*BSD News Article 12714


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!spool.mu.edu!uunet!amdahl!amdcad!BitBlocks.com!bvs
From: bvs@BitBlocks.com (Bakul Shah)
Subject: Re: A challenge to all true kernel hackers - conditional symlinks.
Message-ID: <C3qH3r.I7n@BitBlocks.com>
Organization: Bit Blocks, Inc.
References: <JKH.93Mar9214944@whisker.lotus.ie> <C3ow4H.FID@BitBlocks.com> <JKH.93Mar10215639@whisker.lotus.ie>
Date: Thu, 11 Mar 1993 16:43:02 GMT
Lines: 45

jkh@whisker.lotus.ie (Jordan K. Hubbard) writes:

>The only problem with replacing open() is that you still need to deal
>with things like stat() and any other system call that deals with
>filenames (and follows links) directly.  

Good point!  Yes, such a change would affect more than just open().
I would do this in one of two ways:

a) change all calls that take a filename to take three arguments:
   a filedescriptor for the starting dir, filename, sizeof
   filename buffer.  Here only rename() and link() requires a
   slightly more complicated scheme.

b) make the mapping of a filename to a handle a separate syscall.
   The handle is a small integer just like a file descriptor.
   Having a handle does not mean the file is `open' but with it
   you can perform operations for which you currently give a
   filename.  Here again link() and rename() would require a
   careful design.  In general, associating a new filename with a
   filesystem object gets a bit tricky.

My preference would be b).

I just feel that the kernel has become far too big and while one
can always add more code for new functions, a better idea is to
gain new functionality by restructuring and simplifying the
kernel and in the process removing restrictions.  I think we can
do this without introducing new security holes, and without
breaking existing programs (well, except that you will have to
relink them).  The fact that there are pairs of syscalls with
very similar function (except that one takes a file name, the
other a file descriptor) has pointed to such a simplification for
a long time.

>					  Note that I wasn't talking about
>usurping the $, (, and ) characters in filenames altogether, only in
>symbolic links.  I don't think that this would be any great hardship.

It is not a question of hardship, it is that the type of a file
should not depend on its name; they are independent concepts.
And, in my humble opinion, this (i.e. conditional symlinks) is
not a compelling enough reason to make such an exception.

Bakul Shah <bvs@BitBlocks.com>