summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <mark@2ndQuadrant.com>2020-04-16 08:28:48 -0700
committerMark Wong <mark@2ndQuadrant.com>2020-04-16 08:40:39 -0700
commit1e94e41d33a0300074fb6f4cff0b1fe981e77c80 (patch)
treec703bb0a26bf3d881cb5ffc613e377ca4bda8f50
parentb86878d47bc5157558d1a10fde576ce77767f11e (diff)
Set up freebsd for top io stats display
Set of various machines as we go since displaying i/o stats per process is going to be operating system dependent.
-rw-r--r--machine.h4
-rw-r--r--pg_top.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/machine.h b/machine.h
index 525038e..4604a5a 100644
--- a/machine.h
+++ b/machine.h
@@ -115,9 +115,9 @@ void get_system_info(struct system_info *);
caddr_t get_process_info(struct system_info *, struct process_select *, int,
struct pg_conninfo_ctx *, int);
char *format_header(char *);
-#ifdef __linux__
+#if defined(__linux__) || defined (__FreeBSD__)
char *format_next_io(caddr_t);
-#endif /* __linux__ */
+#endif /* defined(__linux__) || defined (__FreeBSD__) */
char *format_next_process(caddr_t);
char *format_next_replication(caddr_t);
uid_t proc_owner(pid_t);
diff --git a/pg_top.c b/pg_top.c
index 768194a..2bb78b2 100644
--- a/pg_top.c
+++ b/pg_top.c
@@ -266,7 +266,7 @@ do_display(struct pg_top_context *pgtctx)
/* Now show the top "n" processes or other statistics. */
switch (pgtctx->mode)
{
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
case MODE_IO_STATS:
for (i = 0; i < active_procs; i++)
{
@@ -276,7 +276,7 @@ do_display(struct pg_top_context *pgtctx)
(*d_process) (i, format_next_io_r(processes));
}
break;
-#endif /* __linux__ */
+#endif /* defined(__linux__) || defined(__FreeBSD__) */
case MODE_REPLICATION:
for (i = 0; i < active_procs; i++)
{
@@ -848,9 +848,9 @@ main(int argc, char *argv[])
/* 0 corresponds to machine headers definitions */
pgtctx.header_options[0][MODE_PROCESSES] = format_header(uname_field);
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
pgtctx.header_options[0][MODE_IO_STATS] = fmt_header_io;
-#endif /* __linux__ */
+#endif /* defined(__linux__) || defined(__FreeBSD__) */
pgtctx.header_options[0][MODE_REPLICATION] = fmt_header_replication;
/* 1 corresponds to headers definitions when remotely connecting to pg */