Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Feb 2003 00:40:06 -0500 (EST)
From:      Robert Watson <rwatson@FreeBSD.ORG>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Mark Murray <mark@grondar.org>, current@FreeBSD.ORG
Subject:   Re: Style fixups for proc.h 
Message-ID:  <Pine.NEB.3.96L.1030202003329.63806H-100000@fledge.watson.org>
In-Reply-To: <200302020051.h120pXMI018365@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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
robert@fledge.watson.org      Network Associates Laboratories


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030202003329.63806H-100000>