[[PATCH v2] 1/4] Support kernels without __ARCH_WANT_SYSCALL_DEPRECATED

Mark Salter msalter at redhat.com
Fri May 4 12:52:17 UTC 2012


Signed-off-by: Mark Salter <msalter at redhat.com>
---
 libc/sysdeps/linux/common/bits/kernel-features.h |    8 --------
 libc/sysdeps/linux/common/getdents.c             |   13 +++++++++++--
 libc/sysdeps/linux/common/ustat.c                |    2 ++
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 5ea85d2..751ff2b 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -441,14 +441,6 @@
 # define __ASSUME_NO_CLONE_DETACHED	1
 #endif
 
-/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
-   information as well and in between 2.6.5 and 2.6.8 most compat wrappers
-   were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
-#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
-    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
-# define __ASSUME_GETDENTS32_D_TYPE	1
-#endif
-
 /* Starting with version 2.5.3, the initial location returned by `brk'
    after exec is always rounded up to the next page.  */
 #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index 46f7b8e..78a0d57 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -26,8 +26,7 @@
 /* With newer versions of linux, the getdents syscall returns d_type
  * information after the name field.
  *
- * See __ASSUME_GETDENTS32_D_TYPE in glibc's kernel-features.h for specific
- * version / arch details.
+ * See __ASSUME_GETDENTS32_D_TYPE below for specific version / arch details.
  */
 
 #ifndef offsetof
@@ -44,9 +43,19 @@ struct kernel_dirent
 
 ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden;
 
+#ifdef __NR_getdents
 #define __NR___syscall_getdents __NR_getdents
 static __always_inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count)
 
+/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
+   information as well and in between 2.6.5 and 2.6.8 most compat wrappers
+   were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
+# define __ASSUME_GETDENTS32_D_TYPE	1
+#endif
+#endif
+
 #if defined __ASSUME_GETDENTS32_D_TYPE
 
 ssize_t __getdents (int fd, char *buf, size_t nbytes)
diff --git a/libc/sysdeps/linux/common/ustat.c b/libc/sysdeps/linux/common/ustat.c
index e97fa76..1bcb581 100644
--- a/libc/sysdeps/linux/common/ustat.c
+++ b/libc/sysdeps/linux/common/ustat.c
@@ -11,6 +11,7 @@
 #include <sys/ustat.h>
 #include <sys/sysmacros.h>
 
+#ifdef __NR_ustat
 #define __NR___syscall_ustat __NR_ustat
 /* Kernel's fs/super.c defines this:
  * long sys_ustat(unsigned dev, struct ustat __user * ubuf),
@@ -24,3 +25,4 @@ int ustat(dev_t dev, struct ustat *ubuf)
 {
 	return __syscall_ustat(dev, ubuf);
 }
+#endif
-- 
1.7.9.1



More information about the uClibc mailing list