author | Olivier Brunel
<jjk@jjacky.com> 2023-11-01 10:35:34 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-12-14 20:03:50 UTC |
parent | 191a888aff86bd61ea79cc72844d7ede63ce3735 |
configure | +0 | -4 |
meta/desc | +1 | -0 |
src/anopa/aa-enable.c | +1 | -1 |
src/anopa/aa-status.c | +9 | -9 |
src/anopa/aa-stop.c | +1 | -1 |
src/anopa/start-stop.c | +6 | -6 |
src/anopa/start-stop.h | +2 | -2 |
src/include/anopa/service.h | +1 | -1 |
src/include/anopa/service_status.h | +1 | -1 |
src/libanopa/exec_longrun.c | +3 | -3 |
src/libanopa/output.c | +1 | -1 |
src/libanopa/service.c | +3 | -3 |
src/utils/aa-chroot.c | +2 | -2 |
src/utils/aa-ctty.c | +2 | -2 |
src/utils/aa-service.c | +2 | -1 |
src/utils/aa-setready.c | +1 | -1 |
diff --git a/configure b/configure index d8d62e8..7a841a0 100755 --- a/configure +++ b/configure @@ -278,10 +278,8 @@ if [ "x$target" != "x$(cat $sysdeps/target)" ] ; then exit 1 fi -rt_lib=$(cat $sysdeps/rt.lib) socket_lib=$(cat $sysdeps/socket.lib) sysclock_lib=$(cat $sysdeps/sysclock.lib) -tainnow_lib=$(cat $sysdeps/tainnow.lib) util_lib=$(cat $sysdeps/util.lib) tryflag CFLAGS_AUTO -std=c99 @@ -341,10 +339,8 @@ sproot := $sproot version := $version home := $home exthome := $exthome -RT_LIB := ${rt_lib} SOCKET_LIB := ${socket_lib} SYSCLOCK_LIB := ${sysclock_lib} -TAINNOW_LIB := ${tainnow_lib} UTIL_LIB := ${util_lib} CC := $CC_AUTO diff --git a/meta/desc b/meta/desc new file mode 100644 index 0000000..c2782ef --- /dev/null +++ b/meta/desc @@ -0,0 +1 @@ +init system/service manager build around s6 supervision suite diff --git a/src/anopa/aa-enable.c b/src/anopa/aa-enable.c index 517fb85..c16875a 100644 --- a/src/anopa/aa-enable.c +++ b/src/anopa/aa-enable.c @@ -39,7 +39,7 @@ #include <skalibs/direntry.h> #include <skalibs/types.h> #include <skalibs/skamisc.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <anopa/common.h> #include <anopa/output.h> #include <anopa/get_repodir.h> diff --git a/src/anopa/aa-status.c b/src/anopa/aa-status.c index d6bdfff..a76e87a 100644 --- a/src/anopa/aa-status.c +++ b/src/anopa/aa-status.c @@ -42,7 +42,7 @@ #include <skalibs/djbtime.h> #include <skalibs/tai.h> #include <skalibs/sig.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <anopa/common.h> #include <anopa/output.h> #include <anopa/get_repodir.h> @@ -73,7 +73,7 @@ struct serv int si; int is_s6; s6_svstatus_t st6; - tain_t stamp; + tain stamp; }; enum @@ -129,11 +129,11 @@ put_wstat (int wstat, size_t max, int pad) } static void -put_time (tain_t *st_stamp, int strict) +put_time (tain *st_stamp, int strict) { char buf[LOCALTMN_FMT]; - localtmn_t local; - tain_t stamp; + localtmn local; + tain stamp; int n; localtmn_from_tain (&local, st_stamp, 1); @@ -401,7 +401,7 @@ status_service (struct serv *serv, struct config *cfg) put_s (" (PID "); buf[uint_fmt (buf, serv->st6.pid)] = '\0'; put_s (buf); - if (cfg->mode == MODE_LIST && !serv->st6.flagwant) + if (cfg->mode == MODE_LIST && !serv->st6.flagwantup) { put_s ("; Once"); } @@ -410,7 +410,7 @@ status_service (struct serv *serv, struct config *cfg) if (cfg->mode != MODE_LIST) { aa_bs (AA_OUT, "\nMode: "); - if (serv->st6.flagwant) + if (serv->st6.flagwantup) { put_s ("Automatic restart (want up)"); } @@ -431,7 +431,7 @@ status_service (struct serv *serv, struct config *cfg) aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); put_s (" ("); put_wstat (serv->st6.wstat, max, 0); - if (serv->st6.flagwant && serv->st6.flagwantup) + if (serv->st6.flagwantup) { put_s ("; "); aa_is (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); @@ -446,7 +446,7 @@ status_service (struct serv *serv, struct config *cfg) * given that one cannot start a service w/out specifying the mode * to be set (-u for up, -o for once)) */ - if (cfg->mode != MODE_LIST && serv->st6.flagwant && serv->st6.flagwantup) + if (cfg->mode != MODE_LIST && serv->st6.flagwantup) { aa_bs (AA_OUT, "\nMode: "); put_s ("Automatic restart (want up)"); diff --git a/src/anopa/aa-stop.c b/src/anopa/aa-stop.c index d96ff8a..27070a6 100644 --- a/src/anopa/aa-stop.c +++ b/src/anopa/aa-stop.c @@ -36,7 +36,7 @@ #include <skalibs/types.h> #include <skalibs/tai.h> #include <skalibs/djbunix.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <anopa/common.h> #include <anopa/err.h> #include <anopa/get_repodir.h> diff --git a/src/anopa/start-stop.c b/src/anopa/start-stop.c index 691dd1b..444269b 100644 --- a/src/anopa/start-stop.c +++ b/src/anopa/start-stop.c @@ -46,7 +46,7 @@ genalloc ga_iop = GENALLOC_ZERO; genalloc ga_progress = GENALLOC_ZERO; genalloc ga_pid = GENALLOC_ZERO; -tain_t iol_deadline; +tain iol_deadline; unsigned int draw = 0; int nb_already = 0; int nb_done = 0; @@ -159,7 +159,7 @@ draw_waiting (int already_drawn) char buf[UINT_FMT]; int nb; int si; - tain_t ts; + tain ts; int secs; if (already_drawn) @@ -1107,9 +1107,9 @@ process_timeouts (aa_mode mode, aa_scan_cb scan_cb) int si; size_t l; size_t i; - tain_t ts_timeout; - tain_t ts; - tain_t tms; + tain ts_timeout; + tain ts; + tain tms; int ms = -1; int scan = 0; @@ -1292,7 +1292,7 @@ mainloop (aa_mode mode, aa_scan_cb scan_cb) int nb_iop; int r; int ms1, ms2; - tain_t tms; + tain tms; if (mode & AA_MODE_IS_DRY) { diff --git a/src/anopa/start-stop.h b/src/anopa/start-stop.h index c6cf235..674c4b8 100644 --- a/src/anopa/start-stop.h +++ b/src/anopa/start-stop.h @@ -42,7 +42,7 @@ extern genalloc ga_iop; extern genalloc ga_progress; extern genalloc ga_pid; -extern tain_t iol_deadline; +extern tain iol_deadline; extern unsigned int draw; extern int nb_already; extern int nb_done; @@ -99,7 +99,7 @@ int handle_fd_out (int si); int handle_fd_progress (int si); int handle_fd_in (void); int handle_fd (int fd); -int handle_longrun (aa_mode mode, uint16 id, char event); +int handle_longrun (aa_mode mode, uint16_t id, char event); int is_locale_utf8 (void); int get_cols (int fd); int handle_signals (aa_mode mode); diff --git a/src/include/anopa/service.h b/src/include/anopa/service.h index 7584ecb..733a988 100644 --- a/src/include/anopa/service.h +++ b/src/include/anopa/service.h @@ -85,7 +85,7 @@ typedef struct unsigned int secs_timeout; aa_ls ls; aa_service_status st; - tain_t ts_exec; + tain ts_exec; uint16_t retries; /* longrun */ uint16_t ft_id; diff --git a/src/include/anopa/service_status.h b/src/include/anopa/service_status.h index 78d3675..87c84aa 100644 --- a/src/include/anopa/service_status.h +++ b/src/include/anopa/service_status.h @@ -52,7 +52,7 @@ enum typedef struct { - tain_t stamp; + tain stamp; aa_evt event; int code; stralloc sa; diff --git a/src/libanopa/exec_longrun.c b/src/libanopa/exec_longrun.c index 6e287d2..39326c8 100644 --- a/src/libanopa/exec_longrun.c +++ b/src/libanopa/exec_longrun.c @@ -26,7 +26,7 @@ #include <skalibs/djbunix.h> #include <skalibs/bytestr.h> #include <skalibs/tai.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <s6/ftrigr.h> #include <anopa/service.h> #include <anopa/err.h> @@ -40,7 +40,7 @@ _exec_longrun (int si, aa_mode mode) s6_svstatus_t st6 = S6_SVSTATUS_ZERO; size_t l_sn = strlen (aa_service_name (s)); char fifodir[l_sn + 1 + sizeof (S6_SUPERVISE_EVENTDIR)]; - tain_t deadline; + tain deadline; int is_start = (mode & AA_MODE_START) ? 1 : 0; const char *event = (is_start) ? ((s->gets_ready) ? "[udU]" : "u") : "D"; const char *cmd = (is_start) ? "u" : (mode & AA_MODE_STOP_ALL) ? "dx" : "d"; @@ -248,7 +248,7 @@ aa_get_longrun_info (uint16_t *id, char *event) int aa_unsubscribe_for (uint16_t id) { - tain_t deadline; + tain deadline; tain_addsec_g (&deadline, 1); return (ftrigr_unsubscribe_g (&_aa_ft, id, &deadline)) ? 0 : -1; diff --git a/src/libanopa/output.c b/src/libanopa/output.c index ea9050a..3eea717 100644 --- a/src/libanopa/output.c +++ b/src/libanopa/output.c @@ -33,7 +33,7 @@ static int istty[2] = { -1, 0 }; static int double_output = 0; static char buf_log[BUFFER_OUTSIZE]; -static buffer_t buffer_log = BUFFER_ZERO; +static buffer buffer_log = BUFFER_ZERO; #define is_tty(n) (istty[0] > -1 || chk_tty ()) && istty[n] diff --git a/src/libanopa/service.c b/src/libanopa/service.c index 235c835..72f0e7d 100644 --- a/src/libanopa/service.c +++ b/src/libanopa/service.c @@ -30,7 +30,7 @@ #include <skalibs/direntry.h> #include <skalibs/types.h> #include <skalibs/tai.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <s6/ftrigr.h> #include <anopa/service.h> #include <anopa/ga_int_list.h> @@ -258,7 +258,7 @@ aa_ensure_service_loaded (int si, aa_mode mode, int no_wants, aa_autoload_cb al_ if (is_up && aa_service (si)->gets_ready && st6.flagready) is_up = 2; else if ((mode & (AA_MODE_STOP | AA_MODE_STOP_ALL)) - && !is_up && st6.flagwant && st6.flagwantup) + && !is_up && st6.flagwantup) /* it is down, but to be restarted soon by s6-supervise; so * for our intent & purposes, it shall be considered up, so * that we stop the restart and place the down file. @@ -583,7 +583,7 @@ aa_prepare_mainlist (aa_prepare_cb prepare_cb, aa_exec_cb exec_cb) if (has_longrun) { - tain_t deadline; + tain deadline; tain_addsec_g (&deadline, 1); if (!ftrigr_startf_g (&_aa_ft, &deadline)) diff --git a/src/utils/aa-chroot.c b/src/utils/aa-chroot.c index 9d45e2e..4bab0f1 100644 --- a/src/utils/aa-chroot.c +++ b/src/utils/aa-chroot.c @@ -24,7 +24,7 @@ #include <getopt.h> #include <unistd.h> -#include <skalibs/djbunix.h> +#include <skalibs/exec.h> #include <anopa/common.h> #include <anopa/output.h> @@ -90,6 +90,6 @@ main (int argc, char * const argv[], char * const envp[]) aa_strerr_diefu1sys (RC_FATAL_IO, "chroot"); if (chdir ("/") < 0) aa_strerr_diefu1sys (RC_FATAL_IO, "chdir to new root"); - pathexec_run (argv[1], (char const * const *) argv + 1, (char const * const *) envp); + exec_ae (argv[1], (char const * const *) argv + 1, (char const * const *) envp); aa_strerr_dieexec (RC_FATAL_EXEC, argv[1]); } diff --git a/src/utils/aa-ctty.c b/src/utils/aa-ctty.c index 83b4517..ebba572 100644 --- a/src/utils/aa-ctty.c +++ b/src/utils/aa-ctty.c @@ -23,8 +23,8 @@ #include <getopt.h> #include <termios.h> #include <sys/ioctl.h> +#include <skalibs/exec.h> #include <skalibs/types.h> -#include <skalibs/djbunix.h> #include <anopa/common.h> #include <anopa/output.h> @@ -102,6 +102,6 @@ main (int argc, char * const argv[], char const * const *envp) if (ioctl (fd, TIOCSCTTY, steal) < 0) aa_strerr_warnu1sys ("set controlling terminal"); - pathexec_run (argv[0], (char const * const *) argv, envp); + exec_ae (argv[0], (char const * const *) argv, envp); aa_strerr_dieexec (RC_FATAL_EXEC, argv[0]); } diff --git a/src/utils/aa-service.c b/src/utils/aa-service.c index 2940732..6dc9509 100644 --- a/src/utils/aa-service.c +++ b/src/utils/aa-service.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <skalibs/djbunix.h> #include <skalibs/env.h> +#include <skalibs/exec.h> #include <skalibs/bytestr.h> #include <skalibs/sgetopt.h> #include <skalibs/genalloc.h> @@ -262,7 +263,7 @@ main (int argc, char const **argv, char const *const *envp) if (!env_make (v, r, dst.s, dst.len)) aa_strerr_diefu1sys (RC_ST_FAIL, "env_make"); v[r] = 0; - pathexec_r (v, envp, env_len (envp), info.modifs.s, info.modifs.len); + mexec_fm (v, envp, env_len (envp), info.modifs.s, info.modifs.len); } aa_strerr_dieexec (RC_FATAL_EXEC, dst.s); diff --git a/src/utils/aa-setready.c b/src/utils/aa-setready.c index be44ba8..d63055f 100644 --- a/src/utils/aa-setready.c +++ b/src/utils/aa-setready.c @@ -26,7 +26,7 @@ #include <skalibs/djbunix.h> #include <skalibs/bytestr.h> #include <s6/ftrigw.h> -#include <s6/s6-supervise.h> +#include <s6/supervise.h> #include <anopa/common.h> #include <anopa/output.h>