Skip to contentSkip to conversation

ltp: Fix build with glibc 2.30

PATCH New Khem Raj 1 participant 2 messages Jul 27, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 ltp: Fix build with glibc 2.30

---
 ...me-check-for-getdents-getdents64-API.patch | 72 +++++++++++++++++++
 ...k-for-RES_USE_INET6-during-configure.patch | 68 ++++++++++++++++++
 ...e-getdents-getdents64-only-for-glibc.patch | 50 -------------
 meta/recipes-extended/ltp/ltp_20190517.bb     |  3 +-
 4 files changed, 142 insertions(+), 51 deletions(-)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch
 create mode 100644 meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch
 delete mode 100644 meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch
meta/recipes-extended/ltp/ltp/0001-Add-configure-time-check-for-getdents-getdents64-API.patch new file +72 -0
new file mode 100644
index 0000000000..bfceadb190
@@ -0,0 +1,72 @@
+From 404dfeb4faef213b0450f173b60cd7080edec349 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 26 Jul 2019 10:32:29 -0700
+Subject: [PATCH 1/2] Add configure time check for getdents/getdents64 APIs
+
+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
+
+Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-July/012954.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac                                  | 2 ++
+ testcases/kernel/syscalls/getdents/getdents.h | 8 ++++++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -65,6 +65,8 @@ AC_CHECK_FUNCS([ \
+     fallocate \
+     fchownat \
+     fstatat \
++    getdents \
++    getdents64 \
+     kcmp \
+     mkdirat \
+     mknodat \
+--- 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 */
meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch new file +68 -0

68 lines not on this page · raw message

meta/recipes-extended/ltp/ltp/0005-getdents-define-getdents-getdents64-only-for-glibc.patch deleted +0 -50

50 lines not on this page · raw message

meta/recipes-extended/ltp/ltp_20190517.bb +2 -1
index 1f3a94bdfa..c62f2618b5 100644
@@ -34,7 +34,6 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://0002-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \
            file://0003-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch \
            file://0004-guard-mallocopt-with-__GLIBC__.patch \
-           file://0005-getdents-define-getdents-getdents64-only-for-glibc.patch \
            file://0006-rt_tgsigqueueinfo-disable-test-on-musl.patch \
            file://0007-Fix-test_proc_kill-hanging.patch \
            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 \
            file://0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
            file://0011-direct_io-diotest4-drop-MAP_FIXED.patch \
            file://0012-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch \
+           file://0001-Add-configure-time-check-for-getdents-getdents64-API.patch \
+           file://0002-check-for-RES_USE_INET6-during-configure.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.22.0
author
#1 lore raw

PATCH 2/2 lttng-tools: Fix build with glibc 2.30

---
 ...heck-for-gettid-API-during-configure.patch | 55 +++++++++++++++++++
 .../lttng/lttng-tools_2.10.7.bb               |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/0001-check-for-gettid-API-during-configure.patch
meta/recipes-kernel/lttng/lttng-tools/0001-check-for-gettid-API-during-configure.patch new file +55 -0
new file mode 100644
index 0000000000..c494cee604
@@ -0,0 +1,55 @@
+From 69c62f5f3cc424b7dd0c8e4097743b39a9c48306 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Jul 2019 08:48:13 -0700
+Subject: [lttng-tools][PATCH] check for gettid API during configure
+
+Add support for gettid() provided by glibc 2.30+
+
+Since version 2.30 glibc provides gettid and it causes conflicts with
+locally defined gettid(). Use the local definition of
+gettid only if system gettid is not available.
+
+https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD<Paste>
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac            | 2 +-
+ src/common/compat/tid.h | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7b99f5c..e4bd82c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -190,7 +190,7 @@ AC_CHECK_HEADERS([ \
+ # Basic functions check
+ AC_CHECK_FUNCS([ \
+ 	atexit bzero clock_gettime dup2 fdatasync fls ftruncate \
+-	gethostbyname gethostname getpagesize localtime_r memchr memset \
++	gethostbyname gethostname getpagesize gettid localtime_r memchr memset \
+ 	mkdir munmap putenv realpath rmdir socket strchr strcspn strdup \
+ 	strncasecmp strndup strnlen strpbrk strrchr strstr strtol strtoul \
+ 	strtoull dirfd gethostbyname2 getipnodebyname epoll_create1 \
+diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
+index 40f562f..aa07a85 100644
+--- a/src/common/compat/tid.h
++++ b/src/common/compat/tid.h
+@@ -25,6 +25,7 @@
+ #ifndef LTTNG_TID_H
+ #define LTTNG_TID_H
+ 
++#if !HAVE_GETTID
+ #ifdef __linux__
+ #include <syscall.h>
+ #endif
+@@ -47,5 +48,5 @@ static inline pid_t gettid(void)
+ 	return getpid();
+ }
+ #endif
+-
++#endif /* HAVE_GETTID */
+ #endif /* LTTNG_TID_H */
+-- 
+2.22.0
+
meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb +1 -0
index 469ad111c4..aa6d19d0fa 100644
@@ -34,6 +34,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
            file://lttng-sessiond.service \
            file://0001-Skip-when-testapp-is-not-present.patch \
            file://0002-Fix-check-for-lttng-modules-presence-before-testing.patch \
+           file://0001-check-for-gettid-API-during-configure.patch \
            "
 
 SRC_URI[md5sum] = "e7804d10e4cade381e241601f6047373"
Signature · 1 line
2.22.0