diff mbox

conformtest: clean up POSIX expectations for sys/mman.h, sys/stat.h, sys/types.h

Message ID Pine.LNX.4.64.1405152141190.911@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers May 15, 2014, 9:43 p.m. UTC
Continuing the series of patches to clean up conformtest expectations
for "POSIX" (1995/6) based on review of the expectations against the
standard, this patch cleans up expectations for sys/mman.h, sys/stat.h
and sys/types.h.  Tested x86_64; no new XFAILs needed.

2014-05-15  Joseph Myers  <joseph@codesourcery.com>

	* conform/data/sys/mman.h-data [POSIX] (size_t): Do not require
	type.
	[POSIX] (off_t): Likewise.
	* conform/data/sys/stat.h-data (S_IRGRP): Require constant.
	[POSIX] (S_ISBLK): Require macro.
	[POSIX] (S_ISCHR): Likewise.
	[POSIX] (S_ISDIR): Likewise.
	[POSIX] (S_ISFIFO): Likewise.
	[POSIX] (S_ISREG): Likewise.
	[POSIX || XPG3 || XPG4 || UNIX98] (S_TYPEISTMO): Do not list
	optional-macro.
	* conform/data/sys/types.h-data [POSIX] (blkcnt_t): Do not require
	type.
	[POSIX] (time_t): Likewise.
	[POSIX] (timer_t): Likewise.

Comments

Joseph Myers May 22, 2014, 2:43 p.m. UTC | #1
Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-05/msg00391.html> is pending 
review.
Joseph Myers May 30, 2014, 9:58 p.m. UTC | #2
Ping^2.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-05/msg00391.html> is still 
pending review.
Joseph Myers June 6, 2014, 4:40 p.m. UTC | #3
Ping^3.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-05/msg00391.html> is still 
pending review.
Siddhesh Poyarekar June 11, 2014, 5:58 p.m. UTC | #4
On Thu, May 15, 2014 at 09:43:05PM +0000, Joseph S. Myers wrote:
> diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
> index 0555fd1..3a88684 100644
> --- a/conform/data/sys/mman.h-data
> +++ b/conform/data/sys/mman.h-data
> @@ -39,8 +39,10 @@ optional-function int posix_typed_mem_get_info (int, struct posix_typed_mem_info
>  optional-function int posix_typed_mem_open (const char*, int, int)
>  # endif
>  
> +# ifndef POSIX
>  type size_t
>  type off_t
> +# endif

The earliest POSIX I could access (2001) as this text:

    The size_t and off_t types are defined as described in
    <sys/types.h>.

Since I didn't have a copy of the POSIX 1995/6, Carlos suggested I
look at the next best available thing, which was the Susv1 and that
too had the same text.  Wouldn't that make this change incorrect?

>  type suseconds_t
>  # endif
> +# ifndef POSIX
>  type time_t

The Susv1 has time_t in sys/types.h.

Siddhesh
Siddhesh Poyarekar June 11, 2014, 6:10 p.m. UTC | #5
On Wed, Jun 11, 2014 at 11:28:05PM +0530, Siddhesh Poyarekar wrote:
> On Thu, May 15, 2014 at 09:43:05PM +0000, Joseph S. Myers wrote:
> > diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
> > index 0555fd1..3a88684 100644
> > --- a/conform/data/sys/mman.h-data
> > +++ b/conform/data/sys/mman.h-data
> > @@ -39,8 +39,10 @@ optional-function int posix_typed_mem_get_info (int, struct posix_typed_mem_info
> >  optional-function int posix_typed_mem_open (const char*, int, int)
> >  # endif
> >  
> > +# ifndef POSIX
> >  type size_t
> >  type off_t
> > +# endif
> 
> The earliest POSIX I could access (2001) as this text:
> 
>     The size_t and off_t types are defined as described in
>     <sys/types.h>.
> 
> Since I didn't have a copy of the POSIX 1995/6, Carlos suggested I
> look at the next best available thing, which was the Susv1 and that
> too had the same text.  Wouldn't that make this change incorrect?
> 
> >  type suseconds_t
> >  # endif
> > +# ifndef POSIX
> >  type time_t
> 
> The Susv1 has time_t in sys/types.h.

I went through your second similar patch proposal for wait.h and the
number of inconsistencies leads me to believe that I am getting
something wrong, especially since I'm not even looking at the exact
document you cited for verification.  I'll defer review to someone who
actually has access to the document or has other means to verify the
change.

Siddhesh
Joseph Myers June 11, 2014, 6:44 p.m. UTC | #6
On Wed, 11 Jun 2014, Siddhesh Poyarekar wrote:

> On Thu, May 15, 2014 at 09:43:05PM +0000, Joseph S. Myers wrote:
> > diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
> > index 0555fd1..3a88684 100644
> > --- a/conform/data/sys/mman.h-data
> > +++ b/conform/data/sys/mman.h-data
> > @@ -39,8 +39,10 @@ optional-function int posix_typed_mem_get_info (int, struct posix_typed_mem_info
> >  optional-function int posix_typed_mem_open (const char*, int, int)
> >  # endif
> >  
> > +# ifndef POSIX
> >  type size_t
> >  type off_t
> > +# endif
> 
> The earliest POSIX I could access (2001) as this text:
> 
>     The size_t and off_t types are defined as described in
>     <sys/types.h>.
> 
> Since I didn't have a copy of the POSIX 1995/6, Carlos suggested I
> look at the next best available thing, which was the Susv1 and that
> too had the same text.  Wouldn't that make this change incorrect?

No.  POSIX.1:1995/6 does not have the header definition manpages from the 
Single Unix sequence of documents that were used as a basis for 2001 and 
later editions of POSIX, and those often include things that weren't in 
earlier versions of POSIX - not always XSI-conditional.  (In particular, 
cases where a function prototype uses a type have typically moved towards 
POSIX requiring that type to be defined in the header using it, rather 
than allowing the function to be declared with an implementation-namespace 
version __*_t without *_t itself being defined.  Other cases, such as 
where there was a permission for a header to include several other 
complete headers because of a few types used from those headers, have more 
often remained XSI-conditional.)

* These types are not listed in Annex C (not normative and not always to 
be trusted, but a good starting point for indications of what goes in each 
header before going through relevant normative content in more detail).

* The sys/mman.h header definition (section 12) lists various functions 
and constants but does not say anything about types being defined in this 
header (they are of course permitted, as part of the general permission to 
define *_t types in all POSIX headers).

> >  type suseconds_t
> >  # endif
> > +# ifndef POSIX
> >  type time_t
> 
> The Susv1 has time_t in sys/types.h.

Table 2-1 in POSIX.1:1995/6, listing sys/types.h contents, does not.
Siddhesh Poyarekar June 11, 2014, 7:03 p.m. UTC | #7
On Wed, Jun 11, 2014 at 06:44:05PM +0000, Joseph S. Myers wrote:
> No.  POSIX.1:1995/6 does not have the header definition manpages from the 
> Single Unix sequence of documents that were used as a basis for 2001 and 
> later editions of POSIX, and those often include things that weren't in 
> earlier versions of POSIX - not always XSI-conditional.  (In particular, 
> cases where a function prototype uses a type have typically moved towards 
> POSIX requiring that type to be defined in the header using it, rather 
> than allowing the function to be declared with an implementation-namespace 
> version __*_t without *_t itself being defined.  Other cases, such as 
> where there was a permission for a header to include several other 
> complete headers because of a few types used from those headers, have more 
> often remained XSI-conditional.)
> 
> * These types are not listed in Annex C (not normative and not always to 
> be trusted, but a good starting point for indications of what goes in each 
> header before going through relevant normative content in more detail).
> 
> * The sys/mman.h header definition (section 12) lists various functions 
> and constants but does not say anything about types being defined in this 
> header (they are of course permitted, as part of the general permission to 
> define *_t types in all POSIX headers).
> 
> > >  type suseconds_t
> > >  # endif
> > > +# ifndef POSIX
> > >  type time_t
> > 
> > The Susv1 has time_t in sys/types.h.
> 
> Table 2-1 in POSIX.1:1995/6, listing sys/types.h contents, does not.

Thanks, that explains the difference I am seeing.  I think your
explanation ought to be sufficient validation for this patch, but if
you think this needs further review then please wait for someone else
to do that since without the document, I cannot add anything to this
beyond positive testing on the same architectures that you have
already tested, i.e. x86.

Siddhesh
Florian Weimer June 12, 2014, 9:45 a.m. UTC | #8
On 05/15/2014 11:43 PM, Joseph S. Myers wrote:
> Continuing the series of patches to clean up conformtest expectations
> for "POSIX" (1995/6) based on review of the expectations against the
> standard, this patch cleans up expectations for sys/mman.h, sys/stat.h
> and sys/types.h.  Tested x86_64; no new XFAILs needed.

Could you please provide a precise citation for "POSIX" (1995/6)?  I'm 
trying to get a copy, and want to make sure I get the right one.
Joseph Myers June 12, 2014, 12:17 p.m. UTC | #9
On Thu, 12 Jun 2014, Florian Weimer wrote:

> On 05/15/2014 11:43 PM, Joseph S. Myers wrote:
> > Continuing the series of patches to clean up conformtest expectations
> > for "POSIX" (1995/6) based on review of the expectations against the
> > standard, this patch cleans up expectations for sys/mman.h, sys/stat.h
> > and sys/types.h.  Tested x86_64; no new XFAILs needed.
> 
> Could you please provide a precise citation for "POSIX" (1995/6)?  I'm trying
> to get a copy, and want to make sure I get the right one.

"POSIX" in conformtest is testing _POSIX_C_SOURCE=199506L (well, it's 
currently testing _POSIX_C_SOURCE=199912, but there's no difference in 
what they enable in glibc and it should be fixed to test 
_POSIX_C_SOURCE=199506L).  That means the union of the symbols defined by

ISO/IEC 9945-1:1996 (ANSI/IEEE Std 1003.1, 1996 Edition) (ISBN 
1-55937-573-6)

and

ISO/IEC 9945-2:1993 (ANSI/IEEE Std 1003.2-1992) (my copy bears ISBN 
1-55937-255-9 but comes with a correction slip saying it should be 
1-55937-406-3).

For limits.h, stdio.h and unistd.h you need to take the union of the 
symbols from POSIX.1 and POSIX.2.  The other headers are only in one or 
another of the standards.

The last time I checked, the 1993 edition of POSIX.1 (POSIX.1b) was 
available on IEEE Xplore (downloadable as a 42MB PDF given a site 
subscription to IEEE Xplore), but not the 1995/6 or 1990 editions (both of 
which I have in paper form).  I'd hope once the review of "POSIX" is 
complete to rename that standard in conformtest to POSIX95 and extend the 
support to versions that glibc supports but conformtest doesn't currently 
cover (the 2001 edition without XSI extensions, 1993 + POSIX.2, 
POSIX.1:1990 + POSIX.2, POSIX.1:1990).  Once we have POSIX.1:1990 support 
in conformtest we can remove posix/annexc, which is a bit confused about 
what it's testing (it uses _POSIX_SOURCE, i.e. POSIX.1:1990, but the 
expectations are based on a more recent version, probably 1995/6).  With 
C90 Amendment 1 support in conformtest we can remove stdlib/isomac.  With 
both removed, we can eliminate $(native-compile) (see discussion in April 
2012 about how we'd like to do so).

There was some discussion in the Austin Group about making older standards 
and drafts available but I haven't noticed progress there lately.
diff mbox

Patch

diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
index 0555fd1..3a88684 100644
--- a/conform/data/sys/mman.h-data
+++ b/conform/data/sys/mman.h-data
@@ -39,8 +39,10 @@  optional-function int posix_typed_mem_get_info (int, struct posix_typed_mem_info
 optional-function int posix_typed_mem_open (const char*, int, int)
 # endif
 
+# ifndef POSIX
 type size_t
 type off_t
+# endif
 
 function int mlock (const void*, size_t)
 function int mlockall (int)
diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data
index 41c3932..631daa4 100644
--- a/conform/data/sys/stat.h-data
+++ b/conform/data/sys/stat.h-data
@@ -66,6 +66,7 @@  constant S_IRUSR
 constant S_IWUSR
 constant S_IXUSR
 constant S_IRWXG
+constant S_IRGRP
 constant S_IWGRP
 constant S_IXGRP
 constant S_IRWXO
@@ -78,12 +79,12 @@  constant S_ISGID
 constant S_ISVTX
 #endif
 
-#if !defined POSIX
 macro S_ISBLK
 macro S_ISCHR
 macro S_ISDIR
 macro S_ISFIFO
 macro S_ISREG
+#if !defined POSIX
 macro S_ISLNK
 macro S_ISSOCK
 #endif
@@ -92,7 +93,9 @@  macro S_ISSOCK
 optional-macro S_TYPEISMQ
 optional-macro S_TYPEISSEM
 optional-macro S_TYPEISSHM
+# if !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
 optional-macro S_TYPEISTMO
+# endif
 
 # if defined XOPEN2K8 || defined POSIX2008
 constant UTIME_NOW
diff --git a/conform/data/sys/types.h-data b/conform/data/sys/types.h-data
index cda1954..36c5efa 100644
--- a/conform/data/sys/types.h-data
+++ b/conform/data/sys/types.h-data
@@ -1,6 +1,6 @@ 
 #if !defined ISO && !defined ISO99 && !defined ISO11
-type blkcnt_t
 #if !defined POSIX
+type blkcnt_t
 type blksize_t
 type clock_t
 type clockid_t
@@ -48,8 +48,10 @@  type ssize_t
 # if !defined POSIX && !defined POSIX2008
 type suseconds_t
 # endif
+# ifndef POSIX
 type time_t
 type timer_t
+# endif
 type uid_t
 
 allow *_t