NPTL检查!
NPTL是Redhat在RHEL 3版本引入的线程特征!旨在取代LinuxThreads库!
这段是CentOS介绍的如何检查应用程序使用的是NPTL还是LinuxThreads,相信也适用于其他的NPTL实现系统!
这段是CentOS介绍的如何检查应用程序使用的是NPTL还是LinuxThreads,相信也适用于其他的NPTL实现系统!
- CentOS 3 introduced the Native POSIX Thread Library (NPTL) —
an implementation of POSIX threading support that greatly improved
performance, scalability, semantic correctness, and standards
compliance over the LinuxThreads implementation used previously.
While most threaded applications were not impacted by the
introduction of NPTL, applications that relied on those semantics of
LinuxThreads that were contrary to the POSIX specification would not
operate correctly. As noted at the time of NPTL's introduction, CentOS
recommended that such applications be updated so that they complied
with POSIX (and could therefore use NPTL.)
While support for LinuxThreads still exists for CentOS 4,
this statement serves as advance notice that CentOS 5 will no longer
include support for LinuxThreads. Therefore, applications that
require LinuxThreads support must be updated before they will be able
to work properly on a CentOS 5 system.Note
Several workarounds exist that permit applications requiring the
use of LinuxThreads to continue operation under CentOS 3 and 4.
These workarounds include:- Using the LD_ASSUME_KERNEL environment
variable to select LinuxThreads instead of NPTL at
runtime - Using an explicit rpath to /lib/i686/
or /lib/ to select LinuxThreads instead of
NPTL at runtime - Statically linking the application to use LinuxThreads
instead of NPTL (strongly
discouraged)
In order to determine whether an application is using NPTL or
LinuxThreads, add following two environment variables to the
application's environment:
LD_DEBUG=libs
LD_DEBUG_OUTPUT=<filename>
(Where
<filename>
is the name to be given to each debug output log file. More than
one file can be generated if the program forks other processes; all
debug output log filenames include the PID of process generating the
file.)
Then start the application and use it as you normally
would.
If no debug output log file was produced, the application is
statically linked. The application will not be affected by the
missing LinuxThreads DSO but, as with all statically linked
applications, no guarantees for compatibility are given if the
application dynamically loads any code (directly via
dlopen() or indirectly via NSS.)
If one or more debug output log files were produced, review each
one for any references to libpthread — in
particular, a line also containing the string
"calling init". The
grep utility can do this easily:
grep "calling init.*libpthread"
<filename>.*
(Where
<filename>
refers to the name used in the LD_DEBUG_OUTPUT
environment variable.)
If the path preceding libpthread is
/lib/tls/, the application is using NPTL, and
no further action needs to be taken. Any other path means that
LinuxThreads is being used, and the application must be updated and
rebuilt to support NPTL. - Using the LD_ASSUME_KERNEL environment
Comments