From patchwork Sun Jun 10 03:02:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138182 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2619396lji; Sat, 9 Jun 2018 21:23:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKzSCS9uNExQ85fysGS29NlYSTluq8OdStNBzf29gF7lHqIMZOrpN/g1ZCVMozn74jUTCj0 X-Received: by 2002:a0c:e20f:: with SMTP id q15-v6mr10915115qvl.113.1528604621216; Sat, 09 Jun 2018 21:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528604621; cv=none; d=google.com; s=arc-20160816; b=ZqZ07wNhaXUG7UIBJQg4pBjlJFSWbY7/gL9WDdr4TcQe6rq+6v7FcmXROxk/I5PVfG L6P7o3sQdV1BNkGI5NcR7zWUu6Ca9/hvOMjUNMORnKvpcqOZxcBeWFF3nporIYJUWUAN nLzUDTOVXbuPCJPq/hRHGpD0ylPUPNgbfQoZYVgqBaKRi8h3DlHsh0L9vJ6hROAWXoX0 x7j+BuRix7DQsMXw0KLK1LUeFH+tG69bOqB+SZ0ISvP2DEB8BfY/pgiy3zPOQ0K6OdUn tIviX3/Lx1IPN0s1DJctMlKsalRze+UpbZVGVC1fx3GBEnpz36/IRAizyfnJIyH2lJA1 8r4A== 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:arc-authentication-results; bh=lfU3/wFm4RJSWBYR/F7HbmhVB0Jxo3PgQWuS4SjQ/yM=; b=rqtvIKB4QUWWzcB1BA4LvweMXFo8cTLiZOYPW36WWxr3RN+HfP+ftIg88kYG4juuvt 7NTBU1AZZ1sAp+4IJ7MxkybH0kAVjierr8Dd7ULc4zOa1XQ78UNfASIQMdLqN2FDS6RN rNPgQMHHTheshQgTNQp8NrxZ9SJRLbgYYKQgVFwA2+X3N3SvQjnOdn1mPkFbQKsVvBUS sf9WrFSMmcjDKpa1wtQ3KiovQGCJTjZ58Skp4tqLC1Wi9jXYvYrLX6yqC7xda1X6OabW nFaZxOcI2TxrcRNVUWik6jyCHFDjDPHPwv46vdf8bbJZhibvCfDjlb+h3SfQWadTnNh4 BaKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IPKvYD3e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v67-v6si5927257qkb.138.2018.06.09.21.23.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IPKvYD3e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrtE-00083K-OC for patch@linaro.org; Sun, 10 Jun 2018 00:23:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqg6-0004lM-5R for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqg5-0004rJ-7i for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:06:02 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:41358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqg5-0004r8-2E for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:06:01 -0400 Received: by mail-pg0-x244.google.com with SMTP id l65-v6so8133692pgl.8 for ; Sat, 09 Jun 2018 20:06:00 -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=lfU3/wFm4RJSWBYR/F7HbmhVB0Jxo3PgQWuS4SjQ/yM=; b=IPKvYD3eO8r07DZdaRx6x8CaM3CmMvHLZRYcXsAsDxv8wXmtv4nT6GVqYxHz4gD8pp DBVDcaCAgMfd0WRTAsDIUSVkyDIUwx8BbYuPY5/X7ka5U7H1rZFcL3qZnsZbD6ZqBLHg aB/vzCE0V/uYeBREo7vy8SQQHwbJPFeOcJK64= 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=lfU3/wFm4RJSWBYR/F7HbmhVB0Jxo3PgQWuS4SjQ/yM=; b=sfzZYBt/1B3VJ9KrEUyCi5Aa0aoD5s41OPbn4VNhcQi5DHe+UoeQecI/ZGzqtTUM55 Yxz5RO5zsOY4OsM1AYKsDPLdv8Z3+JGI+kzL2DjLmkv+4AXLxRaRbDHMOy/qfXtMiy5a r2Jj3as6oAdczDw+ssqbYSZMXZBk7oalCMjczQxh/9raqG8lTokvvSdBH3Y7fxva9fyO 74IBUHQdlewhJnEt10T+XYk/8+zcwPvMb1BuOM7ZpT+SrkjP9x9bP3hx0XeOmd043o4I xn33mCLK5Ej1sHfqlWpJGtK6QEswtN0xhqMwY+BfIGqIpD4blJGhn82kcLc0/NeyIoPX Pgfw== X-Gm-Message-State: APt69E0DIKW1xIe9l0eL7LBm3qoji0YAFB2mPHoPeeBrfZpiUnYILfuH PKHFQQnrFld7n5HTi8ZNt4PSlgKpPLg= X-Received: by 2002:a63:721d:: with SMTP id n29-v6mr10172147pgc.194.1528599959972; Sat, 09 Jun 2018 20:05:59 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:17 -1000 Message-Id: <20180610030220.3777-106-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v2 105/108] linux-user: Split out timerfd syscalls 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" This includes timerfd_create, timerfd_gettime, timerfd_settime. All targets define all of these; remove the ifdefs. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 83 +++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 43 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 0f12a945ea..c0752ad6e0 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12789,6 +12789,41 @@ IMPL(timer_settime) return ret; } +#ifdef CONFIG_TIMERFD +IMPL(timerfd_create) +{ + int host_flags = target_to_host_bitmask(arg2, fcntl_flags_tbl); + return get_errno(timerfd_create(arg1, host_flags)); +} + +IMPL(timerfd_gettime) +{ + struct itimerspec its_curr; + abi_long ret; + + ret = get_errno(timerfd_gettime(arg1, &its_curr)); + if (!ret && host_to_target_itimerspec(arg2, &its_curr)) { + return -TARGET_EFAULT; + } + return ret; +} + +IMPL(timerfd_settime) +{ + struct itimerspec its_new, its_old; + abi_long ret; + + if (target_to_host_itimerspec(&its_new, arg3)) { + return -TARGET_EFAULT; + } + ret = get_errno(timerfd_settime(arg1, arg2, &its_new, &its_old)); + if (!ret && arg4 && host_to_target_itimerspec(arg4, &its_old)) { + return -TARGET_EFAULT; + } + return ret; +} +#endif /* CONFIG_TIMERFD */ + IMPL(tkill) { return get_errno(safe_tkill((int)arg1, target_to_host_signal(arg2))); @@ -13152,49 +13187,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, abi_long ret; switch(num) { -#if defined(TARGET_NR_timerfd_create) && defined(CONFIG_TIMERFD) - case TARGET_NR_timerfd_create: - return get_errno(timerfd_create(arg1, - target_to_host_bitmask(arg2, fcntl_flags_tbl))); -#endif - -#if defined(TARGET_NR_timerfd_gettime) && defined(CONFIG_TIMERFD) - case TARGET_NR_timerfd_gettime: - { - struct itimerspec its_curr; - - ret = get_errno(timerfd_gettime(arg1, &its_curr)); - - if (arg2 && host_to_target_itimerspec(arg2, &its_curr)) { - return -TARGET_EFAULT; - } - } - return ret; -#endif - -#if defined(TARGET_NR_timerfd_settime) && defined(CONFIG_TIMERFD) - case TARGET_NR_timerfd_settime: - { - struct itimerspec its_new, its_old, *p_new; - - if (arg3) { - if (target_to_host_itimerspec(&its_new, arg3)) { - return -TARGET_EFAULT; - } - p_new = &its_new; - } else { - p_new = NULL; - } - - ret = get_errno(timerfd_settime(arg1, arg2, p_new, &its_old)); - - if (arg4 && host_to_target_itimerspec(arg4, &its_old)) { - return -TARGET_EFAULT; - } - } - return ret; -#endif - #if defined(TARGET_NR_ioprio_get) && defined(__NR_ioprio_get) case TARGET_NR_ioprio_get: return get_errno(ioprio_get(arg1, arg2)); @@ -13896,6 +13888,11 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(timer_getoverrun); SYSCALL(timer_gettime); SYSCALL(timer_settime); +#ifdef CONFIG_TIMERFD + SYSCALL(timerfd_create); + SYSCALL(timerfd_gettime); + SYSCALL(timerfd_settime); +#endif SYSCALL(tkill); SYSCALL(truncate); #ifdef TARGET_NR_truncate64