s6

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

commit aaea6322e9e765969f452764e51ca1ddd9783264
parent ce2977ee9195612730bc8713f142c95f79605e75
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Mon,  9 Aug 2021 23:42:35 +0000

 skalibs-2.11.0.0 API change

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Msrc/conn-tools/s6-ioconnect.c | 10+++++-----
Msrc/conn-tools/s6-ipcclient.c | 2+-
Msrc/conn-tools/s6-ipcserver-access.c | 2+-
Msrc/conn-tools/s6-ipcserver-socketbinder.c | 2+-
Msrc/conn-tools/s6-ipcserver.c | 2+-
Msrc/conn-tools/s6-ipcserverd.c | 7+++----
Msrc/conn-tools/s6-sudo.c | 2+-
Msrc/conn-tools/s6-sudoc.c | 8++++----
Msrc/conn-tools/s6-sudod.c | 8++++----
Msrc/daemontools-extras/s6-applyuidgid.c | 2+-
Msrc/daemontools-extras/s6-envdir.c | 2+-
Msrc/daemontools-extras/s6-envuidgid.c | 2+-
Msrc/daemontools-extras/s6-log.c | 37++++++++++++++++++-------------------
Msrc/daemontools-extras/s6-setlock.c | 4++--
Msrc/daemontools-extras/s6-setsid.c | 5++---
Msrc/daemontools-extras/s6-softlimit.c | 2+-
Msrc/daemontools-extras/s6-tai64nlocal.c | 6+++---
Msrc/daemontools-extras/ucspilogd.c | 2+-
Msrc/fdholder/s6-fdholder-daemon.c | 2+-
Msrc/fdholder/s6-fdholder-delete.c | 4++--
Msrc/fdholder/s6-fdholder-getdump.c | 4++--
Msrc/fdholder/s6-fdholder-list.c | 4++--
Msrc/fdholder/s6-fdholder-retrieve.c | 4++--
Msrc/fdholder/s6-fdholder-setdump.c | 4++--
Msrc/fdholder/s6-fdholder-store.c | 4++--
Msrc/fdholder/s6-fdholder-transferdump.c | 4++--
Msrc/fdholder/s6-fdholderd.c | 67++++++++++++++++++++++++++++++++++---------------------------------
Msrc/include/s6/accessrules.h | 22+++++++++++-----------
Msrc/include/s6/ftrigr.h | 14+++++++-------
Msrc/include/s6/s6-fdholder.h | 24++++++++++++------------
Msrc/include/s6/s6-supervise.h | 8++++----
Msrc/include/s6/s6lock.h | 14+++++++-------
Msrc/libs6/ftrigr_start.c | 2+-
Msrc/libs6/ftrigr_startf.c | 2+-
Msrc/libs6/ftrigr_subscribe.c | 2+-
Msrc/libs6/ftrigr_unsubscribe.c | 2+-
Msrc/libs6/ftrigr_updateb.c | 3++-
Msrc/libs6/ftrigr_wait_and.c | 2+-
Msrc/libs6/ftrigr_wait_or.c | 5+++--
Msrc/libs6/ftrigw_notifyb.c | 10++++++----
Msrc/libs6/s6-ftrigrd.c | 7++++---
Msrc/libs6/s6_accessrules_backend_cdb.c | 3+--
Msrc/libs6/s6_accessrules_keycheck_ip4.c | 2+-
Msrc/libs6/s6_accessrules_keycheck_ip6.c | 2+-
Msrc/libs6/s6_accessrules_keycheck_reversedns.c | 2+-
Msrc/libs6/s6_accessrules_keycheck_uidgid.c | 2+-
Msrc/libs6/s6_fdholder_delete.c | 7++++---
Msrc/libs6/s6_fdholder_delete_async.c | 2+-
Msrc/libs6/s6_fdholder_getdump.c | 7++++---
Msrc/libs6/s6_fdholder_list.c | 4++--
Msrc/libs6/s6_fdholder_list_async.c | 2+-
Msrc/libs6/s6_fdholder_list_cb.c | 5+++--
Msrc/libs6/s6_fdholder_retrieve.c | 4++--
Msrc/libs6/s6_fdholder_retrieve_async.c | 2+-
Msrc/libs6/s6_fdholder_retrieve_cb.c | 5+++--
Msrc/libs6/s6_fdholder_setdump.c | 11++++++-----
Msrc/libs6/s6_fdholder_start.c | 2+-
Msrc/libs6/s6_fdholder_store.c | 8+++++---
Msrc/libs6/s6_fdholder_store_async.c | 4++--
Msrc/libs6/s6_supervise_link.c | 4++--
Msrc/libs6/s6lock_acquire.c | 2+-
Msrc/libs6/s6lock_release.c | 2+-
Msrc/libs6/s6lock_start.c | 2+-
Msrc/libs6/s6lock_startf.c | 2+-
Msrc/libs6/s6lock_update.c | 3++-
Msrc/libs6/s6lock_wait_and.c | 2+-
Msrc/libs6/s6lock_wait_or.c | 5+++--
Msrc/libs6/s6lockd.c | 8++++----
Msrc/pipe-tools/s6-ftrig-listen.c | 10++++------
Msrc/pipe-tools/s6-ftrig-listen1.c | 10++++------
Msrc/pipe-tools/s6-ftrig-wait.c | 4++--
Msrc/pipe-tools/s6-mkfifodir.c | 2+-
Msrc/supervision/s6-notifyoncheck.c | 8++++----
Msrc/supervision/s6-permafailon.c | 4++--
Msrc/supervision/s6-supervise.c | 14++++++--------
Msrc/supervision/s6-svc.c | 2+-
Msrc/supervision/s6-svdt.c | 2+-
Msrc/supervision/s6-svlisten.c | 8++------
Msrc/supervision/s6-svlisten.h | 8++++----
Msrc/supervision/s6-svlisten1.c | 8++------
Msrc/supervision/s6-svperms.c | 2+-
Msrc/supervision/s6-svscan.c | 14+++++++-------
Msrc/supervision/s6-svscanctl.c | 2+-
Msrc/supervision/s6-svstat.c | 18+++++++++---------
Msrc/supervision/s6-svwait.c | 6+++---
Msrc/supervision/s6_svlisten_loop.c | 4++--
Msrc/supervision/s6_svlisten_signal_handler.c | 7++++---
Msrc/usertree/s6-usertree-maker.c | 2+-
88 files changed, 278 insertions(+), 280 deletions(-)

diff --git a/src/conn-tools/s6-ioconnect.c b/src/conn-tools/s6-ioconnect.c @@ -73,11 +73,11 @@ static void handle_signals (void) int main (int argc, char const *const *argv) { - tain_t tto ; + tain tto ; unsigned int i, j ; PROG = "s6-ioconnect" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0 ; for (;;) { @@ -105,16 +105,16 @@ int main (int argc, char const *const *argv) if (ndelay_on(a[i][j].fd) == -1) strerr_diefu1sys(111, "ndelay_on") ; if (!iobuffer_init(&b[i], a[i][0].fd, a[i][1].fd)) strerr_diefu1sys(111, "iobuffer_init") ; } - if (sig_ignore(SIGPIPE) == -1) strerr_diefu1sys(111, "sig_ignore") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "sig_ignore") ; tain_now_set_stopwatch_g() ; x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (selfpipe_trap(SIGTERM) < 0) + if (!selfpipe_trap(SIGTERM)) strerr_diefu1sys(111, "trap SIGTERM") ; for (;;) { - tain_t deadline ; + tain deadline ; unsigned int xlen = 1 ; int r ; diff --git a/src/conn-tools/s6-ipcclient.c b/src/conn-tools/s6-ipcclient.c @@ -17,7 +17,7 @@ int main (int argc, char const *const *argv) unsigned int verbosity = 1 ; PROG = "s6-ipcclient" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "qQvp:l:", &l) ; diff --git a/src/conn-tools/s6-ipcserver-access.c b/src/conn-tools/s6-ipcserver-access.c @@ -125,7 +125,7 @@ int main (int argc, char const *const *argv) int doenv = 1 ; PROG = "s6-ipcserver-access" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "v:Eel:i:x:", &l) ; diff --git a/src/conn-tools/s6-ipcserver-socketbinder.c b/src/conn-tools/s6-ipcserver-socketbinder.c @@ -24,7 +24,7 @@ int main (int argc, char const *const *argv) unsigned int perms = 0777 ; PROG = "s6-ipcserver-socketbinder" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "DdMmBb:a:", &l) ; diff --git a/src/conn-tools/s6-ipcserver.c b/src/conn-tools/s6-ipcserver.c @@ -30,7 +30,7 @@ int main (int argc, char const *const *argv) unsigned int socketperms = 0777 ; PROG = "s6-ipcserver" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "qQvDd1UPpc:C:b:a:u:g:G:", &l) ; diff --git a/src/conn-tools/s6-ipcserverd.c b/src/conn-tools/s6-ipcserverd.c @@ -286,7 +286,6 @@ static void new_connection (int s, char const *remotepath, char const *const *ar else if (!pid) { selfpipe_finish() ; - sig_restore(SIGPIPE) ; run_child(s, uid, gid, num+1, remotepath, argv) ; } @@ -311,7 +310,7 @@ int main (int argc, char const *const *argv) iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .fd = 0, .events = IOPAUSE_READ | IOPAUSE_EXCEPT } } ; PROG = "s6-ipcserverd" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; int flag1 = 0 ; for (;;) { @@ -348,7 +347,7 @@ int main (int argc, char const *const *argv) x[0].fd = selfpipe_init() ; if (x[0].fd == -1) strerr_diefu1sys(111, "create selfpipe") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; @@ -357,7 +356,7 @@ int main (int argc, char const *const *argv) sigaddset(&set, SIGHUP) ; sigaddset(&set, SIGQUIT) ; sigaddset(&set, SIGABRT) ; - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } fmtlocalmaxconn[1+uint_fmt(fmtlocalmaxconn+1, localmaxconn)] = 0 ; diff --git a/src/conn-tools/s6-sudo.c b/src/conn-tools/s6-sudo.c @@ -18,7 +18,7 @@ int main (int argc, char const *const *argv) int nodoenv = 0 ; PROG = "s6-sudo" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "qQvp:l:et:T:", &l) ; diff --git a/src/conn-tools/s6-sudoc.c b/src/conn-tools/s6-sudoc.c @@ -29,12 +29,12 @@ int main (int argc, char const *const *argv, char const *const *envp) { char buf6[64] ; buffer b6 = BUFFER_INIT(&buffer_read, 6, buf6, 64) ; - unixmessage_sender_t b7 = UNIXMESSAGE_SENDER_INIT(7) ; - subgetopt_t l = SUBGETOPT_ZERO ; + unixmessage_sender b7 = UNIXMESSAGE_SENDER_INIT(7) ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0, T = 0 ; int doenv = 1 ; - tain_t deadline = TAIN_INFINITE_RELATIVE ; + tain deadline = TAIN_INFINITE_RELATIVE ; PROG = "s6-sudoc" ; for (;;) { @@ -76,7 +76,7 @@ int main (int argc, char const *const *argv, char const *const *envp) { .iov_base = pack, .iov_len = 16 }, { .iov_base = 0, .iov_len = 0 }, { .iov_base = 0, .iov_len = 0 } } ; - unixmessage_v_t mv = { .v = v, .vlen = 4, .fds = fds, .nfds = 3 } ; + unixmessagev mv = { .v = v, .vlen = 4, .fds = fds, .nfds = 3 } ; stralloc sa = STRALLOC_ZERO ; size_t envlen = doenv ? env_len(envp) : 0 ; uint32_pack_big(pack, (uint32_t)argc) ; diff --git a/src/conn-tools/s6-sudod.c b/src/conn-tools/s6-sudod.c @@ -61,17 +61,17 @@ static int handle_signals (pid_t pid, int *wstat) int main (int argc, char const *const *argv, char const *const *envp) { iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .fd = 0, .events = 0, .revents = 0 } } ; - unixmessage_t m ; + unixmessage m ; unsigned int nullfds = 0 ; pid_t pid ; int wstat ; size_t envc = env_len(envp) ; uint32_t cargc, cenvc, carglen, cenvlen ; - tain_t deadline = TAIN_INFINITE_RELATIVE ; + tain deadline = TAIN_INFINITE_RELATIVE ; PROG = "s6-sudod" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0 ; for (;;) { @@ -176,7 +176,7 @@ int main (int argc, char const *const *argv, char const *const *envp) x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "trap SIGCHLD") ; + if (!selfpipe_trap(SIGCHLD)) strerr_diefu1sys(111, "trap SIGCHLD") ; if (pipecoe(p) < 0) strerr_diefu1sys(111, "pipe") ; pid = fork() ; if (pid < 0) strerr_diefu1sys(111, "fork") ; diff --git a/src/daemontools-extras/s6-applyuidgid.c b/src/daemontools-extras/s6-applyuidgid.c @@ -24,7 +24,7 @@ int main (int argc, char const *const *argv) int unexport = 0 ; PROG = "s6-applyuidgid" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "zUu:g:G:", &l) ; diff --git a/src/daemontools-extras/s6-envdir.c b/src/daemontools-extras/s6-envdir.c @@ -13,7 +13,7 @@ int main (int argc, char const *const *argv) { stralloc modifs = STRALLOC_ZERO ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; int insist = 1 ; unsigned int options = 0 ; char nullis = '\n' ; diff --git a/src/daemontools-extras/s6-envuidgid.c b/src/daemontools-extras/s6-envuidgid.c @@ -78,7 +78,7 @@ int main (int argc, char *const *argv) gid_t tab[NGROUPS_MAX] ; PROG = "s6-envuidgid" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, (char const *const *)argv, "ugBniD:", &l) ; diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c @@ -55,8 +55,8 @@ static stralloc indata = STRALLOC_ZERO ; /* Data types */ -typedef int qcmpfunc_t (void const *, void const *) ; -typedef qcmpfunc_t *qcmpfunc_t_ref ; +typedef int qcmp_func (void const *, void const *) ; +typedef qcmp_func *qcmp_func_ref ; typedef enum rotstate_e rotstate_t, *rotstate_t_ref ; enum rotstate_e @@ -139,16 +139,16 @@ struct scriptelem_s unsigned int actlen ; } ; -typedef void inputprocfunc_t (scriptelem_t const *, unsigned int, size_t, unsigned int) ; -typedef inputprocfunc_t *inputprocfunc_t_ref ; +typedef void inputproc_func (scriptelem_t const *, unsigned int, size_t, unsigned int) ; +typedef inputproc_func *inputproc_func_ref ; typedef struct logdir_s logdir_t, *logdir_t_ref ; struct logdir_s { bufalloc out ; unsigned int xindex ; - tain_t retrytto ; - tain_t deadline ; + tain retrytto ; + tain deadline ; uint64_t maxdirsize ; uint32_t b ; uint32_t n ; @@ -200,7 +200,7 @@ static int filedesc_cmp (struct filedesc_s const *a, struct filedesc_s const *b) static int name_is_relevant (char const *name) { - tain_t dummy ; + tain dummy ; if (strlen(name) != 27) return 0 ; if (!timestamp_scan(name, &dummy)) return 0 ; if (name[25] != '.') return 0 ; @@ -270,7 +270,7 @@ static inline int logdir_trim (logdir_t *ldp) dir_close(dir) ; if ((i <= ldp->n) && (!ldp->maxdirsize || (totalsize <= ldp->maxdirsize))) return 0 ; - qsort(archive, i, sizeof(struct filedesc_s), (qcmpfunc_t_ref)&filedesc_cmp) ; + qsort(archive, i, sizeof(struct filedesc_s), (qcmp_func_ref)&filedesc_cmp) ; n = 0 ; while ((i > ldp->n + n) || (ldp->maxdirsize && (totalsize > ldp->maxdirsize))) { @@ -335,7 +335,6 @@ static inline void exec_processor (logdir_t *ldp) if (fd < 0) strerr_diefu3sys(111, "open_trunc ", ldp->dir, "/newstate") ; if (fd_move(5, fd) < 0) strerr_diefu3sys(111, "fd_move ", ldp->dir, "/newstate") ; selfpipe_finish() ; - sig_restore(SIGPIPE) ; xexec(cargv) ; } @@ -555,7 +554,7 @@ static inline void rotate_or_flush (logdir_t *ldp) bufalloc_flush(&ldp->out) ; } -static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64_t maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags) +static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64_t maxdirsize, tain const *retrytto, char const *processor, char const *name, unsigned int flags) { logdir_t *ldp = logdirs + index ; struct stat st ; @@ -670,7 +669,7 @@ static inline void finalize (void) for (;;) { unsigned int i = 0 ; - tain_t deadline ; + tain deadline ; tain_addsec_g(&deadline, 2) ; for (; i < llen ; i++) if (logdirs[i].rstate != ROTSTATE_END) @@ -766,7 +765,7 @@ static inline void script_firstpass (char const *const *argv, unsigned int *sell static inline void script_secondpass (char const *const *argv, scriptelem_t *script, sel_t *selections, act_t *actions) { - tain_t retrytto ; + tain retrytto ; unsigned int fd2_size = 200 ; unsigned int status_size = 1001 ; uint32_t s = 99999 ; @@ -907,7 +906,7 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char char tstamp[TIMESTAMP+1] ; if (gflags & 3) { - tain_t now ; + tain now ; tain_wallclock_read(&now) ; if (gflags & 1) { @@ -916,7 +915,7 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char } if (gflags & 2) { - localtmn_t l ; + localtmn l ; localtmn_from_tain(&l, &now, 1) ; hlen = localtmn_fmt(hstamp, &l) ; hstamp[hlen++] = ' ' ; @@ -1096,7 +1095,7 @@ static void last_stdin (scriptelem_t const *script, unsigned int scriptlen, size } } -static inputprocfunc_t_ref handle_stdin = &normal_stdin ; +static inputproc_func_ref handle_stdin = &normal_stdin ; /* Signals */ @@ -1178,7 +1177,7 @@ int main (int argc, char const *const *argv) int flagblock = 0 ; PROG = "s6-log" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "qvbpl:d:", &l) ; @@ -1221,7 +1220,7 @@ int main (int argc, char const *const *argv) script_secondpass(argv, script, selections, actions) ; x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "sig_ignore(SIGPIPE)") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "sig_ignore(SIGPIPE)") ; { sigset_t set ; sigemptyset(&set) ; @@ -1229,7 +1228,7 @@ int main (int argc, char const *const *argv) sigaddset(&set, SIGHUP) ; sigaddset(&set, SIGALRM) ; sigaddset(&set, SIGCHLD) ; - if (selfpipe_trapset(&set) < 0) + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "selfpipe_trapset") ; } x[0].events = IOPAUSE_READ ; @@ -1241,7 +1240,7 @@ int main (int argc, char const *const *argv) for (;;) { - tain_t deadline ; + tain deadline ; int r = 0 ; unsigned int xindex0, xindex1 ; unsigned int i = 0, j = 1 ; diff --git a/src/daemontools-extras/s6-setlock.c b/src/daemontools-extras/s6-setlock.c @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) PROG = "s6-setlock" ; for (;;) { - int opt = subgetopt(argc, argv, "nNrwt:") ; + int opt = lgetopt(argc, argv, "nNrwt:") ; if (opt == -1) break ; switch (opt) { @@ -47,7 +47,7 @@ int main (int argc, char const *const *argv) char const *cargv[4] = { "s6lockd-helper", ex ? "w" : "r", argv[0], 0 } ; char const *nullenv = { 0 } ; iopause_fd x = { .events = IOPAUSE_READ } ; - tain_t deadline ; + tain deadline ; int p[2] = { 0, 1 } ; pid_t pid ; char c ; diff --git a/src/daemontools-extras/s6-setsid.c b/src/daemontools-extras/s6-setsid.c @@ -17,7 +17,7 @@ int main (int argc, char const *const *argv) unsigned int ctty = 0, what = 0, insist = 1 ; PROG = "s6-setsid" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "sbfgiIqd:", &l) ; @@ -50,14 +50,13 @@ int main (int argc, char const *const *argv) if (what >= 2) { - if (what == 3) sig_ignore(SIGTTOU) ; + if (what == 3) sig_altignore(SIGTTOU) ; if (tcsetpgrp(ctty, getpid()) < 0) switch (insist) { case 2 : strerr_diefu1sys(111, "tcsetpgrp") ; case 1 : strerr_warnwu1sys("tcsetpgrp") ; break ; default : break ; } - if (what == 3) sig_restore(SIGTTOU) ; } } else if (setsid() < 0) switch (insist) diff --git a/src/daemontools-extras/s6-softlimit.c b/src/daemontools-extras/s6-softlimit.c @@ -27,7 +27,7 @@ static void doit (int res, char const *arg) int main (int argc, char const *const *argv) { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; PROG = "s6-softlimit" ; for (;;) { diff --git a/src/daemontools-extras/s6-tai64nlocal.c b/src/daemontools-extras/s6-tai64nlocal.c @@ -17,7 +17,7 @@ int main (int argc, char const *const *argv) int islocal = 1 ; PROG = "s6-tai64nlocal" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "g", &l) ; @@ -42,11 +42,11 @@ int main (int argc, char const *const *argv) else if (!r) break ; if (satmp.len > TIMESTAMP) { - tain_t a ; + tain a ; p = timestamp_scan(satmp.s, &a) ; if (p) { - localtmn_t local ; + localtmn local ; if (localtmn_from_tain(&local, &a, islocal)) { char fmt[LOCALTMN_FMT+1] ; diff --git a/src/daemontools-extras/ucspilogd.c b/src/daemontools-extras/ucspilogd.c @@ -135,7 +135,7 @@ int main (int argc, char const *const *argv, char const *const *envp) char const *d = "<undefined>" ; PROG = "ucspilogd" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "D:", &l) ; diff --git a/src/fdholder/s6-fdholder-daemon.c b/src/fdholder/s6-fdholder-daemon.c @@ -31,7 +31,7 @@ int main (int argc, char const *const *argv) char const *rulesfile = 0 ; PROG = "s6-fdholder-daemon" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "Dd1Uv:c:n:b:u:g:G:t:T:i:x:", &l) ; diff --git a/src/fdholder/s6-fdholder-delete.c b/src/fdholder/s6-fdholder-delete.c @@ -12,11 +12,11 @@ int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; - tain_t deadline ; + tain deadline ; PROG = "s6-fdholder-delete" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:", &l) ; diff --git a/src/fdholder/s6-fdholder-getdump.c b/src/fdholder/s6-fdholder-getdump.c @@ -20,11 +20,11 @@ int main (int argc, char const *const *argv, char const *const *envp) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; genalloc dump = GENALLOC_ZERO ; - tain_t deadline, halfinfinite ; + tain deadline, halfinfinite ; PROG = "s6-fdholder-getdump" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:", &l) ; diff --git a/src/fdholder/s6-fdholder-list.c b/src/fdholder/s6-fdholder-list.c @@ -19,11 +19,11 @@ int main (int argc, char const *const *argv) stralloc sa = STRALLOC_ZERO, sb = STRALLOC_ZERO ; size_t pos = 0 ; int n ; - tain_t deadline ; + tain deadline ; PROG = "s6-fdholder-list" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:", &l) ; diff --git a/src/fdholder/s6-fdholder-retrieve.c b/src/fdholder/s6-fdholder-retrieve.c @@ -15,13 +15,13 @@ int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; - tain_t deadline ; + tain deadline ; int fd ; int dodelete = 0 ; PROG = "s6-fdholder-retrieve" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "Dt:", &l) ; diff --git a/src/fdholder/s6-fdholder-setdump.c b/src/fdholder/s6-fdholder-setdump.c @@ -14,13 +14,13 @@ int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; - tain_t deadline ; + tain deadline ; unsigned int dumplen ; char const *x ; PROG = "s6-fdholder-setdump" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:", &l) ; diff --git a/src/fdholder/s6-fdholder-store.c b/src/fdholder/s6-fdholder-store.c @@ -12,12 +12,12 @@ int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; - tain_t deadline, limit ; + tain deadline, limit ; unsigned int fd = 0 ; PROG = "s6-fdholder-store" ; { unsigned int t = 0, T = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "d:t:T:", &l) ; diff --git a/src/fdholder/s6-fdholder-transferdump.c b/src/fdholder/s6-fdholder-transferdump.c @@ -14,11 +14,11 @@ int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; genalloc dump = GENALLOC_ZERO ; /* array of s6_fdholder_fd_t */ - tain_t deadline, totto ; + tain deadline, totto ; PROG = "s6-fdholder-transferdump" ; { unsigned int timeoutfrom = 0, timeoutto = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:", &l) ; diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c @@ -12,7 +12,6 @@ #include <regex.h> #include <skalibs/posixplz.h> -#include <skalibs/posixishard.h> #include <skalibs/types.h> #include <skalibs/allreadwrite.h> #include <skalibs/sgetopt.h> @@ -36,14 +35,16 @@ #include <s6/accessrules.h> #include <s6/s6-fdholder.h> +#include <skalibs/posixishard.h> + #define USAGE "s6-fdholderd [ -v verbosity ] [ -1 ] [ -c maxconn ] [ -n maxfds ] [ -t timeout ] [ -T lameducktimeout ] [ -i rulesdir | -x rulesfile ]" #define dieusage() strerr_dieusage(100, USAGE) ; static unsigned int verbosity = 1 ; static int cont = 1 ; -static tain_t answertto = TAIN_INFINITE_RELATIVE ; -static tain_t lameduckdeadline = TAIN_INFINITE_RELATIVE ; -static tain_t const nano1 = { .sec = TAI_ZERO, .nano = 1 } ; +static tain answertto = TAIN_INFINITE_RELATIVE ; +static tain lameduckdeadline = TAIN_INFINITE_RELATIVE ; +static tain const nano1 = { .sec = TAI_ZERO, .nano = 1 } ; static unsigned int rulestype = 0 ; static char const *rules = 0 ; @@ -107,8 +108,8 @@ static void *fds_deadline_dtok (uint32_t d, void *x) static int fds_deadline_cmp (void const *a, void const *b, void *x) { - tain_t const *aa = (tain_t const *)a ; - tain_t const *bb = (tain_t const *)b ; + tain const *aa = (tain const *)a ; + tain const *bb = (tain const *)b ; (void)x ; return tain_less(aa, bb) ? -1 : tain_less(bb, aa) ; } @@ -134,12 +135,12 @@ struct client_s { uint32_t next ; uint32_t xindex ; - tain_t deadline ; + tain deadline ; regex_t rre ; regex_t wre ; unsigned int dumping ; unsigned int flags ; - unixconnection_t connection ; + unixconnection connection ; } ; static genset *clients ; @@ -171,14 +172,14 @@ static void removeclient (uint32_t *i, uint32_t j) static void client_setdeadline (client_t *c) { - tain_t blah ; + tain blah ; tain_half(&blah, &tain_infinite_relative) ; tain_add_g(&blah, &blah) ; if (tain_less(&blah, &c->deadline)) tain_add_g(&c->deadline, &answertto) ; } -static inline int client_prepare_iopause (uint32_t i, tain_t *deadline, iopause_fd *x, uint32_t *j) +static inline int client_prepare_iopause (uint32_t i, tain *deadline, iopause_fd *x, uint32_t *j) { client_t *c = CLIENT(i) ; if (tain_less(&c->deadline, deadline)) *deadline = c->deadline ; @@ -223,13 +224,13 @@ static inline int client_flush (uint32_t i, iopause_fd const *x) static int answer (client_t *c, char e) { - unixmessage_t m = { .s = &e, .len = 1, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = &e, .len = 1, .fds = 0, .nfds = 0 } ; if (!unixmessage_put(&c->connection.out, &m)) return 0 ; client_setdeadline(c) ; return 1 ; } -static int do_store (uint32_t cc, unixmessage_t const *m) +static int do_store (uint32_t cc, unixmessage const *m) { uint32_t pp, idlen ; client_t *c = CLIENT(cc) ; @@ -268,7 +269,7 @@ static int do_store (uint32_t cc, unixmessage_t const *m) return 1 ; } -static int do_delete (uint32_t cc, unixmessage_t const *m) +static int do_delete (uint32_t cc, unixmessage const *m) { uint32_t pp, idlen ; client_t *c = CLIENT(cc) ; @@ -282,10 +283,10 @@ static int do_delete (uint32_t cc, unixmessage_t const *m) return 1 ; } -static int do_retrieve (uint32_t cc, unixmessage_t const *m) +static int do_retrieve (uint32_t cc, unixmessage const *m) { int fd ; - unixmessage_t ans = { .s = "", .len = 1, .fds = &fd, .nfds = 1 } ; + unixmessage ans = { .s = "", .len = 1, .fds = &fd, .nfds = 1 } ; uint32_t pp, idlen ; client_t *c = CLIENT(cc) ; if (c->dumping || m->len < 4 || m->nfds) return (errno = EPROTO, 0) ; @@ -309,11 +310,11 @@ static int fill_siovec_with_ids_iter (char *thing, void *data) return 1 ; } -static int do_list (uint32_t cc, unixmessage_t const *m) +static int do_list (uint32_t cc, unixmessage const *m) { client_t *c = CLIENT(cc) ; struct iovec v[1+numfds] ; - unixmessage_v_t ans = { .v = v, .vlen = 1+numfds, .fds = 0, .nfds = 0 } ; + unixmessagev ans = { .v = v, .vlen = 1+numfds, .fds = 0, .nfds = 0 } ; struct iovec *vp = v + 1 ; char pack[5] = "" ; if (c->dumping || m->len || m->nfds) return (errno = EPROTO, 0) ; @@ -349,7 +350,7 @@ static int getdump_iter (char *thing, void *stuff) return 1 ; } -static int do_getdump (uint32_t cc, unixmessage_t const *m) +static int do_getdump (uint32_t cc, unixmessage const *m) { uint32_t n = numfds ? 1 + ((numfds-1) / UNIXMESSAGE_MAXFDS) : 0 ; client_t *c = CLIENT(cc) ; @@ -357,7 +358,7 @@ static int do_getdump (uint32_t cc, unixmessage_t const *m) if (!(c->flags & 1)) return answer(c, EPERM) ; { char pack[9] = "" ; - unixmessage_t ans = { .s = pack, .len = 9, .fds = 0, .nfds = 0 } ; + unixmessage ans = { .s = pack, .len = 9, .fds = 0, .nfds = 0 } ; uint32_pack_big(pack+1, n) ; uint32_pack_big(pack+5, numfds) ; if (!unixmessage_put(&c->connection.out, &ans)) return answer(c, errno) ; @@ -365,7 +366,7 @@ static int do_getdump (uint32_t cc, unixmessage_t const *m) if (n) { uint32_t i = 0 ; - unixmessage_v_t ans[n] ; + unixmessagev ans[n] ; struct iovec v[numfds << 1] ; int fds[numfds] ; char limits[(TAIN_PACK+1) * numfds] ; @@ -404,11 +405,11 @@ static int do_getdump (uint32_t cc, unixmessage_t const *m) return 1 ; } -static int do_setdump (uint32_t cc, unixmessage_t const *m) +static int do_setdump (uint32_t cc, unixmessage const *m) { char pack[5] = "" ; uint32_t n ; - unixmessage_t ans = { .s = pack, .len = 5, .fds = 0, .nfds = 0 } ; + unixmessage ans = { .s = pack, .len = 5, .fds = 0, .nfds = 0 } ; client_t *c = CLIENT(cc) ; if (c->dumping || m->len != 4 || m->nfds) return (errno = EPROTO, 0) ; if (!(c->flags & 2)) return answer(c, EPERM) ; @@ -421,7 +422,7 @@ static int do_setdump (uint32_t cc, unixmessage_t const *m) return 1 ; } -static int do_setdump_data (uint32_t cc, unixmessage_t const *m) +static int do_setdump_data (uint32_t cc, unixmessage const *m) { client_t *c = CLIENT(cc) ; if (!m->nfds || m->nfds > c->dumping || m->len < m->nfds * (TAIN_PACK + 3)) @@ -468,19 +469,19 @@ static int do_setdump_data (uint32_t cc, unixmessage_t const *m) return answer(c, c->dumping ? EAGAIN : 0) ; } -static int do_error (uint32_t cc, unixmessage_t const *m) +static int do_error (uint32_t cc, unixmessage const *m) { (void)cc ; (void)m ; return (errno = EPROTO, 0) ; } -typedef int parsefunc_t (uint32_t, unixmessage_t const *) ; -typedef parsefunc_t *parsefunc_t_ref ; +typedef int parse_func (uint32_t, unixmessage const *) ; +typedef parse_func *parse_func_ref ; -static inline int parse_protocol (unixmessage_t const *m, void *p) +static inline int parse_protocol (unixmessage const *m, void *p) { - static parsefunc_t_ref const f[8] = + static parse_func_ref const f[8] = { &do_store, &do_delete, @@ -491,7 +492,7 @@ static inline int parse_protocol (unixmessage_t const *m, void *p) &do_setdump_data, &do_error } ; - unixmessage_t mcopy = { .s = m->s + 1, .len = m->len - 1, .fds = m->fds, .nfds = m->nfds } ; + unixmessage mcopy = { .s = m->s + 1, .len = m->len - 1, .fds = m->fds, .nfds = m->nfds } ; if (!m->len) { unixmessage_drop(m) ; @@ -651,7 +652,7 @@ int main (int argc, char const *const *argv, char const *const *envp) PROG = "s6-fdholderd" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0, T = 0 ; for (;;) { @@ -702,13 +703,13 @@ int main (int argc, char const *const *argv, char const *const *envp) else close(1) ; spfd = selfpipe_init() ; if (spfd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; sigaddset(&set, SIGTERM) ; sigaddset(&set, SIGHUP) ; - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } if (rulestype == 2) @@ -758,7 +759,7 @@ int main (int argc, char const *const *argv, char const *const *envp) for (;;) { - tain_t deadline ; + tain deadline ; uint32_t j = 2 ; uint32_t i ; int r = 1 ; diff --git a/src/include/s6/accessrules.h b/src/include/s6/accessrules.h @@ -35,20 +35,20 @@ enum s6_accessrules_result_e S6_ACCESSRULES_NOTFOUND = 2 } ; -typedef s6_accessrules_result_t s6_accessrules_backend_func_t (char const *, size_t, void const *, s6_accessrules_params_t *) ; -typedef s6_accessrules_backend_func_t *s6_accessrules_backend_func_t_ref ; +typedef s6_accessrules_result_t s6_accessrules_backend_func (char const *, size_t, void const *, s6_accessrules_params_t *) ; +typedef s6_accessrules_backend_func *s6_accessrules_backend_func_ref ; -extern s6_accessrules_backend_func_t s6_accessrules_backend_fs ; -extern s6_accessrules_backend_func_t s6_accessrules_backend_cdb ; +extern s6_accessrules_backend_func s6_accessrules_backend_fs ; +extern s6_accessrules_backend_func s6_accessrules_backend_cdb ; -typedef s6_accessrules_result_t s6_accessrules_keycheck_func_t (void const *, void const *, s6_accessrules_params_t *, s6_accessrules_backend_func_t_ref) ; -typedef s6_accessrules_keycheck_func_t *s6_accessrules_keycheck_func_t_ref ; +typedef s6_accessrules_result_t s6_accessrules_keycheck_func (void const *, void const *, s6_accessrules_params_t *, s6_accessrules_backend_func_ref) ; +typedef s6_accessrules_keycheck_func *s6_accessrules_keycheck_func_ref ; -extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_uidgid ; -extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_ip4 ; -extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_ip6 ; -extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_reversedns ; -#define s6_accessrules_keycheck_ip46(key, data, params, f) (ip46_is6((ip46_t const *)(key)) ? s6_accessrules_keycheck_ip6(((ip46_t const *)(key))->ip, data, params, f) : s6_accessrules_keycheck_ip4(((ip46_t const *)(key))->ip, data, params, f)) +extern s6_accessrules_keycheck_func s6_accessrules_keycheck_uidgid ; +extern s6_accessrules_keycheck_func s6_accessrules_keycheck_ip4 ; +extern s6_accessrules_keycheck_func s6_accessrules_keycheck_ip6 ; +extern s6_accessrules_keycheck_func s6_accessrules_keycheck_reversedns ; +#define s6_accessrules_keycheck_ip46(key, data, params, f) (ip46_is6((ip46 const *)(key)) ? s6_accessrules_keycheck_ip6(((ip46 const *)(key))->ip, data, params, f) : s6_accessrules_keycheck_ip4(((ip46 const *)(key))->ip, data, params, f)) extern s6_accessrules_result_t s6_accessrules_uidgid_cdb (uid_t, gid_t, cdb const *, s6_accessrules_params_t *) ; extern s6_accessrules_result_t s6_accessrules_uidgid_fs (uid_t, gid_t, char const *, s6_accessrules_params_t *) ; diff --git a/src/include/s6/ftrigr.h b/src/include/s6/ftrigr.h @@ -54,7 +54,7 @@ extern ftrigr1_t const ftrigr1_zero ; typedef struct ftrigr_s ftrigr, ftrigr_t, *ftrigr_ref, *ftrigr_t_ref ; struct ftrigr_s { - textclient_t connection ; + textclient connection ; genalloc list ; /* array of uint16_t */ size_t head ; gensetdyn data ; /* set of ftrigr1_t */ @@ -65,9 +65,9 @@ extern ftrigr_t const ftrigr_zero ; /* Starting and ending a session */ -extern int ftrigr_start (ftrigr_t *, char const *, tain_t const *, tain_t *) ; +extern int ftrigr_start (ftrigr_t *, char const *, tain const *, tain *) ; #define ftrigr_start_g(a, path, deadline) ftrigr_start(a, path, (deadline), &STAMP) -extern int ftrigr_startf (ftrigr_t *, tain_t const *, tain_t *) ; +extern int ftrigr_startf (ftrigr_t *, tain const *, tain *) ; #define ftrigr_startf_g(a, deadline) ftrigr_startf(a, (deadline), &STAMP) extern void ftrigr_end (ftrigr_t *) ; @@ -86,14 +86,14 @@ extern void ftrigr_ack (ftrigr_t *, size_t) ; #define FTRIGR_REPEAT 0x0001 -extern uint16_t ftrigr_subscribe (ftrigr_t *, char const *, char const *, uint32_t, tain_t const *, tain_t *) ; +extern uint16_t ftrigr_subscribe (ftrigr_t *, char const *, char const *, uint32_t, tain const *, tain *) ; #define ftrigr_subscribe_g(a, path, re, options, deadline) ftrigr_subscribe(a, path, re, options, (deadline), &STAMP) -extern int ftrigr_unsubscribe (ftrigr_t *, uint16_t, tain_t const *, tain_t *) ; +extern int ftrigr_unsubscribe (ftrigr_t *, uint16_t, tain const *, tain *) ; #define ftrigr_unsubscribe_g(a, id, deadline) ftrigr_unsubscribe(a, id, (deadline), &STAMP) -extern int ftrigr_wait_and (ftrigr_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ; +extern int ftrigr_wait_and (ftrigr_t *, uint16_t const *, unsigned int, tain const *, tain *) ; #define ftrigr_wait_and_g(a, list, len, deadline) ftrigr_wait_and(a, list, len, (deadline), &STAMP) -extern int ftrigr_wait_or (ftrigr_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *, char *) ; +extern int ftrigr_wait_or (ftrigr_t *, uint16_t const *, unsigned int, tain const *, tain *, char *) ; #define ftrigr_wait_or_g(a, list, len, deadline, what) ftrigr_wait_or(a, list, len, deadline, &STAMP, what) #endif diff --git a/src/include/s6/s6-fdholder.h b/src/include/s6/s6-fdholder.h @@ -15,7 +15,7 @@ typedef struct s6_fdholder_s s6_fdholder_t, *s6_fdholder_t_ref ; struct s6_fdholder_s { - unixconnection_t connection ; + unixconnection connection ; } ; #define S6_FDHOLDER_ZERO { .connection = UNIXCONNECTION_ZERO } ; @@ -25,19 +25,19 @@ struct s6_fdholder_s #define s6_fdholder_init(a, fd) unixconnection_init(&(a)->connection, fd, fd) #define s6_fdholder_free(a) unixconnection_free(&(a)->connection) -extern int s6_fdholder_start (s6_fdholder_t *, char const *, tain_t const *, tain_t *) ; +extern int s6_fdholder_start (s6_fdholder_t *, char const *, tain const *, tain *) ; #define s6_fdholder_start_g(a, path, deadline) s6_fdholder_start(a, path, (deadline), &STAMP) extern void s6_fdholder_end (s6_fdholder_t *) ; /* Individual fds */ -extern int s6_fdholder_store_async (s6_fdholder_t *, int, char const *, tain_t const *) ; -extern int s6_fdholder_store (s6_fdholder_t *, int, char const *, tain_t const *, tain_t const *, tain_t *) ; +extern int s6_fdholder_store_async (s6_fdholder_t *, int, char const *, tain const *) ; +extern int s6_fdholder_store (s6_fdholder_t *, int, char const *, tain const *, tain const *, tain *) ; #define s6_fdholder_store_g(a, fd, id, limit, deadline) s6_fdholder_store(a, fd, id, limit, (deadline), &STAMP) extern int s6_fdholder_delete_async (s6_fdholder_t *, char const *) ; -extern int s6_fdholder_delete (s6_fdholder_t *, char const *, tain_t const *, tain_t *) ; +extern int s6_fdholder_delete (s6_fdholder_t *, char const *, tain const *, tain *) ; #define s6_fdholder_delete_g(a, id, deadline) s6_fdholder_delete(a, id, (deadline), &STAMP) typedef struct s6_fdholder_retrieve_result_s s6_fdholder_retrieve_result_t, *s6_fdholder_retrieve_result_t_ref ; @@ -48,8 +48,8 @@ struct s6_fdholder_retrieve_result_s } ; extern int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *, char const *, int) ; -extern unixmessage_handler_func_t s6_fdholder_retrieve_cb ; -extern int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *, char const *, int, tain_t const *, tain_t *) ; +extern unixmessage_handler_func s6_fdholder_retrieve_cb ; +extern int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *, char const *, int, tain const *, tain *) ; #define s6_fdholder_retrieve_maybe_delete_g(a, id, h, deadline) s6_fdholder_retrieve_maybe_delete(a, id, h, (deadline), &STAMP) #define s6_fdholder_retrieve(a, id, deadline, stamp) s6_fdholder_retrieve_maybe_delete(a, id, 0, deadline, stamp) #define s6_fdholder_retrieve_g(a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP) @@ -65,8 +65,8 @@ struct s6_fdholder_list_result_s } ; extern int s6_fdholder_list_async (s6_fdholder_t *) ; -extern unixmessage_handler_func_t s6_fdholder_list_cb ; -extern int s6_fdholder_list (s6_fdholder_t *, stralloc *, tain_t const *, tain_t *) ; +extern unixmessage_handler_func s6_fdholder_list_cb ; +extern int s6_fdholder_list (s6_fdholder_t *, stralloc *, tain const *, tain *) ; #define s6_fdholder_list_g(a, sa, deadline) s6_fdholder_list(a, sa, (deadline), &STAMP) @@ -77,12 +77,12 @@ struct s6_fdholder_fd_s { char id[S6_FDHOLDER_ID_SIZE + 1] ; int fd ; - tain_t limit ; + tain limit ; } ; -extern int s6_fdholder_getdump (s6_fdholder_t *, genalloc *, tain_t const *, tain_t *) ; +extern int s6_fdholder_getdump (s6_fdholder_t *, genalloc *, tain const *, tain *) ; #define s6_fdholder_getdump_g(a, g, deadline) s6_fdholder_getdump(a, g, (deadline), &STAMP) -extern int s6_fdholder_setdump (s6_fdholder_t *, s6_fdholder_fd_t const *, unsigned int, tain_t const *, tain_t *) ; +extern int s6_fdholder_setdump (s6_fdholder_t *, s6_fdholder_fd_t const *, unsigned int, tain const *, tain *) ; #define s6_fdholder_setdump_g(a, list, n, deadline) s6_fdholder_setdump(a, list, n, (deadline), &STAMP) #endif diff --git a/src/include/s6/s6-supervise.h b/src/include/s6/s6-supervise.h @@ -24,8 +24,8 @@ extern int s6_svc_main (int, char const *const *, char const *, char const *, ch typedef struct s6_svstatus_s s6_svstatus_t, *s6_svstatus_t_ref ; struct s6_svstatus_s { - tain_t stamp ; - tain_t readystamp ; + tain stamp ; + tain readystamp ; pid_t pid ; int wstat ; unsigned int flagpaused : 1 ; @@ -55,14 +55,14 @@ extern void s6_svstatus_unpack (char const *, s6_svstatus_t *) ; extern int s6_svstatus_read (char const *, s6_svstatus_t *) ; extern int s6_svstatus_write (char const *, s6_svstatus_t const *) ; -extern int s6_supervise_link (char const *, char const *const *, size_t, char const *, uint32_t, tain_t const *, tain_t *) ; +extern int s6_supervise_link (char const *, char const *const *, size_t, char const *, uint32_t, tain const *, tain *) ; #define s6_supervise_link_g(scdir, servicedirs, n, prefix, options, deadline) s6_supervise_link(scdir, servicedirs, n, prefix, options, (deadline), &STAMP) extern void s6_supervise_unlink (char const *, char const *, uint32_t) ; typedef struct s6_dtally_s s6_dtally_t, *s6_dtally_ref ; struct s6_dtally_s { - tain_t stamp ; + tain stamp ; unsigned char exitcode ; unsigned char sig ; } ; diff --git a/src/include/s6/s6lock.h b/src/include/s6/s6lock.h @@ -27,7 +27,7 @@ typedef struct s6lock_s s6lock_t, *s6lock_t_ref ; struct s6lock_s { - textclient_t connection ; + textclient connection ; genalloc list ; /* array of uint16_t */ gensetdyn data ; /* set of char */ } ; @@ -37,9 +37,9 @@ extern s6lock_t const s6lock_zero ; /* Starting and ending a session */ -extern int s6lock_start (s6lock_t *, char const *, tain_t const *, tain_t *) ; +extern int s6lock_start (s6lock_t *, char const *, tain const *, tain *) ; #define s6lock_start_g(a, ipcpath, deadline) s6lock_start(a, ipcpath, (deadline), &STAMP) -extern int s6lock_startf (s6lock_t *, char const *, tain_t const *, tain_t *) ; +extern int s6lock_startf (s6lock_t *, char const *, tain const *, tain *) ; #define s6lock_startf_g(a, lockdir, deadline) s6lock_startf(a, lockdir, (deadline), &STAMP) extern void s6lock_end (s6lock_t *) ; @@ -56,18 +56,18 @@ extern int s6lock_check (s6lock_t *, uint16_t) ; #define S6LOCK_OPTIONS_SH 0x0000U #define S6LOCK_OPTIONS_EX 0x0001U -extern int s6lock_acquire (s6lock_t *, uint16_t *, char const *, uint32_t, tain_t const *, tain_t const *, tain_t *) ; +extern int s6lock_acquire (s6lock_t *, uint16_t *, char const *, uint32_t, tain const *, tain const *, tain *) ; #define s6lock_acquire_g(a, id, path, options, limit, deadline) s6lock_acquire(a, id, path, options, limit, (deadline), &STAMP) #define s6lock_acquire_sh(a, id, path, limit, deadline, stamp) s6lock_aquire(a, id, path, S6LOCK_OPTIONS_SH, limit, deadline, stamp) #define s6lock_acquire_ex(a, id, path, limit, deadline, stamp) s6lock_aquire(a, id, path, S6LOCK_OPTIONS_EX, limit, deadline, stamp) #define s6lock_acquire_sh_g(a, id, path, limit, deadline) s6lock_acquire_sh(a, id, path, limit, (deadline), &STAMP) #define s6lock_acquire_ex_g(a, id, path, limit, deadline) s6lock_acquire_ex(a, id, path, limit, (deadline), &STAMP) -extern int s6lock_release (s6lock_t *, uint16_t, tain_t const *, tain_t *) ; +extern int s6lock_release (s6lock_t *, uint16_t, tain const *, tain *) ; #define s6lock_release_g(a, id, deadline) s6lock_release(a, id, (deadline), &STAMP) -extern int s6lock_wait_and (s6lock_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ; +extern int s6lock_wait_and (s6lock_t *, uint16_t const *, unsigned int, tain const *, tain *) ; #define s6lock_wait_and_g(a, list, len, deadline) s6lock_wait_and(a, list, len, (deadline), &STAMP) -extern int s6lock_wait_or (s6lock_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ; +extern int s6lock_wait_or (s6lock_t *, uint16_t const *, unsigned int, tain const *, tain *) ; #define s6lock_wait_or_g(a, list, len, deadline) s6lock_wait_or(a, list, len, (deadline), &STAMP) #endif diff --git a/src/libs6/ftrigr_start.c b/src/libs6/ftrigr_start.c @@ -3,7 +3,7 @@ #include <skalibs/textclient.h> #include <s6/ftrigr.h> -int ftrigr_start (ftrigr_t *a, char const *path, tain_t const *deadline, tain_t *stamp) +int ftrigr_start (ftrigr_t *a, char const *path, tain const *deadline, tain *stamp) { return textclient_start(&a->connection, path, 0, FTRIGR_BANNER1, FTRIGR_BANNER1_LEN, FTRIGR_BANNER2, FTRIGR_BANNER2_LEN, deadline, stamp) ; } diff --git a/src/libs6/ftrigr_startf.c b/src/libs6/ftrigr_startf.c @@ -3,7 +3,7 @@ #include <skalibs/textclient.h> #include <s6/ftrigr.h> -int ftrigr_startf (ftrigr_t *a, tain_t const *deadline, tain_t *stamp) +int ftrigr_startf (ftrigr_t *a, tain const *deadline, tain *stamp) { static char const *const cargv[2] = { FTRIGRD_PROG, 0 } ; static char const *const cenvp[1] = { 0 } ; diff --git a/src/libs6/ftrigr_subscribe.c b/src/libs6/ftrigr_subscribe.c @@ -12,7 +12,7 @@ #include <skalibs/textclient.h> #include <s6/ftrigr.h> -uint16_t ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32_t options, tain_t const *deadline, tain_t *stamp) +uint16_t ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32_t options, tain const *deadline, tain *stamp) { size_t pathlen = strlen(path) ; size_t relen = strlen(re) ; diff --git a/src/libs6/ftrigr_unsubscribe.c b/src/libs6/ftrigr_unsubscribe.c @@ -7,7 +7,7 @@ #include <skalibs/textclient.h> #include <s6/ftrigr.h> -int ftrigr_unsubscribe (ftrigr_t *a, uint16_t i, tain_t const *deadline, tain_t *stamp) +int ftrigr_unsubscribe (ftrigr_t *a, uint16_t i, tain const *deadline, tain *stamp) { ftrigr1_t *p ; char pack[3] = "--U" ; diff --git a/src/libs6/ftrigr_updateb.c b/src/libs6/ftrigr_updateb.c @@ -5,7 +5,6 @@ #include <stdint.h> #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/gccattributes.h> #include <skalibs/uint16.h> #include <skalibs/genalloc.h> @@ -13,6 +12,8 @@ #include <skalibs/textclient.h> #include <s6/ftrigr.h> +#include <skalibs/posixishard.h> + static inline int appears (uint16_t, uint16_t const *, size_t) gccattr_pure ; static inline int appears (uint16_t id, uint16_t const *list, size_t len) diff --git a/src/libs6/ftrigr_wait_and.c b/src/libs6/ftrigr_wait_and.c @@ -4,7 +4,7 @@ #include <skalibs/iopause.h> #include <s6/ftrigr.h> -int ftrigr_wait_and (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp) +int ftrigr_wait_and (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain const *deadline, tain *stamp) { iopause_fd x = { -1, IOPAUSE_READ, 0 } ; x.fd = ftrigr_fd(a) ; diff --git a/src/libs6/ftrigr_wait_or.c b/src/libs6/ftrigr_wait_or.c @@ -2,12 +2,13 @@ #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/iopause.h> #include <s6/ftrigr.h> -int ftrigr_wait_or (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp, char *c) +#include <skalibs/posixishard.h> + +int ftrigr_wait_or (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain const *deadline, tain *stamp, char *c) { iopause_fd x = { -1, IOPAUSE_READ | IOPAUSE_EXCEPT, 0 } ; x.fd = ftrigr_fd(a) ; diff --git a/src/libs6/ftrigw_notifyb.c b/src/libs6/ftrigw_notifyb.c @@ -2,18 +2,20 @@ #include <errno.h> #include <signal.h> -#include <skalibs/sig.h> + #include <s6/ftrigw.h> int ftrigw_notifyb (char const *path, char const *s, size_t len) { - struct skasigaction old ; + struct sigaction old ; + struct sigaction action = { .sa_handler = SIG_IGN, .sa_flags = SA_RESTART | SA_NOCLDSTOP } ; int r ; - if (skasigaction(SIGPIPE, &SKASIG_IGN, &old) < 0) return -1 ; + sigfillset(&action.sa_mask) ; + if (sigaction(SIGPIPE, &action, &old) == -1) return -1 ; r = ftrigw_notifyb_nosig(path, s, len) ; { int e = errno ; - skasigaction(SIGPIPE, &old, 0) ; + sigaction(SIGPIPE, &old, 0) ; errno = e ; } return r ; diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c @@ -8,7 +8,6 @@ #include <regex.h> #include <skalibs/posixplz.h> -#include <skalibs/posixishard.h> #include <skalibs/types.h> #include <skalibs/allreadwrite.h> #include <skalibs/error.h> @@ -25,6 +24,8 @@ #include "ftrig1.h" #include <s6/ftrigr.h> +#include <skalibs/posixishard.h> + #define FTRIGRD_MAXREADS 32 #define FTRIGRD_BUFSIZE 17 @@ -197,10 +198,10 @@ int main (void) if (ndelay_on(0) < 0) strerr_diefu2sys(111, "ndelay_on ", "0") ; if (ndelay_on(1) < 0) strerr_diefu2sys(111, "ndelay_on ", "1") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { - tain_t deadline ; + tain deadline ; tain_now_set_stopwatch_g() ; tain_addsec_g(&deadline, 2) ; if (!textclient_server_01x_init_g(FTRIGR_BANNER1, FTRIGR_BANNER1_LEN, FTRIGR_BANNER2, FTRIGR_BANNER2_LEN, &deadline)) diff --git a/src/libs6/s6_accessrules_backend_cdb.c b/src/libs6/s6_accessrules_backend_cdb.c @@ -16,8 +16,7 @@ s6_accessrules_result_t s6_accessrules_backend_cdb (char const *key, size_t keyl int wasnull = !params->env.s ; uint16_t envlen, execlen ; cdb const *c = arg ; - cdb_find_state cfs = CDB_FIND_STATE_ZERO ; - int r = cdb_find(c, &data, key, keylen, &cfs) ; + int r = cdb_find(c, &data, key, keylen) ; if (r < 0) return S6_ACCESSRULES_ERROR ; else if (!r) return S6_ACCESSRULES_NOTFOUND ; if (!data.len || data.len > 8197) return (errno = EINVAL, S6_ACCESSRULES_ERROR) ; diff --git a/src/libs6/s6_accessrules_keycheck_ip4.c b/src/libs6/s6_accessrules_keycheck_ip4.c @@ -5,7 +5,7 @@ #include <skalibs/fmtscan.h> #include <s6/accessrules.h> -s6_accessrules_result_t s6_accessrules_keycheck_ip4 (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1) +s6_accessrules_result_t s6_accessrules_keycheck_ip4 (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_ref check1) { char fmt[IP4_FMT + UINT_FMT + 6] = "ip4/" ; uint32_t ip ; diff --git a/src/libs6/s6_accessrules_keycheck_ip6.c b/src/libs6/s6_accessrules_keycheck_ip6.c @@ -6,7 +6,7 @@ #include <skalibs/fmtscan.h> #include <s6/accessrules.h> -s6_accessrules_result_t s6_accessrules_keycheck_ip6 (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1) +s6_accessrules_result_t s6_accessrules_keycheck_ip6 (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_ref check1) { char fmt[IP6_FMT + UINT_FMT + 6] = "ip6/" ; char ip6[16] ; diff --git a/src/libs6/s6_accessrules_keycheck_reversedns.c b/src/libs6/s6_accessrules_keycheck_reversedns.c @@ -5,7 +5,7 @@ #include <skalibs/bytestr.h> #include <s6/accessrules.h> -s6_accessrules_result_t s6_accessrules_keycheck_reversedns (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1) +s6_accessrules_result_t s6_accessrules_keycheck_reversedns (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_ref check1) { char const *name = key ; size_t len = strlen(name) ; diff --git a/src/libs6/s6_accessrules_keycheck_uidgid.c b/src/libs6/s6_accessrules_keycheck_uidgid.c @@ -6,7 +6,7 @@ #include <skalibs/types.h> #include <s6/accessrules.h> -s6_accessrules_result_t s6_accessrules_keycheck_uidgid (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1) +s6_accessrules_result_t s6_accessrules_keycheck_uidgid (void const *key, void const *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_ref check1) { uidgid_t const *uidgid = key ; char fmt[4 + UINT64_FMT] = "uid/" ; diff --git a/src/libs6/s6_fdholder_delete.c b/src/libs6/s6_fdholder_delete.c @@ -2,16 +2,17 @@ #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/allreadwrite.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_delete (s6_fdholder_t *a, char const *id, tain_t const *deadline, tain_t *stamp) +#include <skalibs/posixishard.h> + +int s6_fdholder_delete (s6_fdholder_t *a, char const *id, tain const *deadline, tain *stamp) { - unixmessage_t m ; + unixmessage m ; if (!s6_fdholder_delete_async(a, id)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; diff --git a/src/libs6/s6_fdholder_delete_async.c b/src/libs6/s6_fdholder_delete_async.c @@ -11,7 +11,7 @@ int s6_fdholder_delete_async (s6_fdholder_t *a, char const *id) size_t idlen = strlen(id) ; char pack[2] = "D" ; struct iovec v[2] = { { .iov_base = pack, .iov_len = 2 }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ; - unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ; + unixmessagev m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ; if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ; pack[1] = (unsigned char)idlen ; return unixmessage_putv(&a->connection.out, &m) ; diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c @@ -4,7 +4,6 @@ #include <stdint.h> #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/allreadwrite.h> #include <skalibs/tai.h> @@ -14,9 +13,11 @@ #include <s6/s6-fdholder.h> -int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline, tain_t *stamp) +#include <skalibs/posixishard.h> + +int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain const *deadline, tain *stamp) { - unixmessage_t m = { .s = "?", .len = 1, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = "?", .len = 1, .fds = 0, .nfds = 0 } ; uint32_t ntot, n ; size_t oldlen = genalloc_len(s6_fdholder_fd_t, g) ; unsigned int i = 0 ; diff --git a/src/libs6/s6_fdholder_list.c b/src/libs6/s6_fdholder_list.c @@ -7,10 +7,10 @@ #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_list (s6_fdholder_t *a, stralloc *sa, tain_t const *deadline, tain_t *stamp) +int s6_fdholder_list (s6_fdholder_t *a, stralloc *sa, tain const *deadline, tain *stamp) { s6_fdholder_list_result_t res = { .sa = sa } ; - unixmessage_t m ; + unixmessage m ; if (!s6_fdholder_list_async(a)) return -1 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return -1 ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return -1 ; diff --git a/src/libs6/s6_fdholder_list_async.c b/src/libs6/s6_fdholder_list_async.c @@ -5,6 +5,6 @@ int s6_fdholder_list_async (s6_fdholder_t *a) { - unixmessage_t m = { .s = "L", .len = 1, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = "L", .len = 1, .fds = 0, .nfds = 0 } ; return unixmessage_put(&a->connection.out, &m) ; } diff --git a/src/libs6/s6_fdholder_list_cb.c b/src/libs6/s6_fdholder_list_cb.c @@ -3,14 +3,15 @@ #include <stdint.h> #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/bytestr.h> #include <skalibs/stralloc.h> #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_list_cb (unixmessage_t const *m, void *p) +#include <skalibs/posixishard.h> + +int s6_fdholder_list_cb (unixmessage const *m, void *p) { uint32_t n ; s6_fdholder_list_result_t *res = p ; diff --git a/src/libs6/s6_fdholder_retrieve.c b/src/libs6/s6_fdholder_retrieve.c @@ -6,9 +6,9 @@ #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *a, char const *id, int dodelete, tain_t const *deadline, tain_t *stamp) +int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *a, char const *id, int dodelete, tain const *deadline, tain *stamp) { - unixmessage_t m ; + unixmessage m ; s6_fdholder_retrieve_result_t res ; if (!s6_fdholder_retrieve_maybe_delete_async(a, id, dodelete)) return -1 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return -1 ; diff --git a/src/libs6/s6_fdholder_retrieve_async.c b/src/libs6/s6_fdholder_retrieve_async.c @@ -11,7 +11,7 @@ int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *a, char const *id, i size_t idlen = strlen(id) ; char pack[3] = "R" ; struct iovec v[2] = { { .iov_base = pack, .iov_len = 3 }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ; - unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ; + unixmessagev m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ; if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ; pack[1] = !!dodelete ; pack[2] = (unsigned char)idlen ; diff --git a/src/libs6/s6_fdholder_retrieve_cb.c b/src/libs6/s6_fdholder_retrieve_cb.c @@ -2,12 +2,13 @@ #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_retrieve_cb (unixmessage_t const *m, void *p) +#include <skalibs/posixishard.h> + +int s6_fdholder_retrieve_cb (unixmessage const *m, void *p) { s6_fdholder_retrieve_result_t *res = p ; if (m->len != 1) goto err ; diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c @@ -5,7 +5,6 @@ #include <string.h> #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/allreadwrite.h> #include <skalibs/bytestr.h> @@ -15,7 +14,9 @@ #include <s6/s6-fdholder.h> -int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigned int ntot, tain_t const *deadline, tain_t *stamp) +#include <skalibs/posixishard.h> + +int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigned int ntot, tain const *deadline, tain *stamp) { uint32_t trips ; if (!ntot) return 1 ; @@ -27,7 +28,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne } { char pack[5] = "!" ; - unixmessage_t m = { .s = pack, .len = 5, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = pack, .len = 5, .fds = 0, .nfds = 0 } ; uint32_pack_big(pack+1, ntot) ; if (!unixmessage_put(&a->connection.out, &m)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; @@ -45,7 +46,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne unsigned int j = 0 ; struct iovec v[1 + (n<<1)] ; int fds[n] ; - unixmessage_v_t m = { .v = v, .vlen = 1 + (n<<1), .fds = fds, .nfds = n } ; + unixmessagev m = { .v = v, .vlen = 1 + (n<<1), .fds = fds, .nfds = n } ; char pack[n * (TAIN_PACK+1)] ; v[0].iov_base = "." ; v[0].iov_len = 1 ; for (; j < n ; j++, list++, ntot--) @@ -63,7 +64,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne } if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; { - unixmessage_t m ; + unixmessage m ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (m.len != 1 || m.nfds) { diff --git a/src/libs6/s6_fdholder_start.c b/src/libs6/s6_fdholder_start.c @@ -5,7 +5,7 @@ #include <s6/s6-fdholder.h> -int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain_t const *deadline, tain_t *stamp) +int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain const *deadline, tain *stamp) { int fd = ipc_stream_nb() ; if (fd < 0) return 0 ; diff --git a/src/libs6/s6_fdholder_store.c b/src/libs6/s6_fdholder_store.c @@ -2,15 +2,17 @@ #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/allreadwrite.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> + #include <s6/s6-fdholder.h> -int s6_fdholder_store (s6_fdholder_t *a, int fd, char const *id, tain_t const *limit, tain_t const *deadline, tain_t *stamp) +#include <skalibs/posixishard.h> + +int s6_fdholder_store (s6_fdholder_t *a, int fd, char const *id, tain const *limit, tain const *deadline, tain *stamp) { - unixmessage_t m ; + unixmessage m ; if (!s6_fdholder_store_async(a, fd, id, limit)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; diff --git a/src/libs6/s6_fdholder_store_async.c b/src/libs6/s6_fdholder_store_async.c @@ -7,12 +7,12 @@ #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> -int s6_fdholder_store_async (s6_fdholder_t *a, int fd, char const *id, tain_t const *limit) +int s6_fdholder_store_async (s6_fdholder_t *a, int fd, char const *id, tain const *limit) { size_t idlen = strlen(id) ; char pack[2 + TAIN_PACK] = "S" ; struct iovec v[2] = { { .iov_base = pack, .iov_len = 2 + TAIN_PACK }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ; - unixmessage_v_t m = { .v = v, .vlen = 2, .fds = &fd, .nfds = 1 } ; + unixmessagev m = { .v = v, .vlen = 2, .fds = &fd, .nfds = 1 } ; if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ; tain_pack(pack + 1, limit) ; pack[1+TAIN_PACK] = (unsigned char)idlen ; diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c @@ -29,7 +29,7 @@ static inline void do_unlink (char const *scdir, char const *prefix, size_t pref } } -static uint16_t registerit (ftrigr_t *a, char *fn, size_t len, gid_t gid, uint32_t options, tain_t const *deadline, tain_t *stamp) +static uint16_t registerit (ftrigr_t *a, char *fn, size_t len, gid_t gid, uint32_t options, tain const *deadline, tain *stamp) { if (options & 4) { @@ -44,7 +44,7 @@ static uint16_t registerit (ftrigr_t *a, char *fn, size_t len, gid_t gid, uint32 return ftrigr_subscribe(a, fn, "s", 0, deadline, stamp) ; } -int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t n, char const *prefix, uint32_t options, tain_t const *deadline, tain_t *stamp) +int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t n, char const *prefix, uint32_t options, tain const *deadline, tain *stamp) { size_t maxlen = 0 ; size_t ntotal = n ; diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c @@ -11,7 +11,7 @@ #include <skalibs/textclient.h> #include <s6/s6lock.h> -int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options, tain_t const *limit, tain_t const *deadline, tain_t *stamp) +int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options, tain const *limit, tain const *deadline, tain *stamp) { size_t pathlen = strlen(path) ; char tmp[23] = "--<" ; diff --git a/src/libs6/s6lock_release.c b/src/libs6/s6lock_release.c @@ -7,7 +7,7 @@ #include <skalibs/textclient.h> #include <s6/s6lock.h> -int s6lock_release (s6lock_t *a, uint16_t i, tain_t const *deadline, tain_t *stamp) +int s6lock_release (s6lock_t *a, uint16_t i, tain const *deadline, tain *stamp) { char *p = GENSETDYN_P(char, &a->data, i) ; char pack[3] = "-->" ; diff --git a/src/libs6/s6lock_start.c b/src/libs6/s6lock_start.c @@ -3,7 +3,7 @@ #include <skalibs/textclient.h> #include <s6/s6lock.h> -int s6lock_start (s6lock_t *a, char const *path, tain_t const *deadline, tain_t *stamp) +int s6lock_start (s6lock_t *a, char const *path, tain const *deadline, tain *stamp) { return textclient_start(&a->connection, path, 0, S6LOCK_BANNER1, S6LOCK_BANNER1_LEN, S6LOCK_BANNER2, S6LOCK_BANNER2_LEN, deadline, stamp) ; } diff --git a/src/libs6/s6lock_startf.c b/src/libs6/s6lock_startf.c @@ -5,7 +5,7 @@ #include <skalibs/textclient.h> #include <s6/s6lock.h> -int s6lock_startf (s6lock_t *a, char const *lockdir, tain_t const *deadline, tain_t *stamp) +int s6lock_startf (s6lock_t *a, char const *lockdir, tain const *deadline, tain *stamp) { char const *cargv[3] = { S6LOCKD_PROG, lockdir, 0 } ; if (!lockdir) return (errno = EINVAL, 0) ; diff --git a/src/libs6/s6lock_update.c b/src/libs6/s6lock_update.c @@ -4,7 +4,6 @@ #include <stdint.h> #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/error.h> #include <skalibs/uint16.h> #include <skalibs/genalloc.h> @@ -13,6 +12,8 @@ #include <s6/s6lock.h> +#include <skalibs/posixishard.h> + static int msghandler (struct iovec const *v, void *context) { s6lock_t *a = (s6lock_t *)context ; diff --git a/src/libs6/s6lock_wait_and.c b/src/libs6/s6lock_wait_and.c @@ -4,7 +4,7 @@ #include <skalibs/iopause.h> #include <s6/s6lock.h> -int s6lock_wait_and (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp) +int s6lock_wait_and (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain const *deadline, tain *stamp) { iopause_fd x = { .fd = -1, .events = IOPAUSE_READ, .revents = 0 } ; x.fd = s6lock_fd(a) ; diff --git a/src/libs6/s6lock_wait_or.c b/src/libs6/s6lock_wait_or.c @@ -2,12 +2,13 @@ #include <errno.h> -#include <skalibs/posixishard.h> #include <skalibs/iopause.h> #include <s6/s6lock.h> -int s6lock_wait_or (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp) +#include <skalibs/posixishard.h> + +int s6lock_wait_or (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain const *deadline, tain *stamp) { iopause_fd x = { -1, IOPAUSE_READ | IOPAUSE_EXCEPT, 0 } ; x.fd = s6lock_fd(a) ; diff --git a/src/libs6/s6lockd.c b/src/libs6/s6lockd.c @@ -30,7 +30,7 @@ struct s6lockio_s { unsigned int xindex ; unsigned int pid ; - tain_t limit ; + tain limit ; int p[2] ; uint16_t id ; /* given by client */ } ; @@ -179,7 +179,7 @@ static int parse_protocol (struct iovec const *v, void *context) int main (int argc, char const *const *argv) { - tain_t deadline ; + tain deadline ; int sfd ; PROG = "s6lockd" ; @@ -187,7 +187,7 @@ int main (int argc, char const *const *argv) if (chdir(argv[1]) < 0) strerr_diefu2sys(111, "chdir to ", argv[1]) ; if (ndelay_on(0) < 0) strerr_diefu2sys(111, "ndelay_on ", "0") ; if (ndelay_on(1) < 0) strerr_diefu2sys(111, "ndelay_on ", "1") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; sfd = selfpipe_init() ; if (sfd < 0) strerr_diefu1sys(111, "selfpipe_init") ; @@ -200,7 +200,7 @@ int main (int argc, char const *const *argv) sigaddset(&set, SIGHUP) ; sigaddset(&set, SIGABRT) ; sigaddset(&set, SIGINT) ; - if (selfpipe_trapset(&set) < 0) + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c @@ -34,7 +34,7 @@ static void handle_signals (void) int main (int argc, char const **argv, char const *const *envp) { iopause_fd x[2] = { { -1, IOPAUSE_READ, 0 }, { -1, IOPAUSE_READ, 0 } } ; - tain_t deadline, tto ; + tain deadline, tto ; ftrigr_t a = FTRIGR_ZERO ; int argc1 ; unsigned int i = 0 ; @@ -44,7 +44,7 @@ int main (int argc, char const **argv, char const *const *envp) unsigned int t = 0 ; for (;;) { - int opt = subgetopt(argc, argv, "aot:") ; + int opt = lgetopt(argc, argv, "aot:") ; if (opt == -1) break ; switch (opt) { @@ -65,8 +65,8 @@ int main (int argc, char const **argv, char const *const *envp) tain_add_g(&deadline, &tto) ; x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "selfpipe_trap") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!selfpipe_trap(SIGCHLD)) strerr_diefu1sys(111, "selfpipe_trap") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; if (!ftrigr_startf_g(&a, &deadline)) strerr_diefu1sys(111, "ftrigr_startf") ; x[1].fd = ftrigr_fd(&a) ; @@ -81,10 +81,8 @@ int main (int argc, char const **argv, char const *const *envp) if (!ids[i]) strerr_diefu4sys(111, "subscribe to ", argv[i<<1], " with regexp ", argv[(i<<1)+1]) ; } - sig_restore(SIGPIPE) ; pid = child_spawn0(argv[argc1 + 1], argv + argc1 + 1, envp) ; if (!pid) strerr_diefu2sys(111, "spawn ", argv[argc1 + 1]) ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; for (;;) { diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c @@ -33,7 +33,7 @@ static void handle_signals (void) int main (int argc, char const *const *argv, char const *const *envp) { iopause_fd x[2] = { { -1, IOPAUSE_READ, 0 }, { -1, IOPAUSE_READ, 0 } } ; - tain_t deadline, tto ; + tain deadline, tto ; ftrigr_t a = FTRIGR_ZERO ; pid_t pid ; uint16_t id ; @@ -43,7 +43,7 @@ int main (int argc, char const *const *argv, char const *const *envp) unsigned int t = 0 ; for (;;) { - int opt = subgetopt(argc, argv, "t:") ; + int opt = lgetopt(argc, argv, "t:") ; if (opt == -1) break ; switch (opt) { @@ -59,20 +59,18 @@ int main (int argc, char const *const *argv, char const *const *envp) tain_now_set_stopwatch_g() ; tain_add_g(&deadline, &tto) ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "sig_ignore") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "sig_ignore") ; if (!ftrigr_startf_g(&a, &deadline)) strerr_diefu1sys(111, "ftrigr_startf") ; id = ftrigr_subscribe_g(&a, argv[0], argv[1], 0, &deadline) ; if (!id) strerr_diefu4sys(111, "subscribe to ", argv[0], " with regexp ", argv[1]) ; x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "selfpipe_trap") ; + if (!selfpipe_trap(SIGCHLD)) strerr_diefu1sys(111, "selfpipe_trap") ; x[1].fd = ftrigr_fd(&a) ; - sig_restore(SIGPIPE) ; pid = child_spawn0(argv[2], argv+2, envp) ; if (!pid) strerr_diefu2sys(111, "spawn ", argv[2]) ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "sig_ignore") ; for (;;) { diff --git a/src/pipe-tools/s6-ftrig-wait.c b/src/pipe-tools/s6-ftrig-wait.c @@ -13,7 +13,7 @@ int main (int argc, char const *const *argv) { - tain_t deadline, tto ; + tain deadline, tto ; ftrigr_t a = FTRIGR_ZERO ; uint16_t id ; char pack[2] = " \n" ; @@ -22,7 +22,7 @@ int main (int argc, char const *const *argv) unsigned int t = 0 ; for (;;) { - int opt = subgetopt(argc, argv, "t:") ; + int opt = lgetopt(argc, argv, "t:") ; if (opt == -1) break ; switch (opt) { diff --git a/src/pipe-tools/s6-mkfifodir.c b/src/pipe-tools/s6-mkfifodir.c @@ -10,7 +10,7 @@ int main (int argc, char const *const *argv) { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; gid_t gid = -1 ; int force = 0 ; PROG = "s6-mkfifodir" ; diff --git a/src/supervision/s6-notifyoncheck.c b/src/supervision/s6-notifyoncheck.c @@ -91,13 +91,13 @@ int main (int argc, char const *const *argv, char const *const *envp) int df = 0 ; int autodetect = 1 ; int p[2] ; - tain_t globaldeadline, sleeptto, localtto, waittto ; + tain globaldeadline, sleeptto, localtto, waittto ; unsigned int tries = 7 ; uint16_t id ; PROG = "s6-notifyoncheck" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int initialsleep = 10, globaltimeout = 0, localtimeout = 0, waitingtime = 1000 ; for (;;) { @@ -211,8 +211,8 @@ int main (int argc, char const *const *argv, char const *const *envp) while (tries == UINT_MAX || tries--) { - tain_t deadline = globaldeadline ; - tain_t localdeadline ; + tain deadline = globaldeadline ; + tain localdeadline ; pid_t pid ; tain_add_g(&localdeadline, &sleeptto) ; diff --git a/src/supervision/s6-permafailon.c b/src/supervision/s6-permafailon.c @@ -86,7 +86,7 @@ int main (int argc, char const *const *argv) } total = st.st_size / S6_DTALLY_PACK ; { - tain_t mintime ; + tain mintime ; unsigned int matches = 0 ; s6_dtally_t tab[total] ; ssize_t r = s6_dtally_read(".", tab, total) ; @@ -98,7 +98,7 @@ int main (int argc, char const *const *argv) if (r < n) goto cont ; tain_uint(&mintime, seconds) ; { - tain_t now ; + tain now ; tain_wallclock_read(&now) ; tain_sub(&mintime, &now, &mintime) ; } diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c @@ -55,8 +55,8 @@ enum state_e typedef void action_t (void) ; typedef action_t *action_t_ref ; -static tain_t deadline ; -static tain_t dontrespawnbefore = TAIN_EPOCH ; +static tain deadline ; +static tain dontrespawnbefore = TAIN_EPOCH ; static s6_svstatus_t status = S6_SVSTATUS_ZERO ; static state_t state = DOWN ; static int flagdying = 0 ; @@ -308,7 +308,6 @@ static void trystart (void) char const *cargv[2] = { "run", 0 } ; ((char *)PROG)[strlen(PROG)] = ' ' ; selfpipe_finish() ; - sig_restore(SIGPIPE) ; if (notifyp[0] >= 0) close(notifyp[0]) ; close(p[0]) ; if (notifyp[1] >= 0 && fd_move(notif, notifyp[1]) < 0) @@ -459,7 +458,6 @@ static int uplastup_z (void) char fmt1[UINT_FMT] ; char *cargv[4] = { "finish", fmt0, fmt1, 0 } ; selfpipe_finish() ; - sig_restore(SIGPIPE) ; fmt0[uint_fmt(fmt0, WIFSIGNALED(status.wstat) ? 256 : WEXITSTATUS(status.wstat))] = 0 ; fmt1[uint_fmt(fmt1, WTERMSIG(status.wstat))] = 0 ; setsid() ; @@ -470,7 +468,7 @@ static int uplastup_z (void) announce() ; ftrigw_notifyb_nosig(S6_SUPERVISE_EVENTDIR, "d", 1) ; { - tain_t tto ; + tain tto ; unsigned int timeout ; if (!read_uint("timeout-finish", &timeout)) timeout = 5000 ; if (timeout && tain_from_millisecs(&tto, timeout)) @@ -513,7 +511,7 @@ static void up_o (void) static void up_d (void) { - tain_t tto ; + tain tto ; unsigned int timeout ; status.flagwantup = 0 ; killr() ; @@ -781,7 +779,7 @@ int main (int argc, char const *const *argv) x[1].fd = control_init() ; x[0].fd = selfpipe_init() ; if (x[0].fd == -1) strerr_diefu1sys(111, "init selfpipe") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; @@ -790,7 +788,7 @@ int main (int argc, char const *const *argv) sigaddset(&set, SIGHUP) ; sigaddset(&set, SIGQUIT) ; sigaddset(&set, SIGINT) ; - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } if (!ftrigw_clean(S6_SUPERVISE_EVENTDIR)) diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c @@ -25,7 +25,7 @@ int main (int argc, char const *const *argv) char updown[3] = "-\0" ; PROG = "s6-svc" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "abqhkti12pcyroduxOT:w:", &l) ; diff --git a/src/supervision/s6-svdt.c b/src/supervision/s6-svdt.c @@ -18,7 +18,7 @@ int main (int argc, char const *const *argv) int num = 0 ; PROG = "s6-svdt" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "Ssn:", &l) ; diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c @@ -1,12 +1,10 @@ /* ISC license. */ #include <stdint.h> -#include <signal.h> #include <skalibs/sgetopt.h> #include <skalibs/types.h> #include <skalibs/bitarray.h> -#include <skalibs/sig.h> #include <skalibs/tai.h> #include <skalibs/strerr2.h> #include <skalibs/djbunix.h> @@ -19,14 +17,14 @@ int main (int argc, char const **argv, char const *const *envp) { - tain_t deadline, tto ; + tain deadline, tto ; int spfd ; int argc1 ; int or = 0 ; int wantup = 1, wantready = 0, wantrestart = 0 ; PROG = "s6-svlisten" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0 ; for (;;) { @@ -71,10 +69,8 @@ int main (int argc, char const **argv, char const *const *envp) unsigned char upstate[bitarray_div8(argc1)] ; unsigned char readystate[bitarray_div8(argc1)] ; s6_svlisten_init(argc1, argv, &foo, ids, upstate, readystate, &deadline) ; - sig_restore(SIGPIPE) ; pid = child_spawn0(argv[argc1 + 1], argv + argc1 + 1, envp) ; if (!pid) strerr_diefu2sys(111, "spawn ", argv[argc1 + 1]) ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; if (wantrestart) s6_svlisten_loop(&foo, 0, 1, or, &deadline, spfd, &s6_svlisten_signal_handler) ; e = s6_svlisten_loop(&foo, wantup, wantready, or, &deadline, spfd, &s6_svlisten_signal_handler) ; if (e < 0) strerr_dief1x(102, "supervisor died") ; diff --git a/src/supervision/s6-svlisten.h b/src/supervision/s6-svlisten.h @@ -7,8 +7,8 @@ #include <skalibs/tai.h> #include <s6/ftrigr.h> -typedef void action_func_t (void) ; -typedef action_func_t *action_func_t_ref ; +typedef void action_func (void) ; +typedef action_func *action_func_ref ; typedef struct s6_svlisten_s s6_svlisten_t, *s6_svlisten_t_ref ; struct s6_svlisten_s @@ -23,7 +23,7 @@ struct s6_svlisten_s extern void s6_svlisten_signal_handler (void) ; extern int s6_svlisten_selfpipe_init (void) ; -extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16_t *, unsigned char *, unsigned char *, tain_t const *) ; -extern int s6_svlisten_loop (s6_svlisten_t *, int, int, int, tain_t const *, int, action_func_t_ref) ; +extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16_t *, unsigned char *, unsigned char *, tain const *) ; +extern int s6_svlisten_loop (s6_svlisten_t *, int, int, int, tain const *, int, action_func_ref) ; #endif diff --git a/src/supervision/s6-svlisten1.c b/src/supervision/s6-svlisten1.c @@ -1,11 +1,9 @@ /* ISC license. */ #include <stdint.h> -#include <signal.h> #include <skalibs/sgetopt.h> #include <skalibs/types.h> -#include <skalibs/sig.h> #include <skalibs/tai.h> #include <skalibs/strerr2.h> #include <skalibs/djbunix.h> @@ -18,7 +16,7 @@ int main (int argc, char const *const *argv, char const *const *envp) { s6_svlisten_t foo = S6_SVLISTEN_ZERO ; - tain_t deadline, tto ; + tain deadline, tto ; pid_t pid ; int spfd ; int e ; @@ -27,7 +25,7 @@ int main (int argc, char const *const *argv, char const *const *envp) unsigned char upstate, readystate ; PROG = "s6-svlisten1" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0 ; for (;;) { @@ -53,10 +51,8 @@ int main (int argc, char const *const *argv, char const *const *envp) tain_add_g(&deadline, &tto) ; spfd = s6_svlisten_selfpipe_init() ; s6_svlisten_init(1, argv, &foo, &id, &upstate, &readystate, &deadline) ; - sig_restore(SIGPIPE) ; pid = child_spawn0(argv[1], argv + 1, envp) ; if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; if (wantrestart) s6_svlisten_loop(&foo, 0, 1, 1, &deadline, spfd, &s6_svlisten_signal_handler) ; e = s6_svlisten_loop(&foo, wantup, wantready, 1, &deadline, spfd, &s6_svlisten_signal_handler) ; if (e < 0) strerr_dief1x(102, "supervisor died") ; diff --git a/src/supervision/s6-svperms.c b/src/supervision/s6-svperms.c @@ -237,7 +237,7 @@ int main (int argc, char const *const *argv) unsigned int what = 0 ; PROG = "s6-svperms" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "vug:G:oO:eE:", &l) ; diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c @@ -42,7 +42,7 @@ struct svinfo_s { dev_t dev ; ino_t ino ; - tain_t restartafter[2] ; + tain restartafter[2] ; pid_t pid[2] ; int p[2] ; unsigned int flagactive : 1 ; @@ -52,7 +52,7 @@ struct svinfo_s static struct svinfo_s *services ; static unsigned int max = 500 ; static unsigned int n = 0 ; -static tain_t deadline, defaulttimeout ; +static tain deadline, defaulttimeout ; static int wantreap = 1 ; static int wantscan = 1 ; static unsigned int wantkill = 0 ; @@ -239,7 +239,7 @@ static void handle_control (int fd) static void reap (void) { - tain_t nextscan ; + tain nextscan ; if (!wantreap) return ; wantreap = 0 ; tain_addsec_g(&nextscan, 1) ; @@ -342,7 +342,7 @@ static void trystart (unsigned int i, char const *name, int islog) static void retrydirlater (void) { - tain_t a ; + tain a ; tain_addsec_g(&a, DIR_RETRY_TIMEOUT) ; if (tain_less(&a, &deadline)) deadline = a ; } @@ -532,7 +532,7 @@ int main (int argc, char const *const *argv) int notif = -1 ; PROG = "s6-svscan" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0 ; for (;;) { @@ -570,7 +570,7 @@ int main (int argc, char const *const *argv) x[0].fd = selfpipe_init() ; if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; @@ -589,7 +589,7 @@ int main (int argc, char const *const *argv) #ifdef SIGWINCH sigaddset(&set, SIGWINCH) ; #endif - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } if (notif >= 0) { diff --git a/src/supervision/s6-svscanctl.c b/src/supervision/s6-svscanctl.c @@ -15,7 +15,7 @@ int main (int argc, char const *const *argv) unsigned int datalen = 0 ; PROG = "s6-svscanctl" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "phratszbnNiq0678", &l) ; diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c @@ -23,14 +23,14 @@ static int normallyup ; -typedef void prfunc_t (buffer *, s6_svstatus_t const *) ; -typedef prfunc_t * prfunc_t_ref ; +typedef void pr_func (buffer *, s6_svstatus_t const *) ; +typedef pr_func * pr_func_ref ; typedef struct funcmap_s funcmap_t ; struct funcmap_s { char const *s ; - prfunc_t_ref f ; + pr_func_ref f ; } ; static void pr_up (buffer *b, s6_svstatus_t const *st) @@ -63,7 +63,7 @@ static void pr_pid (buffer *b, s6_svstatus_t const *st) else buffer_putsnoflush(b, "-1") ; } -static void pr_tain (buffer *b, tain_t const *a) +static void pr_tain (buffer *b, tain const *a) { char fmt[TIMESTAMP] ; buffer_putnoflush(b, fmt, timestamp_fmt(fmt, a)) ; @@ -79,9 +79,9 @@ static void pr_readystamp (buffer *b, s6_svstatus_t const *st) pr_tain(b, &st->readystamp) ; } -static void pr_seconds (buffer *b, tain_t const *a) +static void pr_seconds (buffer *b, tain const *a) { - tain_t d ; + tain d ; char fmt[UINT64_FMT] ; tain_sub(&d, &STAMP, a) ; buffer_putnoflush(b, fmt, uint64_fmt(fmt, tai_sec(tain_secp(&d)))) ; @@ -150,7 +150,7 @@ static funcmap_t const fmtable[] = } ; -static unsigned int parse_options (char const *arg, prfunc_t_ref *fields, unsigned int n) +static unsigned int parse_options (char const *arg, pr_func_ref *fields, unsigned int n) { while (*arg) { @@ -236,12 +236,12 @@ int main (int argc, char const *const *argv) { s6_svstatus_t status ; int flagnum = 0 ; - prfunc_t_ref fields[MAXFIELDS] ; + pr_func_ref fields[MAXFIELDS] ; unsigned int n = 0 ; PROG = "s6-svstat" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "no:uwNrpest", &l) ; diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c @@ -17,13 +17,13 @@ int main (int argc, char const *const *argv) { - tain_t deadline ; + tain deadline ; int or = 0 ; int wantup = 1, wantready = 0 ; PROG = "s6-svwait" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "UudDrRaot:", &l) ; @@ -55,7 +55,7 @@ int main (int argc, char const *const *argv) uint16_t ids[argc] ; unsigned char upstate[bitarray_div8(argc)] ; unsigned char readystate[bitarray_div8(argc)] ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; s6_svlisten_init(argc, argv, &foo, ids, upstate, readystate, &deadline) ; if (wantup == 2) { diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c @@ -11,7 +11,7 @@ #include <s6/s6-supervise.h> #include "s6-svlisten.h" -void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16_t *ids, unsigned char *upstate, unsigned char *readystate, tain_t const *deadline) +void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16_t *ids, unsigned char *upstate, unsigned char *readystate, tain const *deadline) { unsigned int i = 0 ; foo->n = (unsigned int)argc ; @@ -45,7 +45,7 @@ static inline int got (s6_svlisten_t const *foo, int wantup, int wantready, int return (bitarray_first(t, foo->n, or) < foo->n) == or ; } -int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, int or, tain_t const *deadline, int spfd, action_func_t_ref handler) +int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, int or, tain const *deadline, int spfd, action_func_ref handler) { iopause_fd x[2] = { { .fd = ftrigr_fd(&foo->a), .events = IOPAUSE_READ }, { .fd = spfd, .events = IOPAUSE_READ, .revents = 0 } } ; unsigned int e = 0 ; diff --git a/src/supervision/s6_svlisten_signal_handler.c b/src/supervision/s6_svlisten_signal_handler.c @@ -1,18 +1,20 @@ /* ISC license. */ #include <signal.h> + #include <skalibs/strerr2.h> #include <skalibs/sig.h> #include <skalibs/djbunix.h> #include <skalibs/selfpipe.h> + #include "s6-svlisten.h" int s6_svlisten_selfpipe_init (void) { int spfd = selfpipe_init() ; if (spfd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "selfpipe_trap") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!selfpipe_trap(SIGCHLD)) strerr_diefu1sys(111, "selfpipe_trap") ; + if (!sig_altignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; return spfd ; } @@ -26,4 +28,3 @@ void s6_svlisten_signal_handler (void) default : strerr_dief1x(101, "unexpected data in selfpipe") ; } } - diff --git a/src/usertree/s6-usertree-maker.c b/src/usertree/s6-usertree-maker.c @@ -228,7 +228,7 @@ int main (int argc, char *const *argv) char const *vars[VARS_MAX] ; PROG = "s6-usertree-maker" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, (char const *const *)argv, "d:p:E:e:r:l:t:n:s:S:", &l) ;