From 032b853746aabb8c3b82af674fdc783b511569f2 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Sat, 4 Dec 2021 08:48:45 +0000
Subject: Add opendir_at, prepare for 2.11.1.0
Signed-off-by: Laurent Bercot
---
NEWS | 8 ++++++++
doc/index.html | 2 +-
doc/upgrade.html | 15 +++++++++++++++
package/deps.mak | 3 ++-
package/info | 2 +-
src/include/skalibs/unix-transactional.h | 2 ++
src/libstddjb/fd_close.c | 4 ++--
src/libunixonacid/opendir_at.c | 15 +++++++++++++++
8 files changed, 46 insertions(+), 5 deletions(-)
create mode 100644 src/libunixonacid/opendir_at.c
diff --git a/NEWS b/NEWS
index 7fe6aee..507d77d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
Changelog for skalibs.
+In 2.11.1.0
+-----------
+
+ - fd_close() doesn't retry if close() fails. (i.e. adapts to Linux's
+behaviour over HP-UX's.)
+ - New function: opendir_at.
+
+
In 2.11.0.0
-----------
diff --git a/doc/index.html b/doc/index.html
index 3b5dba0..b1e9fa0 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -60,7 +60,7 @@ with a standard C development environment
Download
- - The current released version of skalibs is 2.11.0.0.
+ - The current released version of skalibs is 2.11.1.0.
- Alternatively, you can checkout a copy of the
skalibs
git repository:
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 4d5856e..90d478f 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -16,6 +16,21 @@
skarnet.org
+ in 2.11.1.0
+
+
+ - fd_close() now chooses to adapt to Linux's
+close()
+behaviour (closing the fd on EINTR) over the HP-UX one (not closing it).
+Destructors like
+close()
+being allowed to fail has always been a mistake in the specification and a
+programming nightmare, making it impossible to behave correctly on all
+systems, but apparently standardization efforts are on the way and the Linux
+behaviour seems to be the chosen one.
+ - New unix-transactional.h function: opendir_at.
+
+
in 2.11.0.0
diff --git a/package/deps.mak b/package/deps.mak
index d20d007..cdaf79f 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -51,7 +51,7 @@ src/include/skalibs/tai.h: src/include/skalibs/gccattributes.h src/include/skali
src/include/skalibs/textclient.h: src/include/skalibs/allreadwrite.h src/include/skalibs/tai.h src/include/skalibs/textmessage.h
src/include/skalibs/textmessage.h: src/include/skalibs/allreadwrite.h src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h
src/include/skalibs/unix-timed.h: src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h
-src/include/skalibs/unix-transactional.h: src/include/skalibs/stralloc.h src/include/skalibs/uint64.h
+src/include/skalibs/unix-transactional.h: src/include/skalibs/direntry.h src/include/skalibs/stralloc.h src/include/skalibs/uint64.h
src/include/skalibs/unixconnection.h: src/include/skalibs/unixmessage.h
src/include/skalibs/unixmessage.h: src/include/skalibs/buffer.h src/include/skalibs/cbuffer.h src/include/skalibs/gccattributes.h src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h
src/include/skalibs/unixonacid.h: src/include/skalibs/ancil.h src/include/skalibs/kolbak.h src/include/skalibs/skaclient.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/include/skalibs/unix-timed.h src/include/skalibs/unix-transactional.h src/include/skalibs/unixconnection.h src/include/skalibs/unixmessage.h
@@ -716,6 +716,7 @@ src/libunixonacid/open_truncat.o src/libunixonacid/open_truncat.lo: src/libunixo
src/libunixonacid/open_truncatb.o src/libunixonacid/open_truncatb.lo: src/libunixonacid/open_truncatb.c src/include/skalibs/djbunix.h src/include/skalibs/unix-transactional.h
src/libunixonacid/open_writeat.o src/libunixonacid/open_writeat.lo: src/libunixonacid/open_writeat.c src/include/skalibs/unix-transactional.h
src/libunixonacid/open_writeatb.o src/libunixonacid/open_writeatb.lo: src/libunixonacid/open_writeatb.c src/include/skalibs/djbunix.h src/include/skalibs/unix-transactional.h
+src/libunixonacid/opendir_at.o src/libunixonacid/opendir_at.lo: src/libunixonacid/opendir_at.c src/include/skalibs/direntry.h src/include/skalibs/djbunix.h src/include/skalibs/unix-transactional.h
src/libunixonacid/opengetlnclose.o src/libunixonacid/opengetlnclose.lo: src/libunixonacid/opengetlnclose.c src/include/skalibs/allreadwrite.h src/include/skalibs/buffer.h src/include/skalibs/djbunix.h src/include/skalibs/skamisc.h src/include/skalibs/unix-transactional.h
src/libunixonacid/opengetlnclose_at.o src/libunixonacid/opengetlnclose_at.lo: src/libunixonacid/opengetlnclose_at.c src/include/skalibs/allreadwrite.h src/include/skalibs/buffer.h src/include/skalibs/djbunix.h src/include/skalibs/skamisc.h src/include/skalibs/unix-transactional.h
src/libunixonacid/openreadnclose_at.o src/libunixonacid/openreadnclose_at.lo: src/libunixonacid/openreadnclose_at.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/unix-transactional.h
diff --git a/package/info b/package/info
index 2d62d00..bea2397 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=skalibs
-version=2.11.0.0
+version=2.11.1.0
category=prog
package_macro_name=SKALIBS
diff --git a/src/include/skalibs/unix-transactional.h b/src/include/skalibs/unix-transactional.h
index a5e14b3..88d1838 100644
--- a/src/include/skalibs/unix-transactional.h
+++ b/src/include/skalibs/unix-transactional.h
@@ -8,6 +8,7 @@
#include
#include
+#include
#include
/* Transactional/reliable filesystem operations */
@@ -26,6 +27,7 @@ extern int open_truncat (int, char const *) ;
extern int open_truncatb (int, char const *) ;
extern int open_appendat (int, char const *) ;
extern int open_appendatb (int, char const *) ;
+extern DIR *opendir_at (int, char const *) ;
extern int stat_at (int, char const *, struct stat *) ;
extern int lstat_at (int, char const *, struct stat *) ;
diff --git a/src/libstddjb/fd_close.c b/src/libstddjb/fd_close.c
index a3c7880..dad6518 100644
--- a/src/libstddjb/fd_close.c
+++ b/src/libstddjb/fd_close.c
@@ -1,12 +1,12 @@
/* ISC license. */
-#include
#include
+#include
#include
void fd_close (int fd)
{
int e = errno ;
- while (close(fd) < 0 && errno == EINTR) ;
+ close(fd) ;
errno = e ;
}
diff --git a/src/libunixonacid/opendir_at.c b/src/libunixonacid/opendir_at.c
new file mode 100644
index 0000000..bee971f
--- /dev/null
+++ b/src/libunixonacid/opendir_at.c
@@ -0,0 +1,15 @@
+/* ISC license. */
+
+#include
+#include
+#include
+
+DIR *opendir_at (int dfd, char const *name)
+{
+ DIR *dir ;
+ int fd = open_readatb(dfd, name) ;
+ if (fd < 0) return 0 ;
+ dir = fdopendir(fd) ;
+ if (!dir) fd_close(fd) ;
+ return dir ;
+}
--
cgit v1.2.3