OSDN Git Service

Add clock_adjtime syscall
[uclinux-h8/uclibc-ng.git] / include / fcntl.h
index 1339286..c749ad5 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-2001,2003,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: 6.5 File Control Operations     <fcntl.h>
@@ -55,51 +55,114 @@ __BEGIN_DECLS
 # define SEEK_END      2       /* Seek from end of file.  */
 #endif /* XPG */
 
+#ifdef __USE_ATFILE
+# define AT_FDCWD              -100    /* Special value used to indicate
+                                          the *at functions should use the
+                                          current working directory. */
+# define AT_SYMLINK_NOFOLLOW   0x100   /* Do not follow symbolic links.  */
+# define AT_REMOVEDIR          0x200   /* Remove directory instead of
+                                          unlinking file.  */
+# define AT_SYMLINK_FOLLOW     0x400   /* Follow symbolic links.  */
+# define AT_EACCESS            0x200   /* Test access permitted for
+                                          effective IDs, not real IDs.  */
+#endif
+
 /* Do the file control operation described by CMD on FD.
-   The remaining arguments are interpreted depending on CMD.  */
-#ifndef __USE_FILE_OFFSET64
-extern int fcntl (int __fd, int __cmd, ...) __THROW;
+   The remaining arguments are interpreted depending on CMD.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+#if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
+extern int fcntl (int __fd, int __cmd, ...);
+# ifdef _LIBC
+extern int __fcntl_nocancel(int, int, long) attribute_hidden;
+libc_hidden_proto(fcntl)
+# endif
 #else
 # ifdef __REDIRECT
-extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...) __THROW,
-                      fcntl64);
+extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
 # else
 #  define fcntl fcntl64
 # endif
 #endif
+#if defined(__USE_LARGEFILE64) && !defined(__LP64__)
+extern int fcntl64 (int __fd, int __cmd, ...);
+# ifdef _LIBC
+extern int __fcntl64_nocancel(int, int, long) attribute_hidden;
+libc_hidden_proto(fcntl64)
+# endif
+#endif
 
 /* Open FILE and return a new file descriptor for it, or -1 on error.
    OFLAG determines the type of access used.  If O_CREAT is on OFLAG,
-   the third argument is taken as a `mode_t', the mode of the created file.  */
+   the third argument is taken as a `mode_t', the mode of the created file.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 #ifndef __USE_FILE_OFFSET64
-extern int open (__const char *__file, int __oflag, ...) __THROW;
+extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
+libc_hidden_proto(open)
+# ifdef _LIBC
+extern int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden;
+extern int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
+# endif
 #else
 # ifdef __REDIRECT
-extern int __REDIRECT (open, (__const char *__file, int __oflag, ...) __THROW,
-                      open64);
+extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
+     __nonnull ((1));
 # else
 #  define open open64
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
-extern int open64 (__const char *__file, int __oflag, ...) __THROW;
+extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
+libc_hidden_proto(open64)
+#endif
+
+#ifdef __USE_ATFILE
+/* Similar to `open' but a relative path name is interpreted relative to
+   the directory for which FD is a descriptor.
+
+   NOTE: some other `openat' implementation support additional functionality
+   through this interface, especially using the O_XATTR flag.  This is not
+   yet supported here.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+# ifndef __USE_FILE_OFFSET64
+extern int openat (int __fd, const char *__file, int __oflag, ...)
+     __nonnull ((2));
+libc_hidden_proto(openat)
+# else
+#  ifdef __REDIRECT
+extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
+                               ...), openat64) __nonnull ((2));
+#  else
+#   define openat openat64
+#  endif
+# endif
+
+extern int openat64 (int __fd, const char *__file, int __oflag, ...)
+     __nonnull ((2));
 #endif
 
-/* Create and open FILE, with mode MODE.
-   This takes an `int' MODE argument because that is
-   what `mode_t' will be widened to.  */
+/* Create and open FILE, with mode MODE.  This takes an `int' MODE
+   argument because that is what `mode_t' will be widened to.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 #ifndef __USE_FILE_OFFSET64
-extern int creat (__const char *__file, __mode_t __mode) __THROW;
+extern int creat (const char *__file, __mode_t __mode) __nonnull ((1));
 #else
 # ifdef __REDIRECT
-extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode) __THROW,
-                      creat64);
+extern int __REDIRECT (creat, (const char *__file, __mode_t __mode),
+                      creat64) __nonnull ((1));
 # else
 #  define creat creat64
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
-extern int creat64 (__const char *__file, __mode_t __mode) __THROW;
+extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
 #endif
 
 #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
@@ -118,64 +181,62 @@ extern int creat64 (__const char *__file, __mode_t __mode) __THROW;
 # define F_TEST  3     /* Test a region for other processes locks.  */
 
 # ifndef __USE_FILE_OFFSET64
-extern int lockf (int __fd, int __cmd, __off_t __len) __THROW;
+extern int lockf (int __fd, int __cmd, __off_t __len);
+libc_hidden_proto(lockf)
 # else
-# ifdef __REDIRECT
-extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len) __THROW,
-                      lockf64);
-# else
-#  define lockf lockf64
-# endif
+#  ifdef __REDIRECT
+extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
+#  else
+#   define lockf lockf64
+#  endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;
+extern int lockf64 (int __fd, int __cmd, __off64_t __len);
 # endif
 #endif
 
-
-#ifdef __USE_XOPEN2K
+#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
 /* Advice the system about the expected behaviour of the application with
    respect to the file associated with FD.  */
 # ifndef __USE_FILE_OFFSET64
-extern int posix_fadvise (int __fd, __off_t __offset, size_t __len,
+extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
                          int __advise) __THROW;
 # else
-# ifdef __REDIRECT
-extern int __REDIRECT (posix_fadvise, (int __fd, __off64_t __offset,
-                                      size_t __len, int __advise) __THROW,
-                      posix_fadvise64);
-# else
-#  define posix_fadvise posix_fadvise64
-# endif
+#  ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
+                                          __off64_t __len, int __advise),
+                          posix_fadvise64);
+#  else
+#   define posix_fadvise posix_fadvise64
+#  endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int posix_fadvise64 (int __fd, __off64_t __offset, size_t __len,
+extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
                            int __advise) __THROW;
 # endif
 
 #endif
 
-#if 0
+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
 
-/* FIXME -- uClibc should probably implement these... */
+/* Reserve storage for the data of the file associated with FD.
 
-/* Reserve storage for the data of the file associated with FD.  */
+   This function is a possible cancellation points and therefore not
+   marked with __THROW.  */
 # ifndef __USE_FILE_OFFSET64
-extern int posix_fallocate (int __fd, __off_t __offset, size_t __len) __THROW;
+extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
 # else
-# ifdef __REDIRECT
+#  ifdef __REDIRECT
 extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
-                                        size_t __len) __THROW,
+                                        __off64_t __len),
                       posix_fallocate64);
-# else
-#  define posix_fallocate posix_fallocate64
-# endif
+#  else
+#   define posix_fallocate posix_fallocate64
+#  endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int posix_fallocate64 (int __fd, __off64_t __offset, size_t __len)
-     __THROW;
+extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
 # endif
-
 #endif
 
 __END_DECLS