summaryrefslogtreecommitdiff
path: root/ext/pcntl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcntl')
-rw-r--r--ext/pcntl/config.m42
-rwxr-xr-xext/pcntl/pcntl.c2
-rw-r--r--ext/pcntl/php_pcntl.h2
-rw-r--r--ext/pcntl/php_signal.c2
-rw-r--r--ext/pcntl/php_signal.h2
-rw-r--r--ext/pcntl/tests/bug47566.phpt2
-rw-r--r--ext/pcntl/tests/pcntl_fork_basic.phpt27
-rw-r--r--ext/pcntl/tests/pcntl_fork_variation.phpt48
8 files changed, 81 insertions, 6 deletions
diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4
index d0fef8ade..ea26eb149 100644
--- a/ext/pcntl/config.m4
+++ b/ext/pcntl/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.10.8.3 2008/08/07 13:11:05 tony2001 Exp $
+dnl $Id: config.m4 264390 2008-08-07 13:11:05Z tony2001 $
dnl
PHP_ARG_ENABLE(pcntl, whether to enable pcntl support,
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 85f08e24a..eec6aaa33 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.21 2009/05/26 14:01:39 lbarnaud Exp $ */
+/* $Id: pcntl.c 281177 2009-05-26 14:01:39Z lbarnaud $ */
#define PCNTL_DEBUG 0
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index 03e3d33cb..6bd45b212 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcntl.h,v 1.20.2.1.2.1.2.6 2008/12/31 11:15:40 sebastian Exp $ */
+/* $Id: php_pcntl.h 272370 2008-12-31 11:15:49Z sebastian $ */
#ifndef PHP_PCNTL_H
#define PHP_PCNTL_H
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 22c8fb32f..4396c0531 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_signal.c,v 1.9.2.1.2.1.2.3 2008/12/31 11:15:40 sebastian Exp $ */
+/* $Id: php_signal.c 272370 2008-12-31 11:15:49Z sebastian $ */
#include "php_signal.h"
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
index 06d8219ce..73a395c44 100644
--- a/ext/pcntl/php_signal.h
+++ b/ext/pcntl/php_signal.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_signal.h,v 1.9.2.1.2.1.2.3 2008/12/31 11:15:40 sebastian Exp $ */
+/* $Id: php_signal.h 272370 2008-12-31 11:15:49Z sebastian $ */
#include <signal.h>
#ifndef PHP_SIGNAL_H
diff --git a/ext/pcntl/tests/bug47566.phpt b/ext/pcntl/tests/bug47566.phpt
index 8a69e6bc7..6eb3dbc13 100644
--- a/ext/pcntl/tests/bug47566.phpt
+++ b/ext/pcntl/tests/bug47566.phpt
@@ -3,7 +3,7 @@ Bug #47566 (return value of pcntl_wexitstatus())
--SKIPIF--
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
--FILE--
-<?
+<?php
$pid = pcntl_fork();
if ($pid == -1) {
echo "Unable to fork";
diff --git a/ext/pcntl/tests/pcntl_fork_basic.phpt b/ext/pcntl/tests/pcntl_fork_basic.phpt
new file mode 100644
index 000000000..82759ba32
--- /dev/null
+++ b/ext/pcntl/tests/pcntl_fork_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function pcntl_fork() by calling it with its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
+ elseif (!extension_loaded('posix')) die('skip posix extension not available');
+?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with its expected arguments, first print the child PID and the the father ***\n";
+
+$pid = pcntl_fork();
+if ($pid > 0) {
+ pcntl_wait($status);
+ var_dump($pid);
+} else {
+ var_dump($pid);
+}
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments, first print the child PID and the the father ***
+int(0)
+int(%d)
diff --git a/ext/pcntl/tests/pcntl_fork_variation.phpt b/ext/pcntl/tests/pcntl_fork_variation.phpt
new file mode 100644
index 000000000..4eea07181
--- /dev/null
+++ b/ext/pcntl/tests/pcntl_fork_variation.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
+ elseif (!extension_loaded('posix')) die('skip posix extension not available');
+?>
+--FILE--
+<?php
+echo "*** Testing the process isolations between a process and its forks ***\n";
+
+$pid = pcntl_fork();
+
+if ($pid > 0) {
+ pcntl_wait($status);
+ echo "father is $pid\n";
+
+ if (!isset($pid2))
+ {
+ echo "father ($pid) doesn't know its grandsons\n";
+ }
+}
+else
+{
+ echo "son ($pid)\n";
+ $pid2 = pcntl_fork();
+ if ($pid2 > 0)
+ {
+ pcntl_wait($status2);
+ echo "son is father of $pid2\n";
+ }
+ else
+ {
+ echo "grandson ($pid2)\n";
+ }
+}
+?>
+--EXPECTF--
+*** Testing the process isolations between a process and its forks ***
+son (0)
+grandson (0)
+son is father of %d
+father is %d
+father (%d) doesn't know its grandsons