mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00:00
Westermo service starter and supervisor, inspired by daemontools
finit.c:
o New service and shell_service stanzas for finit.conf
o Run service_startup() before /etc/finit.d/ hooks
o Run service_monitor() at end of startup
helpers.c:
o Several new functions:
- print_desc() displays a service starting up
- print_result() shows if service started OK or not
- start_process() is used by the services framework
svc.c:
Generic API for managing svc_t structures
ipc.o:
TIPC based framework for communicating with the service monitor.
E.g., to relay (re)configuration signals from a Web/CLI
front-end via finit to one or many setup daemons, and back.
services.c:
Service monitor framework
strlcpy.c:
Secure strncpy() replacement from OpenBSD under the free ISC License.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
c0356b5c7a
commit
d21dc2b477
14 files changed
+1352
-28
No files matched your search
@@ -98,7 +98,8 @@ void do_shutdown (int sig)
|
||||
*/
|
||||
static void shutdown_handler(int sig, siginfo_t *info, void *UNUSED(ctx))
|
||||
{
|
||||
_d("Rebooting on signal %d from pid %d with code %d", sig, info->si_pid, info->si_code);
|
||||
_d("Rebooting on signal %d from %s (PID %d) with code %d",
|
||||
sig, get_pidname(info->si_pid, NULL, 0), info->si_pid, info->si_code);
|
||||
|
||||
do_shutdown(sig);
|
||||
}
|
||||
@@ -110,8 +111,8 @@ static void chld_handler(int sig, siginfo_t *info, void *UNUSED(ctx))
|
||||
{
|
||||
int status;
|
||||
|
||||
/* XXX: Add (procname) to debug output, add get_procname(pid) to helpers.c */
|
||||
_d("Child died, harvesting. Signal %d from pid %d code %d", sig, info->si_pid, info->si_code);
|
||||
_d("Child %s died, harvesting. Signal %d from pid %d code %d",
|
||||
get_pidname(info->si_pid, NULL, 0), sig, info->si_pid, info->si_code);
|
||||
while (waitpid(-1, &status, WNOHANG) != 0) {
|
||||
if (errno == ECHILD)
|
||||
break;
|
||||
@@ -123,17 +124,27 @@ static void chld_handler(int sig, siginfo_t *info, void *UNUSED(ctx))
|
||||
*/
|
||||
static void sigstop_handler(int sig, siginfo_t *info, void *UNUSED(ctx))
|
||||
{
|
||||
_d("Received SIGSTOP(%d) from pid %d code %d", sig, info->si_pid, info->si_code);
|
||||
_d("Received SIGSTOP(%d) from %s (PID %d) code %d",
|
||||
sig, get_pidname(info->si_pid, NULL, 0), info->si_pid, info->si_code);
|
||||
touch(SYNC_STOPPED);
|
||||
stopped ++;
|
||||
}
|
||||
static void sigcont_handler(int sig, siginfo_t *info, void *UNUSED(ctx))
|
||||
{
|
||||
_d("Received SIGCONT(%d) from pid %d code %d", sig, info->si_pid, info->si_code);
|
||||
_d("Received SIGCONT(%d) from %s (PID %d) code %d",
|
||||
sig, get_pidname(info->si_pid, NULL, 0), info->si_pid, info->si_code);
|
||||
stopped = 0;
|
||||
remove(SYNC_STOPPED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Is SIGSTOP asserted?
|
||||
*/
|
||||
int sig_stopped(void)
|
||||
{
|
||||
return stopped;
|
||||
}
|
||||
|
||||
/*
|
||||
* Inital signal setup - ignore everything until we're capable of responding
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user