fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
lock.c
Go to the documentation of this file.
1#include <unistd.h>
2#include <sys/types.h>
3#include <sys/file.h>
4#include <fcntl.h>
5#include "lock.h"
6
14#ifdef HASFLOCK
15int lock_ex(int fd) { return flock(fd,LOCK_EX); }
16int lock_exnb(int fd) { return flock(fd,LOCK_EX | LOCK_NB); }
17int lock_un(int fd) { return flock(fd,LOCK_UN); }
18#else
19int lock_ex(int fd) { return lockf(fd,1,0); }
20int lock_exnb(int fd) { return lockf(fd,2,0); }
21int lock_un(int fd) { return lockf(fd,0,0); }
22#endif
int lock_exnb(int fd)
Definition: lock.c:20
int lock_un(int fd)
Definition: lock.c:21
int lock_ex(int fd)
Definition: lock.c:19