projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Aggiunte e correzioni alle funzioni per i file di lock
[gapil.git]
/
sources
/
wrappers.h
diff --git
a/sources/wrappers.h
b/sources/wrappers.h
index 15ddd826c2f3500668632b8d1cea932e6a95fef1..ed4a19b32f06b190ead58071714cdef518df0aa3 100644
(file)
--- a/
sources/wrappers.h
+++ b/
sources/wrappers.h
@@
-5,7
+5,7
@@
*
* Author: S. Piccardi
*
*
* 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 */
*
***************************************************************/
#include <sys/sem.h> /* IPC semaphore declarations */
@@
-161,24
+161,18
@@
inline char * ShmFind(key_t ipc_key, int shm_size)
return shptr;
}
/*
return shptr;
}
/*
- * Function LockFile:
- * Create a lockfile of the given pathname.
+ * Function LockFile
& UnlockFile
:
+ * Create a
nd 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,
*/
* 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
}
/*
* Function Signal