From: Wang Chao Date: Thu, 5 Aug 2010 06:58:37 +0000 (+0800) Subject: Handle CLONE_PARENT flag X-Git-Tag: v4.6~97 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a22b31a60e9defa39df2672c89768fa85543276;p=strace Handle CLONE_PARENT flag * process.c (internal_fork): The parent of new cloned process is the same of the calling process when CLONE_PARENT is set. --- diff --git a/process.c b/process.c index f503ec5c..59d7ba04 100644 --- a/process.c +++ b/process.c @@ -915,6 +915,16 @@ Process %u resumed (parent %d ready)\n", tcpchild->flags |= TCB_CLONE_DETACHED; ++tcp->nclone_detached; } + if ((call_flags & CLONE_PARENT) && + !(call_flags & CLONE_THREAD)) { + --tcp->nchildren; + tcpchild->parent = NULL; + if (tcp->parent != NULL) { + tcp = tcp->parent; + tcpchild->parent = tcp; + ++tcp->nchildren; + } + } } #endif /* TCB_CLONE_THREAD */ }