I have 2 programs that share a header file. This header file defines a multi-member structure. Then there is a #define: #define STRUCTURE_SIZE sizeof(OUR_STRUCTURE).
This structure is then used in shared memory with STRUCTURE_SIZE, which is used for the argument sizeto shmget().
Unfortunately, STRUCTURE_SIZE is 20758 for one program and 20764 for another. Therefore, when the second program tries to get a common mem, shmget()returns EINVAL.
uname -a:
Linux machine 2.6.30.10-105.2.23.fc11.i686.PAE #1 SMP Thu Feb 11 07:05:37 UTC 2010 i686 i686 i386 GNU/Linux
g++ --version:
g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)
xxpor source
share