All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 4/6] syscalls: settimeofday: Use gettimeofday()
Date: Fri, 22 May 2020 12:24:10 +0530	[thread overview]
Message-ID: <40fd549b487a705afa1f50f833488c185011df1f.1590130423.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1590130423.git.viresh.kumar@linaro.org>

Passing struct timeval to __NR_gettimeofday syscall is incompatible and
may cause issues as it must only be used with the libc gettimeofday()
syscall. Use gettimeofday() instead of calling it with tst_syscall() to
fix that.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 testcases/kernel/syscalls/settimeofday/settimeofday01.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/settimeofday/settimeofday01.c b/testcases/kernel/syscalls/settimeofday/settimeofday01.c
index 7ce3dc5a47b3..b7f84b00fdc8 100644
--- a/testcases/kernel/syscalls/settimeofday/settimeofday01.c
+++ b/testcases/kernel/syscalls/settimeofday/settimeofday01.c
@@ -21,7 +21,7 @@ static void verify_settimeofday(void)
 	suseconds_t delta;
 	struct timeval tv1, tv2;
 
-	if (tst_syscall(__NR_gettimeofday, &tv1, NULL) == -1)
+	if (gettimeofday(&tv1, NULL) == -1)
 		tst_brk(TBROK | TERRNO, "gettimeofday(&tv1, NULL) failed");
 
 	tv1.tv_sec += VAL_SEC;
@@ -35,7 +35,7 @@ static void verify_settimeofday(void)
 		return;
 	}
 
-	if (tst_syscall(__NR_gettimeofday, &tv2, NULL) == -1)
+	if (gettimeofday(&tv2, NULL) == -1)
 		tst_brk(TBROK | TERRNO, "gettimeofday(&tv2, NULL) failed");
 
 	if (tv2.tv_sec > tv1.tv_sec) {
-- 
2.25.0.rc1.19.g042ed3e048af


  parent reply	other threads:[~2020-05-22  6:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  6:54 [LTP] [PATCH V2 0/6] syscalls: Remove incorrect usage of libc structures Viresh Kumar
2020-05-22  6:54 ` [LTP] [PATCH V2 1/6] tst_safe_clocks: Remove safe_clock_adjtime() Viresh Kumar
2020-05-22  6:54 ` [LTP] [PATCH V2 2/6] syscalls: settimeofday01: Set .restore_wallclock flag Viresh Kumar
2020-05-22  6:54 ` [LTP] [PATCH V2 3/6] syscalls: settimeofday02: Remove time restoration code Viresh Kumar
2020-05-22  6:54 ` Viresh Kumar [this message]
2020-06-17 12:17   ` [LTP] [PATCH V2 4/6] syscalls: settimeofday: Use gettimeofday() Cyril Hrubis
2020-05-22  6:54 ` [LTP] [PATCH V2 5/6] syscalls: Don't pass struct timespec to tst_syscall() Viresh Kumar
2020-05-22  8:02   ` Arnd Bergmann
2020-05-22  8:42     ` Viresh Kumar
2020-05-22  8:58       ` Cyril Hrubis
2020-06-17 12:22       ` Cyril Hrubis
2020-05-27  9:43   ` [LTP] [PATCH V3 " Viresh Kumar
2020-05-27  9:49     ` Arnd Bergmann
2020-06-17 12:30     ` Cyril Hrubis
2020-06-18  5:25     ` [LTP] [PATCH V4 " Viresh Kumar
2020-06-18 11:06       ` Cyril Hrubis
2020-07-03  9:55       ` Li Wang
2020-07-03 12:26         ` Harish
2020-07-03 12:59         ` Cyril Hrubis
2020-07-04  7:14           ` Li Wang
2020-07-06  8:44             ` Harish
2020-07-06  8:57               ` Li Wang
2020-07-06  9:21                 ` Harish
2020-07-07  9:03             ` Cyril Hrubis
2020-07-07  9:18               ` Viresh Kumar
2020-07-07 11:49                 ` Cyril Hrubis
2020-07-08  2:34                   ` Viresh Kumar
2020-07-06  2:21           ` Viresh Kumar
2020-05-22  6:54 ` [LTP] [PATCH V2 6/6] syscalls: Don't pass struct timeval " Viresh Kumar
2020-06-17 14:08   ` Cyril Hrubis

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=40fd549b487a705afa1f50f833488c185011df1f.1590130423.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=ltp@lists.linux.it \
    /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.