在linux中,我可以通过获取/ dev / shm目录列表获取打开的posix共享内存段列表。
如何以编程方式获取FreeBSD中所有打开的posix共享内存段的列表? 假设使用shm_open打开了段,我甚至不知道某个名称的一部分被用作shm_open的第一个参数。
答案 0 :(得分:6)
你做不到。请参阅/sys/kern/uipc_shm.c中的注释:
* TODO:
*
* (2) Need to export data to a userland tool via a sysctl. Should ipcs(1)
* and ipcrm(1) be expanded or should new tools to manage both POSIX
* kernel semaphores and POSIX shared memory be written?
*
* (3) Add support for this file type to fstat(1).
答案 1 :(得分:0)
您可以使用 posixshmcontrol 实用程序。