diff options
Diffstat (limited to 'src/lock.c')
-rw-r--r-- | src/lock.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -6,10 +6,10 @@ #include <unistd.h> /** - @file lock.c - @author djb - @source qmail - @brief locking of resources + @file lock.c + @author djb + @source qmail + @brief locking of resources */ #ifdef HASFLOCK @@ -17,10 +17,12 @@ int lock_ex(int fd) { return flock(fd, LOCK_EX); } + int lock_exnb(int fd) { return flock(fd, LOCK_EX | LOCK_NB); } + int lock_un(int fd) { return flock(fd, LOCK_UN); @@ -30,10 +32,12 @@ int lock_ex(int fd) { return lockf(fd, 1, 0); } + int lock_exnb(int fd) { return lockf(fd, 2, 0); } + int lock_un(int fd) { return lockf(fd, 0, 0); |