Re: detect presence/version of nptl
Anand Palaniswamy <[email protected]>
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
> From: Ulrich Drepper <[email protected]> > Date: Sun, 16 Feb 2003 12:59:19 -0800 > > I've been asked to provide a mechanism to dynamically detect whether > nptl is used and which version. > > With the current CVS sources you can use confstr() with the key > _CS_GNU_LIBPTHREAD_VERSION to get just that information. It'll return a > string like "NPTL 0.22" or "linuxthreads-0.10". This should provide all > the info you need. There is also _CS_GNU_LIBC_VERSION for those who > need that. How about binaries built with headers from glibc-2.2.x that have to run with any one of glibc-2.2.x-LT and glibc-2.3.x-{LT,NPTL}. Is there a reliable way for such an application to determine at runtime if it is running with NPTL? On a related note, if anyone from redhat who does builds is listening, confstr(_CS_GNU_LIBPTHREAD_VERSION) doesn't work right on RedHat rawhide RPMS, don't have RedHat 9 here. $ rpm -q glibc nptl-devel glibc-2.3.2-11.9 nptl-devel-2.3.2-11.9 $ cat conf.c #include <pthread.h> #include <stdio.h> #include <unistd.h> int main() { char v[64]; confstr(_CS_GNU_LIBPTHREAD_VERSION, v, sizeof(v)); printf("version: %s\n", v); return 0; } $ cc conf.c -lpthread $ (export LD_LIBRARY_PATH=/lib/i686; ldd ./a.out | grep thread; ./a.out) libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40017000) version: NPTL 0.29