signum.c (1097B)
1// SPDX-License-Identifier: LGPL-2.1 2#include <signal.h> 3 4static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscall_arg *arg) 5{ 6 bool show_prefix = arg->show_string_prefix; 7 const char *prefix = "SIG"; 8 int sig = arg->val; 9 10 switch (sig) { 11#define P_SIGNUM(n) case SIG##n: return scnprintf(bf, size, "%s%s", show_prefix ? prefix : "", #n) 12 P_SIGNUM(HUP); 13 P_SIGNUM(INT); 14 P_SIGNUM(QUIT); 15 P_SIGNUM(ILL); 16 P_SIGNUM(TRAP); 17 P_SIGNUM(ABRT); 18 P_SIGNUM(BUS); 19 P_SIGNUM(FPE); 20 P_SIGNUM(KILL); 21 P_SIGNUM(USR1); 22 P_SIGNUM(SEGV); 23 P_SIGNUM(USR2); 24 P_SIGNUM(PIPE); 25 P_SIGNUM(ALRM); 26 P_SIGNUM(TERM); 27 P_SIGNUM(CHLD); 28 P_SIGNUM(CONT); 29 P_SIGNUM(STOP); 30 P_SIGNUM(TSTP); 31 P_SIGNUM(TTIN); 32 P_SIGNUM(TTOU); 33 P_SIGNUM(URG); 34 P_SIGNUM(XCPU); 35 P_SIGNUM(XFSZ); 36 P_SIGNUM(VTALRM); 37 P_SIGNUM(PROF); 38 P_SIGNUM(WINCH); 39 P_SIGNUM(IO); 40 P_SIGNUM(PWR); 41 P_SIGNUM(SYS); 42#ifdef SIGEMT 43 P_SIGNUM(EMT); 44#endif 45#ifdef SIGSTKFLT 46 P_SIGNUM(STKFLT); 47#endif 48#ifdef SIGSWI 49 P_SIGNUM(SWI); 50#endif 51 default: break; 52 } 53 54 return scnprintf(bf, size, "%#x", sig); 55} 56 57#define SCA_SIGNUM syscall_arg__scnprintf_signum