xref: /aosp_15_r20/external/llvm-libc/include/llvm-libc-macros/linux/sys-stat-macros.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1 //===-- Definition of macros from sys/stat.h ------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
10 #define LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
11 
12 // Definitions from linux/stat.h
13 #define S_IFMT 0170000
14 #define S_IFSOCK 0140000
15 #define S_IFLNK  0120000
16 #define S_IFREG  0100000
17 #define S_IFBLK  0060000
18 #define S_IFDIR  0040000
19 #define S_IFCHR  0020000
20 #define S_IFIFO  0010000
21 #define S_ISUID  0004000
22 #define S_ISGID  0002000
23 #define S_ISVTX  0001000
24 
25 #define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
26 #define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
27 #define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
28 #define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
29 #define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
30 #define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
31 #define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)
32 
33 #define S_IRWXU 00700
34 #define S_IRUSR 00400
35 #define S_IWUSR 00200
36 #define S_IXUSR 00100
37 
38 #define S_IRWXG 00070
39 #define S_IRGRP 00040
40 #define S_IWGRP 00020
41 #define S_IXGRP 00010
42 
43 #define S_IRWXO 00007
44 #define S_IROTH 00004
45 #define S_IWOTH 00002
46 #define S_IXOTH 00001
47 
48 #endif // LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
49