Download raw body.
split daemon(3) functionality for better debugability
On Sun, Feb 22, 2026 at 12:08:52PM +0100, Omar Polo wrote: > Hello Martijn, > > Martijn van Duren <openbsd+tech@list.imperialat.at> wrote: > > [... cutting the mail because it was mangled :p ...] > > I'm a bit on the fence on this as well. I've been bitten by this as > well, and in general I think it's weird to using daemon(3) in smtpd (and > from the look of it radiusd as well, but i've never used it). > > If we want to keep the "daemonization" in the program, I agree that a > two-step process like the one you suggest is needed, and having some > code to share (even just by copy-paste) between radiusd and smtpd seems > nice to me. > > I still have to look at the implementation in detail, but at least as a > general direction, assuming again that we want to keep smtpd detaching > on its own, I think it's fine. > > <madness> > > For fairness tho, I have to say that while we were talking about this > I've thought multiple times "what if we just drop *gasp!* the forking in > the background in smtpd?" Instead of piling more code to fix the > problem, we could just always keep it running in the foreground, set > rc_bg=YES in the rc.d file, all with a net-negative diff I'd guess. > > (it's not *that* simple, I know, but it's not terribly hard either) > > I think that there are just two ways of running smtpd, and both will > continue to work just fine (except that there would no longer be a need > for -d) > > - rcctl (re)start smtpd, or > - smtpd -dv for debugging > > </madness> In general you can adjust your daemons to call daemon(3) once it is clear it will have a good chance to run. This is what e.g. bgpd does. The initial configuration is loaded before daemon(3) calls and so the simple problems are quickly noticed. Sure there are cases where this does not work but things like config loads can be moved up with little problems. I seriously hate daemons that don't call daemon. Those are not daemons, those are sloopy programs that would like to be long running but fail to do it correctly. -- :wq Claudio
split daemon(3) functionality for better debugability