SNode.C
Loading...
Searching...
No Matches
signal.cpp
Go to the documentation of this file.
1
/*
2
* SNode.C - a slim toolkit for network communication
3
* Copyright (C) Volker Christian <me@vchrist.at>
4
* 2020, 2021, 2022, 2023, 2024, 2025
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published
8
* by the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
21
22
#
include
"utils/system/signal.h"
23
24
#
include
<
cerrno
>
25
#
include
<
map
>
26
#
include
<
utility
>
27
28
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
29
30
namespace
utils::
system
{
31
32
sighandler_t
signal
(
int
sig
,
sighandler_t
handler
) {
33
errno = 0;
34
return
std::signal(sig, handler);
35
}
36
37
std::string
sigabbrev_np
(
int
sig) {
38
static
std::map<
int
, std::string> sigMap = {
39
{SIGABRT,
"ABRT"
}, {SIGALRM,
"ALRM"
}, {SIGBUS,
"BUS"
}, {SIGCHLD,
"CHLD"
}, {SIGCONT,
"CONT"
}, {SIGFPE,
"FPE"
},
40
{SIGHUP,
"HUP"
}, {SIGILL,
"ILL"
}, {SIGINT,
"INT"
}, {SIGKILL,
"KILL"
}, {SIGPIPE,
"PIPE"
}, {SIGPOLL,
"POLL"
},
41
{SIGPROF,
"PROF"
}, {SIGQUIT,
"QUIT"
}, {SIGSEGV,
"SEGV"
}, {SIGSTOP,
"STOP"
}, {SIGSYS,
"SYS"
}, {SIGTERM,
"TERM"
},
42
{SIGTRAP,
"TRAP"
}, {SIGTSTP,
"TSTP"
}, {SIGTTIN,
"TTIN"
}, {SIGTTOU,
"TTOU"
}, {SIGUSR1,
"USR1"
}, {SIGUSR2,
"USR2"
},
43
{SIGURG,
"URG"
}, {SIGVTALRM,
"VTALRM"
}, {SIGXCPU,
"XCPU"
}, {SIGXFSZ,
"XFSZ"
}, {SIGWINCH,
"WINCH"
}};
44
45
return
sigMap.contains(sig) ? sigMap[sig] :
"UNKNOWN"
;
46
}
47
48
}
// namespace utils::system
utils::system
Definition
signal.cpp:30
utils::system::signal
sighandler_t signal(int sig, sighandler_t handler)
Definition
signal.cpp:32
utils::system::sigabbrev_np
std::string sigabbrev_np(int sig)
Definition
signal.cpp:37
utils
system
signal.cpp
Generated on Mon Feb 10 2025 20:21:56 for SNode.C by
1.11.0