From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 19 15:00:43 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38C6A16A416 for ; Thu, 19 Oct 2006 15:00:43 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C48E443D46 for ; Thu, 19 Oct 2006 15:00:42 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9JF0giD049569 for ; Thu, 19 Oct 2006 15:00:42 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9JF0gpX049568; Thu, 19 Oct 2006 15:00:42 GMT (envelope-from gnats) Date: Thu, 19 Oct 2006 15:00:42 GMT Message-Id: <200610191500.k9JF0gpX049568@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: John Baldwin Cc: Subject: Re: kern/104436: [PATCH] sys/sem.h should include sys/types.h X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John Baldwin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Oct 2006 15:00:43 -0000 The following reply was made to PR kern/104436; it has been noted by GNATS. From: John Baldwin To: Bruce Evans Cc: Cheng-Lung Sung , FreeBSD-gnats-submit@freebsd.org Subject: Re: kern/104436: [PATCH] sys/sem.h should include sys/types.h Date: Thu, 19 Oct 2006 10:39:59 -0400 On Tuesday 17 October 2006 20:09, Bruce Evans wrote: > 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've committed it. > 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. It does, but 'struct sem' is private to kern/sysv_sem.c: struct sem { u_short semval; /* semaphore value */ pid_t sempid; /* pid of last operation */ u_short semncnt; /* # awaiting semval > cval */ u_short semzcnt; /* # awaiting semval = 0 */ }; > - 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. Hmm the 'semun' union is actually passed as an arg to semctl() and the names it uses seem to be standard as Linux, etc. use the same name. > 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. -- John Baldwin