[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what does a number of "_" mean?
On Mon, Nov 03, 2003 at 11:53:22 -0500, Robert Love wrote:
> On Mon, 2003-11-03 at 08:17, Shinpei Kato wrote:
>
> > How about types or variables and functions beggining with one "_"
> > as _exit()?
>
> Underscores tend to denote internal functions, or ones with a
> corresponding functions that are of a "higher level".
>
> There is not any official difference between one and two underscore
> proceeded functions, but I guess two underscore functions would tend to
> be "more internal" than one underscore functions.
Actualy it's the other way around. _ functions are usualy purely
internal. __ functions are usualy "raw" variants.
> For example, consider foo() and __foo(). foo() might obtain requisite
> locks and then call __foo(). The standard interface would be foo(), but
> you could call __foo() if you knew you already held the locks or
> whatever.
... you often want to call such variant from mostly unrelated code
because the calling convention is appropriate. Note, that (except BKL)
locks in kernel are not recursive.
> In the case of the _exit_*() functions, those are internal helper
> functions called by do_exit().
... on the other hand, you never want to call such a helper.
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/