Index: head/sys/compat/freebsd32/freebsd32_misc.c =================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c +++ head/sys/compat/freebsd32/freebsd32_misc.c @@ -2556,27 +2556,18 @@ freebsd32_cpuset_setid(struct thread *td, struct freebsd32_cpuset_setid_args *uap) { - struct cpuset_setid_args ap; - ap.which = uap->which; - ap.id = PAIR32TO64(id_t,uap->id); - ap.setid = uap->setid; - - return (sys_cpuset_setid(td, &ap)); + return (kern_cpuset_setid(td, uap->which, + PAIR32TO64(id_t, uap->id), uap->setid)); } int freebsd32_cpuset_getid(struct thread *td, struct freebsd32_cpuset_getid_args *uap) { - struct cpuset_getid_args ap; - - ap.level = uap->level; - ap.which = uap->which; - ap.id = PAIR32TO64(id_t,uap->id); - ap.setid = uap->setid; - return (sys_cpuset_getid(td, &ap)); + return (kern_cpuset_getid(td, uap->level, uap->which, + PAIR32TO64(id_t, uap->id), uap->setid)); } int Index: head/sys/kern/kern_cpuset.c =================================================================== --- head/sys/kern/kern_cpuset.c +++ head/sys/kern/kern_cpuset.c @@ -976,18 +976,26 @@ int sys_cpuset_setid(struct thread *td, struct cpuset_setid_args *uap) { + + return (kern_cpuset_setid(td, uap->which, uap->id, uap->setid)); +} + +int +kern_cpuset_setid(struct thread *td, cpuwhich_t which, + id_t id, cpusetid_t setid) +{ struct cpuset *set; int error; /* * Presently we only support per-process sets. */ - if (uap->which != CPU_WHICH_PID) + if (which != CPU_WHICH_PID) return (EINVAL); - set = cpuset_lookup(uap->setid, td); + set = cpuset_lookup(setid, td); if (set == NULL) return (ESRCH); - error = cpuset_setproc(uap->id, set, NULL); + error = cpuset_setproc(id, set, NULL); cpuset_rel(set); return (error); } @@ -1003,19 +1011,28 @@ int sys_cpuset_getid(struct thread *td, struct cpuset_getid_args *uap) { + + return (kern_cpuset_getid(td, uap->level, uap->which, uap->id, + uap->setid)); +} + +int +kern_cpuset_getid(struct thread *td, cpulevel_t level, cpuwhich_t which, + id_t id, cpusetid_t *setid) +{ struct cpuset *nset; struct cpuset *set; struct thread *ttd; struct proc *p; - cpusetid_t id; + cpusetid_t tmpid; int error; - if (uap->level == CPU_LEVEL_WHICH && uap->which != CPU_WHICH_CPUSET) + if (level == CPU_LEVEL_WHICH && which != CPU_WHICH_CPUSET) return (EINVAL); - error = cpuset_which(uap->which, uap->id, &p, &ttd, &set); + error = cpuset_which(which, id, &p, &ttd, &set); if (error) return (error); - switch (uap->which) { + switch (which) { case CPU_WHICH_TID: case CPU_WHICH_PID: thread_lock(ttd); @@ -1030,7 +1047,7 @@ case CPU_WHICH_DOMAIN: return (EINVAL); } - switch (uap->level) { + switch (level) { case CPU_LEVEL_ROOT: nset = cpuset_refroot(set); cpuset_rel(set); @@ -1041,10 +1058,10 @@ case CPU_LEVEL_WHICH: break; } - id = set->cs_id; + tmpid = set->cs_id; cpuset_rel(set); if (error == 0) - error = copyout(&id, uap->setid, sizeof(id)); + error = copyout(&tmpid, setid, sizeof(id)); return (error); } Index: head/sys/sys/syscallsubr.h =================================================================== --- head/sys/sys/syscallsubr.h +++ head/sys/sys/syscallsubr.h @@ -86,6 +86,10 @@ int kern_close(struct thread *td, int fd); int kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa); +int kern_cpuset_getid(struct thread *td, cpulevel_t level, + cpuwhich_t which, id_t id, cpusetid_t *setid); +int kern_cpuset_setid(struct thread *td, cpuwhich_t which, + id_t id, cpusetid_t setid); int kern_dup(struct thread *td, u_int mode, int flags, int old, int new); int kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p);