summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-19 16:11:24 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-19 16:11:24 +0000
commit701540827e27a4f07ac725db3ce361d3be0c106f (patch)
tree98c4b2fb8ba8f69ef791feebdcd61cd5bca34140 /src/include
parent83853a80eb18238796154164f9ea776b0c167ab7 (diff)
downloads6-701540827e27a4f07ac725db3ce361d3be0c106f.tar.xz
- added the s6_fdholder library to libs6. (Nothing useful yet.)
- fixed execline invocation in s6-log with slashpackage - integrated s6_svc_main.c's functionality into s6-svscanctl and deleted it - integrated Olivier Brunel's suggestions for wstat report in supervise/status - minor fixes to s6-supervise's status reports - separated sigaction calls in ftrigw_notifyb, this spares a few syscalls in s6-supervise - updated doc to reflect the changes - version bumped to 2.1.0.0 because API breakage (./finish, s6-svstat)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/s6/ftrigw.h1
-rw-r--r--src/include/s6/s6-fdholder.h80
-rw-r--r--src/include/s6/s6-supervise.h19
3 files changed, 95 insertions, 5 deletions
diff --git a/src/include/s6/ftrigw.h b/src/include/s6/ftrigw.h
index 5be9d13..38d89f1 100644
--- a/src/include/s6/ftrigw.h
+++ b/src/include/s6/ftrigw.h
@@ -8,6 +8,7 @@
extern int ftrigw_fifodir_make (char const *, int, int) ;
extern int ftrigw_notify (char const *, char) ;
extern int ftrigw_notifyb (char const *, char const *, unsigned int) ;
+extern int ftrigw_notifyb_nosig (char const *, char const *, unsigned int) ;
#define ftrigw_notifys(f, s) ftrigw_notifyb(f, (s), str_len(s))
extern int ftrigw_clean (char const *) ;
diff --git a/src/include/s6/s6-fdholder.h b/src/include/s6/s6-fdholder.h
new file mode 100644
index 0000000..0285a21
--- /dev/null
+++ b/src/include/s6/s6-fdholder.h
@@ -0,0 +1,80 @@
+ /* ISC license. */
+
+#ifndef S6_FDHOLDER_H
+#define S6_FDHOLDER_H
+
+#include <skalibs/tai.h>
+#include <skalibs/stralloc.h>
+#include <skalibs/genalloc.h>
+#include <skalibs/unixmessage.h>
+#include <skalibs/unixconnection.h>
+
+#define S6_FDHOLDER_ID_SIZE 255
+
+typedef struct s6_fdholder_s s6_fdholder_t, *s6_fdholder_t_ref ;
+struct s6_fdholder_s
+{
+ unixconnection_t connection ;
+} ;
+#define S6_FDHOLDER_ZERO { .connection = UNIXMESSAGE_CONNECTION_ZERO } ;
+
+#define s6_fdholder_init(a, fdin, fdout) unixconnection_init(&(a)->connection, fdin, fdout)
+#define s6_fdholder_free(a) unixconnection_free(&(a)->connection)
+
+
+ /* 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 *) ;
+#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 *) ;
+#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 ;
+struct s6_fdholder_retrieve_result_s
+{
+ int fd ;
+ unsigned char err ;
+} ;
+
+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 *) ;
+#define s6_fdholder_retrieve_maybe_delete_g (a, id, h, deadline) s6_fdholder_retrieve(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)
+#define s6_fdholder_retrieve_delete(a, id, deadline, stamp) s6_fdholder_retrieve_maybe_delete(a, id, 1, deadline, stamp)
+#define s6_fdholder_retrieve_delete_g (a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP)
+
+typedef struct s6_fdholder_list_result_s s6_fdholder_list_result_t, *s6_fdholder_list_result_t_ref ;
+struct s6_fdholder_list_result_s
+{
+ stralloc *sa ;
+ unsigned int n ;
+ unsigned char err ;
+} ;
+
+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 *) ;
+#define s6_fdholder_list_g(a, sa, deadline) s6_fdholder_list(a, sa, (deadline), &STAMP)
+
+
+ /* Dumps */
+
+typedef struct s6_fdholder_fd_s s6_fdholder_fd_t, *s6_fdholder_fd_t_ref ;
+struct s6_fdholder_fd_s
+{
+ char id[S6_FDHOLDER_ID_SIZE + 1] ;
+ int fd ;
+ tain_t limit ;
+} ;
+
+extern int s6_fdholder_getdump (s6_fdholder_t *, genalloc *, tain_t const *, tain_t *) ;
+#define s6_fdholder_getdump_g(a, g, deadline) s6_fdholder_getdump_g(a, g, (deadline), &STAMP)
+extern int s6_fdholder_setdump (s6_fdholder_t *, s6_fdholder_fd_t const *, unsigned int, tain_t const *, tain_t *) ;
+#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
index c8d72d7..2e9a3fa 100644
--- a/src/include/s6/s6-supervise.h
+++ b/src/include/s6/s6-supervise.h
@@ -10,7 +10,7 @@
#define S6_SVSCAN_CTLDIR ".s6-svscan"
#define S6_SVSTATUS_FILENAME S6_SUPERVISE_CTLDIR "/status"
#define S6_SUPERVISE_READY_FILENAME S6_SUPERVISE_CTLDIR "/ready"
-#define S6_SVSTATUS_SIZE 18
+#define S6_SVSTATUS_SIZE 26
extern int s6_svc_write (char const *, char const *, unsigned int) ;
extern int s6_svc_main (int, char const *const *, char const *, char const *, char const *) ;
@@ -24,14 +24,23 @@ struct s6_svstatus_s
unsigned int flagwantup : 1 ;
unsigned int flagpaused : 1 ;
unsigned int flagfinishing : 1 ;
+ unsigned int wstat ;
} ;
-#define S6_SVSTATUS_ZERO { .stamp = TAIN_ZERO, .pid = 0, .flagwant = 0, .flagwantup = 0, .flagpaused = 0, .flagfinishing = 0 }
-
+#define S6_SVSTATUS_ZERO \
+{ \
+ .stamp = TAIN_ZERO, \
+ .pid = 0, \
+ .flagwant = 0, \
+ .flagwantup = 0, \
+ .flagpaused = 0, \
+ .flagfinishing = 0, \
+ .wstat = 0 \
+}
extern void s6_svstatus_pack (char *, s6_svstatus_t const *) ;
-extern void s6_svstatus_unpack (char const *, s6_svstatus_t_ref) ;
-extern int s6_svstatus_read (char const *, s6_svstatus_t_ref) ;
+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 *) ;
/* These functions leak a fd, that's intended */