From 0b8f25bbca8a9d08f0bdae0772fa5ec5172144b5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 5 Jan 2006 12:25:42 +0000 Subject: [PATCH] * include/features.h: Grok _ATFILE_SOURCE and define __USE_ATFILE when it or _GNU_SOURCE is defined. * io/fcntl.h: Protect *at and AT_* with [__USE_ATFILE] instead of [__USE_GNU]. * libio/stdio.h: Likewise. * posix/unistd.h: Likewise. * time/sys/time.h: Likewise. --- ChangeLog | 8 ++++++++ include/features.h | 12 +++++++++++- io/fcntl.h | 12 ++++++------ libio/stdio.h | 4 ++-- posix/unistd.h | 8 ++++---- time/sys/time.h | 5 +++-- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index d982f36..5a7169f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-01-05 Roland McGrath + * include/features.h: Grok _ATFILE_SOURCE and define __USE_ATFILE when + it or _GNU_SOURCE is defined. + * io/fcntl.h: Protect *at and AT_* with [__USE_ATFILE] instead of + [__USE_GNU]. + * libio/stdio.h: Likewise. + * posix/unistd.h: Likewise. + * time/sys/time.h: Likewise. + * io/sys/stat.h [__USE_GNU]: Declare fchmodat. * io/fchmodat.c: New file. * io/Makefile (routines): Add fchmodat. diff --git a/include/features.h b/include/features.h index e252a0c..78eeb88 100644 --- a/include/features.h +++ b/include/features.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1993,1995-2003,2004,2005 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1993,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 + 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 @@ -38,6 +39,7 @@ _FILE_OFFSET_BITS=N Select default filesystem interface. _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. _SVID_SOURCE ISO C, POSIX, and SVID things. + _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. @@ -69,6 +71,7 @@ __USE_BSD Define 4.3BSD things. __USE_SVID Define SVID things. __USE_MISC Define things common to BSD and System V Unix. + __USE_ATFILE Define *at interfaces and AT_* constants for them. __USE_GNU Define GNU extensions. __USE_REENTRANT Define reentrant/thread-safe *_r functions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. @@ -102,6 +105,7 @@ #undef __USE_BSD #undef __USE_SVID #undef __USE_MISC +#undef __USE_ATFILE #undef __USE_GNU #undef __USE_REENTRANT #undef __USE_FORTIFY_LEVEL @@ -158,6 +162,8 @@ # define _BSD_SOURCE 1 # undef _SVID_SOURCE # define _SVID_SOURCE 1 +# undef _ATFILE_SOURCE +# define _ATFILE_SOURCE 1 #endif /* If nothing (other than _GNU_SOURCE) is defined, @@ -256,6 +262,10 @@ # define __USE_SVID 1 #endif +#ifdef _ATFILE_SOURCE +# define __USE_ATFILE 1 +#endif + #ifdef _GNU_SOURCE # define __USE_GNU 1 #endif diff --git a/io/fcntl.h b/io/fcntl.h index 8e13d33..fd45933 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005 - Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006 + 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 @@ -56,7 +56,7 @@ __BEGIN_DECLS # define SEEK_END 2 /* Seek from end of file. */ #endif /* XPG */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE # define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */ @@ -92,11 +92,11 @@ extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1)); #endif -#ifdef __USE_GNU -/* Similar to OPEN but a relative path name is interpreted relative to +#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 + NOTE: some other `openat' implementation support additional functionality through this interface, especially using the O_XATTR flag. This is not yet supported here. diff --git a/libio/stdio.h b/libio/stdio.h index 0ea052b..baba806 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -1,5 +1,5 @@ /* Define ISO C stdio on top of C++ iostreams. - Copyright (C) 1991,1994-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1991,1994-2004,2005,2006 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 @@ -154,7 +154,7 @@ extern int remove (__const char *__filename) __THROW; extern int rename (__const char *__old, __const char *__new) __THROW; __END_NAMESPACE_STD -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ extern int renameat (int __oldfd, __const char *__old, int __newfd, __const char *__new) __THROW; diff --git a/posix/unistd.h b/posix/unistd.h index 4c03c4d..480de5e 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -431,7 +431,7 @@ extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group) #endif /* Use BSD || X/Open Unix. */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Change the owner and group of FILE relative to the directory FD is open on. */ extern int fchownat (int __fd, __const char *__file, __uid_t __owner, @@ -742,7 +742,7 @@ extern int ttyslot (void) __THROW; extern int link (__const char *__from, __const char *__to) __THROW __nonnull ((1, 2)) __wur; -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Like link but relative paths in TO and FROM are interpreted relative to FROMFD and TOFD respectively. */ extern int linkat (int __fromfd, __const char *__from, int __tofd, @@ -761,7 +761,7 @@ extern int readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2)) __wur; #endif /* Use BSD. */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ extern int symlinkat (__const char *__from, int __tofd, __const char *__to) __THROW __nonnull ((1, 3)) __wur; @@ -775,7 +775,7 @@ extern int readlinkat (int __fd, __const char *__restrict __path, /* Remove the link NAME. */ extern int unlink (__const char *__name) __THROW __nonnull ((1)); -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Remove the link NAME relative to FD. */ extern int unlinkat (int __fd, __const char *__name, int __flag) __THROW __nonnull ((2)); diff --git a/time/sys/time.h b/time/sys/time.h index 96649ff..177696b 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1994,1996-2002,2003,2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,1996-2002,2003,2005,2006 + 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 @@ -148,7 +149,7 @@ extern int lutimes (__const char *__file, __const struct timeval __tvp[2]) extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW; #endif -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ -- 2.7.4