diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 02:00:31 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 02:00:31 +0100 |
commit | a2ec37e465adc15cf440907582dd4822feafc01c (patch) | |
tree | 8a7625eaa98753b03a79ae86717c34bae26e1d90 /src | |
parent | feature test macros (diff) | |
download | sat-a2ec37e465adc15cf440907582dd4822feafc01c.tar.gz sat-a2ec37e465adc15cf440907582dd4822feafc01c.tar.bz2 sat-a2ec37e465adc15cf440907582dd4822feafc01c.tar.xz |
the missing bits
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/client.c | 3 | ||||
-rw-r--r-- | src/daemon.c | 45 | ||||
-rw-r--r-- | src/daemon.h | 28 | ||||
-rw-r--r-- | src/satd-add.c | 1 | ||||
-rw-r--r-- | src/satd-diminished.c | 1 |
5 files changed, 77 insertions, 1 deletions
diff --git a/src/client.c b/src/client.c index b7a43eb..27020d8 100644 --- a/src/client.c +++ b/src/client.c @@ -45,7 +45,8 @@ extern char *argv0; int send_command(enum command cmd, size_t n, const char *restrict msg) { - return 0; /* TODO */ + return 0; /* TODO send_command */ + (void) cmd, (void) n, (void) msg; } diff --git a/src/daemon.c b/src/daemon.c index 8221d6a..5e030c3 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -154,3 +154,48 @@ reopen(int fd, int oflag) return 0; } + +/** + * Send a string to a client. + * + * @param sockfd The file descriptor of the socket. + * @param outfd The file descriptor to which the client shall output the message. + * @param ... `NULL`-terminated list of string to concatenate. + * @return 0 on success, -1 on error. + */ +int +send_string(int sockfd, int outfd, ...) +{ + return 0; /* TODO send_string */ + (void) sockfd, (void) outfd; +} + + +/** + * Removes (and optionally runs) a job. + * + * @param jobno The job number, `NULL` for any job. + * @param runjob Shall we run the job too? + * @return 0 on success, -1 on error. + * + * @throws 0 The job is not in the queue. + */ +int +remove_job(const char *jobno, int runjob) +{ + return 0; /* TODO remove_job */ + (void) jobno, (void) runjob; +} + + +/** + * Get a `NULL` terminated list of all queued jobs. + * + * @return A `NULL` terminated list of all queued jobs. `NULL` on error. + */ +struct job ** +get_jobs(void) +{ + return NULL; /* TODO get_jobs */ +} + diff --git a/src/daemon.h b/src/daemon.h index f6ebaf0..773be85 100644 --- a/src/daemon.h +++ b/src/daemon.h @@ -168,3 +168,31 @@ char **sublist(char *const *list, size_t n); */ int reopen(int fd, int oflag); +/** + * Send a string to a client. + * + * @param sockfd The file descriptor of the socket. + * @param outfd The file descriptor to which the client shall output the message. + * @param ... `NULL`-terminated list of string to concatenate. + * @return 0 on success, -1 on error. + */ +int send_string(int sockfd, int outfd, ...); + +/** + * Removes (and optionally runs) a job. + * + * @param jobno The job number, `NULL` for any job. + * @param runjob Shall we run the job too? + * @return 0 on success, -1 on error. + * + * @throws 0 The job is not in the queue. + */ +int remove_job(const char *jobno, int runjob); + +/** + * Get a `NULL` terminated list of all queued jobs. + * + * @return A `NULL` terminated list of all queued jobs. `NULL` on error. + */ +struct job **get_jobs(void); + diff --git a/src/satd-add.c b/src/satd-add.c index 0d7d777..aa7dde0 100644 --- a/src/satd-add.c +++ b/src/satd-add.c @@ -54,6 +54,7 @@ main(int argc, char *argv[]) t (elements < (size_t)msg_argc); n += sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec); + /* TODO main */ (void) argv; return 0; diff --git a/src/satd-diminished.c b/src/satd-diminished.c index a46b67d..cd8f988 100644 --- a/src/satd-diminished.c +++ b/src/satd-diminished.c @@ -90,6 +90,7 @@ main(int argc, char *argv[], char *envp[]) /* The magnificent loop. */ accept_again: + /* TODO run jobs */ if (received_signo == SIGHUP) { execve(DAEMON_PREFIX "diminished", argv, envp); perror(argv[0]); |