public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH] Some POSIX 2008 header fixes
@ 2010-01-07  1:38 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2010-01-07  1:38 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

This is meant just as a material for discussion, I went through a few
headers and where I've noticed stuff was either added in POSIX 2008, or
moved from XSI to base, I've made a change.  I haven't been hiding
any prototypes etc. that were removed from the standard.
I'm unsure about intptr_t in unistd.h and isnan in math.h, the former
is #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED, but
seems to be in base unistd.h already in POSIX 2003 and maybe earlier,
similarly isnan is #if defined __USE_MISC || defined __USE_XOPEN,
eventhough POSIX 2003 and POSIX 2008 have it in base.  [jy][01n]
which are in the same bits/mathcalls.h #ifdef are correct with __USE_XOPEN
though, as they are XSI extension even in POSIX 2008.

2010-01-07  Jakub Jelinek  <jakub@redhat.com>

	[BZ #11125]
	* signal/signal.h (ucontext_t): Provide even for _POSIX_C_SOURCE
	>= 200809L.
	* stdlib/stdlib.h (sys/wait.h): Likewise.
	(getsubopt): Likewise.
	* io/fcntl.h (sys/stat.h, SEEK_SET, SEEK_CUR, SEEK_END): Likewise.
	* posix/glob.h (size_t): Likewise.
	* posix/sys/wait.h (idtype_t, waitid): Likewise.
	* sys/types.h (id_t, clock_t): Likewise.
	* libio/stdio.h (va_list): Likewise.
	(off_t, off64_t, ssize_t): Provide for _POSIX_C_SOURCE >= 200809L.

--- libc/signal/signal.h.jj	2009-05-16 19:23:37.000000000 +0200
+++ libc/signal/signal.h	2010-01-07 01:40:33.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2003, 2004, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003, 2004, 2007, 2009, 2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -61,8 +62,6 @@ typedef __sigset_t sigset_t;
 # ifndef __pid_t_defined
 typedef __pid_t pid_t;
 #  define __pid_t_defined
-#endif
-#ifdef __USE_XOPEN
 # endif
 # ifndef __uid_t_defined
 typedef __uid_t uid_t;
@@ -354,7 +353,7 @@ extern int sigreturn (struct sigcontext 
 extern int siginterrupt (int __sig, int __interrupt) __THROW;
 
 # include <bits/sigstack.h>
-# ifdef __USE_XOPEN
+# if defined __USE_XOPEN || defined __USE_XOPEN2K8
 /* This will define `ucontext_t' and `mcontext_t'.  */
 #  include <sys/ucontext.h>
 # endif
--- libc/stdlib/stdlib.h.jj	2009-11-02 13:54:31.000000000 +0100
+++ libc/stdlib/stdlib.h	2010-01-07 01:46:06.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2007, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +37,7 @@ __BEGIN_DECLS
 #ifndef __need_malloc_and_calloc
 #define	_STDLIB_H	1
 
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
 /* XPG requires a few symbols from <sys/wait.h> being defined.  */
 # include <bits/waitflags.h>
 # include <bits/waitstatus.h>
@@ -880,7 +880,7 @@ extern int rpmatch (__const char *__resp
 #endif
 
 
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
 /* Parse comma separated suboption from *OPTIONP and match against
    strings in TOKENS.  If found return index and set *VALUEP to
    optional value introduced by an equal sign.  If the suboption is
--- libc/libio/stdio.h.jj	2009-05-16 19:23:35.000000000 +0200
+++ libc/libio/stdio.h	2010-01-07 01:59:04.000000000 +0100
@@ -1,5 +1,5 @@
 /* Define ISO C stdio on top of C++ iostreams.
-   Copyright (C) 1991, 1994-2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994-2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -74,7 +74,7 @@ typedef struct _IO_FILE __FILE;
 
 #include <libio.h>
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # ifdef __GNUC__
 #  ifndef _VA_LIST_DEFINED
 typedef _G_va_list va_list;
@@ -85,6 +85,26 @@ typedef _G_va_list va_list;
 # endif
 #endif
 
+#ifdef __USE_XOPEN2K8
+# ifndef __off_t_defined
+#  ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+#  else
+typedef __off64_t off_t;
+#  endif
+#  define __off_t_defined
+# endif
+# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+#  define __off64_t_defined
+# endif
+
+# ifndef __ssize_t_defined
+typedef __ssize_t ssize_t;
+#  define __ssize_t_defined
+# endif
+#endif
+
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
 __BEGIN_NAMESPACE_STD
 #ifndef __USE_FILE_OFFSET64
--- libc/io/fcntl.h.jj	2009-05-16 19:23:35.000000000 +0200
+++ libc/io/fcntl.h	2010-01-07 02:02:59.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007, 2009
+/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007,2009,2010
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -34,7 +34,7 @@ __BEGIN_DECLS
 #include <bits/fcntl.h>
 
 /* For XPG all symbols from <sys/stat.h> should also be available.  */
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <sys/stat.h>
 #endif
 
@@ -50,7 +50,8 @@ __BEGIN_DECLS
 #endif /* Use misc.  */
 
 /* XPG wants the following symbols.  */
-#ifdef __USE_XOPEN		/* <stdio.h> has the same definitions.  */
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+				/* <stdio.h> has the same definitions.  */
 # define SEEK_SET	0	/* Seek from beginning of file.  */
 # define SEEK_CUR	1	/* Seek from current position.  */
 # define SEEK_END	2	/* Seek from end of file.  */
--- libc/posix/glob.h.jj	2009-05-16 19:23:37.000000000 +0200
+++ libc/posix/glob.h	2010-01-07 02:11:23.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95-98,2000,2001,2004,2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +28,7 @@ __BEGIN_DECLS
 #ifndef __size_t
 # if defined __GNUC__ && __GNUC__ >= 2
 typedef __SIZE_TYPE__ __size_t;
-#  ifdef __USE_XOPEN
+#  if defined __USE_XOPEN || defined __USE_XOPEN2K8
 typedef __SIZE_TYPE__ size_t;
 #  endif
 # else
--- libc/posix/sys/types.h.jj	2009-05-16 19:23:37.000000000 +0200
+++ libc/posix/sys/types.h	2010-01-07 02:19:06.000000000 +0100
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
-   	Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006,
+   2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -101,7 +101,8 @@ typedef __pid_t pid_t;
 # define __pid_t_defined
 #endif
 
-#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined
+#if (defined __USE_SVID || defined __USE_XOPEN || __USE_XOPEN2K8) \
+    && !defined __id_t_defined
 typedef __id_t id_t;
 # define __id_t_defined
 #endif
@@ -124,7 +125,7 @@ typedef __key_t key_t;
 # define __key_t_defined
 #endif
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # define __need_clock_t
 #endif
 #define	__need_time_t
--- libc/posix/sys/wait.h.jj	2009-05-17 13:19:03.000000000 +0200
+++ libc/posix/sys/wait.h	2010-01-07 02:15:22.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009
+/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009,2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -98,7 +98,7 @@ typedef union
 #endif
 
 /* The following values are used by the `waitid' function.  */
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
 typedef enum
 {
   P_ALL,		/* Wait for any child.  */
@@ -138,7 +138,7 @@ extern __pid_t wait (__WAIT_STATUS __sta
    __THROW.  */
 extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
 
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
 # define __need_siginfo_t
 # include <bits/siginfo.h>
 /* Wait for a childing matching IDTYPE and ID to change the status and

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-07  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07  1:38 [RFC PATCH] Some POSIX 2008 header fixes Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).