Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-02 Thread Gilles Chehade
On Mon, Feb 01, 2016 at 07:24:39PM +, Stuart Henderson wrote:
> On 2016/02/01 15:02, Joerg Jung wrote:
> > What about smtpd, should be similar, no?
> 
> This would do the trick. It loses the getrlimit/setrlimit dance that
> config_process() normally does, but I'm not sure if that is really
> needed for the parent process anyway (mine only has 11 FDs so it's
> not in any danger of running out).
>

The parent process shouldn't have much open fd's, it only opens them
to hand them over to another process.

ok

> Index: etc/rc.d/smtpd
> ===
> RCS file: /cvs/src/etc/rc.d/smtpd,v
> retrieving revision 1.5
> diff -u -p -r1.5 smtpd
> --- etc/rc.d/smtpd26 Dec 2015 09:55:15 -  1.5
> +++ etc/rc.d/smtpd1 Feb 2016 19:22:33 -
> @@ -6,7 +6,6 @@ daemon="/usr/sbin/smtpd"
>  
>  . /etc/rc.d/rc.subr
>  
> -pexp="smtpd: \[priv\]"
>  rc_reload=NO
>  
>  rc_cmd $1
> Index: usr.sbin/smtpd/smtpd.c
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
> retrieving revision 1.272
> diff -u -p -r1.272 smtpd.c
> --- usr.sbin/smtpd/smtpd.c27 Jan 2016 12:46:03 -  1.272
> +++ usr.sbin/smtpd/smtpd.c1 Feb 2016 19:22:33 -
> @@ -667,8 +667,6 @@ main(int argc, char *argv[])
>  
>   fork_peers();
>  
> - config_process(PROC_PARENT);
> -
>   imsg_callback = parent_imsg;
>   event_init();
>  
> 

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
On 2016/02/01 15:02, Joerg Jung wrote:
> What about smtpd, should be similar, no?

This would do the trick. It loses the getrlimit/setrlimit dance that
config_process() normally does, but I'm not sure if that is really
needed for the parent process anyway (mine only has 11 FDs so it's
not in any danger of running out).

Index: etc/rc.d/smtpd
===
RCS file: /cvs/src/etc/rc.d/smtpd,v
retrieving revision 1.5
diff -u -p -r1.5 smtpd
--- etc/rc.d/smtpd  26 Dec 2015 09:55:15 -  1.5
+++ etc/rc.d/smtpd  1 Feb 2016 19:22:33 -
@@ -6,7 +6,6 @@ daemon="/usr/sbin/smtpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="smtpd: \[priv\]"
 rc_reload=NO
 
 rc_cmd $1
Index: usr.sbin/smtpd/smtpd.c
===
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
retrieving revision 1.272
diff -u -p -r1.272 smtpd.c
--- usr.sbin/smtpd/smtpd.c  27 Jan 2016 12:46:03 -  1.272
+++ usr.sbin/smtpd/smtpd.c  1 Feb 2016 19:22:33 -
@@ -667,8 +667,6 @@ main(int argc, char *argv[])
 
fork_peers();
 
-   config_process(PROC_PARENT);
-
imsg_callback = parent_imsg;
event_init();
 



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Joerg Jung
On Mon, Feb 01, 2016 at 07:24:39PM +, Stuart Henderson wrote:
> On 2016/02/01 15:02, Joerg Jung wrote:
> > What about smtpd, should be similar, no?
> 
> This would do the trick. It loses the getrlimit/setrlimit dance that
> config_process() normally does, but I'm not sure if that is really
> needed for the parent process anyway (mine only has 11 FDs so it's
> not in any danger of running out).

I think that is fine and makes sense to me, ok jung@

But please wait for Gilles to comment.
 
> Index: etc/rc.d/smtpd
> ===
> RCS file: /cvs/src/etc/rc.d/smtpd,v
> retrieving revision 1.5
> diff -u -p -r1.5 smtpd
> --- etc/rc.d/smtpd26 Dec 2015 09:55:15 -  1.5
> +++ etc/rc.d/smtpd1 Feb 2016 19:22:33 -
> @@ -6,7 +6,6 @@ daemon="/usr/sbin/smtpd"
>  
>  . /etc/rc.d/rc.subr
>  
> -pexp="smtpd: \[priv\]"
>  rc_reload=NO
>  
>  rc_cmd $1
> Index: usr.sbin/smtpd/smtpd.c
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
> retrieving revision 1.272
> diff -u -p -r1.272 smtpd.c
> --- usr.sbin/smtpd/smtpd.c27 Jan 2016 12:46:03 -  1.272
> +++ usr.sbin/smtpd/smtpd.c1 Feb 2016 19:22:33 -
> @@ -667,8 +667,6 @@ main(int argc, char *argv[])
>  
>   fork_peers();
>  
> - config_process(PROC_PARENT);
> -
>   imsg_callback = parent_imsg;
>   event_init();
>  
> 



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
moved from misc.

On 2016-01-28, Antoine Jacoutot  wrote:
>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
>> changed the tradition to setproctitle("parent").
>> 
>> I have no objections with changing this in the parent (but keeping the
>> setproctitles in the children) to either the default (all command line
>> flags) or to something like setproctitle("parent, %s", conffile).
>> Command line flags suck and I don't think that -d or -v would be
>> helpful in the output, so I prefer the latter.
>
> "-v" is helpful at least for rc.d which needs to match the full args list by 
> default
>
>> All rc scripts would have to be adjusted by somebody with better rc-fu.
>
> Actually if things are properly done, the non default pexp line in the rc.d 
> scripts should just be removed and that's it.
>

Here it is for the majority of base daemons. I've left ypldap for now,
the rc script matches "ldap client" not "parent". radiusd already leaves
the parent process title as-is (the setproctitle("[main]") are separate
processes).

OK?


Index: etc/rc.d/eigrpd
===
RCS file: /cvs/src/etc/rc.d/eigrpd,v
retrieving revision 1.2
diff -u -p -r1.2 eigrpd
--- etc/rc.d/eigrpd 21 Oct 2015 11:28:02 -  1.2
+++ etc/rc.d/eigrpd 1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/eigrpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="eigrpd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/httpd
===
RCS file: /cvs/src/etc/rc.d/httpd,v
retrieving revision 1.4
diff -u -p -r1.4 httpd
--- etc/rc.d/httpd  19 Dec 2015 13:45:12 -  1.4
+++ etc/rc.d/httpd  1 Feb 2016 13:51:58 -
@@ -6,8 +6,6 @@ daemon="/usr/sbin/httpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="httpd: parent.*"
-
 # child will not return a config parsing error to the parent
 rc_pre() {
${daemon} -n ${daemon_flags}
Index: etc/rc.d/ldpd
===
RCS file: /cvs/src/etc/rc.d/ldpd,v
retrieving revision 1.1
diff -u -p -r1.1 ldpd
--- etc/rc.d/ldpd   6 Jul 2011 18:55:36 -   1.1
+++ etc/rc.d/ldpd   1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ldpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ldpd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/npppd
===
RCS file: /cvs/src/etc/rc.d/npppd,v
retrieving revision 1.1
diff -u -p -r1.1 npppd
--- etc/rc.d/npppd  20 Sep 2012 12:51:43 -  1.1
+++ etc/rc.d/npppd  1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/npppd"
 
 . /etc/rc.d/rc.subr
 
-pexp="npppd: main"
-
 rc_cmd $1
Index: etc/rc.d/ntpd
===
RCS file: /cvs/src/etc/rc.d/ntpd,v
retrieving revision 1.2
diff -u -p -r1.2 ntpd
--- etc/rc.d/ntpd   14 Sep 2011 02:36:09 -  1.2
+++ etc/rc.d/ntpd   1 Feb 2016 13:51:58 -
@@ -6,7 +6,6 @@ daemon="/usr/sbin/ntpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ntpd: \[priv\]"
 rc_reload=NO
 
 rc_cmd $1
Index: etc/rc.d/ospf6d
===
RCS file: /cvs/src/etc/rc.d/ospf6d,v
retrieving revision 1.1
diff -u -p -r1.1 ospf6d
--- etc/rc.d/ospf6d 17 Jul 2011 00:25:58 -  1.1
+++ etc/rc.d/ospf6d 1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ospf6d"
 
 . /etc/rc.d/rc.subr
 
-pexp="ospf6d: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/ospfd
===
RCS file: /cvs/src/etc/rc.d/ospfd,v
retrieving revision 1.1
diff -u -p -r1.1 ospfd
--- etc/rc.d/ospfd  8 Jul 2011 22:20:07 -   1.1
+++ etc/rc.d/ospfd  1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ospfd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ospfd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/relayd
===
RCS file: /cvs/src/etc/rc.d/relayd,v
retrieving revision 1.2
diff -u -p -r1.2 relayd
--- etc/rc.d/relayd 19 Dec 2015 13:45:12 -  1.2
+++ etc/rc.d/relayd 1 Feb 2016 13:51:58 -
@@ -6,8 +6,6 @@ daemon="/usr/sbin/relayd"
 
 . /etc/rc.d/rc.subr
 
-pexp="relayd: parent.*"
-
 # child will not return a config parsing error to the parent
 rc_pre() {
${daemon} -n ${daemon_flags}
Index: etc/rc.d/ripd
===
RCS file: /cvs/src/etc/rc.d/ripd,v
retrieving revision 1.1
diff -u -p -r1.1 ripd
--- etc/rc.d/ripd   6 Jul 2011 18:55:36 -   1.1
+++ etc/rc.d/ripd   1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ripd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ripd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/snmpd
===
RCS file: /cvs/src/etc/rc.d/snmpd,v
retrieving revision 1.2
diff -u -p -r1.2 snmpd
--- etc/rc.d/snmpd  25 Aug 2014 12:08:55 -  1.2

Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Joerg Jung

> On 01 Feb 2016, at 14:53, Stuart Henderson  wrote:
> 
> moved from misc.
> 
> On 2016-01-28, Antoine Jacoutot  wrote:
>>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
>>> changed the tradition to setproctitle("parent").
>>> 
>>> I have no objections with changing this in the parent (but keeping the
>>> setproctitles in the children) to either the default (all command line
>>> flags) or to something like setproctitle("parent, %s", conffile).
>>> Command line flags suck and I don't think that -d or -v would be
>>> helpful in the output, so I prefer the latter.
>> 
>> "-v" is helpful at least for rc.d which needs to match the full args list by 
>> default
>> 
>>> All rc scripts would have to be adjusted by somebody with better rc-fu.
>> 
>> Actually if things are properly done, the non default pexp line in the rc.d 
>> scripts should just be removed and that's it.
>> 
> 
> Here it is for the majority of base daemons. I've left ypldap for now,
> the rc script matches "ldap client" not "parent". radiusd already leaves
> the parent process title as-is (the setproctitle("[main]") are separate
> processes).
> 
> OK?

ok jung@

What about smtpd, should be similar, no?


> Index: etc/rc.d/eigrpd
> ===
> RCS file: /cvs/src/etc/rc.d/eigrpd,v
> retrieving revision 1.2
> diff -u -p -r1.2 eigrpd
> --- etc/rc.d/eigrpd   21 Oct 2015 11:28:02 -  1.2
> +++ etc/rc.d/eigrpd   1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/eigrpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="eigrpd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/httpd
> ===
> RCS file: /cvs/src/etc/rc.d/httpd,v
> retrieving revision 1.4
> diff -u -p -r1.4 httpd
> --- etc/rc.d/httpd19 Dec 2015 13:45:12 -  1.4
> +++ etc/rc.d/httpd1 Feb 2016 13:51:58 -
> @@ -6,8 +6,6 @@ daemon="/usr/sbin/httpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="httpd: parent.*"
> -
> # child will not return a config parsing error to the parent
> rc_pre() {
>   ${daemon} -n ${daemon_flags}
> Index: etc/rc.d/ldpd
> ===
> RCS file: /cvs/src/etc/rc.d/ldpd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ldpd
> --- etc/rc.d/ldpd 6 Jul 2011 18:55:36 -   1.1
> +++ etc/rc.d/ldpd 1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ldpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ldpd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/npppd
> ===
> RCS file: /cvs/src/etc/rc.d/npppd,v
> retrieving revision 1.1
> diff -u -p -r1.1 npppd
> --- etc/rc.d/npppd20 Sep 2012 12:51:43 -  1.1
> +++ etc/rc.d/npppd1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/npppd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="npppd: main"
> -
> rc_cmd $1
> Index: etc/rc.d/ntpd
> ===
> RCS file: /cvs/src/etc/rc.d/ntpd,v
> retrieving revision 1.2
> diff -u -p -r1.2 ntpd
> --- etc/rc.d/ntpd 14 Sep 2011 02:36:09 -  1.2
> +++ etc/rc.d/ntpd 1 Feb 2016 13:51:58 -
> @@ -6,7 +6,6 @@ daemon="/usr/sbin/ntpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ntpd: \[priv\]"
> rc_reload=NO
> 
> rc_cmd $1
> Index: etc/rc.d/ospf6d
> ===
> RCS file: /cvs/src/etc/rc.d/ospf6d,v
> retrieving revision 1.1
> diff -u -p -r1.1 ospf6d
> --- etc/rc.d/ospf6d   17 Jul 2011 00:25:58 -  1.1
> +++ etc/rc.d/ospf6d   1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ospf6d"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ospf6d: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/ospfd
> ===
> RCS file: /cvs/src/etc/rc.d/ospfd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ospfd
> --- etc/rc.d/ospfd8 Jul 2011 22:20:07 -   1.1
> +++ etc/rc.d/ospfd1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ospfd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ospfd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/relayd
> ===
> RCS file: /cvs/src/etc/rc.d/relayd,v
> retrieving revision 1.2
> diff -u -p -r1.2 relayd
> --- etc/rc.d/relayd   19 Dec 2015 13:45:12 -  1.2
> +++ etc/rc.d/relayd   1 Feb 2016 13:51:58 -
> @@ -6,8 +6,6 @@ daemon="/usr/sbin/relayd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="relayd: parent.*"
> -
> # child will not return a config parsing error to the parent
> rc_pre() {
>   ${daemon} -n ${daemon_flags}
> Index: etc/rc.d/ripd
> ===
> RCS file: /cvs/src/etc/rc.d/ripd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ripd
> --- etc/rc.d/ripd 6 Jul 2011 18:55:36 -   1.1
> +++ etc/rc.d/ripd 1 Feb 2016 

Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
On 2016/02/01 15:02, Joerg Jung wrote:
> 
> > On 01 Feb 2016, at 14:53, Stuart Henderson  wrote:
> > 
> > moved from misc.
> > 
> > On 2016-01-28, Antoine Jacoutot  wrote:
> >>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
> >>> changed the tradition to setproctitle("parent").
> >>> 
> >>> I have no objections with changing this in the parent (but keeping the
> >>> setproctitles in the children) to either the default (all command line
> >>> flags) or to something like setproctitle("parent, %s", conffile).
> >>> Command line flags suck and I don't think that -d or -v would be
> >>> helpful in the output, so I prefer the latter.
> >> 
> >> "-v" is helpful at least for rc.d which needs to match the full args list 
> >> by default
> >> 
> >>> All rc scripts would have to be adjusted by somebody with better rc-fu.
> >> 
> >> Actually if things are properly done, the non default pexp line in the 
> >> rc.d scripts should just be removed and that's it.
> >> 
> > 
> > Here it is for the majority of base daemons. I've left ypldap for now,
> > the rc script matches "ldap client" not "parent". radiusd already leaves
> > the parent process title as-is (the setproctitle("[main]") are separate
> > processes).
> > 
> > OK?
> 
> ok jung@
> 
> What about smtpd, should be similar, no?

Ah yes, well spotted. Missed in my grep because setproctitle isn't
called directly with the name, but in config_process() from a string
instead.