*
* Author: S. Piccardi
*
- * $Id: wrappers.h,v 1.4 2002/11/20 23:34:02 piccardi Exp $
+ * $Id: wrappers.h,v 1.5 2002/12/02 23:06:59 piccardi Exp $
*
***************************************************************/
#include <sys/sem.h> /* IPC semaphore declarations */
return shptr;
}
/*
- * Function LockFile:
- * Create a lockfile of the given pathname.
+ * Function LockFile & UnlockFile:
+ * Create and remove a lockfile of the given pathname.
* Fail and exit in case of error or existence of the same lock
* file, using unlink do not need to remove the file,
*/
-inline void LockFile(const char* path_name)
+inline int LockFile(const char* path_name)
{
- if (open(path_name, O_EXCL|O_CREAT)<0) {
- perror("Already active");
- exit(1);
- }
+ return open(path_name, O_EXCL|O_CREAT);
}
-inline void UnlockFile(const char* path_name)
+inline int UnlockFile(const char* path_name)
{
- if (unlink(path_name)) {
- perror("error, cannot unlink");
- exit(1);
- }
+ return unlink(path_name);
}
/*
* Function Signal