From 3339c9b9b43f4ee1b7f8fb61b3701364b8c81e03 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 9 May 2011 08:49:50 -0400 Subject: s3-prefork: provide way to send a signal to all children Signed-off-by: Andreas Schneider --- source3/lib/server_prefork.c | 14 ++++++++++++++ source3/lib/server_prefork.h | 1 + 2 files changed, 15 insertions(+) diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c index 000539da0f..958dc2655e 100644 --- a/source3/lib/server_prefork.c +++ b/source3/lib/server_prefork.c @@ -326,6 +326,20 @@ void prefork_reset_allowed_clients(struct prefork_pool *pfp) } } +void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num) +{ + int i; + + for (i = 0; i < pfp->pool_size; i++) { + if (pfp->pool[i].status == PF_WORKER_NONE) { + continue; + } + + kill(pfp->pool[i].pid, signal_num); + } +} + + /* ==== Functions used by children ==== */ static SIG_ATOMIC_T pf_alarm; diff --git a/source3/lib/server_prefork.h b/source3/lib/server_prefork.h index 19ba32dff0..936ad8d5bd 100644 --- a/source3/lib/server_prefork.h +++ b/source3/lib/server_prefork.h @@ -72,6 +72,7 @@ int prefork_count_active_children(struct prefork_pool *pfp, int *total); bool prefork_mark_pid_dead(struct prefork_pool *pfp, pid_t pid); void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max); void prefork_reset_allowed_clients(struct prefork_pool *pfp); +void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num); /* ==== Functions used by children ==== */ -- cgit