2003-05-22 Roland McGrath <roland@redhat.com>
* process.c (sys_clone): Mask CSIGNAL out of flags and print that separately using signame. * process.c (internal_clone) [TCB_CLONE_THREAD]: Use ARG_FLAGS instead of literal 0 for index. Consult the right flags without clobbering anything when we reparent the new child to the caller's parent thread.
This commit is contained in:
parent
031b0d88cf
commit
984154d246
58
process.c
58
process.c
@ -565,8 +565,10 @@ struct tcb *tcp;
|
||||
tcp->u_arg[ARG_STACKSIZE]);
|
||||
# endif
|
||||
tprintf("flags=");
|
||||
if (printflags(clone_flags, flags) == 0)
|
||||
if (printflags(clone_flags, flags &~ CSIGNAL) == 0)
|
||||
tprintf("0");
|
||||
if ((flags & CSIGNAL) != 0)
|
||||
tprintf("|%s", signame(flags & CSIGNAL));
|
||||
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|
||||
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
|
||||
return 0;
|
||||
@ -845,29 +847,37 @@ Process %u resumed (parent %d ready)\n",
|
||||
}
|
||||
|
||||
#ifdef TCB_CLONE_THREAD
|
||||
if ((tcp->flags & TCB_CLONE_THREAD) && tcp->parent != NULL) {
|
||||
/* The parent in this clone is itself a thread
|
||||
belonging to another process. There is no
|
||||
meaning to the parentage relationship of the new
|
||||
child with the thread, only with the process.
|
||||
We associate the new thread with our parent.
|
||||
Since this is done for every new thread, there
|
||||
will never be a TCB_CLONE_THREAD process that
|
||||
has children. */
|
||||
--tcp->nchildren;
|
||||
tcp->u_arg[0] = tcp->parent->u_arg[0];
|
||||
tcp = tcp->parent;
|
||||
tcpchild->parent = tcp;
|
||||
++tcp->nchildren;
|
||||
}
|
||||
|
||||
if (tcp->u_arg[0] & CLONE_THREAD) {
|
||||
tcpchild->flags |= TCB_CLONE_THREAD;
|
||||
++tcp->nclone_threads;
|
||||
}
|
||||
if (tcp->u_arg[0] & CLONE_DETACHED) {
|
||||
tcpchild->flags |= TCB_CLONE_DETACHED;
|
||||
++tcp->nclone_detached;
|
||||
{
|
||||
/*
|
||||
* Save the flags used in this call,
|
||||
* in case we point TCP to our parent below.
|
||||
*/
|
||||
int call_flags = tcp->u_arg[ARG_FLAGS];
|
||||
if ((tcp->flags & TCB_CLONE_THREAD) &&
|
||||
tcp->parent != NULL) {
|
||||
/* The parent in this clone is itself a
|
||||
thread belonging to another process.
|
||||
There is no meaning to the parentage
|
||||
relationship of the new child with the
|
||||
thread, only with the process. We
|
||||
associate the new thread with our
|
||||
parent. Since this is done for every
|
||||
new thread, there will never be a
|
||||
TCB_CLONE_THREAD process that has
|
||||
children. */
|
||||
--tcp->nchildren;
|
||||
tcp = tcp->parent;
|
||||
tcpchild->parent = tcp;
|
||||
++tcp->nchildren;
|
||||
}
|
||||
if (call_flags & CLONE_THREAD) {
|
||||
tcpchild->flags |= TCB_CLONE_THREAD;
|
||||
++tcp->nclone_threads;
|
||||
}
|
||||
if (call_flags & CLONE_DETACHED) {
|
||||
tcpchild->flags |= TCB_CLONE_DETACHED;
|
||||
++tcp->nclone_detached;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user