diff options
author | bde <bde@FreeBSD.org> | 1998-09-10 18:06:28 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-09-10 18:06:28 +0000 |
commit | df1a6eb48bd60e210246bcfde6b57495071c3b09 (patch) | |
tree | e6059c30c675fb41db7aca8d6ac58241f01b52e2 /bin/ps | |
parent | 4da8db7501887d799efbf5cec963030001bee96a (diff) | |
download | FreeBSD-src-df1a6eb48bd60e210246bcfde6b57495071c3b09.zip FreeBSD-src-df1a6eb48bd60e210246bcfde6b57495071c3b09.tar.gz |
Fixed breakage of %CPU and %MEM in the previous commit. sysctlbyname()
was called with wrong args so it always failed.
PR: 7881
Diffstat (limited to 'bin/ps')
-rw-r--r-- | bin/ps/nlist.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/ps/nlist.c b/bin/ps/nlist.c index 47aa6e9..d950e1b 100644 --- a/bin/ps/nlist.c +++ b/bin/ps/nlist.c @@ -31,8 +31,10 @@ * SUCH DAMAGE. */ -#include <sys/time.h> -#include <sys/resource.h> +#include <sys/types.h> +#include <sys/sysctl.h> + +#include <stddef.h> fixpt_t ccpu; /* kernel _ccpu variable */ int nlistread; /* if nlist already read. */ @@ -42,12 +44,16 @@ int fscale; /* kernel _fscale variable */ int donlist() { + size_t oldlen; - if (sysctlbyname("kern.ccpu", &ccpu, sizeof ccpu, 0, 0) < 0) + oldlen = sizeof(ccpu); + if (sysctlbyname("kern.ccpu", &ccpu, &oldlen, NULL, 0) < 0) return (1); - if (sysctlbyname("kern.fscale", &fscale, sizeof fscale, 0, 0) < 0) + oldlen = sizeof(fscale); + if (sysctlbyname("kern.fscale", &fscale, &oldlen, NULL, 0) < 0) return (1); - if (sysctlbyname("hw.availpages", &mempages, sizeof mempages, 0, 0) < 0) + oldlen = sizeof(mempages); + if (sysctlbyname("hw.availpages", &mempages, &oldlen, NULL, 0) < 0) return (1); nlistread = 1; return (0); |