diff options
author | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
commit | 220534453eecc2c07ad710d72268aafd20b83138 (patch) | |
tree | 469bd5db135e31b7ea908152aa3389b9b1e06d5b /lock_ex.c |
initial commit
Diffstat (limited to 'lock_ex.c')
-rw-r--r-- | lock_ex.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lock_ex.c b/lock_ex.c new file mode 100644 index 0000000..b75a764 --- /dev/null +++ b/lock_ex.c | |||
@@ -0,0 +1,13 @@ | |||
1 | /* Public domain. */ | ||
2 | |||
3 | #include <sys/types.h> | ||
4 | #include <sys/file.h> | ||
5 | #include <fcntl.h> | ||
6 | #include "hasflock.h" | ||
7 | #include "lock.h" | ||
8 | |||
9 | #ifdef HASFLOCK | ||
10 | int lock_ex(int fd) { return flock(fd,LOCK_EX); } | ||
11 | #else | ||
12 | int lock_ex(int fd) { return lockf(fd,1,0); } | ||
13 | #endif | ||