Skip to content

Commit ea0847e

Browse files
committed
Make statx structs/constants available for all Linux targets
1 parent ce3d1a2 commit ea0847e

File tree

2 files changed

+59
-33
lines changed

2 files changed

+59
-33
lines changed

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ s! {
4141
__statx_pad3: [u64; 12],
4242
}
4343

44-
pub struct statx_timestamp {
45-
pub tv_sec: i64,
46-
pub tv_nsec: u32,
47-
pub __statx_timestamp_pad1: [i32; 1],
48-
}
49-
5044
pub struct aiocb {
5145
pub aio_fildes: ::c_int,
5246
pub aio_lio_opcode: ::c_int,
@@ -998,33 +992,6 @@ pub const M_PERTURB: ::c_int = -6;
998992
pub const M_ARENA_TEST: ::c_int = -7;
999993
pub const M_ARENA_MAX: ::c_int = -8;
1000994

1001-
pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
1002-
pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
1003-
pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
1004-
pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
1005-
pub const STATX_TYPE: ::c_uint = 0x0001;
1006-
pub const STATX_MODE: ::c_uint = 0x0002;
1007-
pub const STATX_NLINK: ::c_uint = 0x0004;
1008-
pub const STATX_UID: ::c_uint = 0x0008;
1009-
pub const STATX_GID: ::c_uint = 0x0010;
1010-
pub const STATX_ATIME: ::c_uint = 0x0020;
1011-
pub const STATX_MTIME: ::c_uint = 0x0040;
1012-
pub const STATX_CTIME: ::c_uint = 0x0080;
1013-
pub const STATX_INO: ::c_uint = 0x0100;
1014-
pub const STATX_SIZE: ::c_uint = 0x0200;
1015-
pub const STATX_BLOCKS: ::c_uint = 0x0400;
1016-
pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
1017-
pub const STATX_BTIME: ::c_uint = 0x0800;
1018-
pub const STATX_MNT_ID: ::c_uint = 0x1000;
1019-
pub const STATX_ALL: ::c_uint = 0x0fff;
1020-
pub const STATX__RESERVED: ::c_int = 0x80000000;
1021-
pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
1022-
pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
1023-
pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
1024-
pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
1025-
pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
1026-
pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
1027-
1028995
pub const SOMAXCONN: ::c_int = 4096;
1029996

1030997
//sys/timex.h

src/unix/linux_like/linux/mod.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,38 @@ impl ::Clone for fpos64_t {
5858
}
5959

6060
s! {
61+
pub struct statx {
62+
pub stx_mask: u32,
63+
pub stx_blksize: u32,
64+
pub stx_attributes: u64,
65+
pub stx_nlink: u32,
66+
pub stx_uid: u32,
67+
pub stx_gid: u32,
68+
pub stx_mode: u16,
69+
__statx_pad1: [u16; 1],
70+
pub stx_ino: u64,
71+
pub stx_size: u64,
72+
pub stx_blocks: u64,
73+
pub stx_attributes_mask: u64,
74+
pub stx_atime: ::statx_timestamp,
75+
pub stx_btime: ::statx_timestamp,
76+
pub stx_ctime: ::statx_timestamp,
77+
pub stx_mtime: ::statx_timestamp,
78+
pub stx_rdev_major: u32,
79+
pub stx_rdev_minor: u32,
80+
pub stx_dev_major: u32,
81+
pub stx_dev_minor: u32,
82+
pub stx_mnt_id: u64,
83+
__statx_pad2: u64,
84+
__statx_pad3: [u64; 12],
85+
}
86+
87+
pub struct statx_timestamp {
88+
pub tv_sec: i64,
89+
pub tv_nsec: u32,
90+
pub __statx_timestamp_pad1: [i32; 1],
91+
}
92+
6193
pub struct rlimit64 {
6294
pub rlim_cur: rlim64_t,
6395
pub rlim_max: rlim64_t,
@@ -1325,6 +1357,33 @@ pub const AT_HWCAP2: ::c_ulong = 26;
13251357

13261358
pub const AT_EXECFN: ::c_ulong = 31;
13271359

1360+
pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
1361+
pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
1362+
pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
1363+
pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
1364+
pub const STATX_TYPE: ::c_uint = 0x0001;
1365+
pub const STATX_MODE: ::c_uint = 0x0002;
1366+
pub const STATX_NLINK: ::c_uint = 0x0004;
1367+
pub const STATX_UID: ::c_uint = 0x0008;
1368+
pub const STATX_GID: ::c_uint = 0x0010;
1369+
pub const STATX_ATIME: ::c_uint = 0x0020;
1370+
pub const STATX_MTIME: ::c_uint = 0x0040;
1371+
pub const STATX_CTIME: ::c_uint = 0x0080;
1372+
pub const STATX_INO: ::c_uint = 0x0100;
1373+
pub const STATX_SIZE: ::c_uint = 0x0200;
1374+
pub const STATX_BLOCKS: ::c_uint = 0x0400;
1375+
pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
1376+
pub const STATX_BTIME: ::c_uint = 0x0800;
1377+
pub const STATX_MNT_ID: ::c_uint = 0x1000;
1378+
pub const STATX_ALL: ::c_uint = 0x0fff;
1379+
pub const STATX__RESERVED: ::c_int = 0x80000000;
1380+
pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
1381+
pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
1382+
pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
1383+
pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
1384+
pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
1385+
pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
1386+
13281387
pub const GLOB_ERR: ::c_int = 1 << 0;
13291388
pub const GLOB_MARK: ::c_int = 1 << 1;
13301389
pub const GLOB_NOSORT: ::c_int = 1 << 2;

0 commit comments

Comments
 (0)