Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / global / signal_handler.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2011 New Dream Network
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #ifndef CEPH_GLOBAL_SIGNAL_HANDLER_H
16 #define CEPH_GLOBAL_SIGNAL_HANDLER_H
17
18 #include <signal.h>
19 #include "acconfig.h"
20
21 typedef void (*signal_handler_t)(int);
22
23 #ifndef HAVE_REENTRANT_STRSIGNAL
24 # define sig_str(signum) sys_siglist[signum]
25 #else
26 # define sig_str(signum) strsignal(signum)
27 #endif
28
29 void install_sighandler(int signum, signal_handler_t handler, int flags);
30
31 // handles SIGHUP
32 void sighup_handler(int signum);
33
34 // Install the standard Ceph signal handlers
35 void install_standard_sighandlers(void);
36
37
38 /// initialize async signal handler framework
39 void init_async_signal_handler();
40
41 /// shutdown async signal handler framework
42 void shutdown_async_signal_handler();
43
44 /// queue an async signal
45 void queue_async_signal(int signum);
46
47 /// install a safe, async, callback for the given signal
48 void register_async_signal_handler(int signum, signal_handler_t handler);
49 void register_async_signal_handler_oneshot(int signum, signal_handler_t handler);
50
51 /// uninstall a safe async signal callback
52 void unregister_async_signal_handler(int signum, signal_handler_t handler);
53
54 #endif