Re: clone() <-> getpid() bug in 2.6?

Davide Libenzi
2004-06-05T23:07:14Z

On Sat, 5 Jun 2004, Robert Love wrote:

> On Sat, 2004-06-05 at 14:53 -0700, Chris Wedgwood wrote:
>
> > glibc caches getpid() ?!?
> >
> > it's not like it's a slow syscall or used often
>
> It is almost certainly done to improve the speed of some stupid
> microbenchmark - say, one that just calls getpid() repeatedly (simple
> because it is NOT slow) to measure system call overhead.
>
> Or maybe libc uses the PID a lot internally. I don't know.
>
> But it sure seems wrong.

It is likely used by pthread_self(), that is pretty much performance
sensitive. I'd agree with Ulrich here.

- Davide