From nobody Tue Oct 28 12:17:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1514473444556384.36236951088836; Thu, 28 Dec 2017 07:04:04 -0800 (PST) Received: from localhost ([::1]:54111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUZj1-0006ou-BK for importer@patchew.org; Thu, 28 Dec 2017 10:04:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUZfx-0004ko-Dj for qemu-devel@nongnu.org; Thu, 28 Dec 2017 10:00:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUZfu-0000Aq-Ds for qemu-devel@nongnu.org; Thu, 28 Dec 2017 10:00:53 -0500 Received: from [2a01:474::1] (port=58407 helo=hera.aquilenet.fr) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eUZfu-00009p-6W for qemu-devel@nongnu.org; Thu, 28 Dec 2017 10:00:50 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 470EC10632; Thu, 28 Dec 2017 16:00:48 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AWO-XEKkwnWd; Thu, 28 Dec 2017 16:00:47 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (LFbn-ORL-1-236-13.w92-152.abo.wanadoo.fr [92.152.80.13]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A96D29BD; Thu, 28 Dec 2017 16:00:44 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.90_RC4) (envelope-from ) id 1eUZfk-0004IG-Ko; Thu, 28 Dec 2017 16:00:40 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org, Riku Voipio , Laurent Vivier Date: Thu, 28 Dec 2017 16:00:38 +0100 Message-Id: <20171228150038.16450-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.15.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:474::1 Subject: [Qemu-devel] [PATCH] linux-user: Add getcpu() support 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: Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Samuel Thibault --- linux-user/syscall.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8ec7de96ce..bb8cb726f5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -296,6 +296,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsig= ned int, len, #define __NR_sys_sched_setaffinity __NR_sched_setaffinity _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len, unsigned long *, user_mask_ptr); +#define __NR_sys_getcpu __NR_getcpu +_syscall3(int, sys_getcpu, unsigned *, cpu, unsigned *, node, void *, tcac= he); _syscall4(int, reboot, int, magic1, int, magic2, unsigned int, cmd, void *, arg); _syscall2(int, capget, struct __user_cap_header_struct *, header, @@ -10443,6 +10445,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_lo= ng arg1, ret =3D get_errno(sys_sched_setaffinity(arg1, mask_size, mask)= ); } break; + case TARGET_NR_getcpu: + { + unsigned cpu, node; + ret =3D get_errno(sys_getcpu(arg1 ? &cpu : NULL, + arg2 ? &node : NULL, + NULL)); + if (arg1) { + put_user(cpu, arg1, abi_uint); + } + if (arg2) { + put_user(node, arg2, abi_uint); + } + } + break; case TARGET_NR_sched_setparam: { struct sched_param *target_schp; --=20 2.15.1