#![allow(unused_imports)]
#![allow(dead_code)]
use super::*;
#[cfg(target_os = "macos")]
const _PC_MIN_HOLE_SIZE: i32 = 27;
pub(crate) fn fd_min_hole_size(file: &File) -> std::io::Result<u64> {
let fd = file.as_raw_fd();
let long = unsafe { libc::fpathconf(fd, _PC_MIN_HOLE_SIZE) };
if long == -1 {
return Err(std::io::Error::last_os_error());
}
Ok(long.try_into().unwrap())
}
pub(crate) fn path_min_hole_size(path: &Path) -> std::io::Result<u64> {
let path: crate::cpathbuf::CPathBuf = path.try_into()?;
let long = unsafe { libc::pathconf(path.as_ptr(), _PC_MIN_HOLE_SIZE) };
if long == -1 {
return Err(std::io::Error::last_os_error());
}
Ok(long.try_into().unwrap())
}