summaryrefslogtreecommitdiff
path: root/src/sys/epoll.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-12-09 16:43:33 +0000
committerGitHub <noreply@github.com>2022-12-09 16:43:33 +0000
commit3d3e6b9fa0d182bc04866373ed0b077a5c77560b (patch)
treeb428b818ced4254c20e069ba3a539771a52812e0 /src/sys/epoll.rs
parente11646ebf461a2d89b678e34f34e3675ef109efe (diff)
parent9d743300aedaa81b49c6d71a4bcfb6ef354d3f52 (diff)
parentab5c032e42b4296603263140276f5202b6ea538b (diff)
parenta0e39af194726b0ff77c5f50242b8754a542f6d6 (diff)
parent8772cde9b84e0ab9103f9a8c97d6be7455d7873f (diff)
parentf592678301e30fa51b0149ca37f42b5c7ea5657e (diff)
downloadnix-3d3e6b9fa0d182bc04866373ed0b077a5c77560b.zip
Merge #1913 #1926 #1927 #1931 #1933
1913: feat: I/O safety for 'sys/inotify' r=asomers a=SteveLauC #### What this PR does: 1. Changes the `fd` field of `struct Inotify` from `RawFd` to `OwnedFd` 2. Changes the interfaces of functions in the `impl Inotify {}` > The type of `self` changes from `Self` to `&mut Self`. From: ```rust pub fn add_watch<P: ?Sized + NixPath>( self, path: &P, mask: AddWatchFlags, ) -> Result<WatchDescriptor> pub fn rm_watch(self, wd: WatchDescriptor) -> Result<()> pub fn read_events(self) -> Result<Vec<InotifyEvent>> ``` To: ```rust pub fn add_watch<P: ?Sized + NixPath>( &mut self, path: &P, mask: AddWatchFlags, ) -> Result<WatchDescriptor> pub fn rm_watch(&mut self, wd: WatchDescriptor) -> Result<()> pub fn read_events(&mut self) -> Result<Vec<InotifyEvent>> ``` In the previous implementation, these functions can take `self` by value as `struct Inotify` [was `Copy`](https://docs.rs/nix/latest/nix/sys/inotify/struct.Inotify.html#impl-Copy-for-Inotify). With the changes in `1` applied, `struct Inotify` is no longer `Copy`, so we have to take `self` by reference. ------- Blocks until the merge of #1863 as this PR needs `read(2)` to be I/O-safe. 1926: feat: I/O safety for 'sys/sendfile' r=asomers a=SteveLauC #### What this PR does: 1. Adds I/O safety for module `sys/sendfile`. 1927: feat: I/O safety for 'sys/statvfs' r=asomers a=SteveLauC #### What this PR does: 1. Adds I/O safety for module `sys/statvfs`. 1931: feat: I/O safety for 'sys/uid' & 'sched' r=asomers a=SteveLauC #### What this PR does: Adds I/O safety for modules: 1. `sys/uio` 2. `sched` 1933: feat: I/O safety for 'sys/timerfd' r=asomers a=SteveLauC #### What this PR does: 1. Adds I/O safety for module `sys/timerfd`. Co-authored-by: Steve Lau <stevelauc@outlook.com>