1 //===-- Definition of macros from sys/stat.h ------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
10 #define LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
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
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)
48 #endif // LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H