Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statx #1181

Closed
wants to merge 7 commits into from
Closed
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libc"
version = "0.2.46"
version = "0.2.47"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b32/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,3 +610,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;
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b32/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b32/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,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;
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b64/not_x32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b64/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,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 {
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b64/sparc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b64/x32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
58 changes: 58 additions & 0 deletions src/unix/notbsd/linux/other/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,36 @@ s! {
pub rt_window: ::c_ulong,
pub rt_irtt: ::c_ushort,
}

pub struct statx {
pub stx_mask: ::uint32_t,
pub stx_blksize: ::uint32_t,
pub stx_attributes: ::uint64_t,
pub stx_nlink: ::uint32_t,
pub stx_uid: ::uint32_t,
pub stx_gid: ::uint32_t,
pub stx_mode: ::uint16_t,
pub __statx_pad1: [::uint16_t; 1],
pub stx_ino: ::uint64_t,
pub stx_size: ::uint64_t,
pub stx_blocks: ::uint64_t,
pub stx_attributes_mask: ::uint64_t,
pub stx_atime: statx_timestamp,
pub stx_btime: statx_timestamp,
pub stx_ctime: statx_timestamp,
pub stx_mtime: statx_timestamp,
pub stx_rdev_major: ::uint32_t,
pub stx_rdev_minor: ::uint32_t,
pub stx_dev_major: ::uint32_t,
pub stx_dev_minor: ::uint32_t,
pub __statx_pad2: [::uint64_t; 14],
}

pub struct statx_timestamp {
pub tv_sec: ::int64_t,
pub tv_nsec: ::uint32_t,
pub __statx_timestamp_pad1: [::int32_t; 1],
}
}

pub const __UT_LINESIZE: usize = 32;
Expand Down Expand Up @@ -837,6 +867,32 @@ pub const M_PERTURB: ::c_int = -6;
pub const M_ARENA_TEST: ::c_int = -7;
pub const M_ARENA_MAX: ::c_int = -8;

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;

#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
#[doc(hidden)]
Expand Down Expand Up @@ -870,6 +926,8 @@ extern {
pub fn endutxent();
pub fn getpt() -> ::c_int;
pub fn mallopt(param: ::c_int, value: ::c_int) -> ::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")]
Expand Down