Subject: Re: openat(2) and friends
To: None <tech-kern@netbsd.org>
From: Steinar Hamre <steinarh@pvv.ntnu.no>
List: tech-kern
Date: 03/02/2005 17:23:21
der Mouse <mouse@Rodents.Montreal.QC.CA> writes:

> > [...stuff about Solaris calls that use an fd as a handle on a
> > directory...]
> 
> How do they deal with the x-only directory problem (you can't open() it
> but there's no reason you shouldn't be able to use it with calls like
> these)?  I've often wanted to be able to open . and then use the fd,
> usually for fchdir(), but potentially for these.  Does Solaris have an
> O_NOACCESS or something to deal with that?

Doesn't seem like they have a solution to that.  Can I suggest
O_WRONLY+O_RDWR?

(O_RDONLY+O_WRONLY=O_RDWR would be more natural, but it's way too late
for that.  Hmm... I don't want to think about how much code there is
that depends on O_RDONLY=0)

I'm a bit unsure how this should work for other file types.  ioctls
might be an issue from top of the bag of stuff done with fds that is
neither writing nor reading.  Could O_NOACCESS open up any bad ioctls
not available before?  What about a system call to do exec on the fd
of a regular executable file? O_EXEC?

        Steinar