Re: Using getpid() often, another way? [was Re: clone() <-> getpid() bug in 2.6?]

David Mosberger
2004-06-07T23:27:36Z

>>>>> On Mon, 07 Jun 2004 19:02:34 -0400, Russell Leighton <russ@elegant-software.com> said:

Russell> So Ia64 does have it..that's good. Does glibc wrap it?

Here is how it works at the user-level:

- There _is_ a clone(), with the original interface. However,
this version only works when you create a new address-space.

- There is clone2(), which adds the extra "size" argument. This
one works for all cases.

Russell> I agree with the above...could glibc's clone() should have
Russell> a size added? Then the arch specific stack issues could be
Russell> hidden.

In my opinion, it would make sense for all platforms to support
clone2(), since it's more in line with the normal UNIX-convention of
specifying stacks as a memory-range (e.g., see stack_t). So far, the
interest in doing this has been lack-luster (and, IIRC, Linus was
against it in the past, so I haven't spent a lot of effort on it).

--david