16f52b16cSGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells#ifndef _UAPI_LINUX_STAT_H
3607ca46eSDavid Howells#define _UAPI_LINUX_STAT_H
4607ca46eSDavid Howells
5a528d35eSDavid Howells#include <linux/types.h>
6607ca46eSDavid Howells
7607ca46eSDavid Howells#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
8607ca46eSDavid Howells
9607ca46eSDavid Howells#define S_IFMT  00170000
10607ca46eSDavid Howells#define S_IFSOCK 0140000
11607ca46eSDavid Howells#define S_IFLNK	 0120000
12607ca46eSDavid Howells#define S_IFREG  0100000
13607ca46eSDavid Howells#define S_IFBLK  0060000
14607ca46eSDavid Howells#define S_IFDIR  0040000
15607ca46eSDavid Howells#define S_IFCHR  0020000
16607ca46eSDavid Howells#define S_IFIFO  0010000
17607ca46eSDavid Howells#define S_ISUID  0004000
18607ca46eSDavid Howells#define S_ISGID  0002000
19607ca46eSDavid Howells#define S_ISVTX  0001000
20607ca46eSDavid Howells
21607ca46eSDavid Howells#define S_ISLNK(m)	(((m) & S_IFMT) == S_IFLNK)
22607ca46eSDavid Howells#define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
23607ca46eSDavid Howells#define S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
24607ca46eSDavid Howells#define S_ISCHR(m)	(((m) & S_IFMT) == S_IFCHR)
25607ca46eSDavid Howells#define S_ISBLK(m)	(((m) & S_IFMT) == S_IFBLK)
26607ca46eSDavid Howells#define S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
27607ca46eSDavid Howells#define S_ISSOCK(m)	(((m) & S_IFMT) == S_IFSOCK)
28607ca46eSDavid Howells
29607ca46eSDavid Howells#define S_IRWXU 00700
30607ca46eSDavid Howells#define S_IRUSR 00400
31607ca46eSDavid Howells#define S_IWUSR 00200
32607ca46eSDavid Howells#define S_IXUSR 00100
33607ca46eSDavid Howells
34607ca46eSDavid Howells#define S_IRWXG 00070
35607ca46eSDavid Howells#define S_IRGRP 00040
36607ca46eSDavid Howells#define S_IWGRP 00020
37607ca46eSDavid Howells#define S_IXGRP 00010
38607ca46eSDavid Howells
39607ca46eSDavid Howells#define S_IRWXO 00007
40607ca46eSDavid Howells#define S_IROTH 00004
41607ca46eSDavid Howells#define S_IWOTH 00002
42607ca46eSDavid Howells#define S_IXOTH 00001
43607ca46eSDavid Howells
44607ca46eSDavid Howells#endif
45607ca46eSDavid Howells
46a528d35eSDavid Howells/*
47a528d35eSDavid Howells * Timestamp structure for the timestamps in struct statx.
48a528d35eSDavid Howells *
49a528d35eSDavid Howells * tv_sec holds the number of seconds before (negative) or after (positive)
50a528d35eSDavid Howells * 00:00:00 1st January 1970 UTC.
51a528d35eSDavid Howells *
521741937dSDmitry V. Levin * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time.
53a528d35eSDavid Howells *
54a528d35eSDavid Howells * __reserved is held in case we need a yet finer resolution.
55a528d35eSDavid Howells */
56a528d35eSDavid Howellsstruct statx_timestamp {
57a528d35eSDavid Howells	__s64	tv_sec;
581741937dSDmitry V. Levin	__u32	tv_nsec;
59a528d35eSDavid Howells	__s32	__reserved;
60a528d35eSDavid Howells};
61a528d35eSDavid Howells
62a528d35eSDavid Howells/*
63a528d35eSDavid Howells * Structures for the extended file attribute retrieval system call
64a528d35eSDavid Howells * (statx()).
65a528d35eSDavid Howells *
66a528d35eSDavid Howells * The caller passes a mask of what they're specifically interested in as a
67a528d35eSDavid Howells * parameter to statx().  What statx() actually got will be indicated in
68a528d35eSDavid Howells * st_mask upon return.
69a528d35eSDavid Howells *
70a528d35eSDavid Howells * For each bit in the mask argument:
71