diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 570ede87403a7..b89a6f3083574 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -12,6 +12,14 @@ pub type dev_t = u64; pub type socklen_t = u32; pub type mode_t = u32; pub type ino64_t = u64; +#[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + deprecated( + since = "0.2.187", + note = "Use `off_t` instead. This type is `#define`d as an alias to `off_t` in upstream \ + musl and support for the suffixed variants is phasing out in `libc`." + ) +)] pub type off64_t = i64; pub type blkcnt64_t = i64; pub type rlim64_t = u64; @@ -4093,7 +4101,10 @@ extern "C" { pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + #[cfg(not(any(target_env = "musl", target_env = "ohos")))] pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t; + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn readahead(fd: c_int, offset: off_t, count: size_t) -> ssize_t; pub fn getxattr( path: *const c_char, name: *const c_char, @@ -4181,7 +4192,10 @@ extern "C" { // Not available now on Android pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; + #[cfg(not(any(target_env = "musl", target_env = "ohos")))] pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int; + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn sync_file_range(fd: c_int, offset: off_t, nbytes: off_t, flags: c_uint) -> c_int; pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index ae8e4939bbcb2..934a403268ce9 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = u32; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index 9a62e4d57d6da..f60f359e6e607 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -1,7 +1,6 @@ use crate::prelude::*; pub type wchar_t = u32; -pub type stat64 = crate::stat; s! { pub struct stat { diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index 8c7ccbfc07450..154744bcdb2fe 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, @@ -140,6 +138,11 @@ s! { pub f_spare: [c_ulong; 5], } + #[deprecated( + since = "0.2.187", + note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." + )] pub struct statfs64 { pub f_type: c_ulong, pub f_bsize: c_ulong, diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index cd11a44e43cd4..20a64b34412f8 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = i32; -pub type stat64 = stat; - s! { pub struct termios { pub c_iflag: crate::tcflag_t, diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 5561dcb34d358..ef287875aed50 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -5,8 +5,6 @@ use crate::prelude::*; pub type wchar_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index 737438a594efb..338b311baa3ed 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = i32; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 9b17aaee3f16a..6ba79faa4182c 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -7,8 +7,6 @@ pub type wchar_t = u32; pub type nlink_t = u32; pub type blksize_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs index 29f7d49cc8320..011f3a1a03118 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -10,8 +10,6 @@ pub type blksize_t = c_int; pub type __u64 = c_ulonglong; pub type __s64 = c_longlong; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs index d05b40bd38a11..a18cdc2b92752 100644 --- a/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -7,8 +7,6 @@ pub type __s64 = c_long; pub type nlink_t = c_uint; pub type blksize_t = i64; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, @@ -91,6 +89,11 @@ s! { pub f_spare: [c_ulong; 5], } + #[deprecated( + since = "0.2.187", + note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." + )] pub struct statfs64 { pub f_type: c_ulong, pub f_bsize: c_ulong, diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs index 6e0d6db6a1978..59364e3405f0e 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -7,8 +7,6 @@ pub type __s64 = c_long; pub type nlink_t = u64; pub type blksize_t = c_long; -pub type stat64 = stat; - s! { pub struct termios { pub c_iflag: crate::tcflag_t, diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index ba9bebd84cc73..34c1e4e6d703b 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -10,8 +10,6 @@ pub type blksize_t = c_int; pub type __u64 = c_ulonglong; pub type __s64 = c_longlong; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index 7776e10b60dce..6fc89821c154d 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -7,8 +7,13 @@ pub type wchar_t = i32; pub type greg_t = u64; pub type __u64 = u64; pub type __s64 = i64; + +#[deprecated( + since = "0.2.187", + note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." +)] pub type statfs64 = statfs; -pub type stat64 = stat; s! { pub struct ipc_perm { diff --git a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs index 06b34c25d9238..5e3d2c6b2d612 100644 --- a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs @@ -9,8 +9,6 @@ pub type blksize_t = c_long; pub type __u64 = c_ulonglong; pub type __s64 = c_longlong; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index ec9a31bccf577..3c241f142f2ea 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -8,8 +8,6 @@ pub type __u64 = c_ulonglong; pub type __s64 = c_longlong; pub type greg_t = i64; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/lfs64.rs b/src/unix/linux_like/linux/musl/lfs64.rs index c74fb8460a02f..2d796087576ef 100644 --- a/src/unix/linux_like/linux/musl/lfs64.rs +++ b/src/unix/linux_like/linux/musl/lfs64.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use crate::off64_t; use crate::prelude::*; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 42dbd6495803c..3394edadef28f 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -1,3 +1,4 @@ +#[allow(deprecated)] use crate::off64_t; use crate::prelude::*; @@ -37,11 +38,28 @@ pub type shmatt_t = c_ulong; pub type msgqnum_t = c_ulong; pub type msglen_t = c_ulong; pub type fsblkcnt_t = c_ulonglong; -pub type fsblkcnt64_t = c_ulonglong; pub type fsfilcnt_t = c_ulonglong; -pub type fsfilcnt64_t = c_ulonglong; pub type rlim_t = c_ulonglong; +#[deprecated( + since = "0.2.187", + note = "Use `fsblkcnt64_t` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." +)] +pub type fsblkcnt64_t = c_ulonglong; +#[deprecated( + since = "0.2.187", + note = "Use `fsfilcnt64_t` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." +)] +pub type fsfilcnt64_t = c_ulonglong; +#[deprecated( + since = "0.2.187", + note = "Use `stat` instead. This type is defined as an alias to the unsuffixed type upstream, \ + and support for suffixed types is phasing out in the `libc` crate." +)] +pub type stat64 = stat; + cfg_if! { if #[cfg(doc)] { // Used in `linux::arch` to define ioctl constants. @@ -191,6 +209,11 @@ s! { __f_reserved: Padding<[c_int; 6]>, } + #[deprecated( + since = "0.2.187", + note = "Use `statvfs` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed variants is phasing out in the `libc` crate." + )] pub struct statvfs64 { pub f_bsize: c_ulong, pub f_frsize: c_ulong, @@ -232,6 +255,12 @@ s! { pub l_pid: crate::pid_t, } + #[deprecated( + since = "0.2.187", + note = "Use `flock` instead. This type is defines as an alias to the unsuffixed type \ + upstream, and support for suffixed types in the `libc` crate is phasing out." + )] + #[allow(deprecated)] pub struct flock64 { pub l_type: c_short, pub l_whence: c_short, @@ -399,6 +428,11 @@ s! { // MIPS/s390x implementation is special (see arch folders) #[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "s390x")))] + #[deprecated( + since = "0.2.187", + note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \ + upstream, and support for suffixed types is phasing out in the `libc` crate." + )] pub struct statfs64 { pub f_type: c_ulong, pub f_bsize: c_ulong, @@ -889,7 +923,14 @@ extern "C" { } // Alias to 64 to mimic glibc's LFS64 support +#[deprecated( + since = "0.2.187", + note = "Use the unsuffixed variants instead. Each of these routines is `#define`d in terms of \ + the unsuffixed variant in upstream musl, and support for suffixed aliases is phasing \ + out in the `libc` crate." +)] mod lfs64; +#[allow(deprecated)] pub use self::lfs64::*; cfg_if! { diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index 041e2525d9bc8..4dc410ededefc 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -35,6 +35,15 @@ pub type iconv_t = *mut c_void; cfg_if! { if #[cfg(not(target_env = "gnu"))] { extern_ty! { + #[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + deprecated( + since = "0.2.187", + note = "Use `fpos_t` instead. This type is defined as an alias to the \ + unsuffixed type upstream, and support for suffixed types in the `libc` \ + crate is phasing out." + ) + )] pub enum fpos64_t {} // FIXME(linux): fill this out with a struct } } @@ -290,6 +299,15 @@ s! { pub val: c_int, } + #[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + deprecated( + since = "0.2.187", + note = "Use `rlimit` instead. This type is defined upstream as an alias to the \ + unsuffixed type, and support for suffixed types is phasing out in the `libc` \ + crate." + ) + )] pub struct rlimit64 { pub rlim_cur: crate::rlim64_t, pub rlim_max: crate::rlim64_t, @@ -312,6 +330,14 @@ s! { pub d_name: [c_char; 256], } + #[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + deprecated( + since = "0.2.187", + note = "Use `dirent` instead. This type is defined in upstream musl as an alias to the \ + unsuffixed variant and the `libc` crate is phasing out support for these." + ) + )] pub struct dirent64 { pub d_ino: crate::ino64_t, pub d_off: crate::off64_t, @@ -1964,7 +1990,7 @@ extern "C" { longindex: *mut c_int, ) -> c_int; - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_env = "musl", target_env = "ohos")))] pub fn copy_file_range( fd_in: c_int, off_in: *mut crate::off64_t, @@ -1973,6 +1999,16 @@ extern "C" { len: size_t, flags: c_uint, ) -> ssize_t; + + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn copy_file_range( + fd_in: c_int, + off_in: *mut crate::off_t, + fd_out: c_int, + off_out: *mut crate::off_t, + len: size_t, + flags: c_uint, + ) -> ssize_t; } cfg_if! {