From: Kalle Sommer Nielsen Date: Wed, 22 Apr 2015 07:29:45 +0000 (+0200) Subject: Windows support for sysvshm X-Git-Tag: PRE_PHP7_NSAPI_REMOVAL~184^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ceb1ea37adcde37a9dcc1b859e778e6e17154dc8;p=php 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 --- 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 -#include -#include + +#ifdef PHP_WIN32 +# include +typedef int key_t; +# ifndef THREAD_LS +# define THREAD_LS +# endif +#else +# include +# include +#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-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE--