This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Calls to getpid() in clone'd child return parent's pid.
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: libc-ports at sourceware dot org
- Date: Wed, 13 Sep 2006 22:10:31 -0400
- Subject: Calls to getpid() in clone'd child return parent's pid.
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=sDSq17QOQgRYMKblq9OJLslEIm3qzPjdc6PNw17uT5d0Sxt/zkX8NS/ExD5Djhst5UICIXBbU/QZhblpI+ZAXr8eSQBs1lvsWxh/kaHNv5jV5jPRolr45fATykUIdYDKFzlApmtegUvg8HPCZVVtZ40Oh1dwEaJvi+0bUCxbxAc=
libc-ports,
For the following tests:
nptl/tst-align2.c
nptl/tst-getpid1.c
nptl/tst-getpid2.c
I'm seeing that calls to getpid() in the clone'd child return the parent's pid.
If I make a raw syscall e.g. syscall(__NR_getpid), this returns the correct
pid. Is this problem indicative of anything in particular?
For example on hppa-linux, the cloned child will inhereit the value of the
parents thread register. The nptl getpid() wrapper will therefore return
the parents pid.
How is this supposed to work when the clone flags are zero?
Cheers,
Carlos.