From patchwork Mon Mar 10 12:22:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 25958 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 90B122055F for ; Mon, 10 Mar 2014 12:24:16 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf28073675iec.0 for ; Mon, 10 Mar 2014 05:24:16 -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=rWauyCEvbIlXwgnr6acPBcP8oKb2hNDCczs62Wa9lIU=; b=g+V6Yxbg82AjX+e76WeGo8WoaGukuqX/ppfokQHdmVmRn6wx2IE8g4E/fKj5byH1d0 f8AJP6k9VfE6vOjDoILbqf7uoQjerqhDcMlW537V5ABo7KxUg1XnwlLRFjA1i2h3aPlc ZmP5LkGK53ee+EfaObahIiucTc8dKjNA0joHhaoWtPnLD6NaJsGHSkkntSTsnN9Q2sEm Q5KIqR6bm22Dduh0G24uyPbS9eMu3ZrnYA0zbLhPmfT/Ux0WD1dq6dTkRxLLpAYjbmvp TzbcQOhck4pd9YJLuNYmbaDaq/hh+CtI8sISBocYLy9ygbfOwGlvlfmt+alsdN8quiAx KtmQ== X-Gm-Message-State: ALoCoQkIR/lLlkfMIimvQ0KteHXJyDPVWUlnv7GI686YunkRNPafDTGyh4o0g1RwFkZOI01N1QDS X-Received: by 10.43.125.196 with SMTP id gt4mr3236349icc.32.1394454256085; Mon, 10 Mar 2014 05:24:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.133 with SMTP id b5ls1580545qge.38.gmail; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) X-Received: by 10.52.30.230 with SMTP id v6mr22409699vdh.6.1394454255939; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id bj3si4628369vcb.64.2014.03.10.05.24.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:24:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so6319801vcb.21 for ; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) X-Received: by 10.220.67.18 with SMTP id p18mr22450957vci.14.1394454255864; Mon, 10 Mar 2014 05:24:15 -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.220.78.9 with SMTP id i9csp114653vck; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) X-Received: by 10.140.107.10 with SMTP id g10mr35266780qgf.63.1394454255072; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s49si8711352qge.166.2014.03.10.05.24.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:24:15 -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]:48396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzFe-00041o-Iy for patch@linaro.org; Mon, 10 Mar 2014 08:24:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzEd-0002oy-Gq for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMzEW-00084n-25 for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:11 -0400 Received: from afflict.kos.to ([92.243.29.197]:50049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzEV-00084U-GH for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:03 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id D78CF26566; Mon, 10 Mar 2014 13:23:01 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 10 Mar 2014 14:22:58 +0200 Message-Id: <974a196d7fc9f2f5553589b0022226b877e5c9b1.1394453724.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Petar Jovanovic Subject: [Qemu-devel] [PATCH 6/8] linux-user: translate signal number on return from sigtimedwait 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=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: Petar Jovanovic On success, sigtimedwait() returns a signal number that needs to be translated from a host value to a target value. This change also fixes issues with sigwait (that is implemented using sigtimedwait()). Signed-off-by: Petar Jovanovic Signed-off-by: Riku Voipio Reviewed-by: Peter Maydell --- linux-user/syscall.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1f64867..e2c10cc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6185,11 +6185,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, puts = NULL; } ret = get_errno(sigtimedwait(&set, &uinfo, puts)); - if (!is_error(ret) && arg2) { - if (!(p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t), 0))) - goto efault; - host_to_target_siginfo(p, &uinfo); - unlock_user(p, arg2, sizeof(target_siginfo_t)); + if (!is_error(ret)) { + if (arg2) { + p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t), + 0); + if (!p) { + goto efault; + } + host_to_target_siginfo(p, &uinfo); + unlock_user(p, arg2, sizeof(target_siginfo_t)); + } + ret = host_to_target_signal(ret); } } break;