Conversation

Christian Brauner 🦊🐺

Sigh, trying to do something with AF_UNIX sockets in Rust and it already fails at one of the basic things: specifying a listen() backlog without having to resort to an unsafe block.

3
0
0
@brauner I feel you. Some time ago, I was surprised that there was no support for SOCK_SEQPACKET in tokio's UNIX domain functionality.
Maybe there now is, though.
0
0
0

@brauner I remember wanting to receive SCM_RIGHTS file descriptors from a unix domain socket in rust, finding a rust library that actually provides sufficiently low level and extensive syscall bindings to allow receiving SCM_RIGHTS... and then discovering that this library's abstraction for file descriptors was "we just typedef it to int"

0
0
0

@brauner If you think about it, though, it is kind of a weird API to have for most use cases.
The `nix` crate provides more low level stuff including a `listen` call with backlog, though. These days it even works with the fd traits rather than integer file descriptors.

1
0
0

@wrybane I don't think specifying the listen() backlog is particularly esoteric. Afaict, the reason was that this api was somehow supposed to be platform neutral or something. That's what I understood from one of the issues I looked at at least.

1
0
0

@wrybane and for anything advanced that I want to do UnixStream is pretty useless tbh. It doesn't even really expose MSG_PEEK and MSG_WAITALL in any form. That's severly limiting for anything interesting (at least for my case).

1
0
0

@brauner yeah well, I have written wrappers with `libc` a few times already 🙃
There's also the `socket2` crate which seems popular, but I don't know how much it can do. I don't shy away from libc 😛

1
0
0

@wrybane I'm using it liberally. Very very liberal.

0
0
0