com php-src: Windows support for sysvshm: ext/sysvshm/config.w32 ext/sysvshm/php_sysvshm.h ext/sysvshm/tests/001.p hpt ext/sysvshm/tests/002.phpt
ext/sysvshm/tests/ 003.phpt ext/sysvshm/tests/004.phpt ext/sys vshm/tests/005.phpt ext/sysvshm/tests/006.php t ext/sysvshm/tests/007.phpt
| From: | Kalle Sommer Nielsen | Date: | Wed, 22 Apr 2015 07:29:45 +0000 |
| Subject: | com php-src: Windows support for sysvshm: ext/sysvshm/config.w32 ext/sysvshm/php_sysvshm.h ext/sysvshm/tests/001.p hpt ext/sysvshm/tests/002.phpt ext/sysvshm/tests/ 003.phpt ext/sysvshm/tests/004.phpt ext/sys vshm/tests/005.phpt ext/sysvshm/tests/006.php t ext/sysvshm/tests/007.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86435@lists.php.net to get a copy of this message | ||
Commit: ceb1ea37adcde37a9dcc1b859e778e6e17154dc8
Author: Kalle Sommer Nielsen <kalle@php.net> Wed, 22 Apr 2015 09:29:45 +0200
Parents: af3c72bc805fc0167581fe83ecd24398f509cea0
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ceb1ea37adcde37a9dcc1b859e778e6e17154dc8
Log:
Windows support for sysvshm
A little background:
* key_t is an int, like ext/shmop
* There is no ftok() (from ext/standard), so tests have a new check to see whether or not it is
available. This however means that the 7 tests will all be skipped for Windows. I know we cannot
properly implement an ftok() function since there is no inodes for NTFS, maybe we should look into
using the GetFileInfoByHandle() or similar to use the system unique ID for a file to get the same
functionality, Anatol?
* Despite the lack of phpt's, local testing works flawlessly but we better look into a solution
for this if we are to keep this patch
Changed paths:
A ext/sysvshm/config.w32
M ext/sysvshm/php_sysvshm.h
M ext/sysvshm/tests/001.phpt
M ext/sysvshm/tests/002.phpt
M ext/sysvshm/tests/003.phpt
M ext/sysvshm/tests/004.phpt
M ext/sysvshm/tests/005.phpt
M ext/sysvshm/tests/006.phpt
M ext/sysvshm/tests/007.phpt
Diff:
diff --git a/ext/sysvshm/config..w32 b/ext/sysvshm/config.w32
new file mode 100644
index 0000000..3a9a0d4
--- /dev/null
+++ b/ext/sysvshm/config.w32
@@ -0,0 +1,8 @@
+// vim:ft=javascript
+
+ARG_ENABLE('sysvshm', 'SysV Shared Memory support', 'no');
+
+if (PHP_SYSVSHM != 'no') {
+ AC_DEFINE('HAVE_SYSVSHM', 1);
+ EXTENSION('sysvshm', 'sysvshm.c');
+}
\ No newline at end of file
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
index 72e09b7..36ec0fb 100644
--- a/ext/sysvshm/php_sysvshm.h
+++ b/ext/sysvshm/php_sysvshm.h
@@ -30,8 +30,17 @@ extern zend_module_entry sysvshm_module_entry;
#define PHP_SYSVSHM_VERSION PHP_VERSION
#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+
+#ifdef PHP_WIN32
+# include <TSRM/tsrm_win32.h>
+typedef int key_t;
+# ifndef THREAD_LS
+# define THREAD_LS
+# endif
+#else
+# include <sys/ipc.h>
+# include <sys/shm.h>
+#endif
#define PHP_SHM_RSRC_NAME "sysvshm"
diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt
index 4b1525b..778b796 100644
--- a/ext/sysvshm/tests/001.phpt
+++ b/ext/sysvshm/tests/001.phpt
@@ -1,7 +1,10 @@
--TEST--
ftok() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt
index 61174c6..4ae7a86 100644
--- a/ext/sysvshm/tests/002.phpt
+++ b/ext/sysvshm/tests/002.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_attach() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt
index 8f37d62..9b5ed4d 100644
--- a/ext/sysvshm/tests/003.phpt
+++ b/ext/sysvshm/tests/003.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_detach() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/004.phpt b/ext/sysvshm/tests/004.phpt
index da420b2..877f9f4 100644
--- a/ext/sysvshm/tests/004.phpt
+++ b/ext/sysvshm/tests/004.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_put_var() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/005.phpt b/ext/sysvshm/tests/005.phpt
index acfd8c0..15200c6 100644
--- a/ext/sysvshm/tests/005.phpt
+++ b/ext/sysvshm/tests/005.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_get_var() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt
index d319e88..1e4ec1c 100644
--- a/ext/sysvshm/tests/006.phpt
+++ b/ext/sysvshm/tests/006.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_remove_var() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php
diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt
index e1ba1e4..d68fcea 100644
--- a/ext/sysvshm/tests/007.phpt
+++ b/ext/sysvshm/tests/007.phpt
@@ -1,7 +1,10 @@
--TEST--
shm_remove() tests
--SKIPIF--
-<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
+<?php
+if (!extension_loaded("sysvshm")){ print 'skip'; }
+if (!function_exists('ftok')){ print 'skip'; }
+?>
--FILE--
<?php