RTEMS_WHO_AM_I

Joel Sherrill joel at rtems.org
Wed Nov 17 17:10:09 UTC 2021


On Wed, Nov 17, 2021 at 10:42 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> Hello,
>
> for what is RTEMS_WHO_AM_I used?
>
> grep -r RTEMS_WHO_AM_I .
> ./cpukit/include/rtems/rtems/object.h:#define RTEMS_WHO_AM_I
> OBJECTS_WHO_AM_I
>
> grep -r OBJECTS_WHO_AM_I .
> ./cpukit/include/rtems/score/object.h:#define OBJECTS_WHO_AM_I           0
> ./cpukit/include/rtems/rtems/object.h:#define RTEMS_WHO_AM_I
> OBJECTS_WHO_AM_I

Looks like a mistake in rtems_task_ident().

  if ( name == OBJECTS_ID_OF_SELF ) {
    *id = _Thread_Get_executing()->Object.id;
    return RTEMS_SUCCESSFUL;
  }

That should be RTEMS_WHO_AM_I and it doesn't need to be
a score constant since it is processed here.

Since I don't see a test case that uses this, I looked for
rtems_task_ident() calls which used RTEMS_SELF. There are
multiple of those. RTEMS_SELF is an id. RTEMS_WHO_AM_I
is a name.

Unfortunately, the manual says this field can be RTEMS_SELF.

If we change to RTEMS_SELF, that uses an id constant for name
which works but is sloppy.

git blame has 2006 for RTEMS_WHO_AM_I and 1999 for 0 to
get the id of the calling task. Honestly, I don't recall anything
about either piece of code. I didn't look up the log messages but
doubt they would help either.

I'm prone to change rtems_task_ident() to use RTEMS_WHO_AM_I
since that is more proper.

--joel

>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber at embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list