From owner-freebsd-current Wed Sep 9 12:33:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA04830 for freebsd-current-outgoing; Wed, 9 Sep 1998 12:33:40 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from dingo.cdrom.com (dingo.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA04825 for ; Wed, 9 Sep 1998 12:33:38 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost.cdrom.com [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id MAA00801; Wed, 9 Sep 1998 12:33:58 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199809091933.MAA00801@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Andrzej Bialecki cc: Poul-Henning Kamp , freebsd-current@FreeBSD.ORG Subject: Re: Adding sysctl, part II In-reply-to: Your message of "Wed, 09 Sep 1998 14:54:22 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 09 Sep 1998 12:33:57 -0700 From: Mike Smith Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > On Wed, 9 Sep 1998, Poul-Henning Kamp wrote: > > > > > >Well, I kind of figured out I probably need to use SYSCTL_PROC, and > > >applied the following patch to machdep.c: > > > > Look at the > > DDB_SHOW_COMMAND(msgbuf, db_show_msgbuf) > > { > > > > at the bottom of kern/subr_prf.c > > Ah! I see it now - I should be glad it didn't explode in my face... > > 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... Try something like static int sysctl_msgbuf SYSCTL_HANDLER_ARGS { return(sysctl_out(req, msgbufp, MSGBUFLEN)); } SYSCTL_PROC(_kern, OID_AUTO, msgbuf, CTLFLAG_RD, NULL, NULL, sysctl_msgbuf, "S,msgbuf", "kernel message buffer"); -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message