tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: O_NOACCESS?



On Sat, Feb 11, 2012 at 10:27:42PM +0000, David Laight wrote:
 > On Sat, Feb 11, 2012 at 02:04:23AM -0500, Mouse wrote:
 > > I find myself wanting something I'm tentatively calling O_NOACCESS,
 > > which is basically "open for neither read nor write".  (I want this
 > > mostly so I can open a --x directory for fchdir() purposes.)
 > > 
 > > Looking at sys_open(), I see that one of the first checks it does is
 > > 
 > >         if ((flags & (FREAD | FWRITE)) == 0)
 > >                 return (EINVAL);
 > 
 > Not the least of your problems is that the user specifies one of
 > O_RDONLY, O_WRONLY or O_RDWR - which are 0, 1 and 2.
 > Makes it a little difficult to request 'no access'.

There is no problem. O_NOACCESS would be 3. When converted from O_* to
F* it becomes 0. The fact that the O_ flags were not intelligently
specified aeons ago so that a conversion is required is regrettable,
but at this point unfixable.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index