From 0a910c93472e1e4aff120219e09866d4a20ec2b2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 16 May 2011 10:46:35 -0400 Subject: s3-prefork: Provide a cleanup function This way the parent doesn't need to know how to handle dead children and keeps all of that within the prefork abstraction. Signed-off-by: Andreas Schneider --- source3/printing/spoolssd.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'source3/printing/spoolssd.c') diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 25223c94c5..27704dab3c 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -524,23 +524,16 @@ static void spoolssd_sig_chld_handler(struct tevent_context *ev_ctx, void *siginfo, void *pvt) { struct prefork_pool *pfp; - pid_t pid; - int status; - bool ok; int active, total; int n, r; pfp = talloc_get_type_abort(pvt, struct prefork_pool); - while ((pid = sys_waitpid(-1, &status, WNOHANG)) > 0) { - ok = prefork_mark_pid_dead(pfp, pid); - if (!ok) { - DEBUG(1, ("Pid %d was not found in children pool!\n", - (int)pid)); - } - } + /* run the cleanup function to make sure all dead children are + * properly and timely retired. */ + prefork_cleanup_loop(pfp); - /* now check we do not descent below the minimum */ + /* now check we do not descend below the minimum */ active = prefork_count_active_children(pfp, &total); n = 0; -- cgit