diff options
| author | Stefan Eßer <se@FreeBSD.org> | 2021-12-30 11:20:32 +0000 |
|---|---|---|
| committer | Stefan Eßer <se@FreeBSD.org> | 2021-12-30 11:20:32 +0000 |
| commit | e2650af157bc7489deaf2c9054995f0f88a6e5da (patch) | |
| tree | 21f452bd8fa6cfb4196cd06bab318092c9ea157b /lib | |
| parent | 133180557479cd9676758e6f3f93a9d3e1c6b532 (diff) | |
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/gen/Makefile.inc | 2 | ||||
| -rw-r--r-- | lib/libc/gen/Symbol.map | 2 | ||||
| -rw-r--r-- | lib/libc/gen/cpuset_alloc.c | 33 | ||||
| -rw-r--r-- | lib/libc/gen/cpuset_free.c | 33 | ||||
| -rw-r--r-- | lib/libc/gen/sched_getaffinity.c | 1 | ||||
| -rw-r--r-- | lib/libc/gen/sched_getcpu_gen.c | 1 | ||||
| -rw-r--r-- | lib/libc/gen/sched_setaffinity.c | 1 | ||||
| -rw-r--r-- | lib/libc/x86/sys/sched_getcpu_x86.c | 1 |
8 files changed, 70 insertions, 4 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 6a9e284b5860..fd8a0feeb748 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -30,6 +30,8 @@ SRCS+= __getosreldate.c \ clock_getcpuclockid.c \ closedir.c \ confstr.c \ + cpuset_alloc.c \ + cpuset_free.c \ crypt.c \ ctermid.c \ daemon.c \ diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 5554c32ab4f2..012c9ff11f04 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -442,6 +442,8 @@ FBSD_1.7 { sched_getaffinity; sched_setaffinity; sched_getcpu; + __cpuset_alloc; + __cpuset_free; }; FBSDprivate_1.0 { diff --git a/lib/libc/gen/cpuset_alloc.c b/lib/libc/gen/cpuset_alloc.c new file mode 100644 index 000000000000..ac307f07f263 --- /dev/null +++ b/lib/libc/gen/cpuset_alloc.c @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2021 Stefan Esser <se@FreeBSD.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdlib.h> +#include <sched.h> + +cpuset_t * +__cpuset_alloc(size_t ncpus) +{ + return (malloc(CPU_ALLOC_SIZE(ncpus))); +} diff --git a/lib/libc/gen/cpuset_free.c b/lib/libc/gen/cpuset_free.c new file mode 100644 index 000000000000..4cd993853241 --- /dev/null +++ b/lib/libc/gen/cpuset_free.c @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2021 Stefan Esser <se@FreeBSD.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdlib.h> +#include <sched.h> + +void +__cpuset_free(cpuset_t *ptr) +{ + free(ptr); +} diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c index 7fca53e39b4b..2ae8c5b763a3 100644 --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#define _WITH_CPU_SET_T #include <sched.h> int diff --git a/lib/libc/gen/sched_getcpu_gen.c b/lib/libc/gen/sched_getcpu_gen.c index 704075c0ae53..ef1bebc2915a 100644 --- a/lib/libc/gen/sched_getcpu_gen.c +++ b/lib/libc/gen/sched_getcpu_gen.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#define _WITH_CPU_SET_T #include <sched.h> #include "libc_private.h" diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c index 1c083b4b108a..52fc6d4bc811 100644 --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#define _WITH_CPU_SET_T #include <sched.h> int diff --git a/lib/libc/x86/sys/sched_getcpu_x86.c b/lib/libc/x86/sys/sched_getcpu_x86.c index 5e3bd5311734..13ba18ef5e36 100644 --- a/lib/libc/x86/sys/sched_getcpu_x86.c +++ b/lib/libc/x86/sys/sched_getcpu_x86.c @@ -32,7 +32,6 @@ #include <machine/sysarch.h> #include <x86/ifunc.h> #include <errno.h> -#define _WITH_CPU_SET_T #include <sched.h> #include "libc_private.h" |
