Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Sep 1998 12:45:31 +0200 (CEST)
From:      Andrzej Bialecki <abial@nask.pl>
To:        freebsd-current@FreeBSD.ORG
Subject:   Adding sysctl, part II
Message-ID:  <Pine.BSF.4.02A.9809091233260.19836-200000@korin.warman.org.pl>

next in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-2020518627-905337931=:19836
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi,

Well, I kind of figured out I probably need to use SYSCTL_PROC, and
applied the following patch to machdep.c:

Index: machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.307
diff -r1.307 machdep.c
213a214,222
> static int
> sysctl_hw_msgbuf SYSCTL_HANDLER_ARGS
> {
> 	return(sysctl_handle_opaque(oidp,msgbufp,MSGBUF_SIZE,req));
> }
> 
> SYSCTL_PROC(_machdep, OID_AUTO, msgbuf, CTLTYPE_STRUCT|CTLFLAG_RD,
> 	0, 0, sysctl_hw_msgbuf, "S,msgbuf","");
> 

and I wrote a simple program to get the info (attached).

BUT... it returns garbage instead of msbguf contents...

Also, there is yet another problem which I need to solve: with above
sysctl I get only the msgbufp contents, and I need to also know the value
of struct msgbuf in order to know where to start and stop reading.

Any suggestions are appreciated...

Andrzej Bialecki

--------------------   ++-------++  -------------------------------------
 <abial@nask.pl>       ||PicoBSD||   FreeBSD in your pocket? Go and see:
 Research & Academic   |+-------+|       "Small & Embedded FreeBSD"
 Network in Poland     | |TT~~~| |    http://www.freebsd.org/~picobsd/
--------------------   ~-+==---+-+  -------------------------------------

--0-2020518627-905337931=:19836
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="test.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.02A.9809091245310.19836@korin.warman.org.pl>
Content-Description: 
Content-Disposition: attachment; filename="test.c"

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5j
bHVkZSA8c3lzL3R5cGVzLmg+DQojaW5jbHVkZSA8c3lzL21zZ2J1Zi5oPg0K
I2luY2x1ZGUgPHN5cy9zeXNjdGwuaD4NCg0KaW50DQptYWluKGludCBhcmdj
LCBjaGFyICphcmd2W10pDQp7DQoJaW50IGksbGVuOw0KCWNoYXIgKm1pYj0i
bWFjaGRlcC5tc2didWYiOw0KCXVfY2hhciAqYnVmOw0KDQoJaT1zeXNjdGxi
eW5hbWUobWliLE5VTEwsJmxlbixOVUxMLE5VTEwpOw0KCWlmKGk8MCkgew0K
CQlwZXJyb3IoInN5c2N0bCIpOw0KCQlleGl0KC0xKTsNCgl9DQoJZnByaW50
ZihzdGRlcnIsImxlbj0lZFxuIixsZW4pOw0KCWJ1Zj0odV9jaGFyICopY2Fs
bG9jKDEsbGVuKTsNCglzeXNjdGxieW5hbWUobWliLGJ1ZiwmbGVuLE5VTEws
TlVMTCk7DQoJZnByaW50ZihzdGRlcnIsImxlbj0lZFxuIixsZW4pOw0KCXdy
aXRlKDEsYnVmLGxlbik7DQp9DQo=
--0-2020518627-905337931=:19836--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.02A.9809091233260.19836-200000>