Re: Odd filesystem permission handling

Alexander Viro (viro@math.psu.edu)
Sat, 19 Jun 1999 07:56:28 -0400 (EDT)


On Sat, 19 Jun 1999, Alan Cox wrote:

> > On Fri, 18 Jun 1999, Albert D. Cahalan wrote:
> > > At one time, there was no mkdir() call. You could use mknod()
> > > to get one, then add the '.' and '..' entries yourself.
> > > You could freely hard link and unlink directories. If you go
> > > back far enough, I think you could chmod() a file into a
> > > directory. Yep, turn files into directories and back again.
> >
> > RTFM. Nope, you couldn't. Moreover, mkdir(2) was a separate syscall. Yes,
> > it didn't create '.' and '..'. That's what mkdir(1) did after calling
> > mkdir(2).
>
> I've run V7 unix. V7 has no mkdir syscall. mkdir on V7 was a library
> call that ran a setuid binary that did a mknod and then used ln to build
> the links.

Sorry, Alan. <grabbing the printout of "UNIX PROGRAMMER'S MANUAL". Dated
November 3, 1971 (manual, not the printout ;-)>

11/3/71 SYS MKDIR (II)

NAME mkdir -- make a directory

SYNOPSIS sys mkdir; name; mode / mkdir = 14.

DESCRIPTION mkdir creates an empty directory whose name is the null-
terminated string pointed to by name. The mode of the di-
rectory is mode. The special entries "." and ".." are not
present.

mkdir can only be invoked by the super-user.
FILES
SEE ASLO mkdir command

DIAGNOSTICS Error bit (c-bit) is set if the directory alread exists
or if the user is not the super-user.
BUGS
OWNER ken, dmr

> mkdir() the syscall is a relatively modern invention, and even then you

Unlikely. Unless you mean creation of the normal links, that is. *That* is
relatively modern, syscall by itself isn't. I suspect that at some moment
it was replaced with unified syscall and was resurrected when the atomic
creation of links became an issue. Yup, that happened after v7.

> could use ln as root to link directories for a long time. Often the standard

Where did I deny that? ;-)

> ln binary prevented it but it could be done (eg SunOS)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/