Пример #1
0
void init_watchdog(void)
{
	pid_t pid;

	fflush(stdout);
	pid = fork();

	if (pid == 0) {
		const char watchdogname[17]="trinity-watchdog";
		__unused__ int ret = nice(-20);

		watchdog_pid = getpid();

		if (wait_for_shmready() == FALSE)
			return;

		output(0, "Watchdog is alive. (pid:%d)\n", watchdog_pid);

		prctl(PR_SET_NAME, (unsigned long) &watchdogname);
		(void)signal(SIGSEGV, SIG_DFL);

		watchdog();
		output(0, "[%d] Watchdog exiting because %s.\n",
			watchdog_pid, decode_exit());
		_exit(EXIT_SUCCESS);

	} else {
		watchdog_pid = pid;
		output(0, "Started watchdog process, PID is %d\n", watchdog_pid);
	}
}
Пример #2
0
void init_watchdog(void)
{
	pid_t pid;

	fflush(stdout);
	pid = fork();

	if (pid == 0) {
		watchdog_pid = getpid();
		watchdog();
		output(0, "[%d] Watchdog exiting because %s.\n",
			watchdog_pid, decode_exit());
		_exit(EXIT_SUCCESS);

	} else {
		watchdog_pid = pid;
		output(0, "Started watchdog process, PID is %d\n", watchdog_pid);
	}
}