summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-12-04 08:48:45 +0000
committerLaurent Bercot <ska@appnovation.com>2021-12-04 08:48:45 +0000
commit032b853746aabb8c3b82af674fdc783b511569f2 (patch)
tree79edb0d7148cf2ef34874a20a3f760e464d50025
parent450e114e1e1651c65dfcdbfa3c6f3967163976b3 (diff)
downloadskalibs-032b853746aabb8c3b82af674fdc783b511569f2.tar.xz
Add opendir_at, prepare for 2.11.1.0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--NEWS8
-rw-r--r--doc/index.html2
-rw-r--r--doc/upgrade.html15
-rw-r--r--package/deps.mak3
-rw-r--r--package/info2
-rw-r--r--src/include/skalibs/unix-transactional.h2
-rw-r--r--src/libstddjb/fd_close.c4
-rw-r--r--src/libunixonacid/opendir_at.c15
8 files changed, 46 insertions, 5 deletions
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 </li>
<h3> Download </h3>
<ul>
- <li> The current released version of skalibs is <a href="skalibs-2.11.0.0.tar.gz">2.11.0.0</a>. </li>
+ <li> The current released version of skalibs is <a href="skalibs-2.11.1.0.tar.gz">2.11.1.0</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/skalibs/">skalibs
git repository</a>:
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 @@
<a href="//skarnet.org/">skarnet.org</a>
</p>
+<h2> in 2.11.1.0 </h2>
+
+<ul>
+ <li> <tt>fd_close()</tt> now chooses to adapt to Linux's
+<a href="https://man7.org/linux/man-pages/man2/close.2.html">close()</a>
+behaviour (closing the fd on EINTR) over the HP-UX one (not closing it).
+Destructors like
+<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html">close()</a>
+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. </li>
+ <li> New <tt>unix-transactional.h</tt> function: <tt>opendir_at</tt>. </li>
+</ul>
+
<h2> in 2.11.0.0 </h2>
<ul>
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 <sys/uio.h>
#include <skalibs/uint64.h>
+#include <skalibs/direntry.h>
#include <skalibs/stralloc.h>
/* 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 <unistd.h>
#include <errno.h>
+#include <unistd.h>
#include <skalibs/djbunix.h>
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 <skalibs/direntry.h>
+#include <skalibs/djbunix.h>
+#include <skalibs/unix-transactional.h>
+
+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 ;
+}