blob: 70cce77e29f952a48020a2d2f1b6cd5ea9b1a70b [file] [log] [blame]
Willy Tarreau8f38bd02009-05-10 08:53:33 +02001/*
Willy Tarreau24f4efa2010-08-27 17:56:48 +02002 * include/types/signal.h
Willy Tarreau8f38bd02009-05-10 08:53:33 +02003 * Asynchronous signal delivery functions descriptors.
4 *
Willy Tarreau24f4efa2010-08-27 17:56:48 +02005 * Copyright 2000-2010 Willy Tarreau <w@1wt.eu>
Willy Tarreau8f38bd02009-05-10 08:53:33 +02006 *
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 Tarreau24f4efa2010-08-27 17:56:48 +020014#ifndef _TYPES_SIGNAL_H
15#define _TYPES_SIGNAL_H
16
17
Willy Tarreau8f38bd02009-05-10 08:53:33 +020018#include <signal.h>
Willy Tarreau4c7e4b72020-05-27 12:58:42 +020019#include <haproxy/api-t.h>
Willy Tarreau853b2972020-05-27 18:01:47 +020020#include <haproxy/list-t.h>
Willy Tarreau8f38bd02009-05-10 08:53:33 +020021
Willy Tarreau24f4efa2010-08-27 17:56:48 +020022/* flags for -> flags */
23#define SIG_F_ONE_SHOOT 0x0001 /* unregister handler before calling it */
24#define SIG_F_TYPE_FCT 0x0002 /* handler is a function + arg */
25#define SIG_F_TYPE_TASK 0x0004 /* handler is a task + reason */
26
Olivier Houchardde01ea92020-03-18 13:07:19 +010027/* Define WDTSIG if available */
28#if defined(USE_RT) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME)
29
30
31/* We'll deliver SIGALRM when we've run out of CPU as it's not intercepted by
32 * gdb by default.
33 */
34#define WDTSIG SIGALRM
35
36#endif
37
38#ifdef USE_THREAD_DUMP
39/* The signal to trigger a debug dump on a thread is SIGURG. It has the benefit
40 * of not stopping gdb by default, so that issuing "show threads" in a process
41 * being debugged has no adverse effect.
42 */
43#define DEBUGSIG SIGURG
44
45#endif
46
Willy Tarreau24f4efa2010-08-27 17:56:48 +020047/* those are highly dynamic and stored in pools */
48struct sig_handler {
49 struct list list;
50 void *handler; /* function to call or task to wake up */
51 int arg; /* arg to pass to function, or signals*/
52 int flags; /* SIG_F_* */
53};
54
55/* one per signal */
Willy Tarreau8f38bd02009-05-10 08:53:33 +020056struct signal_descriptor {
Willy Tarreau24f4efa2010-08-27 17:56:48 +020057 int count; /* number of times raised */
58 struct list handlers; /* sig_handler */
Willy Tarreau8f38bd02009-05-10 08:53:33 +020059};
Willy Tarreau24f4efa2010-08-27 17:56:48 +020060
61#endif /* _TYPES_SIGNAL_H */
62
63/*
64 * Local variables:
65 * c-indent-level: 8
66 * c-basic-offset: 8
67 * End:
68 */