Date: Sun, 29 Dec 2002 03:14:20 +0900 From: Kyunghwan Kim <redjade@ada.snu.ac.kr> To: Adam K Kirchhoff <adamk@voicenet.com> Cc: freebsd-smp <freebsd-smp@FreeBSD.ORG> Subject: Re: CPU usage... Message-ID: <20021228181420.GA87711@ada.snu.ac.kr> In-Reply-To: <20021228084433.J2540@sorrow.ashke.com> References: <20021223091038.X71412@sorrow.ashke.com> <20021228130928.GA87308@ada.snu.ac.kr> <20021228084433.J2540@sorrow.ashke.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Sat, Dec 28, 2002 at 08:45:22AM -0500, Adam K Kirchhoff wrote:
> This is your app? :-)
Yes, it's a totally toy program, ;)
> [ adamk@sorrow ~ ]$ ./oncpu
> Segmentation fault (core dumped)
Usually needs root privilege.
> I'm more than willing to give it a shot again if you think you know what
> the problem is.
Thank you. :) Take another shot with updated.
--
Kyunghwan Kim
redjade@ada.snu.ac.kr
[-- Attachment #2 --]
--- oncpu.c.orig Sat Dec 28 22:05:56 2002
+++ oncpu.c Sun Dec 29 03:09:26 2002
@@ -7,6 +7,7 @@
#include <kvm.h>
#include <limits.h>
#include <stdio.h>
+#include <paths.h>
int
main(void)
@@ -16,7 +17,8 @@
char errbuf[_POSIX2_LINE_MAX];
int nproc, i;
- kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
+ kd = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY,
+ errbuf);
kp = kvm_getprocs(kd, KERN_PROC_ALL, NULL, &nproc);
for (i = nproc; i > 0; i--, kp++) {
printf("PID %d:\tCPU %u\t after %u\t%s\n", kp->ki_pid,
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021228181420.GA87711>
