From f58973cb6e8c82d8970602c70dd99d0e1c19335a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 1 Jan 2016 20:43:23 +0100 Subject: remove satd-rm and satd-r and let satrm and satr do everything (not done yet) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/daemon.h | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'src/daemon.h') 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); + -- cgit v1.2.3-70-g09d2