diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-10-12 14:55:02 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2019-10-12 20:51:51 +0200 |
| commit | 40fc7a1fdac23b1799ebce69c2a65236886bc360 (patch) | |
| tree | 724e184f57ab33daa05aa94959e5017dfd35d8a0 /lib/std/os/bits/linux.zig | |
| parent | 8b45921664c8f679c8154b45add84f84e3ec8128 (diff) | |
| download | zig-40fc7a1fdac23b1799ebce69c2a65236886bc360.tar.gz zig-40fc7a1fdac23b1799ebce69c2a65236886bc360.zip | |
Add support for the statx syscall
Diffstat (limited to 'lib/std/os/bits/linux.zig')
| -rw-r--r-- | lib/std/os/bits/linux.zig | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig index 5ed5c0b622..0d70a6bcaa 100644 --- a/lib/std/os/bits/linux.zig +++ b/lib/std/os/bits/linux.zig @@ -1293,3 +1293,81 @@ pub const utsname = extern struct { domainname: [65]u8, }; pub const HOST_NAME_MAX = 64; + +pub const STATX_TYPE = 0x0001; +pub const STATX_MODE = 0x0002; +pub const STATX_NLINK = 0x0004; +pub const STATX_UID = 0x0008; +pub const STATX_GID = 0x0010; +pub const STATX_ATIME = 0x0020; +pub const STATX_MTIME = 0x0040; +pub const STATX_CTIME = 0x0080; +pub const STATX_INO = 0x0100; +pub const STATX_SIZE = 0x0200; +pub const STATX_BLOCKS = 0x0400; +pub const STATX_BASIC_STATS = 0x07ff; + +pub const STATX_BTIME = 0x0800; + +pub const STATX_ATTR_COMPRESSED = 0x0004; +pub const STATX_ATTR_IMMUTABLE = 0x0010; +pub const STATX_ATTR_APPEND = 0x0020; +pub const STATX_ATTR_NODUMP = 0x0040; +pub const STATX_ATTR_ENCRYPTED = 0x0800; +pub const STATX_ATTR_AUTOMOUNT = 0x1000; + +pub const statx_timestamp = extern struct { + tv_sec: i64, + tv_nsec: u32, + __pad1: u32, +}; + +pub const Statx = extern struct { + // Mask of bits indicating filled fields + stx_mask: u32, + // Block size for filesystem I/O + stx_blksize: u32, + // Extra file attribute indicators + stx_attributes: u64, + // Number of hard links + stx_nlink: u32, + // User ID of owner + stx_uid: u32, + // Group ID of owner + stx_gid: u32, + // File type and mode + stx_mode: u16, + __pad1: u16, + // Inode number + stx_ino: u64, + // Total size in bytes + stx_size: u64, + // Number of 512B blocks allocated + stx_blocks: u64, + // Mask to show what's supported in stx_attributes + stx_attributes_mask: u64, + + // The following fields are file timestamps + // Last access + stx_atime: statx_timestamp, + // Creation + stx_btime: statx_timestamp, + // Last status change + stx_ctime: statx_timestamp, + // Last modification + stx_mtime: statx_timestamp, + + // If this file represents a device, then the next two fields contain the ID of the device + // Major ID + stx_rdev_major: u32, + // Minor ID + stx_rdev_minor: u32, + + // The next two fields contain the ID of the device containing the filesystem where the file resides + // Major ID + stx_dev_major: u32, + // Minor ID + stx_dev_minor: u32, + + __pad2: [14]u64, +}; |
