]> granicus.if.org Git - php/commitdiff
- Portability fix. (si_fd seems to be linux only thing)
authorJani Taskinen <jani@php.net>
Tue, 5 Aug 2008 15:12:11 +0000 (15:12 +0000)
committerJani Taskinen <jani@php.net>
Tue, 5 Aug 2008 15:12:11 +0000 (15:12 +0000)
ext/pcntl/config.m4
ext/pcntl/pcntl.c
ext/pcntl/php_pcntl.h
ext/pcntl/php_signal.c
ext/pcntl/tests/001.phpt
ext/pcntl/tests/002.phpt
ext/pcntl/tests/pcntl_signal_dispatch.phpt
ext/pcntl/tests/signal_closure_handler.phpt

index 3971c32a5d2077d24bad0c32162aa06c2f0ff701..9666275239484b37a2bd1aa2d45bd051e1409e53 100644 (file)
@@ -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
index f29588c66f56fa9cd81e2bf76ea5409b4b406544..92452437f09c6b3e564356e2b323ee5de52cb648 100755 (executable)
 #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 <sys/wait.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #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)
 {
index 2b957222c550fb88aa107ef25dbf64eb000f88f4..5dcd4e74d1ba9618fd7fd5953ea978e5e57ed42c 100644 (file)
@@ -21,9 +21,6 @@
 #ifndef PHP_PCNTL_H
 #define PHP_PCNTL_H
 
-#include <sys/wait.h>
-#include "php_signal.h"
-#include "php_ticks.h"
 extern zend_module_entry pcntl_module_entry;
 #define phpext_pcntl_ptr &pcntl_module_entry
 
index 459a2d78f0435a9b9cfd484188bbb02a1d532b54..daedeb40481b049a5fcd0f46799f60a0c62607ca 100644 (file)
@@ -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
+ */
index 74c529124bf712ea675b90e0ef0c00201e41ef0c..d83cae44686b25ec6fc770f3a6f0faacc59be048 100644 (file)
@@ -3,7 +3,7 @@ Test pcntl wait functionality
 --SKIPIF--
 <?php
        if (!extension_loaded("pcntl")) print "skip"; 
-       if (!function_exists("posix_kill")) print "skip posix_kill() not available";
+       elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
 ?>
 --FILE--
 <?php 
index 3d06d5e437dace5f7ef2179a3cddcc4625cf8459..9ea7cf9bb10e7407e063171951c95cc5ae7d895e 100644 (file)
@@ -2,8 +2,8 @@
 pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait()
 --SKIPIF--
 <?php
-if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
-if (!extension_loaded('posix')) die('skip posix extension not available');
+       if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
+       elseif (!extension_loaded('posix')) die('skip posix extension not available');
 ?>
 --FILE--
 <?php
index 82e0a78f151dd93843588d9ae1075c1eac729449..acf6cc05e184c91644ad14ac5b6347d8363c4b7c 100644 (file)
@@ -3,10 +3,10 @@ pcnt_signal_dispatch()
 --SKIPIF--
 <?php
        if (!extension_loaded("pcntl")) print "skip"; 
-       if (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
-       if (!function_exists("pcntl_signal_dispatch")) print "skip pcntl_signal_dispatch() not available";
-       if (!function_exists("posix_kill")) print "skip posix_kill() not available";
-       if (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
+       elseif (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
+       elseif (!function_exists("pcntl_signal_dispatch")) print "skip pcntl_signal_dispatch() not available";
+       elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
+       elseif (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
 ?>
 --FILE--
 <?php
index ba9b8f510667b75c054e76136a6e9fcf86f9bb58..106b9282968cd716fa6a5e6c2ec3fa5622d5bd2d 100755 (executable)
@@ -3,9 +3,9 @@ Closures as a signal handler
 --SKIPIF--
 <?php
        if (!extension_loaded("pcntl")) print "skip"; 
-       if (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
-       if (!function_exists("posix_kill")) print "skip posix_kill() not available";
-       if (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
+       elseif (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
+       elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
+       elseif (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
 ?>
 --FILE--
 <?php