summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-29 15:56:14 +0000
committerbors <bors@rust-lang.org>2019-05-29 15:56:14 +0000
commite66b2a875825a8b510b835a8fe2baae7ec525e75 (patch)
tree508d1586043003a17278c832ad8c4ba187695521
parent3c903c8d3c5aa4514fa22a00694033dc8a15f19f (diff)
parentbf1ab2b6a1900e50b10d3a7846b2e72b55510aa7 (diff)
downloadrust-libc-e66b2a875825a8b510b835a8fe2baae7ec525e75.tar.gz
Auto merge of #1378 - gnzlbg:statx, r=gnzlbg
Add statx on Linux Closes #1178.
-rw-r--r--libc-test/build.rs5
-rw-r--r--src/unix/notbsd/linux/other/b32/arm.rs1
-rw-r--r--src/unix/notbsd/linux/other/b32/powerpc.rs1
-rw-r--r--src/unix/notbsd/linux/other/b32/x86.rs1
-rw-r--r--src/unix/notbsd/linux/other/b64/not_x32.rs1
-rw-r--r--src/unix/notbsd/linux/other/b64/powerpc64.rs1
-rw-r--r--src/unix/notbsd/linux/other/b64/sparc64.rs1
-rw-r--r--src/unix/notbsd/linux/other/b64/x32.rs1
-rw-r--r--src/unix/notbsd/linux/other/mod.rs58
9 files changed, 70 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index b199d1cfbc..5087906486 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1860,6 +1860,7 @@ fn test_linux(target: &str) {
let x32 = target.contains("x32");
let mips = target.contains("mips");
let mips32_musl = mips && !target.contains("64") && musl;
+ let sparc64 = target.contains("sparc64");
let mut cfg = ctest::TestGenerator::new();
cfg.define("_GNU_SOURCE", None);
@@ -2193,6 +2194,10 @@ fn test_linux(target: &str) {
// https://github.com/gnzlbg/ctest/issues/68
"lio_listio" if musl => true,
+ // FIXME: the glibc version used by the Sparc64 build jobs
+ // which use Debian 10.0 is too old.
+ "statx" if sparc64 => true,
+
_ => false,
}
});
diff --git a/src/unix/notbsd/linux/other/b32/arm.rs b/src/unix/notbsd/linux/other/b32/arm.rs
index 8396fcd501..d058fc451e 100644
--- a/src/unix/notbsd/linux/other/b32/arm.rs
+++ b/src/unix/notbsd/linux/other/b32/arm.rs
@@ -607,3 +607,4 @@ pub const SYS_pwritev2: ::c_long = 393;
pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
+pub const SYS_statx: ::c_long = 397;
diff --git a/src/unix/notbsd/linux/other/b32/powerpc.rs b/src/unix/notbsd/linux/other/b32/powerpc.rs
index d609d67923..d6a1919cd5 100644
--- a/src/unix/notbsd/linux/other/b32/powerpc.rs
+++ b/src/unix/notbsd/linux/other/b32/powerpc.rs
@@ -612,3 +612,4 @@ pub const SYS_copy_file_range: ::c_long = 379;
pub const SYS_preadv2: ::c_long = 380;
pub const SYS_pwritev2: ::c_long = 381;
pub const SYS_kexec_file_load: ::c_long = 382;
+pub const SYS_statx: ::c_long = 383;
diff --git a/src/unix/notbsd/linux/other/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs
index 6ccbfbbdb1..ff5abcfe6d 100644
--- a/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/src/unix/notbsd/linux/other/b32/x86.rs
@@ -840,6 +840,7 @@ pub const SYS_pwritev2: ::c_long = 379;
pub const SYS_pkey_mprotect: ::c_long = 380;
pub const SYS_pkey_alloc: ::c_long = 381;
pub const SYS_pkey_free: ::c_long = 382;
+pub const SYS_statx: ::c_long = 383;
// offsets in user_regs_structs, from sys/reg.h
pub const EBX: ::c_int = 0;
diff --git a/src/unix/notbsd/linux/other/b64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs
index e3e449807f..97e21f279d 100644
--- a/src/unix/notbsd/linux/other/b64/not_x32.rs
+++ b/src/unix/notbsd/linux/other/b64/not_x32.rs
@@ -408,6 +408,7 @@ pub const SYS_pwritev2: ::c_long = 328;
pub const SYS_pkey_mprotect: ::c_long = 329;
pub const SYS_pkey_alloc: ::c_long = 330;
pub const SYS_pkey_free: ::c_long = 331;
+pub const SYS_statx: ::c_long = 332;
#[link(name = "util")]
extern {
diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs
index 89f5ca15f7..645cd908ed 100644
--- a/src/unix/notbsd/linux/other/b64/powerpc64.rs
+++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs
@@ -921,6 +921,7 @@ pub const SYS_copy_file_range: ::c_long = 379;
pub const SYS_preadv2: ::c_long = 380;
pub const SYS_pwritev2: ::c_long = 381;
pub const SYS_kexec_file_load: ::c_long = 382;
+pub const SYS_statx: ::c_long = 383;
#[link(name = "util")]
extern {
diff --git a/src/unix/notbsd/linux/other/b64/sparc64.rs b/src/unix/notbsd/linux/other/b64/sparc64.rs
index 7c1362711e..f54504aea0 100644
--- a/src/unix/notbsd/linux/other/b64/sparc64.rs
+++ b/src/unix/notbsd/linux/other/b64/sparc64.rs
@@ -855,6 +855,7 @@ pub const SYS_mlock2: ::c_long = 356;
pub const SYS_copy_file_range: ::c_long = 357;
pub const SYS_preadv2: ::c_long = 358;
pub const SYS_pwritev2: ::c_long = 359;
+pub const SYS_statx: ::c_long = 360;
#[link(name = "util")]
extern {
diff --git a/src/unix/notbsd/linux/other/b64/x32.rs b/src/unix/notbsd/linux/other/b64/x32.rs
index d88dbafed8..37468818af 100644
--- a/src/unix/notbsd/linux/other/b64/x32.rs
+++ b/src/unix/notbsd/linux/other/b64/x32.rs
@@ -336,6 +336,7 @@ pub const SYS_copy_file_range: ::c_long = __X32_SYSCALL_BIT + 326;
pub const SYS_pkey_mprotect: ::c_long = __X32_SYSCALL_BIT + 329;
pub const SYS_pkey_alloc: ::c_long = __X32_SYSCALL_BIT + 330;
pub const SYS_pkey_free: ::c_long = __X32_SYSCALL_BIT + 331;
+pub const SYS_statx: ::c_long = __X32_SYSCALL_BIT + 332;
pub const SYS_rt_sigaction: ::c_long = __X32_SYSCALL_BIT + 512;
pub const SYS_rt_sigreturn: ::c_long = __X32_SYSCALL_BIT + 513;
pub const SYS_ioctl: ::c_long = __X32_SYSCALL_BIT + 514;
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index c875fa1006..33e92d5616 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -3,6 +3,36 @@ pub type __priority_which_t = ::c_uint;
pub type __rlimit_resource_t = ::c_uint;
s! {
+ pub struct statx {
+ pub stx_mask: u32,
+ pub stx_blksize: u32,
+ pub stx_attributes: u64,
+ pub stx_nlink: u32,
+ pub stx_uid: u32,
+ pub stx_gid: u32,
+ pub stx_mode: u16,
+ pub __statx_pad1: [u16; 1],
+ pub stx_ino: u64,
+ pub stx_size: u64,
+ pub stx_blocks: u64,
+ pub stx_attributes_mask: u64,
+ pub stx_atime: ::statx_timestamp,
+ pub stx_btime: ::statx_timestamp,
+ pub stx_ctime: ::statx_timestamp,
+ pub stx_mtime: ::statx_timestamp,
+ pub stx_rdev_major: u32,
+ pub stx_rdev_minor: u32,
+ pub stx_dev_major: u32,
+ pub stx_dev_minor: u32,
+ pub __statx_pad2: [u64; 14],
+ }
+
+ pub struct statx_timestamp {
+ pub tv_sec: i64,
+ pub tv_nsec: u32,
+ pub __statx_timestamp_pad1: [i32; 1],
+ }
+
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_lio_opcode: ::c_int,
@@ -942,6 +972,32 @@ pub const AF_MAX: ::c_int = 45;
#[allow(deprecated)]
pub const PF_MAX: ::c_int = AF_MAX;
+pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
+pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
+pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
+pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
+pub const STATX_TYPE: ::c_uint = 0x0001;
+pub const STATX_MODE: ::c_uint = 0x0002;
+pub const STATX_NLINK: ::c_uint = 0x0004;
+pub const STATX_UID: ::c_uint = 0x0008;
+pub const STATX_GID: ::c_uint = 0x0010;
+pub const STATX_ATIME: ::c_uint = 0x0020;
+pub const STATX_MTIME: ::c_uint = 0x0040;
+pub const STATX_CTIME: ::c_uint = 0x0080;
+pub const STATX_INO: ::c_uint = 0x0100;
+pub const STATX_SIZE: ::c_uint = 0x0200;
+pub const STATX_BLOCKS: ::c_uint = 0x0400;
+pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
+pub const STATX_BTIME: ::c_uint = 0x0800;
+pub const STATX_ALL: ::c_uint = 0x0fff;
+pub const STATX__RESERVED: ::c_int = 0x80000000;
+pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
+pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
+pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
+pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
+pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
+pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
+
cfg_if! {
if #[cfg(any(target_arch = "arm", target_arch = "x86",
target_arch = "x86_64"))] {
@@ -992,6 +1048,8 @@ extern {
pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval,
tz: *mut ::timezone) -> ::c_int;
+ pub fn statx(dirfd: ::c_int, pathname: *const c_char, flags: ::c_int,
+ mask: ::c_uint, statxbuf: *mut statx) -> ::c_int;
}
#[link(name = "util")]