1 ?RCS: $Id: d_uwait.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
11 ?RCS: $Log: d_uwait.U,v $
12 ?RCS: Revision 3.0.1.1 1994/01/24 14:10:49 ram
13 ?RCS: patch16: added knowledge about wait3()
14 ?RCS: patch16: revised 'union wait' look-up algorithm
15 ?RCS: patch16: fixed make dependency line accordingly
17 ?RCS: Revision 3.0 1993/08/18 12:07:54 ram
18 ?RCS: Baseline for dist 3.0 netwide release.
20 ?MAKE:d_uwait d_uwait3: cat contains cppstdin cppminus +cppflags rm \
22 ?MAKE: -pick add $@ %<
24 ?S: This symbol conditionally defines UNION_WAIT which indicates to the C
25 ?S: program that argument for the wait() system call should be declared as
26 ?S: 'union wait status' instead of 'int status'.
29 ?S: This symbol conditionally defines UNION_WAIT3 which indicates to the C
30 ?S: program that the first argument for the wait3() system call should be
31 ?S: declared as 'union wait status' instead of 'int status'.
34 ?C: This symbol if defined indicates to the C program that the argument
35 ?C: for the wait() system call should be declared as 'union wait status'
36 ?C: instead of 'int status'. You probably need to include <sys/wait.h>
37 ?C: in the former case (see I_SYSWAIT).
40 ?C: This symbol if defined indicates to the C program that the first argument
41 ?C: for the wait3() system call should be declared as 'union wait status'
42 ?C: instead of 'int status'. You probably need to include <sys/wait.h>
43 ?C: in the former case (see I_SYSWAIT). It seems safe to assume that the
44 ?C: same rule applies to the second parameter of wait4().
46 ?H:#$d_uwait UNION_WAIT /**/
47 ?H:#$d_uwait3 UNION_WAIT3 /**/
50 ?LINT:set d_uwait d_uwait3
51 : see if union wait is available
54 ?X: Unfortunately, we can't just grep <sys/wait.h> for "union wait" because
55 ?X: some weird systems (did I hear HP-UX?) define union wait only when _BSD
56 ?X: is defined. The same thing happens on OSF/1, who is pushing weirdness to
57 ?X: its limits by requiring wait() to use (int *) but wait3() to use
58 ?X: (union wait *), unless _BSD is defined and -lbsd is used, in which case
59 ?X: wait() also expects (union wait *). Aaargh!!--RAM
68 *) flags="$flags $f";;
71 $cat `./findhdr sys/wait.h` /dev/null | \
72 $cppstdin $flags $cppminus >wait.out 2>/dev/null
73 if $contains 'union.*wait.*{' wait.out >/dev/null 2>&1 ; then
74 echo "Looks like your <sys/wait.h> knows about 'union wait'..." >&4
78 if $contains 'extern.*wait[ ]*([ ]*int' wait.out >/dev/null 2>&1
80 echo "But wait() seems to expect an 'int' pointer (POSIX way)." >&4
83 elif $contains 'extern.*wait[ ]*([ ]*union' wait.out >/dev/null 2>&1
85 echo "And indeed wait() expects an 'union wait' pointer (BSD way)." >&4
87 echo "So we'll use that for wait()." >&4
90 @if UNION_WAIT3 || d_uwait3
94 if $contains 'extern.*wait3[ ]*([ ]*int' wait.out >/dev/null 2>&1
96 echo "However wait3() seems to expect an 'int' pointer, weird." >&4
98 elif $contains 'extern.*wait3[ ]*([ ]*union' wait.out >/dev/null 2>&1
100 echo "And wait3() ${also}expects an 'union wait' pointer, fine." >&4
102 echo "As expected, wait3() ${also}uses an 'union wait' pointer." >&4
106 echo "No trace of 'union wait' in <sys/wait.h>..." >&4
108 @if UNION_WAIT && UNION_WAIT3
109 echo "Both wait() and wait3() will use a plain 'int' pointer then." >&4
111 echo "Your wait() should be happy with a plain 'int' pointer." >&4
113 echo "Your wait3() should be happy with a plain 'int' pointer." >&4
118 @if UNION_WAIT3 || d_uwait3
119 val="$val2"; set d_uwait3