1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _SYS_STAT_H__
6 #define _SYS_STAT_H__
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 /* stat structure */
44 #include <stdint.h>
45 #include <time.h>
46 
47 struct stat
48 {
49     struct rt_device* st_dev;
50     uint16_t st_mode;
51     uint32_t st_size;
52     time_t   st_mtime;
53     uint32_t st_blksize;
54 };
55 
56 #endif
57 
58