shm_open()函数没有创建共享内存
发布时间:2020-12-16 09:43:33 所属栏目:百科 来源:网络整理
导读:我正在尝试打开共享内存,它给我没有这样的文件或目录错误. 但我有一个文件以及名称区域中的目录. fd_sh = shm_open("/home/angus/c_tutorials/interview/linux_sys_pgm/mmap/region",O_CREAT | O_RDWR,S_IRUSR | S_IWUSR); if(fd_sh == -1){ perror("fd_sh:E
我正在尝试打开共享内存,它给我没有这样的文件或目录错误.
但我有一个文件以及名称区域中的目录. fd_sh = shm_open("/home/angus/c_tutorials/interview/linux_sys_pgm/mmap/region",O_CREAT | O_RDWR,S_IRUSR | S_IWUSR); if(fd_sh == -1){ perror("fd_sh:ERROR"); return -1; } 解决方法
在Linux中(我假设这是你的操作系统,给定你的代码),名称应该以斜杠开头但之后没有任何其他名称,例如“/ myshm” – 不是常规文件名.
从手册页: The operation of shm_open() is analogous to that of open(2). name specifies the shared memory object to be created or opened. For porta |
相关内容
- fastjson序列化日期格式化
- ruby-on-rails – ActiveRecord渴望加载多个belongs_to关联
- c# – 可以设置monthCalendar显示当前月份和前2个月?
- 基于vue2.0+vuex+localStorage开发的本地记事本示例
- Vue实现购物车场景下的应用
- react-native – React Native onpress无法正常工作
- doxygen是否有可能从生成的xml中排除未记录的函数?
- ORACLE 11g 由新特性引发lsnrctl hang住卡死迷雾的详细剖析
- cocos2d-x 3.3 CC_CALLBACK_0 std::bind与std::function
- N1QL为NoSQL数据库带来SQL般的查询体验