Re: a puzzle about FreeBSD

From: Andrey Simonenko (simon_at_comsys.ntu-kpi.kiev.ua)
Date: 11/23/05

  • Next message: Daniel Rudy: "Re: getdirentries_args and other kernel syscall structures"
    Date: Wed, 23 Nov 2005 18:14:53 +0200
    To: gzh@net.pku.edu.cn
    
    

    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.
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Daniel Rudy: "Re: getdirentries_args and other kernel syscall structures"

    Relevant Pages

    • Re: Typdef pointers to structs or not? [from clc]
      ... Are FILE objects guaranteed to be thread-safe in POSIX? ... the typical Unix-like getcmacro examines a character ... buffer is empty to refill it. ... expensive than accessing a few structure members directly, ...
      (comp.std.c)
    • Re: [PATCHv2 04/28] cx25840: treat firmware data as const
      ... FWSEND). ... Though the buffer is small (48 bytes, see above paragraph), it is controlled by a macro and thus leaves open the possibility that it could be accidentally increased to a point where the stack gets overflowed. ...
      (Linux-Kernel)
    • Re: Reading whole text files
      ... > implemented as a macro and that I do not want to make assumptions ... Thanks for reminding me of getc() vs. fgetc. ... >> and the buffer you give to fgets (unless you use the expanding ... >> buffer for that too, which is certainly doable but probably gives ...
      (comp.lang.c)
    • Re: gets() is dead
      ... If the buffer is not large enough you are likely to find it easier to debug since the results will be more predictable, if it is large enough it just means you have to deal with the newline left in the buffer. ... Obviously you do not pass a pointer to this macro. ... I will even hereby grant everyone the permission to use the code illustrated herein for any code of there own for any purpose under any license with one exception. ... If you are publishing my idea outside Usenet then you need my permission and inside Usenet you need to acknowledge it as mine unless you can find prior art. ...
      (comp.lang.c)
    • Re: problem with macro
      ... I am having problems with definition of one macro. ... (declare (dynamic-extent buffer)) ...
      (comp.lang.lisp)