summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2012-09-16 16:43:30 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2012-09-16 16:43:30 +0000
commitef6596e8f4593a861b83fdb3c384a98e44040729 (patch)
tree894781b05df322a2acc848ebf7c1400320045462 /usr.sbin
parent31daff28c7781420c4a230b1ba546d4fd9a36a69 (diff)
Factorize log_imsg() in imsg_dispatch() instead of in each imsg_callback()'s
and put it out of profiling, so it's not accounted. While there, for PROC_PARENT: - set smtpd_process for PROC_PARENT - use setproctitle() like other processes ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/control.c4
-rw-r--r--usr.sbin/smtpd/lka.c4
-rw-r--r--usr.sbin/smtpd/mda.c4
-rw-r--r--usr.sbin/smtpd/mfa.c4
-rw-r--r--usr.sbin/smtpd/mta.c4
-rw-r--r--usr.sbin/smtpd/queue.c4
-rw-r--r--usr.sbin/smtpd/scheduler.c4
-rw-r--r--usr.sbin/smtpd/smtp.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c12
9 files changed, 15 insertions, 29 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index c0b34978dd0..eecd564d7ba 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.72 2012/08/25 22:03:26 gilles Exp $ */
+/* $OpenBSD: control.c,v 1.73 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@openbsd.org>
@@ -74,8 +74,6 @@ control_imsg(struct imsgev *iev, struct imsg *imsg)
char *key;
struct stat_value val;
- log_imsg(PROC_CONTROL, iev->proc, imsg);
-
if (iev->proc == PROC_SMTP) {
switch (imsg->hdr.type) {
case IMSG_SMTP_ENQUEUE:
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 54c710e487d..06846019717 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.135 2012/08/25 22:52:19 eric Exp $ */
+/* $OpenBSD: lka.c,v 1.136 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -62,8 +62,6 @@ lka_imsg(struct imsgev *iev, struct imsg *imsg)
struct map *map;
void *tmp;
- log_imsg(PROC_LKA, iev->proc, imsg);
-
if (imsg->hdr.type == IMSG_DNS_HOST || imsg->hdr.type == IMSG_DNS_MX ||
imsg->hdr.type == IMSG_DNS_PTR) {
dns_async(iev, imsg->hdr.type, imsg->data);
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index 4b6f953ff22..1d2a0b9580e 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.72 2012/08/25 10:23:11 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.73 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -63,8 +63,6 @@ mda_imsg(struct imsgev *iev, struct imsg *imsg)
FILE *fp;
uint16_t msg;
- log_imsg(PROC_MDA, iev->proc, imsg);
-
if (iev->proc == PROC_QUEUE) {
switch (imsg->hdr.type) {
case IMSG_MDA_SESS_NEW:
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 2296973c849..993f7790d4a 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.67 2012/01/18 13:41:54 chl Exp $ */
+/* $OpenBSD: mfa.c,v 1.68 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -59,8 +59,6 @@ mfa_imsg(struct imsgev *iev, struct imsg *imsg)
{
struct filter *filter;
- log_imsg(PROC_MFA, iev->proc, imsg);
-
if (iev->proc == PROC_SMTP) {
switch (imsg->hdr.type) {
case IMSG_MFA_CONNECT:
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 365062e8afd..264a0f82372 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.140 2012/08/30 18:16:25 eric Exp $ */
+/* $OpenBSD: mta.c,v 1.141 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -79,8 +79,6 @@ mta_imsg(struct imsgev *iev, struct imsg *imsg)
struct ssl *ssl;
uint64_t id;
- log_imsg(PROC_MTA, iev->proc, imsg);
-
if (iev->proc == PROC_QUEUE) {
switch (imsg->hdr.type) {
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 0bfed5c62c8..37338b72bd9 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.134 2012/09/10 14:22:11 eric Exp $ */
+/* $OpenBSD: queue.c,v 1.135 2012/09/16 16:43:28 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -58,8 +58,6 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg)
uint64_t id;
uint32_t msgid;
- log_imsg(PROC_QUEUE, iev->proc, imsg);
-
if (iev->proc == PROC_SMTP) {
e = imsg->data;
diff --git a/usr.sbin/smtpd/scheduler.c b/usr.sbin/smtpd/scheduler.c
index ffc556a2b22..104d2837542 100644
--- a/usr.sbin/smtpd/scheduler.c
+++ b/usr.sbin/smtpd/scheduler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scheduler.c,v 1.20 2012/09/11 08:37:52 eric Exp $ */
+/* $OpenBSD: scheduler.c,v 1.21 2012/09/16 16:43:29 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -68,8 +68,6 @@ scheduler_imsg(struct imsgev *iev, struct imsg *imsg)
uint64_t id;
uint32_t msgid;
- log_imsg(PROC_SCHEDULER, iev->proc, imsg);
-
switch (imsg->hdr.type) {
case IMSG_QUEUE_SUBMIT_ENVELOPE:
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index e789f93783e..f42b73617da 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.111 2012/09/15 15:12:11 eric Exp $ */
+/* $OpenBSD: smtp.c,v 1.112 2012/09/16 16:43:29 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -62,8 +62,6 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg)
struct ssl *ssl;
struct dns *dns;
- log_imsg(PROC_SMTP, iev->proc, imsg);
-
if (iev->proc == PROC_LKA) {
switch (imsg->hdr.type) {
case IMSG_DNS_PTR:
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index bc29da41139..00b723ee159 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.169 2012/09/11 12:47:36 eric Exp $ */
+/* $OpenBSD: smtpd.c,v 1.170 2012/09/16 16:43:29 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -106,8 +106,6 @@ parent_imsg(struct imsgev *iev, struct imsg *imsg)
struct auth_backend *auth_backend;
int fd;
- log_imsg(PROC_PARENT, iev->proc, imsg);
-
if (iev->proc == PROC_SMTP) {
switch (imsg->hdr.type) {
case IMSG_PARENT_SEND_CONFIG:
@@ -601,6 +599,9 @@ main(int argc, char *argv[])
fork_peers();
+ smtpd_process = PROC_PARENT;
+ setproctitle("%s", env->sc_title[smtpd_process]);
+
imsg_callback = parent_imsg;
event_init();
@@ -676,6 +677,7 @@ fork_peers(void)
env->sc_title[PROC_MDA] = "mail delivery agent";
env->sc_title[PROC_MFA] = "mail filter agent";
env->sc_title[PROC_MTA] = "mail transfer agent";
+ env->sc_title[PROC_PARENT] = "[priv]";
env->sc_title[PROC_QUEUE] = "queue";
env->sc_title[PROC_SCHEDULER] = "scheduler";
env->sc_title[PROC_SMTP] = "smtp server";
@@ -688,8 +690,6 @@ fork_peers(void)
child_add(queue(), CHILD_DAEMON, PROC_QUEUE);
child_add(scheduler(), CHILD_DAEMON, PROC_SCHEDULER);
child_add(smtp(), CHILD_DAEMON, PROC_SMTP);
-
- setproctitle("[priv]");
}
struct child *
@@ -1172,6 +1172,8 @@ imsg_dispatch(int fd, short event, void *p)
if (n == 0)
break;
+ log_imsg(smtpd_process, iev->proc, &imsg);
+
if (profiling || profstat)
clock_gettime(CLOCK_MONOTONIC, &t0);