aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-12 05:14:52 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-12 05:14:52 +0000
commit56ddf355daf2f9812b9560ca9fa698520b7000f8 (patch)
treec6dee26e06b0e0d8d0b07e14bc20eeb64650b5b4
parent1a5b42af05ea744cbba2cafe2ea40b2ed399cd0b (diff)
downloadglibc-56ddf355daf2f9812b9560ca9fa698520b7000f8.tar
glibc-56ddf355daf2f9812b9560ca9fa698520b7000f8.tar.gz
glibc-56ddf355daf2f9812b9560ca9fa698520b7000f8.tar.bz2
glibc-56ddf355daf2f9812b9560ca9fa698520b7000f8.zip
Update.
2000-08-11 Ulrich Drepper <drepper@redhat.com> * rt/aio_cancel.c: If canceling a specific request which is running *really* do nothing. * rt/aio_misc.h: Add `done' to states of a request. * rt/aio_misc.c: Add several tests for the correct state. Simplify request table memory handling. 2000-08-10 Jakub Jelinek <jakub@redhat.com> * dirent/scandir.c: Use it for scandir64 and old_scandir64 as well. * dirent/scandir64.c: Move... * sysdeps/generic/scandir64.c: ...here. * dirent/alphasort64.c: Move... * sysdeps/generic/alphasort64.c: ...here. * dirent/versionsort64.c: Move... * sysdeps/generic/versionsort64.c: ...here. * sysdeps/unix/sysv/linux/i386/dirent/Versions (alphasort64, getdirentries64, readdir64, readdir64_r, scandir64, versionsort64): Export symbols at GLIBC_2.2. * sysdeps/unix/sysv/linux/powerpc/dirent/Versions: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/dirent/Versions: Likewise. * include/dirent.h (__readdir64_r, __scandir64, __alphasort64, __versionsort64): Add prototypes. * io/Versions (__xstat64, __fxstat64, __lxstat64): Export at GLIBC_2.2. * sysdeps/unix/sysv/linux/alpha/kernel_stat.h (__xstat_conv): Remove unused prototype. * sysdeps/unix/sysv/linux/alpha/readdir.c: Export at both GLIBC_2.1 and GLIBC_2.2. * sysdeps/unix/sysv/linux/alpha/readdir_r.c: Likewise. * sysdeps/unix/sysv/linux/alpha/getdents.c: New. * sysdeps/unix/sysv/linux/alpha/getdents64.c: New. * sysdeps/unix/sysv/linux/bits/types.h (__ino64_t): Change to __u_quad_t. * sysdeps/unix/sysv/linux/bits/stat.h (struct stat, struct stat64): Adjust for kernel-2.4.0-test6 layout. * sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat64): Export at both GLIBC_2.1 and GLIBC_2.2. * sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat64): Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c (__xstat64): Likewise. * sysdeps/unix/sysv/linux/i386/getdents64.c: New. * sysdeps/unix/sysv/linux/i386/olddirent.h: New. * sysdeps/unix/sysv/linux/i386/readdir64.c: New. * sysdeps/unix/sysv/linux/i386/readdir64_r.c: New. * sysdeps/unix/sysv/linux/i386/scandir64.c: New. * sysdeps/unix/sysv/linux/i386/alphasort64.c: New. * sysdeps/unix/sysv/linux/i386/versionsort64.c: New. * sysdeps/unix/sysv/linux/ia64/getdents.c: New. * sysdeps/unix/sysv/linux/ia64/getdents64.c: New. * sysdeps/unix/sysv/linux/ia64/readdir.c: Include alpha/readdir.c. * sysdeps/unix/sysv/linux/ia64/readdir_r.c: Include alpha/readdir_r.c. * sysdeps/unix/sysv/linux/mips/bits/types.h (__ino64_t): Change to __u_quad_t. * sysdeps/unix/sysv/linux/powerpc/bits/stat.h: New. * sysdeps/unix/sysv/linux/powerpc/kernel_stat.h (_HAVE_STAT*): Define. * sysdeps/unix/sysv/linux/powerpc/scandir64.c: New. * sysdeps/unix/sysv/linux/powerpc/getdents64.c: New. * sysdeps/unix/sysv/linux/powerpc/readdir64.c: New. * sysdeps/unix/sysv/linux/powerpc/readdir64_r.c: New. * sysdeps/unix/sysv/linux/sparc/bits/types.h (__ino64_t): Change to __u_quad_t. * sysdeps/unix/sysv/linux/sparc/bits/stat.h: New. * sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h (_HAVE_STAT*): Define. * sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c: New. * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c: New. * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c: New. * sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c: New. * sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h (_HAVE_STAT*): Define. * sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c: Include alpha/readdir.c. * sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c: Include alpha/readdir_r.c * sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c: New. * sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c: New. * sysdeps/unix/sysv/linux/fxstat64.c (__fxstat64): If _HAVE_STAT64___ST_INO and __st_ino != (uint32_t)st_ino, set st_ino from __st_ino. * sysdeps/unix/sysv/linux/lxstat64.c (__lxstat64): Likewise. * sysdeps/unix/sysv/linux/xstat64.c (__xstat64): Likewise. * sysdeps/unix/sysv/linux/xstatconv.c (xstat_conv, xstat64_conv, xstat32_conv): Use _HAVE_STAT* macros. If _HAVE_STAT64___ST_INO, set __st_ino in addition to st_ino. * sysdeps/unix/sysv/linux/kernel_stat.h (_HAVE_STAT*): Define. * sysdeps/unix/sysv/linux/getdents.c: Use it for __getdents64 and __old_getdents64 as well. * sysdeps/unix/sysv/linux/getdirentries.c: Use it for getdirentries64 and old_getdirentries64 as well. * sysdeps/unix/sysv/linux/getdirentries64.c (GETDIRENTRIES, __GETDENTS): Define. (GETDENTS64): Remove. * sysdeps/unix/sysv/linux/getdents64.c (__GETDENTS, DIRENT_TYPE): Define. (GETDENTS64): Remove. * sysdeps/unix/sysv/linux/readdir64.c: Use sysdeps/unix/readdir.c. * sysdeps/unix/sysv/linux/readdir64_r.c: Use sysdeps/unix/readdir_r.c. * sysdeps/unix/readdir.c: Use it for readdir64 and __old_readdir64 as well. * sysdeps/unix/readdir_r.c: Use it for readdir64_r and __old_readdir64_r as well. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_ST_INO_64_bit for kernel 2.4.1 and up. * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Add SI_KERNEL define.
-rw-r--r--ChangeLog107
-rw-r--r--NEWS15
-rw-r--r--dirent/scandir.c28
-rw-r--r--dirent/scandir64.c93
-rw-r--r--include/dirent.h8
-rw-r--r--rt/aio_cancel.c24
-rw-r--r--rt/aio_misc.c98
-rw-r--r--rt/aio_misc.h3
-rw-r--r--sysdeps/generic/alphasort64.c (renamed from dirent/alphasort64.c)13
-rw-r--r--sysdeps/generic/scandir64.c40
-rw-r--r--sysdeps/generic/versionsort64.c (renamed from dirent/versionsort64.c)13
-rw-r--r--sysdeps/unix/readdir.c23
-rw-r--r--sysdeps/unix/readdir_r.c21
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getdents.c6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_stat.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h15
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h2
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c30
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c25
-rw-r--r--sysdeps/unix/sysv/linux/getdents64.c3
-rw-r--r--sysdeps/unix/sysv/linux/getdirentries.c13
-rw-r--r--sysdeps/unix/sysv/linux/getdirentries64.c3
-rw-r--r--sysdeps/unix/sysv/linux/i386/Versions17
-rw-r--r--sysdeps/unix/sysv/linux/i386/alphasort64.c48
-rw-r--r--sysdeps/unix/sysv/linux/i386/getdents64.c43
-rw-r--r--sysdeps/unix/sysv/linux/i386/olddirent.h44
-rw-r--r--sysdeps/unix/sysv/linux/i386/readdir64.c44
-rw-r--r--sysdeps/unix/sysv/linux/i386/readdir64_r.c44
-rw-r--r--sysdeps/unix/sysv/linux/i386/scandir64.c47
-rw-r--r--sysdeps/unix/sysv/linux/i386/versionsort64.c48
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getdents.c4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir.c8
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir_r.c5
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h7
-rw-r--r--sysdeps/unix/sysv/linux/kernel_stat.h14
-rw-r--r--sysdeps/unix/sysv/linux/lxstat64.c36
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types.h2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Versions17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/stat.h128
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/kernel_stat.h16
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c103
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c110
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/stat.h131
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/types.h2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Versions19
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h14
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c5
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c39
-rw-r--r--sysdeps/unix/sysv/linux/xstatconv.c79
63 files changed, 1213 insertions, 484 deletions
diff --git a/ChangeLog b/ChangeLog
index bd8ec1dcc5..075594fbd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,110 @@
+2000-08-11 Ulrich Drepper <drepper@redhat.com>
+
+ * rt/aio_cancel.c: If canceling a specific request which is running
+ *really* do nothing.
+ * rt/aio_misc.h: Add `done' to states of a request.
+ * rt/aio_misc.c: Add several tests for the correct state.
+ Simplify request table memory handling.
+
+2000-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ * dirent/scandir.c: Use it for scandir64 and old_scandir64 as well.
+ * dirent/scandir64.c: Move...
+ * sysdeps/generic/scandir64.c: ...here.
+ * dirent/alphasort64.c: Move...
+ * sysdeps/generic/alphasort64.c: ...here.
+ * dirent/versionsort64.c: Move...
+ * sysdeps/generic/versionsort64.c: ...here.
+ * sysdeps/unix/sysv/linux/i386/dirent/Versions (alphasort64,
+ getdirentries64, readdir64, readdir64_r, scandir64, versionsort64):
+ Export symbols at GLIBC_2.2.
+ * sysdeps/unix/sysv/linux/powerpc/dirent/Versions: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/dirent/Versions: Likewise.
+ * include/dirent.h (__readdir64_r, __scandir64, __alphasort64,
+ __versionsort64): Add prototypes.
+ * io/Versions (__xstat64, __fxstat64, __lxstat64): Export at GLIBC_2.2.
+ * sysdeps/unix/sysv/linux/alpha/kernel_stat.h (__xstat_conv): Remove
+ unused prototype.
+ * sysdeps/unix/sysv/linux/alpha/readdir.c: Export at both GLIBC_2.1
+ and GLIBC_2.2.
+ * sysdeps/unix/sysv/linux/alpha/readdir_r.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/getdents.c: New.
+ * sysdeps/unix/sysv/linux/alpha/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/bits/types.h (__ino64_t): Change to
+ __u_quad_t.
+ * sysdeps/unix/sysv/linux/bits/stat.h (struct stat, struct stat64):
+ Adjust for kernel-2.4.0-test6 layout.
+ * sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat64): Export at both
+ GLIBC_2.1 and GLIBC_2.2.
+ * sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat64): Likewise.
+ * sysdeps/unix/sysv/linux/i386/xstat.c (__xstat64): Likewise.
+ * sysdeps/unix/sysv/linux/i386/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/i386/olddirent.h: New.
+ * sysdeps/unix/sysv/linux/i386/readdir64.c: New.
+ * sysdeps/unix/sysv/linux/i386/readdir64_r.c: New.
+ * sysdeps/unix/sysv/linux/i386/scandir64.c: New.
+ * sysdeps/unix/sysv/linux/i386/alphasort64.c: New.
+ * sysdeps/unix/sysv/linux/i386/versionsort64.c: New.
+ * sysdeps/unix/sysv/linux/ia64/getdents.c: New.
+ * sysdeps/unix/sysv/linux/ia64/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/ia64/readdir.c: Include alpha/readdir.c.
+ * sysdeps/unix/sysv/linux/ia64/readdir_r.c: Include alpha/readdir_r.c.
+ * sysdeps/unix/sysv/linux/mips/bits/types.h (__ino64_t): Change to
+ __u_quad_t.
+ * sysdeps/unix/sysv/linux/powerpc/bits/stat.h: New.
+ * sysdeps/unix/sysv/linux/powerpc/kernel_stat.h (_HAVE_STAT*): Define.
+ * sysdeps/unix/sysv/linux/powerpc/scandir64.c: New.
+ * sysdeps/unix/sysv/linux/powerpc/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/powerpc/readdir64.c: New.
+ * sysdeps/unix/sysv/linux/powerpc/readdir64_r.c: New.
+ * sysdeps/unix/sysv/linux/sparc/bits/types.h (__ino64_t): Change to
+ __u_quad_t.
+ * sysdeps/unix/sysv/linux/sparc/bits/stat.h: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h (_HAVE_STAT*):
+ Define.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h (_HAVE_STAT*):
+ Define.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c: Include
+ alpha/readdir.c.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c: Include
+ alpha/readdir_r.c
+ * sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c: New.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c: New.
+ * sysdeps/unix/sysv/linux/fxstat64.c (__fxstat64): If
+ _HAVE_STAT64___ST_INO and __st_ino != (uint32_t)st_ino, set
+ st_ino from __st_ino.
+ * sysdeps/unix/sysv/linux/lxstat64.c (__lxstat64): Likewise.
+ * sysdeps/unix/sysv/linux/xstat64.c (__xstat64): Likewise.
+ * sysdeps/unix/sysv/linux/xstatconv.c (xstat_conv, xstat64_conv,
+ xstat32_conv): Use _HAVE_STAT* macros. If _HAVE_STAT64___ST_INO,
+ set __st_ino in addition to st_ino.
+ * sysdeps/unix/sysv/linux/kernel_stat.h (_HAVE_STAT*): Define.
+ * sysdeps/unix/sysv/linux/getdents.c: Use it for __getdents64 and
+ __old_getdents64 as well.
+ * sysdeps/unix/sysv/linux/getdirentries.c: Use it for
+ getdirentries64 and old_getdirentries64 as well.
+ * sysdeps/unix/sysv/linux/getdirentries64.c (GETDIRENTRIES,
+ __GETDENTS): Define.
+ (GETDENTS64): Remove.
+ * sysdeps/unix/sysv/linux/getdents64.c (__GETDENTS, DIRENT_TYPE):
+ Define.
+ (GETDENTS64): Remove.
+ * sysdeps/unix/sysv/linux/readdir64.c: Use sysdeps/unix/readdir.c.
+ * sysdeps/unix/sysv/linux/readdir64_r.c: Use sysdeps/unix/readdir_r.c.
+ * sysdeps/unix/readdir.c: Use it for readdir64 and __old_readdir64
+ as well.
+ * sysdeps/unix/readdir_r.c: Use it for readdir64_r and
+ __old_readdir64_r as well.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_ST_INO_64_bit for kernel 2.4.1 and up.
+
2000-08-08 Jes Sorensen <jes@linuxcare.com>
- * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Add SI_KERNEL
- define.
+ * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Add SI_KERNEL define.
Add missing ILL_BADIADDR to enum and make ILL_BREAK match the
define of the kernel.
Add missing __SEG_PSTKOVF definition.
diff --git a/NEWS b/NEWS
index 95cddc7e7e..7e433e2d45 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2000-08-03
+GNU C Library NEWS -- history of user-visible changes. 2000-08-11
Copyright (C) 1992-1999, 2000 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -1084,7 +1084,8 @@ Version 1.04
compiler, so the C library should now work with C++ code.
* The header file <bstring.h> is gone. <string.h> now declares bcopy,
- bcmp, bzero, and ffs.
+ bcmp, bzero, and ffs. (Update: nowadays these functions are declared
+ in <strings.h>.)
* Mike Haertel (of GNU e?grep and malloc fame) has written a new sorting
function which uses the `merge sort' algorithm, and is said to be
@@ -1095,14 +1096,6 @@ Version 1.04
* The C library now includes Michael Glad's Ultra Fast Crypt, which
provides the Unix `crypt' function, plus some other entry points.
- Because of the United States export restriction on DES implementations,
- we are distributing this code separately from the rest of the C library.
- There is an extra distribution tar file just for crypt; it is called
- `glibc-VERSION-crypt.tar.Z', e.g. `glibc-1.04-crypt.tar.Z'. You can just
- unpack the crypt distribution along with the rest of the C library and
- build; you can also build the library without getting crypt. Users
- outside the USA can get the crypt distribution via anonymous FTP from
- ftp.uni-c.dk [129.142.6.74], or another archive site outside the U.S.
* The code and header files taken from 4.4 BSD have been updated with the
latest files released from Berkeley.
@@ -1110,7 +1103,7 @@ Version 1.04
----------------------------------------------------------------------
Copyright information:
-Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+Copyright (C) 1992-1999, 2000 Free Software Foundation, Inc.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/dirent/scandir.c b/dirent/scandir.c
index 9b4548cd16..da94ed3690 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -21,17 +21,23 @@
#include <string.h>
#include <errno.h>
+#ifndef SCANDIR
+#define SCANDIR scandir
+#define READDIR __readdir
+#define DIRENT_TYPE struct dirent
+#endif
+
int
-scandir (dir, namelist, select, cmp)
+SCANDIR (dir, namelist, select, cmp)
const char *dir;
- struct dirent ***namelist;
- int (*select) (const struct dirent *);
+ DIRENT_TYPE ***namelist;
+ int (*select) (const DIRENT_TYPE *);
int (*cmp) (const void *, const void *);
{
DIR *dp = __opendir (dir);
- struct dirent **v = NULL;
+ DIRENT_TYPE **v = NULL;
size_t vsize = 0, i;
- struct dirent *d;
+ DIRENT_TYPE *d;
int save;
if (dp == NULL)
@@ -41,10 +47,10 @@ scandir (dir, namelist, select, cmp)
__set_errno (0);
i = 0;
- while ((d = __readdir (dp)) != NULL)
+ while ((d = READDIR (dp)) != NULL)
if (select == NULL || (*select) (d))
{
- struct dirent *vnew;
+ DIRENT_TYPE *vnew;
size_t dsize;
/* Ignore errors from select or readdir */
@@ -52,23 +58,23 @@ scandir (dir, namelist, select, cmp)
if (__builtin_expect (i == vsize, 0))
{
- struct dirent **new;
+ DIRENT_TYPE **new;
if (vsize == 0)
vsize = 10;
else
vsize *= 2;
- new = (struct dirent **) realloc (v, vsize * sizeof (*v));
+ new = (DIRENT_TYPE **) realloc (v, vsize * sizeof (*v));
if (new == NULL)
break;
v = new;
}
dsize = &d->d_name[_D_ALLOC_NAMLEN (d)] - (char *) d;
- vnew = (struct dirent *) malloc (dsize);
+ vnew = (DIRENT_TYPE *) malloc (dsize);
if (vnew == NULL)
break;
- v[i++] = (struct dirent *) memcpy (vnew, d, dsize);
+ v[i++] = (DIRENT_TYPE *) memcpy (vnew, d, dsize);
}
if (__builtin_expect (errno, 0) != 0)
diff --git a/dirent/scandir64.c b/dirent/scandir64.c
deleted file mode 100644
index 1fdff2c64d..0000000000
--- a/dirent/scandir64.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (C) 1992,93,94,95,96,97,98,2000 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 Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-int
-scandir64 (dir, namelist, select, cmp)
- const char *dir;
- struct dirent64 ***namelist;
- int (*select) (const struct dirent64 *);
- int (*cmp) (const void *, const void *);
-{
- DIR *dp = __opendir (dir);
- struct dirent64 **v = NULL;
- size_t vsize = 0, i;
- struct dirent64 *d;
- int save;
-
- if (dp == NULL)
- return -1;
-
- save = errno;
- __set_errno (0);
-
- i = 0;
- while ((d = __readdir64 (dp)) != NULL)
- if (select == NULL || (*select) (d))
- {
- struct dirent64 *vnew;
- size_t dsize;
-
- /* Ignore errors from select or readdir */
- __set_errno (0);
-
- if (i == vsize)
- {
- struct dirent64 **new;
- if (vsize == 0)
- vsize = 10;
- else
- vsize *= 2;
- new = (struct dirent64 **) realloc (v, vsize * sizeof (*v));
- if (new == NULL)
- break;
- v = new;
- }
-
- dsize = &d->d_name[_D_ALLOC_NAMLEN (d)] - (char *) d;
- vnew = (struct dirent64 *) malloc (dsize);
- if (vnew == NULL)
- break;
-
- v[i++] = (struct dirent64 *) memcpy (vnew, d, dsize);
- }
-
- if (errno != 0)
- {
- save = errno;
- (void) __closedir (dp);
- while (i > 0)
- free (v[--i]);
- free (v);
- __set_errno (save);
- return -1;
- }
-
- (void) __closedir (dp);
- __set_errno (save);
-
- /* Sort the list if we have a comparison function to sort with. */
- if (cmp != NULL)
- qsort (v, i, sizeof (*v), cmp);
- *namelist = v;
- return i;
-}
diff --git a/include/dirent.h b/include/dirent.h
index 486e7f60f1..4bffb06a39 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -8,8 +8,16 @@ extern struct dirent *__readdir (DIR *__dirp);
extern struct dirent64 *__readdir64 (DIR *__dirp);
extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
struct dirent **__result);
+extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
+ struct dirent64 **__result);
+extern int __scandir64 (__const char * __dir,
+ struct dirent64 *** __namelist,
+ int (*__selector) (__const struct dirent64 *),
+ int (*__cmp) (__const void *, __const void *));
extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes)
internal_function;
extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes)
internal_function;
+extern int __alphasort64 (const void *a, const void *b);
+extern int __versionsort64 (const void *a, const void *b);
#endif
diff --git a/rt/aio_cancel.c b/rt/aio_cancel.c
index 48e647a263..c1cfea50c8 100644
--- a/rt/aio_cancel.c
+++ b/rt/aio_cancel.c
@@ -29,6 +29,7 @@
/* And undo the hack. */
#undef aio_cancel64
+#include <assert.h>
#include <errno.h>
#include "aio_misc.h"
@@ -74,16 +75,19 @@ aio_cancel (fildes, aiocbp)
/* Don't remove the entry if a thread is already working on it. */
if (req->running == allocated)
- result = AIO_NOTCANCELED;
- else if (req->running == yes)
+ {
+ result = AIO_NOTCANCELED;
+ req = NULL;
+ }
+ else
{
/* We can remove the entry. */
__aio_remove_request (last, req, 0);
result = AIO_CANCELED;
- }
- req->next_prio = NULL;
+ req->next_prio = NULL;
+ }
}
}
else
@@ -103,12 +107,17 @@ aio_cancel (fildes, aiocbp)
old->next_prio = NULL;
result = AIO_NOTCANCELED;
+
+ if (req != NULL)
+ __aio_remove_request (old, req, 1);
}
else
- result = AIO_CANCELED;
+ {
+ result = AIO_CANCELED;
- /* We can remove the entry. */
- __aio_remove_request (NULL, req, 1);
+ /* We can remove the entry. */
+ __aio_remove_request (NULL, req, 1);
+ }
}
}
@@ -116,6 +125,7 @@ aio_cancel (fildes, aiocbp)
while (req != NULL)
{
struct requestlist *old = req;
+ assert (req->running == yes || req->running == queued);
req->aiocbp->aiocb.__error_code = ECANCELED;
req->aiocbp->aiocb.__return_value = -1;
__aio_notify (req);
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index af3e90f881..b26558ac39 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -36,16 +36,16 @@ static void add_request_to_runlist (struct requestlist *newrequest);
static struct requestlist **pool;
/* Number of total and allocated pool entries. */
-static size_t pool_tab_size;
+static size_t pool_max_size;
static size_t pool_size;
/* We implement a two dimensional array but allocate each row separately.
The macro below determines how many entries should be used per row.
It should better be a power of two. */
-#define ENTRIES_PER_ROW 16
+#define ENTRIES_PER_ROW 32
-/* The row table is incremented in units of this. */
-#define ROW_STEP 8
+/* How many rows we allocate at once. */
+#define ROWS_STEP 8
/* List of available entries. */
static struct requestlist *freelist;
@@ -68,7 +68,7 @@ static int idle_thread_count;
static struct aioinit optim =
{
20, /* int aio_threads; Maximal number of threads. */
- 256, /* int aio_num; Number of expected simultanious requests. */
+ 64, /* int aio_num; Number of expected simultanious requests. */
0,
0,
0,
@@ -96,51 +96,33 @@ get_elem (void)
if (freelist == NULL)
{
struct requestlist *new_row;
- size_t new_size;
+ int cnt;
assert (sizeof (struct aiocb) == sizeof (struct aiocb64));
- /* Compute new size. */
- new_size = pool_size ? pool_size + ENTRIES_PER_ROW : optim.aio_num;
-
- if ((new_size / ENTRIES_PER_ROW) >= pool_tab_size)
+ if (pool_size + 1 >= pool_max_size)
{
- size_t new_tab_size = new_size / ENTRIES_PER_ROW;
+ size_t new_max_size = pool_max_size + ROWS_STEP;
struct requestlist **new_tab;
new_tab = (struct requestlist **)
- realloc (pool, (new_tab_size * sizeof (struct requestlist *)));
+ realloc (pool, new_max_size * sizeof (struct requestlist *));
if (new_tab == NULL)
return NULL;
- pool_tab_size = new_tab_size;
+ pool_max_size = new_max_size;
pool = new_tab;
}
- if (pool_size == 0)
- {
- size_t cnt;
-
- new_row = (struct requestlist *)
- calloc (new_size, sizeof (struct requestlist));
-
- if (new_row == NULL)
- return NULL;
+ /* Allocat the new row. */
+ cnt = pool_size == 0 ? optim.aio_num : ENTRIES_PER_ROW;
+ new_row = (struct requestlist *) calloc (cnt,
+ sizeof (struct requestlist));
+ if (new_row == NULL)
+ return NULL;
- for (cnt = 0; cnt < new_size / ENTRIES_PER_ROW; ++cnt)
- pool[cnt] = &new_row[cnt * ENTRIES_PER_ROW];
- }
- else
- {
- /* Allocat one new row. */
- new_row = (struct requestlist *)
- calloc (ENTRIES_PER_ROW, sizeof (struct requestlist));
- if (new_row == NULL)
- return NULL;
-
- pool[new_size / ENTRIES_PER_ROW - 1] = new_row;
- }
+ pool[pool_size++] = new_row;
/* Put all the new entries in the freelist. */
do
@@ -148,7 +130,7 @@ get_elem (void)
new_row->next_prio = freelist;
freelist = new_row++;
}
- while (++pool_size < new_size);
+ while (--cnt > 0);
}
result = freelist;
@@ -210,8 +192,11 @@ internal_function
__aio_remove_request (struct requestlist *last, struct requestlist *req,
int all)
{
+ assert (req->running == yes || req->running == queued
+ || req->running == done);
+
if (last != NULL)
- last->next_prio = req->next_prio;
+ last->next_prio = all ? NULL : req->next_prio;
else
{
if (all || req->next_prio == NULL)
@@ -419,20 +404,25 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+ running = newp->running = allocated;
+
/* Now try to start a thread. */
if (pthread_create (&thid, &attr, handle_fildes_io, newp) == 0)
+ /* We managed to enqueue the request. All errors which can
+ happen now can be recognized by calls to `aio_return' and
+ `aio_error'. */
+ ++nthreads;
+ else
{
- /* We managed to enqueue the request. All errors which can
- happen now can be recognized by calls to `aio_return' and
- `aio_error'. */
- running = allocated;
- ++nthreads;
+ /* Reset the running flat. The new request is not running. */
+ running = newp->running = yes;
+
+ if (nthreads == 0)
+ /* We cannot create a thread in the moment and there is
+ also no thread running. This is a problem. `errno' is
+ set to EAGAIN if this is only a temporary problem. */
+ result = -1;
}
- else if (nthreads == 0)
- /* We cannot create a thread in the moment and there is
- also no thread running. This is a problem. `errno' is
- set to EAGAIN if this is only a temporary problem. */
- result = -1;
}
}
@@ -486,6 +476,9 @@ handle_fildes_io (void *arg)
pthread_mutex_lock (&__aio_requests_mutex);
else
{
+ /* Hopefully this request is marked as running. */
+ assert (runp->running == allocated);
+
/* Update our variables. */
aiocbp = runp->aiocbp;
fildes = aiocbp->aiocb.aio_fildes;
@@ -584,6 +577,11 @@ handle_fildes_io (void *arg)
request. */
__aio_notify (runp);
+ /* For debugging purposes we reset the running flag of the
+ finished request. */
+ assert (runp->running == allocated);
+ runp->running = done;
+
/* Now dequeue the current request. */
__aio_remove_request (NULL, runp, 0);
if (runp->next_prio != NULL)
@@ -672,11 +670,7 @@ free_res (void)
{
size_t row;
- /* The first block of rows as specified in OPTIM is allocated in
- one chunk. */
- free (pool[0]);
-
- for (row = optim.aio_num / ENTRIES_PER_ROW; row < pool_tab_size; ++row)
+ for (row = 0; row < pool_max_size; ++row)
free (pool[row]);
free (pool);
diff --git a/rt/aio_misc.h b/rt/aio_misc.h
index eda06541e6..372b5556ca 100644
--- a/rt/aio_misc.h
+++ b/rt/aio_misc.h
@@ -62,7 +62,8 @@ enum
no,
queued,
yes,
- allocated
+ allocated,
+ done
};
diff --git a/dirent/alphasort64.c b/sysdeps/generic/alphasort64.c
index d48004f2c4..3e634c85bd 100644
--- a/dirent/alphasort64.c
+++ b/sysdeps/generic/alphasort64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1997, 1998, 2000 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
@@ -20,8 +20,17 @@
#include <string.h>
int
-alphasort64 (const void *a, const void *b)
+__alphasort64 (const void *a, const void *b)
{
return strcoll ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __alphasort64, alphasort64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__alphasort64, __old_alphasort64)
+compat_symbol (libc, __old_alphasort64, alphasort64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/generic/scandir64.c b/sysdeps/generic/scandir64.c
new file mode 100644
index 0000000000..0479c49ac9
--- /dev/null
+++ b/sysdeps/generic/scandir64.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define SCANDIR __scandir64
+#define READDIR __readdir64
+#define DIRENT_TYPE struct dirent64
+
+int __scandir64 (__const char *__restrict __dir,
+ struct dirent64 ***__restrict __namelist,
+ int (*__selector) (__const struct dirent64 *),
+ int (*__cmp) (__const void *, __const void *));
+
+#include <dirent/scandir.c>
+
+#undef SCANDIR
+#undef READDIR
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __scandir64, scandir64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__scandir64, __old_scandir64)
+compat_symbol (libc, __old_scandir64, scandir64, GLIBC_2_1);
+#endif
diff --git a/dirent/versionsort64.c b/sysdeps/generic/versionsort64.c
index dab34d66ae..8b01af1c89 100644
--- a/dirent/versionsort64.c
+++ b/sysdeps/generic/versionsort64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1997, 1998, 2000 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
@@ -20,8 +20,17 @@
#include <string.h>
int
-versionsort64 (const void *a, const void *b)
+__versionsort64 (const void *a, const void *b)
{
return __strverscmp ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __versionsort64, versionsort64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__versionsort64, __old_versionsort64)
+compat_symbol (libc, __old_versionsort64, versionsort64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index a17a26435d..4cb66ba2e4 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,99,2000 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,12 +27,18 @@
#include <dirstream.h>
+#ifndef __READDIR
+# define __READDIR __readdir
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+# define __READDIR_ALIAS
+#endif
/* Read a directory entry from DIRP. */
-struct dirent *
-__readdir (DIR *dirp)
+DIRENT_TYPE *
+__READDIR (DIR *dirp)
{
- struct dirent *dp;
+ DIRENT_TYPE *dp;
__libc_lock_lock (dirp->lock);
@@ -54,7 +60,7 @@ __readdir (DIR *dirp)
maxread = dirp->allocation;
#endif
- bytes = __getdents (dirp->fd, dirp->data, maxread);
+ bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
if (bytes <= 0)
{
dp = NULL;
@@ -66,12 +72,12 @@ __readdir (DIR *dirp)
dirp->offset = 0;
}
- dp = (struct dirent *) &dirp->data[dirp->offset];
+ dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
#ifdef _DIRENT_HAVE_D_RECLEN
reclen = dp->d_reclen;
#else
- /* The only version of `struct dirent' that lacks `d_reclen'
+ /* The only version of `struct dirent*' that lacks `d_reclen'
is fixed-size. */
assert (sizeof dp->d_name > 1);
reclen = sizeof *dp;
@@ -97,4 +103,7 @@ __readdir (DIR *dirp)
return dp;
}
+
+#ifdef __READDIR_ALIAS
weak_alias (__readdir, readdir)
+#endif
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index 8d5cfdca16..113e1b41e1 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 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,12 +27,18 @@
#include <dirstream.h>
+#ifndef __READDIR_R
+# define __READDIR_R __readdir_r
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+# define __READDIR_R_ALIAS
+#endif
/* Read a directory entry from DIRP. */
int
-__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
+__READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
{
- struct dirent *dp;
+ DIRENT_TYPE *dp;
size_t reclen;
__libc_lock_lock (dirp->lock);
@@ -53,7 +59,7 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
maxread = dirp->allocation;
#endif
- bytes = __getdents (dirp->fd, dirp->data, maxread);
+ bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
if (bytes <= 0)
{
dp = NULL;
@@ -67,12 +73,12 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
dirp->offset = 0;
}
- dp = (struct dirent *) &dirp->data[dirp->offset];
+ dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
#ifdef _DIRENT_HAVE_D_RECLEN
reclen = dp->d_reclen;
#else
- /* The only version of `struct dirent' that lacks `d_reclen'
+ /* The only version of `struct dirent*' that lacks `d_reclen'
is fixed-size. */
assert (sizeof dp->d_name > 1);
reclen = sizeof *dp;
@@ -104,4 +110,7 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
return dp != NULL ? 0 : reclen ? errno : 0;
}
+
+#ifdef __READDIR_R_ALIAS
weak_alias (__readdir_r, readdir_r)
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/getdents.c b/sysdeps/unix/sysv/linux/alpha/getdents.c
new file mode 100644
index 0000000000..6deb87e2e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/getdents.c
@@ -0,0 +1,6 @@
+#define DIRENT_SET_DP_INO(dp, value) \
+ do { (dp)->d_ino = (value); (dp)->__pad = 0; } while (0)
+#define __getdents64 __no___getdents64_decl
+#include <sysdeps/unix/sysv/linux/getdents.c>
+#undef __getdents64
+weak_alias(__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/alpha/getdents64.c b/sysdeps/unix/sysv/linux/alpha/getdents64.c
new file mode 100644
index 0000000000..0df2c8f4c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/getdents64.c
@@ -0,0 +1 @@
+/* getdents64 is in getdents.c */
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
index 2633b42525..75540c0a6d 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
@@ -38,6 +38,4 @@ struct glibc2_stat
unsigned int st_gen;
};
-extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
-
#define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index d694738033..d432fc858e 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -40,7 +40,7 @@ struct stat
#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
#else
- __ino64_t st_ino; /* File serial number. */
+ __ino_t __st_ino; /* 32bit file serial number. */
#endif
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
@@ -66,23 +66,27 @@ struct stat
unsigned long int __unused2;
__time_t st_ctime; /* Time of last status change. */
unsigned long int __unused3;
+#ifndef __USE_FILE_OFFSET64
unsigned long int __unused4;
unsigned long int __unused5;
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
};
#ifdef __USE_LARGEFILE64
struct stat64
{
__dev_t st_dev; /* Device. */
- unsigned short int __pad1;
+ unsigned int __pad1;
- __ino64_t st_ino; /* File serial number. */
+ __ino_t __st_ino; /* 32bit file serial number. */
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
+ unsigned int __pad2;
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
@@ -93,8 +97,7 @@ struct stat64
unsigned long int __unused2;
__time_t st_ctime; /* Time of last status change. */
unsigned long int __unused3;
- unsigned long int __unused4;
- unsigned long int __unused5;
+ __ino64_t st_ino; /* File serial number. */
};
#endif
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index f9bf8394da..b5576357ae 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -137,7 +137,7 @@ typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
/* Type of file serial numbers. */
-typedef __u_long __ino64_t;
+typedef __u_quad_t __ino64_t;
/* Type of file sizes and offsets. */
typedef __loff_t __off64_t;
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index 3cd21d4fc4..2140661ff3 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -43,13 +43,20 @@ extern int __have_no_stat64;
#endif
/* Get information about the file FD in BUF. */
+extern int ___fxstat64 (int vers, int fd, struct stat64 *buf);
+
int
-__fxstat64 (int vers, int fd, struct stat64 *buf)
+___fxstat64 (int vers, int fd, struct stat64 *buf)
{
+ int result;
#if __ASSUME_STAT64_SYSCALL > 0
- return INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
+ result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t) buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
#else
- int result;
struct kernel_stat kbuf;
# if defined __NR_fstat64
if (! __have_no_stat64)
@@ -58,7 +65,13 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
if (result != -1 || errno != ENOSYS)
- return result;
+ {
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t)buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
+ }
__set_errno (saved_errno);
__have_no_stat64 = 1;
@@ -71,3 +84,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
return result;
#endif
}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (___fxstat64, __old__fxstat64)
+compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index 0f16683eed..474bf1989b 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -51,9 +51,12 @@ struct kernel_dirent
char d_name[256];
};
-#ifdef GETDENTS64
-# define __getdents __getdents64
-# define dirent dirent64
+#ifndef __GETDENTS
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+#endif
+#ifndef DIRENT_SET_DP_INO
+# define DIRENT_SET_DP_INO(dp, value) (dp)->d_ino = (value)
#endif
/* The problem here is that we cannot simply read the next NBYTES
@@ -66,22 +69,22 @@ struct kernel_dirent
amount of data returned much more then the reduced buffer size. */
ssize_t
internal_function
-__getdents (int fd, char *buf, size_t nbytes)
+__GETDENTS (int fd, char *buf, size_t nbytes)
{
off_t last_offset = -1;
size_t red_nbytes;
struct kernel_dirent *skdp, *kdp;
- struct dirent *dp;
+ DIRENT_TYPE *dp;
int retval;
- const size_t size_diff = (offsetof (struct dirent, d_name)
+ const size_t size_diff = (offsetof (DIRENT_TYPE, d_name)
- offsetof (struct kernel_dirent, d_name));
red_nbytes = MIN (nbytes
- - ((nbytes / (offsetof (struct dirent, d_name) + 14))
+ - ((nbytes / (offsetof (DIRENT_TYPE, d_name) + 14))
* size_diff),
nbytes - size_diff);
- dp = (struct dirent *) buf;
+ dp = (DIRENT_TYPE *) buf;
skdp = kdp = __alloca (red_nbytes);
retval = INLINE_SYSCALL (getdents, 3, fd,
@@ -92,7 +95,7 @@ __getdents (int fd, char *buf, size_t nbytes)
while ((char *) kdp < (char *) skdp + retval)
{
- const size_t alignment = __alignof__ (struct dirent);
+ const size_t alignment = __alignof__ (DIRENT_TYPE);
/* Since kdp->d_reclen is already aligned for the kernel structure
this may compute a value that is bigger than necessary. */
size_t new_reclen = ((kdp->d_reclen + size_diff + alignment - 1)
@@ -116,14 +119,14 @@ __getdents (int fd, char *buf, size_t nbytes)
}
last_offset = kdp->d_off;
- dp->d_ino = kdp->d_ino;
+ DIRENT_SET_DP_INO(dp, kdp->d_ino);
dp->d_off = kdp->d_off;
dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN;
memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
- dp = (struct dirent *) ((char *) dp + new_reclen);
+ dp = (DIRENT_TYPE *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen);
}
diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
index f50b0be615..0078ccd19f 100644
--- a/sysdeps/unix/sysv/linux/getdents64.c
+++ b/sysdeps/unix/sysv/linux/getdents64.c
@@ -1,2 +1,3 @@
-#define GETDENTS64
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
#include <getdents.c>
diff --git a/sysdeps/unix/sysv/linux/getdirentries.c b/sysdeps/unix/sysv/linux/getdirentries.c
index cb81ad763b..b0ad4997ad 100644
--- a/sysdeps/unix/sysv/linux/getdirentries.c
+++ b/sysdeps/unix/sysv/linux/getdirentries.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 95, 96, 97, 98, 99, 2000 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
@@ -19,20 +19,21 @@
#include <dirent.h>
#include <unistd.h>
-#ifdef GETDENTS64
-# define getdirentries getdirentries64
-# define __getdents __getdents64
+#ifndef GETDIRENTRIES
+# define GETDIRENTRIES getdirentries
+# define __GETDENTS __getdents
+#else
# define off_t off64_t
# define __lseek __lseek64
#endif
ssize_t
-getdirentries (int fd, char *buf, size_t nbytes, off_t *basep)
+GETDIRENTRIES (int fd, char *buf, size_t nbytes, off_t *basep)
{
off_t base = __lseek (fd, (off_t) 0, SEEK_CUR);
ssize_t result;
- result = __getdents (fd, buf, nbytes);
+ result = __GETDENTS (fd, buf, nbytes);
if (result != -1)
*basep = base;
diff --git a/sysdeps/unix/sysv/linux/getdirentries64.c b/sysdeps/unix/sysv/linux/getdirentries64.c
index 423e361e22..e486a36a12 100644
--- a/sysdeps/unix/sysv/linux/getdirentries64.c
+++ b/sysdeps/unix/sysv/linux/getdirentries64.c
@@ -1,2 +1,3 @@
-#define GETDENTS64 1
+#define GETDIRENTRIES getdirentries64
+#define __GETDENTS __getdents64
#include "getdirentries.c"
diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
index 8dc447ed81..58c7b3d9b1 100644
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -13,7 +13,24 @@ libc {
__modify_ldt; modify_ldt;
}
GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
+
+ # a*
+ alphasort64;
+
+ # g*
+ getdirentries64;
# New rlimit interface
getrlimit; setrlimit; getrlimit64;
+
+ # r*
+ readdir64; readdir64_r;
+
+ # s*
+ scandir64;
+
+ # v*
+ versionsort64;
}
}
diff --git a/sysdeps/unix/sysv/linux/i386/alphasort64.c b/sysdeps/unix/sysv/linux/i386/alphasort64.c
new file mode 100644
index 0000000000..3f8d89c76b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/alphasort64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1992, 1997, 1998, 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <dirent.h>
+#include <string.h>
+
+int
+__alphasort64 (const void *a, const void *b)
+{
+ return strcoll ((*(const struct dirent64 **) a)->d_name,
+ (*(const struct dirent64 **) b)->d_name);
+}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __alphasort64, alphasort64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+int
+__old_alphasort64 (const void *a, const void *b);
+
+int
+__old_alphasort64 (const void *a, const void *b)
+{
+ return strcoll ((*(const struct __old_dirent64 **) a)->d_name,
+ (*(const struct __old_dirent64 **) b)->d_name);
+}
+
+compat_symbol (libc, __old_alphasort64, alphasort64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/getdents64.c b/sysdeps/unix/sysv/linux/i386/getdents64.c
new file mode 100644
index 0000000000..dac046fa0c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getdents64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
+
+#include <sysdeps/unix/sysv/linux/getdents.c>
+
+#include <shlib-compat.h>
+
+#undef __READDIR
+#undef __GETDENTS
+#undef DIRENT_TYPE
+
+versioned_symbol (libc, __getdents64, getdents64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+#define __GETDENTS __old_getdents64
+#define DIRENT_TYPE struct __old_dirent64
+#define kernel_dirent old_kernel_dirent
+
+#include <sysdeps/unix/sysv/linux/getdents.c>
+
+compat_symbol (libc, __old_getdents64, getdents64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/olddirent.h b/sysdeps/unix/sysv/linux/i386/olddirent.h
new file mode 100644
index 0000000000..bcce37bfa5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/olddirent.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __OLD_DIRENT_H
+#define __OLD_DIRENT_H 1
+
+#include <dirent.h>
+
+struct __old_dirent64
+ {
+ __ino_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+
+/* Now define the internal interfaces. */
+extern struct __old_dirent64 *__old_readdir64 (DIR *__dirp);
+extern int __old_readdir64_r (DIR *__dirp, struct __old_dirent64 *__entry,
+ struct __old_dirent64 **__result);
+extern __ssize_t __old_getdents64 (int __fd, char *__buf, size_t __nbytes)
+ internal_function;
+int __old_scandir64 (__const char * __dir,
+ struct __old_dirent64 *** __namelist,
+ int (*__selector) (__const struct __old_dirent64 *),
+ int (*__cmp) (__const void *, __const void *));
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/readdir64.c b/sysdeps/unix/sysv/linux/i386/readdir64.c
new file mode 100644
index 0000000000..669ef9dbf7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/readdir64.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __READDIR __readdir64
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
+
+#include <sysdeps/unix/readdir.c>
+
+#include <shlib-compat.h>
+
+#undef __READDIR
+#undef __GETDENTS
+#undef DIRENT_TYPE
+
+versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+#define __READDIR __old_readdir64
+#define __GETDENTS __old_getdents64
+#define DIRENT_TYPE struct __old_dirent64
+
+#include <sysdeps/unix/readdir.c>
+
+compat_symbol (libc, __old_readdir64, readdir64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/readdir64_r.c b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
new file mode 100644
index 0000000000..96e975d114
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __READDIR_R __readdir64_r
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
+
+#include <sysdeps/unix/readdir_r.c>
+
+#undef __READDIR_R
+#undef __GETDENTS
+#undef DIRENT_TYPE
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __readdir64_r, readdir64_r, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+#define __READDIR_R __old_readdir64_r
+#define __GETDENTS __old_getdents64
+#define DIRENT_TYPE struct __old_dirent64
+
+#include <sysdeps/unix/readdir_r.c>
+
+compat_symbol (libc, __old_readdir64_r, readdir64_r, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/scandir64.c b/sysdeps/unix/sysv/linux/i386/scandir64.c
new file mode 100644
index 0000000000..95e5c73670
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/scandir64.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <dirent.h>
+
+#define SCANDIR __scandir64
+#define READDIR __readdir64
+#define DIRENT_TYPE struct dirent64
+
+#include <dirent/scandir.c>
+
+#undef SCANDIR
+#undef READDIR
+#undef DIRENT_TYPE
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __scandir64, scandir64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+#define SCANDIR __old_scandir64
+#define READDIR __old_readdir64
+#define DIRENT_TYPE struct __old_dirent64
+
+#include <dirent/scandir.c>
+
+compat_symbol (libc, __old_scandir64, scandir64, GLIBC_2_1);
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/versionsort64.c b/sysdeps/unix/sysv/linux/i386/versionsort64.c
new file mode 100644
index 0000000000..fbaaea2e1e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/versionsort64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1992, 1997, 1998, 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <dirent.h>
+#include <string.h>
+
+int
+__versionsort64 (const void *a, const void *b)
+{
+ return __strverscmp ((*(const struct dirent64 **) a)->d_name,
+ (*(const struct dirent64 **) b)->d_name);
+}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, __versionsort64, versionsort64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+
+#include <sysdeps/unix/sysv/linux/i386/olddirent.h>
+
+int
+__old_versionsort64 (const void *a, const void *b);
+
+int
+__old_versionsort64 (const void *a, const void *b)
+{
+ return __strverscmp ((*(const struct __old_dirent64 **) a)->d_name,
+ (*(const struct __old_dirent64 **) b)->d_name);
+}
+
+compat_symbol (libc, __old_versionsort64, versionsort64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/getdents.c b/sysdeps/unix/sysv/linux/ia64/getdents.c
new file mode 100644
index 0000000000..491fa9dfb2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/getdents.c
@@ -0,0 +1,4 @@
+#define __getdents64 __no___getdents64_decl
+#include <sysdeps/unix/sysv/linux/getdents.c>
+#undef __getdents64
+weak_alias(__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/ia64/getdents64.c b/sysdeps/unix/sysv/linux/ia64/getdents64.c
new file mode 100644
index 0000000000..0df2c8f4c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/getdents64.c
@@ -0,0 +1 @@
+/* getdents64 is in getdents.c */
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir.c b/sysdeps/unix/sysv/linux/ia64/readdir.c
index 300ebb2629..e64b2f8bdd 100644
--- a/sysdeps/unix/sysv/linux/ia64/readdir.c
+++ b/sysdeps/unix/sysv/linux/ia64/readdir.c
@@ -1,7 +1 @@
-#define readdir64 __no_readdir64_decl
-#define __readdir64 __no___readdir64_decl
-#include <sysdeps/unix/readdir.c>
-#undef __readdir64
-strong_alias (__readdir, __readdir64)
-#undef readdir64
-weak_alias (__readdir, readdir64)
+#include <sysdeps/unix/sysv/linux/alpha/readdir.c>
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir_r.c b/sysdeps/unix/sysv/linux/ia64/readdir_r.c
index adb92db6af..fc5818fa19 100644
--- a/sysdeps/unix/sysv/linux/ia64/readdir_r.c
+++ b/sysdeps/unix/sysv/linux/ia64/readdir_r.c
@@ -1,4 +1 @@
-#define readdir64_r __no_readdir64_r_decl
-#include <sysdeps/unix/readdir_r.c>
-#undef readdir64_r
-weak_alias (__readdir_r, readdir64_r)
+#include <sysdeps/unix/sysv/linux/alpha/readdir_r.c>
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index babeab56a4..8790057e48 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -122,3 +122,10 @@
#if __LINUX_KERNEL_VERSION >= 131939
# define __ASSUME_LDT_WORKS 1
#endif
+
+/* The changed st_ino field appeared in 2.4.0-test6. But we cannot
+ distinguish this version from other 2.4.0 releases. Therefore play
+ save and assume it available for 2.4.1 and up. */
+#if __LINUX_KERNEL_VERSION >= 132097
+# define __ASSUME_ST_INO_64_BIT 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h
index bd7ddcc9bc..7f4f91f43e 100644
--- a/sysdeps/unix/sysv/linux/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/kernel_stat.h
@@ -29,3 +29,17 @@ struct kernel_stat
unsigned long int __unused5;
#define _HAVE___UNUSED5
};
+
+#define _HAVE_STAT___UNUSED1
+#define _HAVE_STAT___UNUSED2
+#define _HAVE_STAT___UNUSED3
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT64___UNUSED1
+#define _HAVE_STAT64___UNUSED2
+#define _HAVE_STAT64___UNUSED3
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
index 44097653c7..1192940d48 100644
--- a/sysdeps/unix/sysv/linux/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -32,10 +32,12 @@
# include <xstatconv.c>
#endif
-extern int __syscall_lstat (const char *__unbounded, struct kernel_stat *__unbounded);
+extern int __syscall_lstat (const char *__unbounded,
+ struct kernel_stat *__unbounded);
#ifdef __NR_lstat64
-extern int __syscall_lstat64 (const char *__unbounded, struct stat64 *__unbounded);
+extern int __syscall_lstat64 (const char *__unbounded,
+ struct stat64 *__unbounded);
# if __ASSUME_STAT64_SYSCALL == 0
/* The variable is shared between all wrappers around *stat64 calls. */
extern int __have_no_stat64;
@@ -43,14 +45,21 @@ extern int __have_no_stat64;
#endif
/* Get information about the file NAME in BUF. */
+extern int ___lxstat64 (int vers, const char *name, struct stat64 *buf);
+
int
-__lxstat64 (int vers, const char *name, struct stat64 *buf)
+___lxstat64 (int vers, const char *name, struct stat64 *buf)
{
+ int result;
#ifdef __ASSUME_STAT64_SYSCALL
- return INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), CHECK_1 (buf));
+ result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), CHECK_1 (buf));
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t)buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
#else
struct kernel_stat kbuf;
- int result;
# ifdef __NR_lstat64
if (! __have_no_stat64)
{
@@ -58,7 +67,13 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), CHECK_1 (buf));
if (result != -1 || errno != ENOSYS)
- return result;
+ {
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t)buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
+ }
__set_errno (saved_errno);
__have_no_stat64 = 1;
@@ -71,3 +86,12 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
return result;
#endif
}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (___lxstat64, __old__lxstat64)
+compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h
index 6bb07e7b13..379f2bcd32 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/types.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/types.h
@@ -137,7 +137,7 @@ typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
/* Type of file serial numbers. */
-typedef __u_long __ino64_t;
+typedef __u_quad_t __ino64_t;
/* Type of file sizes and offsets. */
typedef __loff_t __off64_t;
diff --git a/sysdeps/unix/sysv/linux/powerpc/Versions b/sysdeps/unix/sysv/linux/powerpc/Versions
index 0f2b4c77eb..6466be2cc5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -6,7 +6,24 @@ libc {
__register_frame_info_table;
}
GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
+
+ # a*
+ alphasort64;
+
+ # g*
+ getdirentries64;
# New rlimit interface
getrlimit; setrlimit; getrlimit64; setrlimit64;
+
+ # r*
+ readdir64; readdir64_r;
+
+ # s*
+ scandir64;
+
+ # v*
+ versionsort64;
}
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
new file mode 100644
index 0000000000..8f1dffacab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
@@ -0,0 +1,128 @@
+/* Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* Versions of the `struct stat' data structure. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the `xmknod' interface. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
+
+struct stat
+ {
+ __dev_t st_dev; /* Device. */
+#ifndef __USE_FILE_OFFSET64
+ unsigned short int __pad1;
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+ __ino64_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) (0)
+#define __S_TYPEISSEM(buf) (0)
+#define __S_TYPEISSHM(buf) (0)
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
diff --git a/sysdeps/unix/sysv/linux/powerpc/getdents64.c b/sysdeps/unix/sysv/linux/powerpc/getdents64.c
new file mode 100644
index 0000000000..0c75fb5a06
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/getdents64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/kernel_stat.h
index c07e182748..d51170e820 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel_stat.h
@@ -1,5 +1,5 @@
/* Definition of `struct stat' used in the kernel.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000 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
@@ -43,3 +43,17 @@ struct kernel_stat
unsigned long int __unused5;
#define _HAVE___UNUSED5
};
+
+#define _HAVE_STAT___UNUSED1
+#define _HAVE_STAT___UNUSED2
+#define _HAVE_STAT___UNUSED3
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT64___UNUSED1
+#define _HAVE_STAT64___UNUSED2
+#define _HAVE_STAT64___UNUSED3
+#define _HAVE_STAT64___UNUSED4
+#define _HAVE_STAT64___UNUSED5
+#define _HAVE_STAT64___PAD2
diff --git a/sysdeps/unix/sysv/linux/powerpc/readdir64.c b/sysdeps/unix/sysv/linux/powerpc/readdir64.c
new file mode 100644
index 0000000000..2ea26dd409
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/readdir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/readdir64_r.c b/sysdeps/unix/sysv/linux/powerpc/readdir64_r.c
new file mode 100644
index 0000000000..9f54f897e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/readdir64_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/scandir64.c b/sysdeps/unix/sysv/linux/powerpc/scandir64.c
new file mode 100644
index 0000000000..506fd8877c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/scandir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index 5a19e220aa..9341e3bd13 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -1,99 +1,14 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+#define __READDIR __readdir64
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+#include <sysdeps/unix/readdir.c>
- 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
- Library General Public License for more details.
+#include <shlib-compat.h>
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
-#include <string.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <assert.h>
-
-#include <dirstream.h>
-
-/* Read a directory entry from DIRP. */
-struct dirent64 *
-__readdir64 (DIR *dirp)
-{
- struct dirent64 *dp;
-
- __libc_lock_lock (dirp->lock);
-
- do
- {
- size_t reclen;
-
- if (dirp->offset >= dirp->size)
- {
- /* We've emptied out our buffer. Refill it. */
-
- size_t maxread;
- ssize_t bytes;
-
-#ifndef _DIRENT_HAVE_D_RECLEN
- /* Fixed-size struct; must read one at a time (see below). */
- maxread = sizeof *dp;
-#else
- maxread = dirp->allocation;
-#endif
-
- bytes = __getdents64 (dirp->fd, dirp->data, maxread);
- if (bytes <= 0)
- {
- dp = NULL;
- break;
- }
- dirp->size = (size_t) bytes;
-
- /* Reset the offset into the buffer. */
- dirp->offset = 0;
- }
-
- dp = (struct dirent64 *) &dirp->data[dirp->offset];
-
-#ifdef _DIRENT_HAVE_D_RECLEN
- reclen = dp->d_reclen;
-#else
- /* The only version of `struct dirent64' that lacks `d_reclen'
- is fixed-size. */
- assert (sizeof dp->d_name > 1);
- reclen = sizeof *dp;
- /* The name is not terminated if it is the largest possible size.
- Clobber the following byte to ensure proper null termination. We
- read jst one entry at a time above so we know that byte will not
- be used later. */
- dp->d_name[sizeof dp->d_name] = '\0';
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__readdir64, __old_readdir64)
+compat_symbol (libc, __old_readdir64, readdir64, GLIBC_2_1);
#endif
-
- dirp->offset += reclen;
-
-#ifdef _DIRENT_HAVE_D_OFF
- dirp->filepos = dp->d_off;
-#else
- dirp->filepos += reclen;
-#endif
-
- /* Skip deleted files. */
- } while (dp->d_ino == 0);
-
- __libc_lock_unlock (dirp->lock);
-
- return dp;
-}
-weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index a86ef7b8d2..63a6b80f95 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -1,106 +1,14 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+#define __READDIR_R __readdir64_r
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+#include <sysdeps/unix/readdir_r.c>
- 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
- Library General Public License for more details.
+#include <shlib-compat.h>
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+versioned_symbol (libc, __readdir64_r, readdir64_r, GLIBC_2_2);
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
-#include <string.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <assert.h>
-
-#include <dirstream.h>
-
-/* Read a directory entry from DIRP, store result in ENTRY and return
- pointer to result in *RESULT. */
-int
-readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
-{
- struct dirent64 *dp;
- size_t reclen;
-
- __libc_lock_lock (dirp->lock);
-
- do
- {
- if (dirp->offset >= dirp->size)
- {
- /* We've emptied out our buffer. Refill it. */
-
- size_t maxread;
- ssize_t bytes;
-
-#ifndef _DIRENT_HAVE_D_RECLEN
- /* Fixed-size struct; must read one at a time (see below). */
- maxread = sizeof *dp;
-#else
- maxread = dirp->allocation;
-#endif
-
- bytes = __getdents64 (dirp->fd, dirp->data, maxread);
- if (bytes <= 0)
- {
- dp = NULL;
- /* Reclen != 0 signals that an error occurred. */
- reclen = bytes != 0;
- break;
- }
- dirp->size = (size_t) bytes;
-
- /* Reset the offset into the buffer. */
- dirp->offset = 0;
- }
-
- dp = (struct dirent64 *) &dirp->data[dirp->offset];
-
-#ifdef _DIRENT_HAVE_D_RECLEN
- reclen = dp->d_reclen;
-#else
- /* The only version of `struct dirent64' that lacks `d_reclen'
- is fixed-size. */
- assert (sizeof dp->d_name > 1);
- reclen = sizeof *dp;
- /* The name is not terminated if it is the largest possible size.
- Clobber the following byte to ensure proper null termination. We
- read just one entry at a time above so we know that byte will not
- be used later. */
- dp->d_name[sizeof dp->d_name] = '\0';
-#endif
-
- dirp->offset += reclen;
-
-#ifdef _DIRENT_HAVE_D_OFF
- dirp->filepos = dp->d_off;
-#else
- dirp->filepos += reclen;
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__readdir64_r, __old_readdir64_r)
+compat_symbol (libc, __old_readdir64_r, readdir64_r, GLIBC_2_1);
#endif
-
- /* Skip deleted files. */
- }
- while (dp->d_ino == 0);
-
- if (dp != NULL)
- *result = memcpy (entry, dp, reclen);
- else
- *result = NULL;
-
- __libc_lock_unlock (dirp->lock);
-
- return dp != NULL ? 0 : reclen ? errno : 0;
-}
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
new file mode 100644
index 0000000000..7fe9d4038e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -0,0 +1,131 @@
+/* Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* Versions of the `struct stat' data structure. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the `xmknod' interface. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
+
+struct stat
+ {
+ __dev_t st_dev; /* Device. */
+#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
+ unsigned short int __pad1;
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+#if __WORDSIZE == 64
+ unsigned short int __pad1;
+#endif
+ __ino64_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) (0)
+#define __S_TYPEISSEM(buf) (0)
+#define __S_TYPEISSHM(buf) (0)
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types.h b/sysdeps/unix/sysv/linux/sparc/bits/types.h
index 8d76cd7e83..191315ff0b 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/types.h
@@ -73,7 +73,7 @@ typedef __u_quad_t __dev_t; /* Type of device numbers. */
typedef __u_int __uid_t; /* Type of user identifications. */
typedef __u_int __gid_t; /* Type of group identifications. */
typedef __u_long __ino_t; /* Type of file serial numbers. */
-typedef __u_long __ino64_t; /* Type of file serial numbers. */
+typedef __u_quad_t __ino64_t; /* Type of file serial numbers. */
typedef __u_int __mode_t; /* Type of file attribute bitmasks. */
typedef __u_int __nlink_t; /* Type of file link counts. */
typedef long int __off_t; /* Type of file sizes and offsets. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
index 2d3061bad5..fcb9df31ec 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
@@ -5,4 +5,23 @@ libc {
__register_frame_info; __deregister_frame_info; __frame_state_for;
__register_frame_info_table;
}
+ GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
+
+ # a*
+ alphasort64;
+
+ # g*
+ getdirentries64;
+
+ # r*
+ readdir64; readdir64_r;
+
+ # s*
+ scandir64;
+
+ # v*
+ versionsort64;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c
new file mode 100644
index 0000000000..0c75fb5a06
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
index 91f02f4e20..ec2804687d 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
@@ -26,3 +26,17 @@ struct kernel_stat
#define _HAVE___UNUSED3
#define _HAVE___UNUSED4
#define _HAVE___UNUSED5
+
+#define _HAVE_STAT___UNUSED1
+#define _HAVE_STAT___UNUSED2
+#define _HAVE_STAT___UNUSED3
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT64___UNUSED1
+#define _HAVE_STAT64___UNUSED2
+#define _HAVE_STAT64___UNUSED3
+#define _HAVE_STAT64___UNUSED4
+#define _HAVE_STAT64___UNUSED5
+#define _HAVE_STAT64___PAD2
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c b/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c
new file mode 100644
index 0000000000..2ea26dd409
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c b/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c
new file mode 100644
index 0000000000..9f54f897e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c b/sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c
new file mode 100644
index 0000000000..506fd8877c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c b/sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c
new file mode 100644
index 0000000000..491fa9dfb2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getdents.c
@@ -0,0 +1,4 @@
+#define __getdents64 __no___getdents64_decl
+#include <sysdeps/unix/sysv/linux/getdents.c>
+#undef __getdents64
+weak_alias(__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c
new file mode 100644
index 0000000000..0df2c8f4c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getdents64.c
@@ -0,0 +1 @@
+/* getdents64 is in getdents.c */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index 05457fc78e..700dd127d0 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -21,4 +21,19 @@ struct kernel_stat
#define _HAVE___UNUSED1
#define _HAVE___UNUSED2
+#define _HAVE_STAT___UNUSED1
+#define _HAVE_STAT___UNUSED2
+#define _HAVE_STAT___UNUSED3
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT64___UNUSED1
+#define _HAVE_STAT64___UNUSED2
+#define _HAVE_STAT64___UNUSED3
+#define _HAVE_STAT64___UNUSED4
+#define _HAVE_STAT64___UNUSED5
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+
#define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
index 300ebb2629..e64b2f8bdd 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
@@ -1,7 +1 @@
-#define readdir64 __no_readdir64_decl
-#define __readdir64 __no___readdir64_decl
-#include <sysdeps/unix/readdir.c>
-#undef __readdir64
-strong_alias (__readdir, __readdir64)
-#undef readdir64
-weak_alias (__readdir, readdir64)
+#include <sysdeps/unix/sysv/linux/alpha/readdir.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
index adb92db6af..fc5818fa19 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
@@ -1,4 +1 @@
-#define readdir64_r __no_readdir64_r_decl
-#include <sysdeps/unix/readdir_r.c>
-#undef readdir64_r
-weak_alias (__readdir_r, readdir64_r)
+#include <sysdeps/unix/sysv/linux/alpha/readdir_r.c>
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index 55d4bea57a..f52cb7a42c 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -1,5 +1,5 @@
/* xstat64 using old-style Unix stat system call.
- Copyright (C) 1991, 95, 96, 97, 98, 99, 00 Free Software Foundation, Inc.
+ Copyright (C) 1991, 95, 96, 97, 98, 99, 2000 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
@@ -32,10 +32,12 @@
# include <xstatconv.c>
#endif
-extern int __syscall_stat (const char *__unbounded, struct kernel_stat *__unbounded);
+extern int __syscall_stat (const char *__unbounded,
+ struct kernel_stat *__unbounded);
#ifdef __NR_stat64
-extern int __syscall_stat64 (const char *__unbounded, struct stat64 *__unbounded);
+extern int __syscall_stat64 (const char *__unbounded,
+ struct stat64 *__unbounded);
# if __ASSUME_STAT64_SYSCALL == 0
/* The variable is shared between all wrappers around *stat64 calls.
This is the definition. */
@@ -46,13 +48,21 @@ int __have_no_stat64;
/* Get information about the file NAME in BUF. */
int
-__xstat64 (int vers, const char *name, struct stat64 *buf)
+___xstat64 (int vers, const char *name, struct stat64 *buf);
+
+int
+___xstat64 (int vers, const char *name, struct stat64 *buf)
{
+ int result;
#if __ASSUME_STAT64_SYSCALL > 0
- return INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), CHECK_1 (buf));
+ result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), CHECK_1 (buf));
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t) buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
#else
struct kernel_stat kbuf;
- int result;
# if defined __NR_stat64
if (! __have_no_stat64)
{
@@ -60,7 +70,13 @@ __xstat64 (int vers, const char *name, struct stat64 *buf)
result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), CHECK_1 (buf));
if (result != -1 || errno != ENOSYS)
- return result;
+ {
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (!result && buf->__st_ino != (__ino_t) buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+# endif
+ return result;
+ }
__set_errno (saved_errno);
__have_no_stat64 = 1;
@@ -74,3 +90,12 @@ __xstat64 (int vers, const char *name, struct stat64 *buf)
return result;
#endif
}
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (___xstat64, __old__xstat64)
+compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1);
+#endif
diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c
index d9b48d13ea..21620a2e00 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/xstatconv.c
@@ -38,7 +38,7 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
/* Convert to current kernel version of `struct stat'. */
buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE___PAD1
+#ifdef _HAVE_STAT___PAD1
buf->__pad1 = 0;
#endif
buf->st_ino = kbuf->st_ino;
@@ -47,28 +47,28 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
buf->st_uid = kbuf->st_uid;
buf->st_gid = kbuf->st_gid;
buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE___PAD2
+#ifdef _HAVE_STAT___PAD2
buf->__pad2 = 0;
#endif
buf->st_size = kbuf->st_size;
buf->st_blksize = kbuf->st_blksize;
buf->st_blocks = kbuf->st_blocks;
buf->st_atime = kbuf->st_atime;
-#ifdef _HAVE___UNUSED1
+#ifdef _HAVE_STAT___UNUSED1
buf->__unused1 = 0;
#endif
buf->st_mtime = kbuf->st_mtime;
-#ifdef _HAVE___UNUSED2
+#ifdef _HAVE_STAT___UNUSED2
buf->__unused2 = 0;
#endif
buf->st_ctime = kbuf->st_ctime;
-#ifdef _HAVE___UNUSED3
+#ifdef _HAVE_STAT___UNUSED3
buf->__unused3 = 0;
#endif
-#ifdef _HAVE___UNUSED4
+#ifdef _HAVE_STAT___UNUSED4
buf->__unused4 = 0;
#endif
-#ifdef _HAVE___UNUSED5
+#ifdef _HAVE_STAT___UNUSED5
buf->__unused5 = 0;
#endif
}
@@ -96,37 +96,40 @@ xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
/* Convert to current kernel version of `struct stat64'. */
buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE___PAD1
+#ifdef _HAVE_STAT64___PAD1
buf->__pad1 = 0;
#endif
buf->st_ino = kbuf->st_ino;
+#ifdef _HAVE_STAT64___ST_INO
+ buf->__st_ino = kbuf->st_ino;
+#endif
buf->st_mode = kbuf->st_mode;
buf->st_nlink = kbuf->st_nlink;
buf->st_uid = kbuf->st_uid;
buf->st_gid = kbuf->st_gid;
buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE___PAD2
+#ifdef _HAVE_STAT64___PAD2
buf->__pad2 = 0;
#endif
buf->st_size = kbuf->st_size;
buf->st_blksize = kbuf->st_blksize;
buf->st_blocks = kbuf->st_blocks;
buf->st_atime = kbuf->st_atime;
-#ifdef _HAVE___UNUSED1
+#ifdef _HAVE_STAT64___UNUSED1
buf->__unused1 = 0;
#endif
buf->st_mtime = kbuf->st_mtime;
-#ifdef _HAVE___UNUSED2
+#ifdef _HAVE_STAT64___UNUSED2
buf->__unused2 = 0;
#endif
buf->st_ctime = kbuf->st_ctime;
-#ifdef _HAVE___UNUSED3
+#ifdef _HAVE_STAT64___UNUSED3
buf->__unused3 = 0;
#endif
-#ifdef _HAVE___UNUSED4
+#ifdef _HAVE_STAT64___UNUSED4
buf->__unused4 = 0;
#endif
-#ifdef _HAVE___UNUSED5
+#ifdef _HAVE_STAT64___UNUSED5
buf->__unused5 = 0;
#endif
}
@@ -151,23 +154,48 @@ xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf)
{
case _STAT_VER_LINUX:
{
- /* Convert current kernel version of `struct stat64' to `struct stat'. */
+ /* Convert current kernel version of `struct stat64' to
+ `struct stat'. */
buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE___PAD1
+#ifdef _HAVE_STAT___PAD1
buf->__pad1 = 0;
#endif
- buf->st_ino = kbuf->st_ino;
+#ifdef _HAVE_STAT64___ST_INO
+# if __ASSUME_ST_INO_64_BIT == 0
+ if (kbuf->st_ino == 0)
+ buf->st_ino = kbuf->__st_ino;
+ else
+# endif
+ {
+ buf->st_ino = kbuf->st_ino;
+ if (sizeof (buf->st_ino) != sizeof (kbuf->__st_ino)
+ && buf->st_ino != kbuf->st_ino)
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+ }
+#else
+ buf->st_ino = kbuf->__st_ino;
+ if (sizeof (buf->st_ino) != sizeof (kbuf->__st_ino)
+ && buf->st_ino != kbuf->st_ino)
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+#endif
buf->st_mode = kbuf->st_mode;
buf->st_nlink = kbuf->st_nlink;
buf->st_uid = kbuf->st_uid;
buf->st_gid = kbuf->st_gid;
buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE___PAD2
+#ifdef _HAVE_STAT___PAD2
buf->__pad2 = 0;
#endif
buf->st_size = kbuf->st_size;
/* Check for overflow. */
- if (buf->st_size != kbuf->st_size)
+ if (sizeof (buf->st_size) != sizeof (kbuf->st_size)
+ && buf->st_size != kbuf->st_size)
{
__set_errno (EOVERFLOW);
return -1;
@@ -175,27 +203,28 @@ xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf)
buf->st_blksize = kbuf->st_blksize;
buf->st_blocks = kbuf->st_blocks;
/* Check for overflow. */
- if (buf->st_blocks != kbuf->st_blocks)
+ if (sizeof (buf->st_blocks) != sizeof (kbuf->st_blocks)
+ && buf->st_blocks != kbuf->st_blocks)
{
__set_errno (EOVERFLOW);
return -1;
}
buf->st_atime = kbuf->st_atime;
-#ifdef _HAVE___UNUSED1
+#ifdef _HAVE_STAT___UNUSED1
buf->__unused1 = 0;
#endif
buf->st_mtime = kbuf->st_mtime;
-#ifdef _HAVE___UNUSED2
+#ifdef _HAVE_STAT___UNUSED2
buf->__unused2 = 0;
#endif
buf->st_ctime = kbuf->st_ctime;
-#ifdef _HAVE___UNUSED3
+#ifdef _HAVE_STAT___UNUSED3
buf->__unused3 = 0;
#endif
-#ifdef _HAVE___UNUSED4
+#ifdef _HAVE_STAT___UNUSED4
buf->__unused4 = 0;
#endif
-#ifdef _HAVE___UNUSED5
+#ifdef _HAVE_STAT___UNUSED5
buf->__unused5 = 0;
#endif
}