summaryrefslogtreecommitdiff
path: root/src/supervision
diff options
context:
space:
mode:
Diffstat (limited to 'src/supervision')
-rw-r--r--src/supervision/s6-notifyoncheck.c8
-rw-r--r--src/supervision/s6-permafailon.c4
-rw-r--r--src/supervision/s6-supervise.c14
-rw-r--r--src/supervision/s6-svc.c2
-rw-r--r--src/supervision/s6-svdt.c2
-rw-r--r--src/supervision/s6-svlisten.c8
-rw-r--r--src/supervision/s6-svlisten.h8
-rw-r--r--src/supervision/s6-svlisten1.c8
-rw-r--r--src/supervision/s6-svperms.c2
-rw-r--r--src/supervision/s6-svscan.c14
-rw-r--r--src/supervision/s6-svscanctl.c2
-rw-r--r--src/supervision/s6-svstat.c18
-rw-r--r--src/supervision/s6-svwait.c6
-rw-r--r--src/supervision/s6_svlisten_loop.c4
-rw-r--r--src/supervision/s6_svlisten_signal_handler.c7
15 files changed, 49 insertions, 58 deletions
diff --git a/src/supervision/s6-notifyoncheck.c b/src/supervision/s6-notifyoncheck.c
index a1ec7ff..a4d0ab1 100644
--- 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
index 3912691..b5bb469 100644
--- 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
index 1bde604..84290ab 100644
--- 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
index a189d24..30a6fb3 100644
--- 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
index b204934..ab0dfc8 100644
--- 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
index 1a25c54..5b9329d 100644
--- 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
index 8f01907..674ed2f 100644
--- 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
index b0d5dd8..7ba6eac 100644
--- 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
index 178ea08..fb35715 100644
--- 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
index 7ef3d41..da2dc30 100644
--- 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
index 0d7a65d..b21c611 100644
--- 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
index 7c93138..cbda314 100644
--- 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
index 512ae77..35788b6 100644
--- 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
index 8c6500c..8eee96b 100644
--- 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
index bfb72bd..b846c05 100644
--- 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") ;
}
}
-