summary refs log tree commit diff
path: root/daemon.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-14 16:51:32 -0400
committerJune McEnroe <june@causal.agency>2020-08-14 16:51:32 -0400
commitecc818534cb9da095ee9dc46eb801233f33b996e (patch)
treeedf4b4ea2b72c968e7158d9356f4ae4608da3530 /daemon.h
parentBuild environment for services (diff)
downloadcatsit-ecc818534cb9da095ee9dc46eb801233f33b996e.tar.gz
catsit-ecc818534cb9da095ee9dc46eb801233f33b996e.zip
Flesh out Service struct
Diffstat (limited to '')
-rw-r--r--daemon.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/daemon.h b/daemon.h
index 2c77537..a62f78f 100644
--- a/daemon.h
+++ b/daemon.h
@@ -19,6 +19,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/time.h>
 #include <unistd.h>
 
 typedef unsigned char byte;
@@ -63,10 +64,29 @@ extern uid_t serviceUID;
 extern gid_t serviceGID;
 extern char *serviceEnviron[EnvironLen];
 
+enum State {
+	Stop,
+	Start,
+};
+
+enum { LineCap = 512 };
+struct Line {
+	size_t len;
+	char buf[LineCap];
+};
+
 struct Service {
 	char *name;
 	char *command;
-	// TODO: And many other things...
+	enum State intent;
+	enum State state;
+	pid_t pid;
+	int outPipe[2];
+	int errPipe[2];
+	struct Line outLine;
+	struct Line errLine;
+	int restartInterval;
+	struct timeval restartTime;
 };
 
 extern struct Services {