Drop nclone_detached and related flags
Remove nclone_detached since CLONE_DETACHED flag was no-op for a very long time in kernel. * defs.h (struct tcb): Remove nclone_detached field. Remove TCB_CLONE_DETACHED flag. * process.c: Remove CLONE_DETACHED flag. (clone_flags): Remove CLONE_DETACHED entry. (internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED flag and nclone_detached. * strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit): Likewise. Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
This commit is contained in:
parent
ffd2b30926
commit
21b8db4eb9
2
defs.h
2
defs.h
@ -336,7 +336,6 @@ struct tcb {
|
||||
int nzombies; /* # of formerly traced children now dead */
|
||||
#ifdef LINUX
|
||||
int nclone_threads; /* # of nchildren with CLONE_THREAD */
|
||||
int nclone_detached; /* # of nchildren with CLONE_DETACHED */
|
||||
int nclone_waiting; /* clone threads in wait4 (TCB_SUSPENDED) */
|
||||
#endif
|
||||
/* (1st arg of wait4()) */
|
||||
@ -382,7 +381,6 @@ struct tcb {
|
||||
|| defined(ARM) || defined(MIPS) || defined(BFIN) || defined(TILE)
|
||||
# define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
|
||||
# endif
|
||||
# define TCB_CLONE_DETACHED 04000 /* CLONE_DETACHED set in creating syscall */
|
||||
# define TCB_CLONE_THREAD 010000 /* CLONE_THREAD set in creating syscall */
|
||||
# define TCB_GROUP_EXITING 020000 /* TCB_EXITING was exit_group, not _exit */
|
||||
# include <sys/syscall.h>
|
||||
|
10
process.c
10
process.c
@ -555,7 +555,6 @@ struct tcb *tcp;
|
||||
#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
|
||||
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
|
||||
#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
|
||||
#define CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */
|
||||
#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
|
||||
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
|
||||
|
||||
@ -574,7 +573,6 @@ static const struct xlat clone_flags[] = {
|
||||
{ CLONE_SETTLS, "CLONE_SETTLS" },
|
||||
{ CLONE_PARENT_SETTID,"CLONE_PARENT_SETTID" },
|
||||
{ CLONE_CHILD_CLEARTID,"CLONE_CHILD_CLEARTID" },
|
||||
{ CLONE_DETACHED, "CLONE_DETACHED" },
|
||||
{ CLONE_UNTRACED, "CLONE_UNTRACED" },
|
||||
{ CLONE_CHILD_SETTID,"CLONE_CHILD_SETTID" },
|
||||
{ 0, NULL },
|
||||
@ -911,10 +909,6 @@ Process %u resumed (parent %d ready)\n",
|
||||
tcpchild->flags |= TCB_CLONE_THREAD;
|
||||
++tcp->nclone_threads;
|
||||
}
|
||||
if (call_flags & CLONE_DETACHED) {
|
||||
tcpchild->flags |= TCB_CLONE_DETACHED;
|
||||
++tcp->nclone_detached;
|
||||
}
|
||||
if ((call_flags & CLONE_PARENT) &&
|
||||
!(call_flags & CLONE_THREAD)) {
|
||||
--tcp->nchildren;
|
||||
@ -1932,9 +1926,9 @@ int flagarg;
|
||||
if (tcp->flags & TCB_CLONE_THREAD)
|
||||
/* The children we wait for are our parent's children. */
|
||||
got_kids = (tcp->parent->nchildren
|
||||
> (tcp->parent->nclone_detached + tcp->parent->nclone_threads));
|
||||
> tcp->parent->nclone_threads);
|
||||
else
|
||||
got_kids = (tcp->nchildren > (tcp->nclone_detached + tcp->nclone_threads));
|
||||
got_kids = (tcp->nchildren > tcp->nclone_threads);
|
||||
#else
|
||||
got_kids = tcp->nchildren > 0;
|
||||
#endif
|
||||
|
14
strace.c
14
strace.c
@ -443,10 +443,9 @@ startup_attach(void)
|
||||
++nerr;
|
||||
else if (tid != tcbtab[tcbi]->pid) {
|
||||
tcp = alloctcb(tid);
|
||||
tcp->flags |= TCB_ATTACHED|TCB_CLONE_THREAD|TCB_CLONE_DETACHED|TCB_FOLLOWFORK;
|
||||
tcp->flags |= TCB_ATTACHED|TCB_CLONE_THREAD|TCB_FOLLOWFORK;
|
||||
tcbtab[tcbi]->nchildren++;
|
||||
tcbtab[tcbi]->nclone_threads++;
|
||||
tcbtab[tcbi]->nclone_detached++;
|
||||
tcp->parent = tcbtab[tcbi];
|
||||
}
|
||||
if (interactive) {
|
||||
@ -1028,7 +1027,7 @@ alloc_tcb(int pid, int command_options_parsed)
|
||||
tcp->nchildren = 0;
|
||||
tcp->nzombies = 0;
|
||||
#ifdef TCB_CLONE_THREAD
|
||||
tcp->nclone_threads = tcp->nclone_detached = 0;
|
||||
tcp->nclone_threads = 0;
|
||||
tcp->nclone_waiting = 0;
|
||||
#endif
|
||||
tcp->flags = TCB_INUSE | TCB_STARTUP;
|
||||
@ -1396,15 +1395,10 @@ struct tcb *tcp;
|
||||
if (tcp->parent != NULL) {
|
||||
tcp->parent->nchildren--;
|
||||
#ifdef TCB_CLONE_THREAD
|
||||
if (tcp->flags & TCB_CLONE_DETACHED)
|
||||
tcp->parent->nclone_detached--;
|
||||
if (tcp->flags & TCB_CLONE_THREAD)
|
||||
tcp->parent->nclone_threads--;
|
||||
#endif
|
||||
#ifdef TCB_CLONE_DETACHED
|
||||
if (!(tcp->flags & TCB_CLONE_DETACHED))
|
||||
#endif
|
||||
tcp->parent->nzombies++;
|
||||
tcp->parent->nzombies++;
|
||||
#ifdef LINUX
|
||||
/* Update `tcp->parent->parent->nchildren' and the other fields
|
||||
like NCLONE_DETACHED, only for zombie group leader that has
|
||||
@ -2232,8 +2226,6 @@ handle_group_exit(struct tcb *tcp, int sig)
|
||||
|
||||
if (tcp->flags & TCB_CLONE_THREAD)
|
||||
leader = tcp->parent;
|
||||
else if (tcp->nclone_detached > 0)
|
||||
leader = tcp;
|
||||
|
||||
if (sig < 0) {
|
||||
if (leader != NULL && leader != tcp
|
||||
|
Loading…
x
Reference in New Issue
Block a user