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

Bernd Eckenfels
2004-06-06T09:52:13Z

In article <Pine.LNX.4.58.0406052244290.7010@ppc970.osdl.org> you wrote:
> It literally does things like
>
> random = now() + (getpid() << 16);

It does that for the unique filenames and id stamps (maildir format and
message ids). But it should be easy to replace this with a cached getpid
result, if this is realy a performance problem. On a traditional unix system
pid and timestamp should be locally unique for non threaded applications.

> Anyway, you did find something that used more than a handful of getpid()
> calls, but no, it doesn't qualify as performance-critical, and even
> despite it's peyote-induced (or hey, some people are just crazy on their
> own) getpid() usage, it's not a reason to have a buggy glibc.

I wonder if it easyly would be possible to cache the getpid() result in some
thread local segment. Is there any, which is present for all clone flags?
Not tha I care much about this unneeded glibc optimizsation, but more out of
curiousity about the new threadind functionality.

Greetings
Bernd
--
eckes privat - http://www.eckes.org/
Project Freefire - http://www.freefire.org/