From owner-freebsd-threads@FreeBSD.ORG Sat Aug 20 05:48:35 2005 Return-Path: X-Original-To: threads@FreeBSD.org Delivered-To: freebsd-threads@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A4C016A41F; Sat, 20 Aug 2005 05:48:35 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id D35A843D45; Sat, 20 Aug 2005 05:48:34 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j7K5mXJT030470; Sat, 20 Aug 2005 15:48:33 +1000 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j7K5mV27011478; Sat, 20 Aug 2005 15:48:32 +1000 Date: Sat, 20 Aug 2005 15:48:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Stefan Farfeleder In-Reply-To: <20050819183507.GE77069@wombat.fafoe.narf.at> Message-ID: <20050820151252.L60332@delplex.bde.org> References: <20050819093649.GU21905@wombat.fafoe.narf.at> <20050819231640.E2640@epsplex.bde.org> <20050819183507.GE77069@wombat.fafoe.narf.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: threads@FreeBSD.org, standards@FreeBSD.org Subject: Re: includes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2005 05:48:35 -0000 On Fri, 19 Aug 2005, Stefan Farfeleder wrote: > On Sat, Aug 20, 2005 at 12:04:56AM +1000, Bruce Evans wrote: >> On Fri, 19 Aug 2005, Stefan Farfeleder wrote: >> >>> I think some of the headers included by violate the POSIX >>> specification (I'm looking at SUSv3/POSIX 1003.1 2004) by making more >>> symbols visible than allowed. >>> >>> Ok >>> Ok >>> Ok >>> No? (POSIX allows which is a subset) > ^^^^^^ > Actually POSIX kind of requires the inclusion of (and > ). At least all symbols must be visible. Urk. This seems to be the place in POSIX where namespace pollution is explictly required. According to an old draft: %%% 10351 Inclusion of the header shall make symbols defined in the headers and 10352 visible. %%% Everywhere else, POSIX permits both broken and non-broken implementations by saying "may make visible". The history of this is interesting: %%% 10408 IEEE PASC Interpretation 1003.1 #86 is applied, allowing the symbols from and 10409 to be made visible when is included. Previously this was an XSI 10410 extension. %%% The weasels who wrote "may" were apparently not present when this was interpreted :-). %%% 10411 IEEE PASC Interpretation 1003.1c #42 is applied, removing the requirement for prototypes for 10412 the pthread_kill ( ) and pthread_sigmask( ) functions. These are required to be in the 10413 header. They are allowed here through the name space rules. %%% sigset_t apparently isn't required here either. >> needed, but can be obtained as a side effect >> of including almost any other header in the list. >> only used to declare size_t. We handle this better >> in many other headers. The old draft of POSIX that >> I'm looking at doesn't say that declares >> size_t, so it might be conformant to use __size_t >> in the prototypes. > > Removed, size_t is obtained via . OK. >> ... >> only used to declare sigset_t and struct timespec. >> We have a whole header, , to help >> declare sigset_t better (it only declares >> __sigset_t), > ... > I've include (for __uint32_t) and > instead. timespec is declared through . Too bad. >> Just namespace pollution. > > We need MINSIGSTKSZ from though. The patch includes > that header instead and protects its usage with __XSI_VISIBLE. I'm not > happy with this, maybe MINSIGSTKSZ should be moved somewhere else? MINSIGSTKSZ is used to define PTHREAD_STACK_MIN. I didn't notice this partly because the old version that I looked at correctly defiens PTHREAD_STACK_MIN as a constant. Everything is wrong here: - POSIX requires PTHREAD_STACK_MIN to be defined (if at all) in but not in . - PTHREAD_STACK_MIN must be defined as a number (if at all even if XSI is no visible. >> Just namespace pollution. > > is included instead and __ULONG_MAX is used. __ULONG_MAX is used to define PTHREAD_THREADS_MAX. POSIX actually requires the latter to be defined (if at all) in only too. I doubt that the limit is actually 2^64-1. Maybe it should be a runtime limit _SC_THREAD* are missing, so apparently no one ever asks for the runtime limits. >> only used to declare struct sched_param and to >> satisfy a POSIX mistake. A forward declaration >> would suffice. > > Left because POSIX says so. Not too bad. > The patch for is at > http://people.freebsd.org/~stefanf/pthread.h.diff . > > There are a few files that need , , etc symbols and > get them by inclusion, the patch at > http://people.freebsd.org/~stefanf/pthread.h-2.diff fixes that. It > should probably be committed anyway. An alarming number. We shouldn't need so many new includes of , Bruce