Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / common / signal.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_COMMON_SIGNAL_H
16 #define CEPH_COMMON_SIGNAL_H
17
18 #include <signal.h>
19 #include <string>
20
21 // Returns a string showing the set of blocked signals for the calling thread.
22 // Other threads may have a different set (this is per-thread thing).
23 extern std::string signal_mask_to_str();
24
25 // Block a list of signals. If siglist == NULL, blocks all signals.
26 // If not, the list is terminated with a 0 element.
27 //
28 // On success, stores the old set of blocked signals in
29 // old_sigset. On failure, stores an invalid set of blocked signals in
30 // old_sigset.
31 extern void block_signals(const int *siglist, sigset_t *old_sigset);
32
33 // Restore the set of blocked signals. Will not restore an invalid set of
34 // blocked signals.
35 extern void restore_sigset(const sigset_t *old_sigset);
36
37 // Unblock all signals. On success, stores the old set of blocked signals in
38 // old_sigset. On failure, stores an invalid set of blocked signals in
39 // old_sigset.
40 extern void unblock_all_signals(sigset_t *old_sigset);
41
42 #endif