lkml.org 
[lkml]   [2010]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PROBLEM: getpid() returning same value as getppid()
On 16:45 Wed 26 May     , Sébastien Paumier wrote:
> Hi,
> here is a bug that occurs on my kernel 2.6.31-21, maybe with older ones.
> If a C program contains a function with the constructor attribute that
> calls getpid(), then, a call to syscall(SYS_fork) produces a son that
> obtains the same value calling getpid() or getppid().

The GNU C library caches the results of getpid, which is probably the
cause of your grief. This cache relies on the glibc wrappers for fork
and friends, which you have bypassed by using syscall directly.

--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-05-26 17:19    [W:0.042 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site