summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/s6-rc/connection-common.h22
-rw-r--r--src/include/s6-rc/connection.h16
-rw-r--r--src/include/s6-rc/db.h76
3 files changed, 114 insertions, 0 deletions
diff --git a/src/include/s6-rc/connection-common.h b/src/include/s6-rc/connection-common.h
new file mode 100644
index 0000000..b78d459
--- /dev/null
+++ b/src/include/s6-rc/connection-common.h
@@ -0,0 +1,22 @@
+/* ISC license. */
+
+#ifndef S6RC_CONNECTION_COMMON_H
+#define S6RC_CONNECTION_COMMON_H
+
+#include <skalibs/textmessage.h>
+
+#define S6RC_CONNECTION_BUFSIZE 4096
+
+typedef struct s6rc_connection_s s6rc_connection_t, *s6rc_connection_t_ref ;
+struct s6rc_connection_s
+{
+ textmessage_sender_t out ;
+ textmessage_receiver_t in ;
+ char inbuf[S6RC_CONNECTION_BUFSIZE] ;
+} ;
+#define S6RC_CONNECTION_ZERO { .out = TEXTMESSAGE_SENDER_ZERO, .in = TEXTMESSAGE_RECEIVER_ZERO, .inbuf = "" }
+
+#define S6RC_MONITOR_BANNER "s6-rc monitor: after\n"
+#define S6RC_MONITOR_BANNERLEN (sizeof(S6RC_MONITOR_BANNER) - 1)
+
+#endif
diff --git a/src/include/s6-rc/connection.h b/src/include/s6-rc/connection.h
new file mode 100644
index 0000000..f6d5eda
--- /dev/null
+++ b/src/include/s6-rc/connection.h
@@ -0,0 +1,16 @@
+/* ISC license. */
+
+#ifndef S6_RC_CONNECTION_H
+#define S6_RC_CONNECTION_H
+
+#include <skalibs/tai.h>
+#include <skalibs/textmessage.h>
+
+#include <s6-rc/connection-common.h>
+
+extern int s6rc_connection_start (s6rc_connection_t *, char const *, tain_t const *, tain_t *) ;
+#define s6rc_connection_start_g(path, deadline) s6rc_connection_start(path, (deadline), &STAMP)
+
+extern void s6rc_connection_end (s6rc_connection_t *) ;
+
+#endif
diff --git a/src/include/s6-rc/db.h b/src/include/s6-rc/db.h
new file mode 100644
index 0000000..0f03967
--- /dev/null
+++ b/src/include/s6-rc/db.h
@@ -0,0 +1,76 @@
+/* ISC license. */
+
+#ifndef S6RC_DB_H
+#define S6RC_DB_H
+
+#include <stdint.h>
+#include <skalibs/diuint32.h>
+#include <skalibs/buffer.h>
+
+#define S6RC_DB_BANNER_START "s6rc-db: start\n"
+#define S6RC_DB_BANNER_START_LEN (sizeof(S6RC_DB_BANNER_START) - 1)
+#define S6RC_DB_BANNER_END "\ns6rc-db: end\n"
+#define S6RC_DB_BANNER_END_LEN (sizeof(S6RC_DB_BANNER_END) - 1)
+
+#define S6RC_DB_FLAG_ESSENTIAL 0x00000001U
+
+
+typedef struct s6rc_oneshot_s s6rc_oneshot_t, *s6rc_oneshot_t_ref ;
+struct s6rc_oneshot_s
+{
+ uint32_t argc[2] ;
+ uint32_t argv[2] ;
+} ;
+
+typedef struct s6rc_longrun_s s6rc_longrun_t, *s6rc_longrun_t_ref ;
+struct s6rc_longrun_s
+{
+ uint32_t consumer ;
+ uint32_t nproducers ;
+ uint32_t producers ;
+} ;
+
+typedef union s6rc_longshot_u s6rc_longshot_t, *s6rc_longshot_t_ref ;
+union s6rc_longshot_u
+{
+ s6rc_oneshot_t oneshot ;
+ s6rc_longrun_t longrun ;
+} ;
+
+typedef struct s6rc_service_s s6rc_service_t, *s6rc_service_t_ref ;
+struct s6rc_service_s
+{
+ uint32_t name ;
+ uint32_t flags ;
+ uint32_t deps[2] ;
+ uint32_t ndeps[2] ;
+ uint32_t timeout[2] ;
+ s6rc_longshot_t x ;
+} ;
+
+typedef struct s6rc_db_s s6rc_db_t, *s6rc_db_t_ref ;
+struct s6rc_db_s
+{
+ s6rc_service_t *services ;
+ unsigned int nshort ;
+ unsigned int nlong ;
+ unsigned int stringlen ;
+ unsigned int nargvs ;
+ unsigned int ndeps ;
+ unsigned int nproducers ;
+ char *string ;
+ char const **argvs ;
+ uint32_t *deps ;
+ uint32_t *producers ;
+} ;
+
+extern int s6rc_db_read_uint32 (buffer *, uint32_t *) ;
+
+extern int s6rc_db_read_sizes (int, s6rc_db_t *) ;
+extern int s6rc_db_read (int, s6rc_db_t *) ;
+
+extern int s6rc_db_check_pipelines (s6rc_db_t const *, diuint32 *) ;
+extern int s6rc_db_check_depcycles (s6rc_db_t const *, int, diuint32 *) ;
+extern int s6rc_db_check_revdeps (s6rc_db_t const *) ;
+
+#endif