From owner-freebsd-current Wed Sep 9 07:35:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA20315 for freebsd-current-outgoing; Wed, 9 Sep 1998 07:35:14 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from korin.warman.org.pl (korin.nask.waw.pl [148.81.160.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA20310 for ; Wed, 9 Sep 1998 07:35:09 -0700 (PDT) (envelope-from abial@nask.pl) Received: from localhost (abial@localhost) by korin.warman.org.pl (8.9.1/8.8.5) with SMTP id QAA06791; Wed, 9 Sep 1998 16:39:33 +0200 (CEST) X-Authentication-Warning: korin.warman.org.pl: abial owned process doing -bs Date: Wed, 9 Sep 1998 16:39:33 +0200 (CEST) From: Andrzej Bialecki X-Sender: abial@korin.warman.org.pl To: Jonathan Lemon cc: freebsd-current@FreeBSD.ORG Subject: Re: Adding sysctl, part II In-Reply-To: <19980909092100.52274@right.PCS> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 9 Sep 1998, Jonathan Lemon wrote: > On Sep 09, 1998 at 02:54:22PM +0200, Andrzej Bialecki wrote: > > > > It's still unclear to me, however, what should I do to retrieve not only > > the struct msgbuf (which the msgbufp points to), but the buffer itself as > > well. If I understand this correctly, once I retrieved the struct msgbuf > > contents, the msgbufp->msg_ptr is useless because it points to the data in > > kernel space, so I need to make another call to retrieve the buffer > > contents, right? The code in subr_prf.c can do this because it works in > > kernel space all the time, but I can't... > > Well, if you get the address of the message buffer through msgbufp, > you can then just open /dev/kmem and read the the buffer from that > address. msgbufp points to an area of the allocated size, and the > struct msgbuf is just the first thing in this area. > > This isn't exactly robust to changes, but will do what you want. Ugh.. No. I mean, this will work indeed, thanks for the hint. But: I'll need sgid kmem, and I don't consider it a decent behaviour to peek into kernel brains. Obtaining this via sysctl is much cleaner IMHO. Andrzej Bialecki -------------------- ++-------++ ------------------------------------- ||PicoBSD|| FreeBSD in your pocket? Go and see: Research & Academic |+-------+| "Small & Embedded FreeBSD" Network in Poland | |TT~~~| | http://www.freebsd.org/~picobsd/ -------------------- ~-+==---+-+ ------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message