【IT专家】使用.so(共享对象)中的内存映射文件
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
本文由我司收集整编,推荐下载,如有疑问,请与我司联系
使用.so(共享对象)中的内存映射文件
使用.so(共享对象)中的内存映射文件[英]Using memory-mapped files from within a .so (shared object) I am getting a segfault when accessing shared memory
(memory mapped file, using a fixed address of 0x60000000 ) from within a share object (.so).
当从共享对象(.so)中访问共享内存(内存映射文件,使用固定地址
0x60000000)时,我得到一个段错误。
We have many applications accessing this shared memory without difficulty. My app is different in that I create a small .so with it and the .so is the one calling mmap and accessing the shared memory.
我们有很多应用程序毫无困难地访问此共享内存。我的应用程序不同之处在于我
用它创建一个小的.so 而.so 是调用mmap 并访问共享内存的.so。
The mmap() returns just fine. My requested address is returned back properly. But as
soon as I try to access the memory from within this .so, it seg faults.
mmap()返回正常。我要求的地址已正确退回。但是一旦我尝试从这个.so 中访
问内存,就会出现故障。
I can’t figure out what is unique about a .so that would prevent it from accessing shared
memory this way.
我无法弄清楚.so 的独特之处在于它会阻止它以这种方式访问共享内存。
Anyone have thoughts?
有人有想法吗?
2
In general, accessing mmaped memory from a shared library is in no way different from accessing it from a main executable, and you are likely barking up the wrong tree. That
said, this:
通常,从共享库访问mmaped 内存与从主可执行文件访问mmaped 内存完全不