[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100526151651.GA21197@elliptictech.com>
Date: Wed, 26 May 2010 11:16:51 -0400
From: Nick Bowler <nbowler@...iptictech.com>
To: Sébastien Paumier
<sebastien.paumier@...v-mlv.fr>
Cc: linux-kernel@...r.kernel.org
Subject: Re: 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists