File: ksh_wait.h

package info (click to toggle)
pdksh 5.2.14-20
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,884 kB
  • ctags: 2,293
  • sloc: ansic: 24,016; perl: 944; makefile: 606; sh: 308; sed: 40
file content (50 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Wrapper around the ugly sys/wait includes/ifdefs */
/* $Id$ */

#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 */