Lines Matching full:lock
29 int lock;
35 * someone else can grab your lock and DoS you. For internal use, who
38 if((lock = open(file, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT|O_EXCL, 0666)) < 0)
49 lock = open(file, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0666);
55 if (lock < 0)
56 return nerr_raise_errno (NERR_IO, "Unable to open lock file %s", file);
59 *plock = lock;
64 void fDestroy(int lock)
67 if(lock < 0)
70 close(lock);
77 int lock;
81 if((lock = open(file, O_WRONLY|O_NDELAY|O_APPEND, 0666)) < 0) {
83 return nerr_raise (NERR_NOT_FOUND, "Unable to find lock file %s", file);
84 return nerr_raise_errno (NERR_IO, "Unable to open lock file %s", file);
87 *plock = lock;
92 NEOERR *fLock(int lock)
95 if(lockf(lock, F_LOCK, 0) < 0)
96 return nerr_raise_errno (NERR_LOCK, "File lock failed");
101 void fUnlock(int lock)
104 if(lock < 0)
107 lockf(lock, F_ULOCK, 0);
139 return nerr_raise(NERR_LOCK, "Mutex lock failed: %s", strerror(err));