All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 9/9] ltp: Fix tescases with 64bit time_t using 32bit arches
Date: Wed, 12 Feb 2020 22:38:23 -0800	[thread overview]
Message-ID: <02efd07db0d224016689a0a43321742e406079ef.1581575578.git.raj.khem@gmail.com> (raw)
In-Reply-To: <cover.1581575578.git.raj.khem@gmail.com>

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...or-time64-unsafe-syscalls-before-usi.patch | 81 +++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20190930.bb     |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch

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 @@
+From 09e631419d9763a4ff08b32d9801c12b475d8ec5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 12 Feb 2020 22:22:17 -0800
+Subject: [PATCH] syscalls: Check for time64 unsafe syscalls before using them
+
+musl is using 64bit time_t now on 32bit architectures and these syscalls
+no longer exist, therefore its better to check for them being available
+before using them
+
+Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2020-February/015400.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/tst_clocks.c                                        | 9 +++++++++
+ testcases/kernel/syscalls/gettimeofday/gettimeofday01.c | 4 ++++
+ testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 4 ++++
+ 3 files changed, 17 insertions(+)
+
+diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c
+index 35798a4aaf..6a5b05c4ea 100644
+--- a/lib/tst_clocks.c
++++ b/lib/tst_clocks.c
+@@ -28,15 +28,24 @@
+ 
+ int tst_clock_getres(clockid_t clk_id, struct timespec *res)
+ {
++#if defined(__NR_clock_getres)
+ 	return syscall(SYS_clock_getres, clk_id, res);
++#endif
++	return -1;
+ }
+ 
+ int tst_clock_gettime(clockid_t clk_id, struct timespec *ts)
+ {
++#if defined(__NR_clock_gettime)
+ 	return syscall(SYS_clock_gettime, clk_id, ts);
++#endif
++	return -1;
+ }
+ 
+ int tst_clock_settime(clockid_t clk_id, struct timespec *ts)
+ {
++#if defined(__NR_clock_settime)
+ 	return syscall(SYS_clock_settime, clk_id, ts);
++#endif
++	return -1;
+ }
+diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
+index 583d8f7b9b..b498de5b68 100644
+--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
++++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
+@@ -41,7 +41,11 @@
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ 
++#ifdef __NR_gettimeofday
+ #define gettimeofday(a,b)  syscall(__NR_gettimeofday,a,b)
++#else
++#define gettimeofday(a,b) (-1)
++#endif
+ 
+ char *TCID = "gettimeofday01";
+ int TST_TOTAL = 1;
+diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
+index 1d60f448e8..218e017df8 100644
+--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
++++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
+@@ -23,7 +23,11 @@
+ 
+ #include "tst_test.h"
+ 
++#ifdef __NR_gettimeofday
+ #define gettimeofday(a,b)  syscall(__NR_gettimeofday,a,b)
++#else
++#define gettimeofday(a,b) (-1)
++#endif
+ 
+ static volatile sig_atomic_t done;
+ static char *str_rtime;
+-- 
+2.25.0
+
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 \
            file://0001-testcases-fix-an-absent-format-string-issue.patch \
            file://0001-Add-more-musl-exclusions.patch \
            file://0001-nm01-Remove-prefix-zeros-of-the-addresses-output-by-.patch \
+           file://0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch \
            "
 
 S = "${WORKDIR}/git"
-- 
2.25.0



  parent reply	other threads:[~2020-02-13  6:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  6:38 [PATCH 0/9] recipe updates, testing fixes Khem Raj
2020-02-13  6:38 ` [PATCH 1/9] qemuarm: Disable highmem when QB_MACHINE is virt Khem Raj
2020-02-13  6:38 ` [PATCH 2/9] oeqa: Use --disable-maintainer-mode configure option Khem Raj
2020-02-13  6:38 ` [PATCH 3/9] libsolv: Enable rpm packageconfig by default only if rpm O_P_M is enabled Khem Raj
2020-02-13  6:38 ` [PATCH 4/9] dnf, libdnf: Ignore if PACKAGE_CLASSES does not have rpm Khem Raj
2020-02-13  6:38 ` [PATCH 5/9] musl: Update to latest tip Khem Raj
2020-02-13  6:38 ` [PATCH 6/9] gdb: Upgrade to 9.1 release Khem Raj
2020-02-13 23:38   ` Richard Purdie
2020-02-14  1:33     ` Khem Raj
2020-02-13  6:38 ` [PATCH 7/9] busybox: Backport patches to support removal of __NR_clock_gettime Khem Raj
2020-02-13  6:38 ` [PATCH 8/9] binutils: Bail out if gold is used on 32/64 bit RISC-V Khem Raj
2020-02-13  7:31   ` Adrian Bunk
2020-02-13 16:08     ` Khem Raj
2020-02-13  6:38 ` Khem Raj [this message]
2020-02-13  8:21 ` [PATCH 0/9] recipe updates, testing fixes Alexander Kanavin
2020-02-13 16:07   ` Khem Raj
2020-02-13 16:19     ` Alexander Kanavin
2020-02-13 16:44       ` Khem Raj
2020-02-13 16:53         ` Alexander Kanavin
2020-02-13 21:37           ` Khem Raj
2020-02-13 22:05             ` Alexander Kanavin
2020-02-14  1:39               ` Khem Raj
2020-02-14  7:05                 ` Alexander Kanavin
2020-02-14  7:14                   ` Khem Raj
2020-02-14 12:19                     ` Alexander Kanavin
2020-02-14 19:21                       ` Alexander Kanavin
2020-02-14 19:42                         ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02efd07db0d224016689a0a43321742e406079ef.1581575578.git.raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.