1b8a62b91Sopenharmony_ci//! Automatically enable “large file” support features. 2b8a62b91Sopenharmony_ci 3b8a62b91Sopenharmony_ci#[cfg(not(windows))] 4b8a62b91Sopenharmony_ciuse super::c; 5b8a62b91Sopenharmony_ci 6b8a62b91Sopenharmony_ci#[cfg(not(any( 7b8a62b91Sopenharmony_ci windows, 8b8a62b91Sopenharmony_ci target_os = "android", 9b8a62b91Sopenharmony_ci target_os = "emscripten", 10b8a62b91Sopenharmony_ci target_os = "l4re", 11b8a62b91Sopenharmony_ci target_os = "linux", 12b8a62b91Sopenharmony_ci)))] 13b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 14b8a62b91Sopenharmony_cipub(super) use c::{ 15b8a62b91Sopenharmony_ci fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, lseek as libc_lseek, 16b8a62b91Sopenharmony_ci off_t as libc_off_t, 17b8a62b91Sopenharmony_ci}; 18b8a62b91Sopenharmony_ci 19b8a62b91Sopenharmony_ci#[cfg(any( 20b8a62b91Sopenharmony_ci target_os = "android", 21b8a62b91Sopenharmony_ci target_os = "emscripten", 22b8a62b91Sopenharmony_ci target_os = "l4re", 23b8a62b91Sopenharmony_ci target_os = "linux", 24b8a62b91Sopenharmony_ci))] 25b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 26b8a62b91Sopenharmony_cipub(super) use c::{ 27b8a62b91Sopenharmony_ci fstat64 as libc_fstat, fstatat64 as libc_fstatat, ftruncate64 as libc_ftruncate, 28b8a62b91Sopenharmony_ci lseek64 as libc_lseek, off64_t as libc_off_t, 29b8a62b91Sopenharmony_ci}; 30b8a62b91Sopenharmony_ci 31b8a62b91Sopenharmony_ci#[cfg(any( 32b8a62b91Sopenharmony_ci target_os = "android", 33b8a62b91Sopenharmony_ci target_os = "emscripten", 34b8a62b91Sopenharmony_ci target_os = "l4re", 35b8a62b91Sopenharmony_ci target_os = "linux", 36b8a62b91Sopenharmony_ci))] 37b8a62b91Sopenharmony_cipub(super) use c::rlimit64 as libc_rlimit; 38b8a62b91Sopenharmony_ci 39b8a62b91Sopenharmony_ci#[cfg(not(any( 40b8a62b91Sopenharmony_ci windows, 41b8a62b91Sopenharmony_ci target_os = "android", 42b8a62b91Sopenharmony_ci target_os = "emscripten", 43b8a62b91Sopenharmony_ci target_os = "l4re", 44b8a62b91Sopenharmony_ci target_os = "linux", 45b8a62b91Sopenharmony_ci target_os = "wasi", 46b8a62b91Sopenharmony_ci)))] 47b8a62b91Sopenharmony_ci#[cfg(feature = "mm")] 48b8a62b91Sopenharmony_cipub(super) use c::mmap as libc_mmap; 49b8a62b91Sopenharmony_ci 50b8a62b91Sopenharmony_ci#[cfg(not(any( 51b8a62b91Sopenharmony_ci windows, 52b8a62b91Sopenharmony_ci target_os = "android", 53b8a62b91Sopenharmony_ci target_os = "emscripten", 54b8a62b91Sopenharmony_ci target_os = "fuchsia", 55b8a62b91Sopenharmony_ci target_os = "l4re", 56b8a62b91Sopenharmony_ci target_os = "linux", 57b8a62b91Sopenharmony_ci target_os = "redox", 58b8a62b91Sopenharmony_ci target_os = "wasi", 59b8a62b91Sopenharmony_ci)))] 60b8a62b91Sopenharmony_cipub(super) use c::{rlimit as libc_rlimit, RLIM_INFINITY as LIBC_RLIM_INFINITY}; 61b8a62b91Sopenharmony_ci 62b8a62b91Sopenharmony_ci#[cfg(not(any( 63b8a62b91Sopenharmony_ci windows, 64b8a62b91Sopenharmony_ci target_os = "android", 65b8a62b91Sopenharmony_ci target_os = "fuchsia", 66b8a62b91Sopenharmony_ci target_os = "emscripten", 67b8a62b91Sopenharmony_ci target_os = "l4re", 68b8a62b91Sopenharmony_ci target_os = "linux", 69b8a62b91Sopenharmony_ci target_os = "wasi", 70b8a62b91Sopenharmony_ci)))] 71b8a62b91Sopenharmony_cipub(super) use c::{getrlimit as libc_getrlimit, setrlimit as libc_setrlimit}; 72b8a62b91Sopenharmony_ci 73b8a62b91Sopenharmony_ci// TODO: Add `RLIM64_INFINITY` to upstream libc. 74b8a62b91Sopenharmony_ci#[cfg(any( 75b8a62b91Sopenharmony_ci target_os = "android", 76b8a62b91Sopenharmony_ci target_os = "linux", 77b8a62b91Sopenharmony_ci target_os = "emscripten", 78b8a62b91Sopenharmony_ci target_os = "l4re", 79b8a62b91Sopenharmony_ci))] 80b8a62b91Sopenharmony_cipub(super) const LIBC_RLIM_INFINITY: u64 = !0_u64; 81b8a62b91Sopenharmony_ci 82b8a62b91Sopenharmony_ci#[cfg(any( 83b8a62b91Sopenharmony_ci target_os = "android", 84b8a62b91Sopenharmony_ci target_os = "linux", 85b8a62b91Sopenharmony_ci target_os = "emscripten", 86b8a62b91Sopenharmony_ci target_os = "l4re", 87b8a62b91Sopenharmony_ci))] 88b8a62b91Sopenharmony_cipub(super) use c::{getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit}; 89b8a62b91Sopenharmony_ci 90b8a62b91Sopenharmony_ci#[cfg(any( 91b8a62b91Sopenharmony_ci target_os = "android", 92b8a62b91Sopenharmony_ci target_os = "linux", 93b8a62b91Sopenharmony_ci target_os = "emscripten", 94b8a62b91Sopenharmony_ci target_os = "l4re", 95b8a62b91Sopenharmony_ci))] 96b8a62b91Sopenharmony_ci#[cfg(feature = "mm")] 97b8a62b91Sopenharmony_cipub(super) use c::mmap64 as libc_mmap; 98b8a62b91Sopenharmony_ci 99b8a62b91Sopenharmony_ci// `prlimit64` wasn't supported in glibc until 2.13. 100b8a62b91Sopenharmony_ci#[cfg(all(target_os = "linux", target_env = "gnu"))] 101b8a62b91Sopenharmony_ciweak_or_syscall! { 102b8a62b91Sopenharmony_ci fn prlimit64( 103b8a62b91Sopenharmony_ci pid: c::pid_t, 104b8a62b91Sopenharmony_ci resource: c::__rlimit_resource_t, 105b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 106b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64 107b8a62b91Sopenharmony_ci ) via SYS_prlimit64 -> c::c_int 108b8a62b91Sopenharmony_ci} 109b8a62b91Sopenharmony_ci#[cfg(all(target_os = "linux", target_env = "musl"))] 110b8a62b91Sopenharmony_ciweak_or_syscall! { 111b8a62b91Sopenharmony_ci fn prlimit64( 112b8a62b91Sopenharmony_ci pid: c::pid_t, 113b8a62b91Sopenharmony_ci resource: c::c_int, 114b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 115b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64 116b8a62b91Sopenharmony_ci ) via SYS_prlimit64 -> c::c_int 117b8a62b91Sopenharmony_ci} 118b8a62b91Sopenharmony_ci#[cfg(target_os = "android")] 119b8a62b91Sopenharmony_ciweak_or_syscall! { 120b8a62b91Sopenharmony_ci fn prlimit64( 121b8a62b91Sopenharmony_ci pid: c::pid_t, 122b8a62b91Sopenharmony_ci resource: c::c_int, 123b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 124b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64 125b8a62b91Sopenharmony_ci ) via SYS_prlimit64 -> c::c_int 126b8a62b91Sopenharmony_ci} 127b8a62b91Sopenharmony_ci#[cfg(all(target_os = "linux", target_env = "gnu"))] 128b8a62b91Sopenharmony_cipub(super) unsafe fn libc_prlimit( 129b8a62b91Sopenharmony_ci pid: c::pid_t, 130b8a62b91Sopenharmony_ci resource: c::__rlimit_resource_t, 131b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 132b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64, 133b8a62b91Sopenharmony_ci) -> c::c_int { 134b8a62b91Sopenharmony_ci prlimit64(pid, resource, new_limit, old_limit) 135b8a62b91Sopenharmony_ci} 136b8a62b91Sopenharmony_ci#[cfg(all(target_os = "linux", target_env = "musl"))] 137b8a62b91Sopenharmony_cipub(super) unsafe fn libc_prlimit( 138b8a62b91Sopenharmony_ci pid: c::pid_t, 139b8a62b91Sopenharmony_ci resource: c::c_int, 140b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 141b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64, 142b8a62b91Sopenharmony_ci) -> c::c_int { 143b8a62b91Sopenharmony_ci prlimit64(pid, resource, new_limit, old_limit) 144b8a62b91Sopenharmony_ci} 145b8a62b91Sopenharmony_ci#[cfg(target_os = "android")] 146b8a62b91Sopenharmony_cipub(super) unsafe fn libc_prlimit( 147b8a62b91Sopenharmony_ci pid: c::pid_t, 148b8a62b91Sopenharmony_ci resource: c::c_int, 149b8a62b91Sopenharmony_ci new_limit: *const c::rlimit64, 150b8a62b91Sopenharmony_ci old_limit: *mut c::rlimit64, 151b8a62b91Sopenharmony_ci) -> c::c_int { 152b8a62b91Sopenharmony_ci prlimit64(pid, resource, new_limit, old_limit) 153b8a62b91Sopenharmony_ci} 154b8a62b91Sopenharmony_ci 155b8a62b91Sopenharmony_ci#[cfg(not(any( 156b8a62b91Sopenharmony_ci windows, 157b8a62b91Sopenharmony_ci target_os = "android", 158b8a62b91Sopenharmony_ci target_os = "linux", 159b8a62b91Sopenharmony_ci target_os = "emscripten", 160b8a62b91Sopenharmony_ci target_os = "l4re", 161b8a62b91Sopenharmony_ci target_os = "redox", 162b8a62b91Sopenharmony_ci)))] 163b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 164b8a62b91Sopenharmony_cipub(super) use c::openat as libc_openat; 165b8a62b91Sopenharmony_ci#[cfg(any( 166b8a62b91Sopenharmony_ci target_os = "android", 167b8a62b91Sopenharmony_ci target_os = "linux", 168b8a62b91Sopenharmony_ci target_os = "emscripten", 169b8a62b91Sopenharmony_ci target_os = "l4re", 170b8a62b91Sopenharmony_ci))] 171b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 172b8a62b91Sopenharmony_cipub(super) use c::openat64 as libc_openat; 173b8a62b91Sopenharmony_ci 174b8a62b91Sopenharmony_ci#[cfg(target_os = "fuchsia")] 175b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 176b8a62b91Sopenharmony_cipub(super) use c::fallocate as libc_fallocate; 177b8a62b91Sopenharmony_ci#[cfg(any(target_os = "android", target_os = "linux"))] 178b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 179b8a62b91Sopenharmony_cipub(super) use c::fallocate64 as libc_fallocate; 180b8a62b91Sopenharmony_ci#[cfg(not(any( 181b8a62b91Sopenharmony_ci windows, 182b8a62b91Sopenharmony_ci target_os = "android", 183b8a62b91Sopenharmony_ci target_os = "dragonfly", 184b8a62b91Sopenharmony_ci target_os = "emscripten", 185b8a62b91Sopenharmony_ci target_os = "haiku", 186b8a62b91Sopenharmony_ci target_os = "illumos", 187b8a62b91Sopenharmony_ci target_os = "ios", 188b8a62b91Sopenharmony_ci target_os = "linux", 189b8a62b91Sopenharmony_ci target_os = "l4re", 190b8a62b91Sopenharmony_ci target_os = "macos", 191b8a62b91Sopenharmony_ci target_os = "netbsd", 192b8a62b91Sopenharmony_ci target_os = "openbsd", 193b8a62b91Sopenharmony_ci target_os = "redox", 194b8a62b91Sopenharmony_ci target_os = "solaris", 195b8a62b91Sopenharmony_ci)))] 196b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 197b8a62b91Sopenharmony_cipub(super) use c::posix_fadvise as libc_posix_fadvise; 198b8a62b91Sopenharmony_ci#[cfg(any( 199b8a62b91Sopenharmony_ci target_os = "android", 200b8a62b91Sopenharmony_ci target_os = "emscripten", 201b8a62b91Sopenharmony_ci target_os = "linux", 202b8a62b91Sopenharmony_ci target_os = "l4re", 203b8a62b91Sopenharmony_ci))] 204b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 205b8a62b91Sopenharmony_cipub(super) use c::posix_fadvise64 as libc_posix_fadvise; 206b8a62b91Sopenharmony_ci 207b8a62b91Sopenharmony_ci#[cfg(all(not(any( 208b8a62b91Sopenharmony_ci windows, 209b8a62b91Sopenharmony_ci target_os = "android", 210b8a62b91Sopenharmony_ci target_os = "linux", 211b8a62b91Sopenharmony_ci target_os = "emscripten", 212b8a62b91Sopenharmony_ci))))] 213b8a62b91Sopenharmony_cipub(super) use c::{pread as libc_pread, pwrite as libc_pwrite}; 214b8a62b91Sopenharmony_ci#[cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten"))] 215b8a62b91Sopenharmony_cipub(super) use c::{pread64 as libc_pread, pwrite64 as libc_pwrite}; 216b8a62b91Sopenharmony_ci#[cfg(any(target_os = "linux", target_os = "emscripten"))] 217b8a62b91Sopenharmony_cipub(super) use c::{preadv64 as libc_preadv, pwritev64 as libc_pwritev}; 218b8a62b91Sopenharmony_ci#[cfg(target_os = "android")] 219b8a62b91Sopenharmony_cimod readwrite_pv64 { 220b8a62b91Sopenharmony_ci use super::c; 221b8a62b91Sopenharmony_ci 222b8a62b91Sopenharmony_ci // 64-bit offsets on 32-bit platforms are passed in endianness-specific 223b8a62b91Sopenharmony_ci // lo/hi pairs. See src/backend/linux_raw/conv.rs for details. 224b8a62b91Sopenharmony_ci #[cfg(all(target_endian = "little", target_pointer_width = "32"))] 225b8a62b91Sopenharmony_ci fn lo(x: u64) -> usize { 226b8a62b91Sopenharmony_ci (x >> 32) as usize 227b8a62b91Sopenharmony_ci } 228b8a62b91Sopenharmony_ci #[cfg(all(target_endian = "little", target_pointer_width = "32"))] 229b8a62b91Sopenharmony_ci fn hi(x: u64) -> usize { 230b8a62b91Sopenharmony_ci (x & 0xffff_ffff) as usize 231b8a62b91Sopenharmony_ci } 232b8a62b91Sopenharmony_ci #[cfg(all(target_endian = "big", target_pointer_width = "32"))] 233b8a62b91Sopenharmony_ci fn lo(x: u64) -> usize { 234b8a62b91Sopenharmony_ci (x & 0xffff_ffff) as usize 235b8a62b91Sopenharmony_ci } 236b8a62b91Sopenharmony_ci #[cfg(all(target_endian = "big", target_pointer_width = "32"))] 237b8a62b91Sopenharmony_ci fn hi(x: u64) -> usize { 238b8a62b91Sopenharmony_ci (x >> 32) as usize 239b8a62b91Sopenharmony_ci } 240b8a62b91Sopenharmony_ci 241b8a62b91Sopenharmony_ci pub(in super::super) unsafe fn preadv64( 242b8a62b91Sopenharmony_ci fd: c::c_int, 243b8a62b91Sopenharmony_ci iov: *const c::iovec, 244b8a62b91Sopenharmony_ci iovcnt: c::c_int, 245b8a62b91Sopenharmony_ci offset: c::off64_t, 246b8a62b91Sopenharmony_ci ) -> c::ssize_t { 247b8a62b91Sopenharmony_ci // Older Android libc lacks `preadv64`, so use the `weak!` mechanism to 248b8a62b91Sopenharmony_ci // test for it, and call back to `c::syscall`. We don't use 249b8a62b91Sopenharmony_ci // `weak_or_syscall` here because we need to pass the 64-bit offset 250b8a62b91Sopenharmony_ci // specially. 251b8a62b91Sopenharmony_ci weak! { 252b8a62b91Sopenharmony_ci fn preadv64(c::c_int, *const c::iovec, c::c_int, c::off64_t) -> c::ssize_t 253b8a62b91Sopenharmony_ci } 254b8a62b91Sopenharmony_ci if let Some(fun) = preadv64.get() { 255b8a62b91Sopenharmony_ci fun(fd, iov, iovcnt, offset) 256b8a62b91Sopenharmony_ci } else { 257b8a62b91Sopenharmony_ci #[cfg(target_pointer_width = "32")] 258b8a62b91Sopenharmony_ci { 259b8a62b91Sopenharmony_ci c::syscall( 260b8a62b91Sopenharmony_ci c::SYS_preadv, 261b8a62b91Sopenharmony_ci fd, 262b8a62b91Sopenharmony_ci iov, 263b8a62b91Sopenharmony_ci iovcnt, 264b8a62b91Sopenharmony_ci hi(offset as u64), 265b8a62b91Sopenharmony_ci lo(offset as u64), 266b8a62b91Sopenharmony_ci ) as c::ssize_t 267b8a62b91Sopenharmony_ci } 268b8a62b91Sopenharmony_ci #[cfg(target_pointer_width = "64")] 269b8a62b91Sopenharmony_ci { 270b8a62b91Sopenharmony_ci c::syscall(c::SYS_preadv, fd, iov, iovcnt, offset) as c::ssize_t 271b8a62b91Sopenharmony_ci } 272b8a62b91Sopenharmony_ci } 273b8a62b91Sopenharmony_ci } 274b8a62b91Sopenharmony_ci pub(in super::super) unsafe fn pwritev64( 275b8a62b91Sopenharmony_ci fd: c::c_int, 276b8a62b91Sopenharmony_ci iov: *const c::iovec, 277b8a62b91Sopenharmony_ci iovcnt: c::c_int, 278b8a62b91Sopenharmony_ci offset: c::off64_t, 279b8a62b91Sopenharmony_ci ) -> c::ssize_t { 280b8a62b91Sopenharmony_ci // See the comments in `preadv64`. 281b8a62b91Sopenharmony_ci weak! { 282b8a62b91Sopenharmony_ci fn pwritev64(c::c_int, *const c::iovec, c::c_int, c::off64_t) -> c::ssize_t 283b8a62b91Sopenharmony_ci } 284b8a62b91Sopenharmony_ci if let Some(fun) = pwritev64.get() { 285b8a62b91Sopenharmony_ci fun(fd, iov, iovcnt, offset) 286b8a62b91Sopenharmony_ci } else { 287b8a62b91Sopenharmony_ci #[cfg(target_pointer_width = "32")] 288b8a62b91Sopenharmony_ci { 289b8a62b91Sopenharmony_ci c::syscall( 290b8a62b91Sopenharmony_ci c::SYS_pwritev, 291b8a62b91Sopenharmony_ci fd, 292b8a62b91Sopenharmony_ci iov, 293b8a62b91Sopenharmony_ci iovcnt, 294b8a62b91Sopenharmony_ci hi(offset as u64), 295b8a62b91Sopenharmony_ci lo(offset as u64), 296b8a62b91Sopenharmony_ci ) as c::ssize_t 297b8a62b91Sopenharmony_ci } 298b8a62b91Sopenharmony_ci #[cfg(target_pointer_width = "64")] 299b8a62b91Sopenharmony_ci { 300b8a62b91Sopenharmony_ci c::syscall(c::SYS_pwritev, fd, iov, iovcnt, offset) as c::ssize_t 301b8a62b91Sopenharmony_ci } 302b8a62b91Sopenharmony_ci } 303b8a62b91Sopenharmony_ci } 304b8a62b91Sopenharmony_ci} 305b8a62b91Sopenharmony_ci#[cfg(not(any( 306b8a62b91Sopenharmony_ci windows, 307b8a62b91Sopenharmony_ci target_os = "android", 308b8a62b91Sopenharmony_ci target_os = "emscripten", 309b8a62b91Sopenharmony_ci target_os = "haiku", 310b8a62b91Sopenharmony_ci target_os = "ios", 311b8a62b91Sopenharmony_ci target_os = "linux", 312b8a62b91Sopenharmony_ci target_os = "macos", 313b8a62b91Sopenharmony_ci target_os = "redox", 314b8a62b91Sopenharmony_ci target_os = "solaris", 315b8a62b91Sopenharmony_ci)))] 316b8a62b91Sopenharmony_cipub(super) use c::{preadv as libc_preadv, pwritev as libc_pwritev}; 317b8a62b91Sopenharmony_ci#[cfg(target_os = "android")] 318b8a62b91Sopenharmony_cipub(super) use readwrite_pv64::{preadv64 as libc_preadv, pwritev64 as libc_pwritev}; 319b8a62b91Sopenharmony_ci// macOS added preadv and pwritev in version 11.0 320b8a62b91Sopenharmony_ci#[cfg(any(target_os = "ios", target_os = "macos"))] 321b8a62b91Sopenharmony_cimod readwrite_pv { 322b8a62b91Sopenharmony_ci use super::c; 323b8a62b91Sopenharmony_ci 324b8a62b91Sopenharmony_ci weakcall! { 325b8a62b91Sopenharmony_ci pub(in super::super) fn preadv( 326b8a62b91Sopenharmony_ci fd: c::c_int, 327b8a62b91Sopenharmony_ci iov: *const c::iovec, 328b8a62b91Sopenharmony_ci iovcnt: c::c_int, 329b8a62b91Sopenharmony_ci offset: c::off_t 330b8a62b91Sopenharmony_ci ) -> c::ssize_t 331b8a62b91Sopenharmony_ci } 332b8a62b91Sopenharmony_ci weakcall! { 333b8a62b91Sopenharmony_ci pub(in super::super) fn pwritev( 334b8a62b91Sopenharmony_ci fd: c::c_int, 335b8a62b91Sopenharmony_ci iov: *const c::iovec, 336b8a62b91Sopenharmony_ci iovcnt: c::c_int, offset: c::off_t 337b8a62b91Sopenharmony_ci ) -> c::ssize_t 338b8a62b91Sopenharmony_ci } 339b8a62b91Sopenharmony_ci} 340b8a62b91Sopenharmony_ci#[cfg(all(target_os = "linux", target_env = "gnu"))] 341b8a62b91Sopenharmony_cipub(super) use c::{preadv64v2 as libc_preadv2, pwritev64v2 as libc_pwritev2}; 342b8a62b91Sopenharmony_ci#[cfg(any(target_os = "ios", target_os = "macos"))] 343b8a62b91Sopenharmony_cipub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev}; 344b8a62b91Sopenharmony_ci 345b8a62b91Sopenharmony_ci#[cfg(not(any( 346b8a62b91Sopenharmony_ci windows, 347b8a62b91Sopenharmony_ci target_os = "aix", 348b8a62b91Sopenharmony_ci target_os = "android", 349b8a62b91Sopenharmony_ci target_os = "dragonfly", 350b8a62b91Sopenharmony_ci target_os = "fuchsia", 351b8a62b91Sopenharmony_ci target_os = "illumos", 352b8a62b91Sopenharmony_ci target_os = "ios", 353b8a62b91Sopenharmony_ci target_os = "linux", 354b8a62b91Sopenharmony_ci target_os = "l4re", 355b8a62b91Sopenharmony_ci target_os = "macos", 356b8a62b91Sopenharmony_ci target_os = "netbsd", 357b8a62b91Sopenharmony_ci target_os = "openbsd", 358b8a62b91Sopenharmony_ci target_os = "redox", 359b8a62b91Sopenharmony_ci target_os = "solaris", 360b8a62b91Sopenharmony_ci)))] 361b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 362b8a62b91Sopenharmony_cipub(super) use c::posix_fallocate as libc_posix_fallocate; 363b8a62b91Sopenharmony_ci#[cfg(target_os = "l4re")] 364b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 365b8a62b91Sopenharmony_cipub(super) use c::posix_fallocate64 as libc_posix_fallocate; 366b8a62b91Sopenharmony_ci#[cfg(not(any( 367b8a62b91Sopenharmony_ci windows, 368b8a62b91Sopenharmony_ci target_os = "android", 369b8a62b91Sopenharmony_ci target_os = "emscripten", 370b8a62b91Sopenharmony_ci target_os = "haiku", 371b8a62b91Sopenharmony_ci target_os = "illumos", 372b8a62b91Sopenharmony_ci target_os = "linux", 373b8a62b91Sopenharmony_ci target_os = "l4re", 374b8a62b91Sopenharmony_ci target_os = "netbsd", 375b8a62b91Sopenharmony_ci target_os = "redox", 376b8a62b91Sopenharmony_ci target_os = "solaris", 377b8a62b91Sopenharmony_ci target_os = "wasi", 378b8a62b91Sopenharmony_ci)))] 379b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 380b8a62b91Sopenharmony_cipub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs}; 381b8a62b91Sopenharmony_ci#[cfg(not(any( 382b8a62b91Sopenharmony_ci windows, 383b8a62b91Sopenharmony_ci target_os = "android", 384b8a62b91Sopenharmony_ci target_os = "emscripten", 385b8a62b91Sopenharmony_ci target_os = "haiku", 386b8a62b91Sopenharmony_ci target_os = "illumos", 387b8a62b91Sopenharmony_ci target_os = "linux", 388b8a62b91Sopenharmony_ci target_os = "l4re", 389b8a62b91Sopenharmony_ci target_os = "redox", 390b8a62b91Sopenharmony_ci target_os = "solaris", 391b8a62b91Sopenharmony_ci target_os = "wasi", 392b8a62b91Sopenharmony_ci)))] 393b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 394b8a62b91Sopenharmony_cipub(super) use {c::fstatvfs as libc_fstatvfs, c::statvfs as libc_statvfs}; 395b8a62b91Sopenharmony_ci 396b8a62b91Sopenharmony_ci#[cfg(any( 397b8a62b91Sopenharmony_ci target_os = "android", 398b8a62b91Sopenharmony_ci target_os = "linux", 399b8a62b91Sopenharmony_ci target_os = "emscripten", 400b8a62b91Sopenharmony_ci target_os = "l4re", 401b8a62b91Sopenharmony_ci))] 402b8a62b91Sopenharmony_ci#[cfg(feature = "fs")] 403b8a62b91Sopenharmony_cipub(super) use { 404b8a62b91Sopenharmony_ci c::fstatfs64 as libc_fstatfs, c::fstatvfs64 as libc_fstatvfs, c::statfs64 as libc_statfs, 405b8a62b91Sopenharmony_ci c::statvfs64 as libc_statvfs, 406b8a62b91Sopenharmony_ci}; 407