aboutsummaryrefslogtreecommitdiffstats
path: root/src/daemon.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-28 22:45:45 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-28 22:45:49 +0100
commit7d8c71019c111134c15a7903ec9acfb5713755fe (patch)
tree3e7f2441e2a326cfe3ab810ddf00e9a1edc9ebbe /src/daemon.h
parentm (diff)
downloadsat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.gz
sat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.bz2
sat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.xz
partially implement satd-list, satd-rm, and satd-run
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/daemon.h')
-rw-r--r--src/daemon.h64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/daemon.h b/src/daemon.h
index 6b968ba..2c0d0ff 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -20,6 +20,10 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <stddef.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
#include <sys/socket.h>
@@ -35,6 +39,27 @@
#define STATE_FILENO 4
+/**
+ * Command: queue a job.
+ */
+#define SAT_QUEUE 0
+
+/**
+ * Command: remove jobs.
+ */
+#define SAT_REMOVE 1
+
+/**
+ * Command: print job queue.
+ */
+#define SAT_PRINT 2
+
+/**
+ * Command: run jobs.
+ */
+#define SAT_RUN 3
+
+
#ifndef t
/**
@@ -48,6 +73,43 @@
/**
+ * A queued job.
+ */
+struct job {
+ /**
+ * The job number.
+ */
+ size_t no;
+
+ /**
+ * The number of “argv” elements in `payload`.
+ */
+ int argc;
+
+ /**
+ * The clock in which `ts` is measured.
+ */
+ clockid_t clk;
+
+ /**
+ * The time when the job shall be executed.
+ */
+ struct timespec ts;
+
+ /**
+ * The number of bytes in `payload`.
+ */
+ size_t n;
+
+ /**
+ * “argv” followed by “envp”.
+ */
+ char payload[0];
+};
+
+
+
+/**
* Wrapper for `read` that reads all available data.
*
* Sets `errno` to `EBADMSG` on success.
@@ -75,7 +137,7 @@ int readall(int fd, char **buf, size_t *n);
*
* @throws Any exception specified for realloc(3).
*/
-char **restore_array(char* buf, size_t len, size_t* n);
+char **restore_array(char *buf, size_t len, size_t *n);
/**
* Create `NULL`-terminate subcopy of an list,