summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-05-16 10:46:35 -0400
committerAndreas Schneider <asn@samba.org>2011-08-10 18:14:04 +0200
commit0a910c93472e1e4aff120219e09866d4a20ec2b2 (patch)
tree21b595373c4fe52393fbafafe3376959799c8ff2 /source3/printing
parente0aa6eec0b498db345666df4b02d4917fa3e259a (diff)
downloadsamba-0a910c93472e1e4aff120219e09866d4a20ec2b2.tar.gz
samba-0a910c93472e1e4aff120219e09866d4a20ec2b2.tar.bz2
samba-0a910c93472e1e4aff120219e09866d4a20ec2b2.zip
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 <asn@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/spoolssd.c15
1 files changed, 4 insertions, 11 deletions
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;