From 90b819c6d832046840018ff08b9bc5d0e3b69c37 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 29 Nov 2020 21:02:32 +0000 Subject: Revamp lock primitives; prepare for 2.10.0.0 instead of 2.9.4.0 flock() doesn't have a way to test for a lock without taking it. lockf() doesn't have shared locks. The only way to have both is fcntl(). So I rewrote all the locking stuff around fcntl(), and used the opportunity to change the interface. The point of changing the interface is to stop having to bother with the old one, so to hell with compatibility, let's just do a major bump. --- NEWS | 7 +++--- doc/index.html | 2 +- doc/libstddjb/djbunix.html | 45 +++++++++++-------------------------- doc/license.html | 2 +- doc/upgrade.html | 4 +++- package/deps.mak | 11 ++++----- package/info | 2 +- src/include/skalibs/djbunix.h | 12 +++++----- src/include/skalibs/exec.h | 2 ++ src/libstddjb/fd_islocked.c | 17 ++++++++++++++ src/libstddjb/fd_lock.c | 25 +++++++++++++++++++++ src/libstddjb/fd_unlock.c | 20 +++++++++++++++++ src/libstddjb/ipc_bind_reuse_lock.c | 6 ++++- src/libstddjb/lock_ex.c | 34 ---------------------------- src/libstddjb/lock_exnb.c | 35 ----------------------------- src/libstddjb/lock_sh.c | 34 ---------------------------- src/libstddjb/lock_shnb.c | 35 ----------------------------- src/libstddjb/lock_un.c | 34 ---------------------------- src/libstddjb/lock_unx.c | 11 --------- 19 files changed, 101 insertions(+), 237 deletions(-) create mode 100644 src/libstddjb/fd_islocked.c create mode 100644 src/libstddjb/fd_lock.c create mode 100644 src/libstddjb/fd_unlock.c delete mode 100644 src/libstddjb/lock_ex.c delete mode 100644 src/libstddjb/lock_exnb.c delete mode 100644 src/libstddjb/lock_sh.c delete mode 100644 src/libstddjb/lock_shnb.c delete mode 100644 src/libstddjb/lock_un.c delete mode 100644 src/libstddjb/lock_unx.c diff --git a/NEWS b/NEWS index deb04ba..d390e6a 100644 --- a/NEWS +++ b/NEWS @@ -1,14 +1,15 @@ Changelog for skalibs. -In 2.9.4.0 ----------- +In 2.10.0.0 +----------- - New openc_* functions. - New function: ipc_bind_reuse_lock(), taking a lock before unconditionally deleting the socket. - ipc_bind_reuse() rewritten to use ipc_bind_reuse_lock(), so it does the right thing instead of clobbering sockets. - - Complete revamping of the pathexec functions, see exec.h + - Complete revamping of the pathexec functions, see exec.h. + - Revamping of the locking functions. In 2.9.3.0 diff --git a/doc/index.html b/doc/index.html index c7cb59c..66095a2 100644 --- a/doc/index.html +++ b/doc/index.html @@ -60,7 +60,7 @@ with a standard C development environment

Download