Reputation: 1119
Is it possible to create a shared memory segment that can be accessed by both 32 and 64 bit processes. The flag'TPF_IPC64' to support 64 bit addressing is as below
shmget(key,100,IPC_CREAT|TPF_IPC64);
Will this be accessible from a 32 bit Linux process?
Edit: It seems like the flag 'TPF_IPC64' is not supported in a normal Linux OS call to shmget. I think it is some proprietary to IBM ( my bad). I took it from this link
Upvotes: 4
Views: 2158
Reputation: 1331
From IBM's document
TPF_IPC64
Specifies that 64-bit addressing is supported. If you specify this flag, 64-bit system heap is used to satisfy the request if there is enough heap available. If there is no 64-bit system heap space available, 31-bit system heap will be used. Specify this flag only if all the users of this shared memory area can support 64-bit addresses.
The last sentence has mentioned that all the process has to support 64-bit address. So process with 32-bit address cannot access it.
However, I don't what is the behavior if you tried to access it with 32-bit process.
Upvotes: 0
Reputation: 41065
man shmget(2)
If IPC_CREAT is set in shmflg the shared memory segment created can only be shared by processes of the same executable type. That is, an application compiled as a 32-bit process will be able to share the same memory segment with other 32-bit processes, and an application compiled as a 64-bit process will be able to share the same memory segment with other 64-bit processes. If a 64-bit bit process want to create a shared memory segment which can also be shared with 32-bit processes, the 64-bit process must specify IPC_SHARE32 in addition to IPC_CREAT in shmflg . The 32-bit process does not need to specify IPC_SHARE32 .On Itanium(R)-based platforms, if the Adaptive Address Space feature is being used, then additional rules may apply. See the section below on Adaptive Address Space.
Upvotes: 4