ca5275a127a6e491f69b998ff37bd91bc409971e
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / include_exp / signal.h
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * signal.h
6  * - POSIX Signal Emulation/Interface
7  */
8 #ifndef _SIGNAL_H_
9 #define _SIGNAL_H_
10
11 typedef void (*sighandler_t)(int);
12
13 //! Atomic integer type
14 typedef volatile int    sig_atomic_t;
15
16 #define SIG_IGN ((void*)1)
17 #define SIG_DFL ((void*)0)
18 #define SIG_ERR ((void*)-1)
19
20 #define SIGINT  2       // C99
21 #define SIGILL  4       // C99
22 #define SIGABRT 6       // C99
23 #define SIGFPE  8       // C99
24 #define SIGSEGV 11      // C99
25 #define SIGTERM 15      // C99
26
27 extern sighandler_t     signal(int signum, sighandler_t handler);
28
29 extern int      raise(int sig);
30
31 // POSIX Signals
32 #define SIGHUP  1
33 #define SIGQUIT 3
34 #define SIGKILL 9
35 #define SIGALRM 14
36 #define SIGUSR1 16
37 #define SIGUSR2 17
38
39 #define SIGSTOP 30      // Stop process
40 #define SIGTSTP 31      // ? ^Z
41 #define SIGTTIN 32      // Background process read TTY
42 #define SIGTTOU 33      // Background process write TTY
43 #define SIGPIPE 34
44 #define SIGCHLD 35
45 #define SIGWINCH        36
46
47 #include <sys/types.h>  // libposix
48
49 typedef long long unsigned int  sigset_t;
50 extern int      sigemptyset(sigset_t *set);
51 extern int      sigfillset(sigset_t *set);
52
53 typedef struct siginfo_s        siginfo_t;
54
55 struct siginfo_s
56 {
57         int     si_signo;
58         int     si_errno;
59         int     si_code;
60         int     si_trapno;
61         pid_t   si_pid;
62         uid_t   si_uid;
63         int     si_status;
64         // TODO: There's others
65 };
66
67 struct sigaction
68 {
69         sighandler_t    sa_handler;
70         //void  (*sa_sigaction)(int, siginfo_t *, void *);
71         sigset_t        sa_mask;
72         int     sa_flags;
73 };
74
75 #define SA_NOCLDSTOP    0x001
76
77 extern int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
78
79 #endif
80

UCC git Repository :: git.ucc.asn.au