aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2007-08-28 12:26:35 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2007-08-28 12:26:35 +0000
commitb6e645c90f37e74056544503883f1cf02d290116 (patch)
tree001d113e9fb8a3030b51a8b7dbab00c04d4a9e6d /sys
parent8553cd622c29a640c0868c3ffd93b4bb708921b0 (diff)
Implement fake linux sched_getaffinity() syscall to enable java to work
with Linux 2.6 emulation. This shall be reimplemented once FreeBSD gets native scheduler affinity syscalls. Submitted by: rdivacky Reviewed by: jkim Sponsored by: Google Summer of Code 2007 Approved by: re (kensmith)
Notes
Notes: svn path=/head/; revision=171998
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/linux32/syscalls.master3
-rw-r--r--sys/compat/linux/linux_misc.c21
-rw-r--r--sys/i386/linux/syscalls.master3
3 files changed, 25 insertions, 2 deletions
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index 958c5ced5b8b..e8abe3bb68d3 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -408,7 +408,8 @@
240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \
struct l_timespec *timeout, void *uaddr2, int val3); }
241 AUE_NULL UNIMPL linux_sched_setaffinity
-242 AUE_NULL UNIMPL linux_sched_getaffinity
+242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
+ l_ulong *user_mask_ptr); }
243 AUE_NULL STD { int linux_set_thread_area(struct l_user_desc *desc); }
244 AUE_NULL UNIMPL linux_get_thread_area
245 AUE_NULL UNIMPL linux_io_setup
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 9c066fcbfcc2..01f1ceea8779 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1713,3 +1713,24 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args)
return (error);
}
+
+/*
+ * XXX: fake one.. waiting for real implementation of affinity mask.
+ */
+int
+linux_sched_getaffinity(struct thread *td,
+ struct linux_sched_getaffinity_args *args)
+{
+ int error;
+ cpumask_t i = ~0;
+
+ if (args->len < sizeof(cpumask_t))
+ return (EINVAL);
+
+ error = copyout(&i, args->user_mask_ptr, sizeof(cpumask_t));
+ if (error)
+ return (EFAULT);
+
+ td->td_retval[0] = sizeof(cpumask_t);
+ return (0);
+}
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index 43946f2339eb..ee83e369f285 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -410,7 +410,8 @@
240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \
struct l_timespec *timeout, void *uaddr2, int val3); }
241 AUE_NULL UNIMPL linux_sched_setaffinity
-242 AUE_NULL UNIMPL linux_sched_getaffinity
+242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
+ l_ulong *user_mask_ptr); }
243 AUE_NULL STD { int linux_set_thread_area(struct l_user_desc *desc); }
244 AUE_NULL STD { int linux_get_thread_area(struct l_user_desc *desc); }
245 AUE_NULL UNIMPL linux_io_setup