| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: linux_sched.c,v 1.58 2008/10/25 23:38:28 christos Exp $ */ | | 1 | /* $NetBSD: linux_sched.c,v 1.58.10.1 2009/06/19 21:41:33 snj 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 |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | /* | | 33 | /* |
34 | * Linux compatibility module. Try to deal with scheduler related syscalls. | | 34 | * Linux compatibility module. Try to deal with scheduler related syscalls. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.58 2008/10/25 23:38:28 christos Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.58.10.1 2009/06/19 21:41:33 snj Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/mount.h> | | 41 | #include <sys/mount.h> |
42 | #include <sys/proc.h> | | 42 | #include <sys/proc.h> |
43 | #include <sys/systm.h> | | 43 | #include <sys/systm.h> |
44 | #include <sys/sysctl.h> | | 44 | #include <sys/sysctl.h> |
45 | #include <sys/malloc.h> | | 45 | #include <sys/malloc.h> |
46 | #include <sys/syscallargs.h> | | 46 | #include <sys/syscallargs.h> |
47 | #include <sys/wait.h> | | 47 | #include <sys/wait.h> |
48 | #include <sys/kauth.h> | | 48 | #include <sys/kauth.h> |
49 | #include <sys/ptrace.h> | | 49 | #include <sys/ptrace.h> |
50 | | | 50 | |
51 | #include <sys/cpu.h> | | 51 | #include <sys/cpu.h> |
| @@ -636,32 +636,31 @@ linux_sys_sched_getaffinity(struct lwp * | | | @@ -636,32 +636,31 @@ linux_sys_sched_getaffinity(struct lwp * |
636 | if (pfind(SCARG(uap, pid)) == NULL) | | 636 | if (pfind(SCARG(uap, pid)) == NULL) |
637 | return ESRCH; | | 637 | return ESRCH; |
638 | | | 638 | |
639 | /* | | 639 | /* |
640 | * return the actual number of CPU, tag all of them as available | | 640 | * return the actual number of CPU, tag all of them as available |
641 | * The result is a mask, the first CPU being in the least significant | | 641 | * The result is a mask, the first CPU being in the least significant |
642 | * bit. | | 642 | * bit. |
643 | */ | | 643 | */ |
644 | ret = (1 << ncpu) - 1; | | 644 | ret = (1 << ncpu) - 1; |
645 | data = malloc(SCARG(uap, len), M_TEMP, M_WAITOK|M_ZERO); | | 645 | data = malloc(SCARG(uap, len), M_TEMP, M_WAITOK|M_ZERO); |
646 | retp = (int *)&data[SCARG(uap, len) - sizeof(ret)]; | | 646 | retp = (int *)&data[SCARG(uap, len) - sizeof(ret)]; |
647 | *retp = ret; | | 647 | *retp = ret; |
648 | | | 648 | |
649 | if ((error = copyout(data, SCARG(uap, mask), SCARG(uap, len))) != 0) | | 649 | error = copyout(data, SCARG(uap, mask), SCARG(uap, len)); |
650 | return error; | | | |
651 | | | 650 | |
652 | free(data, M_TEMP); | | 651 | free(data, M_TEMP); |
653 | | | 652 | |
654 | return 0; | | 653 | return error; |
655 | | | 654 | |
656 | } | | 655 | } |
657 | | | 656 | |
658 | int | | 657 | int |
659 | linux_sys_sched_setaffinity(struct lwp *l, const struct linux_sys_sched_setaffinity_args *uap, register_t *retval) | | 658 | linux_sys_sched_setaffinity(struct lwp *l, const struct linux_sys_sched_setaffinity_args *uap, register_t *retval) |
660 | { | | 659 | { |
661 | /* { | | 660 | /* { |
662 | syscallarg(pid_t) pid; | | 661 | syscallarg(pid_t) pid; |
663 | syscallarg(unsigned int) len; | | 662 | syscallarg(unsigned int) len; |
664 | syscallarg(unsigned long *) mask; | | 663 | syscallarg(unsigned long *) mask; |
665 | } */ | | 664 | } */ |
666 | | | 665 | |
667 | if (pfind(SCARG(uap, pid)) == NULL) | | 666 | if (pfind(SCARG(uap, pid)) == NULL) |