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