Skip to content

Add safe fdset macros rules - #263

Merged
nunoplopes merged 1 commit into
Cpp2Rust:masterfrom
lucic71:fdset
Jul 18, 2026
Merged

Add safe fdset macros rules#263
nunoplopes merged 1 commit into
Cpp2Rust:masterfrom
lucic71:fdset

Conversation

@lucic71

@lucic71 lucic71 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Nix also contains a FdSet, but its semantics are too strict for mechanical translation: https://docs.rs/nix/latest/nix/sys/select/struct.FdSet.html

nix::FdSet has lifetime attached and the methods insert/remove/etc take a BorrowedFd, not a raw integer. This is too strict for the C semantics.

Instead, in C, you can modify the fd set in whichever way you want, and only a later call to select will validate if the fd set is in a valid state or not.

To fix this limitation I added CFdSet which behaves like the C version of fd set.

@nunoplopes
nunoplopes merged commit b33bdc3 into Cpp2Rust:master Jul 18, 2026
9 checks passed
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.

2 participants