Skip to content

Commit

Permalink
Merge pull request #6 from iKwinto/develop
Browse files Browse the repository at this point in the history
[fix] Determining of available signals. Closes #5
  • Loading branch information
lifo101 authored Jan 17, 2018
2 parents 58705e2 + 2d1040d commit e0971c3
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/Lifo/Daemon/Daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -1957,17 +1957,33 @@ public static function findPhp($includeArgs = true)
return $phpPath;
}

private function getSignals()
/**
* Return available signals (IPC)
*
* @return array
*/
protected 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)
Expand Down

0 comments on commit e0971c3

Please sign in to comment.