On Mon, Aug 25, 2003 at 02:06:06PM -0500, Bob Friesenhahn wrote:
> 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. ...
>
> ...
>

I'd rather see a link to the POSIX standard defining link as atomic.

-- 
albert chin ([EMAIL PROTECTED])


_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool

Reply via email to