Skip to content

Conversation

@outtersg
Copy link

@outtersg outtersg commented Nov 9, 2025

On some FreeBSDs, configure could not detect <sys/cpuset.h>, because it tried to include it without <sys/param.h>, while (as seen in the man page for cpuset_setaffinity()), they should work in pair.

Why?

This is likely due to an autoconf bug:
the historic list of headers included by AC_INCLUDES_DEFAULT ends with <sys/stat.h> and <unistd.h>, without <sys/param.h>,
while in paradox ac_header_cxx_list defines the HAVE_…_H macros until HAVE_SYS_TYPES_H, HAVE_UNISTD_H, plus HAVE_SYS_PARAM_H.

What happens?

However, the detection for the function cpuset_setaffinity() works well, in the same configure.

So we end up with:

  • HAVE_SYS_CPUSET_H undefined
    (→ no #include <sys/cpuset.h>),
  • while HAVE_CPUSET_SETAFFINITY is defined
    (→ in set_this_thread_affinity_and_priority(), the #elif defined(__FreeBSD__) && defined(HAVE_CPUSET_SETAFFINITY) block gets compiled).

→ The compilation fails with undefined types and macros.

Fixing

I put the test for <sys/cpuset.h> apart from the other includes, appending <sys/param.h> to the preincluded files, similarly to what openldap did for a similar need (for <ucred.h>).

inclusion of <sys/cpuset.h> from the configure failed because, as mentioned in cpuset_setaffinity's man page, it has to be included after <sys/param.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant