signalnames.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #include "signalnames.hh"
18 
19 // Custom includes
20 
21 #define prefix_
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 prefix_ std::string const & senf::signalName(int signal)
25 {
26  static std::string const names[] = {
27  "<unknown>",
28  "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE",
29  "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM",
30  "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU",
31  "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO",
32  "SIGPWR", "SIGSYS" };
33 
34  return names[
35  (signal <= 0 || signal > int(sizeof(names)/sizeof(names[0]))) ? 0 : signal ];
36 }
37 
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 #undef prefix_
40 
41 
42 // Local Variables:
43 // mode: c++
44 // fill-column: 100
45 // comment-column: 40
46 // c-file-style: "senf"
47 // indent-tabs-mode: nil
48 // ispell-local-dictionary: "american"
49 // compile-command: "scons -u test"
50 // End:
#define prefix_
Definition: signalnames.cc:21
signalnames public header
std::string const & signalName(int signal)
Convert signal number to signal name.
Definition: signalnames.cc:24