virtualization/app-emulation/qemu/files/0.12.4/0009-qemu-cvs-sched_getaffinity.patch
2010-10-10 08:02:11 +00:00

57 lines
1.9 KiB
Diff

From a6f58c0e024cda6f06d788f6d03b699c8c736fdf Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:30:16 +0200
Subject: [PATCH 09/16] qemu-cvs-sched_getaffinity
Implements sched_getaffinity syscall.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3f810c3..a74869e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -156,6 +156,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
}
+#define __NR_sys_sched_getaffinity __NR_sched_getaffinity
#define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
@@ -215,6 +216,9 @@ _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
_syscall2(int,sys_tkill,int,tid,int,sig)
#endif
+#ifdef __NR_sys_sched_getaffinity
+_syscall3(int,sys_sched_getaffinity,pid_t,pid,unsigned int,cpusetsize,void*,mask)
+#endif
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
@@ -7045,6 +7049,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
break;
#endif
+
+#ifdef TARGET_NR_sched_getaffinity
+ case TARGET_NR_sched_getaffinity:
+ {
+ cpu_set_t *mask;
+ lock_user_struct(VERIFY_READ, mask, arg3, 1);
+ ret = get_errno(sys_sched_getaffinity((pid_t)arg1, (unsigned int)arg2, mask));
+ unlock_user_struct(mask, arg3, 0);
+ break;
+ }
+#endif
+
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.4.2