Skip to content

cmdext: Add pass_systemd_fds() for socket activation fd passing#92

Open
cgwalters wants to merge 1 commit intocoreos:mainfrom
cgwalters:add-systemd-socket-api
Open

cmdext: Add pass_systemd_fds() for socket activation fd passing#92
cgwalters wants to merge 1 commit intocoreos:mainfrom
cgwalters:add-systemd-socket-api

Conversation

@cgwalters
Copy link
Member

It's a bit too complicated to use the systemd socket protocol, let's make it simpler.

Assisted-by: OpenCode (Claude claude-opus-4-6)

We want good support for systemd LISTEN_FDS protocol, it's a bit
subtle and complex because we need to set LISTEN_PID which can
only be done via custom `setenv` right now because we don't
know the PID until post-fork obviously.

Then there's the next problem - take_fd_n is I/O safe for the parent
but not the target process - it's easy to have overlapping fds set
for the child.

To fix this add a `CmdFds` struct that is source of truth for
all child process fds (that we control) and detects conflicts and
panics. It can be constructed with a LISTEN_FDs set.

Assisted-by: OpenCode (Claude claude-opus-4-6)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters force-pushed the add-systemd-socket-api branch from b0aa7db to 94191c9 Compare March 13, 2026 21:48
@cgwalters cgwalters marked this pull request as ready for review March 13, 2026 21:48
@cgwalters cgwalters requested a review from jlebon March 13, 2026 21:48
@cgwalters cgwalters enabled auto-merge March 13, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant