blob: 763cfb0bef7e8b3bf50cdaf16f16a918d509d15c [file] [log] [blame]
Willy Tarreau8f38bd02009-05-10 08:53:33 +02001/*
Willy Tarreau3727a8a2020-06-04 17:37:26 +02002 * include/haproxy/signal.h
Willy Tarreau8f38bd02009-05-10 08:53:33 +02003 * Asynchronous signal delivery functions.
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
14#include <signal.h>
Christopher Fauletb79a94c2017-05-30 15:34:30 +020015
Willy Tarreau3727a8a2020-06-04 17:37:26 +020016#include <haproxy/api.h>
17#include <haproxy/signal-t.h>
Willy Tarreaucea0e1b2020-06-04 17:25:40 +020018#include <haproxy/task-t.h>
Willy Tarreau3727a8a2020-06-04 17:37:26 +020019#include <haproxy/thread.h>
Willy Tarreau8f38bd02009-05-10 08:53:33 +020020
21extern int signal_queue_len;
22extern struct signal_descriptor signal_state[];
23
Willy Tarreauaf613e82020-06-05 08:40:51 +020024__decl_thread(extern HA_SPINLOCK_T signals_lock);
Christopher Fauletb79a94c2017-05-30 15:34:30 +020025
Willy Tarreaud0807c32010-08-27 18:26:11 +020026void signal_handler(int sig);
Willy Tarreau8f38bd02009-05-10 08:53:33 +020027void __signal_process_queue();
Willy Tarreau24f4efa2010-08-27 17:56:48 +020028void deinit_signals();
29struct sig_handler *signal_register_fct(int sig, void (*fct)(struct sig_handler *), int arg);
30struct sig_handler *signal_register_task(int sig, struct task *task, int reason);
31void signal_unregister_handler(struct sig_handler *handler);
32void signal_unregister_target(int sig, void *target);
William Lallemand31a1c1d2018-11-20 17:36:52 +010033void signal_unregister(int sig);
William Lallemandd3801c12018-09-11 10:06:23 +020034void haproxy_unblock_signals();
Willy Tarreau8f38bd02009-05-10 08:53:33 +020035
36static inline void signal_process_queue()
37{
38 if (unlikely(signal_queue_len > 0))
39 __signal_process_queue();
40}
Willy Tarreau24f4efa2010-08-27 17:56:48 +020041
42/*
43 * Local variables:
44 * c-indent-level: 8
45 * c-basic-offset: 8
46 * End:
47 */