Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* io/Makefile (routines): Add fstatat, fstatat64, fxstatat, fxstatat64,
	fchownat, and unlinkat.
	(static-only-routines): Add fstatat and fstatat64.
	(tests): Add tst-unlinkat, tst-fstatat, tst-futimesat, tst-renameat,
	and tst-fchownat.
	* io/Versions [GLIBC_2.4]: Add fchownat, __fxstatat, __fxstatat64,
	and unlinkat.
	* io/fcntl.h: Define AT_FDCWD, AT_SYMLINK_NOFOLLOW, and AT_REMOVEDIR.
	* io/fstatat.c: New file.
	* io/fstatat64.c: New file.
	* io/sys/stat.h: Declare fstatat, fstatat64, __fxstatat, __fxstatat64
	and define fstatat and fstatat64 inline functions.
	* libio/stdio.h: Declare renameat.
	* misc/Makefile (routines): Add futimesat.
	* misc/Versions [GLIBC_2.4]: Add futimesat.
	* posix/unistd.h: Declare fchownat and unlinkat.
	* stdio-common/Makefile (routines): Add renameat.
	* stdio-common/Versions [GLIBC_2.4]: Add renameat.
	* sysdeps/generic/fchownat.c: New file.
	* sysdeps/generic/futimesat.c: New file.
	* sysdeps/generic/fxstatat.c: New file.
	* sysdeps/generic/fxstatat64.c: New file.
	* sysdeps/generic/renameat.c: New file.
	* sysdeps/generic/unlinkat.c: New file.
	* sysdeps/unix/sysv/linux/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/futimesat.c: New file.
	* sysdeps/unix/sysv/linux/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/fxstatat64.c: New file.
	* sysdeps/unix/sysv/linux/renameat.c: New file.
	* sysdeps/unix/sysv/linux/unlinkat.c: New file.
	* sysdeps/unix/sysv/linux/alpha/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/i386/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/i386/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/m68k/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/m68k/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/sh/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/sh/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: New file.
	* sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c: New file.
	* time/sys/time.h: Declare futimesat.
	* include/fcntl.h: Declare __atfct_seterrno.
	* sysdeps/unix/sysv/linux/openat.c (__atfct_seterrno): New function.
	Split out from openat code and called.
	(do_test): Allow openat to fail with ENOSYS.  Handle AT_FDCWD.
	* sysdeps/generic/openat.c: Handle AT_FDCWD.
	* sysdeps/generic/openat64.c: Likewise.
	* io/tst-unlinkat.c: New file.
	* io/tst-fstatat.c: New file.
	* io/tst-futimesat.c: New file.
	* io/tst-renameat.c: New file.
	* io/tst-fchownat.c: New file.
	* io/tst-openat.c: Don't fail if openat is not implemented.

	* sysdeps/unix/sysv/linux/powerpc/chown.c: Don't provide backward
	compatibility code if new kernel is guaranteed.

	* time/sys/time.h: Add a few nonnull attributes.
  • Loading branch information
Ulrich Drepper committed Nov 11, 2005
1 parent 4973cbe commit 26cec51
Show file tree
Hide file tree
Showing 54 changed files with 3,070 additions and 124 deletions.
67 changes: 67 additions & 0 deletions ChangeLog
@@ -1,3 +1,70 @@
2005-11-11 Ulrich Drepper <drepper@redhat.com>

* io/Makefile (routines): Add fstatat, fstatat64, fxstatat, fxstatat64,
fchownat, and unlinkat.
(static-only-routines): Add fstatat and fstatat64.
(tests): Add tst-unlinkat, tst-fstatat, tst-futimesat, tst-renameat,
and tst-fchownat.
* io/Versions [GLIBC_2.4]: Add fchownat, __fxstatat, __fxstatat64,
and unlinkat.
* io/fcntl.h: Define AT_FDCWD, AT_SYMLINK_NOFOLLOW, and AT_REMOVEDIR.
* io/fstatat.c: New file.
* io/fstatat64.c: New file.
* io/sys/stat.h: Declare fstatat, fstatat64, __fxstatat, __fxstatat64
and define fstatat and fstatat64 inline functions.
* libio/stdio.h: Declare renameat.
* misc/Makefile (routines): Add futimesat.
* misc/Versions [GLIBC_2.4]: Add futimesat.
* posix/unistd.h: Declare fchownat and unlinkat.
* stdio-common/Makefile (routines): Add renameat.
* stdio-common/Versions [GLIBC_2.4]: Add renameat.
* sysdeps/generic/fchownat.c: New file.
* sysdeps/generic/futimesat.c: New file.
* sysdeps/generic/fxstatat.c: New file.
* sysdeps/generic/fxstatat64.c: New file.
* sysdeps/generic/renameat.c: New file.
* sysdeps/generic/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/fchownat.c: New file.
* sysdeps/unix/sysv/linux/futimesat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat64.c: New file.
* sysdeps/unix/sysv/linux/renameat.c: New file.
* sysdeps/unix/sysv/linux/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/alpha/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/i386/fchownat.c: New file.
* sysdeps/unix/sysv/linux/i386/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fchownat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/fchownat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sh/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sh/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c: New file.
* time/sys/time.h: Declare futimesat.
* include/fcntl.h: Declare __atfct_seterrno.
* sysdeps/unix/sysv/linux/openat.c (__atfct_seterrno): New function.
Split out from openat code and called.
(do_test): Allow openat to fail with ENOSYS. Handle AT_FDCWD.
* sysdeps/generic/openat.c: Handle AT_FDCWD.
* sysdeps/generic/openat64.c: Likewise.
* io/tst-unlinkat.c: New file.
* io/tst-fstatat.c: New file.
* io/tst-futimesat.c: New file.
* io/tst-renameat.c: New file.
* io/tst-fchownat.c: New file.
* io/tst-openat.c: Don't fail if openat is not implemented.

* sysdeps/unix/sysv/linux/powerpc/chown.c: Don't provide backward
compatibility code if new kernel is guaranteed.

* time/sys/time.h: Add a few nonnull attributes.

2005-11-09 Ulrich Drepper <drepper@redhat.com>

* io/fcntl.h: Declare openat and openat64.
Expand Down
5 changes: 3 additions & 2 deletions NEWS
@@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2005-11-09
GNU C Library NEWS -- history of user-visible changes. 2005-11-11
Copyright (C) 1992-2002,2003,2004,2005 Free Software Foundation, Inc.
See the end for copying conditions.

Expand Down Expand Up @@ -27,7 +27,8 @@ Version 2.4
For a libc and libpthread that works well on Linux 2.4 kernels, we
recommend using the stable 2.3 branch.

* New interfaces: fdopendir, openat.
* New interfaces: fdopendir, openat, fstatat, fchownat, futimesat, renameat,
unlinkat.

Version 2.3.6

Expand Down
4 changes: 4 additions & 0 deletions include/fcntl.h
Expand Up @@ -18,4 +18,8 @@ libc_hidden_proto (__open)
extern int __fcntl (int __fd, int __cmd, ...);
libc_hidden_proto (__fcntl)

/* Helper functions for the various *at functions. For Linux. */
extern void __atfct_seterrno (int errval, int fd, const char *buf)
attribute_hidden;

#endif
51 changes: 27 additions & 24 deletions io/Makefile
Expand Up @@ -26,40 +26,43 @@ headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
poll.h sys/poll.h bits/poll.h \
utime.h ftw.h fts.h sys/sendfile.h

routines := \
utime \
mkfifo \
stat fstat lstat mknod stat64 fstat64 lstat64 \
xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \
statfs fstatfs statfs64 fstatfs64 \
statvfs fstatvfs statvfs64 fstatvfs64 \
umask chmod fchmod lchmod mkdir \
open open64 openat openat64 close \
read write lseek lseek64 access euidaccess \
fcntl flock lockf lockf64 \
dup dup2 pipe \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
chown fchown lchown \
ttyname ttyname_r isatty \
link symlink readlink \
unlink rmdir \
ftw ftw64 fts poll \
posix_fadvise posix_fadvise64 \
posix_fallocate posix_fallocate64 \
routines := \
utime \
mkfifo \
stat fstat lstat mknod stat64 fstat64 lstat64 fstatat fstatat64 \
xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \
fxstatat fxstatat64 \
statfs fstatfs statfs64 fstatfs64 \
statvfs fstatvfs statvfs64 fstatvfs64 \
umask chmod fchmod lchmod mkdir \
open open64 openat openat64 close \
read write lseek lseek64 access euidaccess \
fcntl flock lockf lockf64 \
dup dup2 pipe \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
chown fchown lchown fchownat \
ttyname ttyname_r isatty \
link symlink readlink \
unlink unlinkat rmdir \
ftw ftw64 fts poll \
posix_fadvise posix_fadvise64 \
posix_fallocate posix_fallocate64 \
sendfile sendfile64

# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
# linked against when the shared library will be used.
static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64
static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64 \
fstatat fstatat64

others := pwd
test-srcs := ftwtest
tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
tst-openat
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
tst-renameat tst-fchownat

distribute := ftwtest-sh

Expand Down
3 changes: 3 additions & 0 deletions io/Versions
Expand Up @@ -98,6 +98,9 @@ libc {
nftw; nftw64;
}
GLIBC_2.4 {
fchownat;
__fxstatat; __fxstatat64;
openat; openat64;
unlinkat;
}
}
9 changes: 9 additions & 0 deletions io/fcntl.h
Expand Up @@ -56,6 +56,15 @@ __BEGIN_DECLS
# define SEEK_END 2 /* Seek from end of file. */
#endif /* XPG */

#ifdef __USE_GNU
# define AT_FDCWD -100 /* Special value used to indicate
openat 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. */
#endif

/* Do the file control operation described by CMD on FD.
The remaining arguments are interpreted depending on CMD.
Expand Down
58 changes: 58 additions & 0 deletions io/fstatat.c
@@ -0,0 +1,58 @@
/* Copyright (C) 2005 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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. */

#include <sys/stat.h>

/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */

#undef fstatat
int
fstatat (int fd, const char *file, struct stat *buf, int flag)
{
return __fxstatat (_STAT_VER, fd, file, buf, flag);
}

/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat");
#endif
58 changes: 58 additions & 0 deletions io/fstatat64.c
@@ -0,0 +1,58 @@
/* Copyright (C) 2005 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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. */

#include <sys/stat.h>

/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */

#undef fstatat64
int
fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
}

/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat64");
#endif

0 comments on commit 26cec51

Please sign in to comment.