Rev 4874 | Rev 4930 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
1 | #ifndef _SYS_STAT_H |
1 | #ifndef _SYS_STAT_H |
2 | #define _SYS_STAT_H |
2 | #define _SYS_STAT_H |
3 | 3 | ||
4 | #ifdef __cplusplus |
4 | #ifdef __cplusplus |
5 | extern "C" { |
5 | extern "C" { |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | #include <_ansi.h> |
8 | #include <_ansi.h> |
9 | #include |
9 | #include |
10 | #include |
10 | #include |
11 | 11 | ||
12 | /* dj's stat defines _STAT_H_ */ |
12 | /* dj's stat defines _STAT_H_ */ |
13 | #ifndef _STAT_H_ |
13 | #ifndef _STAT_H_ |
14 | 14 | ||
15 | /* It is intended that the layout of this structure not change when the |
15 | /* It is intended that the layout of this structure not change when the |
16 | sizes of any of the basic types change (short, int, long) [via a compile |
16 | sizes of any of the basic types change (short, int, long) [via a compile |
17 | time option]. */ |
17 | time option]. */ |
18 | 18 | ||
19 | #ifdef __CYGWIN__ |
19 | #ifdef __CYGWIN__ |
20 | #include |
20 | #include |
21 | #ifdef _COMPILING_NEWLIB |
21 | #ifdef _COMPILING_NEWLIB |
22 | #define stat64 __stat64 |
22 | #define stat64 stat |
23 | #endif |
23 | #endif |
24 | #else |
24 | #else |
25 | struct stat |
25 | struct stat |
26 | { |
26 | { |
27 | dev_t st_dev; |
27 | dev_t st_dev; |
28 | ino_t st_ino; |
28 | ino_t st_ino; |
29 | mode_t st_mode; |
29 | mode_t st_mode; |
30 | nlink_t st_nlink; |
30 | nlink_t st_nlink; |
31 | uid_t st_uid; |
31 | uid_t st_uid; |
32 | gid_t st_gid; |
32 | gid_t st_gid; |
33 | dev_t st_rdev; |
33 | dev_t st_rdev; |
34 | off_t st_size; |
34 | off_t st_size; |
35 | #if defined(__rtems__) |
35 | #if defined(__rtems__) |
36 | struct timespec st_atim; |
36 | struct timespec st_atim; |
37 | struct timespec st_mtim; |
37 | struct timespec st_mtim; |
38 | struct timespec st_ctim; |
38 | struct timespec st_ctim; |
39 | blksize_t st_blksize; |
39 | blksize_t st_blksize; |
40 | blkcnt_t st_blocks; |
40 | blkcnt_t st_blocks; |
41 | #else |
41 | #else |
42 | /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ |
42 | /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ |
43 | #if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) |
43 | #if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) |
44 | time_t st_atime; |
44 | time_t st_atime; |
45 | time_t st_mtime; |
45 | time_t st_mtime; |
46 | time_t st_ctime; |
46 | time_t st_ctime; |
47 | #else |
47 | #else |
48 | time_t st_atime; |
48 | time_t st_atime; |
49 | long st_spare1; |
49 | long st_spare1; |
50 | time_t st_mtime; |
50 | time_t st_mtime; |
51 | long st_spare2; |
51 | long st_spare2; |
52 | time_t st_ctime; |
52 | time_t st_ctime; |
53 | long st_spare3; |
53 | long st_spare3; |
54 | long st_blksize; |
54 | long st_blksize; |
55 | long st_blocks; |
55 | long st_blocks; |
56 | long st_spare4[2]; |
56 | long st_spare4[2]; |
57 | #endif |
57 | #endif |
58 | #endif |
58 | #endif |
59 | }; |
59 | }; |
60 | 60 | ||
61 | #if defined(__rtems__) |
61 | #if defined(__rtems__) |
62 | #define st_atime st_atim.tv_sec |
62 | #define st_atime st_atim.tv_sec |
63 | #define st_ctime st_ctim.tv_sec |
63 | #define st_ctime st_ctim.tv_sec |
64 | #define st_mtime st_mtim.tv_sec |
64 | #define st_mtime st_mtim.tv_sec |
65 | #endif |
65 | #endif |
66 | 66 | ||
67 | #endif |
67 | #endif |
68 | 68 | ||
69 | #define _IFMT 0170000 /* type of file */ |
69 | #define _IFMT 0170000 /* type of file */ |
70 | #define _IFDIR 0040000 /* directory */ |
70 | #define _IFDIR 0040000 /* directory */ |
71 | #define _IFCHR 0020000 /* character special */ |
71 | #define _IFCHR 0020000 /* character special */ |
72 | #define _IFBLK 0060000 /* block special */ |
72 | #define _IFBLK 0060000 /* block special */ |
73 | #define _IFREG 0100000 /* regular */ |
73 | #define _IFREG 0100000 /* regular */ |
74 | #define _IFLNK 0120000 /* symbolic link */ |
74 | #define _IFLNK 0120000 /* symbolic link */ |
75 | #define _IFSOCK 0140000 /* socket */ |
75 | #define _IFSOCK 0140000 /* socket */ |
76 | #define _IFIFO 0010000 /* fifo */ |
76 | #define _IFIFO 0010000 /* fifo */ |
77 | 77 | ||
78 | #define S_BLKSIZE 1024 /* size of a block */ |
78 | #define S_BLKSIZE 1024 /* size of a block */ |
79 | 79 | ||
80 | #define S_ISUID 0004000 /* set user id on execution */ |
80 | #define S_ISUID 0004000 /* set user id on execution */ |
81 | #define S_ISGID 0002000 /* set group id on execution */ |
81 | #define S_ISGID 0002000 /* set group id on execution */ |
82 | #define S_ISVTX 0001000 /* save swapped text even after use */ |
82 | #define S_ISVTX 0001000 /* save swapped text even after use */ |
83 | #ifndef _POSIX_SOURCE |
83 | #ifndef _POSIX_SOURCE |
84 | #define S_IREAD 0000400 /* read permission, owner */ |
84 | #define S_IREAD 0000400 /* read permission, owner */ |
85 | #define S_IWRITE 0000200 /* write permission, owner */ |
85 | #define S_IWRITE 0000200 /* write permission, owner */ |
86 | #define S_IEXEC 0000100 /* execute/search permission, owner */ |
86 | #define S_IEXEC 0000100 /* execute/search permission, owner */ |
87 | #define S_ENFMT 0002000 /* enforcement-mode locking */ |
87 | #define S_ENFMT 0002000 /* enforcement-mode locking */ |
88 | #endif /* !_POSIX_SOURCE */ |
88 | #endif /* !_POSIX_SOURCE */ |
89 | 89 | ||
90 | #define S_IFMT _IFMT |
90 | #define S_IFMT _IFMT |
91 | #define S_IFDIR _IFDIR |
91 | #define S_IFDIR _IFDIR |
92 | #define S_IFCHR _IFCHR |
92 | #define S_IFCHR _IFCHR |
93 | #define S_IFBLK _IFBLK |
93 | #define S_IFBLK _IFBLK |
94 | #define S_IFREG _IFREG |
94 | #define S_IFREG _IFREG |
95 | #define S_IFLNK _IFLNK |
95 | #define S_IFLNK _IFLNK |
96 | #define S_IFSOCK _IFSOCK |
96 | #define S_IFSOCK _IFSOCK |
97 | #define S_IFIFO _IFIFO |
97 | #define S_IFIFO _IFIFO |
98 | 98 | ||
99 | #ifdef _WIN32 |
99 | #ifdef _WIN32 |
100 | /* The Windows header files define _S_ forms of these, so we do too |
100 | /* The Windows header files define _S_ forms of these, so we do too |
101 | for easier portability. */ |
101 | for easier portability. */ |
102 | #define _S_IFMT _IFMT |
102 | #define _S_IFMT _IFMT |
103 | #define _S_IFDIR _IFDIR |
103 | #define _S_IFDIR _IFDIR |
104 | #define _S_IFCHR _IFCHR |
104 | #define _S_IFCHR _IFCHR |
105 | #define _S_IFIFO _IFIFO |
105 | #define _S_IFIFO _IFIFO |
106 | #define _S_IFREG _IFREG |
106 | #define _S_IFREG _IFREG |
107 | #define _S_IREAD 0000400 |
107 | #define _S_IREAD 0000400 |
108 | #define _S_IWRITE 0000200 |
108 | #define _S_IWRITE 0000200 |
109 | #define _S_IEXEC 0000100 |
109 | #define _S_IEXEC 0000100 |
110 | #endif |
110 | #endif |
111 | 111 | ||
112 | #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) |
112 | #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) |
113 | #define S_IRUSR 0000400 /* read permission, owner */ |
113 | #define S_IRUSR 0000400 /* read permission, owner */ |
114 | #define S_IWUSR 0000200 /* write permission, owner */ |
114 | #define S_IWUSR 0000200 /* write permission, owner */ |
115 | #define S_IXUSR 0000100/* execute/search permission, owner */ |
115 | #define S_IXUSR 0000100/* execute/search permission, owner */ |
116 | #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) |
116 | #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) |
117 | #define S_IRGRP 0000040 /* read permission, group */ |
117 | #define S_IRGRP 0000040 /* read permission, group */ |
118 | #define S_IWGRP 0000020 /* write permission, grougroup */ |
118 | #define S_IWGRP 0000020 /* write permission, grougroup */ |
119 | #define S_IXGRP 0000010/* execute/search permission, group */ |
119 | #define S_IXGRP 0000010/* execute/search permission, group */ |
120 | #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) |
120 | #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) |
121 | #define S_IROTH 0000004 /* read permission, other */ |
121 | #define S_IROTH 0000004 /* read permission, other */ |
122 | #define S_IWOTH 0000002 /* write permission, other */ |
122 | #define S_IWOTH 0000002 /* write permission, other */ |
123 | #define S_IXOTH 0000001/* execute/search permission, other */ |
123 | #define S_IXOTH 0000001/* execute/search permission, other */ |
124 | 124 | ||
125 | #ifndef _POSIX_SOURCE |
125 | #ifndef _POSIX_SOURCE |
126 | #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */ |
126 | #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */ |
127 | #define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */ |
127 | #define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */ |
128 | #define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */ |
128 | #define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */ |
129 | #endif |
129 | #endif |
130 | 130 | ||
131 | #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) |
131 | #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) |
132 | #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) |
132 | #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) |
133 | #define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) |
133 | #define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) |
134 | #define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) |
134 | #define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) |
135 | #define S_ISREG(m) (((m)&_IFMT) == _IFREG) |
135 | #define S_ISREG(m) (((m)&_IFMT) == _IFREG) |
136 | #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) |
136 | #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) |
137 | #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) |
137 | #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) |
138 | 138 | ||
139 | #if defined(__CYGWIN__) |
139 | #if defined(__CYGWIN__) |
140 | /* Special tv_nsec values for futimens(2) and utimensat(2). */ |
140 | /* Special tv_nsec values for futimens(2) and utimensat(2). */ |
141 | #define UTIME_NOW -2L |
141 | #define UTIME_NOW -2L |
142 | #define UTIME_OMIT -1L |
142 | #define UTIME_OMIT -1L |
143 | #endif |
143 | #endif |
144 | 144 | ||
145 | int _EXFUN(chmod,( const char *__path, mode_t __mode )); |
145 | int _EXFUN(chmod,( const char *__path, mode_t __mode )); |
146 | int _EXFUN(fchmod,(int __fd, mode_t __mode)); |
146 | int _EXFUN(fchmod,(int __fd, mode_t __mode)); |
147 | int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); |
147 | int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); |
148 | int _EXFUN(mkdir,( const char *_path, mode_t __mode )); |
148 | int _EXFUN(mkdir,( const char *_path, mode_t __mode )); |
149 | int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); |
149 | int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); |
150 | int _EXFUN(stat,( const char *__path, struct stat *__sbuf )); |
150 | int _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf )); |
151 | mode_t _EXFUN(umask,( mode_t __mask )); |
151 | mode_t _EXFUN(umask,( mode_t __mask )); |
152 | 152 | ||
153 | #if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__) |
153 | #if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__) |
154 | int _EXFUN(lstat,( const char *__path, struct stat *__buf )); |
154 | int _EXFUN(lstat,( const char *__restrict __path, struct stat *__restrict __buf )); |
155 | int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev )); |
155 | int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev )); |
156 | #endif |
156 | #endif |
157 | 157 | ||
158 | #if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__) |
158 | #if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__) |
159 | int _EXFUN(fchmodat, (int, const char *, mode_t, int)); |
159 | int _EXFUN(fchmodat, (int, const char *, mode_t, int)); |
160 | int _EXFUN(fstatat, (int, const char *, struct stat *, int)); |
160 | int _EXFUN(fstatat, (int, const char *__restrict , struct stat *__restrict, int)); |
161 | int _EXFUN(mkdirat, (int, const char *, mode_t)); |
161 | int _EXFUN(mkdirat, (int, const char *, mode_t)); |
162 | int _EXFUN(mkfifoat, (int, const char *, mode_t)); |
162 | int _EXFUN(mkfifoat, (int, const char *, mode_t)); |
163 | int _EXFUN(mknodat, (int, const char *, mode_t, dev_t)); |
163 | int _EXFUN(mknodat, (int, const char *, mode_t, dev_t)); |
164 | int _EXFUN(utimensat, (int, const char *, const struct timespec *, int)); |
164 | int _EXFUN(utimensat, (int, const char *, const struct timespec *, int)); |
165 | int _EXFUN(futimens, (int, const struct timespec *)); |
165 | int _EXFUN(futimens, (int, const struct timespec *)); |
166 | #endif |
166 | #endif |
167 | 167 | ||
168 | /* Provide prototypes for most of the _ |
168 | /* Provide prototypes for most of the _ |
169 | provided in newlib for some compilers. */ |
169 | provided in newlib for some compilers. */ |
170 | #ifdef _COMPILING_NEWLIB |
170 | #ifdef _COMPILING_NEWLIB |
171 | int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); |
171 | int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); |
172 | int _EXFUN(_stat,( const char *__path, struct stat *__sbuf )); |
172 | int _EXFUN(_stat,( const char *__restrict __path, struct stat *__restrict __sbuf )); |
- | 173 | int _EXFUN(_mkdir,( const char *_path, mode_t __mode )); |
|
173 | #ifdef __LARGE64_FILES |
174 | #ifdef __LARGE64_FILES |
174 | struct stat64; |
175 | struct stat64; |
- | 176 | int _EXFUN(_stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf )); |
|
175 | int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf )); |
177 | int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf )); |
176 | #endif |
178 | #endif |
177 | #endif |
179 | #endif |
178 | 180 | ||
179 | #endif /* !_STAT_H_ */ |
181 | #endif /* !_STAT_H_ */ |
180 | #ifdef __cplusplus |
182 | #ifdef __cplusplus |
181 | } |
183 | } |
182 | #endif |
184 | #endif |
183 | #endif /* _SYS_STAT_H */ |
185 | #endif /* _SYS_STAT_H */ |