|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-10-08 07:33 UTC] ozoon at vnet dot ee
Hi.
Its seems to be impossible to use shmop_write if you are opening memory segment secong time.
example code (produces crash):
$mid = 0xffe;
$shm_id = shmop_open($mid, "c", 0644, 100);
if(!$shm_id) {
echo "Couldn't create shared memory segment\n";
}
$shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0);
if($shm_bytes_written != strlen("my shared memory block")) {
echo "Couldn't write the entire length of data\n";
}
shmop_close($shm_id);
$shm_id = shmop_open($mid, "a", 0, 0);
$shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0);
if($shm_bytes_written != strlen("my shared memory block")) {
echo "Couldn't write the entire length of data\n";
}
shmop_close($shm_id);
I did somehting wrong? or i should use other release of PHP?
O.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
I got it working, but i had to change C source for it: in ext/shmop/shmop.c -------------------------- if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) { shmflg = SHM_RDONLY; shmop->shmflg |= IPC_EXCL; } ------------- changed to: ------------- if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) { shmop->shmflg |= IPC_EXCL; shmop->shmflg |= SHM_R; shmop->shmflg |= SHM_W; } ------------- and it worked.... I hope php 4.0.7 will implement some patch too for it (CVS is still buggy) Thx. O.