This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70b / mcon / U / d_pidcheck.U
1 ?RCS: $Id: d_pidcheck.U,v 3.0.1.1 1997/02/28 15:37:55 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS: 
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 3.0.
10 ?RCS:
11 ?RCS: $Log: d_pidcheck.U,v $
12 ?RCS: Revision 3.0.1.1  1997/02/28  15:37:55  ram
13 ?RCS: patch61: replaced .o with $_o all over the place
14 ?RCS: patch61: added ?F: metalint hint
15 ?RCS:
16 ?RCS: Revision 3.0  1993/08/18  12:06:46  ram
17 ?RCS: Baseline for dist 3.0 netwide release.
18 ?RCS:
19 ?MAKE:d_pidcheck: cat rm +cc _o
20 ?MAKE:  -pick add $@ %<
21 ?S:d_pidcheck:
22 ?S:     This variable conditionally defines the variable PIDCHECK
23 ?S:     which indicates that kill(pid, 0) will check for an active pid.
24 ?S:.
25 ?C:PIDCHECK:
26 ?C:     This symbol, if defined, means that the kill(pid, 0) will
27 ?C:     check for an active pid (i.e. the kernel will run all the
28 ?C:     necessary pid checks, but no signal is actually sent).
29 ?C:.
30 ?H:#$d_pidcheck PIDCHECK                /**/
31 ?H:.
32 ?F:!try
33 : check for "kill(pid, 0)"
34 echo " "
35 case "$d_pidcheck" in
36 "$define")
37 echo "I already know your system supports kill(pid, 0) for pid checks." >&4
38         ;;
39 "$undef")
40 echo "We both know your system does not support signal #0 for pid checks." >&4
41         ;;
42 *)
43         echo "Checking to see if kill(pid, 0) works..." >&4
44         $cat >try.c <<'EOCP'
45 main()
46         {
47         int     pid, status0, status9;
48
49         if ((pid = fork()) == 0)
50                 {
51                 sleep(30);
52                 exit(1);
53                 }
54         status0 = kill(pid, 0);
55         status9 = kill(pid, 9);
56         exit(status0 == status9);
57         }
58 EOCP
59         if $cc -o try try.c >/dev/null 2>&1 ; then
60                 if ./try >/dev/null 2>&1 ; then
61                         echo "Yes, it does marvels."
62                         d_pidcheck="$undef"
63                 else
64                         d_pidcheck="$define"
65                         echo "No, it doesn't."
66                 fi
67         else
68                 echo "(I was unable to compile the test program.)"
69                 echo "Your system does not appear to support kill(pid, 0)."
70                 d_pidcheck="$undef"
71         fi
72         $rm -f try.c try$_o try
73         ;;
74 esac
75