diff options
author | 2015-09-12 15:59:36 +0000 | |
---|---|---|
committer | 2015-09-12 15:59:36 +0000 | |
commit | f0a5b740cf9cc29d720b8728ca99cd8e0a63f994 (patch) | |
tree | f0ac21bd823d6601e06749826a7a5a61bb320dd2 | |
parent | mark up arguments individually and drop redundant .Bk (diff) | |
download | wireguard-openbsd-f0a5b740cf9cc29d720b8728ca99cd8e0a63f994.tar.xz wireguard-openbsd-f0a5b740cf9cc29d720b8728ca99cd8e0a63f994.zip |
use sysctl() to get FSCALE value; ok guenther
-rw-r--r-- | usr.bin/systat/pigs.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index 515d9f22409..f9af1b0e111 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pigs.c,v 1.29 2015/01/16 00:03:37 deraadt Exp $ */ +/* $OpenBSD: pigs.c,v 1.30 2015/09/12 15:59:36 deraadt Exp $ */ /* $NetBSD: pigs.c,v 1.3 1995/04/29 05:54:50 cgd Exp $ */ /*- @@ -98,23 +98,21 @@ field_view views_pg[] = { {NULL, NULL, 0, NULL} }; +int fscale; -#ifdef FSCALE -# define FIXED_LOADAVG FSCALE -# define FIXED_PCTCPU FSCALE -#endif +#define pctdouble(p) ((double)(p) / fscale) -#ifdef FIXED_PCTCPU - typedef long pctcpu; -# define pctdouble(p) ((double)(p) / FIXED_PCTCPU) -#else -typedef double pctcpu; -# define pctdouble(p) (p) -#endif +typedef long pctcpu; int select_pg(void) { + int mib[] = { CTL_KERN, KERN_FSCALE }; + size_t size = sizeof(fscale); + + if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), + &fscale, &size, NULL, 0) < 0) + return (-1); num_disp = pigs_cnt; return (0); } |