输出同现SEGMENTATION FAULT是因为试图写操作,这是因为将虚拟内存挂载为了READ ONLY方式导致的权限不够。
输出:
./shmat_rd_flag_regular
get the share memory id is 32769
in yangzd the attach add is 0xb7734000
Now ,try to write the memory.
Segmentation fault
查看当前系统的共享内存信息,可以看到新建的共享内存段:
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuITNiNTOkhzNzcjNwUTO3QzMyIWNyQGO4MTOjlTN2EzNfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.png)
输出同现SEGMENTATION FAULT是因为试图写操作,这是因为将虚拟内存挂载为了READ ONLY方式导致的权限不够。
输出:
./shmat_rd_flag_regular
get the share memory id is 32769
in yangzd the attach add is 0xb7734000
Now ,try to write the memory.
Segmentation fault
查看当前系统的共享内存信息,可以看到新建的共享内存段: