]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc/process_utils.h: use strsignal() or sys_siglist[] for Non-GNU distros 4565/head
authorLi Lu <1487442471@qq.com>
Mon, 28 Jul 2025 15:27:35 +0000 (23:27 +0800)
committerLi Lu <1487442471@qq.com>
Mon, 28 Jul 2025 15:34:55 +0000 (23:34 +0800)
use strsignal() for Non-GNU and sys_siglist[] for nothing, even if sys_siglist[] has been marked as deprecated by Glibc

Signed-off-by: Li Lu <1487442471@qq.com>
meson.build
src/lxc/process_utils.h

index f95b87af942f9877a614c3ed2f1b2f591cbb2404..a20068cd96f7f9d2faf9b220b6a0ce3b20e35cc4 100644 (file)
@@ -570,6 +570,8 @@ foreach ident: [
                              #include <mntent.h>'''],
     ['setns',             '''#include <sched.h>'''],
     ['sigdescr_np',       '''#include <string.h>'''],
+    ['strsignal',         '''#include <string.h>'''],
+    ['sys_siglist',       '''#include <signal.h>'''],
     ['signalfd',          '''#include <sys/signalfd.h>'''],
     ['statvfs',           '''#include <sys/statvfs.h>'''],
     ['statx',             '''#include <sys/types.h>
@@ -624,6 +626,8 @@ foreach tuple: [
     ['setmntent'],
     ['setns'],
     ['sigdescr_np'],
+    ['strsignal'],
+    ['sys_siglist'],
     ['signalfd'],
     ['statx'],
     ['statvfs'],
index d2bf97802d1f66316932edd560442768fe0c9ba4..effff9bd30a6ce36290c68a342def6d11c615f1f 100644 (file)
@@ -300,6 +300,10 @@ static inline const char *signal_name(int sig)
 
 #if HAVE_SIGDESCR_NP
        s = sigdescr_np(sig);
+#elif HAVE_STRSIGNAL
+       s = strsignal(sig);
+#elif HAVE_SYS_SIGLIST
+       s = sys_siglist[sig];
 #else
        s = "UNSUPPORTED";
 #endif