aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-01-12 09:14:35 +0100
committerLaurent Vivier <laurent@vivier.eu>2018-01-23 14:20:52 +0100
commitb827c3ed30e4777ab9bd91cb240252a4815b3322 (patch)
tree8957d3cb661e59cca17601d9996af07cda398cba /linux-user
parent444cd5c3aeb2acffce302e354ad22d1bb37bbfae (diff)
linux-user: Add getcpu() support
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180112081435.21299-1-samuel.thibault@ens-lyon.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 143e4a959d..104408c050 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,
@@ -10491,6 +10493,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;