diff options
Diffstat (limited to 'ext/shmop')
-rw-r--r-- | ext/shmop/CREDITS | 2 | ||||
-rw-r--r-- | ext/shmop/README | 69 | ||||
-rw-r--r-- | ext/shmop/config.m4 | 8 | ||||
-rw-r--r-- | ext/shmop/config.w32 | 9 | ||||
-rw-r--r-- | ext/shmop/php_shmop.h | 84 | ||||
-rw-r--r-- | ext/shmop/shmop.c | 368 | ||||
-rw-r--r-- | ext/shmop/shmop.dsp | 107 | ||||
-rw-r--r-- | ext/shmop/tests/001.phpt | 91 |
8 files changed, 0 insertions, 738 deletions
diff --git a/ext/shmop/CREDITS b/ext/shmop/CREDITS deleted file mode 100644 index caab89e208..0000000000 --- a/ext/shmop/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -Shared Memory Operations -Slava Poliakov, Ilia Alshanetsky diff --git a/ext/shmop/README b/ext/shmop/README deleted file mode 100644 index 5ec15861b8..0000000000 --- a/ext/shmop/README +++ /dev/null @@ -1,69 +0,0 @@ -last update Jan 2, 2002 (hackie@prohost.org/ilia@prohost.org) - -Shared Memory Operations Extension to PHP - - While developing a search deamon we needed a php based front end - to communicate the deamon via SHM. PHP already had a shared memory - extention (sysvshm) written by Christian Cartus <cartus@atrior.de>, - unfortunatly this extention was designed with PHP only in mind and - offers high level features which are extremly bothersome for basic SHM - we had in mind. After spending a day trying to reverse engineer and figure - out the format of sysvshm we decided that it would be much easier to - add our own extention to php for simple SHM operations, we were right :)). - -the functions are: - -int shmop_open(int key, string flags, int mode, int size) - - key - the key of/for the shared memory block - flags - 4 flags are avalible - a for read only access (sets SHM_RDONLY) - w for read & write access - c create or open an existing segment (sets IPC_CREATE) - n create a new segment and fail if one already exists under same name (sets IPC_CREATE|IPC_EXCL) - (the n flag is mostly useful for security perpouses, so that you don't end up opening a faked segment - if someone guesses your key) - mode - acsess mode same as for a file (0644) for example - size - size of the block in bytes - - returns an indentifier - - -char shmop_read(int shmid, int start, int count) - - shmid - shmid from which to read - start - offset from which to start reading - count - how many bytes to read - - returns the data read - -int shmop_write(int shmid, string data, int offset) - - shmid - shmid from which to read - data - string to put into shared memory - offset - offset in shm to write from - - returns bytes written - -int shmop_size(int shmid) - - shmid - shmid for which to return the size - - returns the size in bytes of the shm segment - - -int shmop_delete(int shmid) - - marks the segment for deletion, the segment will be deleted when all processes mapping it will detach - - shmid - shmid which to mark for deletion - - returns 1 if all ok, zero on failure - -int shmop_close(int shmid) - - shmid - shmid which to close - - returns zero - - diff --git a/ext/shmop/config.m4 b/ext/shmop/config.m4 deleted file mode 100644 index 6c1709d715..0000000000 --- a/ext/shmop/config.m4 +++ /dev/null @@ -1,8 +0,0 @@ -dnl $Id$ -PHP_ARG_ENABLE(shmop, whether to enable shmop support, -[ --enable-shmop Enable shmop support]) - -if test "$PHP_SHMOP" != "no"; then - AC_DEFINE(HAVE_SHMOP, 1, [ ]) - PHP_NEW_EXTENSION(shmop, shmop.c, $ext_shared) -fi diff --git a/ext/shmop/config.w32 b/ext/shmop/config.w32 deleted file mode 100644 index 9302184af6..0000000000 --- a/ext/shmop/config.w32 +++ /dev/null @@ -1,9 +0,0 @@ -// $Id$ -// vim:ft=javascript - -ARG_ENABLE("shmop", "shmop support", "no"); - -if (PHP_SHMOP == "yes") { - EXTENSION("shmop", "shmop.c"); - AC_DEFINE('HAVE_SHMOP', 1, 'Have SHMOP support'); -} diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h deleted file mode 100644 index 485826d0c0..0000000000 --- a/ext/shmop/php_shmop.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Slava Poliakov <hackie@prohost.org> | - | Ilia Alshanetsky <ilia@prohost.org> | - +----------------------------------------------------------------------+ - */ -#ifndef PHP_SHMOP_H -#define PHP_SHMOP_H - -#if HAVE_SHMOP - -extern zend_module_entry shmop_module_entry; -#define phpext_shmop_ptr &shmop_module_entry - -#ifdef PHP_WIN32 -#define PHP_SHMOP_API __declspec(dllexport) -#else -#define PHP_SHMOP_API -#endif - -PHP_MINIT_FUNCTION(shmop); -PHP_MSHUTDOWN_FUNCTION(shmop); -PHP_RINIT_FUNCTION(shmop); -PHP_RSHUTDOWN_FUNCTION(shmop); -PHP_MINFO_FUNCTION(shmop); - -PHP_FUNCTION(shmop_open); -PHP_FUNCTION(shmop_read); -PHP_FUNCTION(shmop_close); -PHP_FUNCTION(shmop_size); -PHP_FUNCTION(shmop_write); -PHP_FUNCTION(shmop_delete); - -#ifdef PHP_WIN32 -typedef int key_t; -#endif - -struct php_shmop -{ - int shmid; - key_t key; - int shmflg; - int shmatflg; - char *addr; - int size; -}; - -typedef struct { - int le_shmop; -} php_shmop_globals; - -#ifdef ZTS -#define SHMOPG(v) TSRMG(shmop_globals_id, php_shmop_globals *, v) -#else -#define SHMOPG(v) (shmop_globals.v) -#endif - -#else - -#define phpext_shmop_ptr NULL - -#endif - -#endif /* PHP_SHMOP_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c deleted file mode 100644 index 78d9e1b973..0000000000 --- a/ext/shmop/shmop.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Slava Poliakov <hackie@prohost.org> | - | Ilia Alshanetsky <ilia@prohost.org> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "php_shmop.h" -# ifndef PHP_WIN32 -# include <sys/ipc.h> -# include <sys/shm.h> -#else -#include "tsrm_win32.h" -#endif - - -#if HAVE_SHMOP - -#include "ext/standard/info.h" - -#ifdef ZTS -int shmop_globals_id; -#else -php_shmop_globals shmop_globals; -#endif - -int shm_type; - -/* {{{ shmop_functions[] - */ -function_entry shmop_functions[] = { - PHP_FE(shmop_open, NULL) - PHP_FE(shmop_read, NULL) - PHP_FE(shmop_close, NULL) - PHP_FE(shmop_size, NULL) - PHP_FE(shmop_write, NULL) - PHP_FE(shmop_delete, NULL) - {NULL, NULL, NULL} /* Must be the last line in shmop_functions[] */ -}; -/* }}} */ - -/* {{{ shmop_module_entry - */ -zend_module_entry shmop_module_entry = { - STANDARD_MODULE_HEADER, - "shmop", - shmop_functions, - PHP_MINIT(shmop), - PHP_MSHUTDOWN(shmop), - NULL, - NULL, - PHP_MINFO(shmop), - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES -}; -/* }}} */ - -#ifdef COMPILE_DL_SHMOP -ZEND_GET_MODULE(shmop) -#endif - -/* {{{ rsclean - */ -static void rsclean(zend_rsrc_list_entry *rsrc TSRMLS_DC) -{ - struct php_shmop *shmop = (struct php_shmop *)rsrc->ptr; - - shmdt(shmop->addr); - efree(shmop); -} -/* }}} */ - -/* {{{ PHP_MINIT_FUNCTION - */ -PHP_MINIT_FUNCTION(shmop) -{ - shm_type = zend_register_list_destructors_ex(rsclean, NULL, "shmop", module_number); - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ -PHP_MSHUTDOWN_FUNCTION(shmop) -{ - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION - */ -PHP_MINFO_FUNCTION(shmop) -{ - php_info_print_table_start(); - php_info_print_table_row(2, "shmop support", "enabled"); - php_info_print_table_end(); -} -/* }}} */ - -/* {{{ proto int shmop_open (int key, string flags, int mode, int size) - gets and attaches a shared memory segment */ -PHP_FUNCTION(shmop_open) -{ - long key, mode, size; - struct php_shmop *shmop; - struct shmid_ds shm; - int rsid; - char *flags; - int flags_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) { - WRONG_PARAM_COUNT; - } - - if (flags_len != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid flag", flags); - RETURN_FALSE; - } - - shmop = emalloc(sizeof(struct php_shmop)); - memset(shmop, 0, sizeof(struct php_shmop)); - - shmop->key = key; - shmop->shmflg |= mode; - - switch (flags[0]) - { - case 'a': - shmop->shmatflg |= SHM_RDONLY; - break; - case 'c': - shmop->shmflg |= IPC_CREAT; - shmop->size = size; - break; - case 'n': - shmop->shmflg |= (IPC_CREAT | IPC_EXCL); - shmop->size = size; - break; - case 'w': - /* noop - shm segment is being opened for read & write - will fail if segment does not exist - */ - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid access mode"); - efree(shmop); - RETURN_FALSE; - } - - shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg); - if (shmop->shmid == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach or create shared memory segment"); - efree(shmop); - RETURN_FALSE; - } - - if (shmctl(shmop->shmid, IPC_STAT, &shm)) { - efree(shmop); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to get shared memory segment information"); - RETURN_FALSE; - } - - shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg); - if (shmop->addr == (char*) -1) { - efree(shmop); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach to shared memory segment"); - RETURN_FALSE; - } - - shmop->size = shm.shm_segsz; - - rsid = zend_list_insert(shmop, shm_type); - RETURN_LONG(rsid); -} -/* }}} */ - -/* {{{ proto string shmop_read (int shmid, int start, int count) - reads from a shm segment */ -PHP_FUNCTION(shmop_read) -{ - long shmid, start, count; - struct php_shmop *shmop; - int type; - char *startaddr; - int bytes; - char *return_string; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) { - WRONG_PARAM_COUNT; - } - - shmop = zend_list_find(shmid, &type); - - if (!shmop) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid); - RETURN_FALSE; - } - - if (start < 0 || start > shmop->size) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "start is out of range"); - RETURN_FALSE; - } - - if (start + count > shmop->size) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range"); - RETURN_FALSE; - } - - if (count < 0 ){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range"); - RETURN_FALSE; - } - - startaddr = shmop->addr + start; - bytes = count ? count : shmop->size - start; - - return_string = emalloc(bytes+1); - memcpy(return_string, startaddr, bytes); - return_string[bytes] = 0; - - RETURN_STRINGL(return_string, bytes, 0); -} -/* }}} */ - -/* {{{ proto void shmop_close (int shmid) - closes a shared memory segment */ -PHP_FUNCTION(shmop_close) -{ - long shmid; - struct php_shmop *shmop; - int type; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { - WRONG_PARAM_COUNT; - } - - shmop = zend_list_find(shmid, &type); - - if (!shmop) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid); - RETURN_FALSE; - } - - zend_list_delete(shmid); -} -/* }}} */ - -/* {{{ proto int shmop_size (int shmid) - returns the shm size */ -PHP_FUNCTION(shmop_size) -{ - long shmid; - struct php_shmop *shmop; - int type; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { - WRONG_PARAM_COUNT; - } - - shmop = zend_list_find(shmid, &type); - - if (!shmop) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid); - RETURN_FALSE; - } - - RETURN_LONG(shmop->size); -} -/* }}} */ - -/* {{{ proto int shmop_write (int shmid, string data, int offset) - writes to a shared memory segment */ -PHP_FUNCTION(shmop_write) -{ - struct php_shmop *shmop; - int type; - int writesize; - long shmid, offset; - char *data; - int data_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &shmid, &data, &data_len, &offset) == FAILURE) { - WRONG_PARAM_COUNT; - } - - shmop = zend_list_find(shmid, &type); - - if (!shmop) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid); - RETURN_FALSE; - } - - if ((shmop->shmatflg & SHM_RDONLY) == SHM_RDONLY) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "trying to write to a read only segment"); - RETURN_FALSE; - } - - if (offset > shmop->size) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "offset out of range"); - RETURN_FALSE; - } - - writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset; - memcpy(shmop->addr + offset, data, writesize); - - RETURN_LONG(writesize); -} -/* }}} */ - -/* {{{ proto bool shmop_delete (int shmid) - mark segment for deletion */ -PHP_FUNCTION(shmop_delete) -{ - long shmid; - struct php_shmop *shmop; - int type; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { - WRONG_PARAM_COUNT; - } - - shmop = zend_list_find(shmid, &type); - - if (!shmop) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid); - RETURN_FALSE; - } - - if (shmctl(shmop->shmid, IPC_RMID, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't mark segment for deletion (are you the owner?)"); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -#endif /* HAVE_SHMOP */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/shmop/shmop.dsp b/ext/shmop/shmop.dsp deleted file mode 100644 index 848f0bdc91..0000000000 --- a/ext/shmop/shmop.dsp +++ /dev/null @@ -1,107 +0,0 @@ -# Microsoft Developer Studio Project File - Name="shmop" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=shmop - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak" CFG="shmop - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "shmop - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "shmop - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "shmop - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D "WIN32" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SHMOP" /D COMPILE_DL_SHMOP=1 /D ZEND_DEBUG=0 /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_shmop.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "shmop - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D "WIN32" /D ZEND_DEBUG=1 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_EXPORTS" /D "COMPILE_DL_SHMOP" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SHMOP=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_shmop.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "shmop - Win32 Release_TS"
-# Name "shmop - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\shmop.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_shmop.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt deleted file mode 100644 index 1a1b926308..0000000000 --- a/ext/shmop/tests/001.phpt +++ /dev/null @@ -1,91 +0,0 @@ ---TEST-- -shmop extension test ---SKIPIF-- -<?php - if (!extension_loaded("shmop")) { - die("skip shmop() extension not avaliable"); - } -?> ---FILE-- -<?php - $hex_shm_id = 0xff3; - $write_d1 = "test #1 of the shmop() extension"; - $write_d2 = "test #2 append data to shared memory segment"; - - echo "shm open for create: "; - $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024); - if (!$shm_id) { - die("failed\n"); - } else { - echo "ok\n"; - } - - echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n"; - - echo "shm write test #1: "; - $written = shmop_write($shm_id, $write_d1, 0); - if ($written != strlen($write_d1)) { - echo "failed\n"; - } else { - echo "ok\n"; - } - - echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; - - shmop_close($shm_id); - - echo "shm open for read only: "; - $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024); - if (!$shm_id) { - echo "failed\n"; - } else { - echo "ok\n"; - } - - echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n"; - - /* try to append data to the shared memory segment, this should fail */ - @shmop_write($shm_id, $write_d1, $written); - echo $php_errormsg . "\n"; - - shmop_close($shm_id); - - echo "shm open for read only: "; - $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024); - if (!$shm_id) { - echo "failed\n"; - } else { - echo "ok\n"; - } - - echo "shm write test #1: "; - $written = shmop_write($shm_id, $write_d2, $written); - if ($written != strlen($write_d2)) { - die("failed\n"); - } else { - echo "ok\n"; - } - - echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n"; - - echo "deletion of shm segment: "; - if (!shmop_delete($shm_id)) { - echo "failed\n"; - } else { - echo "ok\n"; - } - - shmop_close($shm_id); -?> ---EXPECT-- -shm open for create: ok -shm size is: 1024 -shm write test #1: ok -data in memory is: test #1 of the shmop() extension -shm open for read only: ok -data in memory is: test #1 of the shmop() extension -trying to write to a read only segment -shm open for read only: ok -shm write test #1: ok -data in memory is: test #1 of the shmop() extensiontest #2 append data to shared memory segment -deletion of shm segment: ok |