[lttng-dev] [RFC PATCH 1/1] check if set_schedaffinity works in configure.ac

Nathan Lynch Nathan_Lynch at mentor.com
Mon Jun 9 14:59:56 EDT 2014


On 06/08/2014 03:31 PM, Pranith Kumar wrote:
> +    AS_IF([test "x$sched_set_affinity_args" = "x3"], [
> +        # test if sched_setaffinity works
> +        AC_MSG_CHECKING([if sched_setaffinity works])
> +        AC_RUN_IFELSE([AC_LANG_SOURCE([[
> +                #include <sched.h>
> +                int main()
> +                {
> +                    cpu_set_t foo;
> +                    return sched_setaffinity(0, sizeof (foo), &foo);

This passes uninitialized stack memory to the system call; the return
value is unpredictable.

If it turns out that such a test is necessary, it should probably call
sched_getaffinity first and pass the result to sched_setaffinity.




More information about the lttng-dev mailing list