summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2011-05-01 12:57:12 +0000
committerEric Faurot <eric@cvs.openbsd.org>2011-05-01 12:57:12 +0000
commitc451ba908723902ef2bf2ef658ed29e304a28fe1 (patch)
treefde86e74ac869a4d88d3612616972d38e0aa5861 /usr.sbin/smtpd/queue.c
parenta98e9bb7b03360436119edd88230330b78dac64f (diff)
the smtpd env is meant to be global, so do not pass it all around.
discussed with and ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/queue.c')
-rw-r--r--usr.sbin/smtpd/queue.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index b540fa17a57..1326f8606ab 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.102 2011/04/17 13:36:07 gilles Exp $ */
+/* $OpenBSD: queue.c,v 1.103 2011/05/01 12:57:11 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -36,14 +36,14 @@
#include "smtpd.h"
#include "log.h"
-static void queue_imsg(struct smtpd *, struct imsgev *, struct imsg *);
-static void queue_pass_to_runner(struct smtpd *, struct imsgev *, struct imsg *);
+static void queue_imsg(struct imsgev *, struct imsg *);
+static void queue_pass_to_runner(struct imsgev *, struct imsg *);
static void queue_shutdown(void);
static void queue_sig_handler(int, short, void *);
-static void queue_purge(struct smtpd *, enum queue_kind, char *);
+static void queue_purge(enum queue_kind, char *);
static void
-queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
+queue_imsg(struct imsgev *iev, struct imsg *imsg)
{
struct submit_status ss;
struct envelope *m;
@@ -59,9 +59,9 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
ss.code = 250;
ss.u.msgid = 0;
if (m->flags & F_MESSAGE_ENQUEUED)
- ret = queue_message_create(env, Q_ENQUEUE, &ss.u.msgid);
+ ret = queue_message_create(Q_ENQUEUE, &ss.u.msgid);
else
- ret = queue_message_create(env, Q_INCOMING, &ss.u.msgid);
+ ret = queue_message_create(Q_INCOMING, &ss.u.msgid);
if (ret == 0)
ss.code = 421;
imsg_compose_event(iev, IMSG_QUEUE_CREATE_MESSAGE, 0, 0, -1,
@@ -70,20 +70,20 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
case IMSG_QUEUE_REMOVE_MESSAGE:
if (m->flags & F_MESSAGE_ENQUEUED)
- queue_message_purge(env, Q_ENQUEUE, evpid_to_msgid(m->evpid));
+ queue_message_purge(Q_ENQUEUE, evpid_to_msgid(m->evpid));
else
- queue_message_purge(env, Q_INCOMING, evpid_to_msgid(m->evpid));
+ queue_message_purge(Q_INCOMING, evpid_to_msgid(m->evpid));
return;
case IMSG_QUEUE_COMMIT_MESSAGE:
ss.id = m->session_id;
if (m->flags & F_MESSAGE_ENQUEUED) {
- if (queue_message_commit(env, Q_ENQUEUE, evpid_to_msgid(m->evpid)))
+ if (queue_message_commit(Q_ENQUEUE, evpid_to_msgid(m->evpid)))
env->stats->queue.inserts_local++;
else
ss.code = 421;
} else {
- if (queue_message_commit(env, Q_INCOMING, evpid_to_msgid(m->evpid)))
+ if (queue_message_commit(Q_INCOMING, evpid_to_msgid(m->evpid)))
env->stats->queue.inserts_remote++;
else
ss.code = 421;
@@ -92,16 +92,16 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
&ss, sizeof ss);
if (ss.code != 421)
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
case IMSG_QUEUE_MESSAGE_FILE:
ss.id = m->session_id;
if (m->flags & F_MESSAGE_ENQUEUED)
- fd = queue_message_fd_rw(env, Q_ENQUEUE, evpid_to_msgid(m->evpid));
+ fd = queue_message_fd_rw(Q_ENQUEUE, evpid_to_msgid(m->evpid));
else
- fd = queue_message_fd_rw(env, Q_INCOMING, evpid_to_msgid(m->evpid));
+ fd = queue_message_fd_rw(Q_INCOMING, evpid_to_msgid(m->evpid));
if (fd == -1)
ss.code = 421;
imsg_compose_event(iev, IMSG_QUEUE_MESSAGE_FILE, 0, 0, fd,
@@ -109,7 +109,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
return;
case IMSG_SMTP_ENQUEUE:
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
}
}
@@ -129,9 +129,9 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
/* Write to disk */
if (m->flags & F_MESSAGE_ENQUEUED)
- ret = queue_envelope_create(env, Q_ENQUEUE, m);
+ ret = queue_envelope_create(Q_ENQUEUE, m);
else
- ret = queue_envelope_create(env, Q_INCOMING, m);
+ ret = queue_envelope_create(Q_INCOMING, m);
if (ret == 0) {
ss.code = 421;
@@ -163,14 +163,14 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_QUEUE_MESSAGE_FD:
rq_batch = imsg->data;
- fd = queue_message_fd_r(env, Q_QUEUE, rq_batch->msgid);
+ fd = queue_message_fd_r(Q_QUEUE, rq_batch->msgid);
imsg_compose_event(iev, IMSG_QUEUE_MESSAGE_FD, 0, 0,
fd, rq_batch, sizeof *rq_batch);
return;
case IMSG_QUEUE_MESSAGE_UPDATE:
case IMSG_BATCH_DONE:
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
}
}
@@ -179,7 +179,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_QUEUE_MESSAGE_UPDATE:
case IMSG_MDA_SESS_NEW:
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
}
}
@@ -192,7 +192,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
case IMSG_QUEUE_RESUME_OUTGOING:
case IMSG_QUEUE_SCHEDULE:
case IMSG_QUEUE_REMOVE:
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
}
}
@@ -200,12 +200,12 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
if (iev->proc == PROC_PARENT) {
switch (imsg->hdr.type) {
case IMSG_PARENT_ENQUEUE_OFFLINE:
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
case IMSG_CTL_VERBOSE:
log_verbose(*(int *)imsg->data);
- queue_pass_to_runner(env, iev, imsg);
+ queue_pass_to_runner(iev, imsg);
return;
}
}
@@ -214,7 +214,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
}
static void
-queue_pass_to_runner(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
+queue_pass_to_runner(struct imsgev *iev, struct imsg *imsg)
{
imsg_compose_event(env->sc_ievs[PROC_RUNNER], imsg->hdr.type,
iev->proc, imsg->hdr.pid, imsg->fd, imsg->data,
@@ -242,7 +242,7 @@ queue_shutdown(void)
}
pid_t
-queue(struct smtpd *env)
+queue(void)
{
pid_t pid;
struct passwd *pw;
@@ -269,7 +269,7 @@ queue(struct smtpd *env)
return (pid);
}
- purge_config(env, PURGE_EVERYTHING);
+ purge_config(PURGE_EVERYTHING);
pw = env->sc_pw;
@@ -289,8 +289,8 @@ queue(struct smtpd *env)
imsg_callback = queue_imsg;
event_init();
- signal_set(&ev_sigint, SIGINT, queue_sig_handler, env);
- signal_set(&ev_sigterm, SIGTERM, queue_sig_handler, env);
+ signal_set(&ev_sigint, SIGINT, queue_sig_handler, NULL);
+ signal_set(&ev_sigterm, SIGTERM, queue_sig_handler, NULL);
signal_add(&ev_sigint, NULL);
signal_add(&ev_sigterm, NULL);
signal(SIGPIPE, SIG_IGN);
@@ -305,11 +305,11 @@ queue(struct smtpd *env)
if ((env->sc_maxconn = availdesc() / 4) < 1)
fatalx("runner: fd starvation");
- config_pipes(env, peers, nitems(peers));
- config_peers(env, peers, nitems(peers));
+ config_pipes(peers, nitems(peers));
+ config_peers(peers, nitems(peers));
- queue_purge(env, Q_INCOMING, PATH_INCOMING);
- queue_purge(env, Q_ENQUEUE, PATH_ENQUEUE);
+ queue_purge(Q_INCOMING, PATH_INCOMING);
+ queue_purge(Q_ENQUEUE, PATH_ENQUEUE);
if (event_dispatch() < 0)
fatal("event_dispatch");
@@ -319,7 +319,7 @@ queue(struct smtpd *env)
}
static void
-queue_purge(struct smtpd *env, enum queue_kind qkind, char *queuepath)
+queue_purge(enum queue_kind qkind, char *queuepath)
{
char path[MAXPATHLEN];
struct qwalk *q;
@@ -333,14 +333,14 @@ queue_purge(struct smtpd *env, enum queue_kind qkind, char *queuepath)
log_warnx("queue_purge: invalid evpid");
continue;
}
- queue_message_purge(env, qkind, msgid);
+ queue_message_purge(qkind, msgid);
}
qwalk_close(q);
}
void
-queue_submit_envelope(struct smtpd *env, struct envelope *m)
+queue_submit_envelope(struct envelope *m)
{
imsg_compose_event(env->sc_ievs[PROC_QUEUE],
IMSG_QUEUE_SUBMIT_ENVELOPE, 0, 0, -1,
@@ -348,7 +348,7 @@ queue_submit_envelope(struct smtpd *env, struct envelope *m)
}
void
-queue_commit_envelopes(struct smtpd *env, struct envelope *m)
+queue_commit_envelopes(struct envelope *m)
{
imsg_compose_event(env->sc_ievs[PROC_QUEUE],
IMSG_QUEUE_COMMIT_ENVELOPES, 0, 0, -1,