From patchwork Fri Jan 18 21:31:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156061 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3734242jaa; Fri, 18 Jan 2019 13:41:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN4K0wPqQoU6abgwTSO3J7outV4Xl09lh6L9iDhtGqinSYlrqsbA3A9ugycQRDmJgemAw93H X-Received: by 2002:adf:e911:: with SMTP id f17mr19337233wrm.126.1547847693623; Fri, 18 Jan 2019 13:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547847693; cv=none; d=google.com; s=arc-20160816; b=iWHg4CJ+aSqAAe0NLi2BNalVNEGDSCzI/9xyyddjqTP8Tct6YaJ2Hwp1qInYLbeDmf IbjjYyICQASiHvCgCQ8NorB9ZVxj7vHqr5Pi9j5vg+hi9dcl1+QtbN4exhNWjI+Q9r/5 qwK0dGBIu1Ul929l+djtWki02rWwyx9S3wwsBl9mWq2VpJbYdnCPqVyVIki6TaJfde7Q vxcoPLspazofmTzYSpw+MXDG+5gxPWsac8GqXFAGlQ0esITEyxP5JE8jmgDQVgSZwcdU A0vQKLUYbqDZtEyGNlHFsvFnZwCeZbskAOaY9cFQaxSOS3WQu15shNdJSssv7yM2MUyi ro4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=N4AEijcfhSLtaoaWm0ch5ZKqRV8AkG+w+zrqUah4AVM=; b=W2SimNnroeKzdj7tyc+R2lvczE7O/o2+ZzcvycvEcxA6GQSZHxjXbw0R062DX864a/ 6s1T1+EWtk5cn7sYBDshpWcwBa+wrVDvDtSOIPp3jgMMax8Tm05i6toJrr7+KR1YJjqG jQDdaTskDBwm1ytAf7vQwJ6wt1I3yn84xM6Q+ubHYkHN1JTH3FrVFrEqiFylzd/VXxCw UrwnsLNgrwJ+nO6uDZH+Mq+beRChg0dadjadSnV8W1XsmQCJ/le3/h5bEKSUqnFpypeq KiuGMPWXWkcrvYjYKwnwG4+YVeQBlLTysRhXpucj6lINfXbaWo33BGmJ+sXeJsNS8II3 72XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="AZ/t2HYf"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k13si57226286wrn.425.2019.01.18.13.41.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 13:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="AZ/t2HYf"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:47526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkbtM-0004F0-IB for patch@linaro.org; Fri, 18 Jan 2019 16:41:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkbkf-0005Ni-Sd for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkbke-0004v5-IN for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:33 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:41193) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkbke-0004tQ-Bd for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:32 -0500 Received: by mail-pf1-x444.google.com with SMTP id b7so7192468pfi.8 for ; Fri, 18 Jan 2019 13:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N4AEijcfhSLtaoaWm0ch5ZKqRV8AkG+w+zrqUah4AVM=; b=AZ/t2HYfbMEAscbm9eF9lL7HFTboFB8Knwj0Lw+6oTlElkkg5/j8AqLjhX6CkNTc5L 8v+jmyWu2JSuXyQ/kPN8STB5sBzIzRd2Lrdj7hJRwbk/6zWSHKVKVmU4WBDAHHc0kYPe FtMTw2EyyuRlIiXMnBn5nBlKRX4pAjhrf+gxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N4AEijcfhSLtaoaWm0ch5ZKqRV8AkG+w+zrqUah4AVM=; b=TzNsrjGgloJ4Rmed/YifZrccASR+4yPKSAdskCNVMOZRxa5tQeW2HSXCZrk96bpMRS /YagJhfJxYidIxEVumTebSwxmQ/RBBmmJJkdElrkdEJJxCn4bAYEyvjx9R1fhSM2JeZt +DQ1K7A4rVzRNSpFWPImoyf2X9x9hYqjVVJXjDBAMddigI5GNW8nKR0KYjtm/IhcT1R2 JA00T72smP/rGZkMjwX/3PyXTgVuga/tEUSi0nz8/UBH1kHZts861erTMTkVon+93LtG l07l5HOo/42fwXcL7/wPSik32ggdNiBw5fXJfX6zHMc6sQ8j7x84nF7/pnenOdd/IXnY bc+g== X-Gm-Message-State: AJcUukec98WKVmjKk67FSO4Irsa1jHMLrGQWSzbfmErFay8qOv60Fbrh CXzH8a70wE6Lz+zp49Cs/p3IxxI32iw= X-Received: by 2002:a63:5b48:: with SMTP id l8mr19413851pgm.80.1547847151052; Fri, 18 Jan 2019 13:32:31 -0800 (PST) Received: from cloudburst.twiddle.net ([2001:8000:10e0:a000:c673:a6b6:fdef:1933]) by smtp.gmail.com with ESMTPSA id v12sm5833667pgg.41.2019.01.18.13.32.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:32:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 19 Jan 2019 08:31:00 +1100 Message-Id: <20190118213122.22865-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190118213122.22865-1-richard.henderson@linaro.org> References: <20190118213122.22865-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v6 27/49] linux-user: Split out time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 3 +++ linux-user/syscall-time.inc.c | 32 ++++++++++++++++++++++++++++++++ linux-user/syscall.c | 13 +------------ linux-user/strace.list | 3 --- 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 linux-user/syscall-time.inc.c -- 2.17.2 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 3fad9d51f0..9950b73e76 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -127,6 +127,9 @@ SYSCALL_DEF(shmdt, ARG_PTR); #if !defined(SYSCALL_TABLE) || defined(TARGET_NR_shmget) SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX); #endif +#ifdef TARGET_NR_time +SYSCALL_DEF(time, ARG_PTR); +#endif #ifdef TARGET_NR_unlink SYSCALL_DEF(unlink, ARG_STR); #endif diff --git a/linux-user/syscall-time.inc.c b/linux-user/syscall-time.inc.c new file mode 100644 index 0000000000..14fec88e47 --- /dev/null +++ b/linux-user/syscall-time.inc.c @@ -0,0 +1,32 @@ +/* + * Linux time related syscalls + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifdef TARGET_NR_time +SYSCALL_IMPL(time) +{ + time_t host_time; + abi_long ret = get_errno(time(&host_time)); + + if (!is_error(ret) + && arg1 + && put_user_sal(host_time, arg1)) { + return -TARGET_EFAULT; + } + return ret; +} +#endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1cdc9727a9..cc5360ae43 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5331,18 +5331,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_time - case TARGET_NR_time: - { - time_t host_time; - ret = get_errno(time(&host_time)); - if (!is_error(ret) - && arg1 - && put_user_sal(host_time, arg1)) - return -TARGET_EFAULT; - } - return ret; -#endif #ifdef TARGET_NR_mknod case TARGET_NR_mknod: if (!(p = lock_user_string(arg1))) @@ -9303,6 +9291,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #include "syscall-ipc.inc.c" #include "syscall-mem.inc.c" #include "syscall-proc.inc.c" +#include "syscall-time.inc.c" #undef SYSCALL_IMPL #undef SYSCALL_ARGS diff --git a/linux-user/strace.list b/linux-user/strace.list index 357984dd6f..3505014501 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1350,9 +1350,6 @@ #ifdef TARGET_NR_tgkill { TARGET_NR_tgkill, "tgkill" , NULL, print_tgkill, NULL }, #endif -#ifdef TARGET_NR_time -{ TARGET_NR_time, "time" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_timer_create { TARGET_NR_timer_create, "timer_create" , NULL, NULL, NULL }, #endif