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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Another crack at doing a Win32 build under MINGW
Дата
Msg-id 200403050342.i253gRY24980@candle.pha.pa.us
обсуждение исходный текст
Список pgsql-hackers-win32
Are you saying you mapped to a high fixed address?  0x20000000?

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

Dann Corbit wrote:
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.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@DANNFAST /usr/local/pgsql/bin
> > > $ postmaster -D u:/pgdata
> > > LOG:  select() failed in postmaster: No such file or directory
> > >
> > > dcorbit@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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-hackers-win32 по дате отправления:

Предыдущее
От: Claudio Natoli
Дата:
Сообщение: Re: [HACKERS] Another crack at doing a Win3
Следующее
От: "Dann Corbit"
Дата:
Сообщение: Re: [HACKERS] Another crack at doing a Win32 build under MINGW