summaryrefslogtreecommitdiff
path: root/src/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lock.c')
-rw-r--r--src/lock.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lock.c b/src/lock.c
index cec290e..cadb07c 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -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);