]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 1 Mar 2004 21:34:36 +0000 (21:34 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 1 Mar 2004 21:34:36 +0000 (21:34 +0000)
2004-03-01  Ulrich Drepper  <drepper@redhat.com>

* sysdeps/unix/sysv/linux/kernel-features.h: Add support for
__ASSUME_GETDENTS32_D_TYPE.
* sysdeps/unix/sysv/linux/getdents.c: For 2.6.4+ kernels you
getdents syscall again since it provides d_type information.

* manual/install.texi (Tools for Compilation): Autoconf 2.53 is
required.

ChangeLog
sysdeps/unix/sysv/linux/getdents.c
sysdeps/unix/sysv/linux/kernel-features.h

index a2486301ae02f1575bcb1cad60946af021cccdf9..097a54c33a2c2384e5080c52ce3eb0e270e857de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
+2004-03-01  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/unix/sysv/linux/kernel-features.h: Add support for
+       __ASSUME_GETDENTS32_D_TYPE.
+       * sysdeps/unix/sysv/linux/getdents.c: For 2.6.4+ kernels you
+       getdents syscall again since it provides d_type information.
+
 2004-02-29  Andreas Jaeger  <aj@suse.de>
 
-       * manual/install.texi (Tools for Compilation): Autoconf 2.53 is required.
+       * manual/install.texi (Tools for Compilation): Autoconf 2.53 is
+       required.
        (Supported Configurations): Add x86_64-*-linux.
-       * INSTALL: Regenerated.
 
 2004-02-28  Ulrich Drepper  <drepper@redhat.com>
 
index a732afe3c5d8909f207d913e9a1c97c526062e26..d473486de8f3335c7c5109a31249d35e6df91e0c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include "kernel-features.h"
 
 #ifdef __NR_getdents64
-#ifndef __ASSUME_GETDENTS64_SYSCALL
-#ifndef __GETDENTS
+# ifndef __ASSUME_GETDENTS64_SYSCALL
+#  ifndef __GETDENTS
 /* The variable is shared between all *getdents* calls.  */
 int __have_no_getdents64;
-#else
+#  else
 extern int __have_no_getdents64;
+#  endif
+#  define have_no_getdents64_defined 1
+# endif
 #endif
-#endif
+#ifndef have_no_getdents64_defined
+# define __have_no_getdents64 0
 #endif
 
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
@@ -94,13 +98,42 @@ ssize_t
 internal_function
 __GETDENTS (int fd, char *buf, size_t nbytes)
 {
-  off64_t last_offset = -1;
   ssize_t retval;
 
+#ifdef __ASSUME_GETDENTS32_D_TYPE
+  if (sizeof (DIRENT_TYPE) == sizeof (struct dirent))
+    {
+      retval = INLINE_SYSCALL (getdents, 3, fd, CHECK_N(buf, nbytes), nbytes);
+
+      /* The kernel added the d_type value after the name.  Change
+        this now.  */
+      if (retval != -1)
+       {
+         union
+         {
+           struct kernel_dirent k;
+           struct dirent u;
+         } *kbuf = (void *) buf;
+
+         while ((char *) kbuf < buf + retval)
+           {
+             char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1);
+             memmove (kbuf->u.d_name, kbuf->k.d_name,
+                      strlen (kbuf->k.d_name) + 1);
+             kbuf->u.d_type = d_type;
+
+             kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen);
+           }
+       }
+
+      return retval;
+    }
+#endif
+
+  off64_t last_offset = -1;
+
 #ifdef __NR_getdents64
-# ifndef __ASSUME_GETDENTS64_SYSCALL
   if (!__have_no_getdents64)
-# endif
     {
 # ifndef __ASSUME_GETDENTS64_SYSCALL
       int saved_errno = errno;
index 0f35a3ccc37dd7f2da19b28faf8dcc7bb10f2d84..b52fa73e0d935e75557c8116df7a5f01ff177739 100644 (file)
    SIMD (AKA Altivec, VMX) instructions and register state.  This changes
    the overall size of the sigcontext and adds the swapcontext syscall.  */
 #if __LINUX_KERNEL_VERSION >= 132608 && defined __powerpc__
-# define __ASSUME_SWAPCONTEXT_SYSCALL          1
+# define __ASSUME_SWAPCONTEXT_SYSCALL  1
 #endif
 
 /* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is
    implied.  */
 #if __LINUX_KERNEL_VERSION >= 132610
-# define __ASSUME_NO_CLONE_DETACHED            1
+# define __ASSUME_NO_CLONE_DETACHED    1
+#endif
+
+/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
+   information as well.  */
+#if __LINUX_KERNEL_VERSION >= 132612
+# define __ASSUME_GETDENTS32_D_TYPE    1
 #endif