From patchwork Sun Jun 10 03:01:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138103 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2585221lji; Sat, 9 Jun 2018 20:23:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ9rufviGDdaG6MWGFtwniMdMQbMVZcTwXSkMP4Hnuzgt8V8cQfDy4sNt7UgTX3uNbYJrKx X-Received: by 2002:a37:434f:: with SMTP id q76-v6mr10148118qka.277.1528601012271; Sat, 09 Jun 2018 20:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601012; cv=none; d=google.com; s=arc-20160816; b=hMWnHniH1ldj6UUYkNa3VoajMlnkco6uIrn777W4YcKaBbDHLIQORtOcRTfDd4VQhk DVMcQXWnieN6I05fQcYwCEtPb2FJpJzUZp7yEjUo8NEC3FSJ9XP5GfHMeKmiiOABir6J Mrzacv/71JH0zt8s/ff27nIgBJBfLzA+/IhLlKv1/HP24iIFIxWR4UbEGvLkgSRXtIzb eANdsI2ZSdtA43U3+DQuyGxgp/2AMgpKBmWhBd6C4ZpqE87zMIpKE2W/vgrt4OIVll3c 1J5T2vBCwArgfeKj1/MHaAZsy0HFWNlQr9YGKYDczaPYoBMv54mzYACvK/3oYK5tgeOs qX6Q== 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=bUIbiyb6n/MWqS9aplOG1Wd+VcRE/eBlJtqcebCnTT0=; b=WYWZFHs3bl3bhlc0WMY3EcD4UyFiyidXJMAGrV8TNWvPSeGHpG6xJ43GffYNSfWMaD CJ/2zEKSejWMo08y6xYdw/w9TyazwQ0uJ0uKXNxe/8Vhu8Xe/K3AbbNT+vqXPH4eZUS1 GMDOvNOj8jce32KZw8MT6WLVz2riEZ+SPz6IAYFeOunr479Q4ZZt+cCvBSn4CkM1Syua rxsQdTaySWSouGq+jhXl0fIlrYzoLYrGb+BLDwM5P46+az7l/x+xsgPyVMOaY54JT9RJ +xZ+WORWdYhzvt+joS7iMOJHu7R+7FzAIwX4gXquT8zNxa0qDG0UDM1v3JIql1r7rggo XSkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ws2jBF0+; 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 r65-v6si5130110qkh.24.2018.06.09.20.23.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:23:32 -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=Ws2jBF0+; 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]:42286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqx1-0002YG-Mu for patch@linaro.org; Sat, 09 Jun 2018 23:23:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqdo-0002Vj-CA for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqdn-0003XV-Et for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:40 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:35908) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqdn-0003XN-72 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:39 -0400 Received: by mail-pl0-x244.google.com with SMTP id a7-v6so7899198plp.3 for ; Sat, 09 Jun 2018 20:03:39 -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=bUIbiyb6n/MWqS9aplOG1Wd+VcRE/eBlJtqcebCnTT0=; b=Ws2jBF0+xMChVXeqQDGBnmRPfrFb/ROgNNqUUfk7oQVv6+G72JC1MS9O4wZwAUZPAW OBvYZUZyZMg14voWux/KmqaGmFd/sPfxMtprqtJLs3hsMYlZxirUdYdk4WEIDqBmJl7V GRV0T3FuZ5bNzQiGJPHj3ZQSdCmoiN5loKgLM= 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=bUIbiyb6n/MWqS9aplOG1Wd+VcRE/eBlJtqcebCnTT0=; b=odoy6JHtSalnzebg+s7tOz/x3zsHSlZFuo6eUE37aJj4EHUmYWn7ekg+SpSDRjZa0e VzWFOu44NJqn3STndJBcKXpaNGJ1g2CObrE2b1yPWFvWySQAEbEg+0TdoSIlce+n9JV0 k5VJCznOiKfRlmZNWa9s207xQjKyjJSAbezBtTrBG+sq7YXwNjRM7vXFpUWG1ei1RyWF 40gpFqYp7Mo1uW7ElIEdq6MUf8yoz3AvVdD3nJuemdL3bt5nQvmEW6RaNl6Um4lHZkwj 2CXTHhrieuMqXz3FbZSsL6Vq/zMa9ZuPTSQRIo7Qn3K5ZE8kQjtIfa7Z23biPjbUq/S0 Ytkg== X-Gm-Message-State: APt69E2EnP5JggJVHwO0f5Cm8RSxXuLCbEEYMGEmEgMVF2/FfZ2QRTkp qVyYX7ljwVYGfJkQMmNZP+hswdwNohc= X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr13003491plg.170.1528599818040; Sat, 09 Jun 2018 20:03:38 -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.03.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:05 -1000 Message-Id: <20180610030220.3777-34-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:c01::244 Subject: [Qemu-devel] [PATCH v2 033/108] linux-user: Split out rt_sigreturn, sethostname, setrlimit, sigreturn 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.c | 85 +++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 33 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 94dc773b4c..ac3592d776 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8782,6 +8782,14 @@ IMPL(rt_sigqueueinfo) return get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); } +IMPL(rt_sigreturn) +{ + if (block_signals()) { + return -TARGET_ERESTARTSYS; + } + return do_rt_sigreturn(cpu_env); +} + IMPL(rt_sigsuspend) { CPUState *cpu = ENV_GET_CPU(cpu_env); @@ -8869,11 +8877,39 @@ IMPL(sgetmask) } #endif +IMPL(sethostname) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(sethostname(p, arg2)); + unlock_user(p, arg1, 0); + return ret; +} + IMPL(setpgid) { return get_errno(setpgid(arg1, arg2)); } +IMPL(setrlimit) +{ + int resource = target_to_host_resource(arg1); + struct target_rlimit *target_rlim; + struct rlimit rlim; + + if (!lock_user_struct(VERIFY_READ, target_rlim, arg2, 1)) { + return -TARGET_EFAULT; + } + rlim.rlim_cur = target_to_host_rlim(target_rlim->rlim_cur); + rlim.rlim_max = target_to_host_rlim(target_rlim->rlim_max); + unlock_user_struct(target_rlim, arg2, 0); + return get_errno(setrlimit(resource, &rlim)); +} + IMPL(setsid) { return get_errno(setsid()); @@ -9055,6 +9091,16 @@ IMPL(sigprocmask) } #endif +#ifdef TARGET_NR_sigreturn +IMPL(sigreturn) +{ + if (block_signals()) { + return -TARGET_ERESTARTSYS; + } + return do_sigreturn(cpu_env); +} +#endif + #ifdef TARGET_NR_sigsuspend IMPL(sigsuspend) { @@ -9339,39 +9385,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_sigreturn - case TARGET_NR_sigreturn: - if (block_signals()) { - ret = -TARGET_ERESTARTSYS; - } else { - ret = do_sigreturn(cpu_env); - } - return ret; -#endif - case TARGET_NR_rt_sigreturn: - if (block_signals()) { - return -TARGET_ERESTARTSYS; - } else { - return do_rt_sigreturn(cpu_env); - } - case TARGET_NR_sethostname: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(sethostname(p, arg2)); - unlock_user(p, arg1, 0); - return ret; - case TARGET_NR_setrlimit: - { - int resource = target_to_host_resource(arg1); - struct target_rlimit *target_rlim; - struct rlimit rlim; - if (!lock_user_struct(VERIFY_READ, target_rlim, arg2, 1)) - return -TARGET_EFAULT; - rlim.rlim_cur = target_to_host_rlim(target_rlim->rlim_cur); - rlim.rlim_max = target_to_host_rlim(target_rlim->rlim_max); - unlock_user_struct(target_rlim, arg2, 0); - return get_errno(setrlimit(resource, &rlim)); - } case TARGET_NR_getrlimit: { int resource = target_to_host_resource(arg1); @@ -12778,13 +12791,16 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(rt_sigpending); SYSCALL(rt_sigprocmask); SYSCALL(rt_sigqueueinfo); + SYSCALL(rt_sigreturn); SYSCALL(rt_sigsuspend); SYSCALL(rt_sigtimedwait); SYSCALL(rt_tgsigqueueinfo); #ifdef TARGET_NR_sgetmask SYSCALL(sgetmask); #endif + SYSCALL(sethostname); SYSCALL(setpgid); + SYSCALL(setrlimit); SYSCALL(setsid); #ifdef TARGET_NR_sigaction SYSCALL(sigaction); @@ -12795,6 +12811,9 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_sigprocmask SYSCALL(sigprocmask); #endif +#ifdef TARGET_NR_sigreturn + SYSCALL(sigreturn); +#endif #ifdef TARGET_NR_sigsuspend SYSCALL(sigsuspend); #endif