Skip to content

Commit

Permalink
linux add FICLONE* ioctl.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Sep 19, 2022
1 parent 6eee580 commit 152bb49
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/semver/linux-gnu-x86_64.txt
@@ -1,3 +1,5 @@
FICLONE
FICLONERANGE
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -2909,6 +2909,7 @@ ff_rumble_effect
ff_trigger
fgetpos64
fgetxattr
file_clone_range
flistxattr
fmemopen
fopen64
Expand Down
7 changes: 7 additions & 0 deletions src/unix/linux_like/linux/arch/generic/mod.rs
Expand Up @@ -104,6 +104,13 @@ cfg_if! {
pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
}
}

cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
pub const FICLONE: ::c_ulong = 0x40049409;
pub const FICLONERANGE: ::c_ulong = 0x4020940D;
}
}
// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;

Expand Down
7 changes: 7 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Expand Up @@ -596,6 +596,13 @@ s! {
pub nla_len: u16,
pub nla_type: u16,
}

pub struct file_clone_range {
pub src_fd: ::__s64,
pub src_offset: ::__u64,
pub src_length: ::__u64,
pub dest_offset: ::__u64,
}
}

s_no_extra_traits! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b32/mod.rs
Expand Up @@ -3,6 +3,7 @@ pub type c_ulong = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;
pub type regoff_t = ::c_int;

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
@@ -1,5 +1,6 @@
pub type c_char = u8;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;
pub type wchar_t = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_int;
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/mips64.rs
@@ -1,6 +1,7 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub type __u64 = ::c_ulong;
pub type __s64 = ::c_long;
pub type nlink_t = u64;
pub type blksize_t = i64;

Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/powerpc64.rs
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type wchar_t = i32;
pub type __u64 = ::c_ulong;
pub type __s64 = ::c_long;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;

Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
Expand Up @@ -8,6 +8,7 @@ pub type blksize_t = ::c_int;
pub type fsblkcnt64_t = ::c_ulong;
pub type fsfilcnt64_t = ::c_ulong;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct pthread_attr_t {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/s390x.rs
Expand Up @@ -4,6 +4,7 @@ pub type nlink_t = u64;
pub type wchar_t = i32;
pub type greg_t = u64;
pub type __u64 = u64;
pub type __s64 = i64;

s! {
pub struct ipc_perm {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
Expand Up @@ -3,6 +3,7 @@ pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;
pub type greg_t = i64;

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/uclibc/arm/mod.rs
Expand Up @@ -19,6 +19,7 @@ pub type blkcnt_t = ::c_long;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct cmsghdr {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/uclibc/x86_64/mod.rs
Expand Up @@ -20,6 +20,7 @@ pub type wchar_t = ::c_int;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = ::c_ulong;
pub type __s64 = ::c_long;

s! {
pub struct ipc_perm {
Expand Down

0 comments on commit 152bb49

Please sign in to comment.