From owner-freebsd-hackers Thu Aug 15 0:19:32 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C198837B400 for ; Thu, 15 Aug 2002 00:19:29 -0700 (PDT) Received: from swan.mail.pas.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6DEFB43E70 for ; Thu, 15 Aug 2002 00:19:29 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0107.cvx40-bradley.dialup.earthlink.net ([216.244.42.107] helo=mindspring.com) by swan.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17fEug-0000lD-00; Thu, 15 Aug 2002 00:19:23 -0700 Message-ID: <3D5B52EA.2594A98@mindspring.com> Date: Thu, 15 Aug 2002 00:06:18 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: ouyang kai Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: About 'sysctl' routine problem? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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