From patchwork Sun Jun 10 03:01:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138118 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2591608lji; Sat, 9 Jun 2018 20:34:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL9qypHHTQ4N4wfqI8cdcR0WHINTjrVB9aSrUpblX6lRkGhibJP1Czh4IyAcL8iPZASDwmo X-Received: by 2002:ae9:df06:: with SMTP id t6-v6mr10152037qkf.46.1528601690826; Sat, 09 Jun 2018 20:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601690; cv=none; d=google.com; s=arc-20160816; b=Keyuca0ba1E6mnhTUqyZtI0ttg4A2vog2oNnx66TII0/wbexWSFWXcMbfbZHHh43pb cFlFlsk2FIuEHod6loPdbaXs6aO04QTSIRNbR0OOvDDYcaLdz6Bf8cCdGNRm+pxfDdDv fDn/o/uZSOTOIvrbgKYJZ8WNA0NvENtbcmGYwDrk7k7Ld90w0ixx+nsUGtnfWDdjxJl+ EG2O56gejB81+aN1JWP/63TIRJR42NVdt4j1YVbxCwq34VR1XtbeHKPO1z1nDSQwJFaY CQt13wpJeWWvHeUHwrEcfkJu9HxWtDtvJEyfmOIQZHOQQ3rnYGKffTRh8kL/udW4TXRn KWbA== 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=GNKzSio2SBkgR4wvRREYC8akk3s9QztX958J6dqMyBM=; b=bM2tl4O9kLExgInymcIuvoj7gAC6LbLTeAUDPJimNIKNJYual5Q0MY+OoOTty3AHyO ybu/X0j0jR3yv8LTK+DRN+HARaSKWvqYrPk4qnrlvWZvSJzkUKBodAxkysTfg7gke5ri gGfQKPlDw+Lw5RMAMNPkolcRqDulazcDUz1t6Irs/5fN5tRfNQwOS5iajj2QXja+IPiz 6Scwk1F6ffTta6hu9yuvHvXC3056i3ynFp/w0BeNsGu97F/YTB4R8NfMyTThgumMmZe4 zITeZtjZPySdUGdaEf6fLvZzK/GKUOyIUIRR7QfrZwAQh1TPF3XQzo4WQE5/olSQD0Ba 97ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=buuJ6uKE; 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 j3-v6si83649qtp.72.2018.06.09.20.34.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:34:50 -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=buuJ6uKE; 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]:42348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRr7y-0004pH-Bt for patch@linaro.org; Sat, 09 Jun 2018 23:34:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqeB-0002st-PC for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqe9-0003eR-5Y for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:03 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:44506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqe8-0003e6-Uy for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:01 -0400 Received: by mail-pf0-x244.google.com with SMTP id h12-v6so8485496pfk.11 for ; Sat, 09 Jun 2018 20:04:00 -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=GNKzSio2SBkgR4wvRREYC8akk3s9QztX958J6dqMyBM=; b=buuJ6uKEtbWE+VV8+9M9gzsTFGVitmVxYY5GDvFO9VktgBY1xfAMmqU8NJBUBnoeIB SnRR1IWQkQxb5JCD/taZ38oL5Xvba8PuFyiHqSAHvL5QGDWSM+Emjm59ecTS3XVU5uAK yRhnkCa+BijCX1qfa1MchLcmvXnQvfUXH9XxY= 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=GNKzSio2SBkgR4wvRREYC8akk3s9QztX958J6dqMyBM=; b=kfGqduO779n+CNbwFSxwjOOR2yNfj6qroZG/F/rlcjX2qAEpDrVQW3qmraTDu7XFFR hw7xxxtJfKOk7eDL6F9L9Dy4zUV6q/U3I/vrkPIlKNILrKDjfk2ffb6bFvYRA4BYOADn 66f+9K11mW4QrfjxIFSfuheRyDGe6CFSGdtVC/SoxK04X71GTuJKLbqLLSSmkHNtUh4H 2HOVMq6eng1ps57N8cuBGj6VAlEKJd5W6uxtyUgifdKzvlliyHbWnC57343egKTUbsgH 9b1xblsP2/sM2kV9SkVl6JPrC/19gmScoVT9dVzntBjIuKog+ybOTg96NkOwLoQKLF6F bXoA== X-Gm-Message-State: APt69E3wTcGJG73A918SS2DtF51T7jpqVqKHVmu/5xBgKl5bsGRkwdL8 rlf63jpXKYZZlz3dAD7mgEM5CXytIDA= X-Received: by 2002:a62:3e11:: with SMTP id l17-v6mr12299808pfa.18.1528599839786; Sat, 09 Jun 2018 20:03:59 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:15 -1000 Message-Id: <20180610030220.3777-44-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:c00::244 Subject: [Qemu-devel] [PATCH v2 043/108] 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.c | 46 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 86583988c4..6d8d2eb780 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8241,6 +8241,27 @@ IMPL(getppid) } #endif +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; + return ret; +#else + /* Return value is a biased priority to avoid negative numbers. */ + return 20 - ret; +#endif +} + IMPL(getrlimit) { int resource = target_to_host_resource(arg1); @@ -9303,6 +9324,11 @@ IMPL(setpgid) return get_errno(setpgid(arg1, arg2)); } +IMPL(setpriority) +{ + return get_errno(setpriority(arg1, arg2, arg3)); +} + IMPL(setrlimit) { int resource = target_to_host_resource(arg1); @@ -9898,24 +9924,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned 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_socketcall case TARGET_NR_socketcall: return do_socketcall(arg1, arg2); @@ -12811,6 +12819,7 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_getppid SYSCALL(getppid); #endif + SYSCALL(getpriority); SYSCALL(getrlimit); SYSCALL(getrusage); SYSCALL(gettimeofday); @@ -12907,6 +12916,7 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(sethostname); SYSCALL(setpgid); + SYSCALL(setpriority); SYSCALL(setrlimit); SYSCALL(settimeofday); SYSCALL(setsid);