diff options
author | David Oberhollenzer <goliath@infraroot.at> | 2019-03-27 17:48:13 +0100 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2019-03-27 17:48:32 +0100 |
commit | d16d26018126d381954110e8cdb788650eb41d9e (patch) | |
tree | d398bc1c0dbbde87d22f0eb686e4bf6f90056e73 /initd/supervisor.c | |
parent | affe9e4b8802ccb2d9749300327969dcf4222bc1 (diff) |
Add filter argument to status request
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd/supervisor.c')
-rw-r--r-- | initd/supervisor.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/initd/supervisor.c b/initd/supervisor.c index 451ad93..4f7ddc9 100644 --- a/initd/supervisor.c +++ b/initd/supervisor.c @@ -186,8 +186,12 @@ out: } static int send_svc_list(int fd, const void *dst, size_t addrlen, - E_SERVICE_STATE state, service_t *list) + E_SERVICE_STATE filter, E_SERVICE_STATE state, + service_t *list) { + if (filter != ESS_NONE && filter != state) + return 0; + while (list != NULL) { if (init_socket_send_status(fd, dst, addrlen, state, list)) return -1; @@ -198,17 +202,18 @@ static int send_svc_list(int fd, const void *dst, size_t addrlen, return 0; } -void supervisor_answer_status_request(int fd, const void *dst, size_t addrlen) +void supervisor_answer_status_request(int fd, const void *dst, size_t addrlen, + E_SERVICE_STATE filter) { - if (send_svc_list(fd, dst, addrlen, ESS_RUNNING, running)) + if (send_svc_list(fd, dst, addrlen, filter, ESS_RUNNING, running)) return; - if (send_svc_list(fd, dst, addrlen, ESS_DONE, completed)) + if (send_svc_list(fd, dst, addrlen, filter, ESS_DONE, completed)) return; - if (send_svc_list(fd, dst, addrlen, ESS_FAILED, failed)) + if (send_svc_list(fd, dst, addrlen, filter, ESS_FAILED, failed)) return; - if (send_svc_list(fd, dst, addrlen, ESS_ENQUEUED, queue)) + if (send_svc_list(fd, dst, addrlen, filter, ESS_ENQUEUED, queue)) return; - if (send_svc_list(fd, dst, addrlen, ESS_ENQUEUED, terminated)) + if (send_svc_list(fd, dst, addrlen, filter, ESS_ENQUEUED, terminated)) return; init_socket_send_status(fd, dst, addrlen, ESS_NONE, NULL); } |