On Sep 21 15:02, Christian Rank wrote: > Hi, > > thanks to all who replied to my question. It seems that so far there is > no solution: > http://cygwin.com/ml/cygwin/2004-08/msg00277.html > > I've done some debugging and found out that the shmat... error message > is generated by PostgreSQL in the source module > src/backend/port/sysv_shmem.c during execution of the following code: > > /* OK, should be able to attach to the segment */ > #ifdef SHM_SHARE_MMU > /* use intimate shared memory on Solaris */ > memAddress = shmat(shmid, 0, SHM_SHARE_MMU); > #else > memAddress = shmat(shmid, 0, 0); > #endif > > if (memAddress == (void *) -1) > elog(FATAL, "shmat(id=%d) failed: %m", shmid); > > Here it can be seen that shmat is called with a shmaddr (second > parameter) of 0, which means "the system should itself choose a suitable > address". (Thus there is no need for supplying the SHM_RND flag.) > > The corresponding debugging info of cygserver reads: > > cygserver: /netrel/src/cygwin-1.5.11-1/winsup/cygserver/sysv_shm.cc, > line 385: shmaddr: 82FFD000, shmflg: 0 > cygserver: /netrel/src/cygwin-1.5.11-1/winsup/cygserver/sysv_shm.cc, > line 393: Odd shmaddr: EINVAL
Urgh! Ok, well... looking into the implementation of shmat, there's only one explanation for this behaviour. Apparently MapViewOfFileEx returned memory which isn't aligned to the memory granulation. [time passes, testing on a 9x system] That's it. Incredible. I've checked in a patch to cygserver which takes this into account. Please give cygserver from the next Cygwin snapshot (http://cygwin.com/snapshots.html) a try. Thanks for the analysis, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:[EMAIL PROTECTED] Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/