This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: __WAIT_STATUS
Here is a fix for the sys/wait.h compilation problem.
============================
#include <stdlib.h>
#include <sys/wait.h>
============================
Remember the errors this gave:
In file included from foo.c:2:
/usr/include/sys/wait.h:113: parse error before `__stat_loc'
/usr/include/sys/wait.h:114: parse error before `__stat_loc'
In file included from foo.c:2:
/usr/include/sys/wait.h:161: parse error before `__stat_loc'
/usr/include/sys/wait.h:171: parse error before `__WAIT_STATUS'
2000-04-22 Bruno Haible <haible@clisp.cons.org>
* stdlib/stdlib.h: Test _WAIT_MACROS_DEFINED instead of _SYS_WAIT_H.
* posix/sys/wait.h: Test _WAIT_MACROS_DEFINED instead of _STDLIB_H.
*** ./stdlib/stdlib.h.bak Mon Feb 28 11:38:03 2000
--- ./stdlib/stdlib.h Sat Apr 22 11:29:57 2000
***************
*** 37,45 ****
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
! #if defined __USE_XOPEN && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
# ifdef __USE_BSD
--- 37,51 ----
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
! #if defined __USE_XOPEN && !defined _WAIT_MACROS_DEFINED
! #define _WAIT_MACROS_DEFINED 1
/* XPG requires a few symbols from <sys/wait.h> being defined. */
+
+ /* This will define the `W*' macros for the flag
+ bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
+
+ /* This will define all the `__W*' macros. */
# include <bits/waitstatus.h>
# ifdef __USE_BSD
***************
*** 88,94 ****
# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
! #endif /* X/Open and <sys/wait.h> not included. */
/* Returned by `div'. */
typedef struct
--- 94,101 ----
# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
!
! #endif /* X/Open and _WAIT_MACROS_DEFINED not defined by <sys/wait.h>. */
/* Returned by `div'. */
typedef struct
*** ./posix/sys/wait.h.bak Mon Feb 28 11:37:59 2000
--- ./posix/sys/wait.h Sat Apr 22 11:29:55 2000
***************
*** 35,45 ****
#endif
/* These macros could also be defined int <stdlib.h>. */
! #ifndef _STDLIB_H
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
# ifdef __USE_BSD
/* Lots of hair to allow traditional BSD use of `union wait'
--- 35,50 ----
#endif
/* These macros could also be defined int <stdlib.h>. */
! #ifndef _WAIT_MACROS_DEFINED
! #define _WAIT_MACROS_DEFINED 1
!
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
+ /* This will define all the `__W*' macros. */
+ # include <bits/waitstatus.h>
+
# ifdef __USE_BSD
/* Lots of hair to allow traditional BSD use of `union wait'
***************
*** 79,94 ****
# endif /* Use BSD. */
- /* 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))
! #endif /* <stdlib.h> not included. */
#ifdef __USE_BSD
# define WCOREFLAG __WCOREFLAG
--- 84,97 ----
# endif /* Use BSD. */
# 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 /* _WAIT_MACROS_DEFINED not defined by <stdlib.h>. */
#ifdef __USE_BSD
# define WCOREFLAG __WCOREFLAG