From owner-freebsd-smp Sat Dec 28 10:14:24 2002 Delivered-To: freebsd-smp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E2A4C37B401 for ; Sat, 28 Dec 2002 10:14:22 -0800 (PST) Received: from ada.snu.ac.kr (ada.snu.ac.kr [147.46.106.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 165CF43EA9 for ; Sat, 28 Dec 2002 10:14:22 -0800 (PST) (envelope-from redjade@ada.snu.ac.kr) Received: from ada.snu.ac.kr (ada.snu.ac.kr [147.46.106.49]) by ada.snu.ac.kr (8.12.6/8.12.6) with ESMTP id gBSIEKjC088027; Sun, 29 Dec 2002 03:14:21 +0900 (KST) (envelope-from redjade@ada.snu.ac.kr) Received: (from redjade@localhost) by ada.snu.ac.kr (8.12.6/8.12.6/Submit) id gBSIEKhI088026; Sun, 29 Dec 2002 03:14:20 +0900 (KST) Date: Sun, 29 Dec 2002 03:14:20 +0900 From: Kyunghwan Kim To: Adam K Kirchhoff Cc: freebsd-smp Subject: Re: CPU usage... Message-ID: <20021228181420.GA87711@ada.snu.ac.kr> References: <20021223091038.X71412@sorrow.ashke.com> <20021228130928.GA87308@ada.snu.ac.kr> <20021228084433.J2540@sorrow.ashke.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="uAKRQypu60I7Lcqm" Content-Disposition: inline In-Reply-To: <20021228084433.J2540@sorrow.ashke.com> User-Agent: Mutt/1.4i X-My-Present-Organization: Innuworks, Inc. Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=euc-kr Content-Disposition: inline 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 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=euc-kr Content-Disposition: attachment; filename=diff --- oncpu.c.orig Sat Dec 28 22:05:56 2002 +++ oncpu.c Sun Dec 29 03:09:26 2002 @@ -7,6 +7,7 @@ #include #include #include +#include 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, --uAKRQypu60I7Lcqm-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message