Subversion Repositories Kolibri OS

Rev

Rev 6109 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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