s3-prefork: provide way to send a signal to all children
authorSimo Sorce <idra@samba.org>
Mon, 9 May 2011 12:49:50 +0000 (08:49 -0400)
committerAndreas Schneider <asn@samba.org>
Wed, 10 Aug 2011 16:14:04 +0000 (18:14 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
source3/lib/server_prefork.c
source3/lib/server_prefork.h

index 000539da0f1600a91fa46653446782b2880c30db..958dc2655e2efd64fa2079983242479fd2d785e2 100644 (file)
@@ -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;
index 19ba32dff079142a707d2edcfd956c339d463628..936ad8d5bd7c23dba862b231fe9842f8f2d0667d 100644 (file)
@@ -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 ==== */