Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2002 00:06:18 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        ouyang kai <oykai@msn.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: About 'sysctl' routine problem?
Message-ID:  <3D5B52EA.2594A98@mindspring.com>
References:  <OE51W8jERqdZ7wql06T0001ea41@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
ouyang kai wrote:
> 
>    Part 1.1    Type: Plain Text (text/plain)
>            Encoding: quoted-printable

| Hi guys,
|   In the "TCP/IP Illustrated, Volume2: The Implementation" book,
| there give 'ioctl' and 'sysctl' in the kernel routine.
|   ioctl -> sooioctl->(interface)ifioctl.....
|   sysctl-> net_sysctl -> pr_sysctl -> ip_sysctl....
|   Now, I can find the corresponding code about 'ioctl' routine.
| But, I could not find any code about 'sysctl', why?
| how the FreeBSD realize the corresponding functions?
|    Thank you!

The book is not applicable to the sysctl implementation.

Pick a sysctl by the terminal name, search for the name in the
source code, and then expand the macros.

Once again, we are talking about linker sets.  This is a little
more complex, though, since you have to take the "boot environment"
into account, as well (the boot environment is the basis for a
preinitialized sysctl space contents, seperate from the code you
see in the kernel itself for the declarations of specific sysctl
OIDs that are added to the ones exported before the kernel is even
really started.

Research:

	TUNABLE_INT_DECL
	TUNABLE_INT_FETCH
	SYSCTL_DECL
	SYSCTL_NODE
	SYSCTL_INT
	SYSCTL_STRUCT
	SYSCTL_PROC

Start with:

	cd /usr/src/sys/netinet
	grep SYSCTL *

And looking at: /usr/src/sys/sys/sysctl.h

See also:

        SI_SUB_TUNABLES         = 0x0700000,    /* establish tunable values */

in /usr/src/sys/sys/kernel.h.

-- Terry

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?3D5B52EA.2594A98>