summaryrefslogtreecommitdiff
path: root/src/lock.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/lock.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/lock.c')
-rw-r--r--src/lock.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/lock.c b/src/lock.c
index 4ac6b40..cec290e 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -1,9 +1,10 @@
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <fcntl.h>
#include "lock.h"
+#include <fcntl.h>
+#include <sys/file.h>
+#include <sys/types.h>
+#include <unistd.h>
+
/**
@file lock.c
@author djb
@@ -12,11 +13,29 @@
*/
#ifdef HASFLOCK
-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); }
+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);
+}
#else
-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); }
+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);
+}
#endif