diff --git a/changelog/2300.added.md b/changelog/2300.added.md new file mode 100644 index 0000000000..964733df5c --- /dev/null +++ b/changelog/2300.added.md @@ -0,0 +1 @@ +Added `F_OFD_SETLK`, `F_OFD_SETLKW`, and `F_OFD_GETLK` fcntl commands on macOS diff --git a/src/fcntl.rs b/src/fcntl.rs index 6504c1dcf2..da991889d5 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -751,15 +751,15 @@ pub enum FcntlArg<'a> { /// Get the first lock that blocks the lock description F_GETLK(&'a mut libc::flock), /// Acquire or release an open file description lock - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_SETLK(&'a libc::flock), /// Like [`F_OFD_SETLK`] except that if a conflicting lock is held on /// the file, then wait for that lock to be released. - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_SETLKW(&'a libc::flock), /// Determine whether it would be possible to create the given lock. If not, return details /// about one existing lock that would prevent it. - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_GETLK(&'a mut libc::flock), /// Add seals to the file #[cfg(any( @@ -879,11 +879,11 @@ pub fn fcntl(fd: Fd, arg: FcntlArg) -> Result { F_SETLKW(flock) => libc::fcntl(fd, libc::F_SETLKW, flock), #[cfg(not(target_os = "redox"))] F_GETLK(flock) => libc::fcntl(fd, libc::F_GETLK, flock), - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_SETLK(flock) => libc::fcntl(fd, libc::F_OFD_SETLK, flock), - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_SETLKW(flock) => libc::fcntl(fd, libc::F_OFD_SETLKW, flock), - #[cfg(linux_android)] + #[cfg(any(linux_android, macos))] F_OFD_GETLK(flock) => libc::fcntl(fd, libc::F_OFD_GETLK, flock), #[cfg(any( linux_android, diff --git a/src/sys/select.rs b/src/sys/select.rs index b15fab886d..7a2faf8f63 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -3,7 +3,6 @@ use crate::errno::Errno; use crate::sys::time::{TimeSpec, TimeVal}; use crate::Result; use libc::{self, c_int}; -use std::convert::TryFrom; use std::iter::FusedIterator; use std::mem; use std::ops::Range; diff --git a/test/test_sendfile.rs b/test/test_sendfile.rs index ab50a1d040..8d2c50b845 100644 --- a/test/test_sendfile.rs +++ b/test/test_sendfile.rs @@ -159,10 +159,10 @@ fn test_sendfile_dragonfly() { fn test_sendfile_darwin() { // Declare the content let header_strings = - vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; + ["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; let body = "Xabcdef123456"; let body_offset = 1; - let trailer_strings = vec!["\n", "Served by Make Believe\n"]; + let trailer_strings = ["\n", "Served by Make Believe\n"]; // Write the body to a file let mut tmp = tempfile().unwrap();