On Tue, Nov 23, 2004 at 10:15:58AM +0000, Matt Massie wrote: > thanks for submitting this bug fix but i'm not sure what problem it > solves. the code that you have submitted below would not close all file > descriptor after fork but rather would only close 0,1 and 2 > (stdin,stdout,stderr). are you saying that kvm_read() passed data over > a file descriptor? if so, i think the right solution is to run > daemon_init() BEFORE we run metric_init(). in the past, we ran > metric_init() first because some operating system required that gmond > initialize as root (before it setuid to another user e.g. "nobody"). > > i'm CC:ing the developers to double check but i'm pretty sure we don't > need gmond to start as root anymore. if i don't here objections from > the other developers, i'm going to solve this problem by forking/setuid > BEFORE metric_init in order that the kvm_read descriptor doesn't get > closed (assuming that is the problem).
You can fork any time you want, but metric_init must be run as root on FreeBSD and we must keep the file descripter returned by libkvm open after that. We'll eventually be able to get rid of this requirement (hopefully in FreeBSD 6.x), but for now we're stuck with it. I haven't looked at it, but if the current code is closing all file descriptors any time after metric_init, then FreeBSD won't work. -- Brooks
pgpSiKCGlnQsk.pgp
Description: PGP signature