summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch')
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
new file mode 100644
index 0000000000..4e21d1e9f1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
@@ -0,0 +1,74 @@
1From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001
2From: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3Date: Tue, 17 Jan 2023 16:57:35 -0500
4Subject: [PATCH] compat: off64_t is not defined by musl
5
6This helps compile with latest musl, where off64_t is not defined unless
7_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined
8if _GNU_SOURCE is defined, so the problem is only seen with musl.
9
10Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc:
11"arrange for 64-bit file offsets, known as large-file support."
12
13As such, it is safe to assume off_t is 64-bit wide. This is checked by a
14static_assert to catch any platform where autoconf would let a 32-bit
15off_t slip.
16
17Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268]
18Reported-by: Khem Raj <raj.khem@gmail.com>
19Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
20Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8
21---
22
23--- a/src/common/compat/compat-fcntl.c
24+++ b/src/common/compat/compat-fcntl.c
25@@ -8,14 +8,17 @@
26 #define _LGPL_SOURCE
27 #include <common/compat/fcntl.h>
28 #include <common/macros.h>
29+#include <common/bug.h>
30+#include <stdint.h>
31 #include <unistd.h>
32
33 #ifdef __linux__
34
35 LTTNG_HIDDEN
36-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
37+int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
38 unsigned int flags)
39 {
40+ LTTNG_BUILD_BUG_ON(sizeof(off_t) != sizeof(int64_t));
41 #ifdef HAVE_SYNC_FILE_RANGE
42 return sync_file_range(fd, offset, nbytes, flags);
43 #else
44--- a/src/common/compat/fcntl.h
45+++ b/src/common/compat/fcntl.h
46@@ -13,16 +13,12 @@
47
48 #include <common/compat/errno.h>
49
50-#if (defined(__CYGWIN__))
51-typedef long long off64_t;
52-#endif
53-
54 #if (defined(__FreeBSD__) || defined(__sun__))
55 typedef off64_t loff_t;
56 #endif
57
58 #ifdef __linux__
59-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
60+extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
61 unsigned int flags);
62 #define lttng_sync_file_range(fd, offset, nbytes, flags) \
63 compat_sync_file_range(fd, offset, nbytes, flags)
64@@ -37,8 +33,8 @@ extern int compat_sync_file_range(int fd
65 #define SYNC_FILE_RANGE_WAIT_BEFORE 0
66 #define SYNC_FILE_RANGE_WRITE 0
67
68-static inline int lttng_sync_file_range(int fd, off64_t offset,
69- off64_t nbytes, unsigned int flags)
70+static inline int lttng_sync_file_range(int fd, off_t offset,
71+ off_t nbytes, unsigned int flags)
72 {
73 return -ENOSYS;
74 }