I'm trying to attach to a specific memory address with IPC::SharedMem, but keep getting in at 0x00000000 instead. Here's the ipcs output indicating what I specifically want to monitor:
I'm trying to monitor the one whose username I have redacted, at 0xf102ee77. Here's my code for trying to do so:------ Shared Memory Segments -------- key shmid owner perms bytes nattch stat +us 0x00000000 98304 root 600 67108864 20 dest 0x0052e2c1 65537 postgres 600 56 5 0xf102ee77 131074 XXXXXXX 700 65535 0
Here's what my actual shared memory requests are creating (even without the create flag being used):use strict; use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR SHM_RDONLY); use IPC::SharedMem; use Class::Struct; my $key = '0xf102ee77'; my $shm = IPC::SharedMem->new(${key},65535,SHM_RDONLY); &fl_die("Could not open shared memory segment.") unless defined(${shm} +); my $stat = ${shm}->stat; &fl_die("Could not stat shared memory segment.") unless defined(${stat +}); my $concount = ${stat}->nattch;
0x00000000 393224 root 0 65535 0 0x00000000 425993 root 0 65535 0 0x00000000 458762 root 0 65535 0 0x00000000 491531 root 0 65535 0 0x00000000 524300 root 0 65535 0 0x00000000 557069 root 0 65535 0 0x00000000 589838 root 0 65535 0
While I get no errors, nattch keeps reading zero, largely because I'm getting in at 0x00000000 instead of the requested address. If I try unquoting the key value, it won't even attach to any shared memory, and comes back undefined at the constructor call.
May I please get some assistance on this? This is my first time needing to deal with shared memory. I know what I'm after (nattch), but this module is not the best documented in the world.
Thanks!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |