lttng-tools: Switch to alternative upstream submitted patch

(From OE-Core rev: b055ca4b25dc6bfd617497f995b42b362020473e)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2023-01-19 15:18:15 -08:00
committed by Richard Purdie
parent a78842a19a
commit 02081ada4c

View File

@@ -1,35 +1,72 @@
From cc3e1abaa1e7ad85c6a299fe30a36e0cb732e1c8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 15 Dec 2022 14:51:20 -0800
Subject: [PATCH] compat: Define off64_t as off_t on linux
From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001
From: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Date: Tue, 17 Jan 2023 16:57:35 -0500
Subject: [PATCH] compat: off64_t is not defined by musl
This helps compile with latest musl, where off64_t is not defined
unless _LARGEFILE64_SOURCE is defined, on glibc _LARGEFILE64_SOURCE is
defined if _GNU_SOURCE is defined, so the problem is only seen with musl
This helps compile with latest musl, where off64_t is not defined unless
_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined
if _GNU_SOURCE is defined, so the problem is only seen with musl.
Upstream-Status: Submitted [https://github.com/lttng/lttng-tools/pull/164]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc:
"arrange for 64-bit file offsets, known as large-file support."
As such, it is safe to assume off_t is 64-bit wide. This is checked by a
static_assert to catch any platform where autoconf would let a 32-bit
off_t slip.
Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268]
Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8
---
src/common/compat/fcntl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 5e566e50..d19a6ece 100644
--- a/src/common/compat/compat-fcntl.c
+++ b/src/common/compat/compat-fcntl.c
@@ -13,7 +13,7 @@
#ifdef __linux__
LTTNG_HIDDEN
-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
unsigned int flags)
{
#ifdef HAVE_SYNC_FILE_RANGE
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -7,7 +7,6 @@
@@ -8,21 +8,21 @@
#ifndef _COMPAT_FCNTL_H
#define _COMPAT_FCNTL_H
-
+#include <assert.h>
#include <fcntl.h>
#include <sys/types.h>
@@ -22,6 +21,7 @@ typedef off64_t loff_t;
#include <common/compat/errno.h>
-#if (defined(__CYGWIN__))
-typedef long long off64_t;
-#endif
+static_assert(sizeof(off_t) == sizeof(int64_t),
+ "Build system is misconfigured, off_t must be 64-bit wide");
#if (defined(__FreeBSD__) || defined(__sun__))
typedef off64_t loff_t;
#endif
#ifdef __linux__
+typedef off_t off64_t;
extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
unsigned int flags);
#define lttng_sync_file_range(fd, offset, nbytes, flags) \
compat_sync_file_range(fd, offset, nbytes, flags)
@@ -37,8 +37,8 @@ extern int compat_sync_file_range(int fd
#define SYNC_FILE_RANGE_WAIT_BEFORE 0
#define SYNC_FILE_RANGE_WRITE 0
-static inline int lttng_sync_file_range(int fd, off64_t offset,
- off64_t nbytes, unsigned int flags)
+static inline int lttng_sync_file_range(int fd, off_t offset,
+ off_t nbytes, unsigned int flags)
{
return -ENOSYS;
}