From a0470b3ee360ee17453e652eefbad3381fdc6b2b Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Tue, 5 Aug 2008 15:12:11 +0000 Subject: [PATCH] - Portability fix. (si_fd seems to be linux only thing) --- ext/pcntl/config.m4 | 4 +--- ext/pcntl/pcntl.c | 17 +++++++++++------ ext/pcntl/php_pcntl.h | 3 --- ext/pcntl/php_signal.c | 9 ++++++++- ext/pcntl/tests/001.phpt | 2 +- ext/pcntl/tests/002.phpt | 4 ++-- ext/pcntl/tests/pcntl_signal_dispatch.phpt | 8 ++++---- ext/pcntl/tests/signal_closure_handler.phpt | 6 +++--- 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4 index 3971c32a5d..9666275239 100644 --- a/ext/pcntl/config.m4 +++ b/ext/pcntl/config.m4 @@ -9,11 +9,9 @@ PHP_ARG_ENABLE(pcntl, whether to enable pcntl support, [ --enable-pcntl Enable experimental pcntl support (CLI/CGI only)]) if test "$PHP_PCNTL" != "no"; then - AC_CHECK_FUNCS(fork, [ AC_DEFINE(HAVE_FORK,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ]) AC_CHECK_FUNCS(waitpid, [ AC_DEFINE(HAVE_WAITPID,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ]) AC_CHECK_FUNCS(sigaction, [ AC_DEFINE(HAVE_SIGACTION,1,[ ]) ], [ AC_MSG_ERROR(pcntl: sigaction() not supported by this platform) ]) - AC_CHECK_FUNCS(getpriority setpriority wait3 sigprocmask sigwaitinfo sigtimedwait) - + AC_CHECK_FUNCS([getpriority setpriority wait3 sigprocmask sigwaitinfo sigtimedwait]) PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli) fi diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index f29588c66f..92452437f0 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -35,8 +35,11 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "php_pcntl.h" +#include "php_signal.h" +#include "php_ticks.h" #if HAVE_GETPRIORITY || HAVE_SETPRIORITY || HAVE_WAIT3 +#include #include #include #endif @@ -864,12 +867,12 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ #ifdef SIGCHLD case SIGCHLD: add_ascii_assoc_long_ex(user_siginfo, "status", sizeof("status"), siginfo.si_status); -#ifdef si_utime +# ifdef si_utime add_ascii_assoc_double_ex(user_siginfo, "utime", sizeof("utime"), siginfo.si_utime); -#endif -#ifdef si_stime +# endif +# ifdef si_stime add_ascii_assoc_double_ex(user_siginfo, "stime", sizeof("stime"), siginfo.si_stime); -#endif +# endif add_ascii_assoc_long_ex(user_siginfo, "pid", sizeof("pid"), siginfo.si_pid); add_ascii_assoc_long_ex(user_siginfo, "uid", sizeof("uid"), siginfo.si_uid); break; @@ -883,7 +886,9 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ #ifdef SIGPOLL case SIGPOLL: add_ascii_assoc_long_ex(user_siginfo, "band", sizeof("band"), siginfo.si_band); +#ifdef si_fd add_ascii_assoc_long_ex(user_siginfo, "fd", sizeof("fd"), siginfo.si_fd); +#endif break; #endif EMPTY_SWITCH_DEFAULT_CASE(); @@ -894,7 +899,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } /* }}} */ -/* {{{ proto int sigwaitinfo(array set[, array &siginfo]) +/* {{{ proto int pcnlt_sigwaitinfo(array set[, array &siginfo]) Synchronously wait for queued signals */ PHP_FUNCTION(pcntl_sigwaitinfo) { @@ -902,7 +907,7 @@ PHP_FUNCTION(pcntl_sigwaitinfo) } /* }}} */ -/* {{{ proto int sigtimedwait(array set[, array &siginfo[, int seconds[, int nanoseconds]]]) +/* {{{ proto int pcntl_sigtimedwait(array set[, array &siginfo[, int seconds[, int nanoseconds]]]) Wait for queued signals */ PHP_FUNCTION(pcntl_sigtimedwait) { diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index 2b957222c5..5dcd4e74d1 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -21,9 +21,6 @@ #ifndef PHP_PCNTL_H #define PHP_PCNTL_H -#include -#include "php_signal.h" -#include "php_ticks.h" extern zend_module_entry pcntl_module_entry; #define phpext_pcntl_ptr &pcntl_module_entry diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 459a2d78f0..daedeb4048 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -24,7 +24,6 @@ * in the Unix Environment by W. Richard Stevens p 298. */ Sigfunc *php_signal(int signo, Sigfunc *func, int restart) { - struct sigaction act,oact; act.sa_handler = func; sigemptyset(&act.sa_mask); @@ -44,3 +43,11 @@ Sigfunc *php_signal(int signo, Sigfunc *func, int restart) return oact.sa_handler; } +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt index 74c529124b..d83cae4468 100644 --- a/ext/pcntl/tests/001.phpt +++ b/ext/pcntl/tests/001.phpt @@ -3,7 +3,7 @@ Test pcntl wait functionality --SKIPIF-- --FILE-- --FILE-- --FILE-- --FILE--