]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: cpu_topo: work around a small bug in musl's CPU_ISSET()
authorWilly Tarreau <w@1wt.eu>
Sat, 6 Sep 2025 08:50:31 +0000 (10:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 6 Sep 2025 09:05:52 +0000 (11:05 +0200)
commit75bd9255dd04d9247f1e555023cc45f5e17936ca
treef1726b137a710c66da2d2d77b92c9f9c47ad991b
parentd7dea408c64c327cab6aebf4ccad93405b675565
BUG/MINOR: cpu_topo: work around a small bug in musl's CPU_ISSET()

As found in GH issue #3103, CPU_ISSET() on musl 1.25 doesn't match the man
page which says it's returning an int. The reason is pretty simple, it's
a macro that operates on the bits directly and returns the result of the
bit field applied to the mask as an unsigned long. Bits above 31 will
simply be dropped if returned as an int, which causes CPUs 32..63 to
appear as absent from cpu_sets.

The fix is trivial, it consists in just comparing the result against zero
(i.e. turning it to a boolean), but before it's merged and deployed we'll
have to face such deployments, so better implement the same workaround
in the code here since we have access to the raw long value.

This workaround should be backported to 3.0.
src/cpuset.c