Remove comments that was moved to .h file, rename goto label..

This commit is contained in:
Nils O. Selåsdal
2013-08-28 23:30:37 +02:00
parent 110c843d9d
commit 1a85dd3231
+4 -18
View File
@@ -44,7 +44,7 @@ static int watch(pid_t pid)
int status; int status;
pid_t rc; pid_t rc;
restart: again:
rc = waitpid(pid, &status, 0); rc = waitpid(pid, &status, 0);
if (rc == -1 && errno == EINTR) { if (rc == -1 && errno == EINTR) {
if (restart_flag) { if (restart_flag) {
@@ -52,13 +52,13 @@ restart:
kill_supervised_process(pid); kill_supervised_process(pid);
/* next waitpid should notify us of the death and /* next waitpid should notify us of the death and
* we'll restart the process */ * we'll restart the process */
goto restart; goto again;
} else if (exit_flag) { } else if (exit_flag) {
exit_flag = 0; exit_flag = 0;
return CLEAN_EXIT; return CLEAN_EXIT;
} }
goto restart; goto again;
} else if (rc == -1) { } else if (rc == -1) {
return BAD_EXIT; return BAD_EXIT;
@@ -110,21 +110,7 @@ static void install_signal_handlers(void)
sigaction(SIGINT, &act, &orig_int_sa); sigaction(SIGINT, &act, &orig_int_sa);
} }
/** Supervises this process - restart if it dies. //See notes in supervisor.h
*
* The program should call supervise() at a pristine state (all relevant file descriptors closed, etc).
* supervise() will return 0 if all is ok, and the program can continue.(returning != 0 means
* the supervisor couldn't start, and the calling process must exit)
*
* This will run the actual process as a child process. If that child process dies by any means,
* supervise will create another child process, where supervise() returns 0 again.
*
* To kill the supervisor process and the supervised process, send SIGERM/SIGHUP/SIGINT to the
* parent supervisor process.
* Sending SIGUSR1 to the parent supervisor process will terminate the current child process and
* restart it.
*
* The supervised child process must exit if it recieves a SIGTERM */
int uc_supervise(void) int uc_supervise(void)
{ {
pid_t pid; pid_t pid;