diff options
Diffstat (limited to 'third_party/rust/nix/src/lib.rs')
-rw-r--r-- | third_party/rust/nix/src/lib.rs | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/third_party/rust/nix/src/lib.rs b/third_party/rust/nix/src/lib.rs index af0c67b0f3..dffac29b54 100644 --- a/third_party/rust/nix/src/lib.rs +++ b/third_party/rust/nix/src/lib.rs @@ -12,6 +12,7 @@ //! * `dir` - Stuff relating to directory iteration //! * `env` - Manipulate environment variables //! * `event` - Event-driven APIs, like `kqueue` and `epoll` +//! * `fanotify` - Linux's `fanotify` filesystem events monitoring API //! * `feature` - Query characteristics of the OS at runtime //! * `fs` - File system functionality //! * `hostname` - Get and set the system's hostname @@ -41,7 +42,6 @@ //! * `zerocopy` - APIs like `sendfile` and `copy_file_range` #![crate_name = "nix"] #![cfg(unix)] -#![cfg_attr(docsrs, doc(cfg(all())))] #![allow(non_camel_case_types)] #![cfg_attr(test, deny(warnings))] #![recursion_limit = "500"] @@ -54,6 +54,7 @@ feature = "dir", feature = "env", feature = "event", + feature = "fanotify", feature = "feature", feature = "fs", feature = "hostname", @@ -90,6 +91,7 @@ #![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] #![deny(clippy::cast_ptr_alignment)] +#![deny(unsafe_op_in_unsafe_fn)] // Re-exported external crates pub use libc; @@ -116,42 +118,29 @@ feature! { #[deny(missing_docs)] pub mod features; } -#[allow(missing_docs)] pub mod fcntl; feature! { #![feature = "net"] - #[cfg(any(target_os = "android", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "ios", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "illumos", - target_os = "openbsd"))] + #[cfg(any(linux_android, + bsd, + solarish))] #[deny(missing_docs)] pub mod ifaddrs; #[cfg(not(target_os = "redox"))] #[deny(missing_docs)] pub mod net; } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(linux_android)] feature! { #![feature = "kmod"] - #[allow(missing_docs)] pub mod kmod; } feature! { #![feature = "mount"] pub mod mount; } -#[cfg(any( - target_os = "dragonfly", - target_os = "freebsd", - target_os = "linux", - target_os = "netbsd" -))] +#[cfg(any(freebsdlike, target_os = "linux", target_os = "netbsd"))] feature! { #![feature = "mqueue"] pub mod mqueue; @@ -173,7 +162,6 @@ feature! { pub mod sys; feature! { #![feature = "time"] - #[allow(missing_docs)] pub mod time; } // This can be implemented for other platforms as soon as libc @@ -192,9 +180,11 @@ feature! { #[allow(missing_docs)] pub mod ucontext; } -#[allow(missing_docs)] pub mod unistd; +#[cfg(any(feature = "poll", feature = "event"))] +mod poll_timeout; + use std::ffi::{CStr, CString, OsStr}; use std::mem::MaybeUninit; use std::os::unix::ffi::OsStrExt; @@ -311,7 +301,7 @@ impl NixPath for [u8] { } let mut buf = MaybeUninit::<[u8; MAX_STACK_ALLOCATION]>::uninit(); - let buf_ptr = buf.as_mut_ptr() as *mut u8; + let buf_ptr = buf.as_mut_ptr().cast(); unsafe { ptr::copy_nonoverlapping(self.as_ptr(), buf_ptr, self.len()); |