summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-02-24 08:04:43 +0000
committerUlrich Drepper <drepper@redhat.com>2000-02-24 08:04:43 +0000
commit9323b58f76b756cc41b6c39b48d42b697a1bd4ec (patch)
treefa61adb04ca487a090c3e8c5b4eb4b11ee4f7482
parent05d5dedc62e474ec38f2e3646037640629576313 (diff)
downloadglibc-9323b58f76b756cc41b6c39b48d42b697a1bd4ec.tar.gz
glibc-9323b58f76b756cc41b6c39b48d42b697a1bd4ec.tar.xz
glibc-9323b58f76b756cc41b6c39b48d42b697a1bd4ec.zip
Update.
	* posix/sys/wait.h: Pretty printing.  Allow WEXITSTATUS etc be
	defined elsewhere.
	* stdlib/stdlib.h [__USE_XOPEN]: Define WEXITSTATUS etc.
	* sysdeps/generic/bits/waitflags.h: Allow including from stdlib.h.
	* sysdeps/unix/bsd/bits/waitflags.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/waitflags.h: Likewise.
	* sysdeps/unix/sysv/sysv4/bits/waitflags.h: Likewise.
	* sysdeps/generic/bits/waitstatus.h: Likewise.
-rw-r--r--ChangeLog9
-rw-r--r--bits/waitflags.h4
-rw-r--r--bits/waitstatus.h4
-rw-r--r--posix/sys/wait.h20
-rw-r--r--stdlib/stdlib.h65
-rw-r--r--sysdeps/generic/bits/waitflags.h4
-rw-r--r--sysdeps/generic/bits/waitstatus.h4
-rw-r--r--sysdeps/unix/bsd/bits/waitflags.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/waitflags.h2
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/waitflags.h4
10 files changed, 93 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 03536a6227..abe8633216 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2000-02-23  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/sys/wait.h: Pretty printing.  Allow WEXITSTATUS etc be
+	defined elsewhere.
+	* stdlib/stdlib.h [__USE_XOPEN]: Define WEXITSTATUS etc.
+	* sysdeps/generic/bits/waitflags.h: Allow including from stdlib.h.
+	* sysdeps/unix/bsd/bits/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/bits/waitflags.h: Likewise.
+	* sysdeps/generic/bits/waitstatus.h: Likewise.
+
 	* posix/wordexp.c: Use we_offs everywhere if WRDE_DOOFS.  Expand ~
 	correctly.  Detect syntax errors in command substitutions.  Delete
 	trailing newlines correctly.  Don't split fields in command
diff --git a/bits/waitflags.h b/bits/waitflags.h
index 596df932b7..bd7d17de74 100644
--- a/bits/waitflags.h
+++ b/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997, 2000 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
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/bits/waitstatus.h b/bits/waitstatus.h
index 1ec55107f9..1736717e5a 100644
--- a/bits/waitstatus.h
+++ b/bits/waitstatus.h
@@ -1,5 +1,5 @@
 /* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1996, 1997, 2000 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
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index 5a3404d6a7..4af77b070d 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,96,97,98,99, 2000 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
@@ -66,8 +66,8 @@ typedef union
     union wait *__uptr;
     int *__iptr;
   } __WAIT_STATUS __attribute__ ((__transparent_union__));
-# define __WAIT_STATUS_DEFN	int *
-#endif
+#  define __WAIT_STATUS_DEFN	int *
+# endif
 
 #else /* Don't use BSD.  */
 
@@ -80,12 +80,14 @@ typedef union
 /* This will define all the `__W*' macros.  */
 #include <bits/waitstatus.h>
 
-#define	WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
-#define	WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
-#define	WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
-#define	WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
-#define	WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
-#define	WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
+/* These macros could also be defined int <stdlib.h>.  */
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
+# define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
+# define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
+# define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
+# define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
+# define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
 
 #ifdef	__USE_BSD
 # define WCOREFLAG		__WCOREFLAG
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 3448553e11..db624dea16 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000 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
@@ -32,6 +32,61 @@
 #endif
 #include <stddef.h>
 
+#ifdef __USE_XOPEN
+/* XPG requires a few symbols from <sys/wait.h> being defined.  */
+# include <bits/waitflags.h>
+# include <bits/waitstatus.h>
+
+# ifndef WEXITSTATUS
+#  ifdef __USE_BSD
+
+/* Lots of hair to allow traditional BSD use of `union wait'
+   as well as POSIX.1 use of `int' for the status word.  */
+
+#   if defined __GNUC__ && !defined __cplusplus
+#    define __WAIT_INT(status)						      \
+  (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
+		    __u.__in = (status); __u.__i; }))
+#   else
+#    define __WAIT_INT(status)	(*(int *) &(status))
+#   endif
+
+/* This is the type of the argument to `wait'.  The funky union
+   causes redeclarations with ether `int *' or `union wait *' to be
+   allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
+   the actual function definitions.  */
+
+#   if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
+#    define __WAIT_STATUS	void *
+#    define __WAIT_STATUS_DEFN	void *
+#   else
+/* This works in GCC 2.6.1 and later.  */
+typedef union
+  {
+    union wait *__uptr;
+    int *__iptr;
+  } __WAIT_STATUS __attribute__ ((__transparent_union__));
+#    define __WAIT_STATUS_DEFN	int *
+#   endif
+
+#  else /* Don't use BSD.  */
+
+#   define __WAIT_INT(status)	(status)
+#   define __WAIT_STATUS	int *
+#   define __WAIT_STATUS_DEFN	int *
+
+#  endif /* Use BSD.  */
+
+/* Define the macros <sys/wait.h> also would define this way.  */
+#  define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
+#  define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
+#  define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
+#  define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
+#  define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
+#  define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
+# endif
+#endif
+
 __BEGIN_DECLS
 
 #ifndef __need_malloc_and_calloc
@@ -350,12 +405,12 @@ extern void srandom (unsigned int __seed) __THROW;
    of length STATELEN, and seed it with SEED.  Optimal lengths are 8, 16,
    32, 64, 128 and 256, the bigger the better; values less than 8 will
    cause an error and values greater than 256 will be rounded down.  */
-extern void *initstate (unsigned int __seed, void *__statebuf,
+extern char *initstate (unsigned int __seed, char *__statebuf,
 			size_t __statelen) __THROW;
 
 /* Switch the random number generator to state buffer STATEBUF,
    which should have been previously initialized by `initstate'.  */
-extern void *setstate (void *__statebuf) __THROW;
+extern char *setstate (__const char *__statebuf) __THROW;
 
 
 # ifdef __USE_MISC
@@ -379,11 +434,11 @@ extern int random_r (struct random_data *__restrict __buf,
 
 extern int srandom_r (unsigned int __seed, struct random_data *__buf) __THROW;
 
-extern int initstate_r (unsigned int __seed, void *__restrict __statebuf,
+extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
 			size_t __statelen,
 			struct random_data *__restrict __buf) __THROW;
 
-extern int setstate_r (void *__restrict __statebuf,
+extern int setstate_r (char *__restrict __statebuf,
 		       struct random_data *__restrict __buf) __THROW;
 # endif	/* Use misc.  */
 #endif	/* Use SVID || extended X/Open.  */
diff --git a/sysdeps/generic/bits/waitflags.h b/sysdeps/generic/bits/waitflags.h
index 596df932b7..bd7d17de74 100644
--- a/sysdeps/generic/bits/waitflags.h
+++ b/sysdeps/generic/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997, 2000 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
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h
index 1ec55107f9..1736717e5a 100644
--- a/sysdeps/generic/bits/waitstatus.h
+++ b/sysdeps/generic/bits/waitstatus.h
@@ -1,5 +1,5 @@
 /* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1996, 1997, 2000 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
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/sysdeps/unix/bsd/bits/waitflags.h b/sysdeps/unix/bsd/bits/waitflags.h
index 47fc6ea1b7..e9e6c99214 100644
--- a/sysdeps/unix/bsd/bits/waitflags.h
+++ b/sysdeps/unix/bsd/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.  Hurd version.
-   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997, 2000 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
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H<
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h
index afc8b22295..b854dd333a 100644
--- a/sysdeps/unix/sysv/linux/bits/waitflags.h
+++ b/sysdeps/unix/sysv/linux/bits/waitflags.h
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
diff --git a/sysdeps/unix/sysv/sysv4/bits/waitflags.h b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
index e99dc00511..841f8a303b 100644
--- a/sysdeps/unix/sysv/sysv4/bits/waitflags.h
+++ b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -18,7 +18,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif