summaryrefslogtreecommitdiff
path: root/src/sys/event.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-12-10 18:19:27 +0000
committerGitHub <noreply@github.com>2022-12-10 18:19:27 +0000
commitdf5877c46a2b2d1aad6069b8ab8c9d1961a1650b (patch)
tree5a3283e699c1e04f67048c09323cf062d0024397 /src/sys/event.rs
parent8ecd7bc4c4318669efc4f34115d7fe3fca456f5f (diff)
parent147ed3f610287c061e88c5eddf66b2173f87c81f (diff)
downloadnix-df5877c46a2b2d1aad6069b8ab8c9d1961a1650b.zip
Merge #1874
1874: signalfd optional file descriptor r=asomers a=JonathanWoollett-Light [`sys::signalfd::signalfd`](https://docs.rs/nix/latest/nix/sys/signalfd/fn.signalfd.html) currently takes a `RawFd` for its `fd` argument. Considering from [the documentation](https://man7.org/linux/man-pages/man2/signalfd.2.html): > If the fd argument is -1, then the call creates a new file descriptor and associates the signal set specified in mask with that file descriptor. If fd is not -1, then it must specify a valid existing signalfd file descriptor, and mask is used to replace the signal set associated with that file descriptor. We can better pass the argument as `Option<BorrowedFd>` which encodes the optional nature of this parameter in an option rather than the value being -1 (invalid) (`size_of::<Option<BorrowedFd>>() == size_of::<RawFd>() == 4`). This removes the error case where `fd < -1`. > EBADF The fd file descriptor is not a valid file descriptor. This does however require additional changes to produce a cohesive implementation, notably changing the type within `Signal` from `RawFd` to `ManuallyDrop<OwnedFd>`, this has no functional affect, but illustrates ownership and allows the type to more easily produce `BorrowedFd`s. To use [`BorrowedFd`](https://doc.rust-lang.org/stable/std/os/unix/io/struct.BorrowedFd.html) requires updating the MSRV to `>= 1.63.0` Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
Diffstat (limited to 'src/sys/event.rs')
0 files changed, 0 insertions, 0 deletions