diff options
author | 2010-04-22 12:13:33 +0000 | |
---|---|---|
committer | 2010-04-22 12:13:33 +0000 | |
commit | 34917824f0789d615080e42e39ab00f5509937fb (patch) | |
tree | 48dc8ddbcf806b78e312876a128aa3e955d47874 | |
parent | Including bgpd.h in mrt.h is dumb. (diff) | |
download | wireguard-openbsd-34917824f0789d615080e42e39ab00f5509937fb.tar.xz wireguard-openbsd-34917824f0789d615080e42e39ab00f5509937fb.zip |
- kill the runner_imsg_compose wrapper to reduce indirection
- kill noisy log_debug
-rw-r--r-- | usr.sbin/smtpd/queue.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/runner.c | 51 |
2 files changed, 20 insertions, 35 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index ebd24c174a0..71ddb9c0421 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.80 2010/04/21 18:54:43 jacekm Exp $ */ +/* $OpenBSD: queue.c,v 1.81 2010/04/22 12:13:33 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -159,7 +159,6 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) if (iev->proc == PROC_RUNNER) { /* forward imsgs from runner on its behalf */ - log_debug("queue: runner sent %d imsg type %d", imsg->hdr.peerid, imsg->hdr.type); imsg_compose_event(env->sc_ievs[imsg->hdr.peerid], imsg->hdr.type, 0, imsg->hdr.pid, imsg->fd, (char *)imsg->data, imsg->hdr.len - sizeof imsg->hdr); @@ -223,7 +222,6 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) void queue_pass_to_runner(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { - log_debug("queue_pass_to_runner: from %d type %d", iev->proc, imsg->hdr.type); imsg_compose_event(env->sc_ievs[PROC_RUNNER], imsg->hdr.type, iev->proc, imsg->hdr.pid, imsg->fd, imsg->data, imsg->hdr.len - sizeof imsg->hdr); diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index 1ee057d31bf..f2b051db201 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.84 2010/04/21 18:54:43 jacekm Exp $ */ +/* $OpenBSD: runner.c,v 1.85 2010/04/22 12:13:33 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -79,19 +79,12 @@ int runner_force_message_schedule(char *); int runner_force_envelope_remove(char *); int runner_force_message_remove(char *); -void runner_imsg_compose(struct smtpd *, int, u_int16_t, - u_int32_t, pid_t, int, void *, u_int16_t); - void runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct message *m; struct remove *rem; struct sched *sched; - int proc; - - /* queue stores imsg sender process number in the ``peerid'' field. */ - proc = imsg->hdr.peerid; switch (imsg->hdr.type) { case IMSG_QUEUE_MESSAGE_UPDATE: @@ -114,8 +107,8 @@ runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) sched->ret = runner_force_envelope_schedule(sched->mid); else if (valid_message_id(sched->mid)) sched->ret = runner_force_message_schedule(sched->mid); - runner_imsg_compose(env, proc, IMSG_QUEUE_SCHEDULE, 0, 0, -1, - sched, sizeof *sched); + imsg_compose_event(iev, IMSG_QUEUE_SCHEDULE, imsg->hdr.peerid, + 0, -1, sched, sizeof *sched); return; case IMSG_QUEUE_REMOVE: @@ -125,8 +118,8 @@ runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) rem->ret = runner_force_envelope_remove(rem->mid); else if (valid_message_id(rem->mid)) rem->ret = runner_force_message_remove(rem->mid); - runner_imsg_compose(env, proc, IMSG_QUEUE_REMOVE, 0, 0, -1, rem, - sizeof *rem); + imsg_compose_event(iev, IMSG_QUEUE_REMOVE, imsg->hdr.peerid, 0, + -1, rem, sizeof *rem); return; case IMSG_PARENT_ENQUEUE_OFFLINE: @@ -281,8 +274,8 @@ runner_process_offline(struct smtpd *env) q = qwalk_new(PATH_OFFLINE); if (qwalk(q, path)) - runner_imsg_compose(env, PROC_PARENT, - IMSG_PARENT_ENQUEUE_OFFLINE, 0, 0, -1, path, + imsg_compose_event(env->sc_ievs[PROC_QUEUE], + IMSG_PARENT_ENQUEUE_OFFLINE, PROC_PARENT, 0, -1, path, strlen(path) + 1); qwalk_close(q); @@ -472,8 +465,9 @@ runner_process_batchqueue(struct smtpd *env) case T_MDA_BATCH: m = TAILQ_FIRST(&batchp->messages); fd = queue_open_message_file(m->message_id); - runner_imsg_compose(env, PROC_MDA, IMSG_MDA_SESS_NEW, - 0, 0, fd, m, sizeof *m); + imsg_compose_event(env->sc_ievs[PROC_QUEUE], + IMSG_MDA_SESS_NEW, PROC_MDA, 0, fd, m, + sizeof *m); TAILQ_REMOVE(&batchp->messages, m, entry); free(m); env->stats->mda.sessions_active++; @@ -481,16 +475,19 @@ runner_process_batchqueue(struct smtpd *env) break; case T_MTA_BATCH: - runner_imsg_compose(env, PROC_MTA, IMSG_BATCH_CREATE, - 0, 0, -1, batchp, sizeof *batchp); + imsg_compose_event(env->sc_ievs[PROC_QUEUE], + IMSG_BATCH_CREATE, PROC_MTA, 0, -1, batchp, + sizeof *batchp); while ((m = TAILQ_FIRST(&batchp->messages))) { - runner_imsg_compose(env, PROC_MTA, - IMSG_BATCH_APPEND, 0, 0, -1, m, sizeof *m); + imsg_compose_event(env->sc_ievs[PROC_QUEUE], + IMSG_BATCH_APPEND, PROC_MTA, 0, -1, m, + sizeof *m); TAILQ_REMOVE(&batchp->messages, m, entry); free(m); } - runner_imsg_compose(env, PROC_MTA, IMSG_BATCH_CLOSE, - 0, 0, -1, batchp, sizeof *batchp); + imsg_compose_event(env->sc_ievs[PROC_QUEUE], + IMSG_BATCH_CLOSE, PROC_MTA, 0, -1, batchp, + sizeof *batchp); env->stats->mta.sessions_active++; env->stats->mta.sessions++; break; @@ -888,14 +885,4 @@ message_reset_flags(struct message *m) sleep(1); } -void -runner_imsg_compose(struct smtpd *env, int proc, u_int16_t type, - u_int32_t peerid, pid_t pid, int fd, void *data, u_int16_t datalen) -{ - /* forward via the queue process */ - log_debug("runner: sending %d imsg type %d", proc, type); - imsg_compose_event(env->sc_ievs[PROC_QUEUE], type, proc, pid, fd, - data, datalen); -} - SPLAY_GENERATE(batchtree, batch, b_nodes, batch_cmp); |