Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-83017

glibc: Add pthread_gettid_np to libc_nonshared.a [rhel-9]

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • glibc-2.34-176.el9
    • Low
    • Hide
      74d463c50bb1096efef47022405c7db33f83fb5a
      6e30efe570f1ba135747c6d8f4004e78cd24c49c
      Show
      74d463c50bb1096efef47022405c7db33f83fb5a 6e30efe570f1ba135747c6d8f4004e78cd24c49c
    • 2
    • rhel-pt-c-libs
    • ssg_platform_tools
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • PT Libraries 2025 S04, PT Libraries 2025 S05
    • Enhancement
    • Hide
      .`glibc pthread_gettid_np` function added to `libc_nonshared.a`

      Previously, there was no direct method to obtain the Linux task or thread ID (TID) from a glibc ‎`pthread_t` handle. The newly implemented ‎`pthread_gettid_np` function, declared in ‎`<pthread.h>` when ‎`_GNU_SOURCE` is defined, now allows applications that require TID, such as those using ‎`sched_setattr`, to retrieve the TID value directly from a ‎`pthread_t` handle.

      As a result, applications can now use functions that expect a TID after obtaining it from a ‎`pthread_t` handle, improving compatibility and simplifying thread management.
      Show
      .`glibc pthread_gettid_np` function added to `libc_nonshared.a` Previously, there was no direct method to obtain the Linux task or thread ID (TID) from a glibc ‎`pthread_t` handle. The newly implemented ‎`pthread_gettid_np` function, declared in ‎`<pthread.h>` when ‎`_GNU_SOURCE` is defined, now allows applications that require TID, such as those using ‎`sched_setattr`, to retrieve the TID value directly from a ‎`pthread_t` handle. As a result, applications can now use functions that expect a TID after obtaining it from a ‎`pthread_t` handle, improving compatibility and simplifying thread management.
    • Done
    • Done
    • Unspecified
    • Done
    • None

      We are adding sched_setattr and sched_getattr under RHEL-56627, but these functions need a TID and cannot work on a pthread_t. If upstream accepts pthread_gettid_np, we should add it downstream as well:

      We can do this in an ABI-preserving manner by implementing the function in libc_nonshared.a on top of pthread_getcpuclockid.

              skolosov@redhat.com Sergey Kolosov
              fweimer@redhat.com Florian Weimer
              Angana Chakraborty
              Platform Tools - Libraries Bot Platform Tools - Libraries Bot
              Sergey Kolosov Sergey Kolosov
              Malhar Jivrajani Malhar Jivrajani
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: