+ return fcntl(fd, F_SETLK, &lock);
+}
+/*
+ * Function RemoveMutex: remove a mutex (unlinking the lock file).
+ *
+ * Just remove the lock file.
+ *
+ * Input: a filename
+ * Output: a return code (0 OK, -1 KO)
+ */
+int RemoveMutex(const char *path_name)
+{
+ return unlink(path_name);
+}
+/*
+ * Function ReadMutex: read a mutex status.
+ *
+ * Read the status for a mutex.
+ *
+ * Input: a mutex (i.e. a file descriptor)
+ * Output: the lock type (F_UNLCK, F_RDLCK or F_WRLCK, or -1 if KO)
+ */
+int ReadMutex(int fd)
+{
+ int res;
+ struct flock lock; /* file lock structure */
+ /* set flock structure */
+ lock.l_type = F_WRLCK; /* set type: unlock */
+ lock.l_whence = SEEK_SET; /* start from the beginning of the file */
+ lock.l_start = 0; /* set the start of the locked region */
+ lock.l_len = 0; /* set the length of the locked region */
+ /* do locking */
+ if ( (res = fcntl(fd, F_GETLK, &lock)) ) {