From patchwork Wed Jun 8 13:30:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69659 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2519854qgf; Wed, 8 Jun 2016 07:15:42 -0700 (PDT) X-Received: by 10.140.98.172 with SMTP id o41mr4750957qge.8.1465395342617; Wed, 08 Jun 2016 07:15:42 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 30si756635qkp.218.2016.06.08.07.15.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 07:15:42 -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; 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 dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAeGk-0003FI-1H for patch@linaro.org; Wed, 08 Jun 2016 10:15:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZg-0004Y2-FQ for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZe-0005qx-F0 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:11 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:35703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZe-0005qe-73 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:10 -0400 Received: by mail-lf0-x233.google.com with SMTP id u74so5856928lff.2 for ; Wed, 08 Jun 2016 06:31:10 -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=N/npdIAyPdGn6iSKT9xjbsEqluu2y5fpK4lBtKuIi5s=; b=U7RTVti4XBzYPUzwNvfJcRiKdsi0oahrDgiDHgrn+IJ4xGbTPLuwXHCn9XYmh+u8+P dJOtRpRmIXAa2JqV7Hq6XujSqiPXCLRjYn4PFUhK9fEY/G4E0wg0NnVt5BnRwnGZ8/wr 5R6huv5zCTNvHRV49FUeOZD6ZNFwoe9Kf9OAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N/npdIAyPdGn6iSKT9xjbsEqluu2y5fpK4lBtKuIi5s=; b=Rgb18t23WdFU2AqqfYE9kAkMe6Nwvl8Rok3A90HC2QKIzQTK/Q9z+xzJiDF2lgFPsZ ALqUj5srOFTl07vJ7wMd7ABZRy8S/LSdMlFZkwch2gdvyrnL4FvEpSspTQcT09nNoCCY P11O8pR96dP6ot7GUBgAI663uBPx4nggi9Fqhu1TdZ7IioKNhNhF3nY16E/KTuQNdDPx 660POOH2GlPtEfhqHkoyMqEgbd0g5i49spIgOkIz1UlmzN9MhOKK2wrecT1RwXARHtAe ZMODHZRYKFm/wa4uLwNz9oDxnPp0jjV1FXTsLShl/JRNop8qjJ+GZwDcaK1AnKPe2tu8 TtjQ== X-Gm-Message-State: ALyK8tJBU2mGIFxKiHGS/lGm7p59lsD9M3neVIqMqbPNKTYkzT5Oo1rz1AB76XRGkFT+B5L4 X-Received: by 10.25.86.79 with SMTP id k76mr4733063lfb.189.1465392669522; Wed, 08 Jun 2016 06:31:09 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.31.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:08 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:16 +0300 Message-Id: <9e518226f431454ce2d4d01051593b32515b3b55.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::233 Subject: [Qemu-devel] [PULL 35/44] linux-user: Use safe_syscall wrapper for sleep 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the safe_syscall wrapper for the clock_nanosleep and nanosleep syscalls. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cecd96c..a931919 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -725,6 +725,12 @@ safe_syscall3(ssize_t, recvmsg, int, fd, struct msghdr *, msg, int, flags) safe_syscall2(int, flock, int, fd, int, operation) safe_syscall4(int, rt_sigtimedwait, const sigset_t *, these, siginfo_t *, uinfo, const struct timespec *, uts, size_t, sigsetsize) +safe_syscall2(int, nanosleep, const struct timespec *, req, + struct timespec *, rem) +#ifdef TARGET_NR_clock_nanosleep +safe_syscall4(int, clock_nanosleep, const clockid_t, clock, int, flags, + const struct timespec *, req, struct timespec *, rem) +#endif #ifdef __NR_msgsnd safe_syscall4(int, msgsnd, int, msgid, const void *, msgp, size_t, sz, int, flags) @@ -9205,7 +9211,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct timespec req, rem; target_to_host_timespec(&req, arg1); - ret = get_errno(nanosleep(&req, &rem)); + ret = get_errno(safe_nanosleep(&req, &rem)); if (is_error(ret) && arg2) { host_to_target_timespec(arg2, &rem); } @@ -10473,14 +10479,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct timespec ts; target_to_host_timespec(&ts, arg3); - ret = get_errno(clock_nanosleep(arg1, arg2, &ts, arg4 ? &ts : NULL)); + ret = get_errno(safe_clock_nanosleep(arg1, arg2, + &ts, arg4 ? &ts : NULL)); if (arg4) host_to_target_timespec(arg4, &ts); #if defined(TARGET_PPC) /* clock_nanosleep is odd in that it returns positive errno values. * On PPC, CR0 bit 3 should be set in such a situation. */ - if (ret) { + if (ret && ret != -TARGET_ERESTARTSYS) { ((CPUPPCState *)cpu_env)->crf[0] |= 1; } #endif