On Sat, 1 Feb 2003, Matthew Dillon wrote:

>     sys/acl.h  -- looks like the authors tried to use the underscore technique
>                 but forgot a couple.

Actually, the pattern is that the function prototypes exposed to userspace
are prefixed with '_' to prevent interfering with the application
namespace.  The ones exposed only in the kernel don't.  I should probably
update the kernel ones as well.  This is mostly because of the profound
evils associated with the C preprocessor, which can cause substitutions to
occur in function prototypes (this is often used intentionally).

For an example of this evil: there appears to be a convention in which we
name structure elements with a prefix, such as m_blah, based on the
structure name.  At one point I added "m_flags" to struct mac.  When I
included mbuf.h, this became m_hdr.mh_flags, resulting in fairly obtuse
compile errors.  Protecting user applications against hard to understand
compile errors is an important part of providing useful include files to
application writers, so avoiding exposing things to the application
namespace where it can be avoided. 

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]      Network Associates Laboratories


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to