Skip to content

Commit

Permalink
CHANGELOG entry
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Oct 6, 2023
1 parent ebe84c2 commit 115e72a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ This project adheres to [Semantic Versioning](https://semver.org/).

- Simplified the function signatures of `recvmmsg` and `sendmmsg`

### Added
- Added `Icmp` and `IcmpV6` to `SockProtocol`.
(#[2103](https://github.com/nix-rust/nix/pull/2103))

- Added `F_GETPATH` FcntlFlags entry on Apple/NetBSD/DragonflyBSD for `::nix::fcntl`.
([#2142](https://github.com/nix-rust/nix/pull/2142))

- Added `Ipv6HopLimit` to `::nix::sys::socket::ControlMessage` for Linux,
MacOS, FreeBSD, DragonflyBSD, Android, iOS and Haiku.
([#2074](https://github.com/nix-rust/nix/pull/2074))

- Added `F_GETPATH_NOFIRMLINK` and `F_BARRIERFSYNC` FcntlFlags entry on Apple for `::nix::fcntl`.
([#2155](https://github.com/nix-rust/nix/pull/2155))

## [0.27.1] - 2023-08-28

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
let p = info.kf_path;
let u8_slice = slice::from_raw_parts(p.as_ptr().cast(), p.len());
let optr = CStr::from_bytes_until_nul(u8_slice).unwrap();
*path = PathBuf::from(OsString::from(optr.to_str().unwrap()));
return Ok(ok_res)
},
#[cfg(any(target_os = "macos", target_os = "ios"))]
F_GETPATH_NOFIRMLINK(path) => {
Expand Down
32 changes: 32 additions & 0 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,38 @@ fn test_f_get_path() {
);
}

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[test]
fn test_f_get_path_nofirmlink() {
use nix::fcntl::*;
use std::{os::unix::io::AsRawFd, path::PathBuf};

let tmp = NamedTempFile::new().unwrap();
let fd = tmp.as_raw_fd();
let mut path = PathBuf::new();
let res = fcntl(fd, FcntlArg::F_GETPATH_NOFIRMLINK(&mut path))
.expect("get path failed");
let mut tmpstr = String::from("/System/Volumes/Data");
tmpstr.push_str(
&tmp.path()
.canonicalize()
.unwrap()
.into_os_string()
.into_string()
.unwrap(),
);
assert_ne!(res, -1);
assert_eq!(
path.as_path()
.canonicalize()
.unwrap()
.into_os_string()
.into_string()
.unwrap(),
tmpstr
);
}

#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))]
#[test]
fn test_f_kinfo() {
Expand Down

0 comments on commit 115e72a

Please sign in to comment.