Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 2 | * include/types/signal.h |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 3 | * Asynchronous signal delivery functions descriptors. |
| 4 | * |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 5 | * Copyright 2000-2010 Willy Tarreau <w@1wt.eu> |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 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 | |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 14 | #ifndef _TYPES_SIGNAL_H |
| 15 | #define _TYPES_SIGNAL_H |
| 16 | |
| 17 | |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 18 | #include <signal.h> |
| 19 | #include <common/config.h> |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 20 | #include <common/mini-clist.h> |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 21 | #include <common/standard.h> |
| 22 | |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 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 | /* those are highly dynamic and stored in pools */ |
| 29 | struct sig_handler { |
| 30 | struct list list; |
| 31 | void *handler; /* function to call or task to wake up */ |
| 32 | int arg; /* arg to pass to function, or signals*/ |
| 33 | int flags; /* SIG_F_* */ |
| 34 | }; |
| 35 | |
| 36 | /* one per signal */ |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 37 | struct signal_descriptor { |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 38 | int count; /* number of times raised */ |
| 39 | struct list handlers; /* sig_handler */ |
Willy Tarreau | 8f38bd0 | 2009-05-10 08:53:33 +0200 | [diff] [blame] | 40 | }; |
Willy Tarreau | 24f4efa | 2010-08-27 17:56:48 +0200 | [diff] [blame] | 41 | |
| 42 | #endif /* _TYPES_SIGNAL_H */ |
| 43 | |
| 44 | /* |
| 45 | * Local variables: |
| 46 | * c-indent-level: 8 |
| 47 | * c-basic-offset: 8 |
| 48 | * End: |
| 49 | */ |