輸出同現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)