Index | Thread | Search

From:
"Omar Polo" <op@omarpolo.com>
Subject:
Re: split daemon(3) functionality for better debugability
To:
Martijn van Duren <openbsd+tech@list.imperialat.at>
Cc:
tech@openbsd.org
Date:
Sun, 22 Feb 2026 12:08:52 +0100

Download raw body.

Thread
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>