Closed g2p closed 3 years ago
Thanks for this and sorry for the poor state this library was in :-(.
Wait, I'm not sure about the u32
fds. They're signed in the POSIX API, right? I'm thinking that picking std::os::unix::io::RawFd
might not be a bad idea.
Thanks for the prompt reply!
They are signed because libc functions can use negative values for errors. (Same for pids and errnos in the other commit) On the Rust side, there's no reason they should be negative. Anyway, the parsing should definitely expect something positive, overly large values are handled by the try_into in fd_cloexec, and the fcntl calls ensure that they are all already-valid file descriptors.
Yeah, good point about the errors in the C API.
Still, I'm inclined to use RawFd
since you can pass them directly to e.g. <File as FromRawFd>::from_raw_fd
.
Well, currently sd-notify doesn't open them, and that makes sense (they may be files, sockets, pipes…). The return value is just a count.
(or, return an impl Iter<RawFd>
? idk, it's a different approach)
No, I think it's fine. Published to crates.io, thanks again!
Hello! I wanted to use listen_fds in another crate, and found a few things that could be fixed. This should be a version bump since some of the types have changed from signed to unsigned.