From 99ea5f6faeaf714e34bbcd75fdc50cc94dc7a1c8 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 10 Jul 2020 13:55:25 +0100 Subject: [PATCH] Command-line option for no notifier socket. Bug 2616 --- doc/doc-docbook/spec.xfpt | 33 +++++++++++++++++++++++++-- doc/doc-txt/NewStuff | 2 ++ src/src/daemon.c | 5 ++++ src/src/exim.c | 9 +++++++- test/scripts/0999-EXP-Queue-Ramp/0999 | 2 +- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 6d440e938..0ffc88c58 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -4441,6 +4441,27 @@ of the syntax, and how it interacts with configuration file options, are given in chapter &<>&. When &%-oX%& is used to start a daemon, no pid file is written unless &%-oP%& is also present to specify a pid filename. +.new +.vitem &%-oY%& +.oindex &%-oY%& +.cindex "daemon notifier socket" +This option controls the creation of an inter-process communications endpoint +by the Exim daemon. +It is only relevant when the &%-bd%& (start listening daemon) option is also +given. +Normally the daemon creates this socket, unless a &%-oX%& and &*no*& &%-oP%& +option is also present. +If this option is given then the socket will not be created. This could be +required if the system is running multiple daemons. + +The socket is currently used for +.ilist +fast ramp-up of queue runner processes +.next +obtaining a current queue size +.endlist +.wen + .vitem &%-pd%& .oindex "&%-pd%&" .cindex "Perl" "starting the interpreter" @@ -13111,6 +13132,8 @@ The name of the spool queue in use; empty for the default queue. .cindex "spool" "number of messages" This variable contains the number of messages queued. It is evaluated on demand, but no more often than once every minute. +If there is no daemon notifier socket open, the value will be +an empty string. .vitem &$r_...$& .vindex &$r_...$& @@ -16687,10 +16710,16 @@ should need to modify the default. The option is expanded before use. If the platform supports Linux-style abstract socket names, the result is used with a nul byte prefixed. -Otherwise, it should be a full path name and use a directory accessible +Otherwise, +.new "if nonempty," +it should be a full path name and use a directory accessible to Exim. -If the Exim command line uses a &%-oX%& option and does not use &%-oP%& +.new +If this option is set as empty, +or the command line &%-oY%& option is used, or +.wen +the command line uses a &%-oX%& option and does not use &%-oP%&, then a notifier socket is not created. diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index ac6383ca4..13ee6a3b7 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -36,6 +36,8 @@ Version 4.95 9. Lsearch lookups accept a "ret=full" option, to return both the portion of the line matching the key, and the remainder. +10. A command-line option to have a daemon not create a notifier socket. + Version 4.94 ------------ diff --git a/src/src/daemon.c b/src/src/daemon.c index c376f27c7..f56e36a10 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -1007,6 +1007,11 @@ const uschar * where; struct sockaddr_un sa_un = {.sun_family = AF_UNIX}; int len; +if (!notifier_socket || !*notifier_socket) + { + DEBUG(D_any) debug_printf("-oY used so not creating notifier socket\n"); + return; + } if (override_local_interfaces && !override_pid_file_path) { DEBUG(D_any) diff --git a/src/src/exim.c b/src/src/exim.c index c0ef9150a..25464f799 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -3208,6 +3208,13 @@ on the second character (the one after '-'), to save some effort. */ else override_local_interfaces = string_copy_taint(argv[++i], TRUE); break; + /* -oY: Override creation of daemon notifier socket */ + + case 'Y': + if (*argrest) badarg = TRUE; + else notifier_socket = NULL; + break; + /* Unknown -o argument */ default: @@ -4775,7 +4782,7 @@ if (!originator_login || f.running_in_test_harness) /* Ensure that the user name is in a suitable form for use as a "phrase" in an RFC822 address.*/ -originator_name = parse_fix_phrase(originator_name, Ustrlen(originator_name)); +originator_name = US parse_fix_phrase(originator_name, Ustrlen(originator_name)); /* If a message is created by this call of Exim, the uid/gid of its originator are those of the caller. These values are overridden if an existing message is diff --git a/test/scripts/0999-EXP-Queue-Ramp/0999 b/test/scripts/0999-EXP-Queue-Ramp/0999 index 827b7b9c8..529fa16a1 100644 --- a/test/scripts/0999-EXP-Queue-Ramp/0999 +++ b/test/scripts/0999-EXP-Queue-Ramp/0999 @@ -683,6 +683,6 @@ system "grep -q '=> bob' DIR/spool/log/servermainlog && echo 'daemon did make at system "awk '/<=/{i++} END{print i, \"messages received by dest\"}' DIR/spool/log/servermainlog 1>&2"; system "ls DIR/spool/input 1>&2"; **** -sudo rm DIR/spool/log/mainlog DIR/spool/log/servermainlog +sudo rm -f DIR/spool/log/mainlog DIR/spool/log/servermainlog no_stdout_check no_msglog_check -- 2.30.2