[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating lock file for compilers that don't support -c -o
From: |
Bob Friesenhahn |
Subject: |
Re: Creating lock file for compilers that don't support -c -o |
Date: |
Mon, 25 Aug 2003 14:06:06 -0500 (CDT) |
On Mon, 25 Aug 2003, Paul Jarc wrote:
> Bob Friesenhahn <address@hidden> 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
address@hidden
http://www.simplesystems.org/users/bfriesen
Re: Creating lock file for compilers that don't support -c -o, Robert Collins, 2003/08/25
Re: Creating lock file for compilers that don't support -c -o, Albert Chin, 2003/08/25