From owner-freebsd-current Sat Feb 1 21:40:34 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACD9637B401 for ; Sat, 1 Feb 2003 21:40:33 -0800 (PST) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DDBB43E4A for ; Sat, 1 Feb 2003 21:40:33 -0800 (PST) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.12.6/8.12.5) with SMTP id h125e6P4072338; Sun, 2 Feb 2003 00:40:06 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Sun, 2 Feb 2003 00:40:06 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Matthew Dillon Cc: Mark Murray , current@FreeBSD.ORG Subject: Re: Style fixups for proc.h In-Reply-To: <200302020051.h120pXMI018365@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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