Home > Blockchain >  How do I determine which version of glibc supports the functions I use?
How do I determine which version of glibc supports the functions I use?

Time:01-17

Some functions like pthread_setname_np, the manual will say that it was supported from glibc 2.12. But for some other functions, like pthread_self, the manual doesn't say which version it has been supported. How do I determine which version of glibc supports the functions I use ?

I tried to find information from glibc doc, but I can't find anything useful.

CodePudding user response:

Notice the CONFORMING TO section in the documentation.

A function like pthread_self is conforming to the POSIX standard, which means that it's probably going to be available in every version of glibc.

pthread_setname_np Isn't defined in POSIX, but is a later addition to the library, so it says what version it's available from.

AFAIK only functions that are not defined in POSIX were added in a late version of glibc, and it usually says in the docs what version they are available from.

CodePudding user response:

If you type man pthread_setname_np you can see a section like this

VERSIONS
       These functions first appeared in glibc in version 2.12.

Alternatively you can query libpthread for the versions stored

$ readelf -a /usr/lib/x86_64-linux-gnu/libpthread.so | grep pthread_setname_np
   188: 0000000000015580   293 FUNC    GLOBAL DEFAULT   16 pthread_setname_np@@GLIBC_2.12
   639: 0000000000015580   293 FUNC    GLOBAL DEFAULT   16 pthread_setname_np
  • Related