共享内存 - shmget和shmat [英] Shared Memory - shmget and shmat

查看:98
本文介绍了共享内存 - shmget和shmat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

shmid = shmget(key + sdz,shmSize,0664)创建了4个共享内存段;



shmat (shmid,CurAddr,SHM_RND);

通过更改不同段的shmSize的偏移量来更新CurAddr。



段成功创建,通过ipcs检查,客户端也成功附加到共享内存段,但读取的数据是(null),客户端终止

给出分段错误。((null)比较wid string)

I have created 4 shared memory segments using
shmid=shmget(key+sdz, shmSize, 0664);
and
shmat(shmid, CurAddr,SHM_RND);
CurAddr is updated by changing the offset for shmSize for different segments.

the segments are successfully created, checked through ipcs,the client also successfully attach to shared mem segment but the data read is (null) and the client terminated
giving segmentation fault.((null) is compared wid string)

推荐答案

这篇关于共享内存 - shmget和shmat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆