Re: [PATCH 1/3] tools/router: use socket activation

Alyssa Ross
2025-12-09T10:55:26Z

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> On 12/8/25 19:38, Alyssa Ross wrote:
>> This means we can use readiness notification to wait until the sockets
>> are created without having to add special functionality for that to
>> the router program, and also means we can do extra system-specific
>> setup to the sockets, like changing their owners, outside of the
>> router.
>>
>> Since the socket paths were the only arguments taken by the router,
>> this also lets us drop the clap dependency entirely.
>
> I strongly recommend open-coding the file descriptor stuff instead
> of using a third-party library for it. It's just a two calls to
> getsockopt() (SO_DOMAIN and SO_TYPE) per socket, and listenfd pulls
> in wasm-bindgen and js-sys!

It pulls in wasm-bindgen and js-sys if you're building for those
platforms, which we are not. An inert mention in Cargo.lock is not a
problem. The only dependency of listenfd in our context (checked via
cargo tree) is on libc, which is already a dependency of tokio.

I've implemented systemd socket activation in Rust before, and it's not
at all nice, even with libsystemd. listenfd adds 295 extra lines of
code in total. I think that's worth it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]