1 From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001
2 From: Laurent Vivier <laurent@vivier.eu>
3 Date: Tue, 12 Nov 2019 15:25:56 +0100
4 Subject: [PATCH] linux-user: remove host stime() syscall
6 stime() has been withdrawn from glibc
7 (12cbde1dae6f "Use clock_settime to implement stime; withdraw stime.")
9 Implement the target stime() syscall using host
10 clock_settime(CLOCK_REALTIME, ...) as it is done internally in glibc.
12 Tested qemu-ppc/x86_64 with:
22 /* date -u -d"2019-11-12T15:11:00" "+%s" */
25 printf("ret %d\n", ret);
30 Tue Nov 12 14:18:32 UTC 2019
32 Tue Nov 12 15:11:00 UTC 2019
34 Buglink: https://bugs.launchpad.net/qemu/+bug/1852115
35 Reported-by: Cole Robinson <crobinso@redhat.com>
36 Signed-off-by: Laurent Vivier <laurent@vivier.eu>
37 Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
38 Message-Id: <20191112142556.6335-1-laurent@vivier.eu>
40 linux-user/syscall.c | 8 +++++---
41 1 file changed, 5 insertions(+), 3 deletions(-)
43 diff --git a/linux-user/syscall.c b/linux-user/syscall.c
44 index 4e97bcf..ce399a5 100644
45 --- a/linux-user/syscall.c
46 +++ b/linux-user/syscall.c
47 @@ -7764,10 +7764,12 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
48 #ifdef TARGET_NR_stime /* not on alpha */
52 - if (get_user_sal(host_time, arg1))
55 + if (get_user_sal(ts.tv_sec, arg1)) {
56 return -TARGET_EFAULT;
57 - return get_errno(stime(&host_time));
59 + return get_errno(clock_settime(CLOCK_REALTIME, &ts));
62 #ifdef TARGET_NR_alarm /* not on alpha */