[rtems commit] rtems: Use RTEMS_WHO_AM_I for rtems_task_ident()

Sebastian Huber sebh at rtems.org
Thu Nov 18 18:54:52 UTC 2021


Module:    rtems
Branch:    master
Commit:    9b6362da712e58f39ac637b1705e6f6ea16c0be9
Changeset: http://git.rtems.org/rtems/commit/?id=9b6362da712e58f39ac637b1705e6f6ea16c0be9

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 18 12:13:53 2021 +0100

rtems: Use RTEMS_WHO_AM_I for rtems_task_ident()

---

 cpukit/include/rtems/rtems/tasks.h        | 3 ++-
 cpukit/rtems/src/taskident.c              | 3 ++-
 testsuites/libtests/malloctest/task1.c    | 2 +-
 testsuites/libtests/stackchk/task1.c      | 2 +-
 testsuites/mptests/mp01/task1.c           | 2 +-
 testsuites/mptests/mp03/task1.c           | 2 +-
 testsuites/mptests/mp04/task1.c           | 2 +-
 testsuites/samples/base_mp/apptask.c      | 2 +-
 testsuites/samples/base_sp/apptask.c      | 2 +-
 testsuites/samples/ticker/tasks.c         | 2 +-
 testsuites/smptests/smp08/tasks.c         | 2 +-
 testsuites/smptests/smpaffinity01/init.c  | 2 +-
 testsuites/sptests/sp19/first.c           | 2 +-
 testsuites/sptests/sp19/fptask.c          | 2 +-
 testsuites/sptests/sp19/task1.c           | 2 +-
 testsuites/sptests/sp24/task1.c           | 2 +-
 testsuites/sptests/sp30/task1.c           | 2 +-
 testsuites/sptests/sp42/init.c            | 2 +-
 testsuites/sptests/sp76/init.c            | 2 +-
 testsuites/sptests/spcbssched01/task1.c   | 2 +-
 testsuites/sptests/spedfsched01/task1.c   | 2 +-
 testsuites/sptests/spsimplesched01/init.c | 2 +-
 testsuites/sptests/spsimplesched02/init.c | 2 +-
 testsuites/sptests/sptask_err04/task1.c   | 4 ++--
 24 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h
index 8c6e8a3..0392586 100644
--- a/cpukit/include/rtems/rtems/tasks.h
+++ b/cpukit/include/rtems/rtems/tasks.h
@@ -1267,7 +1267,8 @@ rtems_status_code rtems_task_construct(
  * This directive obtains a task identifier associated with the task name
  * specified in ``name``.
  *
- * A task may obtain its own identifier by specifying #RTEMS_SELF for the name.
+ * A task may obtain its own identifier by specifying #RTEMS_WHO_AM_I for the
+ * name.
  *
  * The node to search is specified in ``node``.  It shall be
  *
diff --git a/cpukit/rtems/src/taskident.c b/cpukit/rtems/src/taskident.c
index 74a0a53..89c2c7c 100644
--- a/cpukit/rtems/src/taskident.c
+++ b/cpukit/rtems/src/taskident.c
@@ -40,6 +40,7 @@
 #endif
 
 #include <rtems/rtems/tasksimpl.h>
+#include <rtems/rtems/object.h>
 #include <rtems/rtems/objectimpl.h>
 #include <rtems/score/percpu.h>
 
@@ -53,7 +54,7 @@ rtems_status_code rtems_task_ident(
     return RTEMS_INVALID_ADDRESS;
   }
 
-  if ( name == OBJECTS_ID_OF_SELF ) {
+  if ( name == RTEMS_WHO_AM_I ) {
     *id = _Thread_Get_executing()->Object.id;
     return RTEMS_SUCCESSFUL;
   }
diff --git a/testsuites/libtests/malloctest/task1.c b/testsuites/libtests/malloctest/task1.c
index 753a74e..4f0309a 100644
--- a/testsuites/libtests/malloctest/task1.c
+++ b/testsuites/libtests/malloctest/task1.c
@@ -34,7 +34,7 @@ rtems_task Task_1_through_5(
   unsigned char *mem_ptr;
   int mem_amt;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   while (TRUE)
diff --git a/testsuites/libtests/stackchk/task1.c b/testsuites/libtests/stackchk/task1.c
index 7a9f488..4e08d20 100644
--- a/testsuites/libtests/stackchk/task1.c
+++ b/testsuites/libtests/stackchk/task1.c
@@ -25,7 +25,7 @@ rtems_task Task_1_through_3(
   rtems_time_of_day time;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   while( FOREVER ) {
diff --git a/testsuites/mptests/mp01/task1.c b/testsuites/mptests/mp01/task1.c
index 50821e1..1868213 100644
--- a/testsuites/mptests/mp01/task1.c
+++ b/testsuites/mptests/mp01/task1.c
@@ -35,7 +35,7 @@ rtems_task Test_task(
   rtems_id          tid;
   rtems_time_of_day time;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   status = rtems_clock_get_tod( &time );
diff --git a/testsuites/mptests/mp03/task1.c b/testsuites/mptests/mp03/task1.c
index 48682e0..9b0c1b2 100644
--- a/testsuites/mptests/mp03/task1.c
+++ b/testsuites/mptests/mp03/task1.c
@@ -94,7 +94,7 @@ rtems_task Test_task(
   rtems_id          tid;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   puts( "Getting TID of remote task" );
diff --git a/testsuites/mptests/mp04/task1.c b/testsuites/mptests/mp04/task1.c
index 878effd..6e350d8 100644
--- a/testsuites/mptests/mp04/task1.c
+++ b/testsuites/mptests/mp04/task1.c
@@ -33,7 +33,7 @@ rtems_task Test_task(
   rtems_task_priority previous_priority;
   rtems_task_priority previous_priority_1;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   puts( "Getting TID of remote task" );
diff --git a/testsuites/samples/base_mp/apptask.c b/testsuites/samples/base_mp/apptask.c
index e54e08a..063328e 100644
--- a/testsuites/samples/base_mp/apptask.c
+++ b/testsuites/samples/base_mp/apptask.c
@@ -32,7 +32,7 @@ rtems_task Application_task(
   rtems_id          tid;
   rtems_status_code status;
 
-  rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   (void) status;
   printf( "This task was invoked with the node argument (%" PRIdrtems_task_argument ")\n", node );
   printf( "This task has the id of 0x%" PRIxrtems_id "\n",  tid );
diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c
index f450f71..02df777 100644
--- a/testsuites/samples/base_sp/apptask.c
+++ b/testsuites/samples/base_sp/apptask.c
@@ -34,7 +34,7 @@ rtems_task Application_task(
   rtems_status_code status;
   unsigned int      a = (unsigned int) argument;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "ident" );
 
   printf(
diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c
index 12e8068..7ff6eb7 100644
--- a/testsuites/samples/ticker/tasks.c
+++ b/testsuites/samples/ticker/tasks.c
@@ -30,7 +30,7 @@ rtems_task Test_task(
   uint32_t          task_index;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "task ident" ); 
 
   task_index = task_number( tid );
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
index 40a097d..2827125 100644
--- a/testsuites/smptests/smp08/tasks.c
+++ b/testsuites/smptests/smp08/tasks.c
@@ -28,7 +28,7 @@ rtems_task Test_task(
   p = rtems_object_get_name( RTEMS_SELF, 5, name );
   rtems_test_assert( p != NULL );
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   rtems_test_assert( status == RTEMS_SUCCESSFUL );
   task_index = task_number( tid );
   for ( ; ; ) {
diff --git a/testsuites/smptests/smpaffinity01/init.c b/testsuites/smptests/smpaffinity01/init.c
index 9ec687d..e0065bf 100644
--- a/testsuites/smptests/smpaffinity01/init.c
+++ b/testsuites/smptests/smpaffinity01/init.c
@@ -213,7 +213,7 @@ static void Init(rtems_task_argument arg)
   TEST_BEGIN();
 
   /* Initialize thread id */
-  sc = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &Init_id );
+  sc = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &Init_id );
   directive_failed( sc, "Identify Init Task" );
 
   Validate_setaffinity_errors();
diff --git a/testsuites/sptests/sp19/first.c b/testsuites/sptests/sp19/first.c
index 69ff297..00da9ed 100644
--- a/testsuites/sptests/sp19/first.c
+++ b/testsuites/sptests/sp19/first.c
@@ -26,7 +26,7 @@ rtems_task First_FP_task(
   INTEGER_DECLARE;
   FP_DECLARE;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   task_index = task_number( tid );
diff --git a/testsuites/sptests/sp19/fptask.c b/testsuites/sptests/sp19/fptask.c
index 5ffff37..c91a163 100644
--- a/testsuites/sptests/sp19/fptask.c
+++ b/testsuites/sptests/sp19/fptask.c
@@ -27,7 +27,7 @@ rtems_task FP_task(
   INTEGER_DECLARE;
   FP_DECLARE;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident of self" );
 
   task_index = task_number( tid );
diff --git a/testsuites/sptests/sp19/task1.c b/testsuites/sptests/sp19/task1.c
index 912ed26..b5cbdcd 100644
--- a/testsuites/sptests/sp19/task1.c
+++ b/testsuites/sptests/sp19/task1.c
@@ -24,7 +24,7 @@ rtems_task Task_1(
   uint32_t          task_index;
   INTEGER_DECLARE;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   task_index = task_number( tid );
diff --git a/testsuites/sptests/sp24/task1.c b/testsuites/sptests/sp24/task1.c
index 9a2de67..d6f51f6 100644
--- a/testsuites/sptests/sp24/task1.c
+++ b/testsuites/sptests/sp24/task1.c
@@ -30,7 +30,7 @@ rtems_task Task_1_through_3(
   rtems_time_of_day time;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident of self" );
 
   while ( FOREVER )  {
diff --git a/testsuites/sptests/sp30/task1.c b/testsuites/sptests/sp30/task1.c
index da4b0d2..56aa6aa 100644
--- a/testsuites/sptests/sp30/task1.c
+++ b/testsuites/sptests/sp30/task1.c
@@ -30,7 +30,7 @@ rtems_task Task_1_through_3(
   rtems_time_of_day time;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident of self" );
 
   while ( FOREVER )  {
diff --git a/testsuites/sptests/sp42/init.c b/testsuites/sptests/sp42/init.c
index 10e4927..0004694 100644
--- a/testsuites/sptests/sp42/init.c
+++ b/testsuites/sptests/sp42/init.c
@@ -74,7 +74,7 @@ static rtems_task Locker_task(
   rtems_status_code   status;
   rtems_task_argument my_obtain_counter;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   rtems_test_assert( task_index == task_number( tid ) - 1 );
diff --git a/testsuites/sptests/sp76/init.c b/testsuites/sptests/sp76/init.c
index c7e451c..6315850 100644
--- a/testsuites/sptests/sp76/init.c
+++ b/testsuites/sptests/sp76/init.c
@@ -49,7 +49,7 @@ static rtems_task Init(
 
   TEST_BEGIN();
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &id );
   directive_failed( status, "task ident" );
 
   /* to make sure it is equal to TA2 */
diff --git a/testsuites/sptests/spcbssched01/task1.c b/testsuites/sptests/spcbssched01/task1.c
index f5d1808..1e51b80 100644
--- a/testsuites/sptests/spcbssched01/task1.c
+++ b/testsuites/sptests/spcbssched01/task1.c
@@ -31,7 +31,7 @@ rtems_task Task_1_through_3(
   rtems_status_code status;
   rtems_interval    ticks;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 );
diff --git a/testsuites/sptests/spedfsched01/task1.c b/testsuites/sptests/spedfsched01/task1.c
index f5d1808..1e51b80 100644
--- a/testsuites/sptests/spedfsched01/task1.c
+++ b/testsuites/sptests/spedfsched01/task1.c
@@ -31,7 +31,7 @@ rtems_task Task_1_through_3(
   rtems_status_code status;
   rtems_interval    ticks;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "rtems_task_ident" );
 
   ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 );
diff --git a/testsuites/sptests/spsimplesched01/init.c b/testsuites/sptests/spsimplesched01/init.c
index f2a0673..0bb05bf 100644
--- a/testsuites/sptests/spsimplesched01/init.c
+++ b/testsuites/sptests/spsimplesched01/init.c
@@ -34,7 +34,7 @@ rtems_task Test_task(
   uint32_t           task_index;
   rtems_status_code  status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "task ident" );
 
   task_index = task_number( tid );
diff --git a/testsuites/sptests/spsimplesched02/init.c b/testsuites/sptests/spsimplesched02/init.c
index d19d355..1366c93 100644
--- a/testsuites/sptests/spsimplesched02/init.c
+++ b/testsuites/sptests/spsimplesched02/init.c
@@ -38,7 +38,7 @@ rtems_task Test_task(
   rtems_id          tid;
   rtems_status_code status;
 
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
   directive_failed( status, "wake after" );
 
   for ( ; ; ) {
diff --git a/testsuites/sptests/sptask_err04/task1.c b/testsuites/sptests/sptask_err04/task1.c
index c1f59d8..ba93d67 100644
--- a/testsuites/sptests/sptask_err04/task1.c
+++ b/testsuites/sptests/sptask_err04/task1.c
@@ -50,7 +50,7 @@ rtems_task Task_1(
   puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" );
 
   /* NULL param */
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, NULL );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, NULL );
   fatal_directive_status(
     status,
     RTEMS_INVALID_ADDRESS,
@@ -59,7 +59,7 @@ rtems_task Task_1(
   puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" );
 
   /* OK */
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id );
+  status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &self_id );
   directive_failed( status, "rtems_task_ident of self" );
   if ( self_id != Task_id[ 1 ] ) {
     puts( "ERROR - rtems_task_ident - incorrect ID returned!" );



More information about the vc mailing list