Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Using IPC::SharedMem to get nattch for a specific address?

by bliako (Monsignor)
on Oct 02, 2018 at 19:56 UTC ( [id://1223427]=note: print w/replies, xml ) Need Help??


in reply to Using IPC::SharedMem to get nattch for a specific address?

there is shared memory key and shared memory identifier. these are different as you already found out.

  • Comment on Re: Using IPC::SharedMem to get nattch for a specific address?

Replies are listed 'Best First'.
Re^2: Using IPC::SharedMem to get nattch for a specific address?
by fairlite (Novice) on Oct 03, 2018 at 04:05 UTC

    Yup. And you really do use the key for this module. The issue was the hex value. You need to either use the signed int found in /proc/sysvipc/shm, or convert the hex value you get from ipcs. I did work out the conversion from one to the other and back again, and they definitely check out as matching each other. I find it easier to just rely upon proc, although it's arguably less portable to do so.

    The shmid is actually something you get from the stat method in the module, after you've already used the key to connect to the segment.

    I'm all set, and it works like a champ. My only real complaint is that there's no (apparent) method akin to select() or inotify or the like, for when nattch changes. To do what I'm doing, I absolutely must do an expensive polling loop, unfortunately. I suspect this is not a common use case, which probably explains the absence of any such creature.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1223427]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found