开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜