summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
authorEric Norum <WENorum@lbl.gov>2006-04-27 18:17:20 +0000
committerEric Norum <WENorum@lbl.gov>2006-04-27 18:17:20 +0000
commit32293d692996ada60e2967718158dc1040f97e89 (patch)
tree544c24b469f23736c5a956d86d8e1bc1d98be775 /cpukit/libmisc
parent2006-04-18 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-32293d692996ada60e2967718158dc1040f97e89.tar.bz2
Add ability to free information on task delete.
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/capture/capture.c29
-rw-r--r--cpukit/libmisc/capture/capture.h15
2 files changed, 36 insertions, 8 deletions
diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index c9f337afc1..3e571382f5 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -79,6 +79,7 @@ static rtems_task_priority capture_ceiling;
static rtems_task_priority capture_floor;
static uint32_t capture_tick_period;
static rtems_id capture_reader;
+int rtems_capture_free_info_on_task_delete;
/*
* RTEMS Event text.
@@ -289,7 +290,7 @@ rtems_capture_create_control (rtems_name name, rtems_id id)
* We need to scan the task list as set the control to the
* tasks.
*/
- for (task = capture_tasks; task != NULL; task = task->next)
+ for (task = capture_tasks; task != NULL; task = task->forw)
if (rtems_capture_match_name_id (name, id, task->name, task->id))
task->control = control;
@@ -345,7 +346,10 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
rtems_interrupt_disable (level);
- task->next = capture_tasks;
+ task->forw = capture_tasks;
+ if (task->forw)
+ task->forw->back = task;
+ task->back = NULL;
capture_tasks = task;
rtems_interrupt_enable (level);
@@ -586,6 +590,19 @@ rtems_capture_delete_task (rtems_tcb* current_task,
* This task's tcb will be invalid.
*/
dt->tcb = 0;
+
+ /*
+ * Unlink
+ */
+ if (rtems_capture_free_info_on_task_delete) {
+ if (dt->forw)
+ dt->forw->back = dt->back;
+ if (dt->back)
+ dt->back->forw = dt->forw;
+ else
+ capture_tasks = dt->forw;
+ _Workspace_Free (dt);
+ }
}
/*
@@ -685,7 +702,7 @@ rtems_capture_switch_task (rtems_tcb* current_task,
{
rtems_id ct_id = current_task->Object.id;
- for (ct = capture_tasks; ct; ct = ct->next)
+ for (ct = capture_tasks; ct; ct = ct->forw)
if (ct->id == ct_id)
break;
}
@@ -926,7 +943,7 @@ rtems_capture_close ()
while (task)
{
rtems_capture_task_t* delete = task;
- task = task->next;
+ task = task->forw;
_Workspace_Free (delete);
}
@@ -998,7 +1015,7 @@ rtems_capture_flush (rtems_boolean prime)
rtems_interrupt_disable (level);
- for (task = capture_tasks; task != NULL; task = task->next)
+ for (task = capture_tasks; task != NULL; task = task->forw)
task->flags &= ~RTEMS_CAPTURE_TRACED;
if (prime)
@@ -1075,7 +1092,7 @@ rtems_capture_watch_del (rtems_name name, rtems_id id)
{
rtems_interrupt_disable (level);
- for (task = capture_tasks; task != NULL; task = task->next)
+ for (task = capture_tasks; task != NULL; task = task->forw)
if (task->control == control)
task->control = 0;
diff --git a/cpukit/libmisc/capture/capture.h b/cpukit/libmisc/capture/capture.h
index 406eb41de1..6db1ee89f3 100644
--- a/cpukit/libmisc/capture/capture.h
+++ b/cpukit/libmisc/capture/capture.h
@@ -103,7 +103,8 @@ typedef struct rtems_capture_task_s
uint32_t last_ticks;
uint32_t last_tick_offset;
rtems_capture_control_t* control;
- struct rtems_capture_task_s* next;
+ struct rtems_capture_task_s* forw;
+ struct rtems_capture_task_s* back;
} rtems_capture_task_t;
/**
@@ -192,6 +193,16 @@ rtems_capture_open (uint32_t size,
rtems_capture_timestamp timestamp);
/**
+ * rtems_capture_free_info_on_task_delete
+ *
+ * DESCRIPTION:
+ *
+ * If non-zero task informaion if freed when a task is deleted.
+ *
+ */
+extern int rtems_capture_free_info_on_task_delete;
+
+/**
* rtems_capture_close
*
* DESCRIPTION:
@@ -458,7 +469,7 @@ rtems_capture_get_task_list ();
static inline rtems_capture_task_t*
rtems_capture_next_task (rtems_capture_task_t* task)
{
- return task->next;
+ return task->forw;
}
/**