summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2011-12-06 19:49:34 +0100
committerEike Rathke <erack@redhat.com>2011-12-07 17:19:54 +0100
commit63a30059d30871ef1fc1920cb9fd17c2d23996c2 (patch)
tree0e8b6525f1769199c22cde7d8e093e45a80327fb /sal
parent0451f4cfa683d6fa8491ae05bd206927e3b567a2 (diff)
Don't replace getpid on Linux when the system version is correct
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/system.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c
index 478fdaf520bb..d1fc724e5f0f 100644
--- a/sal/osl/unx/system.c
+++ b/sal/osl/unx/system.c
@@ -201,14 +201,16 @@ int macxp_resolveAlias(char *path, int buflen)
#endif /* NO_PTHREAD_RTL */
-#if defined(LINUX)
-/* The linux kernel thread implemention, always return the pid of the
- thread subprocess and not of the main process. So we save the main
- pid at startup
+#if defined(LINUX) && defined (__GLIBC__) && __GLIBC__ == 2 || __GLIBC_MINOR__ < 4
+/* The linux kernel 2.4 getpid implemention always return the pid of the
+ thread subprocess and not of the main process, the NPTL implementation
+ with a Linux kernel 2.6 kernel return the pid. So when possibly
+ their is the wrong implementation of getpid, we save the pid at startup.
FIXME: when our Linux base-line is above:
- + Linux kernel version 2.6.18 or higher; -> clone() for NTPL
- + glibc2 version 2.5 or higher; -> NPTL
+ + Linux kernel version 2.6 or higher; -> clone() for NTPL
+ + glibc2 version 2.4 or higher; -> No longer LinuxThreads, only NPTL
Then we get a working getpid() and can remove this hack.
+ FIXME: getppid is also wrong in this situation
*/
// Directly from libc.so.6, obviously missing from some unistd.h: