kumquat-buildroot/package/ltp-testsuite/0003-syscalls-getdents-Add-autotools-check-for-getdents-getdents64.patch
Fabrice Fontaine 0ebdc82ca6 package/ltp-testsuite: fix build with glibc 2.30
Fixes:
 - http://autobuild.buildroot.org/results/e8b72f5d93d3565d41364a52c0024a0292a06b41

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-09-15 22:21:50 +02:00

81 lines
2.1 KiB
Diff

From 6d9de5f0cd4eacf4037770fc3a2ad1ad373bf0c4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 26 Jul 2019 11:25:23 -0700
Subject: [PATCH] syscalls/getdents: Add autotools check for
getdents/getdents64
glibc 2.30 has added wrapper for getdents64, this will help in detecting
right condition to use fallback.
Check for getdents API as well while here.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
[Retrieved from:
https://github.com/linux-test-project/ltp/commit/6d9de5f0cd4eacf4037770fc3a2ad1ad373bf0c4]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
configure.ac | 2 ++
testcases/kernel/syscalls/getdents/getdents.h | 12 ++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f7d1afc405..5a882a3412 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,8 @@ AC_CHECK_FUNCS([ \
fallocate \
fchownat \
fstatat \
+ getdents \
+ getdents64 \
kcmp \
mkdirat \
mknodat \
diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h
index 702b0bd28f..c24ed6c996 100644
--- a/testcases/kernel/syscalls/getdents/getdents.h
+++ b/testcases/kernel/syscalls/getdents/getdents.h
@@ -23,7 +23,7 @@
#include <stdint.h>
#include "test.h"
#include "lapi/syscalls.h"
-
+#include "config.h"
/*
* See fs/compat.c struct compat_linux_dirent
*/
@@ -34,12 +34,17 @@ struct linux_dirent {
char d_name[];
};
+#if HAVE_GETDENTS
+#include <unistd.h>
+#else
static inline int
getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
{
return ltp_syscall(__NR_getdents, fd, dirp, size);
}
+#endif /* HAVE_GETDENTS */
+
struct linux_dirent64 {
uint64_t d_ino;
int64_t d_off;
@@ -48,10 +53,13 @@ struct linux_dirent64 {
char d_name[];
};
+#if HAVE_GETDENTS64
+#include <unistd.h>
+#else
static inline int
getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
{
return ltp_syscall(__NR_getdents64, fd, dirp64, size);
}
-
+#endif /* HAVE_GETDENTS64 */
#endif /* GETDENTS_H */