s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 6305fe2580781df44e93c1ec8ed380896680960d
parent 3ea0b28892de170c5de281529613531dfa15eaa8
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sat, 21 Jul 2018 16:42:59 +0000

 Adapt to skalibs-2.7.0.0

Diffstat:
MINSTALL | 4++--
MNEWS | 1+
Mdoc/index.html | 4++--
Mdoc/s6-notifyoncheck.html | 4++--
Mdoc/upgrade.html | 5++++-
Msrc/conn-tools/s6-accessrules-cdb-from-fs.c | 5++---
Msrc/daemontools-extras/s6-log.c | 13+++++--------
Msrc/libs6/ftrig1_free.c | 4++--
Msrc/libs6/ftrig1_make.c | 18++++++------------
Msrc/libs6/ftrigw_clean.c | 2+-
Msrc/libs6/ftrigw_notifyb_nosig.c | 12+++++-------
11 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -6,8 +6,8 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.6.4.0 or later: http://skarnet.org/software/skalibs/ - - execline version 2.5.0.0 or later: http://skarnet.org/software/execline/ + - skalibs version 2.7.0.0 or later: http://skarnet.org/software/skalibs/ + - execline version 2.5.0.1 or later: http://skarnet.org/software/execline/ This software will run on any operating system that implements POSIX.1-2008, available at: diff --git a/NEWS b/NEWS @@ -12,6 +12,7 @@ at s6-svscan launch will be ready. customize the signal sent by s6-svc -d (and now s6-svc -r too). - New s6-svc option: -r. Sends the signal defined in the down-signal file (still SIGTERM by default). + - Adaptation to skalibs-2.7.0.0. In 2.7.1.1 diff --git a/doc/index.html b/doc/index.html @@ -83,11 +83,11 @@ with s6</a> </li> <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.6.4.0 or later. It's a build-time requirement. It's also a run-time +2.7.0.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> <li> <a href="//skarnet.org/software/execline/">execline</a> version -2.5.0.0 or later. It's a build-time and run-time requirement. </li> +2.5.0.1 or later. It's a build-time and run-time requirement. </li> </ul> <h3> Licensing </h3> diff --git a/doc/s6-notifyoncheck.html b/doc/s6-notifyoncheck.html @@ -86,14 +86,14 @@ differentiated for clarity in the code: <li> <tt>-d</tt>&nbsp;: doublefork. s6-notifyoncheck will run as the grandchild of <em>prog...</em> instead of its direct child. This is useful if <em>prog...</em> never reaps zombies it does not know it has. </li> - <li> <tt>-3&nbsp;<em>notiffd</em></tt>&nbsp;: use <em>fd</em> as the + <li> <tt>-3&nbsp;<em>notiffd</em></tt>&nbsp;: use <em>notiffd</em> as the file descriptor to send a readiness notification to. By default, this number is automatically read from the <tt>./notification-fd</tt> file. </li> <li> <tt>-s&nbsp;<em>initialsleep</em></tt>&nbsp;: sleep for <em>initialsleep</em> milliseconds before starting to poll the service for readiness. Default is 10 milliseconds. </li> <li> <tt>-T&nbsp;<em>globaltimeout</em></tt>&nbsp;: give up (and leave -the service <em>up</em> but not <em>ready</em> if service readiness still +the service <em>up</em> but not <em>ready</em>) if service readiness still has not been detected after <em>globaltimeout</em> milliseconds. Default is 0, meaning infinite: s6-notifyoncheck will keep polling until it succeeds. </li> <li> <tt>-t&nbsp;<em>localtimeout</em></tt>&nbsp;: on every attempt, if diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -21,7 +21,10 @@ <h2> in 2.7.2.0 </h2> <ul> - <li> execline dependency bumped to 2.5.0.0. </li> + <li> <a href="//skarnet.org/software/skalibs/"></a>skalibs</a> +dependency bumped to 2.7.0.0. </li> + <li> <a href="//skarnet.org/software/execline/">execline</a> +dependency bumped to 2.5.0.1. </li> <li> <tt>-B</tt> option added to <a href="s6-ipcserver-socketbinder.html">s6-ipcserver-socketbinder</a>. </li> <li> <tt>-d&nbsp;<em>notif</em></tt> option added to diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c @@ -5,6 +5,7 @@ #include <errno.h> #include <stdlib.h> #include <stdio.h> +#include <skalibs/posixplz.h> #include <skalibs/types.h> #include <skalibs/cdb_make.h> #include <skalibs/strerr2.h> @@ -20,9 +21,7 @@ static stralloc tmp = STRALLOC_ZERO ; static void cleanup (void) { - int e = errno ; - unlink(tmp.s) ; - errno = e ; + unlink_void(tmp.s) ; } static void dienomem (void) diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c @@ -10,6 +10,7 @@ #include <stdio.h> #include <stdlib.h> #include <regex.h> +#include <skalibs/posixplz.h> #include <skalibs/uint64.h> #include <skalibs/types.h> #include <skalibs/allreadwrite.h> @@ -215,9 +216,7 @@ static inline int logdir_trim (logdir_t *ldp) } if (errno) { - int e = errno ; dir_close(dir) ; - errno = e ; return -1 ; } rewinddir(dir) ; @@ -252,9 +251,7 @@ static inline int logdir_trim (logdir_t *ldp) } if (errno) { - int e = errno ; dir_close(dir) ; - errno = e ; return -1 ; } dir_close(dir) ; @@ -586,9 +583,9 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint } else if (st.st_mode & S_IXUSR) goto opencurrent ; memcpy(x + dirlen + 1, "state", 6) ; - unlink(x) ; + unlink_void(x) ; memcpy(x + dirlen + 1, "newstate", 9) ; - unlink(x) ; + unlink_void(x) ; { int flagprocessed = 0 ; memcpy(x + dirlen + 1, "processed", 10) ; @@ -600,13 +597,13 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint if (flagprocessed) { memcpy(x + dirlen + 1, "previous", 9) ; - unlink(x) ; + unlink_void(x) ; if (finish(ldp, "processed", 's') < 0) strerr_diefu2sys(111, "finish processed .s for logdir ", ldp->dir) ; } else { - unlink(x) ; + unlink_void(x) ; if (finish(ldp, "previous", 'u') < 0) strerr_diefu2sys(111, "finish previous .u for logdir ", ldp->dir) ; } diff --git a/src/libs6/ftrig1_free.c b/src/libs6/ftrig1_free.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <unistd.h> +#include <skalibs/posixplz.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> #include "ftrig1.h" @@ -9,7 +9,7 @@ void ftrig1_free (ftrig1_t *p) { if (p->name.s) { - unlink(p->name.s) ; + unlink_void(p->name.s) ; stralloc_free(&p->name) ; } if (p->fd >= 0) diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c @@ -4,7 +4,7 @@ #include <sys/stat.h> #include <unistd.h> #include <stdio.h> -#include <errno.h> +#include <skalibs/posixplz.h> #include <skalibs/tai.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> @@ -32,7 +32,6 @@ int ftrig1_make (ftrig1_t *f, char const *path) { ftrig1_t ff = FTRIG1_ZERO ; size_t pathlen = strlen(path) ; - int e = 0 ; char tmp[pathlen + 46 + FTRIG1_PREFIXLEN] ; memcpy(tmp, path, pathlen) ; @@ -54,28 +53,23 @@ int ftrig1_make (ftrig1_t *f, char const *path) umask(m) ; } - if (!stralloc_catb(&ff.name, tmp, pathlen+1)) { e = errno ; goto err0 ; } - if (!stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 44)) - { - e = errno ; goto err1 ; - } + if (!stralloc_catb(&ff.name, tmp, pathlen+1)) goto err0 ; + if (!stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 44)) goto err1 ; ff.fd = open_read(tmp) ; - if (ff.fd == -1) { e = errno ; goto err1 ; } + if (ff.fd == -1) goto err1 ; ff.fdw = open_write(tmp) ; - if (ff.fdw == -1) { e = errno ; goto err2 ; } + if (ff.fdw == -1) goto err2 ; if (rename(tmp, ff.name.s) == -1) goto err3 ; *f = ff ; return 1 ; err3: - e = errno ; fd_close(ff.fdw) ; err2: fd_close(ff.fd) ; err1: stralloc_free(&ff.name) ; err0: - unlink(tmp) ; - errno = e ; + unlink_void(tmp) ; return 0 ; } diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c @@ -33,7 +33,7 @@ int ftrigw_clean (char const *path) else if ((errno == ENXIO) && (unlink(tmp) < 0)) e = errno ; } } - if (errno) e = errno ; dir_close(dir) ; + if (errno) e = errno ; return e ? (errno = e, 0) : 1 ; } diff --git a/src/libs6/ftrigw_notifyb_nosig.c b/src/libs6/ftrigw_notifyb_nosig.c @@ -3,6 +3,7 @@ #include <string.h> #include <unistd.h> #include <errno.h> +#include <skalibs/posixplz.h> #include <skalibs/direntry.h> #include <skalibs/allreadwrite.h> #include <skalibs/djbunix.h> @@ -32,14 +33,14 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) fd = open_write(tmp) ; if (fd == -1) { - if (errno == ENXIO) unlink(tmp) ; + if (errno == ENXIO) unlink_void(tmp) ; } else { ssize_t r = fd_write(fd, s, len) ; if ((r < 0) || (size_t)r < len) { - if (errno == EPIPE) unlink(tmp) ; + if (errno == EPIPE) unlink_void(tmp) ; /* what to do if EGAIN ? full fifo -> fix the reader ! There's a race condition in extreme cases though ; but it's still better to be nonblocking - the writer @@ -54,9 +55,6 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) } } } - { - int e = errno ; - dir_close(dir) ; - return e ? (errno = e, -1) : (int)i ; - } + dir_close(dir) ; + return errno ? -1 : (int)i ; }