aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-06-10 22:25:18 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-06-10 22:25:18 +0300
commitafc122292609f030ad78f2db7e724417e5ad17af (patch)
tree23ff2db595f4c5a422397cb1bd6af846b90f36b9
parent7f0dd727a18d4e00a0646fd5257cba21c6593a94 (diff)
downloadmailfromd-afc122292609f030ad78f2db7e724417e5ad17af.tar.gz
mailfromd-afc122292609f030ad78f2db7e724417e5ad17af.tar.bz2
Reflect program state in the ps(1) output.
* mfd/main.c (main): Call mf_proctitle_init * mfd/engine.c (mlfi_connect, mlfi_helo, mlfi_envfrom) (mlfi_envrcpt, mlfi_data, mlfi_header, mlfi_eoh) (mlfi_body, mlfi_eom) (mlfi_abort, mlfi_close): Call mf_proctitle_format to reflect the program state in the ps output. * NEWS: Update.
-rw-r--r--NEWS13
-rw-r--r--mfd/engine.c21
-rw-r--r--mfd/main.c1
3 files changed, 31 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 0117876d..337b1f97 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Mailfromd NEWS -- history of user-visible changes. 2009-06-04
+Mailfromd NEWS -- history of user-visible changes. 2009-06-10
Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff
See the end of file for copying conditions.
@@ -7,6 +7,17 @@ Please send Mailfromd bug reports to <bug-mailfromd@gnu.org.ua>
Version 5.1.91 (Git)
+* Process titles.
+
+The process titles visible in the output of the ps(1) command reflect
+the actual states of the corresponding mailfromd subprocesses. For
+example:
+
+$ ps axw|grep mailfromd
+11251 ? S 0:00 mailfromd: n5AIs7aL019522: MAIL FROM <foo@ephi.net> SIZE=1417 BODY=8BITMIME
+19980 ? S 0:00 mailfromd: n5AJ5kFO021484: aborting
+30497 ? S 0:00 mailfromd: HELO s6.newveoron.com
+
* GeoIP support
Two new built-in functions are added to the MFL:
diff --git a/mfd/engine.c b/mfd/engine.c
index 10a29a92..afe9d157 100644
--- a/mfd/engine.c
+++ b/mfd/engine.c
@@ -986,9 +986,11 @@ mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
"Local configuration error; please try again later");
return SMFIS_TEMPFAIL;
}
- debug4(70, "Processing xxfi_connect: %s, %d, %u, %s",
- hostname, family, port, addrstr);
-
+ debug4(70, "Processing xxfi_connect: %s, %d, %s, %u",
+ hostname, family, addrstr, port);
+ mf_proctitle_format("Connect: %s, %d, %s, %u",
+ hostname, family, addrstr, port);
+
env_init(md->env);
env_push_string(md->env, addrstr);
env_push_number(md->env, port);
@@ -1007,6 +1009,8 @@ mlfi_helo(SMFICTX *ctx, char *helohost)
struct message_data *md = priv_get(ctx);
debug1(70, "Processing xxfi_helo: %s", helohost);
+ mf_proctitle_format("%sHELO %s", md->msgid, helohost);
+
md->helostr = strdup(helohost);
env_init(md->env);
env_push_string(md->env, md->helostr);
@@ -1036,6 +1040,8 @@ mlfi_envfrom(SMFICTX *ctx, char **argv)
char *p = concat_args(argv + 1);
debug2(70, "Processing xxfi_envfrom: %s %s", argv[0], p);
+ mf_proctitle_format("%sMAIL FROM %s %s", md->msgid, argv[0], p);
+
env_init(md->env);
capture_from(md->env, argv[0]);
env_push_string(md->env, p);
@@ -1055,6 +1061,7 @@ mlfi_envrcpt(SMFICTX *ctx, char ** argv)
char *p = concat_args(argv + 1);
debug2(70, "Processing xxfi_envrcpt: %s %s", argv[0], p);
+ mf_proctitle_format("%sRCPT TO %s %s", md->msgid, argv[0], p);
env_init(md->env);
env_push_string(md->env, p);
free(p);
@@ -1073,6 +1080,7 @@ mlfi_data(SMFICTX *ctx)
struct message_data *md = priv_get(ctx);
debug(70, "Processing xxfi_data:");
+ mf_proctitle_format("%sDATA", md->msgid);
env_init(md->env);
env_make_frame(md->env);
status = mlfi_eval(ctx, smtp_state_data);
@@ -1087,6 +1095,7 @@ mlfi_header(SMFICTX *ctx, char *headerf, char *headerv)
struct message_data *md = priv_get(ctx);
debug(70, "Processing xxfi_header:");
+ mf_proctitle_format("%sHeader", md->msgid);
env_init(md->env);
capture_header(md->env, headerf, headerv);
env_push_string(md->env, headerv);
@@ -1103,6 +1112,7 @@ mlfi_eoh(SMFICTX *ctx)
sfsistat status;
struct message_data *md = priv_get(ctx);
debug(70, "Processing xxfi_eoh");
+ mf_proctitle_format("%sEOH", md->msgid);
env_init(md->env);
capture_eoh(md->env);
env_make_frame(md->env);
@@ -1117,6 +1127,7 @@ mlfi_body(SMFICTX *ctx, unsigned char *bodyp, size_t len)
sfsistat status;
struct message_data *md = priv_get(ctx);
debug1(70, "Processing xxfi_body: %lu", (unsigned long) len);
+ mf_proctitle_format("%sBODY", md->msgid);
env_init(md->env);
capture_body(md->env, bodyp, len);
env_push_number(md->env, len);
@@ -1262,6 +1273,7 @@ mlfi_eom(SMFICTX *ctx)
struct message_data *md = priv_get(ctx);
debug(70, "Processing xxfi_eom");
+ mf_proctitle_format("%sEOM", md->msgid);
env_init(md->env);
capture_eom(md->env);
@@ -1273,6 +1285,7 @@ mlfi_eom(SMFICTX *ctx)
mu_list_do(md->hdr, run_msgmod, ctx);
}
+ mf_proctitle_format("%sfinished", md->msgid);
clear_rcpt_count(md->env);
mu_list_destroy(&md->hdr);
@@ -1285,6 +1298,7 @@ mlfi_abort(SMFICTX *ctx)
struct message_data *md = priv_get(ctx);
debug(70, "Abort");
+ mf_proctitle_format("%saborting", md->msgid);
mu_list_destroy(&md->hdr);
md->hdr = NULL;
md->msgid[0] = 0;
@@ -1295,6 +1309,7 @@ sfsistat
mlfi_close(SMFICTX *ctx)
{
debug(70, "Close");
+ mf_proctitle_format("closing");
filter_cleanup(ctx);
return SMFIS_CONTINUE;
}
diff --git a/mfd/main.c b/mfd/main.c
index e5a76a7d..9d6a2300 100644
--- a/mfd/main.c
+++ b/mfd/main.c
@@ -2096,6 +2096,7 @@ main(int argc, char **argv)
prog_counter_t entry_point;
mf_init_nls ();
+ mf_proctitle_init (argc, argv, environ);
MU_AUTH_REGISTER_ALL_MODULES();
mu_register_all_formats();

Return to:

Send suggestions and report system problems to the System administrator.