1 /*
2  * include/types/signal.h
3  * Asynchronous signal delivery functions descriptors.
4  *
5  * Copyright 2000-2010 Willy Tarreau <w@1wt.eu>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version
10  * 2 of the License, or (at your option) any later version.
11  *
12  */
13 
14 #ifndef _TYPES_SIGNAL_H
15 #define _TYPES_SIGNAL_H
16 
17 
18 #include <signal.h>
19 #include <common/config.h>
20 #include <common/mini-clist.h>
21 #include <common/standard.h>
22 
23 /* flags for -> flags */
24 #define SIG_F_ONE_SHOOT         0x0001  /* unregister handler before calling it */
25 #define SIG_F_TYPE_FCT          0x0002  /* handler is a function + arg */
26 #define SIG_F_TYPE_TASK         0x0004  /* handler is a task + reason */
27 
28 /* Define WDTSIG if available */
29 #if defined(USE_RT) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME)
30 
31 
32 /* We'll deliver SIGALRM when we've run out of CPU as it's not intercepted by
33  * gdb by default.
34  */
35 #define WDTSIG SIGALRM
36 
37 #endif
38 
39 #ifdef USE_THREAD_DUMP
40 /* The signal to trigger a debug dump on a thread is SIGURG. It has the benefit
41  * of not stopping gdb by default, so that issuing "show threads" in a process
42  * being debugged has no adverse effect.
43  */
44 #define DEBUGSIG SIGURG
45 
46 #endif
47 
48 /* those are highly dynamic and stored in pools */
49 struct sig_handler {
50 	struct list list;
51 	void *handler;                  /* function to call or task to wake up */
52 	int arg;                        /* arg to pass to function, or signals*/
53 	int flags;                      /* SIG_F_* */
54 };
55 
56 /* one per signal */
57 struct signal_descriptor {
58 	int count;                      /* number of times raised */
59 	struct list handlers;           /* sig_handler */
60 };
61 
62 #endif /* _TYPES_SIGNAL_H */
63 
64 /*
65  * Local variables:
66  *  c-indent-level: 8
67  *  c-basic-offset: 8
68  * End:
69  */
70