summaryrefslogtreecommitdiff
path: root/mcon/U/d_vfork.U
blob: fd591470e61f09a9021b69cd7a3d493b479ca03e (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
?RCS: $Id: d_vfork.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_vfork.U,v $
?RCS: Revision 3.0.1.6  1994/08/29  16:18:21  ram
?RCS: patch32: set default to 'y' the first time
?RCS:
?RCS: Revision 3.0.1.5  1994/06/20  06:59:14  ram
?RCS: patch30: usevfork was not always properly set
?RCS:
?RCS: Revision 3.0.1.4  1994/05/13  15:20:56  ram
?RCS: patch27: modified to avoid spurious Whoa warnings (ADO)
?RCS:
?RCS: Revision 3.0.1.3  1994/05/06  14:59:09  ram
?RCS: patch23: now explicitly ask whether vfork() should be used (ADO)
?RCS:
?RCS: Revision 3.0.1.2  1993/10/16  13:49:39  ram
?RCS: patch12: added magic for vfork()
?RCS:
?RCS: Revision 3.0.1.1  1993/09/13  16:06:57  ram
?RCS: patch10: removed automatic remapping of vfork on fork (WAD)
?RCS: patch10: added compatibility code for older config.sh (WAD)
?RCS:
?RCS: Revision 3.0  1993/08/18  12:07:55  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_vfork usevfork: Trylink Myread Oldconfig Setvar cat i_unistd
?MAKE:	-pick add $@ %<
?S:d_vfork:
?S:	This variable conditionally defines the HAS_VFORK symbol, which
?S:	indicates the vfork() routine is available.
?S:.
?S:usevfork:
?S:	This variable is set to true when the user accepts to use vfork.
?S:	It is set to false when no vfork is available or when the user
?S:	explicitly requests not to use vfork.
?S:.
?C:HAS_VFORK (VFORK):
?C:	This symbol, if defined, indicates that vfork() exists.
?C:.
?H:#$d_vfork HAS_VFORK	/**/
?H:.
?M:vfork: HAS_VFORK
?M:#ifndef HAS_VFORK
?M:#define vfork fork
?M:#endif
?M:.
?LINT:set d_vfork
: see if there is a vfork
$cat >try.c <<EOC
#include <sys/types.h>
#$i_unistd I_UNISTD
#ifdef I_UNISTD
#include <unistd.h>
#endif
int main(void)
{
	static pid_t ret;
	ret |= vfork();
	return ret ? 0 : 1;
}
EOC
cyn=vfork
set val
eval $trylink


: Ok, but do we want to use it. vfork is reportedly unreliable in 
: perl on Solaris 2.x, and probably elsewhere.
case "$val" in
$define)
	echo " "
	case "$usevfork" in
	false) dflt='n';;
	*) dflt='y';;
	esac
	rp="Some systems have problems with vfork().  Do you want to use it?"
	. ./myread
	case "$ans" in
	y|Y) ;;
	*)
		echo "Ok, we won't use vfork()."
		val="$undef"
		;;
	esac
	;;
esac
?X:
?X: Only set it when final value is known to avoid spurious Whoas
?X: Then set usevfork accordingly to the current value, for next run
?X:
set d_vfork
eval $setvar
case "$d_vfork" in
$define) usevfork='true';;
*) usevfork='false';;
esac