Ejemplo n.º 1
0
Archivo: mutex.c Proyecto: hef/samba
static void tdb_robust_mutex_handler(int sig)
{
	if (tdb_robust_mutex_pid != -1) {
		pid_t pid;
		int status;

		pid = waitpid(tdb_robust_mutex_pid, &status, WNOHANG);
		if (pid == tdb_robust_mutex_pid) {
			tdb_robust_mutex_pid = -1;
			return;
		}
	}

	if (tdb_robust_mutext_old_handler == SIG_DFL) {
		return;
	}
	if (tdb_robust_mutext_old_handler == SIG_IGN) {
		return;
	}
	if (tdb_robust_mutext_old_handler == SIG_ERR) {
		return;
	}

	tdb_robust_mutext_old_handler(sig);
}
Ejemplo n.º 2
0
static void tdb_robust_mutex_handler(int sig)
{
	pid_t child_pid = tdb_robust_mutex_pid;

	if (child_pid != -1) {
		pid_t pid;

		pid = waitpid(child_pid, NULL, WNOHANG);
		if (pid == -1) {
			switch (errno) {
			case ECHILD:
				tdb_robust_mutex_pid = -1;
				return;

			default:
				return;
			}
		}
		if (pid == child_pid) {
			tdb_robust_mutex_pid = -1;
			return;
		}
	}

	if (tdb_robust_mutext_old_handler == SIG_DFL) {
		return;
	}
	if (tdb_robust_mutext_old_handler == SIG_IGN) {
		return;
	}
	if (tdb_robust_mutext_old_handler == SIG_ERR) {
		return;
	}

	tdb_robust_mutext_old_handler(sig);
}