From 41c7f80337bb477215ee93d777455ff2757ca0cb Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 11 Aug 2004 16:35:44 +0000 Subject: [PATCH] desactivate exit_process until we have the release_task event git-svn-id: http://ltt.polymtl.ca/svn@698 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 43 +++++++++++++++++------------ ltt/branches/poly/lttv/lttv/state.h | 3 -- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index aa204e8a..ec529848 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -814,27 +814,20 @@ lttv_state_create_process(LttvTracefileState *tfs, LttvProcessState *parent, return process; } -LttvProcessState * -lttv_state_find_process_from_trace(LttvTraceState *ts, GQuark cpu, guint pid) +LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, + guint pid) { LttvProcessState key; LttvProcessState *process; + LttvTraceState* ts = (LttvTraceState*)tfs->parent.t_context; + key.pid = pid; - key.last_cpu = cpu; + key.last_cpu = tfs->cpu_name; process = g_hash_table_lookup(ts->processes, &key); return process; } - -LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, - guint pid) -{ - LttvTraceState *ts =(LttvTraceState *)tfs->parent.t_context; - return lttv_state_find_process_from_trace(ts, tfs->cpu_name, pid); -} - - LttvProcessState * lttv_state_find_process_or_create(LttvTracefileState *tfs, guint pid) { @@ -844,7 +837,16 @@ lttv_state_find_process_or_create(LttvTracefileState *tfs, guint pid) return process; } - +/* FIXME : this function should be called when we receive an event telling that + * release_task has been called in the kernel. In happens generally when + * the parent waits for its child terminaison, but may also happen in special + * cases in the child's exit : when the parent ignores its children SIGCCHLD or + * has the flag SA_NOCLDWAIT. It can also happen when the child is part + * of a killed thread ground, but isn't the leader. + * + * This function is important : it removes the dead PID entry in the hash + * table so there is no collision when the OS reuses PID. + */ static void exit_process(LttvTracefileState *tfs, LttvProcessState *process) { LttvTraceState *ts = LTTV_TRACE_STATE(tfs->parent.t_context); @@ -970,10 +972,17 @@ static gboolean schedchange(void *hook_data, void *call_data) g_assert(s->process->pid == 0); } - if(state_out == 0) s->process->state->s = LTTV_STATE_WAIT_CPU; - else if(s->process->state->s == LTTV_STATE_EXIT) - exit_process(s, s->process); - else s->process->state->s = LTTV_STATE_WAIT; + if(s->process->state->s != LTTV_STATE_EXIT) { + if(state_out == 0) s->process->state->s = LTTV_STATE_WAIT_CPU; + else s->process->state->s = LTTV_STATE_WAIT; + } /* FIXME : we do not remove process here, because the kernel + * still has them : they may be zombies. We need to know + * exactly when release_task is executed on the PID to + * know when the zombie is destroyed. We should rename STATE_EXIT + * for STATE_ZOMBIE. + */ + //else + // exit_process(s, s->process); s->process->state->change = s->parent.timestamp; } diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index a88e2997..9d1415a1 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -155,9 +155,6 @@ typedef struct _LttvProcessState { LttvProcessState * lttv_state_find_process(LttvTracefileState *tfs, guint pid); -LttvProcessState * -lttv_state_find_process_from_trace(LttvTraceState *ts, GQuark cpu, guint pid); - LttvProcessState * lttv_state_find_process_or_create(LttvTracefileState *tfs, guint pid); -- 2.34.1