NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/59723: Our pthread_setname_np() requires 3 args, everybody else has 2
>Number: 59723
>Category: lib
>Synopsis: Our pthread_setname_np() requires 3 args, everybody else has 2
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 25 15:25:00 +0000 2025
>Originator: Rhialto
>Release: NetBSD 10.1
>Organization:
>Environment:
System: NetBSD murthe.falu.nl 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
I ran into a program that does this:
#ifdef _GNU_SOURCE
pthread_setname_np(pthread_self(), "USBSID Thread");
#endif
while also using devel/SDL. `sdl-config --cflags` includes
-D_GNU_SOURCE=1.
This errored out with
CXX USBSID.o
../../../../vice/src/lib/libusbsiddrv/USBSID.cpp: In member function 'void* USBSID_NS::USBSID_Class::USBSID_Thread()':
../../../../vice/src/lib/libusbsiddrv/USBSID.cpp:623:21: error: too few arguments to function 'int pthread_setname_np(pthread_t, const char*, void*)'
623 | pthread_setname_np(pthread_self(), "USBSID Thread");
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
Other OSes seem to use only 2 arguments for pthread_setname_np():
FreeBSD: https://man.freebsd.org/cgi/man.cgi?query=pthread_setname_np&apropos=0&sektion=0&manpath=FreeBSD+14.3-RELEASE+and+Ports&arch=default&format=html
Linux: https://manpages.debian.org/bullseye/manpages-dev/pthread_setname_np.3.en.html
OpenBSD doesn't seem to have the function (or at least no manpage on
https://man.openbsd.org/)
On irc #netbsd, this was found:
changeset: 512354:f7dffed1422c
branch: trunk
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Feb 26 22:02:48 2003 +0000
summary: Add support for naming a thread, using an API
compatible with Tru64 Unix:
https://archive.org/details/CompaqTru64UNIX51GuidetothePOSIXThreadsLibraryARH9RBTE2000/page/n389/mode/2up
In src-public this is changeset: 136073:f7dffed1422c.
(It looks like Tru64 and NetBSD were first, but the precedent was
ignored by the other OSes...)
>How-To-Repeat:
Build a the code as quoted above, or get the current svn version of
the VICE emulator and compile it with the SDL GUI.
>Fix:
A suggestion was to make it
pthread_setname_np(t, formatstring, ...<varargs>...)
instead.
That ought to be compatible with our usage and also with the other's.
-Olaf.
--
___ Olaf 'Rhialto' Seibert <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work. --I. Rose
Home |
Main Index |
Thread Index |
Old Index