From b0d2bb1c4c16efed284ad598ca648a8e0f0ce053 Mon Sep 17 00:00:00 2001 From: Alexander Vasilyev Date: Wed, 17 Jan 2018 15:22:36 +0300 Subject: [PATCH 1/2] Filtering of non-existent signals. Added some new signals. --- src/Lifo/Daemon/Daemon.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Lifo/Daemon/Daemon.php b/src/Lifo/Daemon/Daemon.php index e4aed77..5cabb2e 100644 --- a/src/Lifo/Daemon/Daemon.php +++ b/src/Lifo/Daemon/Daemon.php @@ -1957,17 +1957,33 @@ public static function findPhp($includeArgs = true) return $phpPath; } + /** + * Return available signals (IPC) + * + * @return array + */ private function getSignals() { - return [ + $signals = [ // primary signals handled by the daemon - SIGTERM, SIGINT, SIGUSR1, SIGHUP, SIGCHLD, + 'SIGTERM', 'SIGINT', 'SIGUSR1', 'SIGHUP', 'SIGCHLD', // other signals that can be caught by setting an event handler - SIGUSR2, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT, SIGBUS, SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, - SIGCONT, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, - SIGWINCH, SIGIO, SIGPOLL, SIGSYS, SIGBABY, SIGPWR + 'SIGUSR2', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGIOT', + 'SIGBUS', 'SIGFPE', 'SIGSEGV', 'SIGPIPE', 'SIGALRM', 'SIGCONT', + 'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGXCPU', 'SIGXFSZ', + 'SIGVTALRM', 'SIGPROF', 'SIGWINCH', 'SIGIO', 'SIGPOLL', 'SIGSYS', + 'SIGBABY', 'SIGPWR', 'SIGEMT', 'SIGINFO', 'SIGPWR', 'SIGLOST', + 'SIGWINCH', 'SIGSTKFLT', 'SIGUNUSED', 'SIGCLD', 'SIGLWP', ]; + + $availableSignals = []; + foreach ($signals as $signal) { + if (defined($signal)) { + $availableSignals[$signal] = constant($signal); + } + } + return $availableSignals; } public function setupSignals($handler = null) From 2d1040de2d46327ce2c730500230d87d5041cebf Mon Sep 17 00:00:00 2001 From: Alexander Vasilyev Date: Wed, 17 Jan 2018 16:21:51 +0300 Subject: [PATCH 2/2] Changed access level of getSignals func. Small typo fix. --- src/Lifo/Daemon/Daemon.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Lifo/Daemon/Daemon.php b/src/Lifo/Daemon/Daemon.php index 5cabb2e..c3cedd7 100644 --- a/src/Lifo/Daemon/Daemon.php +++ b/src/Lifo/Daemon/Daemon.php @@ -1962,19 +1962,19 @@ public static function findPhp($includeArgs = true) * * @return array */ - private function getSignals() + protected function getSignals() { $signals = [ // primary signals handled by the daemon 'SIGTERM', 'SIGINT', 'SIGUSR1', 'SIGHUP', 'SIGCHLD', // other signals that can be caught by setting an event handler - 'SIGUSR2', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGIOT', - 'SIGBUS', 'SIGFPE', 'SIGSEGV', 'SIGPIPE', 'SIGALRM', 'SIGCONT', - 'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGXCPU', 'SIGXFSZ', - 'SIGVTALRM', 'SIGPROF', 'SIGWINCH', 'SIGIO', 'SIGPOLL', 'SIGSYS', - 'SIGBABY', 'SIGPWR', 'SIGEMT', 'SIGINFO', 'SIGPWR', 'SIGLOST', - 'SIGWINCH', 'SIGSTKFLT', 'SIGUNUSED', 'SIGCLD', 'SIGLWP', + 'SIGUSR2', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGIOT', + 'SIGBUS', 'SIGFPE', 'SIGSEGV', 'SIGPIPE', 'SIGALRM', 'SIGCONT', + 'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGXCPU', 'SIGXFSZ', + 'SIGVTALRM', 'SIGPROF', 'SIGWINCH', 'SIGIO', 'SIGPOLL', 'SIGSYS', + 'SIGBABY', 'SIGPWR', 'SIGEMT', 'SIGINFO', 'SIGPWR', 'SIGLOST', + 'SIGWINCH', 'SIGSTKFLT', 'SIGUNUSED', 'SIGCLD', 'SIGLWP', ]; $availableSignals = [];