source: branches/minix3-book/include/signal.h@ 4

Last change on this file since 4 was 4, checked in by Mattia Monga, 13 years ago

Importazione sorgenti libro

File size: 4.8 KB
Line 
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#ifndef _ANSI_H
10#include <ansi.h>
11#endif
12#ifdef _POSIX_SOURCE
13#ifndef _TYPES_H
14#include <sys/types.h>
15#endif
16#endif
17
18/* Here are types that are closely associated with signal handling. */
19typedef int sig_atomic_t;
20
21#ifdef _POSIX_SOURCE
22#ifndef _SIGSET_T
23#define _SIGSET_T
24typedef unsigned long sigset_t;
25#endif
26#endif
27
28#define _NSIG 20 /* number of signals used */
29
30#define SIGHUP 1 /* hangup */
31#define SIGINT 2 /* interrupt (DEL) */
32#define SIGQUIT 3 /* quit (ASCII FS) */
33#define SIGILL 4 /* illegal instruction */
34#define SIGTRAP 5 /* trace trap (not reset when caught) */
35#define SIGABRT 6 /* IOT instruction */
36#define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
37#define SIGUNUSED 7 /* spare code */
38#define SIGFPE 8 /* floating point exception */
39#define SIGKILL 9 /* kill (cannot be caught or ignored) */
40#define SIGUSR1 10 /* user defined signal # 1 */
41#define SIGSEGV 11 /* segmentation violation */
42#define SIGUSR2 12 /* user defined signal # 2 */
43#define SIGPIPE 13 /* write on a pipe with no one to read it */
44#define SIGALRM 14 /* alarm clock */
45#define SIGTERM 15 /* software termination signal from kill */
46#define SIGCHLD 17 /* child process terminated or stopped */
47
48#define SIGEMT 7 /* obsolete */
49#define SIGBUS 10 /* obsolete */
50
51/* MINIX specific signals. These signals are not used by user proceses,
52 * but meant to inform system processes, like the PM, about system events.
53 */
54#define SIGKMESS 18 /* new kernel message */
55#define SIGKSIG 19 /* kernel signal pending */
56#define SIGKSTOP 20 /* kernel shutting down */
57
58/* POSIX requires the following signals to be defined, even if they are
59 * not supported. Here are the definitions, but they are not supported.
60 */
61#define SIGCONT 18 /* continue if stopped */
62#define SIGSTOP 19 /* stop signal */
63#define SIGTSTP 20 /* interactive stop signal */
64#define SIGTTIN 21 /* background process wants to read */
65#define SIGTTOU 22 /* background process wants to write */
66
67/* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
68typedef void _PROTOTYPE( (*__sighandler_t), (int) );
69
70/* Macros used as function pointers. */
71#define SIG_ERR ((__sighandler_t) -1) /* error return */
72#define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
73#define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
74#define SIG_HOLD ((__sighandler_t) 2) /* block signal */
75#define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
76#define SIG_MESS ((__sighandler_t) 4) /* pass as message (MINIX) */
77
78#ifdef _POSIX_SOURCE
79struct sigaction {
80 __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */
81 sigset_t sa_mask; /* signals to be blocked during handler */
82 int sa_flags; /* special flags */
83};
84
85/* Fields for sa_flags. */
86#define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
87#define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
88#define SA_NODEFER 0x0004 /* don't block signal while catching it */
89#define SA_RESTART 0x0008 /* automatic system call restart */
90#define SA_SIGINFO 0x0010 /* extended signal handling */
91#define SA_NOCLDWAIT 0x0020 /* don't create zombies */
92#define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
93
94/* POSIX requires these values for use with sigprocmask(2). */
95#define SIG_BLOCK 0 /* for blocking signals */
96#define SIG_UNBLOCK 1 /* for unblocking signals */
97#define SIG_SETMASK 2 /* for setting the signal mask */
98#define SIG_INQUIRE 4 /* for internal use only */
99#endif /* _POSIX_SOURCE */
100
101/* POSIX and ANSI function prototypes. */
102_PROTOTYPE( int raise, (int _sig) );
103_PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );
104
105#ifdef _POSIX_SOURCE
106_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
107_PROTOTYPE( int sigaction,
108 (int _sig, const struct sigaction *_act, struct sigaction *_oact) );
109_PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );
110_PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );
111_PROTOTYPE( int sigemptyset, (sigset_t *_set) );
112_PROTOTYPE( int sigfillset, (sigset_t *_set) );
113_PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig) );
114_PROTOTYPE( int sigpending, (sigset_t *_set) );
115_PROTOTYPE( int sigprocmask,
116 (int _how, const sigset_t *_set, sigset_t *_oset) );
117_PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );
118#endif
119
120#endif /* _SIGNAL_H */
Note: See TracBrowser for help on using the repository browser.