summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-30 12:52:48 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-30 12:52:48 +0000
commita22d90e47d420492c98ade168780ba7d3964419b (patch)
tree3104dd7deba0b4d9ec35903d8fafd9fbb862a8d1 /src
parentf65cd7e93eeb39d7ebb4066793345dd45051abe2 (diff)
downloadskalibs-a22d90e47d420492c98ade168780ba7d3964419b.tar.xz
Add lock_unx()
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/djbunix.h1
-rw-r--r--src/libstddjb/lock_unx.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h
index f4cac8a..4dc534e 100644
--- a/src/include/skalibs/djbunix.h
+++ b/src/include/skalibs/djbunix.h
@@ -39,6 +39,7 @@ extern int lock_exnb (int) ;
extern int lock_sh (int) ;
extern int lock_shnb (int) ;
extern int lock_un (int) ;
+extern void lock_unx (int) ;
extern int open2 (char const *, unsigned int) ;
extern int open3 (char const *, unsigned int, unsigned int) ;
extern int open_read (char const *) ;
diff --git a/src/libstddjb/lock_unx.c b/src/libstddjb/lock_unx.c
new file mode 100644
index 0000000..d2f8483
--- /dev/null
+++ b/src/libstddjb/lock_unx.c
@@ -0,0 +1,11 @@
+/* ISC license. */
+
+#include <errno.h>
+#include <skalibs/djbunix.h>
+
+void lock_unx (int fd)
+{
+ int e = errno ;
+ lock_un(fd) ;
+ errno = e ;
+}