aboutsummaryrefslogtreecommitdiffstats
path: root/src/daemon.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2016-01-01 20:43:23 +0100
committerMattias Andrée <maandree@member.fsf.org>2016-01-01 20:43:23 +0100
commitf58973cb6e8c82d8970602c70dd99d0e1c19335a (patch)
tree289daeb2d792e5dde602a259f4c854d133fe7cbc /src/daemon.h
parentsatq does not interface with satd + fix regression bugs (diff)
downloadsat-f58973cb6e8c82d8970602c70dd99d0e1c19335a.tar.gz
sat-f58973cb6e8c82d8970602c70dd99d0e1c19335a.tar.bz2
sat-f58973cb6e8c82d8970602c70dd99d0e1c19335a.tar.xz
remove satd-rm and satd-r and let satrm and satr do everything (not done yet)
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/daemon.h')
-rw-r--r--src/daemon.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/daemon.h b/src/daemon.h
index dc8a355..1d4a747 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -67,21 +67,6 @@
*/
#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
-
/**
@@ -140,6 +125,22 @@ fail: \
FD = WANT
+#define PROLOGUE(USAGE_ASSUMPTION, ...) \
+ int state = -1; \
+ if (argc > 0) argv0 = argv[0]; \
+ if (!(USAGE_ASSUMPTION)) usage(); \
+ GET_FD(state, STATE_FILENO, open_state(__VA_ARGS__))
+
+#define CLEANUP_START \
+ errno = 0; \
+fail: \
+ if (errno) perror(argv[0]); \
+ if (state >= 0) close(state)
+
+#define CLEANUP_END \
+ return !!errno
+
+
/**
* Wrapper for `pread` that reads the required amount of data.
@@ -276,3 +277,11 @@ int dup2_and_null(int old, int new);
*/
int open_state(int open_flags, char **state_path);
+/**
+ * Let the daemon know that it may need to
+ * update the timers, and perhaps exit.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int poke_daemon(void);
+