summaryrefslogtreecommitdiffstats
path: root/third_party/rust/nix/src/sys/inotify.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/nix/src/sys/inotify.rs
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/nix/src/sys/inotify.rs')
-rw-r--r--third_party/rust/nix/src/sys/inotify.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/third_party/rust/nix/src/sys/inotify.rs b/third_party/rust/nix/src/sys/inotify.rs
index e5fe930f49..9cbeb53973 100644
--- a/third_party/rust/nix/src/sys/inotify.rs
+++ b/third_party/rust/nix/src/sys/inotify.rs
@@ -143,7 +143,9 @@ impl Inotify {
pub fn init(flags: InitFlags) -> Result<Inotify> {
let res = Errno::result(unsafe { libc::inotify_init1(flags.bits()) });
- res.map(|fd| Inotify { fd: unsafe { OwnedFd::from_raw_fd(fd) } })
+ res.map(|fd| Inotify {
+ fd: unsafe { OwnedFd::from_raw_fd(fd) },
+ })
}
/// Adds a new watch on the target file or directory.
@@ -157,7 +159,11 @@ impl Inotify {
mask: AddWatchFlags,
) -> Result<WatchDescriptor> {
let res = path.with_nix_path(|cstr| unsafe {
- libc::inotify_add_watch(self.fd.as_raw_fd(), cstr.as_ptr(), mask.bits())
+ libc::inotify_add_watch(
+ self.fd.as_raw_fd(),
+ cstr.as_ptr(),
+ mask.bits(),
+ )
})?;
Errno::result(res).map(|wd| WatchDescriptor { wd })
@@ -202,7 +208,7 @@ impl Inotify {
let mut event = MaybeUninit::<libc::inotify_event>::uninit();
ptr::copy_nonoverlapping(
buffer.as_ptr().add(offset),
- event.as_mut_ptr() as *mut u8,
+ event.as_mut_ptr().cast(),
(BUFSIZ - offset).min(header_size),
);
event.assume_init()
@@ -237,7 +243,9 @@ impl Inotify {
impl FromRawFd for Inotify {
unsafe fn from_raw_fd(fd: RawFd) -> Self {
- Inotify { fd: OwnedFd::from_raw_fd(fd) }
+ Inotify {
+ fd: unsafe { OwnedFd::from_raw_fd(fd) },
+ }
}
}