[comp.unix.questions] Symbolic Links in Sys 5.3.1

naim@nucsrl.UUCP (Naim Abdullah) (10/20/87)

How does one create symbolic links in System V, rel. 3.1 ?
Also, what are the equivalents of the 4.3bsd lstat(2) and
S_IFLNK (in the st_mode word of the structure returned by stat(2)) ?

Normally, I would RTFM but I can't seem to find this info in the FM.

		      Naim Abdullah
		      Dept. of EECS,
		      Northwestern University

		      Internet: naim@eecs.nwu.edu
		      Uucp: {ihnp4, chinet, gargoyle}!nucsrl!naim

ekrell@hector.UUCP (Eduardo Krell) (10/21/87)

In article <3680027@nucsrl.UUCP> naim@nucsrl.UUCP (Naim Abdullah) writes:

>How does one create symbolic links in System V, rel. 3.1 ?
>Also, what are the equivalents of the 4.3bsd lstat(2) and
>S_IFLNK (in the st_mode word of the structure returned by stat(2)) ?

This is joke, right?

There are no symbolic links in System V Release 2 or 3 or 3.1 or anything
else. Period. You can only create hard links within a file system, and
only root can link to a directory.

I hope symbolic links do make it into System V soon. We have a modified
5.3.1 kernel with symbolic links, but it's an internal version.
    
    Eduardo Krell                   AT&T Bell Laboratories, Murray Hill

    {ihnp4,seismo,ucbvax}!ulysses!ekrell

naim@nucsrl.UUCP (Naim Abdullah) (10/23/87)

In article <3680027@nucsrl.UUCP> I wrote:

>How does one create symbolic links in System V, rel. 3.1 ?
>Also, what are the equivalents of the 4.3bsd lstat(2) and
>S_IFLNK (in the st_mode word of the structure returned by stat(2)) ?

In response, Eduardo Krell wrote:

>This is joke, right?

>There are no symbolic links in System V Release 2 or 3 or 3.1 or anything
>else. Period. You can only create hard links within a file system, and
>only root can link to a directory.

>I hope symbolic links do make it into System V soon. We have a modified
>5.3.1 kernel with symbolic links, but it's an internal version.

The reason I asked this question was that I noticed code for
symbolic links in the sources for our System V, rel. 3.1 kernel.
We got the sources directly from AT&T and no, we did not hack
them. Check out line 310 of src/uts/3b2/os/nami.c where there
is the comment:

#ifdef IFLNK
		/* If the file is a symbolic link, the */
		mumble, mumble...
#endif

I have deleted two lines of comments and two lines of code in the ifdef
because I don't want to be sued by AT&T for revealing any of their
proprietary secrets, but suffice it to say that the vanilla
Sys5.3.1 kernel appears to have some support for plugging
in a filesystem containing symbolic links. Anybody, know
how to do that, or whether the kernel needs some more work
to support symbolic links ?

		      Naim Abdullah
		      Dept. of EECS,
		      Northwestern University

		      Internet: naim@eecs.nwu.edu
		      Uucp: {ihnp4, chinet, gargoyle}!nucsrl!naim

hitz@mips.UUCP (David Hitz) (10/26/87)

In article <3680028@nucsrl.UUCP> naim@nucsrl.UUCP (Naim Abdullah) writes:
>The reason I asked this question was that I noticed code for
>symbolic links in the sources for our System V, rel. 3.1 kernel.

AT&T has inluded symlink code that doesn't handle symlinks for a couple
of releases now.

First, IFLNK is not set.  (Check sys/inode.h where it would be.)

Second, the os/nami.c code you refered to calls the fs specific
routines to handle the symlink.  But look at that code.  There is a
long comment describing everything required to to handle symlinks
followed by one line of code that doesn't do those things.  (See
fs/s5/s5nami.c line 463.)
-- 
Dave Hitz
UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!hitz 	DDD: hitz@408-991-0345

ekrell@hector.UUCP (Eduardo Krell) (10/27/87)

In article <3680028@nucsrl.UUCP> naim@nucsrl.UUCP (Naim Abdullah) writes:

>I have deleted two lines of comments and two lines of code in the ifdef
>because I don't want to be sued by AT&T for revealing any of their
>proprietary secrets, but suffice it to say that the vanilla
>Sys5.3.1 kernel appears to have some support for plugging
>in a filesystem containing symbolic links.

The support is really not there. The code you mention is just an attempt
to guess where the support for symbolic links should be in the generic
namei() and the file system specific namei().

>Anybody, know
>how to do that, or whether the kernel needs some more work
>to support symbolic links ?

To start with, you need 3 new system calls: lstat(), readlink() and symlink(),
as per BSD Unix. You will have to change the RFS kernel drivers to allow
for these system calls to "go remote" when appropriate. You'll also have to
decide what to do with a symbolic link which is resolved in a remote
machine and happens to start with a "/" : does it refer to the root on the
remote machine or the root on the machine that initiated the system call?

On the user-level side, you need to add the C library entry points for the
3 new system calls, and change many user level commands to understand symbolic
links (tar, find, file, mv/cp/ln, rm, etc.). Add the -L option to ls and the
-s option to ln (to create symbolic links), fix fsck so that it won't
get rid of all symbolic links thinking they are illegal inode types.

That's about it ...
    
    Eduardo Krell                   AT&T Bell Laboratories, Murray Hill

    {ihnp4,seismo,ucbvax}!ulysses!ekrell