Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b32/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/unix/linux_like/linux/musl/b32/hexagon.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::prelude::*;

pub type wchar_t = u32;
pub type stat64 = crate::stat;

s! {
pub struct stat {
Expand Down
7 changes: 5 additions & 2 deletions src/unix/linux_like/linux/musl/b32/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b32/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b32/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions src/unix/linux_like/linux/musl/b64/mips64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion src/unix/linux_like/linux/musl/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/unix/linux_like/linux/musl/lfs64.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

use crate::off64_t;
use crate::prelude::*;

Expand Down
45 changes: 43 additions & 2 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(deprecated)]
use crate::off64_t;
use crate::prelude::*;

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -889,7 +923,14 @@ extern "C" {
}

// Alias <foo> to <foo>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! {
Expand Down
38 changes: 37 additions & 1 deletion src/unix/linux_like/linux_l4re_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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! {
Expand Down