On Mon, 25 Aug 2003, Paul Jarc wrote: > Bob Friesenhahn <[EMAIL PROTECTED]> wrote: > > Creating a hard link is an atomic operation whereas a symbolic link is > > not > > How so?
It has to do with the complexity of the operation, particularly if a network is involved. Creating a hard link does not create a new file (allocate a new inode), it simply updates a directory table to reference an existing file. This requires a single network request. Most importantly, it is documented to be atomic. Creating a symbolic link requires testing for an existing file, and then (if the file does not exist) creating a new file, and a directory entry to reference it. This requires multiple network transactions with an opportunity for race-conditions. NAME link - make a hard file link LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <unistd.h> int link(const char *name1, const char *name2); DESCRIPTION The link() function call atomically creates the specified directory entry (hard link) name2 with the attributes of the underlying object pointed at by name1. ... NAME symlink - make symbolic link to a file LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <unistd.h> int symlink(const char *name1, const char *name2); DESCRIPTION A symbolic link name2 is created to name1 (name2 is the name of the file created, name1 is the string used in creating the symbolic link). Either name may be an arbitrary path name; the files need not be on the same file system. ====================================== Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen _______________________________________________ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool