summaryrefslogtreecommitdiff
path: root/Unix/i686-elf/include/sys/stat.h
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-12-18 16:22:58 +0100
committerAlexis211 <alexis211@gmail.com>2009-12-18 16:22:58 +0100
commitd04645198d648a17ccb83e70aa5e6d60a06121aa (patch)
tree4ee3203112c2fda42a85ec00f3f78eee14689869 /Unix/i686-elf/include/sys/stat.h
parent5f87c447bdcb82beacbfb930942fe9995dcdb60f (diff)
downloadMelon-d04645198d648a17ccb83e70aa5e6d60a06121aa.tar.gz
Melon-d04645198d648a17ccb83e70aa5e6d60a06121aa.zip
[nonworking commit] Started porting newlib
Diffstat (limited to 'Unix/i686-elf/include/sys/stat.h')
-rw-r--r--Unix/i686-elf/include/sys/stat.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/Unix/i686-elf/include/sys/stat.h b/Unix/i686-elf/include/sys/stat.h
new file mode 100644
index 0000000..5163244
--- /dev/null
+++ b/Unix/i686-elf/include/sys/stat.h
@@ -0,0 +1,147 @@
+#ifndef _SYS_STAT_H
+#define _SYS_STAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <_ansi.h>
+#include <time.h>
+#include <sys/types.h>
+
+/* dj's stat defines _STAT_H_ */
+#ifndef _STAT_H_
+
+/* It is intended that the layout of this structure not change when the
+ sizes of any of the basic types change (short, int, long) [via a compile
+ time option]. */
+
+#ifdef __CYGWIN__
+#include <cygwin/stat.h>
+#ifdef _COMPILING_NEWLIB
+#define stat64 __stat64
+#endif
+#else
+struct stat
+{
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ /* SysV/sco doesn't have the rest... But Solaris, eabi does. */
+#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+#else
+ time_t st_atime;
+ long st_spare1;
+ time_t st_mtime;
+ long st_spare2;
+ time_t st_ctime;
+ long st_spare3;
+ long st_blksize;
+ long st_blocks;
+ long st_spare4[2];
+#endif
+};
+#endif
+
+#define _IFMT 0170000 /* type of file */
+#define _IFDIR 0040000 /* directory */
+#define _IFCHR 0020000 /* character special */
+#define _IFBLK 0060000 /* block special */
+#define _IFREG 0100000 /* regular */
+#define _IFLNK 0120000 /* symbolic link */
+#define _IFSOCK 0140000 /* socket */
+#define _IFIFO 0010000 /* fifo */
+
+#define S_BLKSIZE 1024 /* size of a block */
+
+#define S_ISUID 0004000 /* set user id on execution */
+#define S_ISGID 0002000 /* set group id on execution */
+#ifndef _POSIX_SOURCE
+#define S_ISVTX 0001000 /* save swapped text even after use */
+#define S_IREAD 0000400 /* read permission, owner */
+#define S_IWRITE 0000200 /* write permission, owner */
+#define S_IEXEC 0000100 /* execute/search permission, owner */
+#define S_ENFMT 0002000 /* enforcement-mode locking */
+
+#define S_IFMT _IFMT
+#define S_IFDIR _IFDIR
+#define S_IFCHR _IFCHR
+#define S_IFBLK _IFBLK
+#define S_IFREG _IFREG
+#define S_IFLNK _IFLNK
+#define S_IFSOCK _IFSOCK
+#define S_IFIFO _IFIFO
+#endif /* !_POSIX_SOURCE */
+
+#ifdef _WIN32
+/* The Windows header files define _S_ forms of these, so we do too
+ for easier portability. */
+#define _S_IFMT _IFMT
+#define _S_IFDIR _IFDIR
+#define _S_IFCHR _IFCHR
+#define _S_IFIFO _IFIFO
+#define _S_IFREG _IFREG
+#define _S_IREAD 0000400
+#define _S_IWRITE 0000200
+#define _S_IEXEC 0000100
+#endif
+
+#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#define S_IRUSR 0000400 /* read permission, owner */
+#define S_IWUSR 0000200 /* write permission, owner */
+#define S_IXUSR 0000100/* execute/search permission, owner */
+#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#define S_IRGRP 0000040 /* read permission, group */
+#define S_IWGRP 0000020 /* write permission, grougroup */
+#define S_IXGRP 0000010/* execute/search permission, group */
+#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#define S_IROTH 0000004 /* read permission, other */
+#define S_IWOTH 0000002 /* write permission, other */
+#define S_IXOTH 0000001/* execute/search permission, other */
+
+#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
+#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
+#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
+#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
+#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
+#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
+#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
+
+
+int _EXFUN(chmod,( const char *__path, mode_t __mode ));
+int _EXFUN(fchmod,(int __fd, mode_t __mode));
+int _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
+int _EXFUN(mkdir,( const char *_path, mode_t __mode ));
+int _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
+int _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
+mode_t _EXFUN(umask,( mode_t __mask ));
+
+#if defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
+int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
+int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
+#endif
+
+/* Provide prototypes for most of the _<systemcall> names that are
+ provided in newlib for some compilers. */
+#ifdef _COMPILING_NEWLIB
+int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
+int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+#ifdef __LARGE64_FILES
+struct stat64;
+int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
+#endif
+#endif
+
+#endif /* !_STAT_H_ */
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SYS_STAT_H */