diff options
author | David Oberhollenzer <goliath@infraroot.at> | 2020-05-07 22:02:30 +0200 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2020-05-07 22:02:30 +0200 |
commit | ef0dd7cbe779b879f61bdbaf23a01bc1fb643243 (patch) | |
tree | 2abdf954a8cdd6d99092708a4d0526eb084ec996 /initd | |
parent | 8d587b86e76817b10f86d18463fc7e536ea501ae (diff) |
Temporarily remove service reload ability
A cleaner, more planned out version will be added back later.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd')
-rw-r--r-- | initd/init.h | 2 | ||||
-rw-r--r-- | initd/main.c | 1 | ||||
-rw-r--r-- | initd/supervisor.c | 79 |
3 files changed, 0 insertions, 82 deletions
diff --git a/initd/init.h b/initd/init.h index c8b1c1d..0196861 100644 --- a/initd/init.h +++ b/initd/init.h @@ -70,8 +70,6 @@ void supervisor_init(void); bool supervisor_process_queues(void); -void supervisor_reload_config(void); - void supervisor_answer_status_request(int fd, const void *dest_addr, size_t addrlen, E_SERVICE_STATE filter); diff --git a/initd/main.c b/initd/main.c index e024c4e..e59d809 100644 --- a/initd/main.c +++ b/initd/main.c @@ -31,7 +31,6 @@ static void handle_signal(void) supervisor_set_target(TGT_REBOOT); break; case SIGHUP: - supervisor_reload_config(); break; case SIGUSR1: if (sockfd >= 0) { diff --git a/initd/supervisor.c b/initd/supervisor.c index f9d3d7f..8c33bf3 100644 --- a/initd/supervisor.c +++ b/initd/supervisor.c @@ -13,46 +13,6 @@ static service_t *failed = NULL; static int singleshot = 0; static bool waiting = false; -static bool find_service(service_t *list, service_t *svc) -{ - while (list != NULL) { - if (strcmp(list->fname, svc->fname) == 0) - return true; - - list = list->next; - } - return false; -} - -static void remove_not_in_list(service_t **current, service_t *list, int tgt) -{ - service_t *it = *current, *prev = NULL; - - while (it != NULL) { - if (it->target == tgt && !find_service(list, it)) { - if (prev == NULL) { - delsvc(it); - *current = (*current)->next; - it = *current; - } else { - prev->next = it->next; - delsvc(it); - it = prev->next; - } - } else { - prev = it; - it = it->next; - } - } -} - -static bool have_service(service_t *svc) -{ - return find_service(running, svc) || find_service(terminated, svc) || - find_service(queue, svc) || find_service(completed, svc) || - find_service(failed, svc); -} - static int start_service(service_t *svc) { if (svc->id < 1) @@ -185,45 +145,6 @@ void supervisor_init(void) print_status("reading configuration from " SVCDIR, status, false); } -void supervisor_reload_config(void) -{ - service_list_t newcfg; - service_t *svc; - int i; - - if (svcscan(SVCDIR, &newcfg)) - return; - - for (i = 0; i < TGT_MAX; ++i) { - if (cfg.targets[i] == NULL) { - remove_not_in_list(&queue, newcfg.targets[i], i); - remove_not_in_list(&terminated, newcfg.targets[i], i); - remove_not_in_list(&completed, newcfg.targets[i], i); - remove_not_in_list(&failed, newcfg.targets[i], i); - - while (newcfg.targets[i] != NULL) { - svc = newcfg.targets[i]; - newcfg.targets[i] = svc->next; - - if (have_service(svc)) { - delsvc(svc); - } else { - svc->id = service_id++; - svc->status = EXIT_SUCCESS; - svc->next = completed; - completed = svc; - } - } - } else { - svc = cfg.targets[i]; - cfg.targets[i] = newcfg.targets[i]; - newcfg.targets[i] = svc; - } - } - - del_svc_list(&newcfg); -} - bool supervisor_process_queues(void) { service_t *svc; |