summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-09-10 18:06:28 +0000
committerbde <bde@FreeBSD.org>1998-09-10 18:06:28 +0000
commitdf1a6eb48bd60e210246bcfde6b57495071c3b09 (patch)
treee6059c30c675fb41db7aca8d6ac58241f01b52e2 /bin/ps
parent4da8db7501887d799efbf5cec963030001bee96a (diff)
downloadFreeBSD-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.c16
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);
OpenPOWER on IntegriCloud