开发者

Listing all shared memory segments used by a process on AIX5.3+

开发者 https://www.devze.com 2022-12-17 14:50 出处:网络
I would like to find all shared memory segments used by a given process. I am especially interested开发者_开发技巧 in figuring out the shmid so i can use it in calls to shmctl().

I would like to find all shared memory segments used by a given process. I am especially interested开发者_开发技巧 in figuring out the shmid so i can use it in calls to shmctl().

On Solaris i would just read /proc/$PID/map to figure out that information (field pr_shmid). The contents of that file are defined by struct prmap_t in sys/procfs.

AIX also has a /proc/$PID/map file. There is also a struct prmap but unfortunately it is missing the pr_shmid field.

Any ideas how i can achieve this on AIX5.3+?


I don't know about AIX in particular, but I think the ipcs command is fairly standard where SysV IPC is supported, so I'd expect the ipcs -m command to give the appropriate information; parsing the output of that might be an option, if you can't find a better way.


svmon -P will list the process memory segments by type.

You can also use -S to see what PIDs are attached to a segment. with -S, first run ipcs -bmS, then take the SID w/o the 0x, and use it with

svmon -lS [SID]

That will return the PIDs attached.

0

精彩评论

暂无评论...
验证码 换一张
取 消