From bc3863eaf3e4ae92eac8cd3ce0ca9dcb8915fc36 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 11 Sep 2023 08:13:01 +0000 Subject: Better s6-setlock; delete the s6lock subsystem Signed-off-by: Laurent Bercot --- src/libs6/s6lockd_openandlock.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/libs6/s6lockd_openandlock.c (limited to 'src/libs6/s6lockd_openandlock.c') diff --git a/src/libs6/s6lockd_openandlock.c b/src/libs6/s6lockd_openandlock.c deleted file mode 100644 index ca51934..0000000 --- a/src/libs6/s6lockd_openandlock.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ISC license. */ - -#include - -#include -#include - -#include "s6lockd.h" - -int s6lockd_openandlock (char const *file, int ex, int nb) -{ - int fd, r ; - if (ex) - { - fd = open_create(file) ; - if (fd < 0) strerr_diefu3sys(111, "open ", file, " for writing") ; - } - else - { - fd = open_read(file) ; - if (fd < 0) - { - if (errno != ENOENT) strerr_diefu3sys(111, "open ", file, " for reading") ; - fd = open_create(file) ; - if (fd < 0) strerr_diefu2sys(111, "create ", file) ; - fd_close(fd) ; - fd = open_read(file) ; - if (fd < 0) strerr_diefu3sys(111, "open ", file, " for reading") ; - } - } - r = fd_lock(fd, ex, nb) ; - if (!r) errno = EBUSY ; - if (r < 1) strerr_diefu2sys(1, "lock ", file) ; - return fd ; -} -- cgit v1.2.3