From patchwork Tue Nov 12 14:25:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1193565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47C96W2hRrz9sPK for ; Wed, 13 Nov 2019 01:26:43 +1100 (AEDT) Received: from localhost ([::1]:35588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUX7x-00050m-7v for incoming@patchwork.ozlabs.org; Tue, 12 Nov 2019 09:26:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56780) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUX7a-0004ya-NQ for qemu-devel@nongnu.org; Tue, 12 Nov 2019 09:26:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUX7Z-0005rX-JX for qemu-devel@nongnu.org; Tue, 12 Nov 2019 09:26:18 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:60485) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUX7Z-0005qn-Am for qemu-devel@nongnu.org; Tue, 12 Nov 2019 09:26:17 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MF3U0-1ifamv0DfM-00FU05; Tue, 12 Nov 2019 15:26:01 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PATCH] linux-user: remove host stime() syscall Date: Tue, 12 Nov 2019 15:25:56 +0100 Message-Id: <20191112142556.6335-1-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:lMLzvhVRBqGcDpm64aMbuyq5VZyhb5rLM7ZHuxL8H4MsqHQVP6/ 9lQORUGrb6RztknEFHoyPnqmW941UiRdRphuJQXA8xHGPWVHnuIjl9IYRI8Sy82KAQ6PsXK IO0PP89uZ+b3KUmJglmi6FAyUtldY8ntBrclmyz2pGIuscitPdlppCY4W5RkKB1ylpbiT6n 6FSJmRs40lLWYRyUtCBlw== X-UI-Out-Filterresults: notjunk:1; V03:K0:ckg1wGnTGRY=:zYnsRXjaG/zhSd3Xg6l4jX Elv4y1i1C5jhVJW4724xjnMslpRhYYEsJcKs+uUOa9jUo3AdODVW3BH9LWOlWUQ1QujnJwoNy ia/CB0QQ78ScRjrA3GxkuLrCkS1mLvA1LHjKR2GicI6GyM25JBb90TUIDcmI1tdSCI7fwLS82 lrdI7kne1t+gB4m9pl8phFzQkQ8eN8AnphdhbK14DCp2kW+cZAdqUGJKWN8EQNxi3K9bVM6sk svy5RKNdqd9VZN3i+TZc1VTuQcd7Ih3l9FBIwKdrEZxSKyDYb5ar3poT2khnN+uWlWncOS+KJ YAqL5sO3TcLHmZqsYoGkoOwL5cQEHYkqoh630RA8Rm6mzG8EJgC7WuFh+g8/qdtrUTrx/mzYU 52e+DKVN+vaZYSpXm2emta0VCdzSIEbO7ltZCtjYEXX5zAnwCQHFM4INkMFHtg+rgcJOPN/zo l93H9+Dv8HMymImVGRw/Wf+e0ierjkX8pAg9B147Pe1hB9It/yAgAxL4iMYU26Nj1GM1sElU6 YMNBmrUjG6n0sX4iskp3oNX2LWnH8DqzV6lRPGN7qcrHDQvTzropDcORXlmZs0PbfCP5KRon1 j3O1qeg/epAVDbiZraAbng4wtR2tMSZbrSyYtPI38ZZZ6jGS0E9vBEtQmkOl9J7SEgpUlEDe0 STS9uCaPpsIVR4lAp10V4K173kCJPWJkUFWTVVwESlpkLa67texGL/J2fnUH/2iM+DLVwkw5m 0i3G6am7vEuGMlR/WVI4qZg9oG+OT5+Hhkw0fGKSzEJZO0aFaE+IXV7c4JkQ4aSlpx3iQaWR4 TLwlVk4aMjprapsyTZFbhTns33B7KLK5HHx2mXhHzZCe+cFMghQH1PYcbmRixUykSZrR1Os+v /cwdelEv2fx1QReL49ew== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P . Berrange" , Peter Maydell , Riku Voipio , Laurent Vivier , Cole Robinson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" stime() has been withdrawn from glibc (12cbde1dae6f "Use clock_settime to implement stime; withdraw stime.") Implement the target stime() syscall using host clock_settime(CLOCK_REALTIME, ...) as it is done internally in glibc. Tested qemu-ppc/x86_64 with: #include #include int main(void) { time_t t; int ret; /* date -u -d"2019-11-12T15:11:00" "+%s" */ t = 1573571460; ret = stime(&t); printf("ret %d\n", ret); return 0; } # date; ./stime; date Tue Nov 12 14:18:32 UTC 2019 ret 0 Tue Nov 12 15:11:00 UTC 2019 Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 Reported-by: Cole Robinson Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell --- linux-user/syscall.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ab9d933e53af..c4dcdc94b10c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7763,10 +7763,12 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_stime /* not on alpha */ case TARGET_NR_stime: { - time_t host_time; - if (get_user_sal(host_time, arg1)) + struct timespec ts; + ts.tv_nsec = 0; + if (get_user_sal(ts.tv_sec, arg1)) { return -TARGET_EFAULT; - return get_errno(stime(&host_time)); + } + return get_errno(clock_settime(CLOCK_REALTIME, &ts)); } #endif #ifdef TARGET_NR_alarm /* not on alpha */