From 576522606d25ccb68ce580aa9b2d77ae382c9c2d Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Sun, 24 May 2009 14:22:25 +0000 Subject: Instead of keeping stats private to each process, and querying every process individually whenever stats need to be fetched, keep stats in MAP_ANON shared memory allocated by parent. This means control has direct access to stats and can respond very quickly without troubling any other daemon processes. ok gilles@ --- usr.sbin/smtpd/runner.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'usr.sbin/smtpd/runner.c') diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index 8394f0a4928..c242f44b82b 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.46 2009/05/19 11:24:24 jacekm Exp $ */ +/* $OpenBSD: runner.c,v 1.47 2009/05/24 14:22:23 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -82,8 +82,6 @@ struct batch *batch_lookup(struct smtpd *, struct message *); int runner_force_envelope_schedule(char *); int runner_force_message_schedule(char *); -struct s_runner s_runner; - void runner_sig_handler(int sig, short event, void *p) { @@ -194,15 +192,6 @@ runner_dispatch_control(int sig, short event, void *p) case IMSG_MTA_RESUME: env->sc_opts &= ~SMTPD_MTA_PAUSED; break; - case IMSG_STATS: { - struct stats *s = imsg.data; - - IMSG_SIZE_CHECK(s); - - s->u.runner = s_runner; - imsg_compose(ibuf, IMSG_STATS, 0, 0, -1, s, sizeof(*s)); - break; - } case IMSG_RUNNER_SCHEDULE: { struct sched *s = imsg.data; @@ -268,7 +257,7 @@ runner_dispatch_queue(int sig, short event, void *p) IMSG_SIZE_CHECK(m); - s_runner.active--; + env->stats->runner.active--; queue_message_update(m); break; } @@ -936,7 +925,7 @@ batch_record(struct smtpd *env, struct message *messagep) } TAILQ_INSERT_TAIL(&batchp->messages, messagep, entry); - s_runner.active++; + env->stats->runner.active++; return batchp; } -- cgit v1.2.3