diff options
-rwxr-xr-x | rvnit | bin | 0 -> 76160 bytes | |||
-rw-r--r-- | rvnit.c | 14 |
2 files changed, 8 insertions, 6 deletions
diff --git a/rvnit b/rvnit new file mode 100755 index 0000000..730af55 --- /dev/null +++ b/rvnit Binary files differdiff --git a/rvnit.c b/rvnit.c index 794d43c..0846457 100644 --- a/rvnit.c +++ b/rvnit.c @@ -68,9 +68,9 @@ int real_pid1; int use_global_log; volatile sig_atomic_t want_shutdown; -volatile sig_atomic_t want_rescan; -volatile sig_atomic_t want_rescandir; volatile sig_atomic_t want_reboot; +int want_rescan; +int want_rescandir; void on_signal(int sig) @@ -328,8 +328,10 @@ socket_loop(void* ignored) if (cmd == 'r') { write(connfd, "ok\n", 3); + pthread_mutex_lock(&services_lock); want_rescandir = 1; want_rescan = 1; + pthread_mutex_unlock(&services_lock); pthread_kill(main_thread, SIGCONT); } @@ -867,16 +869,15 @@ cont1: LOG("system up"); while (!want_shutdown) { + pthread_mutex_lock(&services_lock); + if (want_rescandir) { - pthread_mutex_lock(&services_lock); rescandir(); - pthread_mutex_unlock(&services_lock); want_rescandir = 0; } if (want_rescan) { printf("rescanning state\n"); - pthread_mutex_lock(&services_lock); for (i = 0; i < MAX_SV; i++) { if (services[i].name[2] == 'L') { if (services[i].state == UP && @@ -910,11 +911,12 @@ cont1: } } } - pthread_mutex_unlock(&services_lock); want_rescan = 0; } + pthread_mutex_lock(&services_lock); + int status = 0; errno = 0; int pid = wait(&status); |