On 2016-01-27, Antoine Jacoutot <[email protected]> wrote:
> On Wed, Jan 27, 2016 at 12:30:08PM +0100, Reyk Floeter wrote:
>> On Wed, Jan 27, 2016 at 06:12:22AM -0500, Jiri B wrote:
>> > Hi,
>> >
>> > I can't run multiple instances of httpd via rc.d as I can't distinguish
>> > between httpd instances. ps aux never show flags passed to httpd.
>> >
>> > Could httpd be extended to show flags like sshd does it?
>> >
>> > root 15681 0.0 0.1 1196 2308 ?? Ssp 12:08PM 0:00.05 httpd:
>> > parent (httpd)
>> >
>> > vs
>> >
>> > root 17247 0.0 0.1 920 1376 ?? Ss 12:09PM 0:00.03
>> > /usr/sbin/sshd -f /etc/ssh/test_sshd_config
>> >
>> > Or is there any other way to distinguish between two httpd instances?
>> >
>> > j.
>> >
>>
>> Interesting point, I never thought about it.
>
> That's not httpd specific. Most of our privilege separated daemons do that
> and it sucks :-)
This does the trick. It probably doesn't make sense to run multiple
copies of all of the privsep daemons though I see definite use cases
for httpd, snmpd [v4 and v6 need separate daemons], and possibly some
others, but it would be better to keep them all in-sync..
Index: etc/rc.d/httpd
===================================================================
RCS file: /cvs/src/etc/rc.d/httpd,v
retrieving revision 1.3
diff -u -p -r1.3 httpd
--- etc/rc.d/httpd 22 Jul 2014 17:37:16 -0000 1.3
+++ etc/rc.d/httpd 27 Jan 2016 22:22:11 -0000
@@ -6,6 +6,4 @@ daemon="/usr/sbin/httpd"
. /etc/rc.d/rc.subr
-pexp="httpd: parent.*"
-
rc_cmd $1
Index: usr.sbin/httpd/httpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/httpd.c,v
retrieving revision 1.53
diff -u -p -r1.53 httpd.c
--- usr.sbin/httpd/httpd.c 3 Dec 2015 11:46:25 -0000 1.53
+++ usr.sbin/httpd/httpd.c 27 Jan 2016 22:22:11 -0000
@@ -248,7 +248,6 @@ main(int argc, char *argv[])
proc_init(ps, procs, nitems(procs));
- setproctitle("parent");
log_procinit("parent");
if (pledge("stdio rpath wpath cpath inet dns proc ioctl sendfd",