Add foreground server option#2
Conversation
|
What option letters do other services use for this? We may try to be consistent. (I put some related context and thoughts in #1.) |
| switch (c) { | ||
| case 'F': | ||
| foreground++; | ||
| /* [[fallthrough]]; */ |
There was a problem hiding this comment.
What compilers recognize /* [[fallthrough]]; */?
FWIW, in LKRG we define and use this macro:
#if defined(fallthrough)
#define P_FALL_THROUGH fallthrough
#elif defined(__GNUC__) && __GNUC__ > 6
#define P_FALL_THROUGH __attribute__ ((fallthrough))
#else
#define P_FALL_THROUGH /* FALLTHROUGH */
#endifbut its #if defined(fallthrough) part is specific to the kernel. Of course, I'd rather have just a simple comment understood by compilers than introduce a macro into this project as well... or avoid the fall-through to side-step it.
In yescrypt, including its integration in libxcrypt, it's just /* FALLTHRU */, and I don't recall warning reports about that, so apparently it works pretty well.
There was a problem hiding this comment.
Heh, I initially put just [[fallthrough]] because the target compile had C23 and I thought "let's do it because I can" but then turned it into a comment for the PR here for compatibility - will take your advice!
| case -1: | ||
| return log_error("fork"); | ||
| if (!foreground) { | ||
| setsid(); |
There was a problem hiding this comment.
I wonder if we can reasonably minimize the code differences vs. LKRG logger.c here.
There was a problem hiding this comment.
I didn't get why the first (unconditional) of the two setsid() calls was there in both tools. So it's possible I was wrong to make them conditional on not being in foreground mode.
This is a good question. I agree Quite a few daemons get used with
isc-dhcp-server uses
|
New '-F' option is like '-D' but does not fork. This enables improved init system integration methods and can make up for the lack of a PID file writing option (fixes: openwall#1).
bbe3542 to
f2bdf78
Compare
|
I force-pushed a revision to my PR simply to knock off the 3 blatant errors you picked up! |
Yes, and also ... except what to do if standalone mode support is not compiled in? Default to inetd mode in that case, or refuse to run unless Given our past use of |
|
Hi,
I suspect it would be a bad plan to invert the meaning of But that doesn't mean you have to go with my And you could harmlessly add in new preferred options to explicitly select inetd mode and daemon mode and deprecate the old ways. |
Maybe this should depend on whether we're giving popa3d some maybe-final life support touches (conservative), or giving it a new life (modernized). Does a new life for a POP3-only server make sense these days (if we, say, added builtin TLS support)? Maybe not, and I see no reason to compete with Dovecot by adding IMAP. Also I don't currently have a use for popa3d myself, so am not motivated and would not dogfood it.
I currently don't have a better idea, and you found one precedent of |
This sounds like the realistic perspective to me! 😁
Might be worth ensuring this builds with C23/gcc-15 as part of the drop. |
New '-F' option is like '-D' but does not fork. This enables improved init system integration methods and can make up for the lack of a PID file writing option (fixes: #1).