Subject: Re: POSIX named semaphores naming restrictions in sem_open()
To: Ian Zagorskih <ianzag@megasignal.com>
From: None <cube@cubidou.net>
List: tech-kern
Date: 09/10/2004 07:59:55
On Fri, Sep 10, 2004 at 12:43:00PM +0700, Ian Zagorskih wrote:
> On Friday 10 September 2004 00:04, John F. Woods wrote:
> > > According to POSIX specification semaphore name is not required to be
> > > started with slash character:
> > >
> > > "If name does not begin with the slash character, the effect is
> > > implementation-defined."
> >
> > Thus, POSIX indicates that if you want to guarantee the behavior, you
> > must use one (and only one) slash character at the start of the name.
> > Anything else is "implementation defined", and assuming that the
> > documentation indicates that lacking a leading slash leads to failure, the
> > implementation meets the requirement.
> 
> POSIX documentation indicates that lacking a leading slash character may lead 
> to failure but does not require it. Of course if i got POSIX docs right.
> 
> Well, all what i'm wondering about is why NetBSD realization *explicitly* 
> requires leading slash? As if it is really important for realization. Though 
> according to NetBSD code it doesn't depend on slash character at all in any 
> name position.
> 
> Let's take for example some application that doesn't name semaphores this way. 
> It will be obviously "broken" on NetBSD while technically it is POSIX 
> compatible and could be fully usable in NetBSD environment.
> 
> Isn't this naming scheme requirement is too stern? Why not to forward 
> portability issues to application developer when it's possibly and doesn't 
> require lot of work?

When POSIX says it is "implementation-defined", it means "if you use this,
you're beyond the limits of POSIX portability.  Good luck.".

Failing on situations where portability is no more ensured is one way to
get people to writing portable code.

Making NetBSD accept other syntaxes would not increase portability of the
application.  It would just be a hack to make it magically work on NetBSD.

Quentin Garnier.