2 |
- |
1 |
#ifndef __SIGNAL_H
|
|
|
2 |
#define __SIGNAL_H
|
|
|
3 |
#pragma lib "/$M/lib/ape/libap.a"
|
|
|
4 |
|
|
|
5 |
typedef int sig_atomic_t;
|
|
|
6 |
|
|
|
7 |
/*
|
|
|
8 |
* We don't give arg types for signal handlers, in spite of ANSI requirement
|
|
|
9 |
* that it be 'int' (the signal number), because some programs need an
|
|
|
10 |
* additional context argument. So the real type of signal handlers is
|
|
|
11 |
* void handler(int sig, char *, struct Ureg *)
|
|
|
12 |
* where the char * is the Plan 9 message and Ureg is defined in <ureg.h>
|
|
|
13 |
*/
|
|
|
14 |
#define SIG_DFL ((void (*)())0)
|
|
|
15 |
#define SIG_ERR ((void (*)())-1)
|
|
|
16 |
#define SIG_IGN ((void (*)())1)
|
|
|
17 |
|
|
|
18 |
#define SIGHUP 1 /* hangup */
|
|
|
19 |
#define SIGINT 2 /* interrupt */
|
|
|
20 |
#define SIGQUIT 3 /* quit */
|
|
|
21 |
#define SIGILL 4 /* illegal instruction (not reset when caught)*/
|
|
|
22 |
#define SIGABRT 5 /* used by abort */
|
|
|
23 |
#define SIGFPE 6 /* floating point exception */
|
|
|
24 |
#define SIGKILL 7 /* kill (cannot be caught or ignored) */
|
|
|
25 |
#define SIGSEGV 8 /* segmentation violation */
|
|
|
26 |
#define SIGPIPE 9 /* write on a pipe with no one to read it */
|
|
|
27 |
#define SIGALRM 10 /* alarm clock */
|
|
|
28 |
#define SIGTERM 11 /* software termination signal from kill */
|
|
|
29 |
#define SIGUSR1 12 /* user defined signal 1 */
|
|
|
30 |
#define SIGUSR2 13 /* user defined signal 2 */
|
|
|
31 |
#define SIGBUS 14 /* bus error */
|
|
|
32 |
|
|
|
33 |
/* The following symbols must be defined, but the signals needn't be supported */
|
|
|
34 |
#define SIGCHLD 15 /* child process terminated or stopped */
|
|
|
35 |
#define SIGCONT 16 /* continue if stopped */
|
|
|
36 |
#define SIGSTOP 17 /* stop */
|
|
|
37 |
#define SIGTSTP 18 /* interactive stop */
|
|
|
38 |
#define SIGTTIN 19 /* read from ctl tty by member of background */
|
|
|
39 |
#define SIGTTOU 20 /* write to ctl tty by member of background */
|
|
|
40 |
|
|
|
41 |
#ifdef _BSD_EXTENSION
|
|
|
42 |
#define NSIG 21
|
|
|
43 |
#endif
|
|
|
44 |
|
|
|
45 |
#ifdef __cplusplus
|
|
|
46 |
extern "C" {
|
|
|
47 |
#endif
|
|
|
48 |
|
|
|
49 |
extern void (*signal(int, void (*)()))();
|
|
|
50 |
extern int raise(int);
|
|
|
51 |
|
|
|
52 |
#ifdef __cplusplus
|
|
|
53 |
}
|
|
|
54 |
#endif
|
|
|
55 |
|
|
|
56 |
#ifdef _POSIX_SOURCE
|
|
|
57 |
|
|
|
58 |
typedef long sigset_t;
|
|
|
59 |
struct sigaction {
|
|
|
60 |
void (*sa_handler)();
|
|
|
61 |
sigset_t sa_mask;
|
|
|
62 |
int sa_flags;
|
|
|
63 |
};
|
|
|
64 |
/* values for sa_flags */
|
|
|
65 |
#define SA_NOCLDSTOP 1
|
|
|
66 |
|
|
|
67 |
/* first argument to sigprocmask */
|
|
|
68 |
#define SIG_BLOCK 1
|
|
|
69 |
#define SIG_UNBLOCK 2
|
|
|
70 |
#define SIG_SETMASK 3
|
|
|
71 |
|
|
|
72 |
#ifdef __cplusplus
|
|
|
73 |
extern "C" {
|
|
|
74 |
#endif
|
|
|
75 |
|
|
|
76 |
#ifdef __TYPES_H
|
|
|
77 |
extern int kill(pid_t, int);
|
|
|
78 |
#endif
|
|
|
79 |
extern int sigemptyset(sigset_t *);
|
|
|
80 |
extern int sigfillset(sigset_t *);
|
|
|
81 |
extern int sigaddset(sigset_t *, int);
|
|
|
82 |
extern int sigdelset(sigset_t *, int);
|
|
|
83 |
extern int sigismember(const sigset_t *, int);
|
|
|
84 |
extern int sigaction(int, const struct sigaction *, struct sigaction *);
|
|
|
85 |
extern int sigprocmask(int, sigset_t *, sigset_t *);
|
|
|
86 |
extern int sigpending(sigset_t *);
|
|
|
87 |
extern int sigsuspend(const sigset_t *);
|
|
|
88 |
|
|
|
89 |
#ifdef __cplusplus
|
|
|
90 |
}
|
|
|
91 |
#endif
|
|
|
92 |
|
|
|
93 |
#endif /* _POSIX_SOURCE */
|
|
|
94 |
|
|
|
95 |
#endif /* __SIGNAL_H */
|