Skip to content

Commit 67ef287

Browse files
committed
tools include uapi: Grab copies of stat.h and fcntl.h
We will need it to build tools/perf/trace/beauty/statx.h. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-nin41ve2fa63lrfbdr6x57yr@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent a596a87 commit 67ef287

5 files changed

Lines changed: 253 additions & 0 deletions

File tree

‎tools/include/linux/types.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
99
#include <asm/types.h>
10+
#include <asm/posix_types.h>
1011

1112
struct page;
1213
struct kmem_cache;

‎tools/include/uapi/linux/fcntl.h‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#ifndef _UAPI_LINUX_FCNTL_H
2+
#define _UAPI_LINUX_FCNTL_H
3+
4+
#include <asm/fcntl.h>
5+
6+
#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
7+
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
8+
9+
/*
10+
* Cancel a blocking posix lock; internal use only until we expose an
11+
* asynchronous lock api to userspace:
12+
*/
13+
#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
14+
15+
/* Create a file descriptor with FD_CLOEXEC set. */
16+
#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
17+
18+
/*
19+
* Request nofications on a directory.
20+
* See below for events that may be notified.
21+
*/
22+
#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23+
24+
/*
25+
* Set and get of pipe page size array
26+
*/
27+
#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28+
#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29+
30+
/*
31+
* Set/Get seals
32+
*/
33+
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
34+
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
35+
36+
/*
37+
* Types of seals
38+
*/
39+
#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
40+
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
41+
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
42+
#define F_SEAL_WRITE 0x0008 /* prevent writes */
43+
/* (1U << 31) is reserved for signed error codes */
44+
45+
/*
46+
* Types of directory notifications that may be requested.
47+
*/
48+
#define DN_ACCESS 0x00000001 /* File accessed */
49+
#define DN_MODIFY 0x00000002 /* File modified */
50+
#define DN_CREATE 0x00000004 /* File created */
51+
#define DN_DELETE 0x00000008 /* File removed */
52+
#define DN_RENAME 0x00000010 /* File renamed */
53+
#define DN_ATTRIB 0x00000020 /* File changed attibutes */
54+
#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
55+
56+
#define AT_FDCWD -100 /* Special value used to indicate
57+
openat should use the current
58+
working directory. */
59+
#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
60+
#define AT_REMOVEDIR 0x200 /* Remove directory instead of
61+
unlinking file. */
62+
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
63+
#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
64+
#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
65+
66+
#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
67+
#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
68+
#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */
69+
#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */
70+
71+
72+
#endif /* _UAPI_LINUX_FCNTL_H */

‎tools/include/uapi/linux/stat.h‎

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#ifndef _UAPI_LINUX_STAT_H
2+
#define _UAPI_LINUX_STAT_H
3+
4+
#include <linux/types.h>
5+
6+
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
7+
8+
#define S_IFMT 00170000
9+
#define S_IFSOCK 0140000
10+
#define S_IFLNK 0120000
11+
#define S_IFREG 0100000
12+
#define S_IFBLK 0060000
13+
#define S_IFDIR 0040000
14+
#define S_IFCHR 0020000
15+
#define S_IFIFO 0010000
16+
#define S_ISUID 0004000
17+
#define S_ISGID 0002000
18+
#define S_ISVTX 0001000
19+
20+
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
21+
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
22+
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
23+
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
24+
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
25+
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
26+
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
27+
28+
#define S_IRWXU 00700
29+
#define S_IRUSR 00400
30+
#define S_IWUSR 00200
31+
#define S_IXUSR 00100
32+
33+
#define S_IRWXG 00070
34+
#define S_IRGRP 00040
35+
#define S_IWGRP 00020
36+
#define S_IXGRP 00010
37+
38+
#define S_IRWXO 00007
39+
#define S_IROTH 00004
40+
#define S_IWOTH 00002
41+
#define S_IXOTH 00001
42+
43+
#endif
44+
45+
/*
46+
* Timestamp structure for the timestamps in struct statx.
47+
*
48+
* tv_sec holds the number of seconds before (negative) or after (positive)
49+
* 00:00:00 1st January 1970 UTC.
50+
*
51+
* tv_nsec holds a number of nanoseconds before (0..-999,999,999 if tv_sec is
52+
* negative) or after (0..999,999,999 if tv_sec is positive) the tv_sec time.
53+
*
54+
* Note that if both tv_sec and tv_nsec are non-zero, then the two values must
55+
* either be both positive or both negative.
56+
*
57+
* __reserved is held in case we need a yet finer resolution.
58+
*/
59+
struct statx_timestamp {
60+
__s64 tv_sec;
61+
__s32 tv_nsec;
62+
__s32 __reserved;
63+
};
64+
65+
/*
66+
* Structures for the extended file attribute retrieval system call
67+
* (statx()).
68+
*
69+
* The caller passes a mask of what they're specifically interested in as a
70+
* parameter to statx(). What statx() actually got will be indicated in
71+
* st_mask upon return.
72+
*
73+
* For each bit in the mask argument:
74+
*
75+
* - if the datum is not supported:
76+
*
77+
* - the bit will be cleared, and
78+
*
79+
* - the datum will be set to an appropriate fabricated value if one is
80+
* available (eg. CIFS can take a default uid and gid), otherwise
81+
*
82+
* - the field will be cleared;
83+
*
84+
* - otherwise, if explicitly requested:
85+
*
86+
* - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is
87+
* set or if the datum is considered out of date, and
88+
*
89+
* - the field will be filled in and the bit will be set;
90+
*
91+
* - otherwise, if not requested, but available in approximate form without any
92+
* effort, it will be filled in anyway, and the bit will be set upon return
93+
* (it might not be up to date, however, and no attempt will be made to
94+
* synchronise the internal state first);
95+
*
96+
* - otherwise the field and the bit will be cleared before returning.
97+
*
98+
* Items in STATX_BASIC_STATS may be marked unavailable on return, but they
99+
* will have values installed for compatibility purposes so that stat() and
100+
* co. can be emulated in userspace.
101+
*/
102+
struct statx {
103+
/* 0x00 */
104+
__u32 stx_mask; /* What results were written [uncond] */
105+
__u32 stx_blksize; /* Preferred general I/O size [uncond] */
106+
__u64 stx_attributes; /* Flags conveying information about the file [uncond] */
107+
/* 0x10 */
108+
__u32 stx_nlink; /* Number of hard links */
109+
__u32 stx_uid; /* User ID of owner */
110+
__u32 stx_gid; /* Group ID of owner */
111+
__u16 stx_mode; /* File mode */
112+
__u16 __spare0[1];
113+
/* 0x20 */
114+
__u64 stx_ino; /* Inode number */
115+
__u64 stx_size; /* File size */
116+
__u64 stx_blocks; /* Number of 512-byte blocks allocated */
117+
__u64 __spare1[1];
118+
/* 0x40 */
119+
struct statx_timestamp stx_atime; /* Last access time */
120+
struct statx_timestamp stx_btime; /* File creation time */
121+
struct statx_timestamp stx_ctime; /* Last attribute change time */
122+
struct statx_timestamp stx_mtime; /* Last data modification time */
123+
/* 0x80 */
124+
__u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
125+
__u32 stx_rdev_minor;
126+
__u32 stx_dev_major; /* ID of device containing file [uncond] */
127+
__u32 stx_dev_minor;
128+
/* 0x90 */
129+
__u64 __spare2[14]; /* Spare space for future expansion */
130+
/* 0x100 */
131+
};
132+
133+
/*
134+
* Flags to be stx_mask
135+
*
136+
* Query request/result mask for statx() and struct statx::stx_mask.
137+
*
138+
* These bits should be set in the mask argument of statx() to request
139+
* particular items when calling statx().
140+
*/
141+
#define STATX_TYPE 0x00000001U /* Want/got stx_mode & S_IFMT */
142+
#define STATX_MODE 0x00000002U /* Want/got stx_mode & ~S_IFMT */
143+
#define STATX_NLINK 0x00000004U /* Want/got stx_nlink */
144+
#define STATX_UID 0x00000008U /* Want/got stx_uid */
145+
#define STATX_GID 0x00000010U /* Want/got stx_gid */
146+
#define STATX_ATIME 0x00000020U /* Want/got stx_atime */
147+
#define STATX_MTIME 0x00000040U /* Want/got stx_mtime */
148+
#define STATX_CTIME 0x00000080U /* Want/got stx_ctime */
149+
#define STATX_INO 0x00000100U /* Want/got stx_ino */
150+
#define STATX_SIZE 0x00000200U /* Want/got stx_size */
151+
#define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
152+
#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
153+
#define STATX_BTIME 0x00000800U /* Want/got stx_btime */
154+
#define STATX_ALL 0x00000fffU /* All currently supported flags */
155+
156+
/*
157+
* Attributes to be found in stx_attributes
158+
*
159+
* These give information about the features or the state of a file that might
160+
* be of use to ordinary userspace programs such as GUIs or ls rather than
161+
* specialised tools.
162+
*
163+
* Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
164+
* semantically. Where possible, the numerical value is picked to correspond
165+
* also.
166+
*/
167+
#define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
168+
#define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
169+
#define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
170+
#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
171+
#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
172+
173+
#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
174+
175+
176+
#endif /* _UAPI_LINUX_STAT_H */

‎tools/perf/MANIFEST‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ tools/include/uapi/asm-generic/mman-common.h
7373
tools/include/uapi/asm-generic/mman.h
7474
tools/include/uapi/linux/bpf.h
7575
tools/include/uapi/linux/bpf_common.h
76+
tools/include/uapi/linux/fcntl.h
7677
tools/include/uapi/linux/hw_breakpoint.h
7778
tools/include/uapi/linux/mman.h
7879
tools/include/uapi/linux/perf_event.h
80+
tools/include/uapi/linux/stat.h
7981
tools/include/linux/poison.h
8082
tools/include/linux/rbtree.h
8183
tools/include/linux/rbtree_augmented.h

‎tools/perf/check-headers.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/sh
22

33
HEADERS='
4+
include/uapi/linux/fcntl.h
45
include/uapi/linux/perf_event.h
6+
include/uapi/linux/stat.h
57
include/linux/hash.h
68
include/uapi/linux/hw_breakpoint.h
79
arch/x86/include/asm/disabled-features.h

0 commit comments

Comments
 (0)