I have a requirement where in i have to access shared
memory allocated by some C process. Can i do this in
PHP?
I am trying out some thing like this.
I want to access the existing shared memory.
$shm_id = ftok("/tmp/", 'm');
echo "$shm_id". "<br>";
$shmid = shmop_open($shm_id, "c", 0644, 164);
$shm_data = shmop_read($shm_id, 0, 50);
echo "$shm_data". "<br>";
with the above script the shm_id which gets generated
by ftok function is very much different then that of
existing shared memory.
Out put of ipcs command is as shown below
------ Shared Memory Segments --------
key shmid owner perms bytes
nattch status
0x6d023641 1867780 root 666 164
1
0x00180004 1638405 apache 644 164
0
0x6d023641 allocated with some C process which i am
intersted in.
0x00180004 is the one which is created by the above
script.
Why is the shm_id generated from ftok in C and ftok in
php different?
I also tried hard coding the shm_id in the above
script
but that too did not work. It gives following warning
Warning: shmop_read(): no shared memory segment with
an id of [1867780]
Where am i going wrong?
Thanks,
Chidanand.
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php