blob: 2827c3021ddc53f49fcf27e8ab55d00e57280a38 (
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
|
/***********************************************************************/
/* */
/* Caml Special Light */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1995 Institut National de Recherche en Informatique et */
/* Automatique. Distributed only by permission. */
/* */
/***********************************************************************/
/* $Id$ */
/* To determine the semantics of signal handlers
(System V: signal is reset to default behavior on entrance to the handler
BSD: signal handler remains active). */
#include <stdio.h>
#include <signal.h>
/* Find a signal that is ignored by default */
#ifdef SIGCHLD
#define IGNSIG SIGCHLD
#else
#ifdef SIGIO
#define IGNSIG SIGIO
#else
#ifdef SIGCLD
#define IGNSIG SIGCLD
#else
#ifdef SIGPWR
#define IGNSIG SIGPWR
#endif
#endif
#endif
#endif
#ifdef IGNSIG
int counter;
void sig_handler(dummy)
int dummy;
{
counter++;
}
int main(argc, argv)
int argc;
char ** argv;
{
signal(IGNSIG, sig_handler);
counter = 0;
kill(getpid(), IGNSIG);
kill(getpid(), IGNSIG);
return (counter == 2 ? 0 : 1);
}
#else
/* If no suitable signal was found, assume System V */
int main(argc, argv)
int argc;
char ** argv;
{
return 1;
}
#endif
|