json_stream_format_queue() drains queued output items into the output buffer and stages their fds in n_output_fds, relying on the downstream sendmsg() to deliver bytes-and-ancillary atomically as one SCM_RIGHTS message. If the output buffer already holds bytes (from a prior fast-path enqueue that hasn't been sent yet or from a partial write), concatenating a new fd-bearing item's JSON into it means the next sendmsg() ships the combined bytes with those fds attached — violating the per-message fd boundary on transports where that boundary is load-bearing. Bail out of the drain loop when we would cross that boundary, so the next write() first sends the buffered bytes with no ancillary, then pulls the fd-bearing item into a clean buffer and ships it on its own sendmsg. This only produces an observable difference for SOCK_SEQPACKET / SOCK_DGRAM consumers: on those transports each sendmsg() is its own datagram with its own SCM_RIGHTS cmsg, so whether we concatenate matters. On AF_UNIX SOCK_STREAM (today's sole consumer shape, used by sd-varlink and the QMP client) the kernel absorbs a preceding non-scm skb forward into the next scm-bearing skb's recv, so per-sendmsg separation is invisible to the receiver anyway — the guard is cheap defensive sender hygiene there, not a behaviour change. It becomes load- bearing the moment a SEQPACKET/DGRAM consumer wires JsonStream up.
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
