From patchwork Mon Jun 23 13:26:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 32356 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2713520540 for ; Mon, 23 Jun 2014 13:31:27 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf23126507obc.1 for ; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=pdbqM+CBqyCgXnQpy0uyObRa43FTLxhWLGy75q5Sb2s=; b=ktPyUrX+ZBQp+TUon0j6z4yzQKi0ZTNuwaAF2f9KMrpB9PpN8Y0br4Qpm6+VLXmu0L e1wK0iz4odpls75HxHydPR7AJO/EAjV4yV3nTHDnfxTpPCDXnj5pyE4S2jh2kgZWgv8M Yp55kmBWkodWhs+BN71Ku52KGjjYPuqwnNGoYDEwwVoSYJTBHKq57ywo7MmT5gaAnyJx 6W+CiTSMcjdf9iuBs4cgf2szugiyXQ80/JNOJcZ79p9kFcbvDlM8iajFEGmxvZEv5xkd gjemFHXyJBicXVtkdfqkmbegnOtTYBwEDEmwk2qkz4rglLkONnw8PRLzGeRROJ4Rq499 vbCQ== X-Gm-Message-State: ALoCoQmVrKT1FGDDglnE6AsXtBR0Rxq7CmUeHWyzPD1ZtwrefAe3G7iRUPjTC/VHN2WXxRYkKaSY X-Received: by 10.50.13.6 with SMTP id d6mr9152618igc.1.1403530286541; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.33 with SMTP id f30ls173191qga.39.gmail; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) X-Received: by 10.52.7.163 with SMTP id k3mr713063vda.58.1403530286433; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id q9si8993233vey.41.2014.06.23.06.31.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:31:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so5925922vcb.19 for ; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) X-Received: by 10.58.24.38 with SMTP id r6mr1485556vef.41.1403530286369; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp130887vcb; Mon, 23 Jun 2014 06:31:26 -0700 (PDT) X-Received: by 10.224.74.196 with SMTP id v4mr5183527qaj.104.1403530285866; Mon, 23 Jun 2014 06:31:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l4si7228887qae.116.2014.06.23.06.31.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:31:25 -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; Received: from localhost ([::1]:53533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4LF-0000Vh-Df for patch@linaro.org; Mon, 23 Jun 2014 09:31:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4Gm-0003iL-MD for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz4Gd-0001Bo-OL for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:48 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=37370 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4Gd-0001As-IS for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:39 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 83F9926595; Mon, 23 Jun 2014 15:26:36 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 23 Jun 2014 16:26:28 +0300 Message-Id: <88c41cc3c0bc896e0784a2800023458ce1f3bc43.1403529800.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Paul Burton Subject: [Qemu-devel] [PULL 13/19] linux-user: support timerfd_{create, gettime, settime} syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Paul Burton Adds support for the timerfd_create, timerfd_gettime & timerfd_settime syscalls, allowing use of timerfds by target programs. Signed-off-by: Paul Burton Signed-off-by: Riku Voipio --- linux-user/strace.list | 9 +++++++++ linux-user/syscall.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/linux-user/strace.list b/linux-user/strace.list index fcb258d..8de972a 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1404,6 +1404,15 @@ #ifdef TARGET_NR_timer_settime { TARGET_NR_timer_settime, "timer_settime" , NULL, NULL, NULL }, #endif +#ifdef TARGET_NR_timerfd_create +{ TARGET_NR_timerfd_create, "timerfd_create" , NULL, NULL, NULL }, +#endif +#ifdef TARGET_NR_timerfd_gettime +{ TARGET_NR_timerfd_gettime, "timerfd_gettime" , NULL, NULL, NULL }, +#endif +#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 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8e2762b..ca38147 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -58,6 +58,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, #include #include #include +#include #include #include //#include @@ -9491,6 +9492,50 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } #endif +#ifdef TARGET_NR_timerfd_create + case TARGET_NR_timerfd_create: + ret = get_errno(timerfd_create(arg1, + target_to_host_bitmask(arg2, fcntl_flags_tbl))); + break; +#endif + +#ifdef TARGET_NR_timerfd_gettime + 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)) { + goto efault; + } + } + break; +#endif + +#ifdef TARGET_NR_timerfd_settime + case TARGET_NR_timerfd_settime: + { + struct itimerspec its_new, its_old, *p_new; + + if (arg3) { + if (target_to_host_itimerspec(&its_new, arg3)) { + goto 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)) { + goto efault; + } + } + break; +#endif + default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);