diff options
| author | tnn <tnn@pkgsrc.org> | 2008-05-23 17:15:14 +0000 |
|---|---|---|
| committer | tnn <tnn@pkgsrc.org> | 2008-05-23 17:15:14 +0000 |
| commit | 8ca66f5d839af263bb04b4bc1e281dfc372043b5 (patch) | |
| tree | a7ba750f0b8b832b526df15d6fa2caa48e8927e0 /shells/pdksh/files/ksh_wait.h | |
| parent | 8a311b3069ee79731eec38ca13eb13772cc49223 (diff) | |
| download | pkgsrc-MRENDEL.tar.gz | |
Import subset of pdksh-5.2.14 distribution.MRENDEL
Only the files required to build it, for pkgsrc bootstrap purposes.
Diffstat (limited to 'shells/pdksh/files/ksh_wait.h')
| -rw-r--r-- | shells/pdksh/files/ksh_wait.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/shells/pdksh/files/ksh_wait.h b/shells/pdksh/files/ksh_wait.h new file mode 100644 index 00000000000..5676fb2b5d4 --- /dev/null +++ b/shells/pdksh/files/ksh_wait.h @@ -0,0 +1,50 @@ +/* Wrapper around the ugly sys/wait includes/ifdefs */ +/* $Id: ksh_wait.h,v 1.1.1.1 2008/05/23 17:15:20 tnn Exp $ */ + +#ifdef HAVE_SYS_WAIT_H +# include <sys/wait.h> +#endif + +#ifndef POSIX_SYS_WAIT +/* Get rid of system macros (which probably use union wait) */ +# undef WIFCORED +# undef WIFEXITED +# undef WEXITSTATUS +# undef WIFSIGNALED +# undef WTERMSIG +# undef WIFSTOPPED +# undef WSTOPSIG +#endif /* POSIX_SYS_WAIT */ + +typedef int WAIT_T; + +#ifndef WIFCORED +# define WIFCORED(s) ((s) & 0x80) +#endif +#define WSTATUS(s) (s) + +#ifndef WIFEXITED +# define WIFEXITED(s) (((s) & 0xff) == 0) +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(s) (((s) >> 8) & 0xff) +#endif +#ifndef WIFSIGNALED +# define WIFSIGNALED(s) (((s) & 0xff) != 0 && ((s) & 0xff) != 0x7f) +#endif +#ifndef WTERMSIG +# define WTERMSIG(s) ((s) & 0x7f) +#endif +#ifndef WIFSTOPPED +# define WIFSTOPPED(s) (((s) & 0xff) == 0x7f) +#endif +#ifndef WSTOPSIG +# define WSTOPSIG(s) (((s) >> 8) & 0xff) +#endif + +#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3) + /* always used with p == -1 */ +# define ksh_waitpid(p, s, o) wait3((s), (o), (struct rusage *) 0) +#else /* !HAVE_WAITPID && HAVE_WAIT3 */ +# define ksh_waitpid(p, s, o) waitpid((p), (s), (o)) +#endif /* !HAVE_WAITPID && HAVE_WAIT3 */ |
