summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>1999-11-15 21:35:14 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>1999-11-15 21:35:14 +0000
commit2578970553ccf4e6e5e3088230684faec6f48006 (patch)
treef1265591057a5d85ccbf2b53b539f8b4ce58579c /c
parent1ae60eb4e6352fe6d8f567211a24229ecb716c56 (diff)
downloadrtems-2578970553ccf4e6e5e3088230684faec6f48006.tar.bz2
+ Fixed files to consistantly use a case of the location after calls
to ITRON_Task_Get. + Modified to consistantly call _ITRON_return_errorno with E_OK. + Optimized the code to not disable dispatch prior to checking input values.
Diffstat (limited to 'c')
-rw-r--r--c/src/exec/itron/src/can_wup.c6
-rw-r--r--c/src/exec/itron/src/chg_pri.c6
-rw-r--r--c/src/exec/itron/src/del_tsk.c7
-rw-r--r--c/src/exec/itron/src/frsm_tsk.c6
-rw-r--r--c/src/exec/itron/src/ref_tsk.c94
-rw-r--r--c/src/exec/itron/src/rel_wai.c7
-rw-r--r--c/src/exec/itron/src/rot_rdq.c6
-rw-r--r--c/src/exec/itron/src/rsm_tsk.c7
-rw-r--r--c/src/exec/itron/src/sta_tsk.c6
-rw-r--r--c/src/exec/itron/src/sus_tsk.c6
-rw-r--r--c/src/exec/itron/src/ter_tsk.c27
11 files changed, 97 insertions, 81 deletions
diff --git a/c/src/exec/itron/src/can_wup.c b/c/src/exec/itron/src/can_wup.c
index 61ef0dc259..13c64a62f8 100644
--- a/c/src/exec/itron/src/can_wup.c
+++ b/c/src/exec/itron/src/can_wup.c
@@ -32,15 +32,15 @@ ER can_wup(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
/*
* XXX - FILL ME IN.
*/
- _ITRON_return_errorno( E_OK );
+ break;
}
- _ITRON_return_errorno( E_OBJ ); /* XXX - Should never get here */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/chg_pri.c b/c/src/exec/itron/src/chg_pri.c
index abbc9f274a..37d9d8f172 100644
--- a/c/src/exec/itron/src/chg_pri.c
+++ b/c/src/exec/itron/src/chg_pri.c
@@ -33,7 +33,7 @@ ER chg_pri(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ));
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
if (_States_Is_dormant( the_thread->current_state ))
@@ -54,10 +54,10 @@ ER chg_pri(
the_thread->current_priority > new_priority )
_Thread_Change_priority( the_thread, new_priority, FALSE );
- _ITRON_return_errorno( E_OK );
+ break;
}
- _ITRON_return_errorno( E_OBJ ); /* XXX - Should never get here */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/del_tsk.c b/c/src/exec/itron/src/del_tsk.c
index c6a1397762..8cb0e98514 100644
--- a/c/src/exec/itron/src/del_tsk.c
+++ b/c/src/exec/itron/src/del_tsk.c
@@ -27,14 +27,13 @@ ER del_tsk(
{
register Thread_Control *the_thread;
Objects_Locations location;
- ER result;
+ ER result = E_OK; /* to avoid warning */
the_thread = _ITRON_Task_Get( tskid, &location );
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
- break;
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
@@ -48,6 +47,6 @@ ER del_tsk(
break;
}
- _ITRON_return_errorno( E_OK );
+ _ITRON_return_errorno( result );
}
diff --git a/c/src/exec/itron/src/frsm_tsk.c b/c/src/exec/itron/src/frsm_tsk.c
index 84f3575aa8..5ca9e2da4f 100644
--- a/c/src/exec/itron/src/frsm_tsk.c
+++ b/c/src/exec/itron/src/frsm_tsk.c
@@ -32,7 +32,7 @@ ER frsm_tsk(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
if ( _Thread_Is_executing( the_thread ) )
@@ -42,10 +42,10 @@ ER frsm_tsk(
_ITRON_return_errorno( E_OBJ );
_Thread_Resume( the_thread, TRUE );
- _ITRON_return_errorno( E_OK );
+ break;
}
- _ITRON_return_errorno( E_OBJ ); /* XXX - Should never get here */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/ref_tsk.c b/c/src/exec/itron/src/ref_tsk.c
index eee348412b..da30497904 100644
--- a/c/src/exec/itron/src/ref_tsk.c
+++ b/c/src/exec/itron/src/ref_tsk.c
@@ -34,49 +34,61 @@ ER ref_tsk(
return E_PAR;
the_thread = _ITRON_Task_Get( tskid, &location );
- if ( location != OBJECTS_LOCAL)
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
-
- /*
- * The following are extended functions [level X ].
- * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
- */
-
- pk_rtsk->tskwait = 0;
- pk_rtsk->wid = 0;
- pk_rtsk->wupcnt = 0;
- pk_rtsk->suscnt = the_thread->suspend_count;
- pk_rtsk->tskatr = 0;
- pk_rtsk->task = the_thread->Start.entry_point;
- core_priority = the_thread->Start.initial_priority;
- pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
- pk_rtsk->stksz = the_thread->Start.Initial_stack.size;
-
- /*
- * The following are required.
- */
-
- pk_rtsk->exinf = NULL; /* extended information */
- pk_rtsk->tskpri = _ITRON_Task_Core_to_Priority(the_thread->current_priority);
- pk_rtsk->tskstat = 0;
-
- /*
- * Mask in the tskstat information
- * Convert the task state XXX double check this
- */
-
- if ( the_thread == _Thread_Executing )
- pk_rtsk->tskstat |= TTS_RUN;
- if ((the_thread->current_state & STATES_READY) != 0)
- pk_rtsk->tskstat = TTS_RDY;
- if (_States_Is_dormant( the_thread->current_state ))
- pk_rtsk->tskstat = TTS_DMT;
- if ((the_thread->current_state & STATES_SUSPENDED) != 0)
- pk_rtsk->tskstat = TTS_SUS;
- if ((the_thread->current_state & STATES_BLOCKED) != 0)
- pk_rtsk->tskstat = TTS_WAI;
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+ case OBJECTS_ERROR:
+ return _ITRON_Task_Clarify_get_id_error( tskid );
+
+ case OBJECTS_LOCAL:
+
+ if ( location != OBJECTS_LOCAL )
+ return _ITRON_Task_Clarify_get_id_error( tskid );
+
+ /*
+ * The following are extended functions [level X ].
+ * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
+ */
+
+ pk_rtsk->tskwait = 0;
+ pk_rtsk->wid = 0;
+ pk_rtsk->wupcnt = 0;
+ pk_rtsk->suscnt = the_thread->suspend_count;
+ pk_rtsk->tskatr = 0; /* XXX - Not correctly implemented */
+ pk_rtsk->task = (FP) the_thread->Start.entry_point;
+ core_priority = the_thread->Start.initial_priority;
+ pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
+ pk_rtsk->stksz = the_thread->Start.Initial_stack.size;
+
+ /*
+ * The following are required.
+ */
+
+ pk_rtsk->exinf = NULL; /* extended information */
+ pk_rtsk->tskpri =
+ _ITRON_Task_Core_to_Priority(the_thread->current_priority);
+
+ /*
+ * Mask in the tskstat information
+ * Convert the task state XXX double check this
+ */
+
+ pk_rtsk->tskstat = 0;
+ if ( the_thread == _Thread_Executing )
+ pk_rtsk->tskstat |= TTS_RUN;
+ if ( _States_Is_ready(the_thread->current_state) )
+ pk_rtsk->tskstat |= TTS_RDY;
+ if ( _States_Is_dormant( the_thread->current_state) )
+ pk_rtsk->tskstat |= TTS_DMT;
+ if ( _States_Is_suspended(the_thread->current_state) )
+ pk_rtsk->tskstat |= TTS_SUS;
+ if ( _States_Is_blocked(the_thread->current_state) )
+ pk_rtsk->tskstat |= TTS_WAI;
+
+ break;
+ }
_ITRON_return_errorno( E_OK );
+
}
diff --git a/c/src/exec/itron/src/rel_wai.c b/c/src/exec/itron/src/rel_wai.c
index 1fb3cbbcd4..d845bcd310 100644
--- a/c/src/exec/itron/src/rel_wai.c
+++ b/c/src/exec/itron/src/rel_wai.c
@@ -31,16 +31,17 @@ ER rel_wai(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
/*
* XXX - FILL ME IN.
*/
- return E_OK;
+
+ break;
}
- return E_OBJ; /* XXX - Should never get here */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/rot_rdq.c b/c/src/exec/itron/src/rot_rdq.c
index ac6d89d55f..35008d53a2 100644
--- a/c/src/exec/itron/src/rot_rdq.c
+++ b/c/src/exec/itron/src/rot_rdq.c
@@ -27,15 +27,15 @@ ER rot_rdq(
PRI priority;
+ if (( tskpri <= 0 ) || ( tskpri >= 256 ))
+ return E_PAR;
+
_Thread_Disable_dispatch();
/*
* Yield of processor will rotate the queue for this processor.
*/
- if (( tskpri <= 0 ) || ( tskpri >= 256 ))
- _ITRON_return_errorno( E_PAR );
-
priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority);
if ( priority == tskpri )
_Thread_Yield_processor();
diff --git a/c/src/exec/itron/src/rsm_tsk.c b/c/src/exec/itron/src/rsm_tsk.c
index 98d96c4798..a9bdf57d6c 100644
--- a/c/src/exec/itron/src/rsm_tsk.c
+++ b/c/src/exec/itron/src/rsm_tsk.c
@@ -32,7 +32,7 @@ ER rsm_tsk(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
@@ -43,10 +43,9 @@ ER rsm_tsk(
_ITRON_return_errorno( E_OBJ );
_Thread_Resume( the_thread, FALSE );
- _Thread_Enable_dispatch();
- return E_OK;
+ break;
}
- return E_OBJ; /* XXX - Should never get here */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/sta_tsk.c b/c/src/exec/itron/src/sta_tsk.c
index 83592edf9a..aafa282161 100644
--- a/c/src/exec/itron/src/sta_tsk.c
+++ b/c/src/exec/itron/src/sta_tsk.c
@@ -34,7 +34,7 @@ ER sta_tsk(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
@@ -55,10 +55,10 @@ ER sta_tsk(
_ITRON_return_errorno( E_OBJ );
*/
- _ITRON_return_errorno( E_OK );
+ break;
}
- _ITRON_return_errorno( E_OBJ ); /* unreached - only to remove warnings */
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/sus_tsk.c b/c/src/exec/itron/src/sus_tsk.c
index f2ee948e0b..907b708843 100644
--- a/c/src/exec/itron/src/sus_tsk.c
+++ b/c/src/exec/itron/src/sus_tsk.c
@@ -36,7 +36,7 @@ ER sus_tsk(
switch ( location ) {
case OBJECTS_REMOTE:
case OBJECTS_ERROR:
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
+ return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
@@ -44,10 +44,10 @@ ER sus_tsk(
_ITRON_return_errorno( E_OBJ );
_Thread_Suspend( the_thread );
- _ITRON_return_errorno( E_OK );
+ break;
}
- _ITRON_return_errorno( E_OBJ );
+ _ITRON_return_errorno( E_OK );
}
diff --git a/c/src/exec/itron/src/ter_tsk.c b/c/src/exec/itron/src/ter_tsk.c
index e620338669..6c6f4c85c2 100644
--- a/c/src/exec/itron/src/ter_tsk.c
+++ b/c/src/exec/itron/src/ter_tsk.c
@@ -29,20 +29,25 @@ ER ter_tsk(
Objects_Locations location;
the_thread = _ITRON_Task_Get( tskid, &location );
-
- if ( location != OBJECTS_LOCAL )
- _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
-
- if ( _Thread_Is_executing( the_thread ) )
- _ITRON_return_errorno( E_OBJ );
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+ case OBJECTS_ERROR:
+ return _ITRON_Task_Clarify_get_id_error( tskid );
+
+ case OBJECTS_LOCAL:
+
+ if ( _Thread_Is_executing( the_thread ) )
+ _ITRON_return_errorno( E_OBJ );
- if ( _States_Is_dormant( the_thread->current_state ) )
- _ITRON_return_errorno( E_OBJ );
+ if ( _States_Is_dormant( the_thread->current_state ) )
+ _ITRON_return_errorno( E_OBJ );
- _Thread_Restart( the_thread, NULL, 0 );
- _Thread_Set_state( the_thread, STATES_DORMANT );
+ _Thread_Restart( the_thread, NULL, 0 );
+ _Thread_Set_state( the_thread, STATES_DORMANT );
+ break;
+ }
- _ITRON_return_errorno( E_OK );
+ _ITRON_return_errorno( E_OK );
}