Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diod: do not daemonize, do not syslog #130

Merged
merged 6 commits into from
Jan 19, 2025
Merged

Conversation

garlick
Copy link
Member

@garlick garlick commented Jan 19, 2025

Since systemd (and probably other pid ones) can manage daemons running in the foreground and capture stderr, drop diod's capability to daemonize and log to syslog to keep things simple.

As a bonus it avoid the unexpected WTF? when you manually rundiod and nothing apparently happens (because it backgrounded itself).

Problem: diod_sock.c defined some globals for TCP Wrappers, but
support for it was removed so they are now unused.

Drop the unused globals.
Problem: diod can log directly to syslog, but these days that can be
handled in other ways.

For example, stderr is typically redirected to the systemd journal,
which can be redirected to syslog.

Drop the direct syslog logging capability from diod.
Drop syslog.h from several source files.
Update unit test.
Problem: logging to syslog is deprecated but man pages still
describe it, and it appears in the example config file.

Drop syslog from the man pages.
Change the example log config to a filename.
Problem: diod puts itself in the background by default, but this
can be confusing and unexpected when running the service manually.

In fact, given that systemd can manage daemons running in the
foreground, it is probably no longer useful at all.

Drop the --foreground option and never daemonize.
Update tests.
Problem: diod dropped its --foreground option but the man page
still describes it.

Drop it from the man page.
Problem: diod now runs in the foreground, but systemd thinks it is
going to fork.

Change to Type=exec.

See also systemd.exec(5).
Copy link
Member

@grondo grondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I guess diod is only used on Linux?

@garlick
Copy link
Member Author

garlick commented Jan 19, 2025

LGTM! I guess diod is only used on Linux?

People do run diod on FreeBSD (or have in the past) and in busy box environments where there is no systemd. However I don't think that poses a problem:

I should have noted that in the description, so thanks for bringing it up. There is also the fact that philosophically speaking 9P is about as far as you can get from the "toss it all in" apparent guiding principle of systemd so I wouldn't want to imply that it's required for diod!

@grondo
Copy link
Member

grondo commented Jan 19, 2025

Thanks for the clarification!

@mergify mergify bot merged commit 1420354 into chaos:master Jan 19, 2025
5 checks passed
@garlick garlick deleted the no_syslog branch January 19, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants