Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jun 2019 08:47:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        threads@FreeBSD.org
Subject:   [Bug 238650] pthread_getthreadid_np lacks libc stub
Message-ID:  <bug-238650-13406@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238650

            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@FreeBSD.org
          Reporter: jbeich@FreeBSD.org

A consumer may want to avoid -lpthread dependency if thread ID is not criti=
cal
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 invocati=
on)

  $ cc a.c -pthread
  $ ./a.out
  101610

DragonFly:

  $ cc a.c
  $ ./a.out
  0

  $ cc a.c -pthread
  $ ./a.out
  1

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238650-13406>