kern/104436: [PATCH] sys/sem.h should include sys/types.h
Bruce Evans
bde at zeta.org.au
Tue Oct 17 17:10:26 PDT 2006
The following reply was made to PR kern/104436; it has been noted by GNATS.
From: Bruce Evans <bde at zeta.org.au>
To: John Baldwin <jhb at FreeBSD.org>
Cc: Cheng-Lung Sung <clsung at FreeBSD.org>, FreeBSD-gnats-submit at FreeBSD.org
Subject: Re: kern/104436: [PATCH] sys/sem.h should include sys/types.h
Date: Wed, 18 Oct 2006 10:09:04 +1000 (EST)
On Tue, 17 Oct 2006, John Baldwin wrote:
> How's this, it removes extra includes of cdefs.h and _types.h (ipc.h
> already includes them), moves the typedefs earlier and includes them
> in the _KERNEL case (consistent with ipc.h) and fixes the whitespace
> in the typedefs.
OK. POSIX actually requires the namespace pollution with everything in
sys/ipc.h, so the include of this can't be cleaned up and we may as well
depend on its internals.
I did a quick review of symbols in sys/sem.h:
- POSIX seems to overspecify the representation: "A semaphore shall be
respresented by an anonymous struct containing the following members:"
[semval, sempid, semncnt, semzcnt]". FreeBSD doesn't declare any of
these struct members.
- FreeBSD declares several things that aren't required by POSIX and uses
bad names for most of these. The worst ones are the struct member
names `val', `buf' and `array'. POSIX cannot reserve these, and sem.h
mostly uses a `sem' prefix to avoid such pollution. These seem to be
implementation details that don't belong in the header anyway.
I didn't check the symbols imported from sys/ipc.h. Both of these headers
are XSI extensions, so they don't need many visibility ifdefs internally.
Bruce
More information about the freebsd-bugs
mailing list