Search
lxdream.org :: lxdream/test/include/sys/stat.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/include/sys/stat.h
changeset 185:6755a04c447f
author nkeynes
date Sun Oct 07 06:27:12 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Fix compilation warnings
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/include/sys/stat.h Sun Oct 07 06:27:12 2007 +0000
1.3 @@ -0,0 +1,149 @@
1.4 +#ifndef _SYS_STAT_H
1.5 +#define _SYS_STAT_H
1.6 +
1.7 +#ifdef __cplusplus
1.8 +extern "C" {
1.9 +#endif
1.10 +
1.11 +#include <_ansi.h>
1.12 +#include <time.h>
1.13 +#include <sys/types.h>
1.14 +
1.15 +#ifdef __i386__
1.16 +#ifdef __MSDOS__
1.17 +#include "stat-dj.h"
1.18 +#endif
1.19 +#endif
1.20 +
1.21 +/* dj's stat defines _STAT_H_ */
1.22 +#ifndef _STAT_H_
1.23 +
1.24 +/* It is intended that the layout of this structure not change when the
1.25 + sizes of any of the basic types change (short, int, long) [via a compile
1.26 + time option]. */
1.27 +
1.28 +struct stat
1.29 +{
1.30 + dev_t st_dev;
1.31 + ino_t st_ino;
1.32 + mode_t st_mode;
1.33 + nlink_t st_nlink;
1.34 + uid_t st_uid;
1.35 + gid_t st_gid;
1.36 + dev_t st_rdev;
1.37 + off_t st_size;
1.38 + /* SysV/sco doesn't have the rest... But Solaris, eabi does. */
1.39 +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
1.40 + time_t st_atime;
1.41 + time_t st_mtime;
1.42 + time_t st_ctime;
1.43 +#else
1.44 + time_t st_atime;
1.45 + long st_spare1;
1.46 + time_t st_mtime;
1.47 + long st_spare2;
1.48 + time_t st_ctime;
1.49 + long st_spare3;
1.50 + long st_blksize;
1.51 + long st_blocks;
1.52 + long st_spare4[2];
1.53 +#endif
1.54 +};
1.55 +
1.56 +#define _IFMT 0170000 /* type of file */
1.57 +#define _IFDIR 0040000 /* directory */
1.58 +#define _IFCHR 0020000 /* character special */
1.59 +#define _IFBLK 0060000 /* block special */
1.60 +#define _IFREG 0100000 /* regular */
1.61 +#define _IFLNK 0120000 /* symbolic link */
1.62 +#define _IFSOCK 0140000 /* socket */
1.63 +#define _IFIFO 0010000 /* fifo */
1.64 +
1.65 +#define S_BLKSIZE 1024 /* size of a block */
1.66 +
1.67 +#define S_ISUID 0004000 /* set user id on execution */
1.68 +#define S_ISGID 0002000 /* set group id on execution */
1.69 +#ifndef _POSIX_SOURCE
1.70 +#define S_ISVTX 0001000 /* save swapped text even after use */
1.71 +#define S_IREAD 0000400 /* read permission, owner */
1.72 +#define S_IWRITE 0000200 /* write permission, owner */
1.73 +#define S_IEXEC 0000100 /* execute/search permission, owner */
1.74 +
1.75 +#define S_ENFMT 0002000 /* enforcement-mode locking */
1.76 +
1.77 +#define S_IFMT _IFMT
1.78 +#define S_IFDIR _IFDIR
1.79 +#define S_IFCHR _IFCHR
1.80 +#define S_IFBLK _IFBLK
1.81 +#define S_IFREG _IFREG
1.82 +#define S_IFLNK _IFLNK
1.83 +#define S_IFSOCK _IFSOCK
1.84 +#define S_IFIFO _IFIFO
1.85 +#endif /* !_POSIX_SOURCE */
1.86 +
1.87 +#ifdef _WIN32
1.88 +/* The Windows header files define _S_ forms of these, so we do too
1.89 + for easier portability. */
1.90 +#define _S_IFMT _IFMT
1.91 +#define _S_IFDIR _IFDIR
1.92 +#define _S_IFCHR _IFCHR
1.93 +#define _S_IFIFO _IFIFO
1.94 +#define _S_IFREG _IFREG
1.95 +#define _S_IREAD 0000400
1.96 +#define _S_IWRITE 0000200
1.97 +#define _S_IEXEC 0000100
1.98 +#endif
1.99 +
1.100 +#define S_IRWXU 0000700 /* rwx, owner */
1.101 +#define S_IRUSR 0000400 /* read permission, owner */
1.102 +#define S_IWUSR 0000200 /* write permission, owner */
1.103 +#define S_IXUSR 0000100 /* execute/search permission, owner */
1.104 +#define S_IRWXG 0000070 /* rwx, group */
1.105 +#define S_IRGRP 0000040 /* read permission, group */
1.106 +#define S_IWGRP 0000020 /* write permission, grougroup */
1.107 +#define S_IXGRP 0000010 /* execute/search permission, group */
1.108 +#define S_IRWXO 0000007 /* rwx, other */
1.109 +#define S_IROTH 0000004 /* read permission, other */
1.110 +#define S_IWOTH 0000002 /* write permission, other */
1.111 +#define S_IXOTH 0000001 /* execute/search permission, other */
1.112 +
1.113 +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
1.114 +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
1.115 +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
1.116 +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
1.117 +#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
1.118 +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
1.119 +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
1.120 +
1.121 +
1.122 +int _EXFUN(chmod,( const char *__path, mode_t __mode ));
1.123 +int _EXFUN(fchmod,(int __fd, mode_t __mode));
1.124 +int _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
1.125 +int _EXFUN(mkdir,( const char *_path, mode_t __mode ));
1.126 +int _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
1.127 +int _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
1.128 +mode_t _EXFUN(umask,( mode_t __mask ));
1.129 +
1.130 +#if defined(__rtems__)
1.131 +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev ));
1.132 +#endif
1.133 +
1.134 +/* Provide prototypes for most of the _<systemcall> names that are
1.135 + provided in newlib for some compilers. */
1.136 +int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
1.137 +int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
1.138 +
1.139 +#ifdef __CYGWIN32__
1.140 +int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
1.141 +#endif
1.142 +
1.143 +#if defined(__rtems__)
1.144 +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev ));
1.145 +int _EXFUN(lstat,( const char *_path, struct stat *_sbuf ));
1.146 +#endif
1.147 +
1.148 +#endif /* !_STAT_H_ */
1.149 +#ifdef __cplusplus
1.150 +}
1.151 +#endif
1.152 +#endif /* _SYS_STAT_H */
.