From patchwork Sun May 19 20:37:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164565 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4819324ili; Sun, 19 May 2019 14:38:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzmokdHuD22xTxpoilOKMmt0oypQK/aopXhR40oe7NTrNF+LkMGgoVHYIbdOgyH4aySq/z X-Received: by 2002:a17:906:4594:: with SMTP id t20mr30716337ejq.223.1558301899137; Sun, 19 May 2019 14:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558301899; cv=none; d=google.com; s=arc-20160816; b=GuJN/fRR3FeLPJ7PZauLLoLRRmirf59aulDoVHICJNIfKtCE4UXde9LejmvRKq6Jsg at9524xOAVKwoTAtdmMix37vEWLxYERV7hJDyaeaoLQyGWyO0On+uZ4r8xTLOHFIuoex PytPudnJJK+rtmPU0jUzzp94AQ43FO0NL5mnVYRKDQJ3wqriOGthhPamav5PJmaFV7cA mkoDwg4OFM7t28ZutxhD5raMCmD00TrEjD1AExH2vVcFsUjMB/KL0psXCWZnvLud5CSJ S6VDVEKjrDfCD5VktMqyuiUKxR0X/+Z26276DtaL7wmHs6Ru8H9OyMha0iUlqDW5Oyo3 HTWg== 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; bh=EjoYPrl44jrQeXa6UK02T5QS4VIgYMGR1w3phRnmDY0=; b=j9p8ghTnpsDye+vRZJoB1NT7+WtqAkgfhIGdQRw4PdEXUI+2l5tbmxAnukHAH5WhxH f/a66Q3dhSDDTAiZgSooVdYuyhcV8jg1Lphts74vAUojFcnFyd6+0+YjHyngZw8b7VQv X06/slqTOi7EvVFRctwaxs3jGOftRW7l01QWxwwVL2r8n+wpj8YqlT0g8zleWaVOxWlq FwST2zav61f6oqHwMRY64DMHwnelcjzW+krRY/y+QZ2IL0zTGco06BRbg+EWv2/6+0NG kokjSRfD59bYs6Sdqigp9HzRFN4kpZ2zYEPGvDeuOGubsJQsK//PLfZvUmyI76c2bMKm +M2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=z5F6WQF5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id z54si6131492edb.367.2019.05.19.14.38.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:38:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=z5F6WQF5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:54050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTVa-0004PZ-3o for patch@linaro.org; Sun, 19 May 2019 17:38:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSaE-0004BD-Q1 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSaD-0005Av-Ld for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:02 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:38183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSaD-0005AS-FZ for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:01 -0400 Received: by mail-pg1-x541.google.com with SMTP id j26so5741300pgl.5 for ; Sun, 19 May 2019 13:39:01 -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=EjoYPrl44jrQeXa6UK02T5QS4VIgYMGR1w3phRnmDY0=; b=z5F6WQF52rpJo3PQhy2+twbWWJQFDoZoEePUHYzj82TmKnjvzvY5uXYPkFCbsuEr07 HjfI5nNwOrnbdyELuTn3C59hgaV9BZtN8XtBmp3vzq7XPBwCr6KO1we6KNf2gBww9wmZ yUcFH6KgkzN+qhIt1Rvz13Ese9e4L0Ai/1SJUamSkRzYOqxG1xE300HxH6VNdAkgVbRX sTpU8GlNq/J9/Rk3Ns2+kby1AiO5Z4kTvnCdEK3gp0zMRwAwL2owtrXZ658Nbu1XfIpv zcsdgoDBh4yiXc5PBn9S5KIw+l9ff/y0hXOUHOwPdRTESnx0V8ckvrtLspf1lxNcfoVx K/IQ== 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=EjoYPrl44jrQeXa6UK02T5QS4VIgYMGR1w3phRnmDY0=; b=dI4xfd8Nx1rSEjdAP8pklXWylPlaHXnsfu5GDc01SEd/4wtWaQkLPZpeBHgoJbWqf4 HRSC7M7SNtYgNuSL7pynjYhApB5v+d6uufXUST9GEuRELv4GnmiSTN9Nb3tFVq5R65Dv WNQcGYvZYB5eO9yJgVBTQWkCgjIq/O7W484l8mH3FIBoVqfq5V9uW9I0HPOkYUN2VmOz qQimN/b6pUkqoa4ZR/1FJeP7bUn1uXOYA19XoIWA4nwU9ml0B+nfwzDJLEfLw0BE7cW3 YTS7qWIG5WnFBYwuorbyKNXMw5Wey5imz0YII8vltfemWI2Fs2wDEhU+FsB/4W0A2bAz WZXw== X-Gm-Message-State: APjAAAUPoSg01a3b1HhA1AB5qfM3ZWqZ6/ujOrmEuoc5lNZGSYzCTEsG VKwINVxMRsJx06E+jiHm43YZFrHfrxI= X-Received: by 2002:a65:5c89:: with SMTP id a9mr71876407pgt.334.1558298340290; Sun, 19 May 2019 13:39:00 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:26 -0700 Message-Id: <20190519203726.20729-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH v7 74/74] linux-user: Split out getpriority, setpriority 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-defs.h | 2 ++ linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 6 ------ 4 files changed, 30 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 8b2d95d19e..3b45250977 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -80,6 +80,7 @@ SYSCALL_DEF(getpid); #ifdef TARGET_NR_getppid SYSCALL_DEF(getppid); #endif +SYSCALL_DEF(getpriority, ARG_DEC, ARG_DEC); #ifdef TARGET_NR_getrlimit SYSCALL_DEF(getrlimit, ARG_DEC, ARG_PTR); #endif @@ -238,6 +239,7 @@ SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX); #endif SYSCALL_DEF(sethostname, ARG_STR); SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC); +SYSCALL_DEF(setpriority, ARG_DEC, ARG_DEC, ARG_DEC); #ifdef TARGET_NR_setrlimit SYSCALL_DEF(setrlimit, ARG_DEC, ARG_PTR); #endif diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c index 408e96a834..e85151cc2e 100644 --- a/linux-user/syscall-proc.inc.c +++ b/linux-user/syscall-proc.inc.c @@ -479,6 +479,29 @@ SYSCALL_IMPL(getppid) } #endif +SYSCALL_IMPL(getpriority) +{ + abi_long ret; + + /* + * Note that negative values are valid for getpriority, so we must + * differentiate based on errno settings. + */ + errno = 0; + ret = getpriority(arg1, arg2); + if (ret == -1 && errno != 0) { + return -host_to_target_errno(errno); + } +#ifdef TARGET_ALPHA + /* Return value is the unbiased priority. Signal no error. */ + ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0; +#else + /* Return value is a biased priority to avoid negative numbers. */ + ret = 20 - ret; +#endif + return ret; +} + #ifdef TARGET_NR_getrlimit SYSCALL_IMPL(getrlimit) { @@ -568,6 +591,11 @@ SYSCALL_IMPL(setpgid) return get_errno(setpgid(arg1, arg2)); } +SYSCALL_IMPL(setpriority) +{ + return get_errno(setpriority(arg1, arg2, arg3)); +} + #ifdef TARGET_NR_setrlimit SYSCALL_IMPL(setrlimit) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1b1d44bf32..6e7cccbdd5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4144,24 +4144,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_getpriority: - /* Note that negative values are valid for getpriority, so we must - differentiate based on errno settings. */ - errno = 0; - ret = getpriority(arg1, arg2); - if (ret == -1 && errno != 0) { - return -host_to_target_errno(errno); - } -#ifdef TARGET_ALPHA - /* Return value is the unbiased priority. Signal no error. */ - ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0; -#else - /* Return value is a biased priority to avoid negative numbers. */ - ret = 20 - ret; -#endif - return ret; - case TARGET_NR_setpriority: - return get_errno(setpriority(arg1, arg2, arg3)); #ifdef TARGET_NR_statfs case TARGET_NR_statfs: if (!(p = lock_user_string(arg1))) { diff --git a/linux-user/strace.list b/linux-user/strace.list index 55b617239c..a0d2b3f9c5 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -256,9 +256,6 @@ #ifdef TARGET_NR_getpmsg { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getpriority -{ TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL }, -#endif #ifdef TARGET_NR_getrandom { TARGET_NR_getrandom, "getrandom", NULL, NULL, NULL }, #endif @@ -1007,9 +1004,6 @@ #ifdef TARGET_NR_setpgrp { TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_setpriority -{ TARGET_NR_setpriority, "setpriority" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setregid { TARGET_NR_setregid, "setregid" , NULL, NULL, NULL }, #endif