Skip site navigation (1) Skip section navigation (2)

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

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
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:27:24
Message-ID: D90A5A6C612A39408103E6ECDD77B829408D1F@voyager.corporate.connx.com (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
> -----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;
		}
	}

Responses

pgsql-hackers-win32 by date

Next:From: Claudio NatoliDate: 2004-03-05 03:39:13
Subject: Re: [HACKERS] Another crack at doing a Win3
Previous:From: Bruce MomjianDate: 2004-03-05 03:20:28
Subject: Re: [HACKERS] Another crack at doing a Win32 build under MINGW

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group