Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: abortsig.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, 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 4.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: abortsig.U,v $ | |
12 | ?RCS: Revision 3.0.1.1 1994/10/29 16:02:19 ram | |
13 | ?RCS: patch36: call ./usg explicitly instead of relying on PATH | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0 1993/08/18 12:05:20 ram | |
16 | ?RCS: Baseline for dist 3.0 netwide release. | |
17 | ?RCS: | |
18 | ?MAKE:abortsig: Myread Oldconfig Guess cat +cc ccflags rm | |
19 | ?MAKE: -pick add $@ %< | |
20 | ?S:abortsig: | |
21 | ?S: This variable holds the name of the signal used by the abort() call. | |
22 | ?S:. | |
23 | ?C:ABORTSIG: | |
24 | ?C: This symbol holds the signal number (symbol) used by the abort() call. To | |
25 | ?C: actually define the signal symbol, <signal.h> should be included. | |
26 | ?C:. | |
27 | ?H:#define ABORTSIG $abortsig /**/ | |
28 | ?H:. | |
29 | ?T:signal | |
30 | : which signal is sent by abort ? | |
31 | echo " " | |
32 | case "$abortsig" in | |
33 | '') | |
34 | echo "Checking to see which signal is sent to the process by abort()..." >&4 | |
35 | echo "abort" > abort.sh | |
36 | chmod +x abort.sh | |
37 | ?X: SIGABRT should replace SIGIOT on USG machines in a near future (1991). | |
38 | for signal in SIGIOT SIGILL SIGABRT; do | |
39 | case "$abortsig" in | |
40 | '') $cat >abort.c <<EOP | |
41 | #include <signal.h> | |
42 | caught() { exit(0); } | |
43 | int main() | |
44 | { | |
45 | #ifdef $signal | |
46 | signal($signal, caught); | |
47 | #endif | |
48 | if (-1 == abort()) | |
49 | exit(1); | |
50 | exit(1); | |
51 | } | |
52 | EOP | |
53 | ?X: We have to use the abort.sh script otherwise sh behaves strangely on AIX. | |
54 | if $cc $ccflags -o abort abort.c >/dev/null 2>&1; then | |
55 | (./abort.sh) >/dev/null 2>&1 | |
56 | case $? in | |
57 | 0) abortsig="$signal";; | |
58 | esac | |
59 | fi | |
60 | ;; | |
61 | esac | |
62 | done | |
63 | ;; | |
64 | esac | |
65 | case "$abortsig" in | |
66 | '') echo "(I wasn't able to compute the signal name--guessing)" | |
67 | if ./usg; then | |
68 | dflt="SIGIOT" | |
69 | else | |
70 | dflt="SIGILL" | |
71 | fi;; | |
72 | *) dflt="$abortsig" | |
73 | ;; | |
74 | esac | |
75 | rp="Which signal does abort() send to the process (signal name)?" | |
76 | . ./myread | |
77 | abortsig="$ans" | |
78 | $rm -f core abort.sh abort abort.c | |
79 |