From patchwork Fri Jan 18 21:31:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156078 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3744152jaa; Fri, 18 Jan 2019 13:56:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ga7cNjiQYiNqpQoY4XoMVyng2GY+M43Z66ZfMUqlXZ+q64AA6c6TK+FkfjSyekTOy0O/R X-Received: by 2002:a5d:694d:: with SMTP id r13mr17629759wrw.323.1547848610291; Fri, 18 Jan 2019 13:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547848610; cv=none; d=google.com; s=arc-20160816; b=m6HOm38cOM4zm569MFVkTRT56G8y/e7YuY0LAB0ChIvImpRxTm3yza9rI0T3qe/a3P O81IDwttATvqVkcEla/9CkPC/KrBnxYXXrTok4b7k4Ys0z6Omndvvl+un+hQM11/Ilbu zRu1ozO0LkXUkobTqTXvu+K/t+xbtMT/Rtrr5lqz/1S9sjP1riZ5F16u4NCjtn8Lsa7C bKG7o/lX/Mf9siKYdp7G2criWgm6IYs1jodk72fhG8EOPQMF7nV46RVxewAkHTMEZelo uU43H8KsiCH5fyqXw21FcQXnAECxGERu5l5Elxt8lqAI0lGYuuPItru6UDVQ6pqjIDQl sfHg== 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=rux+kRu2UAl1QIPUh/1VQqUdHSpoV4AukU1szKGl9bY=; b=RSy4IaNtkCtr+O7KU6iGCGCGOZ3Z/N/iY4CJqHmIAY+XNyjfUyQIZQKzKWarN/tHBZ aE3jasfSdDm54jbTFx2KXKako6Xrz9K2tp8AcwOF/cnC+obh5925KaAtIW73r9/U5Hk4 uKTaedAow0Fas4nUez6iQ+U0LcTQtiEwGpQhzA8Ak26lI3pWVhNyvuzCqvPfBRx9gfIx lmaLj9bh92vAHQTlgb5CVyiy5cSstme4U9sp1ERf3d3vnWlODxvuMG7kQ56YZ4lrYlHO OcWxCIgyQtITP+Bt0AKqQCLtLHFIYdxiqM2qC9l2VuRC5FxTKrkJbF6gWFVPukompmXj aocA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fBfvB5LT; 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 d126si27891949wmf.158.2019.01.18.13.56.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 13:56:50 -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=fBfvB5LT; 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]:47742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkc89-0008Ph-7N for patch@linaro.org; Fri, 18 Jan 2019 16:56:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkble-00068t-KW for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkblQ-0005t3-L2 for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:26 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:38211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkblO-0005jf-0s for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:18 -0500 Received: by mail-pf1-x443.google.com with SMTP id q1so7204236pfi.5 for ; Fri, 18 Jan 2019 13:33:13 -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=rux+kRu2UAl1QIPUh/1VQqUdHSpoV4AukU1szKGl9bY=; b=fBfvB5LT3Jk57DYzHjGUNedsBZ+273ivbG7f4lPFtGTB5DQXHoXizLILQrhf6ti3oE MnrG6mkm1kGipC5zoKAuEsiJoainGjzHT2NMzMM7je4hkX4/2e+VH9af7qnxm5DvSEs3 zEP38DN/VlLmbYnD1d55jVOHC0suazXOLjwhQ= 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=rux+kRu2UAl1QIPUh/1VQqUdHSpoV4AukU1szKGl9bY=; b=QjJaoUvyfy5m+KEA9NZZjkysGXNJIAf0/EHE2GPOJUPIQau5PPIZy47PnwwJ+XzFbx x6FvbwmqEKa37UAbHkle1WUTyPWDPzmnOtv+oj8SYAkT7P1pyQu9X4gDgkIaFkaSvJaN e94EVpOLxl9XYvMFxFJZSboHfAl2zcTlccHKAGThVgfFiNkJsZJL1NpIJqsh7bRAjJj5 eI9ft0/C+b5oAu/w/+g+OO8YnrquikDhrw/YjGoO3VmXyQCyRTx5kDxRiA7ByylNq8Q+ FMllnC1WB3mSDnpX+RZz4LQIWHHz+fHexLVv5prkO5Urk0p13LO8+66M4YrGiZe2uBx9 dNfg== X-Gm-Message-State: AJcUukfyA4iXAssgpfdv/je7vAoD+Q1DlAKFokB7Tg4ZNwezc1RCCikM qM2KCdm8KueWlGu+hF7JZ8nu78EdsLg= X-Received: by 2002:a62:b80a:: with SMTP id p10mr19676364pfe.32.1547847192333; Fri, 18 Jan 2019 13:33:12 -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.33.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:33:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 19 Jan 2019 08:31:18 +1100 Message-Id: <20190118213122.22865-45-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::443 Subject: [Qemu-devel] [PATCH v6 45/49] 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.2 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 58c0a22300..09a0306406 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 3a322a61ca..d0bf339281 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5293,24 +5293,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 ac25e13bfa..4ea11f162e 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