Date: Wed, 2 Sep 1998 10:31:54 +0200 (MET DST) From: Willem Jan Withagen <wjw@surf.IAE.nl> To: luigi@labinfo.iet.unipi.it Cc: hackers@FreeBSD.ORG Subject: Re: kernel sysctl interface question... Message-ID: <199809020831.KAA08769@surf.IAE.nl> In-Reply-To: <199809010757.JAA08942@labinfo.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <199809010757.JAA08942@labinfo.iet.unipi.it> you write: >Hi, > >i notice that some (static) kernel data structures are exported to user >space using the sysctl interface, and that makes life easy for programs >that want to access these things -- examples are statistics etc. > >Now, i wonder if (and then how) i can use the same interface for >exporting dynamic data structures, e.g. things like "struct ifnet" >which are allocated more or less dynamically. In the current structure you can do certain things by creating a static node which "expands" on request through a function-call which mimics certain behaviour. I'm in the process of wanting to rewrite most of the internals, but given my current payload of work. I'm going to settle for less and first try to swap-out the static allocation and repalce with dynamic allocation. Leaving almost all else in place. As such I'm now really delving into the code to stay "compatible". What you want is doable, and from what I'va seen thus far, is also done for getting the routing tables through sysctl. Check the sources of: /usr/sbin/netstat Which will give you the idea on how a sysctl call is made for a dynamic structure /sys/kern/sysctl.c See how it is handled. to start with. --WjW -- Internet Access Eindhoven BV., voice: +31-40-2 393 393, data: +31-40-2 606 606 P.O. 928, 5600 AX Eindhoven, The Netherlands Full Internet connectivity for only fl 12.95 a month. Call now, and login as 'new'. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809020831.KAA08769>