Usermode/libc - Improved strerror, added some basic time functions
[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 typedef long long unsigned int  sigset_t;
48 extern int      sigemptyset(sigset_t *set);
49 extern int      sigfillset(sigset_t *set);
50
51 typedef struct siginfo_s        siginfo_t;
52
53 struct siginfo_s
54 {
55         int     si_signo;
56         int     si_errno;
57         int     si_code;
58         int     si_trapno;
59         pid_t   si_pid;
60         uid_t   si_uid;
61         int     si_status;
62         // TODO: There's others
63 };
64
65 struct sigaction
66 {
67         sighandler_t    sa_handler;
68         //void  (*sa_sigaction)(int, siginfo_t *, void *);
69         sigset_t        sa_mask;
70         int     sa_flags;
71 };
72
73 #define SA_NOCLDSTOP    0x001
74
75 extern int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
76
77 #endif
78

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