?RCS: $Id: d_pidcheck.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_pidcheck.U,v $ ?RCS: Revision 3.0.1.1 1997/02/28 15:37:55 ram ?RCS: patch61: replaced .o with $_o all over the place ?RCS: patch61: added ?F: metalint hint ?RCS: ?RCS: Revision 3.0 1993/08/18 12:06:46 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: ?MAKE:d_pidcheck: cat rm +cc _o ?MAKE: -pick add $@ %< ?S:d_pidcheck: ?S: This variable conditionally defines the variable PIDCHECK ?S: which indicates that kill(pid, 0) will check for an active pid. ?S:. ?C:PIDCHECK: ?C: This symbol, if defined, means that the kill(pid, 0) will ?C: check for an active pid (i.e. the kernel will run all the ?C: necessary pid checks, but no signal is actually sent). ?C:. ?H:#$d_pidcheck PIDCHECK /**/ ?H:. ?F:!try : check for "kill(pid, 0)" echo " " case "$d_pidcheck" in "$define") echo "I already know your system supports kill(pid, 0) for pid checks." >&4 ;; "$undef") echo "We both know your system does not support signal #0 for pid checks." >&4 ;; *) echo "Checking to see if kill(pid, 0) works..." >&4 $cat >try.c <<'EOCP' int main() { int pid, status0, status9; if ((pid = fork()) == 0) { sleep(30); exit(1); } status0 = kill(pid, 0); status9 = kill(pid, 9); exit(status0 == status9); } EOCP if $cc -o try try.c >/dev/null 2>&1 ; then if ./try >/dev/null 2>&1 ; then echo "Yes, it does marvels." d_pidcheck="$undef" else d_pidcheck="$define" echo "No, it doesn't." fi else echo "(I was unable to compile the test program.)" echo "Your system does not appear to support kill(pid, 0)." d_pidcheck="$undef" fi $rm -f try.c try$_o try ;; esac