diff --git a/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c b/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c index 9eca03bae2b0..56ab7364af2a 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c @@ -36,6 +36,46 @@ __RCSID("$NetBSD: t_cpuset.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $"); #include #include +#ifdef __FreeBSD__ +#include + +#include + +#define cpuset_create() calloc(1, sizeof(cpuset_t)) +#define cpuset_destroy(cs) free(cs) + +static inline int +cpuset_set(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + CPU_SET(i, cs); + return (0); +} + +static inline int +cpuset_clr(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + CPU_CLR(i, cs); + return (0); +} + +static inline int +cpuset_isset(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + return (CPU_ISSET(i, cs)); +} + +#define cpuset_size(cs) sizeof(*cs) +#endif + ATF_TC(cpuset_err); ATF_TC_HEAD(cpuset_err, tc) { diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile index 2096f2066e52..a808f6617ec7 100644 --- a/lib/libc/tests/gen/Makefile +++ b/lib/libc/tests/gen/Makefile @@ -20,7 +20,7 @@ ATF_TESTS_C+= realpath2_test ATF_TESTS_C+= sigsetops_test ATF_TESTS_C+= wordexp_test -# TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, +# TODO: t_closefrom, t_fmtcheck, t_randomid, # TODO: t_siginfo (fixes require further inspection) # TODO: t_sethostname_test (consistently screws up the hostname) @@ -47,6 +47,7 @@ CFLAGS+= -D__HAVE_LONG_DOUBLE NETBSD_ATF_TESTS_C= alarm_test NETBSD_ATF_TESTS_C+= assert_test NETBSD_ATF_TESTS_C+= basedirname_test +NETBSD_ATF_TESTS_C+= cpuset_test NETBSD_ATF_TESTS_C+= dir_test NETBSD_ATF_TESTS_C+= floatunditf_test NETBSD_ATF_TESTS_C+= fnmatch_test