From owner-p4-projects@FreeBSD.ORG Tue Mar 6 21:54:13 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9C45E16A414; Tue, 6 Mar 2007 21:54:13 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F9FC16A40A for ; Tue, 6 Mar 2007 21:54:13 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB9513C4BE for ; Tue, 6 Mar 2007 21:54:13 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l26LsCZM037370 for ; Tue, 6 Mar 2007 21:54:12 GMT (envelope-from jkim@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l26LsCVY037367 for perforce@freebsd.org; Tue, 6 Mar 2007 21:54:12 GMT (envelope-from jkim@freebsd.org) Date: Tue, 6 Mar 2007 21:54:12 GMT Message-Id: <200703062154.l26LsCVY037367@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jkim@freebsd.org using -f From: Jung-uk Kim To: Perforce Change Reviews Cc: Subject: PERFORCE change 115443 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2007 21:54:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=115443 Change 115443 by jkim@jkim_hammer on 2007/03/06 21:54:06 Add rudimentary sched_getaffinity() support. With this change, Linux JDK 1.5.0 works again in 2.6.16 emulation. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_proto.h#20 edit .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_syscall.h#20 edit .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysent.c#19 edit .. //depot/projects/linuxolator/src/sys/amd64/linux32/syscalls.master#20 edit .. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#62 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_proto.h#20 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_syscall.h#19 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_sysent.c#19 edit .. //depot/projects/linuxolator/src/sys/i386/linux/syscalls.master#19 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_proto.h#20 (text+ko) ==== @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.29 2007/02/15 01:15:31 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.26 2007/02/15 01:13:36 jkim Exp */ @@ -740,6 +740,11 @@ char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)]; char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)]; }; +struct linux_sched_getaffinity_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char cpusetsize_l_[PADL_(l_uint)]; l_uint cpusetsize; char cpusetsize_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_ulong *)]; l_ulong * mask; char mask_r_[PADR_(l_ulong *)]; +}; struct linux_set_thread_area_args { char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)]; }; @@ -1130,6 +1135,7 @@ int linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *); int linux_tkill(struct thread *, struct linux_tkill_args *); int linux_sys_futex(struct thread *, struct linux_sys_futex_args *); +int linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *); int linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *); int linux_io_setup(struct thread *, struct linux_io_setup_args *); int linux_io_destroy(struct thread *, struct linux_io_destroy_args *); @@ -1383,6 +1389,7 @@ #define LINUX_SYS_AUE_linux_fremovexattr AUE_NULL #define LINUX_SYS_AUE_linux_tkill AUE_NULL #define LINUX_SYS_AUE_linux_sys_futex AUE_NULL +#define LINUX_SYS_AUE_linux_sched_getaffinity AUE_NULL #define LINUX_SYS_AUE_linux_set_thread_area AUE_NULL #define LINUX_SYS_AUE_linux_io_setup AUE_NULL #define LINUX_SYS_AUE_linux_io_destroy AUE_NULL ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_syscall.h#20 (text+ko) ==== @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.29 2007/02/15 01:15:31 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.26 2007/02/15 01:13:36 jkim Exp */ @@ -222,6 +222,7 @@ #define LINUX_SYS_linux_fremovexattr 237 #define LINUX_SYS_linux_tkill 238 #define LINUX_SYS_linux_sys_futex 240 +#define LINUX_SYS_linux_sched_getaffinity 242 #define LINUX_SYS_linux_set_thread_area 243 #define LINUX_SYS_linux_io_setup 245 #define LINUX_SYS_linux_io_destroy 246 ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysent.c#19 (text+ko) ==== @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.29 2007/02/15 01:15:31 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.26 2007/02/15 01:13:36 jkim Exp */ @@ -262,7 +262,7 @@ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 239 = linux_sendfile64 */ { AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 }, /* 240 = linux_sys_futex */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 241 = linux_sched_setaffinity */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 242 = linux_sched_getaffinity */ + { AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0 }, /* 242 = linux_sched_getaffinity */ { AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0 }, /* 243 = linux_set_thread_area */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 244 = linux_get_thread_area */ { AS(linux_io_setup_args), (sy_call_t *)linux_io_setup, AUE_NULL, NULL, 0, 0 }, /* 245 = linux_io_setup */ ==== //depot/projects/linuxolator/src/sys/amd64/linux32/syscalls.master#20 (text+ko) ==== @@ -407,9 +407,10 @@ 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } 239 AUE_SENDFILE UNIMPL linux_sendfile64 240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } + 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 cpusetsize, \ + l_ulong *mask); } 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 STD { int linux_io_setup(l_uint nr_reqs, linux_aio_context_t *ctxp); } ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#62 (text+ko) ==== @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -1736,6 +1737,25 @@ } int +linux_sched_getaffinity(struct thread *td, + struct linux_sched_getaffinity_args *args) +{ + l_ulong mask; + int i; + + if (PTRIN(args->mask) == NULL) + return (EFAULT); + if (args->cpusetsize < (l_uint)sizeof(cpumask_t)) + return (EINVAL); + + /* We do not support process affinity yet. Just allow all for now. */ + for (i = mp_ncpus, mask = 0; i > 0; i--) + mask |= 1 << (i - 1); + + return (copyout(&mask, args->mask, sizeof(l_ulong))); +} + +int linux_chroot(struct thread *td, struct linux_chroot_args *args) { return (chroot(td, (struct chroot_args *)args)); ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_proto.h#20 (text+ko) ==== @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.91 2007/02/15 00:57:03 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp */ @@ -737,6 +737,11 @@ char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)]; char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)]; }; +struct linux_sched_getaffinity_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char cpusetsize_l_[PADL_(l_uint)]; l_uint cpusetsize; char cpusetsize_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_ulong *)]; l_ulong * mask; char mask_r_[PADR_(l_ulong *)]; +}; struct linux_set_thread_area_args { char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)]; }; @@ -1149,6 +1154,7 @@ int linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *); int linux_tkill(struct thread *, struct linux_tkill_args *); int linux_sys_futex(struct thread *, struct linux_sys_futex_args *); +int linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *); int linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *); int linux_get_thread_area(struct thread *, struct linux_get_thread_area_args *); int linux_io_setup(struct thread *, struct linux_io_setup_args *); @@ -1403,6 +1409,7 @@ #define LINUX_SYS_AUE_linux_fremovexattr AUE_NULL #define LINUX_SYS_AUE_linux_tkill AUE_NULL #define LINUX_SYS_AUE_linux_sys_futex AUE_NULL +#define LINUX_SYS_AUE_linux_sched_getaffinity AUE_NULL #define LINUX_SYS_AUE_linux_set_thread_area AUE_NULL #define LINUX_SYS_AUE_linux_get_thread_area AUE_NULL #define LINUX_SYS_AUE_linux_io_setup AUE_NULL ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_syscall.h#19 (text+ko) ==== @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.84 2007/02/15 00:57:04 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp */ @@ -228,6 +228,7 @@ #define LINUX_SYS_linux_fremovexattr 237 #define LINUX_SYS_linux_tkill 238 #define LINUX_SYS_linux_sys_futex 240 +#define LINUX_SYS_linux_sched_getaffinity 242 #define LINUX_SYS_linux_set_thread_area 243 #define LINUX_SYS_linux_get_thread_area 244 #define LINUX_SYS_linux_io_setup 245 ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_sysent.c#19 (text+ko) ==== @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.91 2007/02/15 00:57:04 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp */ @@ -261,7 +261,7 @@ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 239 = linux_sendfile64 */ { AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 }, /* 240 = linux_sys_futex */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 241 = linux_sched_setaffinity */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 242 = linux_sched_getaffinity */ + { AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0 }, /* 242 = linux_sched_getaffinity */ { AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0 }, /* 243 = linux_set_thread_area */ { AS(linux_get_thread_area_args), (sy_call_t *)linux_get_thread_area, AUE_NULL, NULL, 0, 0 }, /* 244 = linux_get_thread_area */ { AS(linux_io_setup_args), (sy_call_t *)linux_io_setup, AUE_NULL, NULL, 0, 0 }, /* 245 = linux_io_setup */ ==== //depot/projects/linuxolator/src/sys/i386/linux/syscalls.master#19 (text+ko) ==== @@ -409,9 +409,10 @@ 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } 239 AUE_SENDFILE UNIMPL linux_sendfile64 240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } + 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 cpusetsize, \ + l_ulong *mask); } 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 STD { int linux_io_setup(l_uint nr_reqs, linux_aio_context_t *ctxp); }