From patchwork Sun May 19 20:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10949687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BB74924 for ; Sun, 19 May 2019 21:07:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CA4C285B8 for ; Sun, 19 May 2019 21:07:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80C0C285C3; Sun, 19 May 2019 21:07:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BEED285B8 for ; Sun, 19 May 2019 21:07:22 +0000 (UTC) Received: from localhost ([127.0.0.1]:53540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hST1e-0003HP-71 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 19 May 2019 17:07:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZg-0003gT-QI for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZe-0004Sg-P8 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:28 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZe-0004R4-HU for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:26 -0400 Received: by mail-pl1-x641.google.com with SMTP id f12so5707249plt.8 for ; Sun, 19 May 2019 13:38:26 -0700 (PDT) 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=hCKl3WsFFB8I9SyuErlgjzDySDbodc+1SphzTaA0mp0=; b=IBCN5yrde7jbvLtsr8VkhNSO50Hr38sFL8xFDuu0FVnf2s6cIEXyIBnmK9UlbEud3L iUjQ/MuneVRfAdmbcV+9WDNHoDuZTH9QWqJYqPygkULjpzD2R9oSpnzFlJVgyYgD1/rh veE9EY5y/IopR81L8oPkbPRjK62wHs4fe1K0O0N8CgVZZHkYohMHm6nAPtdlPJE0EtA8 ZgTI4NzJ5jo5nAF2Xa6c5X4dXc9SXdIqPJM+9UOrKSyEADTXLS6hsdxT/LVr9wj+uifZ H4mqwUU3zme7MaRpHWEC+R/tu8FMfmxrKT+1xtkqO7L0vzlqEAejHPlrC97u7b1ErZow EiIQ== 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=hCKl3WsFFB8I9SyuErlgjzDySDbodc+1SphzTaA0mp0=; b=BG0W6Ru4eLaU8o89lw4KryrvcejqfmrNjPhugdovEzz8v1SVCq40vldiE+ulWRCE1V lDtK6Z6bki6/YQWq9FX4uQtMrgw/3jhxso4uhUyxH7Fog1gxWfYq7OnP5BMVvZUF9saY quGgHzNJk0k3ySKybtsmLIoSJN0Yp9H6TDnWKMjdLO4VA0LAXiMfFVm0zj/Aa2bU8GCS jhgqPJ6YwerD66qrVHZUbqbVsUKBZwa9Nkyg1ZDUJfxiSbkJjSZ1v3junx+jnsW9HIec dUdPykjDWhiwJW9YZfwdhjF0ABxV03eoca4uqWXWqtb3SuhIGwQ36D6gcsagI77ktXPS QeNQ== X-Gm-Message-State: APjAAAV9PwbNWiSFKzFdB5/bt6HUH196KUKDDe8BoQfWkha1kES2Avj1 gHWa+jb6qPo278Oq6EReWjfD8aAlXoE= X-Google-Smtp-Source: APXvYqxWa7yZt46HyYmaxImDDO8wG2CYq5FLocecukC1T6SC0jg2SGJmJVTGFywFYU41qfOgcN5o4g== X-Received: by 2002:a17:902:6bc8:: with SMTP id m8mr70316262plt.227.1558298305264; Sun, 19 May 2019 13:38:25 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:36:56 -0700 Message-Id: <20190519203726.20729-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-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::641 Subject: [Qemu-devel] [PATCH v7 44/74] linux-user: Split out times 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 3 --- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index bd3301a72f..25d5aaccd1 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -204,6 +204,7 @@ SYSCALL_DEF(syncfs, ARG_DEC); #ifdef TARGET_NR_time SYSCALL_DEF(time, ARG_PTR); #endif +SYSCALL_DEF(times, ARG_PTR); #ifdef TARGET_NR_umount SYSCALL_DEF(umount, ARG_STR); #endif diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c index e29c2ede25..517f84e139 100644 --- a/linux-user/syscall-proc.inc.c +++ b/linux-user/syscall-proc.inc.c @@ -468,6 +468,31 @@ SYSCALL_IMPL(nice) } #endif +SYSCALL_IMPL(times) +{ + abi_ulong target_buf = arg1; + struct tms tms; + abi_long ret; + + ret = get_errno(times(&tms)); + if (target_buf) { + struct target_tms *tmsp = lock_user(VERIFY_WRITE, target_buf, + sizeof(struct target_tms), 0); + if (!tmsp) { + return -TARGET_EFAULT; + } + tmsp->tms_utime = tswapal(host_to_target_clock_t(tms.tms_utime)); + tmsp->tms_stime = tswapal(host_to_target_clock_t(tms.tms_stime)); + tmsp->tms_cutime = tswapal(host_to_target_clock_t(tms.tms_cutime)); + tmsp->tms_cstime = tswapal(host_to_target_clock_t(tms.tms_cstime)); + unlock_user(tmsp, target_buf, sizeof(struct target_tms)); + } + if (!is_error(ret)) { + ret = host_to_target_clock_t(ret); + } + return ret; +} + /* * Map host to target signal numbers for the wait family of syscalls. * Assume all other status bits are the same. diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cda1f8a205..cdca0dbe4f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5346,24 +5346,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_times: - { - struct target_tms *tmsp; - struct tms tms; - ret = get_errno(times(&tms)); - if (arg1) { - tmsp = lock_user(VERIFY_WRITE, arg1, sizeof(struct target_tms), 0); - if (!tmsp) - return -TARGET_EFAULT; - tmsp->tms_utime = tswapal(host_to_target_clock_t(tms.tms_utime)); - tmsp->tms_stime = tswapal(host_to_target_clock_t(tms.tms_stime)); - tmsp->tms_cutime = tswapal(host_to_target_clock_t(tms.tms_cutime)); - tmsp->tms_cstime = tswapal(host_to_target_clock_t(tms.tms_cstime)); - } - if (!is_error(ret)) - ret = host_to_target_clock_t(ret); - } - return ret; case TARGET_NR_acct: if (arg1 == 0) { ret = get_errno(acct(NULL)); diff --git a/linux-user/strace.list b/linux-user/strace.list index a1c3dd98e0..85e3de87d8 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1290,9 +1290,6 @@ #ifdef TARGET_NR_timerfd_settime { TARGET_NR_timerfd_settime, "timerfd_settime" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_times -{ TARGET_NR_times, "times" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_tkill { TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL }, #endif