chiark / gitweb /
tests: clarify test_path_startswith return value (#4508)
[elogind.git] / src / basic / signal-util.c
index 4bb2177d67129d2e74b3f220f5186465d6551fea..0be2ec0c708ee983a8abdefcf8430407d3f3d078 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 /***
   This file is part of systemd.
 
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "macro.h"
+#include "parse-util.h"
 #include "signal-util.h"
+#include "stdio-util.h"
+#include "string-table.h"
+#include "string-util.h"
 
 int reset_all_signal_handlers(void) {
         static const struct sigaction sa = {
@@ -84,6 +90,7 @@ static int sigaction_many_ap(const struct sigaction *sa, int sig, va_list ap) {
         return r;
 }
 
+#if 0 /// UNNEEDED by elogind
 int sigaction_many(const struct sigaction *sa, ...) {
         va_list ap;
         int r;
@@ -94,6 +101,7 @@ int sigaction_many(const struct sigaction *sa, ...) {
 
         return r;
 }
+#endif // 0
 
 int ignore_signals(int sig, ...) {
 
@@ -112,8 +120,7 @@ int ignore_signals(int sig, ...) {
         return r;
 }
 
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
 int default_signals(int sig, ...) {
 
         static const struct sigaction sa = {
@@ -230,9 +237,9 @@ const char *signal_to_string(int signo) {
                 return name;
 
         if (signo >= SIGRTMIN && signo <= SIGRTMAX)
-                snprintf(buf, sizeof(buf), "RTMIN+%d", signo - SIGRTMIN);
+                xsprintf(buf, "RTMIN+%d", signo - SIGRTMIN);
         else
-                snprintf(buf, sizeof(buf), "%d", signo);
+                xsprintf(buf, "%d", signo);
 
         return buf;
 }
@@ -252,7 +259,7 @@ int signal_from_string(const char *s) {
         }
         if (safe_atou(s, &u) >= 0) {
                 signo = (int) u + offset;
-                if (signo > 0 && signo < _NSIG)
+                if (SIGNAL_VALID(signo))
                         return signo;
         }
         return -EINVAL;
@@ -269,3 +276,9 @@ int signal_from_string_try_harder(const char *s) {
 
         return signo;
 }
+
+#if 0 /// UNNEEDED by elogind
+void nop_signal_handler(int sig) {
+        /* nothing here */
+}
+#endif // 0