Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Nov 2005 18:14:53 +0200
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        gzh@net.pku.edu.cn
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: a puzzle about FreeBSD
Message-ID:  <20051123161453.GA606@pm513-1.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <200511191408.jAJE8KGl024009@net.pku.edu.cn>
References:  <200511191408.jAJE8KGl024009@net.pku.edu.cn>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 19, 2005 at 09:51:58PM +0800, ?????? wrote:
> 
> I read the source code of a project. I don??t understand SYSCTL_IN macro and
> SYSCTL_PROC macro. I want to know when my function registered in SYSCTL_PROC
> is called.

This sysctl handler is called, for example, from __sysctl ->
userland_sysctl -> sysctl_root as oid_handler, which is setuped,
when SYSCTL_PROC declared struct sysctl_oid{}.

SYSCTL_IN/OUT are used for copying to/from one buffer to another
buffer with advancing pointers and offsets of buffers.  Since
there are two spaces userland and kernel, but interface should
be general, there are two functions oldfunc and newfunc in struct
sysctl_req{}, which are defined to sysctl_{new,old}_{kernel,user},
depending from which space it is necessary to make sysctl call.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051123161453.GA606>