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

Re: BUG #2406: Not all systems support SHM_SHARE_MMU

From: Paul van der Zwan <Paul(dot)Vanderzwan(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2406: Not all systems support SHM_SHARE_MMU
Date: 2006-04-25 18:23:47
Message-ID: 9AC81D3F-10F3-4F0A-9057-FC82F35658F1@Sun.COM (view raw or flat)
Thread:
Lists: pgsql-bugs
On 25-apr-2006, at 16:46, Tom Lane wrote:

> Paul van der Zwan <Paul(dot)Vanderzwan(at)Sun(dot)COM> writes:
>> AFAIK getpagesizes() appeared in 2001 so that probably means it is
>> missing in anything before Solaris 9.
>
> We could handle this without relying on getpagesizes() by just trying
> and falling back:
>
> #ifdef SHM_SHARE_MMU
> 	memAddress = shmat(shmid, addr, SHM_SHARE_MMU);
> 	if (memAddress == (void *) -1 && errno == EINVAL)
> 		memAddress = shmat(shmid, addr, 0);
> #else
> 	memAddress = shmat(shmid, addr, 0);
> #endif
>
That would be a clean solution ( and was suggested by some of my  
colleagues as well)

> However, I would argue that a system is pretty broken if it exposes  
> the
> SHM_SHARE_MMU #define and then rejects it at runtime.

It is just a define, the fact that this define exists has nothing to  
do with it having
any meaning. It's not like a HAVE_ISM flag. shmat() can fail for a  
number of reasons, one of
them is not having ISM available on the current system.

>
>> I'll see if I can get the x86 experts here to have a look at it...
>
> I think either Solaris/x86 should not expose this #define, or it  
> should
> silently ignore the bit at runtime.  AFAICS, SHM_SHARE_MMU has no
> guaranteed semantic effect anyway, it's just a performance hint; so
> ignoring it on platforms that can't handle it is reasonable.
>
I disagree, I have no definite info  why it is a hard failure,  
probably because
there is no way to communicate to the app that it's request is  
ignored. System calls
either fail or succeed. And introducing a new errno value just for  
this is overkill, I guess.
> 			regards, tom lane

Regards
	Paul


In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-04-25 18:34:41
Subject: Re: BUG #2406: Not all systems support SHM_SHARE_MMU
Previous:From: Tom LaneDate: 2006-04-25 14:46:45
Subject: Re: BUG #2406: Not all systems support SHM_SHARE_MMU

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