summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fdholder/s6-fdholder-delete.c2
-rw-r--r--src/fdholder/s6-fdholder-getdump.c2
-rw-r--r--src/fdholder/s6-fdholder-list.c2
-rw-r--r--src/fdholder/s6-fdholder-retrieve.c2
-rw-r--r--src/fdholder/s6-fdholder-setdump.c2
-rw-r--r--src/fdholder/s6-fdholder-store.c2
-rw-r--r--src/fdholder/s6-fdholder-transferdump.c2
-rw-r--r--src/fdholder/s6-fdholderd.c2
-rw-r--r--src/include/s6/fdholder.h (renamed from src/include/s6/s6-fdholder.h)0
-rw-r--r--src/include/s6/lock.h (renamed from src/include/s6/s6lock.h)6
-rw-r--r--src/include/s6/s6.h4
-rw-r--r--src/include/s6/supervise.h (renamed from src/include/s6/s6-supervise.h)6
-rw-r--r--src/libs6/deps-lib/s61
-rw-r--r--src/libs6/s6_dtally_pack.c2
-rw-r--r--src/libs6/s6_dtally_read.c2
-rw-r--r--src/libs6/s6_dtally_unpack.c2
-rw-r--r--src/libs6/s6_dtally_write.c2
-rw-r--r--src/libs6/s6_fdholder_delete.c2
-rw-r--r--src/libs6/s6_fdholder_delete_async.c2
-rw-r--r--src/libs6/s6_fdholder_end.c2
-rw-r--r--src/libs6/s6_fdholder_getdump.c2
-rw-r--r--src/libs6/s6_fdholder_list.c2
-rw-r--r--src/libs6/s6_fdholder_list_async.c2
-rw-r--r--src/libs6/s6_fdholder_list_cb.c2
-rw-r--r--src/libs6/s6_fdholder_retrieve.c2
-rw-r--r--src/libs6/s6_fdholder_retrieve_async.c2
-rw-r--r--src/libs6/s6_fdholder_retrieve_cb.c2
-rw-r--r--src/libs6/s6_fdholder_setdump.c2
-rw-r--r--src/libs6/s6_fdholder_start.c2
-rw-r--r--src/libs6/s6_fdholder_store.c2
-rw-r--r--src/libs6/s6_fdholder_store_async.c2
-rw-r--r--src/libs6/s6_supervise_link.c2
-rw-r--r--src/libs6/s6_supervise_link_names.c22
-rw-r--r--src/libs6/s6_supervise_unlink.c2
-rw-r--r--src/libs6/s6_supervise_unlink_names.c98
-rw-r--r--src/libs6/s6_svc_ok.c2
-rw-r--r--src/libs6/s6_svc_write.c2
-rw-r--r--src/libs6/s6_svc_writectl.c2
-rw-r--r--src/libs6/s6_svstatus_pack.c8
-rw-r--r--src/libs6/s6_svstatus_read.c2
-rw-r--r--src/libs6/s6_svstatus_unpack.c8
-rw-r--r--src/libs6/s6_svstatus_write.c2
-rw-r--r--src/libs6/s6lock_acquire.c2
-rw-r--r--src/libs6/s6lock_check.c2
-rw-r--r--src/libs6/s6lock_end.c2
-rw-r--r--src/libs6/s6lock_release.c2
-rw-r--r--src/libs6/s6lock_start.c2
-rw-r--r--src/libs6/s6lock_startf.c2
-rw-r--r--src/libs6/s6lock_update.c2
-rw-r--r--src/libs6/s6lock_wait_and.c2
-rw-r--r--src/libs6/s6lock_wait_or.c2
-rw-r--r--src/libs6/s6lock_zero.c2
-rw-r--r--src/libs6/s6lockd.c2
-rw-r--r--src/supervision/deps-exe/s6-svdir-unlink2
-rw-r--r--src/supervision/deps-exe/s6-svlink (renamed from src/supervision/deps-exe/s6-svdir-link)0
-rw-r--r--src/supervision/deps-exe/s6-svunlink5
-rw-r--r--src/supervision/s6-permafailon.c2
-rw-r--r--src/supervision/s6-supervise.c3
-rw-r--r--src/supervision/s6-svc.c2
-rw-r--r--src/supervision/s6-svdir-unlink.c38
-rw-r--r--src/supervision/s6-svdt-clear.c2
-rw-r--r--src/supervision/s6-svdt.c2
-rw-r--r--src/supervision/s6-svlink.c (renamed from src/supervision/s6-svdir-link.c)34
-rw-r--r--src/supervision/s6-svok.c2
-rw-r--r--src/supervision/s6-svperms.c2
-rw-r--r--src/supervision/s6-svscan.c2
-rw-r--r--src/supervision/s6-svscanctl.c2
-rw-r--r--src/supervision/s6-svstat.c6
-rw-r--r--src/supervision/s6-svunlink.c49
-rw-r--r--src/supervision/s6_svlisten_loop.c2
70 files changed, 266 insertions, 130 deletions
diff --git a/src/fdholder/s6-fdholder-delete.c b/src/fdholder/s6-fdholder-delete.c
index 8d11b1e..ac0c9e7 100644
--- a/src/fdholder/s6-fdholder-delete.c
+++ b/src/fdholder/s6-fdholder-delete.c
@@ -4,7 +4,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-delete [ -t timeout ] socket id"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-getdump.c b/src/fdholder/s6-fdholder-getdump.c
index 789f478..69781c3 100644
--- a/src/fdholder/s6-fdholder-getdump.c
+++ b/src/fdholder/s6-fdholder-getdump.c
@@ -11,7 +11,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/exec.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-getdump [ -t timeout ] socket prog..."
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-list.c b/src/fdholder/s6-fdholder-list.c
index 930b50f..4f16af3 100644
--- a/src/fdholder/s6-fdholder-list.c
+++ b/src/fdholder/s6-fdholder-list.c
@@ -8,7 +8,7 @@
#include <skalibs/tai.h>
#include <skalibs/stralloc.h>
#include <skalibs/skamisc.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-list [ -t timeout ] socket"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-retrieve.c b/src/fdholder/s6-fdholder-retrieve.c
index d4206c9..0e8d224 100644
--- a/src/fdholder/s6-fdholder-retrieve.c
+++ b/src/fdholder/s6-fdholder-retrieve.c
@@ -7,7 +7,7 @@
#include <skalibs/djbunix.h>
#include <skalibs/exec.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-retrieve [ -D ] [ -t timeout ] socket id prog..."
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-setdump.c b/src/fdholder/s6-fdholder-setdump.c
index 4a85291..1d36aba 100644
--- a/src/fdholder/s6-fdholder-setdump.c
+++ b/src/fdholder/s6-fdholder-setdump.c
@@ -6,7 +6,7 @@
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-setdump [ -t timeout ] socket"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-store.c b/src/fdholder/s6-fdholder-store.c
index 84aef3c..ff53034 100644
--- a/src/fdholder/s6-fdholder-store.c
+++ b/src/fdholder/s6-fdholder-store.c
@@ -4,7 +4,7 @@
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-store [ -d fd ] [ -t timeout ] [ -T fdtimeout ] socket id"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholder-transferdump.c b/src/fdholder/s6-fdholder-transferdump.c
index 035d103..3fa4790 100644
--- a/src/fdholder/s6-fdholder-transferdump.c
+++ b/src/fdholder/s6-fdholder-transferdump.c
@@ -5,7 +5,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
#include <skalibs/genalloc.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#define USAGE "s6-fdholder-transferdump [ -t timeoutfrom:timeoutto ] socketfrom socketto"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c
index 87124e5..483c20a 100644
--- a/src/fdholder/s6-fdholderd.c
+++ b/src/fdholder/s6-fdholderd.c
@@ -32,7 +32,7 @@
#include <skalibs/unixconnection.h>
#include <s6/accessrules.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/include/s6/s6-fdholder.h b/src/include/s6/fdholder.h
index 62b9ab7..62b9ab7 100644
--- a/src/include/s6/s6-fdholder.h
+++ b/src/include/s6/fdholder.h
diff --git a/src/include/s6/s6lock.h b/src/include/s6/lock.h
index b1848c7..e87e001 100644
--- a/src/include/s6/s6lock.h
+++ b/src/include/s6/lock.h
@@ -1,13 +1,15 @@
/* ISC license. */
-#ifndef S6LOCK_H
-#define S6LOCK_H
+#ifndef S6_LOCK_H
+#define S6_LOCK_H
#include <stdint.h>
+
#include <skalibs/tai.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
+
#include <s6/config.h>
diff --git a/src/include/s6/s6.h b/src/include/s6/s6.h
index aabcc13..5b32a86 100644
--- a/src/include/s6/s6.h
+++ b/src/include/s6/s6.h
@@ -4,10 +4,10 @@
#define S6_H
#include <s6/compat.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#include <s6/ftrigr.h>
#include <s6/ftrigw.h>
#include <s6/accessrules.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
#endif
diff --git a/src/include/s6/s6-supervise.h b/src/include/s6/supervise.h
index c0dc1b6..914bff3 100644
--- a/src/include/s6/s6-supervise.h
+++ b/src/include/s6/supervise.h
@@ -30,10 +30,8 @@ struct s6_svstatus_s
int wstat ;
unsigned int flagpaused : 1 ;
unsigned int flagfinishing : 1 ;
- unsigned int flagwant : 1 ; /* unused */
unsigned int flagwantup : 1 ;
unsigned int flagready : 1 ;
- unsigned int flagthrottled : 1 ;
} ;
#define S6_SVSTATUS_ZERO \
@@ -44,10 +42,8 @@ struct s6_svstatus_s
.wstat = 0, \
.flagpaused = 0, \
.flagfinishing = 0, \
- .flagwant = 1, \
.flagwantup = 1, \
.flagready = 1, \
- .flagthrottled = 0 \
}
extern void s6_svstatus_pack (char *, s6_svstatus_t const *) ;
@@ -60,6 +56,8 @@ extern int s6_supervise_link (char const *, char const *const *, size_t, char co
extern int s6_supervise_link_names (char const *, char const *const *, char const *const *, size_t, uint32_t, tain const *, tain *) ;
#define s6_supervise_link_names_g(scdir, servicedirs, names, n, options, deadline) s6_supervise_link_names(scdir, servicedirs, names, n, options, (deadline), &STAMP)
extern void s6_supervise_unlink (char const *, char const *, uint32_t) ;
+extern int s6_supervise_unlink_names (char const *, char const *const *, size_t, uint32_t, tain const *, tain *) ;
+#define s6_supervise_unlink_names_g(scdir, names, n, options, deadline) s6_supervise_unlink_names(scdir, names, n, options, (deadline), &STAMP)
typedef struct s6_dtally_s s6_dtally_t, *s6_dtally_ref ;
struct s6_dtally_s
diff --git a/src/libs6/deps-lib/s6 b/src/libs6/deps-lib/s6
index 94eab87..17b6dc4 100644
--- a/src/libs6/deps-lib/s6
+++ b/src/libs6/deps-lib/s6
@@ -65,4 +65,5 @@ s6_fdholder_store_async.o
s6_supervise_link.o
s6_supervise_link_names.o
s6_supervise_unlink.o
+s6_supervise_unlink_names.o
-lskarnet
diff --git a/src/libs6/s6_dtally_pack.c b/src/libs6/s6_dtally_pack.c
index 1608e78..47c26f4 100644
--- a/src/libs6/s6_dtally_pack.c
+++ b/src/libs6/s6_dtally_pack.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/tai.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
void s6_dtally_pack (char *pack, s6_dtally_t const *d)
{
diff --git a/src/libs6/s6_dtally_read.c b/src/libs6/s6_dtally_read.c
index 3906b93..a1623cc 100644
--- a/src/libs6/s6_dtally_read.c
+++ b/src/libs6/s6_dtally_read.c
@@ -7,7 +7,7 @@
#include <skalibs/allreadwrite.h>
#include <skalibs/tai.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
static int truncit (char const *s)
{
diff --git a/src/libs6/s6_dtally_unpack.c b/src/libs6/s6_dtally_unpack.c
index 8fca787..a82e5c3 100644
--- a/src/libs6/s6_dtally_unpack.c
+++ b/src/libs6/s6_dtally_unpack.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/tai.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
void s6_dtally_unpack (char const *pack, s6_dtally_t *d)
{
diff --git a/src/libs6/s6_dtally_write.c b/src/libs6/s6_dtally_write.c
index 785376a..766b66c 100644
--- a/src/libs6/s6_dtally_write.c
+++ b/src/libs6/s6_dtally_write.c
@@ -2,7 +2,7 @@
#include <string.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_dtally_write (char const *sv, s6_dtally_t const *tab, size_t n)
{
diff --git a/src/libs6/s6_fdholder_delete.c b/src/libs6/s6_fdholder_delete.c
index 6f506dd..585722d 100644
--- a/src/libs6/s6_fdholder_delete.c
+++ b/src/libs6/s6_fdholder_delete.c
@@ -6,7 +6,7 @@
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_delete_async.c b/src/libs6/s6_fdholder_delete_async.c
index 2b14f47..50dc6f8 100644
--- a/src/libs6/s6_fdholder_delete_async.c
+++ b/src/libs6/s6_fdholder_delete_async.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <errno.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_delete_async (s6_fdholder_t *a, char const *id)
{
diff --git a/src/libs6/s6_fdholder_end.c b/src/libs6/s6_fdholder_end.c
index 7b2cb2d..dd8c312 100644
--- a/src/libs6/s6_fdholder_end.c
+++ b/src/libs6/s6_fdholder_end.c
@@ -2,7 +2,7 @@
#include <skalibs/djbunix.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
void s6_fdholder_end (s6_fdholder_t *a)
{
diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c
index 630ddc5..b24ed02 100644
--- a/src/libs6/s6_fdholder_getdump.c
+++ b/src/libs6/s6_fdholder_getdump.c
@@ -11,7 +11,7 @@
#include <skalibs/djbunix.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_list.c b/src/libs6/s6_fdholder_list.c
index 312fc28..10d1f2c 100644
--- a/src/libs6/s6_fdholder_list.c
+++ b/src/libs6/s6_fdholder_list.c
@@ -5,7 +5,7 @@
#include <skalibs/error.h>
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_list (s6_fdholder_t *a, stralloc *sa, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6_fdholder_list_async.c b/src/libs6/s6_fdholder_list_async.c
index e7e8810..167a6f9 100644
--- a/src/libs6/s6_fdholder_list_async.c
+++ b/src/libs6/s6_fdholder_list_async.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_list_async (s6_fdholder_t *a)
{
diff --git a/src/libs6/s6_fdholder_list_cb.c b/src/libs6/s6_fdholder_list_cb.c
index 0be71c9..f1b8895 100644
--- a/src/libs6/s6_fdholder_list_cb.c
+++ b/src/libs6/s6_fdholder_list_cb.c
@@ -7,7 +7,7 @@
#include <skalibs/bytestr.h>
#include <skalibs/stralloc.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_retrieve.c b/src/libs6/s6_fdholder_retrieve.c
index 7af8eb4..6f56283 100644
--- a/src/libs6/s6_fdholder_retrieve.c
+++ b/src/libs6/s6_fdholder_retrieve.c
@@ -4,7 +4,7 @@
#include <skalibs/allreadwrite.h>
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *a, char const *id, int dodelete, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6_fdholder_retrieve_async.c b/src/libs6/s6_fdholder_retrieve_async.c
index ce190b8..da41aad 100644
--- a/src/libs6/s6_fdholder_retrieve_async.c
+++ b/src/libs6/s6_fdholder_retrieve_async.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <errno.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *a, char const *id, int dodelete)
{
diff --git a/src/libs6/s6_fdholder_retrieve_cb.c b/src/libs6/s6_fdholder_retrieve_cb.c
index e8ad7ee..39eca50 100644
--- a/src/libs6/s6_fdholder_retrieve_cb.c
+++ b/src/libs6/s6_fdholder_retrieve_cb.c
@@ -4,7 +4,7 @@
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c
index 8c5ae6e..9c88f6b 100644
--- a/src/libs6/s6_fdholder_setdump.c
+++ b/src/libs6/s6_fdholder_setdump.c
@@ -12,7 +12,7 @@
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_start.c b/src/libs6/s6_fdholder_start.c
index 7e3ddda..db1046a 100644
--- a/src/libs6/s6_fdholder_start.c
+++ b/src/libs6/s6_fdholder_start.c
@@ -3,7 +3,7 @@
#include <skalibs/djbunix.h>
#include <skalibs/socket.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6_fdholder_store.c b/src/libs6/s6_fdholder_store.c
index 1541905..d765df4 100644
--- a/src/libs6/s6_fdholder_store.c
+++ b/src/libs6/s6_fdholder_store.c
@@ -6,7 +6,7 @@
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6_fdholder_store_async.c b/src/libs6/s6_fdholder_store_async.c
index 541f41c..d8577ae 100644
--- a/src/libs6/s6_fdholder_store_async.c
+++ b/src/libs6/s6_fdholder_store_async.c
@@ -5,7 +5,7 @@
#include <errno.h>
#include <skalibs/tai.h>
#include <skalibs/unixmessage.h>
-#include <s6/s6-fdholder.h>
+#include <s6/fdholder.h>
int s6_fdholder_store_async (s6_fdholder_t *a, int fd, char const *id, tain const *limit)
{
diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c
index 0c6852c..85534be 100644
--- a/src/libs6/s6_supervise_link.c
+++ b/src/libs6/s6_supervise_link.c
@@ -5,7 +5,7 @@
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
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)
{
diff --git a/src/libs6/s6_supervise_link_names.c b/src/libs6/s6_supervise_link_names.c
index 74392b9..71fff1d 100644
--- a/src/libs6/s6_supervise_link_names.c
+++ b/src/libs6/s6_supervise_link_names.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <sys/stat.h>
+#include <skalibs/posixplz.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
#include <skalibs/stralloc.h>
@@ -13,7 +14,7 @@
#include <s6/ftrigr.h>
#include <s6/ftrigw.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
static inline void do_unlink (char const *scdir, char const *const *names, size_t n, uint32_t killopts)
{
@@ -36,6 +37,13 @@ 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) ;
}
+/*
+ options: bit 0: force event/ mode
+ bit 1: make event/ public
+ bit 2: don't start the service
+ bit 3: remove down files after starting supervisors
+*/
+
int s6_supervise_link_names (char const *scdir, char const *const *servicedirs, char const *const *names, size_t n, uint32_t options, tain const *deadline, tain *stamp)
{
size_t maxnlen = 0, maxlen = 0 ;
@@ -86,7 +94,7 @@ int s6_supervise_link_names (char const *scdir, char const *const *servicedirs,
uint32_t killopts = 0 ;
int r ;
uint16_t ids[ntotal] ;
- char lname[scdirlen + maxnlen + 2] ;
+ char lname[scdirlen + maxnlen + 7] ;
char fn[maxlen + 5 + (sizeof(S6_SUPERVISE_EVENTDIR) > 5 ? sizeof(S6_SUPERVISE_EVENTDIR) : 5)] ;
if (!ftrigr_startf(&a, deadline, stamp)) return -1 ;
memcpy(lname, scdir, scdirlen) ;
@@ -124,6 +132,16 @@ int s6_supervise_link_names (char const *scdir, char const *const *servicedirs,
killopts = 3 ;
if (ftrigr_wait_and(&a, ids, m, deadline, stamp) < 0) goto errsa ;
ftrigr_end(&a) ;
+ if (options & 8)
+ {
+ for (size_t i = 0 ; i < n ; i++)
+ {
+ size_t nlen = strlen(names[i]) ;
+ memcpy(lname + scdirlen + 1, names[i], nlen) ;
+ memcpy(lname + scdirlen + 1 + nlen, "/down", 6) ;
+ unlink_void(lname) ;
+ }
+ }
return m ;
err:
diff --git a/src/libs6/s6_supervise_unlink.c b/src/libs6/s6_supervise_unlink.c
index cc263e4..f981a74 100644
--- a/src/libs6/s6_supervise_unlink.c
+++ b/src/libs6/s6_supervise_unlink.c
@@ -9,7 +9,7 @@
#include <skalibs/allreadwrite.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
void s6_supervise_unlink (char const *scdir, char const *name, uint32_t options)
{
diff --git a/src/libs6/s6_supervise_unlink_names.c b/src/libs6/s6_supervise_unlink_names.c
new file mode 100644
index 0000000..a0b424d
--- /dev/null
+++ b/src/libs6/s6_supervise_unlink_names.c
@@ -0,0 +1,98 @@
+/* ISC license. */
+
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include <skalibs/posixplz.h>
+#include <skalibs/bitarray.h>
+
+#include <s6/ftrigr.h>
+#include <s6/supervise.h>
+
+static uint16_t registerit (ftrigr_t *a, char *fn, size_t len, tain const *deadline, tain *stamp)
+{
+ memcpy(fn + len, "/" S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR) + 1) ;
+ return ftrigr_subscribe(a, fn, "x", 0, deadline, stamp) ;
+}
+
+/*
+ options: bit 0: wait for s6-supervise to exit
+*/
+
+int s6_supervise_unlink_names (char const *scdir, char const *const *names, size_t n, uint32_t options, tain const *deadline, tain *stamp)
+{
+ size_t scdirlen = strlen(scdir) ;
+ size_t ntotal = n ;
+ unsigned char locked[bitarray_div8(n)] ;
+ unsigned char logged[bitarray_div8(n)] ;
+ if (!n) return 0 ;
+ memset(locked, 0, bitarray_div8(n)) ;
+ memset(logged, 0, bitarray_div8(n)) ;
+
+ if (options & 1) for (size_t i = 0 ; i < n ; i++)
+ {
+ struct stat st ;
+ size_t nlen = strlen(names[i]) ;
+ int h ;
+ char fn[scdirlen + nlen + 6] ;
+ memcpy(fn, scdir, scdirlen) ;
+ fn[scdirlen] = '/' ;
+ memcpy(fn + scdirlen + 1, names[i], nlen + 1) ;
+ h = s6_svc_ok(fn) ;
+ if (h < 0) return -1 ;
+ if (h) bitarray_set(locked, i) ;
+ memcpy(fn + scdirlen + 1 + nlen, "/log", 5) ;
+ if (stat(fn, &st) < 0)
+ {
+ if (errno != ENOENT) return -1 ;
+ }
+ else
+ {
+ int r ;
+ if (!S_ISDIR(st.st_mode)) return (errno = ENOTDIR, -1) ;
+ r = s6_svc_ok(fn) ;
+ if (r < 0) return -1 ;
+ if (r != h) return (errno = EINVAL, -1) ;
+ bitarray_set(logged, i) ;
+ ntotal++ ;
+ }
+ }
+
+ {
+ ftrigr_t a = FTRIGR_ZERO ;
+ unsigned int m = 0 ;
+ uint16_t ids[ntotal] ;
+ if (options & 1 && !ftrigr_startf(&a, deadline, stamp)) return -1 ;
+ for (size_t i = 0 ; i < n ; i++)
+ {
+ size_t nlen = strlen(names[i]) ;
+ char fn[scdirlen + nlen + 6 + sizeof(S6_SUPERVISE_EVENTDIR)] ;
+ memcpy(fn, scdir, scdirlen) ;
+ fn[scdirlen] = '/' ;
+ memcpy(fn + scdirlen + 1, names[i], nlen) ;
+ if (options & 1 && bitarray_peek(locked, i))
+ {
+ ids[m] = registerit(&a, fn, scdirlen + 1 + nlen, deadline, stamp) ;
+ if (ids[m]) m++ ;
+ if (bitarray_peek(logged, i))
+ {
+ memcpy(fn + scdirlen + 1 + nlen, "/log", 4) ;
+ ids[m] = registerit(&a, fn, scdirlen + 5 + nlen, deadline, stamp) ;
+ if (ids[m]) m++ ;
+ }
+ }
+ fn[scdirlen + 1 + nlen] = 0 ;
+ unlink_void(fn) ;
+ }
+ s6_svc_writectl(scdir, S6_SVSCAN_CTLDIR, "an", 2) ;
+ if (options & 1)
+ {
+ ftrigr_wait_and(&a, ids, m, deadline, stamp) ;
+ ftrigr_end(&a) ;
+ }
+ return m ;
+ }
+}
diff --git a/src/libs6/s6_svc_ok.c b/src/libs6/s6_svc_ok.c
index 4940071..abdc85c 100644
--- a/src/libs6/s6_svc_ok.c
+++ b/src/libs6/s6_svc_ok.c
@@ -5,7 +5,7 @@
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_svc_ok (char const *dir)
{
diff --git a/src/libs6/s6_svc_write.c b/src/libs6/s6_svc_write.c
index fba8021..f2a07af 100644
--- a/src/libs6/s6_svc_write.c
+++ b/src/libs6/s6_svc_write.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_svc_write (char const *fifo, char const *data, size_t datalen)
{
diff --git a/src/libs6/s6_svc_writectl.c b/src/libs6/s6_svc_writectl.c
index 11eaf0e..dee9128 100644
--- a/src/libs6/s6_svc_writectl.c
+++ b/src/libs6/s6_svc_writectl.c
@@ -7,7 +7,7 @@
#include <string.h>
#include <skalibs/djbunix.h>
#include <skalibs/unix-transactional.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_svc_writectl (char const *service, char const *subdir, char const *s, size_t len)
{
diff --git a/src/libs6/s6_svstatus_pack.c b/src/libs6/s6_svstatus_pack.c
index ef2d5bd..a769c08 100644
--- a/src/libs6/s6_svstatus_pack.c
+++ b/src/libs6/s6_svstatus_pack.c
@@ -4,7 +4,7 @@
#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
void s6_svstatus_pack (char *pack, s6_svstatus_t const *sv)
{
@@ -15,8 +15,6 @@ void s6_svstatus_pack (char *pack, s6_svstatus_t const *sv)
pack[34] =
sv->flagpaused |
(sv->flagfinishing << 1) |
- (sv->flagwant << 2) |
- (sv->flagwantup << 3) |
- (sv->flagready << 4) |
- (sv->flagthrottled << 5) ;
+ (sv->flagwantup << 2) |
+ (sv->flagready << 3) ;
}
diff --git a/src/libs6/s6_svstatus_read.c b/src/libs6/s6_svstatus_read.c
index edcf38b..376a0c7 100644
--- a/src/libs6/s6_svstatus_read.c
+++ b/src/libs6/s6_svstatus_read.c
@@ -2,7 +2,7 @@
#include <string.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_svstatus_read (char const *dir, s6_svstatus_t *status)
{
diff --git a/src/libs6/s6_svstatus_unpack.c b/src/libs6/s6_svstatus_unpack.c
index b641c8c..59df671 100644
--- a/src/libs6/s6_svstatus_unpack.c
+++ b/src/libs6/s6_svstatus_unpack.c
@@ -4,7 +4,7 @@
#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv)
{
@@ -18,8 +18,6 @@ void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv)
sv->wstat = wstat ;
sv->flagpaused = pack[34] & 1 ;
sv->flagfinishing = !!(pack[34] & 2) ;
- sv->flagwant = !!(pack[34] & 4) ;
- sv->flagwantup = !!(pack[34] & 8) ;
- sv->flagready = !!(pack[34] & 16) ;
- sv->flagthrottled = !!(pack[34] & 32) ;
+ sv->flagwantup = !!(pack[34] & 4) ;
+ sv->flagready = !!(pack[34] & 8) ;
}
diff --git a/src/libs6/s6_svstatus_write.c b/src/libs6/s6_svstatus_write.c
index 29d4f40..a75b3b1 100644
--- a/src/libs6/s6_svstatus_write.c
+++ b/src/libs6/s6_svstatus_write.c
@@ -2,7 +2,7 @@
#include <string.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
int s6_svstatus_write (char const *dir, s6_svstatus_t const *status)
{
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c
index e73ace0..fa500aa 100644
--- a/src/libs6/s6lock_acquire.c
+++ b/src/libs6/s6lock_acquire.c
@@ -9,7 +9,7 @@
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options, tain const *limit, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6lock_check.c b/src/libs6/s6lock_check.c
index da08eff..b62d790 100644
--- a/src/libs6/s6lock_check.c
+++ b/src/libs6/s6lock_check.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/gensetdyn.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_check (s6lock_t *a, uint16_t id)
{
diff --git a/src/libs6/s6lock_end.c b/src/libs6/s6lock_end.c
index e278bd8..8611289 100644
--- a/src/libs6/s6lock_end.c
+++ b/src/libs6/s6lock_end.c
@@ -4,7 +4,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
void s6lock_end (s6lock_t *a)
{
diff --git a/src/libs6/s6lock_release.c b/src/libs6/s6lock_release.c
index 662b876..96fa3d0 100644
--- a/src/libs6/s6lock_release.c
+++ b/src/libs6/s6lock_release.c
@@ -5,7 +5,7 @@
#include <skalibs/uint16.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_release (s6lock_t *a, uint16_t i, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6lock_start.c b/src/libs6/s6lock_start.c
index 6d81628..ca8fcc8 100644
--- a/src/libs6/s6lock_start.c
+++ b/src/libs6/s6lock_start.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_start (s6lock_t *a, char const *path, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6lock_startf.c b/src/libs6/s6lock_startf.c
index e58cb46..be6e0c8 100644
--- a/src/libs6/s6lock_startf.c
+++ b/src/libs6/s6lock_startf.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/posixplz.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_startf (s6lock_t *a, char const *lockdir, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6lock_update.c b/src/libs6/s6lock_update.c
index fdf1001..4866e7c 100644
--- a/src/libs6/s6lock_update.c
+++ b/src/libs6/s6lock_update.c
@@ -10,7 +10,7 @@
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6lock_wait_and.c b/src/libs6/s6lock_wait_and.c
index 801e8a0..eca7946 100644
--- a/src/libs6/s6lock_wait_and.c
+++ b/src/libs6/s6lock_wait_and.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <skalibs/iopause.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
int s6lock_wait_and (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain const *deadline, tain *stamp)
{
diff --git a/src/libs6/s6lock_wait_or.c b/src/libs6/s6lock_wait_or.c
index 421978b..4e2a501 100644
--- a/src/libs6/s6lock_wait_or.c
+++ b/src/libs6/s6lock_wait_or.c
@@ -4,7 +4,7 @@
#include <skalibs/iopause.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
#include <skalibs/posixishard.h>
diff --git a/src/libs6/s6lock_zero.c b/src/libs6/s6lock_zero.c
index a4e0138..3d35d40 100644
--- a/src/libs6/s6lock_zero.c
+++ b/src/libs6/s6lock_zero.c
@@ -1,5 +1,5 @@
/* ISC license. */
-#include <s6/s6lock.h>
+#include <s6/lock.h>
s6lock_t const s6lock_zero = S6LOCK_ZERO ;
diff --git a/src/libs6/s6lockd.c b/src/libs6/s6lockd.c
index 764e102..8724019 100644
--- a/src/libs6/s6lockd.c
+++ b/src/libs6/s6lockd.c
@@ -20,7 +20,7 @@
#include <skalibs/textmessage.h>
#include <skalibs/textclient.h>
-#include <s6/s6lock.h>
+#include <s6/lock.h>
#define USAGE "s6lockd lockdir"
#define X() strerr_dief1x(101, "internal inconsistency, please submit a bug-report.")
diff --git a/src/supervision/deps-exe/s6-svdir-unlink b/src/supervision/deps-exe/s6-svdir-unlink
deleted file mode 100644
index 08815d9..0000000
--- a/src/supervision/deps-exe/s6-svdir-unlink
+++ /dev/null
@@ -1,2 +0,0 @@
-${LIBS6}
--lskarnet
diff --git a/src/supervision/deps-exe/s6-svdir-link b/src/supervision/deps-exe/s6-svlink
index 16eaae2..16eaae2 100644
--- a/src/supervision/deps-exe/s6-svdir-link
+++ b/src/supervision/deps-exe/s6-svlink
diff --git a/src/supervision/deps-exe/s6-svunlink b/src/supervision/deps-exe/s6-svunlink
new file mode 100644
index 0000000..16eaae2
--- /dev/null
+++ b/src/supervision/deps-exe/s6-svunlink
@@ -0,0 +1,5 @@
+${LIBS6}
+-lskarnet
+${SOCKET_LIB}
+${SYSCLOCK_LIB}
+${SPAWN_LIB}
diff --git a/src/supervision/s6-permafailon.c b/src/supervision/s6-permafailon.c
index b5bb469..d34d09b 100644
--- a/src/supervision/s6-permafailon.c
+++ b/src/supervision/s6-permafailon.c
@@ -11,7 +11,7 @@
#include <skalibs/tai.h>
#include <skalibs/exec.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-permafailon seconds deathcount statuslist prog..."
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index 84290ab..cc6779a 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -25,7 +25,7 @@
#include <skalibs/skamisc.h>
#include <s6/ftrigw.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-supervise dir"
#define CTL S6_SUPERVISE_CTLDIR "/control"
@@ -416,7 +416,6 @@ static int uplastup_z (void)
status.wstat = (int)status.pid ;
status.flagpaused = 0 ;
status.flagready = 0 ;
- status.flagthrottled = 0 ;
flagdying = 0 ;
tain_wallclock_read(&status.stamp) ;
if (notifyfd >= 0)
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index 30a6fb3..5467ea2 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -10,7 +10,7 @@
#include <skalibs/exec.h>
#include <s6/config.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduxOX ] servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svdir-unlink.c b/src/supervision/s6-svdir-unlink.c
deleted file mode 100644
index 0e8699e..0000000
--- a/src/supervision/s6-svdir-unlink.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ISC license. */
-
-#include <stdint.h>
-
-#include <skalibs/sgetopt.h>
-#include <skalibs/strerr2.h>
-
-#include <s6/s6-supervise.h>
-
-#define USAGE "s6-svdir-unlink [ -d ] [ -x ] scandir servicename"
-#define dieusage() strerr_dieusage(100, USAGE)
-
-int main (int argc, char const *const *argv)
-{
- uint32_t options = 0 ;
- PROG = "s6-svdir-link" ;
- {
- subgetopt l = SUBGETOPT_ZERO ;
- for (;;)
- {
- int opt = subgetopt_r(argc, argv, "dx", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'd' : options = 3 ; break ;
- case 'x' : options = 1 ; break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
- }
- if (argc < 2) dieusage() ;
-
- if (!argv[1][0] || argv[1][0] == '.' || argv[1][0] == '/')
- strerr_dief1x(100, "invalid service name") ;
- s6_supervise_unlink(argv[0], argv[1], options) ;
- return 0 ;
-}
diff --git a/src/supervision/s6-svdt-clear.c b/src/supervision/s6-svdt-clear.c
index 791dd61..6b36718 100644
--- a/src/supervision/s6-svdt-clear.c
+++ b/src/supervision/s6-svdt-clear.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/strerr2.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svdt-clear servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svdt.c b/src/supervision/s6-svdt.c
index ab0dfc8..3df356a 100644
--- a/src/supervision/s6-svdt.c
+++ b/src/supervision/s6-svdt.c
@@ -6,7 +6,7 @@
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/sig.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svdt [ -S | -s ] [ -n maxentries ] servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svdir-link.c b/src/supervision/s6-svlink.c
index 8329197..159f817 100644
--- a/src/supervision/s6-svdir-link.c
+++ b/src/supervision/s6-svlink.c
@@ -4,16 +4,19 @@
#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
+#include <libgen.h>
+#include <skalibs/posixplz.h>
#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
+#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
-#define USAGE "s6-svdir-link [ -d ] [ -f ] [ -P | -p ] [ -t timeout ] scandir name servicedir"
+#define USAGE "s6-svlink [ -d | -D ] [ -f ] [ -P ] [ -t timeout ] scandir servicedir [ name ]"
#define dieusage() strerr_dieusage(100, USAGE)
static inline void checkscandir (char const *s)
@@ -67,20 +70,21 @@ int main (int argc, char const *const *argv)
{
tain tto = TAIN_INFINITE_RELATIVE ;
uint32_t options = 0 ;
- PROG = "s6-svdir-link" ;
+ char const *name ;
+ PROG = "s6-svlink" ;
{
unsigned int t = 0 ;
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "dfPpt:", &l) ;
+ int opt = subgetopt_r(argc, argv, "dDfPt:", &l) ;
if (opt == -1) break ;
switch (opt)
{
- case 'd' : options |= 4 ; break ;
+ case 'd' : options |= 12 ; break ;
+ case 'D' : options |= 4 ; options &= ~8U ; break ;
case 'f' : options |= 1 ; break ;
case 'P' : options |= 2 ; break ;
- case 'p' : options &= ~2U ; break ;
case 't' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
default : dieusage() ;
}
@@ -88,18 +92,26 @@ int main (int argc, char const *const *argv)
argc -= l.ind ; argv += l.ind ;
if (t) tain_from_millisecs(&tto, t) ;
}
- if (argc < 3) dieusage() ;
+ if (argc < 2) dieusage() ;
+ if (argv[2]) name = argv[2] ;
+ else
+ {
+ stralloc sa = STRALLOC_ZERO ;
+ if (!stralloc_cats(&sa, argv[1]) || !stralloc_0(&sa))
+ strerr_diefu1sys(111, "stralloc_cats") ;
+ name = basename(sa.s) ;
+ }
if (!argv[0][0]) strerr_dief1x(100, "invalid scandir") ;
- if (!argv[1][0] || argv[1][0] == '.' || argv[1][0] == '/')
+ if (!argv[1][0]) strerr_dief1x(100, "invalid servicedir") ;
+ if (!name[0] || name[0] == '.' || name[0] == '/')
strerr_dief1x(100, "invalid name") ;
- if (!argv[2][0]) strerr_dief1x(100, "invalid servicedir") ;
checkscandir(argv[0]) ;
tain_now_set_stopwatch_g() ;
tain_add_g(&tto, &tto) ;
- if (s6_supervise_link_names_g(argv[0], argv + 2, argv + 1, 1, options, &tto) == -1)
- strerr_diefu6sys(111, "link servicedir ", argv[2], " into scandir ", argv[0], " with name ", argv[1]) ;
+ if (s6_supervise_link_names_g(argv[0], argv + 1, &name, 1, options, &tto) == -1)
+ strerr_diefu6sys(errno == ETIMEDOUT ? 99 : 111, "link servicedir ", argv[1], " into scandir ", argv[0], " with name ", name) ;
return 0 ;
}
diff --git a/src/supervision/s6-svok.c b/src/supervision/s6-svok.c
index 176d8a8..c6c6bd4 100644
--- a/src/supervision/s6-svok.c
+++ b/src/supervision/s6-svok.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/strerr2.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svok servicedir"
diff --git a/src/supervision/s6-svperms.c b/src/supervision/s6-svperms.c
index fb35715..4b8de05 100644
--- a/src/supervision/s6-svperms.c
+++ b/src/supervision/s6-svperms.c
@@ -12,7 +12,7 @@
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svperms [ -v ] [ -u | -g group | -G group | -o | -O group ] [ -e | -E group ] servicedir..."
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index da2dc30..ee0b013 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -22,7 +22,7 @@
#include <skalibs/exec.h>
#include <s6/config.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svscan [ -c maxservices ] [ -t timeout ] [ -d notif ] [ -X consoleholder ] [ dir ]"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svscanctl.c b/src/supervision/s6-svscanctl.c
index b21c611..119d41e 100644
--- a/src/supervision/s6-svscanctl.c
+++ b/src/supervision/s6-svscanctl.c
@@ -2,7 +2,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svscanctl [ -zabhitqnN ] svscandir"
#define dieusage() strerr_dieusage(100, USAGE)
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
index cbda314..979552f 100644
--- a/src/supervision/s6-svstat.c
+++ b/src/supervision/s6-svstat.c
@@ -13,7 +13,7 @@
#include <skalibs/sig.h>
#include <skalibs/tai.h>
#include <skalibs/djbunix.h>
-#include <s6/s6-supervise.h>
+#include <s6/supervise.h>
#define USAGE "s6-svstat [ -uwNrpest | -o up,wantedup,normallyup,ready,paused,pid,exitcode,signal,signum,updownsince,readysince,updownfor,readyfor ] [ -n ] servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -35,7 +35,7 @@ struct funcmap_s
static void pr_up (buffer *b, s6_svstatus_t const *st)
{
- buffer_putsnoflush(b, st->pid && !st->flagfinishing ? st->flagthrottled ? "throttled" : "true" : "false") ;
+ buffer_putsnoflush(b, st->pid && !st->flagfinishing ? "true" : "false") ;
}
static void pr_wantedup (buffer *b, s6_svstatus_t const *st)
@@ -210,8 +210,6 @@ static void legacy (s6_svstatus_t *st, int flagnum)
buffer_putnoflush(buffer_1small, fmt, uint64_fmt(fmt, status.stamp.sec.x)) ;
buffer_putnoflush(buffer_1small, " seconds", 8) ;
- if (isup && status.flagthrottled)
- buffer_putnoflush(buffer_1small, ", throttled", 11) ;
if (isup && !normallyup)
buffer_putnoflush(buffer_1small, ", normally down", 15) ;
if (!isup && normallyup)
diff --git a/src/supervision/s6-svunlink.c b/src/supervision/s6-svunlink.c
new file mode 100644
index 0000000..986be65
--- /dev/null
+++ b/src/supervision/s6-svunlink.c
@@ -0,0 +1,49 @@
+/* ISC license. */
+
+#include <stdint.h>
+
+#include <skalibs/posixplz.h>
+#include <skalibs/types.h>
+#include <skalibs/sgetopt.h>
+#include <skalibs/strerr2.h>
+#include <skalibs/tai.h>
+
+#include <s6/supervise.h>
+
+#define USAGE "s6-svdir-unlink [ -X ] [ -t timeout ] scandir servicename"
+#define dieusage() strerr_dieusage(100, USAGE)
+
+int main (int argc, char const *const *argv)
+{
+ tain tto = TAIN_INFINITE_RELATIVE ;
+ uint32_t options = 1 ;
+ PROG = "s6-svdir-link" ;
+ {
+ unsigned int t = 0 ;
+ subgetopt l = SUBGETOPT_ZERO ;
+ for (;;)
+ {
+ int opt = subgetopt_r(argc, argv, "Xt:", &l) ;
+ if (opt == -1) break ;
+ switch (opt)
+ {
+ case 'X' : options &= ~1U ; break ;
+ case 't' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
+ default : dieusage() ;
+ }
+ }
+ argc -= l.ind ; argv += l.ind ;
+ if (t) tain_from_millisecs(&tto, t) ;
+ }
+ if (argc < 2) dieusage() ;
+
+ if (!argv[1][0] || argv[1][0] == '.' || argv[1][0] == '/')
+ strerr_dief1x(100, "invalid service name") ;
+
+ tain_now_set_stopwatch_g() ;
+ tain_add_g(&tto, &tto) ;
+
+ if (s6_supervise_unlink_names_g(argv[0], argv + 1, 1, options, &tto) == -1)
+ strerr_diefu4sys(111, "prepare unlinking of service ", argv[1], " in scandir ", argv[0]) ;
+ return 0 ;
+}
diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c
index 8eee96b..c97427f 100644
--- a/src/supervision/s6_svlisten_loop.c
+++ b/src/supervision/s6_svlisten_loop.c
@@ -8,7 +8,7 @@
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
#include <s6/ftrigr.h>
-#include <s6/s6-supervise.h>
+#include <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 const *deadline)