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: 164529 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4798743ili; Sun, 19 May 2019 14:08:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbC4Ih20FtB425nkqblvYNZ8uyXsF5WCaBgK1bkDrrToDKnwCqdCzD1VjqirCaHxWhKk1+ X-Received: by 2002:a50:ce06:: with SMTP id y6mr71621606edi.160.1558300126344; Sun, 19 May 2019 14:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558300126; cv=none; d=google.com; s=arc-20160816; b=vFqURfYWMEKDMq3CUu7Cl3NOb1zr+c/QSXg5RfKsE/cO0NZdCYu09LGpk0zRiKGK9U NQaZHBjhl8yp10GU7dChyfp2ByrxPo5MHGO/uyKrh4pJXUfiLG51Zi66zjQaN1eIB+CK ziaVPMfxeXs2u4m1fYaMcg0dCPk+qVZJIJedfJapdb/J3dz4bI0nk169dmK8GROLCkIb KuKxzFM3286duEJCBFOAjsRbSApuB4S0pWioyCA0EHIX5LZp/moTePeVSZ/iZ1OHMmgJ X4Gdz3mZce0BFFzVV+aF14QiyoX45P9aAU+bcY8BSLJgCRA0y1V9IRAJpveWIarKzVcf kZgg== 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=hCKl3WsFFB8I9SyuErlgjzDySDbodc+1SphzTaA0mp0=; b=lt0EAQT/WoDvq8heozr4PeewlfZy1myX6tm0ZWVQS6GRdM+RR/lIvjo1Fv0z0sZKso TZD95BwFfzVBCUJkJ1hZF1gWADTs3ExU4uM4kPjcyaexfOs75UhoCpoQIlJ+ateqb9Wz z8Xz00+zLneEJvHmG2H9Vs05Vucvr2x5LFtrm4iWp7Rrd/hRoSEJApk9VonBm9tfG8vr fpKtnyGN91H8egCcmqhfmkFhXZxTiWBUAeBNnvQg6AHuvir/5j6K/XqfJRKPNQbEWsHz RV/FxBfKgNdlcyG/6dbDDkRq89bg6Yglj+Axnger9cpM1wBJMQeo2oGvilRjLrQmwM+F Chyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IBCN5yrd; 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 g6si11883317edg.190.2019.05.19.14.08.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:08:46 -0700 (PDT) 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=IBCN5yrd; 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]:53550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hST2z-0004O9-4W for patch@linaro.org; Sun, 19 May 2019 17:08:45 -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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.1 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