From: Jens Axboe Date: Tue, 30 Mar 2021 23:38:02 +0000 (-0600) Subject: configure: add test case for pthread_getaffinity_np() X-Git-Tag: fio-3.27~28 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=deb859d67f4951614037969d2657f30c50667936 configure: add test case for pthread_getaffinity_np() Signed-off-by: Jens Axboe --- diff --git a/configure b/configure index 2f5ac91f..a7d82be0 100755 --- a/configure +++ b/configure @@ -418,6 +418,7 @@ CYGWIN*) clock_monotonic="yes" sched_idle="yes" pthread_condattr_setclock="no" + pthread_affinity="no" ;; esac @@ -803,6 +804,29 @@ elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then fi print_config "pthread_sigmask()" "$pthread_sigmask" +########################################## +# pthread_getaffinity_np() probe +if test "$pthread_getaffinity" != "yes" ; then + pthread_getaffinity="no" +fi +cat > $TMPC < /* NULL */ +#include /* pthread_sigmask() */ +#include +int main(void) +{ + cpu_set_t set; + return pthread_getaffinity_np(pthread_self(), sizeof(set), &set); +} +EOF +if compile_prog "" "$LIBS" "pthread_getaffinity" ; then + pthread_getaffinity="yes" +elif compile_prog "" "$LIBS -lpthread" "pthread_getaffinity" ; then + pthread_getaffinity="yes" + LIBS="$LIBS -lpthread" +fi +print_config "pthread_getaffinity_np()" "$pthread_getaffinity" + ########################################## # solaris aio probe if test "$solaris_aio" != "yes" ; then @@ -2823,6 +2847,9 @@ fi if test "$pthread_sigmask" = "yes" ; then output_sym "CONFIG_PTHREAD_SIGMASK" fi +if test "$pthread_getaffinity" = "yes" ; then + output_sym "CONFIG_PTHREAD_GETAFFINITY" +fi if test "$have_asprintf" = "yes" ; then output_sym "CONFIG_HAVE_ASPRINTF" fi