From owner-svn-src-head@freebsd.org Wed Jun 1 09:32:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE744B57319; Wed, 1 Jun 2016 09:32:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 68B7F1B98; Wed, 1 Jun 2016 09:32:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 8477E4276AB; Wed, 1 Jun 2016 19:31:52 +1000 (AEST) Date: Wed, 1 Jun 2016 19:31:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301071 - head/sys/sys In-Reply-To: <201605311905.u4VJ5geL053766@repo.freebsd.org> Message-ID: <20160601183101.X1028@besplex.bde.org> References: <201605311905.u4VJ5geL053766@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=M8SwUHEs c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=2TT30KpsNie2StMT_LEA:9 a=KWgJyJwKMZXIdalQ:21 a=1cV-WSLL0UF4EQd1:21 a=BIl9eTCUz8m1Y23O:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2016 09:32:02 -0000 On Tue, 31 May 2016, Ed Schouten wrote: > Log: > Improve POSIX conformance of . > > - This header file has always depended on pthread_t, pthread_attr_t, > struct timespec, size_t and uid_t. Only as of POSIX 2008, these > dependencies have been states explicitly. They should now be defined. Not always. POSIX didn't have pthreads or timespecs before about 1993. > - In our implementation, struct sigevent::sigev_notify_attributes has > type "void *" instead of "pthread_attr_t *". My guess is that this was > done to prevent pulling in the pthread types, but this can easily be > avoided by using the underlying structure types. Not easily, since the tags of the underlying struct types are in the application namespace, at least up to POSIX 2001. > Modified: > head/sys/sys/signal.h > > Modified: head/sys/sys/signal.h > ============================================================================== > --- head/sys/sys/signal.h Tue May 31 18:45:52 2016 (r301070) > +++ head/sys/sys/signal.h Tue May 31 19:05:41 2016 (r301071) > @@ -45,6 +45,23 @@ > #include /* __MINSIGSTKSZ */ > #include /* sig_atomic_t; trap codes; sigcontext */ > > +#if __POSIX_VISIBLE >= 200809 > + > +#include This gives the following pollution (which breaks almost everything since includes this header: - struct tag names pthread* - struct member names state and mutex POSIX could reasonably be unimproved by reserving pthread* but not ordinary identifiers like state and mutex. > ... > @@ -160,6 +177,9 @@ union sigval { > #endif > > #if __POSIX_VISIBLE >= 199309 > + > +struct pthread_attr; > + The 1993 version certainly doesn't reserve pthread*. The 1996 version has a nice table of reserved symbols for every header. For signal.h, they are just ones with a prefix of sa_, si_, sigev_ and sival_ (these shall not be declared or #defined by the application), and SIG_, SA_, SI_ and SIGEV_ (these may be used by the application iff they are #undef'ed before use). This doesn't proprtly separate optional things. A draft 2001 version as a not so nice table. The rules are now too tangled to present in a single table, so there are several tables that are hard to parse. The first table has sa_, uc_ (new), SIG[A-Z] (stronger), SIG_[A-Z] (weaker). Then it has ss_ (new) and sv_ (new) for XSI only. Then it has si_, SI_, sigev_, SIGEV_ and sival_ for RTS only. The second table has SA_, SIG_[0-9a-z_] (different/weaker), then massive pollution: BUS_, CLD_, FPE_, ILL_, POLL_, SEGV_, SI_ (now in both tables), SS_, SV_ and TRAP_. A draft 2007 version is like the 2001 version. It fixes the sorting of uc_ and makes RTS non-optional. In the second table, it moves SS_, SV_ and TRAP_ under XSI, and moves POLL_ under OBS XSR. I think pthread is not reserved since it is not in these tables. Later versions of POSIX were broken to allow to be pollutied with all the symbols in , but I don't want to check what is in that now. is slightly simpler in POSIX but much more polluted than in FreeBSD. > struct sigevent { > int sigev_notify; /* Notification type */ > int sigev_signo; /* Signal number */ > @@ -168,7 +188,7 @@ struct sigevent { > __lwpid_t _threadid; Names like _threadid are bogus. sigev is reserved for uses like this. Noy using a prefix makes the namespace random. > struct { > void (*_function)(union sigval); > - void *_attribute; /* pthread_attr_t * */ > + struct pthread_attr **_attribute; pthread is not reserved. pthread*_t is only reserved by the general rule that everything ending in _t is reserved. This also has indentation errors. > } _sigev_thread; > unsigned short _kevent_flags; Further bogus names. At least they use a prefix. > long __spare__[8]; A more bogus name. > @@ -190,6 +210,7 @@ struct sigevent { > #define SIGEV_KEVENT 3 /* Generate a kevent. */ > #define SIGEV_THREAD_ID 4 /* Send signal to a kernel thread. */ It is correct to used the reserved prefix for our extensions, but this style is inconsistent with old parts of the file. In the old parts, we ifdef out extensions to a fault. This makes the code hard to read but provides good documentation of what is portable. > #endif > + > #endif /* __POSIX_VISIBLE >= 199309 */ > > #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE > Bruce