summaryrefslogtreecommitdiff
path: root/source3/lib/server_prefork.h
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-05-19 23:56:02 -0400
committerAndreas Schneider <asn@samba.org>2011-08-10 18:14:04 +0200
commit1155280a483e2a84e8baa27556c6ea066dbe6c8a (patch)
tree39c58cbdcb491651b4129233010154fe6e11842a /source3/lib/server_prefork.h
parentd36a8dc896d2a814dd18f127593a8382e4004213 (diff)
downloadsamba-1155280a483e2a84e8baa27556c6ea066dbe6c8a.tar.gz
samba-1155280a483e2a84e8baa27556c6ea066dbe6c8a.tar.bz2
samba-1155280a483e2a84e8baa27556c6ea066dbe6c8a.zip
s3-prefork: Set up a SIGCHLD handler by default
We need to properly handle preforked children so it is better to just do that automatically. If the parent needs/wants to intercept SIGCHLD events it can set a callback that will be called by the prefork code once the internal cleanup function that checks all prefork children has been executed. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/lib/server_prefork.h')
-rw-r--r--source3/lib/server_prefork.h33
1 files changed, 23 insertions, 10 deletions
diff --git a/source3/lib/server_prefork.h b/source3/lib/server_prefork.h
index f4d03ccca1..c45b96975a 100644
--- a/source3/lib/server_prefork.h
+++ b/source3/lib/server_prefork.h
@@ -21,6 +21,8 @@
#include "system/network.h"
#include <tevent.h>
+struct prefork_pool;
+
enum pf_worker_status {
PF_WORKER_NONE = 0,
PF_WORKER_IDLE,
@@ -76,8 +78,16 @@ typedef int (prefork_main_fn_t)(struct tevent_context *ev,
int lock_fd,
void *private_data);
-struct prefork_pool;
-
+/**
+* @brief Callback function for parents that also want to be called on sigchld
+*
+* @param ev_ctx The event context
+* @param pool The pool handler
+* @param private_data Data private to the parent
+*/
+typedef void (prefork_sigchld_fn_t)(struct tevent_context *ev_ctx,
+ struct prefork_pool *pool,
+ void *private_data);
/* ==== Functions used by controlling process ==== */
@@ -162,14 +172,6 @@ int prefork_retire_children(struct prefork_pool *pfp,
int prefork_count_active_children(struct prefork_pool *pfp, int *total);
/**
-* @brief Perform cleanups, like waiting (WNOHANG) dead children.
-* MUST be called regularly from the parent main loop.
-*
-* @param pfp The pool.
-*/
-void prefork_cleanup_loop(struct prefork_pool *pfp);
-
-/**
* @brief Inform all children that they are allowed to accept 'max' clients
* now. Use this when all children are already busy and more clients
* are trying to connect. It will allow each child to handle more than
@@ -200,6 +202,17 @@ void prefork_reset_allowed_clients(struct prefork_pool *pfp);
*/
void prefork_send_signal_to_all(struct prefork_pool *pfp, int signal_num);
+/**
+* @brief Sets the SIGCHLD callback
+*
+* @param pfp The pool handler.
+* @param sigchld_fn The callback function (pass NULL to unset).
+* @param private_data Private data for the callback function.
+*/
+void prefork_set_sigchld_callback(struct prefork_pool *pfp,
+ prefork_sigchld_fn_t *sigchld_fn,
+ void *private_data);
+
/* ==== Functions used by children ==== */
/**