diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-02-13 00:21:57 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-02-14 13:07:23 +0000 |
commit | 53b0b651374ca78d95bf9474e5fa05270421460d (patch) | |
tree | 51737b9d27a3e1c1712fc310227340eb0011d1b6 /meta/recipes-extended | |
parent | 21d97d00d59c0fabdbb44f6a39c0f9bbcd167888 (diff) | |
download | poky-53b0b651374ca78d95bf9474e5fa05270421460d.tar.gz |
ltp: Fix tescases with 64bit time_t using 32bit arches
This helps it compile on musl
Fixes
| tst_clocks.c:31:17: error: 'SYS_clock_getres' undeclared (first use in this function); did you mean 'tst_clock_getres
(From OE-Core rev: 8b6c22a0dc61579d112161fd49da855a678cc58b)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch | 81 | ||||
-rw-r--r-- | meta/recipes-extended/ltp/ltp_20190930.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch new file mode 100644 index 0000000000..92e5fdfe6e --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch | |||
@@ -0,0 +1,81 @@ | |||
1 | From 09e631419d9763a4ff08b32d9801c12b475d8ec5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 12 Feb 2020 22:22:17 -0800 | ||
4 | Subject: [PATCH] syscalls: Check for time64 unsafe syscalls before using them | ||
5 | |||
6 | musl is using 64bit time_t now on 32bit architectures and these syscalls | ||
7 | no longer exist, therefore its better to check for them being available | ||
8 | before using them | ||
9 | |||
10 | Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2020-February/015400.html] | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | lib/tst_clocks.c | 9 +++++++++ | ||
14 | testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 4 ++++ | ||
15 | testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 4 ++++ | ||
16 | 3 files changed, 17 insertions(+) | ||
17 | |||
18 | diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c | ||
19 | index 35798a4aaf..6a5b05c4ea 100644 | ||
20 | --- a/lib/tst_clocks.c | ||
21 | +++ b/lib/tst_clocks.c | ||
22 | @@ -28,15 +28,24 @@ | ||
23 | |||
24 | int tst_clock_getres(clockid_t clk_id, struct timespec *res) | ||
25 | { | ||
26 | +#if defined(__NR_clock_getres) | ||
27 | return syscall(SYS_clock_getres, clk_id, res); | ||
28 | +#endif | ||
29 | + return -1; | ||
30 | } | ||
31 | |||
32 | int tst_clock_gettime(clockid_t clk_id, struct timespec *ts) | ||
33 | { | ||
34 | +#if defined(__NR_clock_gettime) | ||
35 | return syscall(SYS_clock_gettime, clk_id, ts); | ||
36 | +#endif | ||
37 | + return -1; | ||
38 | } | ||
39 | |||
40 | int tst_clock_settime(clockid_t clk_id, struct timespec *ts) | ||
41 | { | ||
42 | +#if defined(__NR_clock_settime) | ||
43 | return syscall(SYS_clock_settime, clk_id, ts); | ||
44 | +#endif | ||
45 | + return -1; | ||
46 | } | ||
47 | diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | ||
48 | index 583d8f7b9b..b498de5b68 100644 | ||
49 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | ||
50 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | ||
51 | @@ -41,7 +41,11 @@ | ||
52 | #include <sys/syscall.h> | ||
53 | #include <unistd.h> | ||
54 | |||
55 | +#ifdef __NR_gettimeofday | ||
56 | #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) | ||
57 | +#else | ||
58 | +#define gettimeofday(a,b) (-1) | ||
59 | +#endif | ||
60 | |||
61 | char *TCID = "gettimeofday01"; | ||
62 | int TST_TOTAL = 1; | ||
63 | diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | ||
64 | index 1d60f448e8..218e017df8 100644 | ||
65 | --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | ||
66 | +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | ||
67 | @@ -23,7 +23,11 @@ | ||
68 | |||
69 | #include "tst_test.h" | ||
70 | |||
71 | +#ifdef __NR_gettimeofday | ||
72 | #define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b) | ||
73 | +#else | ||
74 | +#define gettimeofday(a,b) (-1) | ||
75 | +#endif | ||
76 | |||
77 | static volatile sig_atomic_t done; | ||
78 | static char *str_rtime; | ||
79 | -- | ||
80 | 2.25.0 | ||
81 | |||
diff --git a/meta/recipes-extended/ltp/ltp_20190930.bb b/meta/recipes-extended/ltp/ltp_20190930.bb index 2853b1c819..19bd7bc9c6 100644 --- a/meta/recipes-extended/ltp/ltp_20190930.bb +++ b/meta/recipes-extended/ltp/ltp_20190930.bb | |||
@@ -42,6 +42,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ | |||
42 | file://0001-testcases-fix-an-absent-format-string-issue.patch \ | 42 | file://0001-testcases-fix-an-absent-format-string-issue.patch \ |
43 | file://0001-Add-more-musl-exclusions.patch \ | 43 | file://0001-Add-more-musl-exclusions.patch \ |
44 | file://0001-nm01-Remove-prefix-zeros-of-the-addresses-output-by-.patch \ | 44 | file://0001-nm01-Remove-prefix-zeros-of-the-addresses-output-by-.patch \ |
45 | file://0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch \ | ||
45 | " | 46 | " |
46 | 47 | ||
47 | S = "${WORKDIR}/git" | 48 | S = "${WORKDIR}/git" |