Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Keep an autoconf check for pthread_setname_np() #4103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dridi
Copy link
Member

@dridi dridi commented May 7, 2024

It is not portable by definition, so we should keep the guards.

dridi added 2 commits May 7, 2024 09:52
This reverts commit 41cdd27.

Even though everybody has a pthread_setname_np(3), they are different
and not portable by definition. The safeguards should be preserved
since THR_SetName() will at least allow a panic to get the thread name.
We can rely on pthread_setname_np() for all the platforms we care about.
The nested preprocessor conditions for pthread_setname_np are indented
to improve readability.

Better diff with the --ignore-all-space option.
@bsdphk
Copy link
Contributor

bsdphk commented May 13, 2024

First apologies for confusing everybody with a sign-error on the underscore

There is no reason to retain this check because all relevant platforms today have pthread_setname_np() and if somebody wants to port varnish to a new platform, they will have to provide a pthread_setname_np() function.

Please also note that the "_np" suffix literally means "POSIX is stuck in the 1990'ies where some people ran VMS", it doesnt mean that all contemporary platforms do not have it.

@nigoroll
Copy link
Member

nigoroll commented Jun 4, 2024

FTR, I just hit this on a not-so-recent SmartOS

cache/cache_main.c: In function 'THR_SetName':
cache/cache_main.c:142:2: error: implicit declaration of function 'pthread_setname_np' [-Werror=implicit-function-declaration]
  (void)pthread_setname_np(pthread_self(), name);
  ^

@dridi
Copy link
Member Author

dridi commented Jun 4, 2024

The THR_SetName() function still serves the purpose of stashing the thread name that is displayed in a panic in the absence of pthread_setname_np().

@catap
Copy link
Contributor

catap commented Nov 7, 2024

FYI: Just hit this on OpenBSD.

@catap catap mentioned this pull request Nov 7, 2024
15 tasks
@nigoroll
Copy link
Member

bugwash: @walid-git to resolve conflicts and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants