From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 13 13:15:51 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 120DD16A4CE for ; Mon, 13 Sep 2004 13:15:51 +0000 (GMT) Received: from bloodwood.hunterlink.net.au (smtp-local.hunterlink.net.au [203.12.144.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E72F43D54 for ; Mon, 13 Sep 2004 13:15:49 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from [61.8.46.197] (ppp2EC5.dyn.pacific.net.au [61.8.46.197]) i8DDF9Vw024508; Mon, 13 Sep 2004 23:15:10 +1000 From: Sam Lawrance To: Peter Pentchev In-Reply-To: <20040913125107.GB839@straylight.m.ringlet.net> References: <1095078631.77709.53.camel@dirk.no.domain> <20040913125107.GB839@straylight.m.ringlet.net> Content-Type: text/plain Message-Id: <1095081425.77709.62.camel@dirk.no.domain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Mon, 13 Sep 2004 23:17:05 +1000 Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: struct proc - basic question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2004 13:15:51 -0000 On Mon, 2004-09-13 at 22:51, Peter Pentchev wrote: > On Mon, Sep 13, 2004 at 10:30:31PM +1000, Sam Lawrance wrote: > > On Mon, 2004-09-13 at 22:01, Joanna Sledzik wrote: > > > Hi :) > > > I'm very very begginer in Unix system programming. > > > What function should I use to catch the struct proc for some process? > > > Is it possible to get the pointer to struct proc using for example the pid_t pid > > > as an argument? > > > > >From userland, maybe the kvm_* functions will do what you want. > > See the kvm, kvm_open and kvm_getprocs manpages. > > The kern.proc.all sysctl might be a better idea; see my other e-mail for > details. > Is there a functional difference? kvm_getprocs uses the kern.proc sysctls anyway. I did note the comment in the manpage that "these routines do not belong in the kvm interface". -Sam