| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: linux_sched.c,v 1.37.2.1 2007/03/28 20:38:41 jdc Exp $ */ | | 1 | /* $NetBSD: linux_sched.c,v 1.37.2.1.6.1 2009/06/21 11:22:41 bouyer Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center; by Matthias Scheler. | | 9 | * NASA Ames Research Center; by Matthias Scheler. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
37 | * POSSIBILITY OF SUCH DAMAGE. | | 37 | * POSSIBILITY OF SUCH DAMAGE. |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | /* | | 40 | /* |
41 | * Linux compatibility module. Try to deal with scheduler related syscalls. | | 41 | * Linux compatibility module. Try to deal with scheduler related syscalls. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/cdefs.h> | | 44 | #include <sys/cdefs.h> |
45 | __KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.37.2.1 2007/03/28 20:38:41 jdc Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.37.2.1.6.1 2009/06/21 11:22:41 bouyer Exp $"); |
46 | | | 46 | |
47 | #include <sys/param.h> | | 47 | #include <sys/param.h> |
48 | #include <sys/mount.h> | | 48 | #include <sys/mount.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
50 | #include <sys/systm.h> | | 50 | #include <sys/systm.h> |
51 | #include <sys/sysctl.h> | | 51 | #include <sys/sysctl.h> |
52 | #include <sys/malloc.h> | | 52 | #include <sys/malloc.h> |
53 | #include <sys/sa.h> | | 53 | #include <sys/sa.h> |
54 | #include <sys/syscallargs.h> | | 54 | #include <sys/syscallargs.h> |
55 | #include <sys/wait.h> | | 55 | #include <sys/wait.h> |
56 | #include <sys/kauth.h> | | 56 | #include <sys/kauth.h> |
57 | #include <sys/ptrace.h> | | 57 | #include <sys/ptrace.h> |
58 | | | 58 | |
| @@ -547,32 +547,31 @@ linux_sys_sched_getaffinity(l, v, retval | | | @@ -547,32 +547,31 @@ linux_sys_sched_getaffinity(l, v, retval |
547 | name[0] = CTL_HW; | | 547 | name[0] = CTL_HW; |
548 | name[1] = HW_NCPU; | | 548 | name[1] = HW_NCPU; |
549 | sz = sizeof(ncpu); | | 549 | sz = sizeof(ncpu); |
550 | | | 550 | |
551 | if ((error = old_sysctl(&name[0], 2, &ncpu, &sz, NULL, 0, NULL)) != 0) | | 551 | if ((error = old_sysctl(&name[0], 2, &ncpu, &sz, NULL, 0, NULL)) != 0) |
552 | return error; | | 552 | return error; |
553 | | | 553 | |
554 | ret = (1 << ncpu) - 1; | | 554 | ret = (1 << ncpu) - 1; |
555 | | | 555 | |
556 | data = malloc(SCARG(uap, len), M_TEMP, M_WAITOK|M_ZERO); | | 556 | data = malloc(SCARG(uap, len), M_TEMP, M_WAITOK|M_ZERO); |
557 | retp = (int *)&data[SCARG(uap, len) - sizeof(ret)]; | | 557 | retp = (int *)&data[SCARG(uap, len) - sizeof(ret)]; |
558 | *retp = ret; | | 558 | *retp = ret; |
559 | | | 559 | |
560 | if ((error = copyout(data, SCARG(uap, mask), SCARG(uap, len))) != 0) | | 560 | error = copyout(data, SCARG(uap, mask), SCARG(uap, len)); |
561 | return error; | | | |
562 | | | 561 | |
563 | free(data, M_TEMP); | | 562 | free(data, M_TEMP); |
564 | | | 563 | |
565 | return 0; | | 564 | return error; |
566 | | | 565 | |
567 | } | | 566 | } |
568 | | | 567 | |
569 | int | | 568 | int |
570 | linux_sys_sched_setaffinity(l, v, retval) | | 569 | linux_sys_sched_setaffinity(l, v, retval) |
571 | struct lwp *l; | | 570 | struct lwp *l; |
572 | void *v; | | 571 | void *v; |
573 | register_t *retval; | | 572 | register_t *retval; |
574 | { | | 573 | { |
575 | struct linux_sys_sched_setaffinity_args /* { | | 574 | struct linux_sys_sched_setaffinity_args /* { |
576 | syscallarg(pid_t) pid; | | 575 | syscallarg(pid_t) pid; |
577 | syscallarg(unsigned int) len; | | 576 | syscallarg(unsigned int) len; |
578 | syscallarg(unsigned long *) mask; | | 577 | syscallarg(unsigned long *) mask; |