Re: [HACKERS] Another crack at doing a Win32 build under MINGW

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] Another crack at doing a Win32 build under MINGW
Date: 2004-03-05 03:42:27
Message-ID: 200403050342.i253gRY24980@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32


Are you saying you mapped to a high fixed address? 0x20000000?

---------------------------------------------------------------------------

Dann Corbit wrote:
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> > Sent: Thursday, March 04, 2004 7:20 PM
> > To: Dann Corbit
> > Cc: PostgreSQL Win32 port list
> > Subject: Re: [HACKERS] Another crack at doing a Win32 build
> > under MINGW
> >
> >
> > Dann Corbit wrote:
> > > I am able to build now, and perform initdb. However, I
> > cannot run the
> > > postmaster. I don't know how far along the port is. What is the
> > > current state of the port to Win32?
> > >
> > > dcorbit(at)DANNFAST /usr/local/pgsql/bin
> > > $ postmaster -D u:/pgdata
> > > LOG: select() failed in postmaster: No such file or directory
> > >
> > > dcorbit(at)DANNFAST /usr/local/pgsql/bin
> > > $ FATAL: could not attach to proper memory at fixed address:
> > > shmget(key=5432001, addr=00E10000) failed: No such file or directory
> >
> > [ email moved to win32 list.]
> >
> > They have only a few regression tests failing, so we are very
> > far along.
> >
> > The message you are seeing looks like code that assumes that
> > a child can map to the same shared memory address as the
> > postmaster. We haven't seen that fail for anyone before, but
> > it is an assumption we weren't sure about. Of course this is
> > all a guess.
>
> We had the same issue in our port then. Yes, it can fail. This is
> especially true if the machine has lots of stuff in memory already (I
> have perhaps 30 applications loaded right now).
>
> This is what we did for a work-around:
>
> static void * pWireMemoryAddress=(void *)0x20000000;
>
> void *shmat(int shmid, const void *shmaddr, int shmflg)
> {
> int nItem;
> if (-1 == (nItem = findSharedMemorySet(shmid)))
> {
> errno = ENOENT;
> return NULL; // failure - could not find it.
> }
>
>
> if (shmaddr == 0) // just map the view of the file
> {
> void * pData;
> if (pWireMemoryAddress) // if we are looking to wire/map
> this memory to a specific address/
> {
> pData = gSharedMemoryList[nItem].pSharedMemory =
> MapViewOfFileEx(gSharedMemoryList[nItem].hSharedMemory,
>
> FILE_MAP_ALL_ACCESS,
>
> 0,
>
> 0,
>
> gSharedMemoryList[nItem].nSharedMemorySize,
>
> pWireMemoryAddress);
> pWireMemoryAddress=NULL;
> }
> else
> {
> pData = gSharedMemoryList[nItem].pSharedMemory =
> MapViewOfFile(gSharedMemoryList[nItem].hSharedMemory,
>
> FILE_MAP_ALL_ACCESS,
>
> 0,
>
> 0,
>
> gSharedMemoryList[nItem].nSharedMemorySize);
> }
>
> if (pData)
> gSharedMemoryList[nItem].nUseCount++;
> return pData;
> }
> else
> {
> // not currently used, and unimplemented
> assert(0);
> return NULL;
> }
> }
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Dann Corbit 2004-03-05 03:43:55 Re: [HACKERS] Another crack at doing a Win32 build under MINGW
Previous Message Claudio Natoli 2004-03-05 03:39:13 Re: [HACKERS] Another crack at doing a Win3