authorgravatar for dev@sgregoratto.meStephen Gregoratto <dev@sgregoratto.me> 2025-10-17 14:41:54+11:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-12-14 01:41:47+01:00
logff3fd950a74ab8ea8907a62dbf880eae08232417
tree751686a13d8b75a89de6185d2ca4edded6970075
parentc13857e504f5893cabf182dde1e826131f2acf24

Linux: Update `Statx` structure

Also removes the blank lines between members, and a comptime sizeOf check.

1 files changed, 43 insertions(+), 36 deletions(-)

lib/std/os/linux.zig+43-36
...@@ -6963,73 +6963,80 @@ pub const STATX_ATTR_ENCRYPTED = 0x0800;...@@ -6963,73 +6963,80 @@ pub const STATX_ATTR_ENCRYPTED = 0x0800;
6963pub const STATX_ATTR_AUTOMOUNT = 0x1000;6963pub const STATX_ATTR_AUTOMOUNT = 0x1000;
69646964
6965pub const statx_timestamp = extern struct {6965pub const statx_timestamp = extern struct {
6966 /// Number of seconds before or after `1970-01-01T00:00:00Z`.
6966 sec: i64,6967 sec: i64,
6968 /// Number of nanoseconds (0..999,999,999) after `sec`.
6967 nsec: u32,6969 nsec: u32,
6970 // Reserved for future increases in resolution.
6968 __pad1: u32,6971 __pad1: u32,
6969};6972};
69706973
6971/// Renamed to `Statx` to not conflict with the `statx` function.6974/// Renamed to `Statx` to not conflict with the `statx` function.
6972pub const Statx = extern struct {6975pub const Statx = extern struct {
6973 /// Mask of bits indicating filled fields6976 /// Mask of bits indicating filled fields.
6974 mask: u32,6977 mask: u32,
69756978 /// Block size for filesystem I/O.
6976 /// Block size for filesystem I/O
6977 blksize: u32,6979 blksize: u32,
69786980 /// Extra file attribute indicators.
6979 /// Extra file attribute indicators
6980 attributes: u64,6981 attributes: u64,
69816982 /// Number of hard links.
6982 /// Number of hard links
6983 nlink: u32,6983 nlink: u32,
69846984 /// User ID of owner.
6985 /// User ID of owner
6986 uid: uid_t,6985 uid: uid_t,
69876986 /// Group ID of owner.
6988 /// Group ID of owner
6989 gid: gid_t,6987 gid: gid_t,
69906988 /// File type and mode.
6991 /// File type and mode
6992 mode: u16,6989 mode: u16,
6993 __pad1: u16,6990 __spare0: u16,
69946991 /// Inode number.
6995 /// Inode number
6996 ino: u64,6992 ino: u64,
69976993 /// Total size in bytes.
6998 /// Total size in bytes
6999 size: u64,6994 size: u64,
70006995 /// Number of 512B blocks allocated.
7001 /// Number of 512B blocks allocated
7002 blocks: u64,6996 blocks: u64,
7003
7004 /// Mask to show what's supported in `attributes`.6997 /// Mask to show what's supported in `attributes`.
7005 attributes_mask: u64,6998 attributes_mask: u64,
70066999 /// Last access file timestamp.
7007 /// Last access file timestamp
7008 atime: statx_timestamp,7000 atime: statx_timestamp,
70097001 /// Creation file timestamp.
7010 /// Creation file timestamp
7011 btime: statx_timestamp,7002 btime: statx_timestamp,
70127003 /// Last status change file timestamp.
7013 /// Last status change file timestamp
7014 ctime: statx_timestamp,7004 ctime: statx_timestamp,
70157005 /// Last modification file timestamp.
7016 /// Last modification file timestamp
7017 mtime: statx_timestamp,7006 mtime: statx_timestamp,
7018
7019 /// Major ID, if this file represents a device.7007 /// Major ID, if this file represents a device.
7020 rdev_major: u32,7008 rdev_major: u32,
7021
7022 /// Minor ID, if this file represents a device.7009 /// Minor ID, if this file represents a device.
7023 rdev_minor: u32,7010 rdev_minor: u32,
7024
7025 /// Major ID of the device containing the filesystem where this file resides.7011 /// Major ID of the device containing the filesystem where this file resides.
7026 dev_major: u32,7012 dev_major: u32,
7027
7028 /// Minor ID of the device containing the filesystem where this file resides.7013 /// Minor ID of the device containing the filesystem where this file resides.
7029 dev_minor: u32,7014 dev_minor: u32,
70307015 /// Mount ID
7031 __pad2: [14]u64,7016 mnt_id: u64,
7032};7017 /// Memory buffer alignment for direct I/O.
7018 dio_mem_align: u32,
7019 /// File offset alignment for direct I/O.
7020 dio_offset_align: u32,
7021 /// Subvolume identifier.
7022 subvol: u64,
7023 /// Min atomic write unit in bytes.
7024 atomic_write_unit_min: u32,
7025 /// Max atomic write unit in bytes.
7026 atomic_write_unit_max: u32,
7027 /// Max atomic write segment count.
7028 atomic_write_segments_max: u32,
7029 /// File offset alignment for direct I/O reads.
7030 dio_read_offset_align: u32,
7031 /// Optimised max atomic write unit in bytes.
7032 atomic_write_unit_max_opt: u32,
7033 __spare2: [1]u32,
7034 __spare3: [8]u64,
7035};
7036
7037comptime {
7038 assert(@sizeOf(Statx) == 0x100);
7039}
70337040
7034pub const addrinfo = extern struct {7041pub const addrinfo = extern struct {
7035 flags: AI,7042 flags: AI,