* 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.
This commit is contained in:
Ulrich Drepper 2000-02-24 08:04:43 +00:00
parent 05d5dedc62
commit 9323b58f76
10 changed files with 93 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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