[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests 001.phpt bug47566.phpt

2009-05-26 Thread Arnaud Le Blanc
lbarnaudTue May 26 14:01:39 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pcntl/testsbug47566.phpt 

  Modified files:  
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/tests001.phpt 
  Log:
  MFH: Fix return value of pcntl_wexitstatus() (fixes #47566,
  patch by james at jamesreno dot com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.20r2=1.48.2.2.2.4.2.21diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.20 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.21
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.20 Sat Mar 28 03:21:04 2009
+++ php-src/ext/pcntl/pcntl.c   Tue May 26 14:01:39 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.20 2009/03/28 03:21:04 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.21 2009/05/26 14:01:39 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -607,9 +607,7 @@
   return;
}
 
-   /* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
-  if you want to have valid negative exit codes */
-   RETURN_LONG((signed char) WEXITSTATUS(status_word));
+   RETURN_LONG(WEXITSTATUS(status_word));
 #else
RETURN_FALSE;
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/001.phpt?r1=1.8.6.1r2=1.8.6.2diff_format=u
Index: php-src/ext/pcntl/tests/001.phpt
diff -u php-src/ext/pcntl/tests/001.phpt:1.8.6.1 
php-src/ext/pcntl/tests/001.phpt:1.8.6.2
--- php-src/ext/pcntl/tests/001.phpt:1.8.6.1Tue Aug  5 15:12:19 2008
+++ php-src/ext/pcntl/tests/001.phptTue May 26 14:01:39 2009
@@ -73,7 +73,7 @@
 Staring wait.h tests
 
 Testing pcntl_wifexited and wexitstatus
-Exited With: -1
+Exited With: 255
 
 Testing pcntl_wifsignaled
 Process was terminated by signal : SIGTERM

http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/bug47566.phpt?view=markuprev=1.1
Index: php-src/ext/pcntl/tests/bug47566.phpt
+++ php-src/ext/pcntl/tests/bug47566.phpt
--TEST--
Bug #47566 (return value of pcntl_wexitstatus())
--SKIPIF--
?php if (!extension_loaded(pcntl)) print skip; ?
--FILE--
?
$pid = pcntl_fork();
if ($pid == -1) {
 echo Unable to fork;
 exit;
} elseif ($pid) {
 $epid = pcntl_waitpid(-1,$status);
 var_dump(pcntl_wexitstatus($status));
} else {
 exit(128);
}
?
--EXPECT--
int(128)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-28 Thread Antony Dovgal
On 28.03.2009 04:32, Matteo Beccati wrote:
 mbeccati  Sat Mar 28 01:32:51 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/pcntlpcntl.c 
 /php-src/ext/pcntl/tests  pcntl_signal.phpt 
   Log:
   MFH:
   - Fixed pcntl_signal() returning NULL when passing wrong parameters

Fixed? Since when standard behavior is broken? 
What's wrong with that?

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-28 Thread Matteo Beccati

Antony Dovgal ha scritto:

On 28.03.2009 04:32, Matteo Beccati wrote:

mbeccatiSat Mar 28 01:32:51 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl	pcntl.c 
/php-src/ext/pcntl/tests	pcntl_signal.phpt 
  Log:

  MFH:
  - Fixed pcntl_signal() returning NULL when passing wrong parameters


Fixed? Since when standard behavior is broken? 
What's wrong with that?


Sorry about that. I've reverted a few minutes later after Arnaud pointed 
me to the standard behaviour.



Cheers

--
Matteo Beccati

OpenX - http://www.openx.org

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 01:32:51 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  MFH:
  - Fixed pcntl_signal() returning NULL when passing wrong parameters
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.17r2=1.48.2.2.2.4.2.18diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.17 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.17 Wed Mar 25 23:34:08 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 01:32:50 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.17 2009/03/25 23:34:08 lbarnaud Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.18 2009/03/28 01:32:50 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   return;
+   RETURN_FALSE;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.2 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.2   Fri Sep 12 19:49:46 2008
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 01:32:51 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-NULL
+bool(false)
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:12:52 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  MFH:
  - Reverting: pcntl_signal() returning NULL when passing wrong parameters
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.18r2=1.48.2.2.2.4.2.19diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.19
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18 Sat Mar 28 01:32:50 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 03:12:52 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.18 2009/03/28 01:32:50 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.19 2009/03/28 03:12:52 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.4
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3   Sat Mar 28 01:32:51 2009
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 03:12:52 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-bool(false)
+NULL
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests 002.phpt

2009-03-25 Thread Arnaud Le Blanc
lbarnaudWed Mar 25 23:34:08 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/tests002.phpt 
  Log:
  MFH: Fix build on FreeBSD 7 (fixes #4)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.16r2=1.48.2.2.2.4.2.17diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.16 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.17
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.16 Wed Mar 25 22:52:30 2009
+++ php-src/ext/pcntl/pcntl.c   Wed Mar 25 23:34:08 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.16 2009/03/25 22:52:30 felipe Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.17 2009/03/25 23:34:08 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -290,50 +290,120 @@
 #endif
 
/* si_code for SIGCHILD */
+#ifdef CLD_EXITED
REGISTER_LONG_CONSTANT(CLD_EXITED,CLD_EXITED,CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef CLD_KILLED
REGISTER_LONG_CONSTANT(CLD_KILLED,CLD_KILLED,CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef CLD_DUMPED
REGISTER_LONG_CONSTANT(CLD_DUMPED,CLD_DUMPED,CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef CLD_TRAPPED
REGISTER_LONG_CONSTANT(CLD_TRAPPED,   CLD_TRAPPED,   CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef CLD_STOPPED
REGISTER_LONG_CONSTANT(CLD_STOPPED,   CLD_STOPPED,   CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef CLD_CONTINUED
REGISTER_LONG_CONSTANT(CLD_CONTINUED, CLD_CONTINUED, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
/* si_code for SIGTRAP */
+#ifdef TRAP_BRKPT
REGISTER_LONG_CONSTANT(TRAP_BRKPT, TRAP_BRKPT, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef TRAP_TRACE
REGISTER_LONG_CONSTANT(TRAP_TRACE, TRAP_TRACE, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
/* si_code for SIGPOLL */
+#ifdef POLL_IN
REGISTER_LONG_CONSTANT(POLL_IN,  POLL_IN,  CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef POLL_OUT
REGISTER_LONG_CONSTANT(POLL_OUT, POLL_OUT, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef POLL_MSG
REGISTER_LONG_CONSTANT(POLL_MSG, POLL_MSG, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef POLL_ERR
REGISTER_LONG_CONSTANT(POLL_ERR, POLL_ERR, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef POLL_PRI
REGISTER_LONG_CONSTANT(POLL_PRI, POLL_PRI, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef POLL_HUP
REGISTER_LONG_CONSTANT(POLL_HUP, POLL_HUP, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
+#ifdef ILL_ILLOPC
REGISTER_LONG_CONSTANT(ILL_ILLOPC, ILL_ILLOPC, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_ILLOPN
REGISTER_LONG_CONSTANT(ILL_ILLOPN, ILL_ILLOPN, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_ILLADR
REGISTER_LONG_CONSTANT(ILL_ILLADR, ILL_ILLADR, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_ILLTRP
REGISTER_LONG_CONSTANT(ILL_ILLTRP, ILL_ILLTRP, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_PRVOPC
REGISTER_LONG_CONSTANT(ILL_PRVOPC, ILL_PRVOPC, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_PRVREG
REGISTER_LONG_CONSTANT(ILL_PRVREG, ILL_PRVREG, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_COPROC
REGISTER_LONG_CONSTANT(ILL_COPROC, ILL_COPROC, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef ILL_BADSTK
REGISTER_LONG_CONSTANT(ILL_BADSTK, ILL_BADSTK, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
+#ifdef FPE_INTDIV
REGISTER_LONG_CONSTANT(FPE_INTDIV, FPE_INTDIV, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_INTOVF
REGISTER_LONG_CONSTANT(FPE_INTOVF, FPE_INTOVF, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTDIV
REGISTER_LONG_CONSTANT(FPE_FLTDIV, FPE_FLTDIV, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTOVF
REGISTER_LONG_CONSTANT(FPE_FLTOVF, FPE_FLTOVF, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTUND
REGISTER_LONG_CONSTANT(FPE_FLTUND, FPE_FLTINV, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTRES
REGISTER_LONG_CONSTANT(FPE_FLTRES, FPE_FLTRES, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTINV
REGISTER_LONG_CONSTANT(FPE_FLTINV, FPE_FLTINV, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef FPE_FLTSUB
REGISTER_LONG_CONSTANT(FPE_FLTSUB, FPE_FLTSUB, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
+#ifdef SEGV_MAPERR
REGISTER_LONG_CONSTANT(SEGV_MAPERR, SEGV_MAPERR, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef SEGV_ACCERR
REGISTER_LONG_CONSTANT(SEGV_ACCERR, SEGV_ACCERR, CONST_CS | 
CONST_PERSISTENT);
+#endif
 
+#ifdef BUS_ADRALN
REGISTER_LONG_CONSTANT(BUS_ADRALN, BUS_ADRALN, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef BUS_ADRERR
REGISTER_LONG_CONSTANT(BUS_ADRERR, BUS_ADRERR, CONST_CS | 
CONST_PERSISTENT);
+#endif
+#ifdef BUS_OBJERR
REGISTER_LONG_CONSTANT(BUS_OBJERR, BUS_OBJERR, CONST_CS | 
CONST_PERSISTENT);
 #endif

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c php_signal.h /ext/pcntl/tests 002.phpt

2008-11-09 Thread Arnaud Le Blanc
lbarnaudMon Nov 10 05:57:18 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c php_signal.h 
/php-src/ext/pcntl/tests002.phpt 
  Log:
  MFH: Added the oldset parameter to pcntl_sigprocmask().
  Already documented.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.12r2=1.48.2.2.2.4.2.13diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.12 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.13
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.12 Sun Nov  2 21:19:34 2008
+++ php-src/ext/pcntl/pcntl.c   Mon Nov 10 05:57:18 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.12 2008/11/02 21:19:34 felipe Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.13 2008/11/10 05:57:18 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -76,6 +76,7 @@
 ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigprocmask, 0, 0, 2)
ZEND_ARG_INFO(0, how)
ZEND_ARG_INFO(0, set)
+   ZEND_ARG_INFO(1, oldset)
 ZEND_END_ARG_INFO()
 
 static
@@ -760,20 +761,20 @@
 /* }}} */
 
 #ifdef HAVE_SIGPROCMASK
-/* {{{ proto bool pcntl_sigprocmask(int how, array set)
+/* {{{ proto bool pcntl_sigprocmask(int how, array set[, array oldset])
Examine and change blocked signals */
 PHP_FUNCTION(pcntl_sigprocmask)
 {
long  how, signo;
-   zval *user_set, **user_signo;
-   sigset_t  set;
+   zval *user_set, *user_oldset = NULL, **user_signo;
+   sigset_t  set, oldset;
HashPosition  pos;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, la, how, 
user_set) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, la|z, how, 
user_set, user_oldset) == FAILURE) {
return;
}
 
-   if (sigemptyset(set) != 0) {
+   if (sigemptyset(set) != 0 || sigemptyset(oldset) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
strerror(errno));
RETURN_FALSE;
}
@@ -793,11 +794,26 @@
zend_hash_move_forward_ex(Z_ARRVAL_P(user_set), pos);
}
 
-   if (sigprocmask(how, set, NULL) != 0) {
+   if (sigprocmask(how, set, oldset) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
strerror(errno));
RETURN_FALSE;
}
 
+   if (user_oldset != NULL) {
+   if (Z_TYPE_P(user_oldset) != IS_ARRAY) {
+   zval_dtor(user_oldset);
+   array_init(user_oldset);
+   } else {
+   zend_hash_clean(Z_ARRVAL_P(user_oldset));
+   }
+   for (signo = 1; signo  MAX(NSIG-1, SIGRTMAX); ++signo) {
+   if (sigismember(oldset, signo) != 1) {
+   continue;
+   }
+   add_next_index_long(user_oldset, signo);
+   }
+   }
+
RETURN_TRUE;
 }
 /* }}} */
@@ -859,6 +875,8 @@
if (Z_TYPE_P(user_siginfo) != IS_ARRAY) {
zval_dtor(user_siginfo);
array_init(user_siginfo);
+   } else {
+   zend_hash_clean(Z_ARRVAL_P(user_siginfo));
}
add_assoc_long_ex(user_siginfo, signo, sizeof(signo), 
siginfo.si_signo);
add_assoc_long_ex(user_siginfo, errno, sizeof(errno), 
siginfo.si_errno);
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/php_signal.h?r1=1.9.2.1.2.1.2.1r2=1.9.2.1.2.1.2.2diff_format=u
Index: php-src/ext/pcntl/php_signal.h
diff -u php-src/ext/pcntl/php_signal.h:1.9.2.1.2.1.2.1 
php-src/ext/pcntl/php_signal.h:1.9.2.1.2.1.2.2
--- php-src/ext/pcntl/php_signal.h:1.9.2.1.2.1.2.1  Mon Dec 31 07:17:11 2007
+++ php-src/ext/pcntl/php_signal.h  Mon Nov 10 05:57:18 2008
@@ -16,12 +16,19 @@
+--+
 */
 
-/* $Id: php_signal.h,v 1.9.2.1.2.1.2.1 2007/12/31 07:17:11 sebastian Exp $ */
+/* $Id: php_signal.h,v 1.9.2.1.2.1.2.2 2008/11/10 05:57:18 lbarnaud Exp $ */
 
 #include signal.h
 #ifndef PHP_SIGNAL_H
 #define PHP_SIGNAL_H
 
+#ifndef NSIG
+# define NSIG 32
+#endif
+#ifndef SIGRTMAX
+# define SIGRTMAX 64
+#endif
+
 typedef void Sigfunc(int);
 Sigfunc *php_signal(int signo, Sigfunc *func, int restart);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/002.phpt?r1=1.1.2.5r2=1.1.2.6diff_format=u
Index: php-src/ext/pcntl/tests/002.phpt
diff -u php-src/ext/pcntl/tests/002.phpt:1.1.2.5 
php-src/ext/pcntl/tests/002.phpt:1.1.2.6
--- php-src/ext/pcntl/tests/002.phpt:1.1.2.5Fri Sep 12 12:17:07 2008
+++ php-src/ext/pcntl/tests/002.phptMon Nov 10 05:57:18 2008
@@ -14,6 +14,11 @@
die('failed');
 } else if ($pid) {
pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,(string)SIGTERM));
+   $oldset = array();
+   pcntl_sigprocmask(SIG_BLOCK, 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c

2008-09-12 Thread Arnaud Le Blanc
lbarnaudFri Sep 12 19:49:18 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
  Log:
  MFH: initialize optional args
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.9r2=1.48.2.2.2.4.2.10diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.9 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.10
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.9  Tue Aug  5 15:12:19 2008
+++ php-src/ext/pcntl/pcntl.c   Fri Sep 12 19:49:18 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.9 2008/08/05 15:12:19 jani Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.10 2008/09/12 19:49:18 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -602,7 +602,7 @@
Executes specified program in current process space as defined by exec(2) */
 PHP_FUNCTION(pcntl_exec)
 {
-   zval *args, *envs;
+   zval *args = NULL, *envs = NULL;
zval **element;
HashTable *args_hash, *envs_hash;
int argc = 0, argi = 0;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c php_pcntl.h /ext/pcntl/tests pcntl_signal_dispatch.phpt

2008-07-29 Thread Arnaud Le Blanc
lbarnaudTue Jul 29 16:46:11 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pcntl/testspcntl_signal_dispatch.phpt 

  Modified files:  
/php-src/ext/pcntl  pcntl.c php_pcntl.h 
  Log:
  MFH: Added pcntl_signal_dispatch()
  [DOC] pcntl_signal_dispatch() allows to dispatch pending signals to registered
  signal handler functions on-demand. This allows to use pcntl_signal() without
  ticks.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.5r2=1.48.2.2.2.4.2.6diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.5 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.6
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.5  Mon Jun 30 13:15:03 2008
+++ php-src/ext/pcntl/pcntl.c   Tue Jul 29 16:46:11 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.5 2008/06/30 13:15:03 felipe Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.6 2008/07/29 16:46:11 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -134,6 +134,7 @@
PHP_FE(pcntl_waitpid,   arginfo_pcntl_waitpid)
PHP_FE(pcntl_wait,  arginfo_pcntl_wait)
PHP_FE(pcntl_signal,arginfo_pcntl_signal)
+   PHP_FE(pcntl_signal_dispatch,   arginfo_pcntl_void)
PHP_FE(pcntl_wifexited, arginfo_pcntl_wifexited)
PHP_FE(pcntl_wifstopped,arginfo_pcntl_wifstopped)
PHP_FE(pcntl_wifsignaled,   arginfo_pcntl_wifsignaled)
@@ -173,7 +174,7 @@
 #endif
 
 static void pcntl_signal_handler(int);
-static void pcntl_tick_handler();
+static void pcntl_signal_dispatch();
   
 void php_register_signal_constants(INIT_FUNC_ARGS)
 {
@@ -262,7 +263,7 @@
 PHP_MINIT_FUNCTION(pcntl)
 {
php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
-   php_add_tick_function(pcntl_tick_handler);
+   php_add_tick_function(pcntl_signal_dispatch);
 
return SUCCESS;
 }
@@ -644,6 +645,15 @@
 }
 /* }}} */
 
+/* {{{ proto bool pcntl_signal_dispatch()
+   Dispatch signals to signal handlers */
+PHP_FUNCTION(pcntl_signal_dispatch)
+{
+   pcntl_signal_dispatch();
+   RETURN_TRUE;
+}
+/* }}} */
+
 #ifdef HAVE_GETPRIORITY
 /* {{{ proto int pcntl_getpriority([int pid [, int process_identifier]])
Get the priority of any process */
@@ -747,7 +757,7 @@
PCNTL_G(tail) = psig;
 }
 
-void pcntl_tick_handler()
+void pcntl_signal_dispatch()
 {
zval *param, **handle, *retval;
struct php_pcntl_pending_signal *queue, *next;
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/php_pcntl.h?r1=1.20.2.1.2.1.2.2r2=1.20.2.1.2.1.2.3diff_format=u
Index: php-src/ext/pcntl/php_pcntl.h
diff -u php-src/ext/pcntl/php_pcntl.h:1.20.2.1.2.1.2.2 
php-src/ext/pcntl/php_pcntl.h:1.20.2.1.2.1.2.3
--- php-src/ext/pcntl/php_pcntl.h:1.20.2.1.2.1.2.2  Thu Jan  3 16:20:32 2008
+++ php-src/ext/pcntl/php_pcntl.h   Tue Jul 29 16:46:11 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcntl.h,v 1.20.2.1.2.1.2.2 2008/01/03 16:20:32 nlopess Exp $ */
+/* $Id: php_pcntl.h,v 1.20.2.1.2.1.2.3 2008/07/29 16:46:11 lbarnaud Exp $ */
 
 #ifndef PHP_PCNTL_H
 #define PHP_PCNTL_H
@@ -44,6 +44,7 @@
 PHP_FUNCTION(pcntl_wtermsig);
 PHP_FUNCTION(pcntl_wstopsig);
 PHP_FUNCTION(pcntl_signal);
+PHP_FUNCTION(pcntl_signal_dispatch);
 PHP_FUNCTION(pcntl_exec);
 #ifdef HAVE_GETPRIORITY
 PHP_FUNCTION(pcntl_getpriority);

http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal_dispatch.phpt?view=markuprev=1.1
Index: php-src/ext/pcntl/tests/pcntl_signal_dispatch.phpt
+++ php-src/ext/pcntl/tests/pcntl_signal_dispatch.phpt
--TEST--
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;
?
--FILE--
?php

pcntl_signal(SIGTERM, function ($signo) { echo Signal handler called!\n; });

echo Start!\n;
posix_kill(posix_getpid(), SIGTERM);
$i = 0; // dummy
pcntl_signal_dispatch();
echo Done!\n;

?
--EXPECTF--
Start!
Signal handler called!
Done!



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c

2008-06-22 Thread Alexey Zakhlestin
indeyetsSun Jun 22 15:16:11 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
  Log:
  updated to the new parameter-parsing api
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.3r2=1.48.2.2.2.4.2.4diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.3 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.4
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.3  Mon Dec 31 07:17:11 2007
+++ php-src/ext/pcntl/pcntl.c   Sun Jun 22 15:16:11 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.3 2007/12/31 07:17:11 sebastian Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.4 2008/06/22 15:16:11 indeyets Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -305,16 +305,14 @@
 PHP_FUNCTION(pcntl_wifexited)
 {
 #ifdef WIFEXITED
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
-   
-   if (WIFEXITED(status_word)) RETURN_TRUE;
+
+   if (WIFEXITED(status_word))
+   RETURN_TRUE;
 #endif
RETURN_FALSE;
 }
@@ -325,16 +323,14 @@
 PHP_FUNCTION(pcntl_wifstopped)
 {
 #ifdef WIFSTOPPED
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
-   
-   if (WIFSTOPPED(status_word)) RETURN_TRUE;
+
+   if (WIFSTOPPED(status_word))
+   RETURN_TRUE;
 #endif
RETURN_FALSE;
 }
@@ -345,16 +341,14 @@
 PHP_FUNCTION(pcntl_wifsignaled)
 {
 #ifdef WIFSIGNALED
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
-   
-   if (WIFSIGNALED(status_word)) RETURN_TRUE;
+
+   if (WIFSIGNALED(status_word))
+   RETURN_TRUE;
 #endif
RETURN_FALSE;
 }
@@ -365,14 +359,11 @@
 PHP_FUNCTION(pcntl_wexitstatus)
 {
 #ifdef WEXITSTATUS
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
 
/* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
   if you want to have valid negative exit codes */
@@ -388,15 +379,12 @@
 PHP_FUNCTION(pcntl_wtermsig)
 {
 #ifdef WTERMSIG
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
-   
+
RETURN_LONG(WTERMSIG(status_word));
 #else
RETURN_FALSE;
@@ -409,16 +397,13 @@
 PHP_FUNCTION(pcntl_wstopsig)
 {
 #ifdef WSTOPSIG
-   zval **status;
-   int status_word;
-   
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), 
status) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   long status_word;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, status_word) 
== FAILURE) {
+  return;
}
-   
-   status_word = (int) Z_LVAL_PP(status);
 
-   RETURN_LONG(WSTOPSIG(status_word));
+   RETURN_LONG(WSTOPSIG(status_word));
 #else
RETURN_FALSE;
 #endif
@@ -439,10 +424,10 @@
char **current_arg, **pair;
int pair_length;
char *key;
-   int key_length;
+   uint key_length;
char *path;
int path_len;
-   long key_num;
+   ulong key_num;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|aa, path, 
path_len, args, envs) == FAILURE) {
return;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c

2007-11-27 Thread Ilia Alshanetsky
iliaa   Tue Nov 27 17:13:18 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
  Log:
  Fixed bug #43373 (pcntl_fork() should not raise E_ERROR on error)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.1r2=1.48.2.2.2.4.2.2diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.1 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.2
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.1  Thu Sep 27 18:00:42 2007
+++ php-src/ext/pcntl/pcntl.c   Tue Nov 27 17:13:18 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.1 2007/09/27 18:00:42 dmitry Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.2 2007/11/27 17:13:18 iliaa Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -225,7 +225,7 @@
 
id = fork();
if (id == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, Error %d, errno);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Error %d, errno);
}

RETURN_LONG((long) id);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php