[Bug 238650] pthread_getthreadid_np lacks libc stub
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Jun 17 08:47:10 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238650
Bug ID: 238650
Summary: pthread_getthreadid_np lacks libc stub
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Keywords: needs-patch
Severity: Affects Only Me
Priority: ---
Component: threads
Assignee: threads at FreeBSD.org
Reporter: jbeich at FreeBSD.org
A consumer may want to avoid -lpthread dependency if thread ID is not critical
e.g., only used for tracing/debugging.
Example:
https://github.com/freebsd/freebsd-ports/blob/d1e16f7b264b/multimedia/libva/files/patch-va_va__trace.c
Environment:
$ cat a.c
#include <stdio.h>
#include <pthread_np.h>
int main()
{
printf("%d\n", pthread_getthreadid_np());
return 0;
}
FreeBSD:
$ cc a.c
ld: error: undefined symbol: pthread_getthreadid_np
>>> referenced by a.c
>>> /tmp/a-104ade.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
$ cc a.c -pthread
$ ./a.out
101610
DragonFly:
$ cc a.c
$ ./a.out
0
$ cc a.c -pthread
$ ./a.out
1
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-threads
mailing list