~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to system/include/libc/sys/stat.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _SYS_STAT_H
2
2
#define _SYS_STAT_H
3
 
 
4
3
#ifdef __cplusplus
5
4
extern "C" {
6
5
#endif
7
6
 
8
 
#include <_ansi.h>
9
 
#include <time.h>
10
 
#include <sys/types.h>
11
 
 
12
 
/* dj's stat defines _STAT_H_ */
13
 
#ifndef _STAT_H_
14
 
 
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
17
 
   time option].  */
18
 
 
19
 
#ifdef __CYGWIN__
20
 
#include <cygwin/stat.h>
21
 
#ifdef _COMPILING_NEWLIB
22
 
#define stat64 __stat64
23
 
#endif
24
 
#else
25
 
struct  stat 
26
 
{
27
 
  dev_t         st_dev;
28
 
  ino_t         st_ino;
29
 
  mode_t        st_mode;
30
 
  nlink_t       st_nlink;
31
 
  uid_t         st_uid;
32
 
  gid_t         st_gid;
33
 
  dev_t         st_rdev;
34
 
  off_t         st_size;
35
 
#if defined(__rtems__)
36
 
  struct timespec st_atim;
37
 
  struct timespec st_mtim;
38
 
  struct timespec st_ctim;
39
 
  blksize_t     st_blksize;
40
 
  blkcnt_t      st_blocks;
41
 
#else
42
 
  /* SysV/sco doesn't have the rest... But Solaris, eabi does.  */
43
 
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
44
 
  time_t        st_atime;
45
 
  time_t        st_mtime;
46
 
  time_t        st_ctime;
47
 
#else
48
 
  time_t        st_atime;
49
 
  long          st_spare1;
50
 
  time_t        st_mtime;
51
 
  long          st_spare2;
52
 
  time_t        st_ctime;
53
 
  long          st_spare3;
54
 
  long          st_blksize;
55
 
  long          st_blocks;
56
 
  long  st_spare4[2];
57
 
#endif
58
 
#endif
59
 
};
60
 
 
61
 
struct  stat64
62
 
{
63
 
  dev_t         st_dev;
64
 
  ino_t         st_ino;
65
 
  mode_t        st_mode;
66
 
  nlink_t       st_nlink;
67
 
  uid_t         st_uid;
68
 
  gid_t         st_gid;
69
 
  dev_t         st_rdev;
70
 
  off_t         st_size;
71
 
#if defined(__rtems__)
72
 
  struct timespec st_atim;
73
 
  struct timespec st_mtim;
74
 
  struct timespec st_ctim;
75
 
  blksize_t     st_blksize;
76
 
  blkcnt_t      st_blocks;
77
 
#else
78
 
  /* SysV/sco doesn't have the rest... But Solaris, eabi does.  */
79
 
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
80
 
  time_t        st_atime;
81
 
  time_t        st_mtime;
82
 
  time_t        st_ctime;
83
 
#else
84
 
  time_t        st_atime;
85
 
  long          st_spare1;
86
 
  time_t        st_mtime;
87
 
  long          st_spare2;
88
 
  time_t        st_ctime;
89
 
  long          st_spare3;
90
 
  long          st_blksize;
91
 
  long          st_blocks;
92
 
  long  st_spare4[2];
93
 
#endif
94
 
#endif
95
 
};
96
 
 
97
 
#if defined(__rtems__)
 
7
#include <features.h>
 
8
 
 
9
#define __NEED_dev_t
 
10
#define __NEED_ino_t
 
11
#define __NEED_mode_t
 
12
#define __NEED_nlink_t
 
13
#define __NEED_uid_t
 
14
#define __NEED_gid_t
 
15
#define __NEED_off_t
 
16
#define __NEED_time_t
 
17
#define __NEED_blksize_t
 
18
#define __NEED_blkcnt_t
 
19
#define __NEED_struct_timespec
 
20
 
 
21
#include <bits/alltypes.h>
 
22
 
 
23
#include <bits/stat.h>
 
24
 
98
25
#define st_atime st_atim.tv_sec
 
26
#define st_mtime st_mtim.tv_sec
99
27
#define st_ctime st_ctim.tv_sec
100
 
#define st_mtime st_mtim.tv_sec
101
 
#endif
102
 
 
103
 
#endif
104
 
 
105
 
#define _IFMT           0170000 /* type of file */
106
 
#define         _IFDIR  0040000 /* directory */
107
 
#define         _IFCHR  0020000 /* character special */
108
 
#define         _IFBLK  0060000 /* block special */
109
 
#define         _IFREG  0100000 /* regular */
110
 
#define         _IFLNK  0120000 /* symbolic link */
111
 
#define         _IFSOCK 0140000 /* socket */
112
 
#define         _IFIFO  0010000 /* fifo */
113
 
 
114
 
#define         S_BLKSIZE  1024 /* size of a block */
115
 
 
116
 
#define S_ISUID         0004000 /* set user id on execution */
117
 
#define S_ISGID         0002000 /* set group id on execution */
118
 
#define S_ISVTX         0001000 /* save swapped text even after use */
119
 
#ifndef _POSIX_SOURCE
120
 
#define S_IREAD         0000400 /* read permission, owner */
121
 
#define S_IWRITE        0000200 /* write permission, owner */
122
 
#define S_IEXEC         0000100 /* execute/search permission, owner */
123
 
#define S_ENFMT         0002000 /* enforcement-mode locking */
124
 
#endif  /* !_POSIX_SOURCE */
125
 
 
126
 
#define S_IFMT          _IFMT
127
 
#define S_IFDIR         _IFDIR
128
 
#define S_IFCHR         _IFCHR
129
 
#define S_IFBLK         _IFBLK
130
 
#define S_IFREG         _IFREG
131
 
#define S_IFLNK         _IFLNK
132
 
#define S_IFSOCK        _IFSOCK
133
 
#define S_IFIFO         _IFIFO
134
 
 
135
 
#ifdef _WIN32
136
 
/* The Windows header files define _S_ forms of these, so we do too
137
 
   for easier portability.  */
138
 
#define _S_IFMT         _IFMT
139
 
#define _S_IFDIR        _IFDIR
140
 
#define _S_IFCHR        _IFCHR
141
 
#define _S_IFIFO        _IFIFO
142
 
#define _S_IFREG        _IFREG
143
 
#define _S_IREAD        0000400
144
 
#define _S_IWRITE       0000200
145
 
#define _S_IEXEC        0000100
146
 
#endif
147
 
 
148
 
#define S_IRWXU         (S_IRUSR | S_IWUSR | S_IXUSR)
149
 
#define         S_IRUSR 0000400 /* read permission, owner */
150
 
#define         S_IWUSR 0000200 /* write permission, owner */
151
 
#define         S_IXUSR 0000100/* execute/search permission, owner */
152
 
#define S_IRWXG         (S_IRGRP | S_IWGRP | S_IXGRP)
153
 
#define         S_IRGRP 0000040 /* read permission, group */
154
 
#define         S_IWGRP 0000020 /* write permission, grougroup */
155
 
#define         S_IXGRP 0000010/* execute/search permission, group */
156
 
#define S_IRWXO         (S_IROTH | S_IWOTH | S_IXOTH)
157
 
#define         S_IROTH 0000004 /* read permission, other */
158
 
#define         S_IWOTH 0000002 /* write permission, other */
159
 
#define         S_IXOTH 0000001/* execute/search permission, other */
160
 
 
161
 
#ifndef _POSIX_SOURCE
162
 
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
163
 
#define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */
164
 
#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */
165
 
#endif
166
 
 
167
 
#define S_ISBLK(m)      (((m)&_IFMT) == _IFBLK)
168
 
#define S_ISCHR(m)      (((m)&_IFMT) == _IFCHR)
169
 
#define S_ISDIR(m)      (((m)&_IFMT) == _IFDIR)
170
 
#define S_ISFIFO(m)     (((m)&_IFMT) == _IFIFO)
171
 
#define S_ISREG(m)      (((m)&_IFMT) == _IFREG)
172
 
#define S_ISLNK(m)      (((m)&_IFMT) == _IFLNK)
173
 
#define S_ISSOCK(m)     (((m)&_IFMT) == _IFSOCK)
174
 
 
175
 
#if defined(__CYGWIN__)
176
 
/* Special tv_nsec values for futimens(2) and utimensat(2). */
177
 
#define UTIME_NOW       -2L
178
 
#define UTIME_OMIT      -1L
179
 
#endif
180
 
 
181
 
int     _EXFUN(chmod,( const char *__path, mode_t __mode ));
182
 
int _EXFUN(lchmod,( const char *__path, mode_t __mode ));
183
 
int _EXFUN(fchmod,(int __fd, mode_t __mode));
184
 
int     _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
185
 
int     _EXFUN(fstat64,( int __fd, struct stat64 *__sbuf )); /* XXX Emscripten */
186
 
int     _EXFUN(mkdir,( const char *_path, mode_t __mode ));
187
 
int     _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
188
 
int     _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
189
 
int     _EXFUN(stat64,( const char *__path, struct stat64 *__sbuf )); /* XXX Emscripten */
190
 
mode_t  _EXFUN(umask,( mode_t __mask ));
191
 
 
192
 
#if defined(EMSCRIPTEN) || defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__) 
193
 
int     _EXFUN(lstat,( const char *__path, struct stat *__buf ));
194
 
int     _EXFUN(lstat64,( const char *__path, struct stat64 *__buf )); /* XXX Emscripten */
195
 
int     _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
196
 
#endif
197
 
 
198
 
#if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
199
 
int     _EXFUN(fchmodat, (int, const char *, mode_t, int));
200
 
int     _EXFUN(fstatat, (int, const char *, struct stat *, int));
201
 
int     _EXFUN(mkdirat, (int, const char *, mode_t));
202
 
int     _EXFUN(mkfifoat, (int, const char *, mode_t));
203
 
int     _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
204
 
int     _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
205
 
int     _EXFUN(futimens, (int, const struct timespec *));
206
 
#endif
207
 
 
208
 
/* Provide prototypes for most of the _<systemcall> names that are
209
 
   provided in newlib for some compilers.  */
210
 
#ifdef _COMPILING_NEWLIB
211
 
int     _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
212
 
int     _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
213
 
#ifdef __LARGE64_FILES
214
 
struct stat64;
215
 
int     _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
216
 
#endif
217
 
#endif
218
 
 
219
 
#endif /* !_STAT_H_ */
 
28
 
 
29
#define S_IFMT  0170000
 
30
 
 
31
#define S_IFDIR 0040000
 
32
#define S_IFCHR 0020000
 
33
#define S_IFBLK 0060000
 
34
#define S_IFREG 0100000
 
35
#define S_IFIFO 0010000
 
36
#define S_IFLNK 0120000
 
37
#define S_IFSOCK 0140000
 
38
 
 
39
#define S_TYPEISMQ(buf)  0
 
40
#define S_TYPEISSEM(buf) 0
 
41
#define S_TYPEISSHM(buf) 0
 
42
#define S_TYPEISTMO(buf) 0
 
43
 
 
44
#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
 
45
#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
 
46
#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
 
47
#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
 
48
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
 
49
#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
 
50
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
 
51
 
 
52
#ifndef S_IRUSR
 
53
#define S_ISUID 04000
 
54
#define S_ISGID 02000
 
55
#define S_ISVTX 01000
 
56
#define S_IRUSR 0400
 
57
#define S_IWUSR 0200
 
58
#define S_IXUSR 0100
 
59
#define S_IRWXU 0700
 
60
#define S_IRGRP 0040
 
61
#define S_IWGRP 0020
 
62
#define S_IXGRP 0010
 
63
#define S_IRWXG 0070
 
64
#define S_IROTH 0004
 
65
#define S_IWOTH 0002
 
66
#define S_IXOTH 0001
 
67
#define S_IRWXO 0007
 
68
#endif
 
69
 
 
70
#define UTIME_NOW  0x3fffffff
 
71
#define UTIME_OMIT 0x3ffffffe
 
72
 
 
73
int stat(const char *__restrict, struct stat *__restrict);
 
74
int fstat(int, struct stat *);
 
75
int lstat(const char *__restrict, struct stat *__restrict);
 
76
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
 
77
int chmod(const char *, mode_t);
 
78
int fchmod(int, mode_t);
 
79
int fchmodat(int, const char *, mode_t, int);
 
80
mode_t umask(mode_t);
 
81
int mkdir(const char *, mode_t);
 
82
int mknod(const char *, mode_t, dev_t);
 
83
int mkfifo(const char *, mode_t);
 
84
int mkdirat(int, const char *, mode_t);
 
85
int mknodat(int, const char *, mode_t, dev_t);
 
86
int mkfifoat(int, const char *, mode_t);
 
87
 
 
88
int futimens(int, const struct timespec [2]);
 
89
int utimensat(int, const char *, const struct timespec [2], int);
 
90
 
 
91
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 
92
int lchmod(const char *, mode_t);
 
93
#define S_IREAD S_IRUSR
 
94
#define S_IWRITE S_IWUSR
 
95
#define S_IEXEC S_IXUSR
 
96
#endif
 
97
 
 
98
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
 
99
#define stat64 stat
 
100
#define fstat64 fstat
 
101
#define lstat64 lstat
 
102
#define fstatat64 fstatat
 
103
#define blksize64_t blksize_t
 
104
#define blkcnt64_t blkcnt_t
 
105
#define ino64_t ino_t
 
106
#define off64_t off_t
 
107
#endif
 
108
 
220
109
#ifdef __cplusplus
221
110
}
222
111
#endif
223
 
#endif /* _SYS_STAT_H */
 
112
#endif
 
113
 
 
114