Skip to content

build, util: Add HAVE_PTHREAD_SETNAME_NP_2ARG configuration macro - #396

Merged
ryanofsky merged 2 commits into
bitcoin-core:masterfrom
hebasto:261115-setname_np2
Nov 16, 2026
Merged

ryanofsky merged 2 commits into
bitcoin-core:masterfrom
hebasto:261115-setname_np2

Conversation

@hebasto

@hebasto hebasto commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

On platforms that provide only the 2-argument pthread_setname_np() function, such as illumos, none of the branches in SetOsThreadName() matches, so threads are left unnamed. As pthread_getname_np() is available there, the thread name tests fail.

Introduce the HAVE_PTHREAD_SETNAME_NP_2ARG configuration macro, which represents the availability of that function, and use it in SetOsThreadName().

Platforms already handled by another branch are not affected.

Additionally, the first commit documents the platforms for every branch in SetOsThreadName(), as suggested by ryanofsky in #324.

@DrahtBot

DrahtBot commented Nov 15, 2026 •

Copy link
Copy Markdown

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK ryanofsky

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@hebasto
hebasto force-pushed the 261115-setname_np2 branch 3 times, most recently from 0231925 to 1a59d5d Compare November 15, 2026 18:02

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 1a59d5d. This fixes the "has OS thread name" tests on illumos, which have failed there since #324 added them: SetOsThreadName() had no branch for illumos's 2-argument pthread_setname_np(), so threads were left unnamed, while the tests still ran because pthread_getname_np() is available.

Thanks for adding the comments from #324, too!

Comment thread src/mp/util.cpp Resolved
Comment thread src/mp/util.cpp Resolved
On platforms that provide only the 2-argument `pthread_setname_np()`
function, such as illumos, none of the branches in `SetOsThreadName()`
matches, so threads are left unnamed. As `pthread_getname_np()` is
available there, the thread name tests fail.

Introduce the `HAVE_PTHREAD_SETNAME_NP_2ARG` configuration macro, which
represents the availability of that function, and use it in
`SetOsThreadName()`.

Platforms already handled by another branch are not affected.

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK fb0e194. This fixes the "has OS thread name" tests on illumos, confirmed by the OpenIndiana job in #393, which is now based on this PR and passes all three tests (its remaining failure is the unrelated listen test).

The only change since my last review is the expanded illumos comment, thanks!

@ryanofsky
ryanofsky merged commit d278634 into bitcoin-core:master Nov 16, 2026
14 checks passed
@hebasto
hebasto deleted the 261115-setname_np2 branch November 16, 2026 20:57
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.

3 participants