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
This commit is contained in:
Kalle Sommer Nielsen 2015-04-22 09:29:45 +02:00
parent af3c72bc80
commit ceb1ea37ad
9 changed files with 47 additions and 9 deletions

8
ext/sysvshm/config.w32 Normal file
View file

@ -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');
}

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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