1 /*****************************************************************************
4 * Function to manipulate lock files.
6 * Author: S. Piccardi, Dec 2002
8 * $Id: LockFile.c,v 1.1 2002/12/03 11:06:05 piccardi Exp $
10 *****************************************************************************/
11 #include <sys/types.h>
13 #include <unistd.h> /* unix standard functions */
14 #include <fcntl.h> /* file control (lock) functions */
18 * Create a lockfile of the given pathname. Fail and exit in case of
19 * error or existence of the same lock file, using unlink do not need
22 * Author: Simone Piccardi, Dec. 2002
24 int LockFile(const char* path_name)
26 return open(path_name, O_EXCL|O_CREAT);
29 * Function UnlockFile:
30 * Remove a lockfile of the given pathname.
32 * Author: Simone Piccardi, Dec. 2002
34 int UnlockFile(const char* path_name)
36 return unlink(path_name);