按名称列出 Solaris 上的共享内存对象
我可以使用 ipcs(1) 列出 Solaris 10 机器上的活动共享内存对象,但它是按键列出的。不过,我通过 shm_open(3) 打开对象,它采用字符串作为名称来标识对象。有没有办法按名称列出共享内存对象,或者只获取键<->名称映射?我最感兴趣的是从命令行运行的东西,尽管用于执行此操作的 API 也可以。谢谢!
I can use ipcs(1) to list out the active shared memory objects on a Solaris 10 box, but it lists them by key. I'm opening the objects via shm_open(3), though, which takes a character string as a name to identify the object. Is there a way to list the shared memory objects by name, or to just get the key<->name mapping? I'm mostly interested in something to run from the command line, although an API for doing this would be OK, too. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,Solaris 下的 POSIX 共享内存出现在文件系统上,或者直接在
/tmp/
下作为.SHMDxxx
文件,或者在/var/tmp/ 下。 SHMD/
。这可能对您有帮助,也可能没有帮助,而且我没有方便的 Solaris 盒子来验证。As far as I remember POSIX shared memory under Solaris appears on the file system either directly under
/tmp/
as.SHMDxxx
files or under/var/tmp/.SHMD/
. This might or might not help you and I don't have a Solaris box handy to validate.我不知道如何列出名称或获取键/名称映射。但我想我知道一个 API 可以解决你的问题。
我认为您可以使用 System V 接口(也是 Posix API)附加密钥中的段。我相信它的工作方式是这样的:
I don't know of a way to list names or get key/name mappings. But I think I know an API that will solve your problem.
I think you can attach the segment from the key by using the System V interface, which is also a Posix API. I believe the way it works is something like: