On Apr 13 11:00, Christoph Weise wrote: > > > > The problem is the call to shmget: > > > > #undef PAGESIZE > > #define PAGESIZE 512 > > shmid = shmget(key, PAGESIZE, IPC_ALLOC); > > > > Since you're requesting only 512 bytes, the shared memory segment the > > following shmat call returns is only 4K. The shmget call should request > > as much memory as it needs so that the OS call is called with the right > > view size. > > > > I re-read the POSIX man page for shmget, and it doesn't mention anything > > which would point out that Cygwin's behaviour here is wrong. If anybody > > has more information on this, please share them. > > Yes, you're right. I tried a workaround that uses a second shm section to > pass between executables either the size or more simply the shm ID of the > main shm section. Either way this circumvented the problem. > > However with this solution there is an odd change in the base address > of the shm section between calls from the routine that creates the > section to the executables that use it.
You can't rely on getting the shm region allocated at the same memory address in different executables. > >On second thought, adjusting Cygwin's behaviour to Linux here is rather > >trivial. I applied a patch to the git repo and uploaded new developer > >snapshots (2015-04-12) to https://cygwin.com/snapshots/ > >You only have to replace the DLL itself, cygserver is not affected by > >this patch. Please give it a try. > > That did the trick. With the new cygwin1 DLL I don't need to pass shm > section information between executables and the overall behavior is > consistent with that on Linux. > > Thank you for your help! I am very happy this works now on cygwin. Thanks for the feedback. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpRI1lEhOaB7.pgp
Description: PGP signature