aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'io/sys/stat.h')
-rw-r--r--io/sys/stat.h198
1 files changed, 142 insertions, 56 deletions
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 5485976ca6..01bc00165e 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,42 +31,42 @@ __BEGIN_DECLS
#include <bits/stat.h>
-#if defined(__USE_BSD) || defined(__USE_MISC)
-#define S_IFMT __S_IFMT
-#define S_IFDIR __S_IFDIR
-#define S_IFCHR __S_IFCHR
-#define S_IFBLK __S_IFBLK
-#define S_IFREG __S_IFREG
-#ifdef __S_IFLNK
-#define S_IFLNK __S_IFLNK
-#endif
-#ifdef __S_IFSOCK
-#define S_IFSOCK __S_IFSOCK
-#endif
-#ifdef __S_IFIFO
-#define S_IFIFO __S_IFIFO
-#endif
+#if defined __USE_BSD || defined __USE_MISC
+# define S_IFMT __S_IFMT
+# define S_IFDIR __S_IFDIR
+# define S_IFCHR __S_IFCHR
+# define S_IFBLK __S_IFBLK
+# define S_IFREG __S_IFREG
+# ifdef __S_IFLNK
+# define S_IFLNK __S_IFLNK
+# endif
+# ifdef __S_IFSOCK
+# define S_IFSOCK __S_IFSOCK
+# endif
+# ifdef __S_IFIFO
+# define S_IFIFO __S_IFIFO
+# endif
#endif
/* Test macros for file types. */
#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
-#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
-#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
-#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
-#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
+#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
+#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
+#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
+#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
#ifdef __S_IFIFO
-#define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
+# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
#endif
#ifdef __USE_BSD
-#ifdef __S_IFLNK
-#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
-#endif
-#ifdef __S_IFSOCK
-#define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
-#endif
+# ifdef __S_IFLNK
+# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
+# endif
+# ifdef __S_IFSOCK
+# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
+# endif
#endif
@@ -75,9 +75,9 @@ __BEGIN_DECLS
#define S_ISUID __S_ISUID /* Set user ID on execution. */
#define S_ISGID __S_ISGID /* Set group ID on execution. */
-#if defined(__USE_BSD) || defined(__USE_MISC)
+#if defined __USE_BSD || defined __USE_MISC
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
-#define S_ISVTX __S_ISVTX
+# define S_ISVTX __S_ISVTX
#endif
#define S_IRUSR __S_IREAD /* Read by owner. */
@@ -86,10 +86,10 @@ __BEGIN_DECLS
/* Read, write, and execute by owner. */
#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
-#if defined(__USE_MISC) && defined(__USE_BSD)
-#define S_IREAD S_IRUSR
-#define S_IWRITE S_IWUSR
-#define S_IEXEC S_IXUSR
+#if defined __USE_MISC && defined __USE_BSD
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+# define S_IEXEC S_IXUSR
#endif
#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
@@ -107,28 +107,51 @@ __BEGIN_DECLS
#ifdef __USE_BSD
/* Macros for common mode bit masks. */
-#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
-#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
-#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666 */
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
-#define S_BLKSIZE 512 /* Block size for `st_blocks'. */
+# define S_BLKSIZE 512 /* Block size for `st_blocks'. */
#endif
/* Get file attributes for FILE and put them in BUF. */
extern int __stat __P ((__const char *__file, struct stat *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int stat __P ((__const char *__file, struct stat *__buf));
+#else
+extern int stat __P ((__const char *__file, struct stat *__buf))
+ __asm__ ("stat64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int stat64 __P ((__const char *__file, struct stat64 *__buf));
+#endif
/* Get file attributes for the file, device, pipe, or socket
that file descriptor FD is open on and put them in BUF. */
extern int __fstat __P ((int __fd, struct stat *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int fstat __P ((int __fd, struct stat *__buf));
+#else
+extern int fstat __P ((int __fd, struct stat *__buf)) __asm__ ("fstat64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int fstat64 __P ((int __fd, struct stat64 *__buf));
+#endif
/* Get file attributes about FILE and put them in BUF.
If FILE is a symbolic link, do not follow it. */
extern int __lstat __P ((__const char *__file, struct stat *__buf));
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# ifndef __USE_FILE_OFFSET64
extern int lstat __P ((__const char *__file, struct stat *__buf));
+# else
+extern int lstat __P ((__const char *__file, struct stat *__buf))
+ __asm__ ("lstat64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lstat64 __P ((__const char *__file, struct stat64 *__buf));
+# endif
#endif
/* Set file access permissions for FILE to MODE.
@@ -139,7 +162,7 @@ extern int chmod __P ((__const char *__file, __mode_t __mode));
/* Set file access permissions of the file FD is open on to MODE. */
extern int __fchmod __P ((int __fd, __mode_t __mode));
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int fchmod __P ((int __fd, __mode_t __mode));
#endif
@@ -164,7 +187,7 @@ extern int mkdir __P ((__const char *__path, __mode_t __mode));
device numbers with the `makedev' macro above). */
extern int __mknod __P ((__const char *__path,
__mode_t __mode, __dev_t __dev));
-#if defined(__USE_MISC) || defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int mknod __P ((__const char *__path,
__mode_t __mode, __dev_t __dev));
#endif
@@ -189,10 +212,10 @@ extern int mkfifo __P ((__const char *__path, __mode_t __mode));
callers. */
#ifndef _STAT_VER
-#define _STAT_VER 0
+# define _STAT_VER 0
#endif
#ifndef _MKNOD_VER
-#define _MKNOD_VER 0
+# define _MKNOD_VER 0
#endif
/* Wrappers for stat and mknod system calls. */
@@ -204,35 +227,98 @@ extern int __lxstat __P ((int __ver, __const char *__filename,
struct stat *__stat_buf));
extern int __xmknod __P ((int __ver, __const char *__path,
__mode_t __mode, __dev_t *__dev));
+#if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
+extern int __fxstat64 __P ((int __ver, int __fildes,
+ struct stat64 *__stat_buf));
+extern int __xstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+extern int __lxstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+#endif
-#if defined (__GNUC__) && __GNUC__ >= 2
+#if defined __GNUC__ && __GNUC__ >= 2
/* Inlined versions of the real stat and mknod functions. */
extern __inline__ int __stat (__const char *__path, struct stat *__statbuf)
-{ return __xstat (_STAT_VER, __path, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __xstat (_STAT_VER, __path, __statbuf);
+# else
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
extern __inline__ int stat (__const char *__path, struct stat *__statbuf)
-{ return __xstat (_STAT_VER, __path, __statbuf); }
-
-extern __inline__ int __lstat(__const char *__path, struct stat *__statbuf)
-{ return __lxstat (_STAT_VER, __path, __statbuf); }
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
-extern __inline__ int lstat(__const char *__path, struct stat *__statbuf)
-{ return __lxstat (_STAT_VER, __path, __statbuf); }
-#endif
+{
+# ifndef __USE_FILE_OFFSET64
+ return __xstat (_STAT_VER, __path, __statbuf);
+# else
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+
+extern __inline__ int __lstat (__const char *__path, struct stat *__statbuf)
+{
+# ifndef __USE_FILE_OFFSET64
+ return __lxstat (_STAT_VER, __path, __statbuf);
+# else
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat (__const char *__path, struct stat *__statbuf)
+{
+# ifndef __USE_FILE_OFFSET64
+ return __lxstat (_STAT_VER, __path, __statbuf);
+# else
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+# endif
extern __inline__ int __fstat (int __fd, struct stat *__statbuf)
-{ return __fxstat (_STAT_VER, __fd, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __fxstat (_STAT_VER, __fd, __statbuf);
+# else
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+# endif
+}
extern __inline__ int fstat (int __fd, struct stat *__statbuf)
-{ return __fxstat (_STAT_VER, __fd, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __fxstat (_STAT_VER, __fd, __statbuf);
+# else
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+# endif
+}
extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
__dev_t __dev)
{ return __xmknod (_MKNOD_VER, __path, __mode, &__dev); }
-#if defined(__USE_MISC) || defined(__USE_BSD)
+# if defined __USE_MISC || defined __USE_BSD
extern __inline__ int mknod (__const char *__path, __mode_t __mode,
__dev_t __dev)
{ return __xmknod (_MKNOD_VER, __path, __mode, &__dev); }
-#endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern __inline__ int stat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+}
+
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+}
+# endif
+
+extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf)
+{
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+}
+# endif
#endif