Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing SIGPOLL and SIGPWR signals on some systems #5

Closed
npub opened this issue Jan 16, 2018 · 4 comments
Closed

Missing SIGPOLL and SIGPWR signals on some systems #5

npub opened this issue Jan 16, 2018 · 4 comments

Comments

@npub
Copy link
Contributor

npub commented Jan 16, 2018

There are some WARNING messages:

PHP Warning: Use of undefined constant SIGPOLL - assumed 'SIGPOLL' (this will throw an Error in a future version of PHP) in …/lifo/php-daemon/src/Lifo/Daemon/Daemon.php on line 1969

PHP Warning: Use of undefined constant SIGPWR - assumed 'SIGPWR' (this will throw an Error in a future version of PHP) in …/vendor/lifo/php-daemon/src/Lifo/Daemon/Daemon.php on line 1969

Systems (where this PHP constants are missing):

  • macOS 10.13.2 + PHP 7.2.1
  • FreeBSD 11 + PHP 5.6.32
  • FreeBSD 11 + PHP 7.1.13
  • FreeBSD 10 + PHP 7.2.0

How to check
Execute php -r "echo SIGPOLL;" and php -r "echo SIGPWR;"

Is any way how to exclude some signals that not presented in system?
Maybe overloading of function getSignals helps to resolve? — Unfortunately it is private function now.

@lifo101
Copy link
Owner

lifo101 commented Jan 16, 2018

One work-around, for now, is to overload the Daemon#setupSignals method and do not call getSignals. Instead just build your own list of signals to process. Those signals must have been removed in v5.6? The environment I'm using this daemon code in is still v5.4.

I suppose the getSignals method could be changed to protected instead of private to allow for overloading.

@npub
Copy link
Contributor Author

npub commented Jan 16, 2018

Those signals must have been removed in v5.6?

Output of kill -l command:

macOS 10.13

1 ) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5 ) SIGTRAP 6) SIGABRT 7) SIGEMT 8) SIGFPE
9 ) SIGKILL 10) SIGBUS 11) SIGSEGV 12) SIGSYS
13 ) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGURG
17 ) SIGSTOP 18) SIGTSTP 19) SIGCONT 20) SIGCHLD
21 ) SIGTTIN 22) SIGTTOU 23) SIGIO 24) SIGXCPU
25 ) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH
29 ) SIGINFO 30) SIGUSR1 31) SIGUSR2

FreeBSD 10-11

HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 LWP

Seems like these signals are absent at all in that systems.

I suppose the getSignals method could be changed to protected instead of private to allow for overloading.

Changing to private works :)

And Daemon::setupSignals is better solution and will be great!

@npub
Copy link
Contributor Author

npub commented Jan 16, 2018

Another way is to using of defined function to check all known signals before using.

if (defined('SIGPOLL')) {
    // do smth
}

@lifo101
Copy link
Owner

lifo101 commented Jan 16, 2018

Another way is to using of defined function to check all known signals before using.

Yeah, I thought of that. Would just need to change the constants in getSignals to strings instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants