Pristine Ack-5.5
[Ack-5.5.git] / lib / minix / include / signal.h
1 /* The <signal.h> header defines all the ANSI and POSIX signals.
2  * MINIX supports all the signals required by POSIX. They are defined below.
3  * Some additional signals are also supported.
4  */
5
6 #ifndef _SIGNAL_H
7 #define _SIGNAL_H
8
9 /* Here are types that are closely associated with signal handling. */
10 typedef int sig_atomic_t;
11
12 #ifdef  _POSIX_SOURCE
13 typedef unsigned short sigset_t;
14 #endif
15
16
17 #define _NSIG             16    /* number of signals used */
18
19 #define SIGHUP             1    /* hangup */
20 #define SIGINT             2    /* interrupt (DEL) */
21 #define SIGQUIT            3    /* quit (ASCII FS) */
22 #define SIGILL             4    /* illegal instruction */
23 #define SIGTRAP            5    /* trace trap (not reset when caught) */
24 #define SIGABRT            6    /* IOT instruction */
25 #define SIGIOT             6    /* SIGABRT for people who speak PDP-11 */
26 #define SIGUNUSED          7    /* spare code */
27 #define SIGFPE             8    /* floating point exception */
28 #define SIGKILL            9    /* kill (cannot be caught or ignored) */
29 #define SIGUSR1           10    /* user defined signal # 1 */
30 #define SIGSEGV           11    /* segmentation violation */
31 #define SIGUSR2           12    /* user defined signal # 2 */
32 #define SIGSYS            12    /* the usual UNIX name for this signal num */
33 #define SIGPIPE           13    /* write on a pipe with no one to read it */
34 #define SIGALRM           14    /* alarm clock */
35 #define SIGTERM           15    /* software termination signal from kill */
36 #define SIGSTKFLT         16    /* used by kernel to indicate stack fault */
37
38 #define SIGEMT             7    /* obsolete */
39 #define SIGBUS            10    /* obsolete */
40
41 /* POSIX requires the following signals to be defined, even if they are
42  * not supported.  Here are the definitions, but they are not supported.
43  */
44 #define SIGCHLD           17    /* child process terminated or stopped */
45 #define SIGCONT           18    /* continue if stopped */
46 #define SIGSTOP           19    /* stop signal */
47 #define SIGTSTP           20    /* interactive stop signal */
48 #define SIGTTIN           21    /* background process wants to read */
49 #define SIGTTOU           22    /* background process wants to write */
50
51 #ifdef _POSIX_SOURCE
52 #define SA_NOCLDSTOP       1    /* signal parent if child stops */
53
54 #endif /* _POSIX_SOURCE */
55
56 /* POSIX requires these values for use on system calls involving signals. */
57 #define SIG_BLOCK          0    /* for blocking signals */
58 #define SIG_UNBLOCK        1    /* for unblocking signals */
59 #define SIG_SETMASK        2    /* for setting the signal mask */
60
61 #ifndef _ANSI_H
62 #include <ansi.h>
63 #endif
64
65 /* Macros used as function pointers and one awful prototype. */
66 #if _ANSI
67 #define SIG_DFL         ((void (*)(int))0)      /* default signal handling */
68 #define SIG_IGN         ((void (*)(int))1)      /* ignore signal */
69 #define SIG_ERR         ((void (*)(int))-1)
70
71 void (*signal(int _sig, void (*_func)(int)))(int);
72
73 #ifdef _POSIX_SOURCE
74 struct sigaction {
75   void (*sa_handler)(int);      /* SIG_DFL, SIG_IGN, or pointer to function */
76   sigset_t sa_mask;             /* signals to be blocked during handler */
77   int sa_flags;                 /* special flags */
78 };
79 #endif
80
81 #else   /* !_ANSI */
82 #define SIG_DFL         ((void (*)())0)         /* default signal handling */
83 #define SIG_IGN         ((void (*)())1)         /* ignore signal */
84 #define SIG_ERR         ((void (*)())-1)
85
86 void (*signal()) ();
87
88 #ifdef _POSIX_SOURCE            /* otherwise sigset_t is not defined */
89 struct sigaction {
90   void (*sa_handler)();         /* SIG_DFL, SIG_IGN, or pointer to function */
91   sigset_t sa_mask;             /* signals to be blocked during handler */
92   int sa_flags;                 /* special flags */
93 };
94 #endif
95
96 #endif  /* _ANSI */
97
98 /* Function Prototypes. */
99 _PROTOTYPE( int raise, (int _sig)                                       );
100
101 #ifdef _POSIX_SOURCE
102 _PROTOTYPE( int kill, (pid_t _pid, int _sig)                            );
103 _PROTOTYPE( int sigaddset, (sigset_t *_set)                             );
104 _PROTOTYPE( int sigdelset, (sigset_t *_set)                             );
105 _PROTOTYPE( int sigemptyset, (sigset_t *_set)                           );
106 _PROTOTYPE( int sigfillset, (sigset_t *_set)                            );
107 _PROTOTYPE( int sigismember, (sigset_t *_set, int _signo)               );
108 _PROTOTYPE( int sigpending, (sigset_t *set)                             );
109 _PROTOTYPE( int sigprocmask, (int _how, sigset_t *_set, sigset_t *_oset));
110 _PROTOTYPE( int sigsuspend, (sigset_t *_sigmask)                        );
111 _PROTOTYPE( int sigaction,
112             (int _sig, struct sigaction *_a, struct sigaction *_oact)   );
113 #endif
114
115 #endif /* _SIGNAL_H */