diff options
Diffstat (limited to 'include/sys/stat.h')
-rw-r--r-- | include/sys/stat.h | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/include/sys/stat.h b/include/sys/stat.h index 2b29e420f..1f758d30c 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 1995-1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2002,2003,2004 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 @@ -27,10 +27,17 @@ #include <bits/types.h> /* For __mode_t and __dev_t. */ -#ifdef __USE_XOPEN -# define __need_time_t -# include <time.h> /* For time_t. */ +#if defined __USE_XOPEN || defined __USE_MISC +# if defined __USE_XOPEN || defined __USE_XOPEN2K +# define __need_time_t +# endif +# ifdef __USE_MISC +# define __need_timespec +# endif +# include <time.h> /* For time_t resp. timespec. */ +#endif +#if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ # ifndef __dev_t_defined @@ -109,7 +116,7 @@ __BEGIN_DECLS # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif -# if (defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K) \ +# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98) \ && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif @@ -130,13 +137,13 @@ __BEGIN_DECLS # define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) #endif -#ifdef __USE_BSD -# ifndef __S_IFLNK -# define S_ISLNK(mode) 0 -# endif -# ifdef __S_IFSOCK -# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) -# endif +#if defined __USE_BSD && !defined __S_IFLNK +# define S_ISLNK(mode) 0 +#endif + +#if (defined __USE_BSD || defined __USE_UNIX98) \ + && defined __S_IFSOCK +# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) #endif /* These are from POSIX.1b. If the objects are not implemented using separate @@ -198,18 +205,18 @@ __BEGIN_DECLS #ifndef __USE_FILE_OFFSET64 /* Get file attributes for FILE and put them in BUF. */ extern int stat (__const char *__restrict __file, - struct stat *__restrict __buf) __THROW; + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); /* 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; +extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT -extern int __REDIRECT (stat, - (__const char *__restrict __file, - struct stat *__restrict __buf) __THROW, - stat64); -extern int __REDIRECT (fstat, (int __fd, struct stat *__buf) __THROW, fstat64); +extern int __REDIRECT (stat, (__const char *__restrict __file, + struct stat *__restrict __buf), stat64) + __nonnull ((1, 2)); +extern int __REDIRECT (fstat, (int __fd, struct stat *__buf), fstat64) + __nonnull ((2)); # else # define stat stat64 # define fstat fstat64 @@ -217,8 +224,8 @@ extern int __REDIRECT (fstat, (int __fd, struct stat *__buf) __THROW, fstat64); #endif #ifdef __USE_LARGEFILE64 extern int stat64 (__const char *__restrict __file, - struct stat64 *__restrict __buf) __THROW; -extern int fstat64 (int __fd, struct stat64 *__buf) __THROW; + struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); +extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -226,27 +233,36 @@ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW; /* 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, - struct stat *__restrict __buf) __THROW; + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (lstat, - (__const char *__restrict __file, - struct stat *__restrict __buf) __THROW, - lstat64); + (__const char *__restrict __file, + struct stat *__restrict __buf), lstat64) + __nonnull ((1, 2)); # else # define lstat lstat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lstat64 (__const char *__restrict __file, - struct stat64 *__restrict __buf) __THROW; + struct stat64 *__restrict __buf) + __THROW __nonnull ((1, 2)); # endif #endif /* Set file access permissions for FILE to MODE. - This takes an `int' MODE argument because that - is what `mode_t's get widened to. */ -extern int chmod (__const char *__file, __mode_t __mode) __THROW; + If FILE is a symbolic link, this affects its target instead. */ +extern int chmod (__const char *__file, __mode_t __mode) + __THROW __nonnull ((1)); + +#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) + __THROW __nonnull ((1)); +#endif /* Set file access permissions of the file FD is open on to MODE. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -265,18 +281,21 @@ 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) __THROW; +extern int mkdir (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); /* 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) - __THROW; + __THROW __nonnull ((1)); #endif + /* Create a new FIFO named PATH, with permission bits MODE. */ -extern int mkfifo (__const char *__path, __mode_t __mode) __THROW; +extern int mkfifo (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); __END_DECLS |