From 1e94e41d33a0300074fb6f4cff0b1fe981e77c80 Mon Sep 17 00:00:00 2001 From: Mark Wong Date: Thu, 16 Apr 2020 08:28:48 -0700 Subject: 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. --- machine.h | 4 ++-- pg_top.c | 8 ++++---- 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 */ -- cgit v1.2.3