OSDN Git Service

Generalize the clone function slightly.
authorElliott Hughes <enh@google.com>
Fri, 6 May 2016 22:55:36 +0000 (15:55 -0700)
committerElliott Hughes <enh@google.com>
Fri, 6 May 2016 23:37:00 +0000 (16:37 -0700)
commite104a2edf3c459b2e79e86d4de388fb7a1efe198
tree4f50d2627e6f47f6908561114d95b32a168691bc
parent5ac45a2add41fd7c1640815accf09a29bd14aac6
Generalize the clone function slightly.

* Allow clone where both the child function and stack are null. It's
obviously wrong to ask to call a function without a stack, but it's not
necessarily wrong to supply no stack if you're also not supplying a
function.

* Reimplement fork in terms of the clone function, rather than using the
clone system call directly.

This is intended as a step towards enabling use of pid namespaces.

Change-Id: I03c89bd1dc540d8b4ed1c8fdf6644290744b9e91
libc/bionic/clone.cpp
libc/bionic/fork.cpp
tests/sched_test.cpp