]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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" | |
20effc67 TL |
20 | #include <map> |
21 | #include <string> | |
7c673cae FG |
22 | |
23 | typedef void (*signal_handler_t)(int); | |
20effc67 TL |
24 | namespace ceph { |
25 | struct BackTrace; | |
26 | } | |
7c673cae | 27 | |
f67539c2 | 28 | #if defined(HAVE_SIGDESCR_NP) |
adb31ebb | 29 | # define sig_str(signum) sigdescr_np(signum) |
f67539c2 | 30 | #elif defined(HAVE_REENTRANT_STRSIGNAL) |
7c673cae | 31 | # define sig_str(signum) strsignal(signum) |
adb31ebb TL |
32 | #else |
33 | # define sig_str(signum) sys_siglist[signum] | |
7c673cae FG |
34 | #endif |
35 | ||
36 | void install_sighandler(int signum, signal_handler_t handler, int flags); | |
37 | ||
38 | // handles SIGHUP | |
39 | void sighup_handler(int signum); | |
40 | ||
41 | // Install the standard Ceph signal handlers | |
42 | void install_standard_sighandlers(void); | |
43 | ||
44 | ||
45 | /// initialize async signal handler framework | |
46 | void init_async_signal_handler(); | |
47 | ||
48 | /// shutdown async signal handler framework | |
49 | void shutdown_async_signal_handler(); | |
50 | ||
51 | /// queue an async signal | |
52 | void queue_async_signal(int signum); | |
53 | ||
54 | /// install a safe, async, callback for the given signal | |
55 | void register_async_signal_handler(int signum, signal_handler_t handler); | |
56 | void register_async_signal_handler_oneshot(int signum, signal_handler_t handler); | |
57 | ||
58 | /// uninstall a safe async signal callback | |
59 | void unregister_async_signal_handler(int signum, signal_handler_t handler); | |
60 | ||
20effc67 TL |
61 | void generate_crash_dump(char *base, |
62 | const ceph::BackTrace& bt, | |
63 | std::map<std::string,std::string> *extra = 0); | |
64 | ||
7c673cae | 65 | #endif |