link-check sched_setaffinity
RFC PATCH 1/1 link-check sched_setaffinity
Hi,
as indicated earlier, there is an issue with uClibc from the blackfin
distribution: AC_TRY_COMPILE succeeds, but linking later on fails.
So my suggestion is to try to link already during configure (and test for missing defines differently).
Jan
configure.in +2 -2
@@ -516,12 +516,12 @@ AC_CACHE_VAL(ac_cv_sched_setaffinity, save_CFLAGS="$CFLAGS" CFLAGS="-Wimplicit-function-declaration -Werror -D_GNU_SOURCE" - [AC_TRY_COMPILE([#include <sched.h>], + [AC_TRY_LINK([#include <sched.h>], [cpu_set_t cpu_set; sched_setaffinity(0, sizeof(cpu_set), &cpu_set);], [ac_cv_sched_setaffinity=new], [ac_cv_sched_setaffinity=bad])] if test $ac_cv_sched_setaffinity = bad ; then - [AC_TRY_COMPILE([#include <sched.h>], + [AC_TRY_LINK([#include <sched.h>], [cpu_set_t cpu_set; sched_setaffinity(0, &cpu_set);], [ac_cv_sched_setaffinity=old], [ac_cv_sched_setaffinity=no])]
testsuite/switchtest/switchtest.c +2 -0
@@ -27,8 +27,10 @@typedef unsigned long cpu_set_t ;#endif #define do_sched_setaffinity (pid,len,mask) 0 +#ifndef CPU_ZERO #define CPU_ZERO (set) do { *(set) = 0; } while(0)#define CPU_SET (n,set) do { *(set) |= (1 << n); } while(0) +#endif #endif /* HAVE_OLD_SETAFFINITY */ #endif /* HAVE_RECENT_SETAFFINITY */
testsuite/clocktest/clocktest.c +3 -0
@@ -18,6 +18,7 @@#include <errno.h> #include <pthread.h> +#include <sched.h> #include <signal.h> #include <stdio.h> #include <stdlib.h>
@@ -35,8 +36,10 @@typedef unsigned long cpu_set_t ;#endif #define sched_setaffinity (pid, len, mask) do { } while (0) +#ifndef CPU_ZERO #define CPU_ZERO (set) memset(set, 0, sizeof(*set))#define CPU_SET (n, set) do { } while (0) +#endif #endif /* !HAVE_OLD_SETAFFINITY */ #endif /* !HAVE_RECENT_SETAFFINITY */