23 lines
977 B
C
23 lines
977 B
C
#ifndef UCORE_SUPERVISOR_H_
|
|
#define UCORE_SUPERVISOR_H_
|
|
|
|
/** Supervises this process - restart if it dies.
|
|
*
|
|
* 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
|
|
* @return 0 on success, non-zero on failure (e.g. fork() fails)*/
|
|
int uc_supervise(void);
|
|
|
|
#endif
|