summaryrefslogtreecommitdiff
path: root/include/sys/stat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys/stat.h')
-rw-r--r--include/sys/stat.h87
1 files changed, 60 insertions, 27 deletions
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 508239050..495a68cb1 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007, 2009
+ 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 5.6 File Characteristics <sys/stat.h>
@@ -27,11 +27,12 @@
#include <bits/types.h> /* For __mode_t and __dev_t. */
-#if defined __USE_XOPEN || defined __USE_MISC
+#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_MISC \
+ || defined __USE_ATFILE
# if defined __USE_XOPEN || defined __USE_XOPEN2K
# define __need_time_t
# endif
-# ifdef __USE_MISC
+# if defined __USE_MISC || defined __USE_ATFILE
# define __need_timespec
# endif
# include <time.h> /* For time_t resp. timespec. */
@@ -204,15 +205,17 @@ __BEGIN_DECLS
#ifndef __USE_FILE_OFFSET64
/* Get file attributes for FILE and put them in BUF. */
-extern int stat (__const char *__restrict __file,
+extern int stat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
+libc_hidden_proto(stat)
/* 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 (int __fd, struct stat *__buf) __THROW __nonnull ((2));
+libc_hidden_proto(fstat)
#else
# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (stat, (__const char *__restrict __file,
+extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf), stat64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
@@ -223,9 +226,11 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int stat64 (__const char *__restrict __file,
+extern int stat64 (const char *__restrict __file,
struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+libc_hidden_proto(stat64)
+libc_hidden_proto(fstat64)
#endif
#ifdef __USE_ATFILE
@@ -233,12 +238,13 @@ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
Relative path names are interpreted relative to FD unless FD is
AT_FDCWD. */
# ifndef __USE_FILE_OFFSET64
-extern int fstatat (int __fd, __const char *__restrict __file,
+extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
+libc_hidden_proto(fstatat)
# else
# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file,
+extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
int __flag),
fstatat64) __nonnull ((2, 3));
@@ -247,21 +253,25 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file,
# endif
# endif
-extern int fstatat64 (int __fd, __const char *__restrict __file,
+# ifdef __USE_LARGEFILE64
+extern int fstatat64 (int __fd, const char *__restrict __file,
struct stat64 *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
+libc_hidden_proto(fstatat64)
+# endif
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __USE_FILE_OFFSET64
/* Get file attributes about FILE and put them in BUF.
If FILE is a symbolic link, do not follow it. */
-extern int lstat (__const char *__restrict __file,
+extern int lstat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
+libc_hidden_proto(lstat)
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
- (__const char *__restrict __file,
+ (const char *__restrict __file,
struct stat *__restrict __buf), lstat64)
__nonnull ((1, 2));
# else
@@ -269,22 +279,24 @@ extern int __REDIRECT_NTH (lstat,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int lstat64 (__const char *__restrict __file,
+extern int lstat64 (const char *__restrict __file,
struct stat64 *__restrict __buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(lstat64)
# endif
#endif
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects its target instead. */
-extern int chmod (__const char *__file, __mode_t __mode)
+extern int chmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
+libc_hidden_proto(chmod)
#if 0 /*def __USE_BSD*/
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects the link itself
rather than its target. */
-extern int lchmod (__const char *__file, __mode_t __mode)
+extern int lchmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
#endif
@@ -296,8 +308,10 @@ extern int fchmod (int __fd, __mode_t __mode) __THROW;
#ifdef __USE_ATFILE
/* Set file access permissions of FILE relative to
the directory FD is open on. */
-extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag)
+extern int fchmodat (int __fd, const char *__file, __mode_t __mode,
+ int __flag)
__THROW __nonnull ((2)) __wur;
+libc_hidden_proto(fchmodat)
#endif /* Use ATFILE. */
@@ -313,46 +327,65 @@ extern __mode_t getumask (void) __THROW;
#endif
/* Create a new directory named PATH, with permission bits MODE. */
-extern int mkdir (__const char *__path, __mode_t __mode)
+extern int mkdir (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
+libc_hidden_proto(mkdir)
#ifdef __USE_ATFILE
/* Like mkdir, create a new directory with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
-extern int mkdirat (int __fd, __const char *__path, __mode_t __mode)
+extern int mkdirat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
+libc_hidden_proto(mkdirat)
#endif
/* Create a device file named PATH, with permission and special bits MODE
and device number DEV (which can be constructed from major and minor
device numbers with the `makedev' macro above). */
#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
+extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev)
__THROW __nonnull ((1));
-#endif
+libc_hidden_proto(mknod)
-#ifdef __USE_ATFILE
+# ifdef __USE_ATFILE
/* Like mknod, create a new device file with permission bits MODE and
device number DEV. But interpret relative PATH names relative to
the directory associated with FD. */
-extern int mknodat (int __fd, __const char *__path, __mode_t __mode,
+extern int mknodat (int __fd, const char *__path, __mode_t __mode,
__dev_t __dev) __THROW __nonnull ((2));
+libc_hidden_proto(mknodat)
+# endif
#endif
/* Create a new FIFO named PATH, with permission bits MODE. */
-extern int mkfifo (__const char *__path, __mode_t __mode)
+extern int mkfifo (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
#ifdef __USE_ATFILE
/* Like mkfifo, create a new FIFO with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
-extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode)
+extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
#endif
+
+#ifdef __USE_ATFILE
+/* Set file access and modification times relative to directory file
+ descriptor. */
+extern int utimensat (int __fd, const char *__path,
+ const struct timespec __times[2],
+ int __flags)
+ __THROW __nonnull ((2));
+libc_hidden_proto(utimensat)
+#endif
+#ifdef __USE_XOPEN2K8
+/* Set file access and modification times of the file associated with FD. */
+extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
+#endif
+
/* on uClibc we have unversioned struct stat and mknod.
* bits/stat.h is filled with wrong info, so we undo it here. */
#undef _STAT_VER