加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

彻底销毁System V共享内存段

发布时间:2020-12-16 07:02:48 所属栏目:百科 来源:网络整理
导读:我使用shmget,shmat和shmctl分别获取并创建一个共享内存段,将其附加到进程地址空间并将其删除. 我想知道进程是否仍然可以使用共享内存段,即使它已被分离并要求使用删除 shmctl(id,IPC_RMID,...) 在一个过程中. 我无法从手册页获取信息: IPC_RMID Mark the s
我使用shmget,shmat和shmctl分别获取并创建一个共享内存段,将其附加到进程地址空间并将其删除.

我想知道进程是否仍然可以使用共享内存段,即使它已被分离并要求使用删除

shmctl(id,IPC_RMID,...)

在一个过程中.

我无法从手册页获取信息:

IPC_RMID Mark the segment to be destroyed. The segment will only actually be destroyed after the last process detaches it (i.e.,when the shm_nattch member of the associated structure shmid_ds is zero). The caller must be the owner or creator,or be privileged. If a segment has been marked for destruction,then the (nonstandard) SHM_DEST flag of the shm_perm.mode
field in the associated data structure retrieved by IPC_STAT will be set.

解决方法

在Linux上,即使已经标记为要删除,也可以附加共享内存段.但是,POSIX.1-2001未指定此行为,许多其他实现不支持它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读