Re: Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH]device arguments from lookup)

Marko Kreen
2001-05-27T21:48:23Z

On Sun, May 27, 2001 at 10:45:17PM +0200, Daniel Phillips wrote:
> On Sunday 27 May 2001 15:32, Edgar Toernig wrote:
> > Daniel Phillips wrote:
> > > I'm not claiming there isn't breakage somewhere,
> >
> > you break UNIX fundamentals. But I'm quite relieved now because I'm
> > pretty sure that something like that will never go into the kernel.
>
> OK, I'll take that as "I couldn't find a piece of code that breaks, so
> it's on to the legal issues".
>
> SUS doesn't seem to have a lot to say about this. The nearest thing to
> a ruling I found was "The special filename dot refers to the directory
> specified by its predecessor". Which is not the same thing as:
>
> open("foo", O_RDONLY) == open ("foo/.", O_RDONLY)
>
> I don't know about POSIX (I don't have it: a pox on standards
> organizations that don't make their standards freely available) but SUS
> doesn't seem to forbid this.

My question is: Is it needed? You are advocating quite
non-obvious behaviour on a UNIX-like fs. Cant the end result
achieved in more obvious manner?

I see at most 3 types of magic files:

1) regular file - nothing special. Whether it has CHR/BLK set
or not is irrelevant.

2) file with subdevs. As 1) but you can acces dev/something
for subdev 'something'. Permissions should be probably taken
from 'dev'. Ofcourse you cant do 'ls' on the thing.

3) magicdev as directory. Act as ordinary directory. Only
reason is to group devices.

And all those should be manageable by devfsd, so you can tell
devfsd to take subdev and create it as file somewhere else.
So 2) and 3) are more like 'defaults'.

So: is there additional type required with non-obvious file/dir
behaviour mix?

--
marko