diff options
author | Kalle Sommer Nielsen <kalle@php.net> | 2015-04-22 09:29:45 +0200 |
---|---|---|
committer | Kalle Sommer Nielsen <kalle@php.net> | 2015-04-22 09:29:45 +0200 |
commit | ceb1ea37adcde37a9dcc1b859e778e6e17154dc8 (patch) | |
tree | e4a4f9123ec493d946355575a94233397d0f06fb | |
parent | af3c72bc805fc0167581fe83ecd24398f509cea0 (diff) | |
download | php-git-ceb1ea37adcde37a9dcc1b859e778e6e17154dc8.tar.gz |
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
-rw-r--r-- | ext/sysvshm/config.w32 | 8 | ||||
-rw-r--r-- | ext/sysvshm/php_sysvshm.h | 13 | ||||
-rw-r--r-- | ext/sysvshm/tests/001.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/002.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/003.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/004.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/005.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/006.phpt | 5 | ||||
-rw-r--r-- | ext/sysvshm/tests/007.phpt | 5 |
9 files changed, 47 insertions, 9 deletions
diff --git a/ext/sysvshm/config.w32 b/ext/sysvshm/config.w32 new file mode 100644 index 0000000000..3a9a0d47df --- /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 72e09b71ec..36ec0fb650 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 4b1525b697..778b796dcc 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 61174c6b83..4ae7a86a4a 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 8f37d625a7..9b5ed4ddba 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 da420b2a66..877f9f4a6d 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 acfd8c03e2..15200c6dd8 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 d319e888dc..1e4ec1c357 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 e1ba1e413a..d68fcea7dd 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 |