Attached to this message is a patch to php's shmop extension, it fixes the
following:
- shmop_open has a new flag for read/write access, 'w' (bug #10530, 10656)
- shmop_open has a new flag for create only 'n' (bug #10530, 10656)
- eliminated a segfault when trying to write to a SHM_RDONLY segment (bug
#14784)
- eliminated a segfault when an invalid flag which starts with 'a' or 'c' is
passed (bug #14784)
- updated creators' email addresses
- changed error messages to say shmop_* instead of shm* to correspond with
new shmop_* function names
Could someone with a CVS access please implement the diff and close the 3 bug
reports I've outlined. I will submit a patch to the shmop's php documentation
shortly.
I've tested this diff on PHP 4.0.6,4.1.0 4.1.1 it seems to work fine on all
of them. On 4.0.6 patch complains a little but it works fine non the less.
cd php4;
patch -p0 shmop.diff
diff -urN ext/shmop/ChangeLog ext/shmop/ChangeLog
--- ext/shmop/ChangeLog Wed Dec 31 19:00:00 1969
+++ ext/shmop/ChangeLog Wed Jan 2 13:15:34 2002
@@ -0,0 +1,7 @@
+Jan, 2, 2002
+
+- shmop_open has a new flag for read/write access, 'w' (bug #10530, 10656)
+- shmop_open has a new flag for create only 'n' (bug #10530, 10656)
+- eliminated a segfault when trying to write to a SHM_RDONLY segment (bug #14784)
+- eliminated a segfault when an invalid flag which starts with 'a' or 'c' is passed (bug #14784)
+- updated creators' email addresses
+- changed error messages to say shmop_* instead of shm* to correspond with new shmop_* function names
diff -urN ext/shmop/README ext/shmop/README
--- ext/shmop/README Tue Oct 3 17:56:21 2000
+++ ext/shmop/README Wed Jan 2 13:57:23 2002
@@ -1,31 +1,35 @@
-last update sept 3, 2000 ([EMAIL PROTECTED][EMAIL PROTECTED])
+last update Jan 2, 2002 ([EMAIL PROTECTED][EMAIL PROTECTED])
Shared Memory Operations Extension to PHP4
- While developing a search deamon we needed the php based front end
- to communicate the deamon via SHM. Now, PHP already had a shared memory
+ 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 [EMAIL PROTECTED],
- unfortunatly this extention was designed with PHP only in mind, and
+ 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 engeener figure
+ 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 shm_open(int key, string flags, int mode, int size)
+int shmop_open(int key, string flags, int mode, int size)
key - the key of/for the shared memory block
- flags - 2 flags are avalible
-a for access (sets IPC_EXCL)
-c for create (sets IPC_CREATE)
+ flags - 3 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 shm_read(int shmid, int start, int count)
+char shmop_read(int shmid, int start, int count)
shmid - shmid from which to read
start - offset from which to start reading
@@ -33,7 +37,7 @@
returns the data read
-int shm_write(int shmid, string data, int offset)
+int shmop_write(int shmid, string data, int offset)
shmid - shmid from which to read
data - string to put into shared memory
@@ -41,14 +45,14 @@
returns bytes written
-int shm_size(int shmid)
+int shmop_size(int shmid)
shmid - shmid for which to return the size
returns the size in bytes of the shm segment
-int shm_delete(int shmid)
+int shmop_delete(int shmid)
marks the segment for deletion, the segment will be deleted when all processes mapping it will detach
@@ -56,7 +60,7 @@
returns 1 if all ok, zero on failure
-int shm_close(int shmid)
+int shmop_close(int shmid)
shmid - shmid which to close
diff -urN ext/shmop/php_shmop.h ext/shmop/php_shmop.h
--- ext/shmop/php_shmop.h Mon Sep 17 09:43:11 2001
+++ ext/shmop/php_shmop.h Wed Jan 2 13:06:18 2002
@@ -12,8 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+--+
- | Authors: Slava Poliakov ([EMAIL PROTECTED])