Changeset 744
- Timestamp:
- Sep 29, 2003, 1:44:04 AM (22 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/sys/stat.h
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r743 r744 1 /* sys/stat.h (emx+gcc) */ 2 3 #ifndef _SYS_STAT_H 4 #define _SYS_STAT_H 5 6 #if !defined (_SYS_TYPES_H) 7 #warning <sys/stat.h> requires <sys/types.h> 8 #include <sys/types.h> 9 #endif 10 11 #if defined (__cplusplus) 12 extern "C" { 13 #endif 14 15 #if !defined (_STAT) 16 #define _STAT 17 struct stat 18 { 19 dev_t st_dev; 20 ino_t st_ino; 21 mode_t st_mode; 22 nlink_t st_nlink; 23 uid_t st_uid; 24 gid_t st_gid; 25 dev_t st_rdev; 26 off_t st_size; 27 time_t st_atime; 28 time_t st_mtime; 29 time_t st_ctime; 30 long st_attr; 31 long st_reserved; 1 /*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)stat.h 8.12 (Berkeley) 6/16/95 39 * $FreeBSD: src/sys/sys/stat.h,v 1.37 2003/05/22 17:07:57 mike Exp $ 40 */ 41 42 /** @file 43 * FreeBSD 5.1 44 * @changed bird: EMX isms and hid the BSD specific structs and related stuff. 45 */ 46 47 #ifndef _SYS_STAT_H_ 48 #define _SYS_STAT_H_ 49 50 #include <sys/cdefs.h> 51 #include <sys/_types.h> 52 53 /* XXX missing blkcnt_t, blksize_t. */ 54 55 #ifndef _DEV_T_DECLARED 56 typedef __dev_t dev_t; 57 #define _DEV_T_DECLARED 58 #endif 59 60 #ifndef _FFLAGS_T_DECLARED 61 typedef __fflags_t fflags_t; 62 #define _FFLAGS_T_DECLARED 63 #endif 64 65 #if !defined(_GID_T_DECLARED) && !defined(_GID_T) 66 typedef __gid_t gid_t; 67 #define _GID_T_DECLARED 68 #define _GID_T 69 #endif 70 71 #if !defined(_INO_T_DECLARED) && !defined(_INO_T) /* bird: emx */ 72 typedef __ino_t ino_t; 73 #define _INO_T_DECLARED 74 #define _INO_T /* bird: emx */ 75 #endif 76 77 #if !defined(_MODE_T_DECLARED) && !defined(_MODE_T) /* bird: emx */ 78 typedef __mode_t mode_t; 79 #define _MODE_T_DECLARED 80 #define _MODE_T /* bird: emx */ 81 #endif 82 83 #ifndef _NLINK_T_DECLARED 84 typedef __nlink_t nlink_t; 85 #define _NLINK_T_DECLARED 86 #endif 87 88 #if !defined(_OFF_T_DECLARED) && !defined(_OFF_T) /* bird: emx */ 89 typedef __off_t off_t; 90 #define _OFF_T_DECLARED 91 #define _OFF_T /* bird: emx */ 92 #endif 93 94 #if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird: emx */ 95 typedef __time_t time_t; 96 #define _TIME_T_DECLARED 97 #define _TIME_T /* bird: emx */ 98 #endif 99 100 #if !defined(_UID_T_DECLARED) && !defined(_UID_T) /* bird: emx */ 101 typedef __uid_t uid_t; 102 #define _UID_T_DECLARED 103 #define _UID_T /* bird: emx */ 104 #endif 105 106 #if !defined(_KERNEL) && __BSD_VISIBLE 107 /* 108 * XXX we need this for struct timespec. We get miscellaneous namespace 109 * pollution with it. 110 */ 111 #include <sys/time.h> 112 #endif 113 114 #if !__BSD_VISIBLE 115 #include <sys/_timespec.h> 116 #endif 117 118 #if 0 /* bird: emx */ 119 #if __BSD_VISIBLE 120 struct ostat { 121 __uint16_t st_dev; /* inode's device */ 122 ino_t st_ino; /* inode's number */ 123 mode_t st_mode; /* inode protection mode */ 124 nlink_t st_nlink; /* number of hard links */ 125 __uint16_t st_uid; /* user ID of the file's owner */ 126 __uint16_t st_gid; /* group ID of the file's group */ 127 __uint16_t st_rdev; /* device type */ 128 __int32_t st_size; /* file size, in bytes */ 129 struct timespec st_atimespec; /* time of last access */ 130 struct timespec st_mtimespec; /* time of last data modification */ 131 struct timespec st_ctimespec; /* time of last file status change */ 132 __int32_t st_blksize; /* optimal blocksize for I/O */ 133 __int32_t st_blocks; /* blocks allocated for file */ 134 fflags_t st_flags; /* user defined flags for file */ 135 __uint32_t st_gen; /* file generation number */ 32 136 }; 33 #endif 34 35 #if !defined (S_IRUSR) 36 #define S_IRWXU 00700 37 #define S_IRUSR 00400 38 #define S_IWUSR 00200 39 #define S_IXUSR 00100 40 41 #define S_IRWXG 00070 42 #define S_IRGRP 00040 43 #define S_IWGRP 00020 44 #define S_IXGRP 00010 45 46 #define S_IRWXO 00007 47 #define S_IROTH 00004 48 #define S_IWOTH 00002 49 #define S_IXOTH 00001 50 51 #define S_ISGID 02000 52 #define S_ISUID 04000 53 #endif 54 55 #if !defined (S_IFMT) 56 #define S_IFMT 0170000 /* Mask for file type */ 57 #define S_IFIFO 0010000 /* Pipe */ 58 #define S_IFCHR 0020000 /* Character device */ 59 #define S_IFDIR 0040000 /* Directory */ 60 #define S_IFREG 0100000 /* Regular file */ 61 #define S_IFSOCK 0140000 /* Socket */ 62 63 /* S_ISBLK */ 64 #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) 65 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 66 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 67 #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) 68 #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) 69 #endif 70 71 int chmod (__const__ char *, int); 72 int fstat (int, struct stat *); 73 int mkdir (__const__ char *, long); 74 /* mkfifo() */ 75 int stat (__const__ char *, struct stat *); 76 int umask (int); 77 78 79 #if !defined (_POSIX_SOURCE) 80 81 #if !defined (S_IREAD) 82 #define S_IREAD 0400 /* Owner: read */ 83 #define S_IWRITE 0200 /* Owner: write */ 84 #define S_IEXEC 0100 /* Owner: exec */ 85 #endif 86 87 #endif 88 137 #endif /* __BSD_VISIBLE */ 138 #endif /* bird: emx */ 139 140 struct stat { 141 __udev_t st_dev; /* inode's device */ 142 ino_t st_ino; /* inode's number */ 143 mode_t st_mode; /* inode protection mode */ 144 nlink_t st_nlink; /* number of hard links */ 145 uid_t st_uid; /* user ID of the file's owner */ 146 gid_t st_gid; /* group ID of the file's group */ 147 __udev_t st_rdev; /* device type */ 148 #if 1 /* bird: emx */ 149 time_t st_atime; 150 time_t st_mtime; 151 time_t st_ctime; 152 #else /* bird: emx */ 153 #if __BSD_VISIBLE 154 struct timespec st_atimespec; /* time of last access */ 155 struct timespec st_mtimespec; /* time of last data modification */ 156 struct timespec st_ctimespec; /* time of last file status change */ 157 #else 158 time_t st_atime; /* time of last access */ 159 long st_atimensec; /* nsec of last access */ 160 time_t st_mtime; /* time of last data modification */ 161 long st_mtimensec; /* nsec of last data modification */ 162 time_t st_ctime; /* time of last file status change */ 163 long st_ctimensec; /* nsec of last file status change */ 164 #endif 165 #endif /* bird: emx */ 166 off_t st_size; /* file size, in bytes */ 167 __int64_t st_blocks; /* blocks allocated for file */ 168 __uint32_t st_blksize; /* optimal blocksize for I/O */ 169 #if 1 /* bird: emx: */ 170 long st_attr; /* emx: OS/2 & DOS attributes */ 171 long st_reserved; 172 #else /* bird: emx */ 173 174 fflags_t st_flags; /* user defined flags for file */ 175 __uint32_t st_gen; /* file generation number */ 176 __int32_t st_lspare; 177 #if __BSD_VISIBLE 178 struct timespec st_birthtimespec; /* time of file creation */ 179 /* 180 * Explicitly pad st_birthtimespec to 16 bytes so that the size of 181 * struct stat is backwards compatible. We use bitfields instead 182 * of an array of chars so that this doesn't require a C99 compiler 183 * to compile if the size of the padding is 0. We use 2 bitfields 184 * to cover up to 64 bits on 32-bit machines. We assume that 185 * CHAR_BIT is 8... 186 */ 187 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); 188 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); 189 #else 190 time_t st_birthtime; /* time of file creation */ 191 long st_birthtimensec; /* nsec of file creation */ 192 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); 193 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); 194 #endif 195 #endif /* bird: emx - end */ 196 }; 197 198 #if 0 /* bird: emx */ 199 #if __BSD_VISIBLE 200 struct nstat { 201 __udev_t st_dev; /* inode's device */ 202 ino_t st_ino; /* inode's number */ 203 __uint32_t st_mode; /* inode protection mode */ 204 __uint32_t st_nlink; /* number of hard links */ 205 uid_t st_uid; /* user ID of the file's owner */ 206 gid_t st_gid; /* group ID of the file's group */ 207 __udev_t st_rdev; /* device type */ 208 struct timespec st_atimespec; /* time of last access */ 209 struct timespec st_mtimespec; /* time of last data modification */ 210 struct timespec st_ctimespec; /* time of last file status change */ 211 off_t st_size; /* file size, in bytes */ 212 __int64_t st_blocks; /* blocks allocated for file */ 213 __uint32_t st_blksize; /* optimal blocksize for I/O */ 214 fflags_t st_flags; /* user defined flags for file */ 215 __uint32_t st_gen; /* file generation number */ 216 struct timespec st_birthtimespec; /* time of file creation */ 217 /* 218 * See above about the following padding. 219 */ 220 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); 221 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); 222 }; 223 #endif 224 #endif /* bird: emx */ 225 226 #if 0 /* bird: emx */ 227 #if __BSD_VISIBLE 228 #define st_atime st_atimespec.tv_sec 229 #define st_mtime st_mtimespec.tv_sec 230 #define st_ctime st_ctimespec.tv_sec 231 #define st_birthtime st_birthtimespec.tv_sec 232 #endif 233 #endif /* bird: emx */ 234 235 #define S_ISUID 0004000 /* set user id on execution */ 236 #define S_ISGID 0002000 /* set group id on execution */ 237 #if __BSD_VISIBLE 238 #define S_ISTXT 0001000 /* sticky bit */ 239 #endif 240 241 #define S_IRWXU 0000700 /* RWX mask for owner */ 242 #define S_IRUSR 0000400 /* R for owner */ 243 #define S_IWUSR 0000200 /* W for owner */ 244 #define S_IXUSR 0000100 /* X for owner */ 245 246 #if __BSD_VISIBLE 247 #define S_IREAD S_IRUSR 248 #define S_IWRITE S_IWUSR 249 #define S_IEXEC S_IXUSR 250 #endif 251 252 #define S_IRWXG 0000070 /* RWX mask for group */ 253 #define S_IRGRP 0000040 /* R for group */ 254 #define S_IWGRP 0000020 /* W for group */ 255 #define S_IXGRP 0000010 /* X for group */ 256 257 #define S_IRWXO 0000007 /* RWX mask for other */ 258 #define S_IROTH 0000004 /* R for other */ 259 #define S_IWOTH 0000002 /* W for other */ 260 #define S_IXOTH 0000001 /* X for other */ 261 262 #if __XSI_VISIBLE 263 #define S_IFMT 0170000 /* type of file mask */ 264 #define S_IFIFO 0010000 /* named pipe (fifo) */ 265 #define S_IFCHR 0020000 /* character special */ 266 #define S_IFDIR 0040000 /* directory */ 267 #define S_IFBLK 0060000 /* block special */ 268 #define S_IFREG 0100000 /* regular */ 269 #define S_IFLNK 0120000 /* symbolic link */ 270 #define S_IFSOCK 0140000 /* socket */ 271 #define S_ISVTX 0001000 /* save swapped text even after use */ 272 #endif 273 #if __BSD_VISIBLE 274 #define S_IFWHT 0160000 /* whiteout */ 275 #endif 276 277 #define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */ 278 #define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */ 279 #define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */ 280 #define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */ 281 #define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */ 282 #if __POSIX_VISIBLE >= 200112 283 #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */ 284 #define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */ 285 #endif 286 #if __XSI_VISIBLE 287 #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */ 288 #endif 289 290 #if __BSD_VISIBLE 291 #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ 292 /* 7777 */ 293 #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) 294 /* 0666 */ 295 #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 296 297 #define S_BLKSIZE 512 /* block size used in the stat struct */ 298 299 /* 300 * Definitions of flags stored in file flags word. 301 * 302 * Super-user and owner changeable flags. 303 */ 304 #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ 305 #define UF_NODUMP 0x00000001 /* do not dump file */ 306 #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ 307 #define UF_APPEND 0x00000004 /* writes to file may only append */ 308 #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ 309 #define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ 310 /* 311 * Super-user changeable flags. 312 */ 313 #define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ 314 #define SF_ARCHIVED 0x00010000 /* file is archived */ 315 #define SF_IMMUTABLE 0x00020000 /* file may not be changed */ 316 #define SF_APPEND 0x00040000 /* writes to file may only append */ 317 #define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */ 318 #define SF_SNAPSHOT 0x00200000 /* snapshot inode */ 319 320 #ifdef _KERNEL 321 /* 322 * Shorthand abbreviations of above. 323 */ 324 #define OPAQUE (UF_OPAQUE) 325 #define APPEND (UF_APPEND | SF_APPEND) 326 #define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) 327 #define NOUNLINK (UF_NOUNLINK | SF_NOUNLINK) 328 #endif 329 330 #endif /* __BSD_VISIBLE */ 331 332 #ifndef _KERNEL 333 __BEGIN_DECLS 334 #if __BSD_VISIBLE 335 /** @todo int chflags(const char *, unsigned long); */ 336 #endif 337 /** @todo int chmod(const char *, mode_t); */ 338 #if __BSD_VISIBLE 339 /** @todo int fchflags(int, unsigned long); */ 340 /** @todo int fchmod(int, mode_t); */ 341 #endif 342 int fstat(int, struct stat *); 343 #if __BSD_VISIBLE 344 /** @todo int lchflags(const char *, int); */ 345 /** @todo int lchmod(const char *, mode_t); */ 346 #endif 347 #if __POSIX_VISIBLE >= 200112 348 int lstat(const char *, struct stat *); 349 #endif 350 int mkdir(const char *, mode_t); 351 /** @todo int mkfifo(const char *, mode_t); */ 352 int stat(const char *, struct stat *); 353 mode_t umask(mode_t); 354 355 /* bird: emx stuff - start */ 89 356 #if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE) 90 91 357 int _chmod (__const__ char *, int); 92 358 int _fstat (int, struct stat *); … … 95 361 int _stat (__const__ char *, struct stat *); 96 362 int _umask (int); 97 98 #endif 99 100 #if defined (__cplusplus) 101 } 102 #endif 103 104 #endif /* not SYS_STAT_H */ 363 #endif 364 /* bird: emx stuff - end */ 365 366 __END_DECLS 367 #endif /* !_KERNEL */ 368 369 #endif /* !_SYS_STAT_H_ */ 370 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.17
to1.18
r743 r744 816 816 "__std_ftello" @835 817 817 "__std_readdir_r" @836 818 "__std_lstat" @837 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__fstat.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r743 r744 92 92 { 93 93 pStat->st_size = info.fsts3L.cbFile; 94 pStat->st_blocks = info.fsts3L.cbFileAlloc / S_BLKSIZE; 94 95 rc = info.fsts3L.attrFile; 95 96 } … … 98 99 { 99 100 pStat->st_size = info.fsts3.cbFile; 101 pStat->st_blocks = info.fsts3.cbFileAlloc / S_BLKSIZE; 100 102 rc = info.fsts3.attrFile; 101 103 } … … 130 132 pStat->st_rdev = 0; 131 133 pStat->st_nlink = 1; 132 pStat->st_ reserved = 0; /* what is this good for?!? */134 pStat->st_blksize = 4096*48; 133 135 return 0; 134 136 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__stat.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r743 r744 90 90 #if OFF_MAX > LONG_MAX 91 91 if (fLarge) 92 { 92 93 pStat->st_size = info.fsf3L.cbFile; 94 pStat->st_blocks = info.fsts3L.cbFileAlloc / S_BLKSIZE; 95 } 93 96 else 94 97 #endif 98 { 95 99 pStat->st_size = info.fsts3.cbFile; 100 pStat->st_blocks = info.fsts3.cbFileAlloc / S_BLKSIZE; 101 } 96 102 pStat->st_mode = S_IFREG; 97 103 if (rc & FILE_READONLY) … … 110 116 pStat->st_nlink = 1; 111 117 pStat->st_reserved = 0; /* what is this good for?!? */ 118 pStat->st_blksize = 4096*48; 112 119 return 0; 113 120 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.