11cb0ef41Sopenharmony_ci#include "node.h" 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci#include <csignal> 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cinamespace node { 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst char* signo_string(int signo) { 81cb0ef41Sopenharmony_ci#define SIGNO_CASE(e) \ 91cb0ef41Sopenharmony_ci case e: \ 101cb0ef41Sopenharmony_ci return #e; 111cb0ef41Sopenharmony_ci switch (signo) { 121cb0ef41Sopenharmony_ci#ifdef SIGHUP 131cb0ef41Sopenharmony_ci SIGNO_CASE(SIGHUP); 141cb0ef41Sopenharmony_ci#endif 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci#ifdef SIGINT 171cb0ef41Sopenharmony_ci SIGNO_CASE(SIGINT); 181cb0ef41Sopenharmony_ci#endif 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci#ifdef SIGQUIT 211cb0ef41Sopenharmony_ci SIGNO_CASE(SIGQUIT); 221cb0ef41Sopenharmony_ci#endif 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci#ifdef SIGILL 251cb0ef41Sopenharmony_ci SIGNO_CASE(SIGILL); 261cb0ef41Sopenharmony_ci#endif 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci#ifdef SIGTRAP 291cb0ef41Sopenharmony_ci SIGNO_CASE(SIGTRAP); 301cb0ef41Sopenharmony_ci#endif 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci#ifdef SIGABRT 331cb0ef41Sopenharmony_ci SIGNO_CASE(SIGABRT); 341cb0ef41Sopenharmony_ci#endif 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci#ifdef SIGIOT 371cb0ef41Sopenharmony_ci#if SIGABRT != SIGIOT 381cb0ef41Sopenharmony_ci SIGNO_CASE(SIGIOT); 391cb0ef41Sopenharmony_ci#endif 401cb0ef41Sopenharmony_ci#endif 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ci#ifdef SIGBUS 431cb0ef41Sopenharmony_ci SIGNO_CASE(SIGBUS); 441cb0ef41Sopenharmony_ci#endif 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci#ifdef SIGFPE 471cb0ef41Sopenharmony_ci SIGNO_CASE(SIGFPE); 481cb0ef41Sopenharmony_ci#endif 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci#ifdef SIGKILL 511cb0ef41Sopenharmony_ci SIGNO_CASE(SIGKILL); 521cb0ef41Sopenharmony_ci#endif 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci#ifdef SIGUSR1 551cb0ef41Sopenharmony_ci SIGNO_CASE(SIGUSR1); 561cb0ef41Sopenharmony_ci#endif 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ci#ifdef SIGSEGV 591cb0ef41Sopenharmony_ci SIGNO_CASE(SIGSEGV); 601cb0ef41Sopenharmony_ci#endif 611cb0ef41Sopenharmony_ci 621cb0ef41Sopenharmony_ci#ifdef SIGUSR2 631cb0ef41Sopenharmony_ci SIGNO_CASE(SIGUSR2); 641cb0ef41Sopenharmony_ci#endif 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci#ifdef SIGPIPE 671cb0ef41Sopenharmony_ci SIGNO_CASE(SIGPIPE); 681cb0ef41Sopenharmony_ci#endif 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ci#ifdef SIGALRM 711cb0ef41Sopenharmony_ci SIGNO_CASE(SIGALRM); 721cb0ef41Sopenharmony_ci#endif 731cb0ef41Sopenharmony_ci 741cb0ef41Sopenharmony_ci SIGNO_CASE(SIGTERM); 751cb0ef41Sopenharmony_ci 761cb0ef41Sopenharmony_ci#ifdef SIGCHLD 771cb0ef41Sopenharmony_ci SIGNO_CASE(SIGCHLD); 781cb0ef41Sopenharmony_ci#endif 791cb0ef41Sopenharmony_ci 801cb0ef41Sopenharmony_ci#ifdef SIGSTKFLT 811cb0ef41Sopenharmony_ci SIGNO_CASE(SIGSTKFLT); 821cb0ef41Sopenharmony_ci#endif 831cb0ef41Sopenharmony_ci 841cb0ef41Sopenharmony_ci#ifdef SIGCONT 851cb0ef41Sopenharmony_ci SIGNO_CASE(SIGCONT); 861cb0ef41Sopenharmony_ci#endif 871cb0ef41Sopenharmony_ci 881cb0ef41Sopenharmony_ci#ifdef SIGSTOP 891cb0ef41Sopenharmony_ci SIGNO_CASE(SIGSTOP); 901cb0ef41Sopenharmony_ci#endif 911cb0ef41Sopenharmony_ci 921cb0ef41Sopenharmony_ci#ifdef SIGTSTP 931cb0ef41Sopenharmony_ci SIGNO_CASE(SIGTSTP); 941cb0ef41Sopenharmony_ci#endif 951cb0ef41Sopenharmony_ci 961cb0ef41Sopenharmony_ci#ifdef SIGBREAK 971cb0ef41Sopenharmony_ci SIGNO_CASE(SIGBREAK); 981cb0ef41Sopenharmony_ci#endif 991cb0ef41Sopenharmony_ci 1001cb0ef41Sopenharmony_ci#ifdef SIGTTIN 1011cb0ef41Sopenharmony_ci SIGNO_CASE(SIGTTIN); 1021cb0ef41Sopenharmony_ci#endif 1031cb0ef41Sopenharmony_ci 1041cb0ef41Sopenharmony_ci#ifdef SIGTTOU 1051cb0ef41Sopenharmony_ci SIGNO_CASE(SIGTTOU); 1061cb0ef41Sopenharmony_ci#endif 1071cb0ef41Sopenharmony_ci 1081cb0ef41Sopenharmony_ci#ifdef SIGURG 1091cb0ef41Sopenharmony_ci SIGNO_CASE(SIGURG); 1101cb0ef41Sopenharmony_ci#endif 1111cb0ef41Sopenharmony_ci 1121cb0ef41Sopenharmony_ci#ifdef SIGXCPU 1131cb0ef41Sopenharmony_ci SIGNO_CASE(SIGXCPU); 1141cb0ef41Sopenharmony_ci#endif 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_ci#ifdef SIGXFSZ 1171cb0ef41Sopenharmony_ci SIGNO_CASE(SIGXFSZ); 1181cb0ef41Sopenharmony_ci#endif 1191cb0ef41Sopenharmony_ci 1201cb0ef41Sopenharmony_ci#ifdef SIGVTALRM 1211cb0ef41Sopenharmony_ci SIGNO_CASE(SIGVTALRM); 1221cb0ef41Sopenharmony_ci#endif 1231cb0ef41Sopenharmony_ci 1241cb0ef41Sopenharmony_ci#ifdef SIGPROF 1251cb0ef41Sopenharmony_ci SIGNO_CASE(SIGPROF); 1261cb0ef41Sopenharmony_ci#endif 1271cb0ef41Sopenharmony_ci 1281cb0ef41Sopenharmony_ci#ifdef SIGWINCH 1291cb0ef41Sopenharmony_ci SIGNO_CASE(SIGWINCH); 1301cb0ef41Sopenharmony_ci#endif 1311cb0ef41Sopenharmony_ci 1321cb0ef41Sopenharmony_ci#ifdef SIGIO 1331cb0ef41Sopenharmony_ci SIGNO_CASE(SIGIO); 1341cb0ef41Sopenharmony_ci#endif 1351cb0ef41Sopenharmony_ci 1361cb0ef41Sopenharmony_ci#ifdef SIGPOLL 1371cb0ef41Sopenharmony_ci#if SIGPOLL != SIGIO 1381cb0ef41Sopenharmony_ci SIGNO_CASE(SIGPOLL); 1391cb0ef41Sopenharmony_ci#endif 1401cb0ef41Sopenharmony_ci#endif 1411cb0ef41Sopenharmony_ci 1421cb0ef41Sopenharmony_ci#ifdef SIGLOST 1431cb0ef41Sopenharmony_ci#if SIGLOST != SIGABRT 1441cb0ef41Sopenharmony_ci SIGNO_CASE(SIGLOST); 1451cb0ef41Sopenharmony_ci#endif 1461cb0ef41Sopenharmony_ci#endif 1471cb0ef41Sopenharmony_ci 1481cb0ef41Sopenharmony_ci#ifdef SIGPWR 1491cb0ef41Sopenharmony_ci#if SIGPWR != SIGLOST 1501cb0ef41Sopenharmony_ci SIGNO_CASE(SIGPWR); 1511cb0ef41Sopenharmony_ci#endif 1521cb0ef41Sopenharmony_ci#endif 1531cb0ef41Sopenharmony_ci 1541cb0ef41Sopenharmony_ci#ifdef SIGINFO 1551cb0ef41Sopenharmony_ci#if !defined(SIGPWR) || SIGINFO != SIGPWR 1561cb0ef41Sopenharmony_ci SIGNO_CASE(SIGINFO); 1571cb0ef41Sopenharmony_ci#endif 1581cb0ef41Sopenharmony_ci#endif 1591cb0ef41Sopenharmony_ci 1601cb0ef41Sopenharmony_ci#ifdef SIGSYS 1611cb0ef41Sopenharmony_ci SIGNO_CASE(SIGSYS); 1621cb0ef41Sopenharmony_ci#endif 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ci default: 1651cb0ef41Sopenharmony_ci return ""; 1661cb0ef41Sopenharmony_ci } 1671cb0ef41Sopenharmony_ci} 1681cb0ef41Sopenharmony_ci 1691cb0ef41Sopenharmony_ci} // namespace node 170