
lightspd
Novice
Feb 25, 2013, 3:24 PM
Post #2 of 3
(176 views)
|
Having never seen that issue before, my best guess would that it has to do with IPC::ShareLite. Doing a simple test with IPC::SysV, simply because I've used it before.
#!/usr/bin/perl -w use strict; use IPC::SysV qw(IPC_CREAT IPC_RMID); my $key = 12345; my $size = 80; my $message = "9876"; my $id = shmget($key, $size, &IPC_CREAT | 0666) or die "Can't shmget: $!"; shmwrite( $id, $message, 0, $size ) or die "Can't shmwrite: $!"; sleep(1); system("./cb $key $size "); sleep(5); shmctl( $id, &IPC_RMID, 0 ) or die "Can't shmctl: $! "; To save space I'm just pasting a editing down main function. Will still work, just no checks.
int main(int argc, char *argv[]) { key_t key; int msize; char *shm; int shmid, count=0; key=atoi(argv[1]); printf("key=%d\n",key); msize=atoi(argv[2]); printf("Size=%d\n",msize); // connect to the shared memory shmid = shmget(key,msize ,0666); shm = shmat(shmid, (void *)0, 0); printf("Trying to send data\n"); printf("%s\n", shm); return(0); } output: perl test.pl key=12345 Size=80 Trying to send data 9876
|