summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2011-12-06 19:49:34 +0100
committerTor Lillqvist <tlillqvist@suse.com>2011-12-07 10:37:38 +0200
commit8538a096603341d78e7c104dacf3048ad7fb953b (patch)
tree22b172886e667cc8a2332e4a2d2f2da0b79ebe02 /sal
parenta2eb0cf44bbd15ae24f9423d3bc6e420691c300d (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: