From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecZfj-0008Mj-29 for qemu-devel@nongnu.org; Fri, 19 Jan 2018 11:37:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecZff-0008HQ-2T for qemu-devel@nongnu.org; Fri, 19 Jan 2018 11:37:43 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:52776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecZfe-0008Gz-Ot for qemu-devel@nongnu.org; Fri, 19 Jan 2018 11:37:38 -0500 References: <20180112081435.21299-1-samuel.thibault@ens-lyon.org> From: Laurent Vivier Message-ID: Date: Fri, 19 Jan 2018 17:37:35 +0100 MIME-Version: 1.0 In-Reply-To: <20180112081435.21299-1-samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCHv4] linux-user: Add getcpu() support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault , qemu-devel@nongnu.org Cc: Riku Voipio Le 12/01/2018 à 09:14, Samuel Thibault a écrit : > Signed-off-by: Samuel Thibault > > --- > Difference between v1 and v2: handle failure of put_user_u32 with goto efault; > Difference between v2 and v3: handle failure of sys_getcpu system call > Difference between v3 and v4: use is_error > --- > linux-user/syscall.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 11c9116c4a..26403d7e5c 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -296,6 +296,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned 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 *, tcache); > _syscall4(int, reboot, int, magic1, int, magic2, unsigned int, cmd, > void *, arg); > _syscall2(int, capget, struct __user_cap_header_struct *, header, > @@ -10403,6 +10405,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > ret = get_errno(sys_sched_setaffinity(arg1, mask_size, mask)); > } > break; > + case TARGET_NR_getcpu: > + { > + unsigned cpu, node; > + ret = get_errno(sys_getcpu(arg1 ? &cpu : NULL, > + arg2 ? &node : NULL, > + NULL)); > + if (is_error(ret)) { > + goto fail; > + } > + if (arg1 && put_user_u32(cpu, arg1)) { > + goto efault; > + } > + if (arg2 && put_user_u32(node, arg2)) { > + goto efault; > + } > + } > + break; > case TARGET_NR_sched_setparam: > { > struct sched_param *target_schp; > Applied to my linux-user branch. Thanks, Laurent