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