summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-07-27 08:58:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-31 13:50:46 +0100
commite72a75671d5b82edc09062415e09ebfdbfe5cfbe (patch)
tree303e54f84790d8618374c1ab20021d65a138d023
parent1a4e4fb6b0a9d54641bd4193e95311d1f822a9ca (diff)
downloadpoky-e72a75671d5b82edc09062415e09ebfdbfe5cfbe.tar.gz
ltp: Fix build with glibc 2.30
(From OE-Core rev: b129e1b8d19e790b8176bbb390ee9b7745773286) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch72
-rw-r--r--meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch68
-rw-r--r--meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch50
-rw-r--r--meta/recipes-extended/ltp/ltp_20190517.bb3
4 files changed, 142 insertions, 51 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch b/meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch
new file mode 100644
index 0000000000..bfceadb190
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch
@@ -0,0 +1,72 @@
1From 404dfeb4faef213b0450f173b60cd7080edec349 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 26 Jul 2019 10:32:29 -0700
4Subject: [PATCH 1/2] Add configure time check for getdents/getdents64 APIs
5
6glibc 2.30 has added wrapper for getdents64 this will help in detecting
7right condition to use fallback
8
9Check for getdents API as well while here
10
11Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-July/012954.html]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 configure.ac | 2 ++
15 testcases/kernel/syscalls/getdents/getdents.h | 8 ++++++--
16 2 files changed, 8 insertions(+), 2 deletions(-)
17
18--- a/configure.ac
19+++ b/configure.ac
20@@ -65,6 +65,8 @@ AC_CHECK_FUNCS([ \
21 fallocate \
22 fchownat \
23 fstatat \
24+ getdents \
25+ getdents64 \
26 kcmp \
27 mkdirat \
28 mknodat \
29--- a/testcases/kernel/syscalls/getdents/getdents.h
30+++ b/testcases/kernel/syscalls/getdents/getdents.h
31@@ -23,7 +23,7 @@
32 #include <stdint.h>
33 #include "test.h"
34 #include "lapi/syscalls.h"
35-
36+#include "config.h"
37 /*
38 * See fs/compat.c struct compat_linux_dirent
39 */
40@@ -34,12 +34,17 @@ struct linux_dirent {
41 char d_name[];
42 };
43
44+#if HAVE_GETDENTS
45+#include <unistd.h>
46+#else
47 static inline int
48 getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
49 {
50 return ltp_syscall(__NR_getdents, fd, dirp, size);
51 }
52
53+#endif /* HAVE_GETDENTS */
54+
55 struct linux_dirent64 {
56 uint64_t d_ino;
57 int64_t d_off;
58@@ -48,10 +53,13 @@ struct linux_dirent64 {
59 char d_name[];
60 };
61
62+#if HAVE_GETDENTS64
63+#include <unistd.h>
64+#else
65 static inline int
66 getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
67 {
68 return ltp_syscall(__NR_getdents64, fd, dirp64, size);
69 }
70-
71+#endif /* HAVE_GETDENTS64 */
72 #endif /* GETDENTS_H */
diff --git a/meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch b/meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch
new file mode 100644
index 0000000000..12e47eb2b6
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch
@@ -0,0 +1,68 @@
1From 7bc134545b7beb09717a60541530c20a1a5740d3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 26 Jul 2019 10:55:28 -0700
4Subject: [PATCH 2/2] check for RES_USE_INET6 during configure
5
6glibc 2.30 has remove RES_USE_INET6 define which has been on its way out
7since 2.26 release, this check ensures that we detect it before using it
8
9Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-July/012955.html]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 configure.ac | 13 +++++++++++++
13 testcases/network/multicast/mc_gethost/mc_gethost.c | 6 ++++++
14 2 files changed, 19 insertions(+)
15
16diff --git a/configure.ac b/configure.ac
17index 2255b5c181..ed7acccb01 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -91,6 +91,19 @@ AC_CHECK_FUNCS([ \
21 vmsplice \
22 ])
23
24+#check defines
25+AC_MSG_CHECKING([for RES_USE_INET6])
26+AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <resolv.h>]],
27+ [[char dummy[RES_USE_INET6];]])],
28+ [
29+ AC_MSG_RESULT([yes])
30+ AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 1, [Define to 1 if you have the RES_USE_INET6 macro.])
31+ ],
32+ [
33+ AC_MSG_RESULT([no])
34+ AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 0, [Define to 1 if you have the RES_USE_INET6 macro.])
35+ ]
36+)
37 # Tools knobs
38
39 # Expect
40diff --git a/testcases/network/multicast/mc_gethost/mc_gethost.c b/testcases/network/multicast/mc_gethost/mc_gethost.c
41index 9cc15d086b..d1cae5441a 100644
42--- a/testcases/network/multicast/mc_gethost/mc_gethost.c
43+++ b/testcases/network/multicast/mc_gethost/mc_gethost.c
44@@ -17,6 +17,8 @@
45 #include <string.h>
46 #include <stdlib.h>
47
48+#include "config.h"
49+
50 #ifndef LOG_PERROR
51 #define LOG_PERROR 0
52 #endif
53@@ -50,8 +52,12 @@ usage:
54 argv++, argc--;
55 }
56 if (argc >= 1 && !strcmp(*argv, "-6")) {
57+#if HAVE_RES_USE_INET6
58 af = AF_INET6, size = IN6ADDRSZ;
59 _res.options |= RES_USE_INET6;
60+#else
61+ af = AF_INET, size = INADDRSZ;
62+#endif
63 argv++, argc--;
64 }
65 if (argc >= 1 && !strcmp(*argv, "-f")) {
66--
672.22.0
68
diff --git a/meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch b/meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch
deleted file mode 100644
index d1f7b0746b..0000000000
--- a/meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From b996b2480fe3a800ffbdc4a0fdc5e8775c575449 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 8 Jan 2016 06:57:04 +0000
4Subject: [PATCH] getdents: define getdents/getdents64 only for glibc
5
6getdents/getdents64 are implemented in musl and when we define static
7functions with same name, it errors out.
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 testcases/kernel/syscalls/getdents/getdents.h | 6 ++++--
14 1 file changed, 4 insertions(+), 2 deletions(-)
15
16diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h
17index 702b0bd..860b22e 100644
18--- a/testcases/kernel/syscalls/getdents/getdents.h
19+++ b/testcases/kernel/syscalls/getdents/getdents.h
20@@ -34,12 +34,13 @@ struct linux_dirent {
21 char d_name[];
22 };
23
24+#ifdef __GLIBC__
25 static inline int
26 getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
27 {
28 return ltp_syscall(__NR_getdents, fd, dirp, size);
29 }
30-
31+#endif
32 struct linux_dirent64 {
33 uint64_t d_ino;
34 int64_t d_off;
35@@ -48,10 +49,11 @@ struct linux_dirent64 {
36 char d_name[];
37 };
38
39+#ifdef __GLIBC__
40 static inline int
41 getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
42 {
43 return ltp_syscall(__NR_getdents64, fd, dirp64, size);
44 }
45-
46+#endif
47 #endif /* GETDENTS_H */
48--
492.7.4
50
diff --git a/meta/recipes-extended/ltp/ltp_20190517.bb b/meta/recipes-extended/ltp/ltp_20190517.bb
index 1f3a94bdfa..c62f2618b5 100644
--- a/meta/recipes-extended/ltp/ltp_20190517.bb
+++ b/meta/recipes-extended/ltp/ltp_20190517.bb
@@ -34,7 +34,6 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
34 file://0002-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \ 34 file://0002-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \
35 file://0003-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch \ 35 file://0003-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch \
36 file://0004-guard-mallocopt-with-__GLIBC__.patch \ 36 file://0004-guard-mallocopt-with-__GLIBC__.patch \
37 file://0005-getdents-define-getdents-getdents64-only-for-glibc.patch \
38 file://0006-rt_tgsigqueueinfo-disable-test-on-musl.patch \ 37 file://0006-rt_tgsigqueueinfo-disable-test-on-musl.patch \
39 file://0007-Fix-test_proc_kill-hanging.patch \ 38 file://0007-Fix-test_proc_kill-hanging.patch \
40 file://0008-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ 39 file://0008-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
@@ -42,6 +41,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
42 file://0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \ 41 file://0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
43 file://0011-direct_io-diotest4-drop-MAP_FIXED.patch \ 42 file://0011-direct_io-diotest4-drop-MAP_FIXED.patch \
44 file://0012-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch \ 43 file://0012-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch \
44 file://0001-Add-configure-time-check-for-getdents-getdents64-API.patch \
45 file://0002-check-for-RES_USE_INET6-during-configure.patch \
45 " 46 "
46 47
47S = "${WORKDIR}/git" 48S = "${WORKDIR}/git"