From 87a2c8d1bfc10a00ba5f9d8003c5a49ad89005b7 Mon Sep 17 00:00:00 2001 From: brooks Date: Thu, 10 Jul 2008 17:45:57 +0000 Subject: id_t is a 64-bit integer and thus is passed as two arguments like off_t is. As a result, those arguments must be recombined before calling the real syscal implementation. This change fixes 32-bit compatibility for cpuset_getid(), cpuset_setid(), cpuset_getaffinity(), and cpuset_setaffinity(). --- sys/compat/freebsd32/freebsd32_misc.c | 57 +++++++++++++++++++++++++++++++++++ sys/compat/freebsd32/syscalls.master | 20 +++++++----- 2 files changed, 70 insertions(+), 7 deletions(-) (limited to 'sys/compat/freebsd32') diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 59bfb05..38af651 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2495,6 +2495,63 @@ freebsd32_sigwaitinfo(struct thread *td, struct freebsd32_sigwaitinfo_args *uap) return (error); } +int +freebsd32_cpuset_setid(struct thread *td, + struct freebsd32_cpuset_setid_args *uap) +{ + struct cpuset_setid_args ap; + + ap.which = uap->which; + ap.id = (uap->idlo | ((id_t)uap->idhi << 32)); + ap.setid = uap->setid; + + return cpuset_setid(td, &ap); +} + +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 = (uap->idlo | ((id_t)uap->idhi << 32)); + ap.setid = uap->setid; + + return cpuset_getid(td, &ap); +} + +int +freebsd32_cpuset_getaffinity(struct thread *td, + struct freebsd32_cpuset_getaffinity_args *uap) +{ + struct cpuset_getaffinity_args ap; + + ap.level = uap->level; + ap.which = uap->which; + ap.id = (uap->idlo | ((id_t)uap->idhi << 32)); + ap.cpusetsize = uap->cpusetsize; + ap.mask = uap->mask; + + return cpuset_getaffinity(td, &ap); +} + +int +freebsd32_cpuset_setaffinity(struct thread *td, + struct freebsd32_cpuset_setaffinity_args *uap) +{ + struct cpuset_setaffinity_args ap; + + ap.level = uap->level; + ap.which = uap->which; + ap.id = (uap->idlo | ((id_t)uap->idhi << 32)); + ap.cpusetsize = uap->cpusetsize; + ap.mask = uap->mask; + + return cpuset_setaffinity(td, &ap); +} + #if 0 int diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 85cb626..5ab7e42 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -799,16 +799,22 @@ mode_t mode); } 483 AUE_SHMUNLINK NOPROTO { int shm_unlink(const char *path); } 484 AUE_NULL NOPROTO { int cpuset(cpusetid_t *setid); } -485 AUE_NULL NOPROTO { int cpuset_setid(cpuwhich_t which, id_t id, \ +485 AUE_NULL STD { int freebsd32_cpuset_setid(cpuwhich_t which, \ + uint32_t idlo, uint32_t idhi, \ cpusetid_t setid); } -486 AUE_NULL NOPROTO { int cpuset_getid(cpulevel_t level, \ - cpuwhich_t which, id_t id, \ +486 AUE_NULL STD { int freebsd32_cpuset_getid(cpulevel_t level, \ + cpuwhich_t which, \ + uint32_t idlo, uint32_t idhi, \ cpusetid_t *setid); } -487 AUE_NULL NOPROTO { int cpuset_getaffinity(cpulevel_t level, \ - cpuwhich_t which, id_t id, size_t cpusetsize, \ +487 AUE_NULL STD { int freebsd32_cpuset_getaffinity( \ + cpulevel_t level, cpuwhich_t which, \ + uint32_t idlo, uint32_t idhi, \ + size_t cpusetsize, \ cpuset_t *mask); } -488 AUE_NULL NOPROTO { int cpuset_setaffinity(cpulevel_t level, \ - cpuwhich_t which, id_t id, size_t cpusetsize, \ +488 AUE_NULL STD { int freebsd32_cpuset_setaffinity( \ + cpulevel_t level, cpuwhich_t which, \ + uint32_t idlo, uint32_t idhi, \ + size_t cpusetsize, \ const cpuset_t *mask); } 489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int mode, \ int flag); } -- cgit v1.1