http://www.perlmonks.org?node_id=1223418


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

After doing a bunch more research, I've discovered that you can get this data from /proc/sysvipc/shm on Linux. You need to do the UID mapping yourself, but the key value in that file, presented as a signed int, is what you want to use. Don't ask me why ipcs doesn't provide this itself. I tried a hex to decimal conversion, but that gave a value far, far different than the file cited above. I've since attached to the shared memory segment in question, and via doing what I know triggers sessions to attach/detach, I've been able to determine without doubt that I'm getting the proper count for the proper segment.

I'll leave this here in case it helps someone else. Shared memory isn't very well-documented in general. I think I went through about 30 resources before stumbling onto the right area to search.