source: rtems/cpukit/rtems/src/rtemsobjectgetapiclassname.c @ 66cb142

5
Last change on this file since 66cb142 was 6c2b8a4b, checked in by Sebastian Huber <sebastian.huber@…>, on 11/29/17 at 05:23:27

score: Use self-contained API mutex

Use a self-contained recursive mutex for API_Mutex_Control. The API
mutexes are protected against asynchronous thread cancellation.

Add dedicated mutexes for libatomic and TOD.

Close #2629.
Close #2630.

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[c18e0ba]1/**
2 *  @file
[6c06288]3 *
[c18e0ba]4 *  @brief Get Class Name
5 *  @ingroup ClassicClassInfo
6 */
7
8/*
[6c06288]9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[6c06288]15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/object.h>
[a2e3f33]22#include <rtems/score/objectimpl.h>
[6c06288]23
24#include <rtems/assoc.h>
25
[a2e3f33]26static const rtems_assoc_t rtems_object_api_internal_assoc[] = {
[ccec63e]27  { "Thread",                  OBJECTS_INTERNAL_THREADS, 0},
[a2e3f33]28  { NULL,                      0, 0}
[6c06288]29};
30
[a2e3f33]31static const rtems_assoc_t rtems_object_api_classic_assoc[] = {
[ccec63e]32  { "Task",                    OBJECTS_RTEMS_TASKS, 0},
33  { "Timer",                   OBJECTS_RTEMS_TIMERS, 0},
34  { "Semaphore",               OBJECTS_RTEMS_SEMAPHORES, 0},
35  { "Message Queue",           OBJECTS_RTEMS_MESSAGE_QUEUES, 0},
36  { "Partition",               OBJECTS_RTEMS_PARTITIONS, 0},
37  { "Region",                  OBJECTS_RTEMS_REGIONS, 0},
38  { "Port",                    OBJECTS_RTEMS_PORTS, 0},
39  { "Period",                  OBJECTS_RTEMS_PERIODS, 0},
40  { "Extension",               OBJECTS_RTEMS_EXTENSIONS, 0},
41  { "Barrier",                 OBJECTS_RTEMS_BARRIERS, 0},
[a2e3f33]42  { NULL,                      0, 0}
[6c06288]43};
44
45#ifdef RTEMS_POSIX_API
[a2e3f33]46static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
[ccec63e]47  { "Thread",                  OBJECTS_POSIX_THREADS, 0},
48  { "Key",                     OBJECTS_POSIX_KEYS, 0},
49  { "Interrupt",               OBJECTS_POSIX_INTERRUPTS, 0},
50  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
51  { "Semaphore",               OBJECTS_POSIX_SEMAPHORES, 0},
52  { "Timer",                   OBJECTS_POSIX_TIMERS, 0},
[ba776282]53  { "Shared Memory",           OBJECTS_POSIX_SHMS, 0},
[a2e3f33]54  { NULL,                      0, 0}
[6c06288]55};
56#endif
57
58const char *rtems_object_get_api_class_name(
[05c1886]59  int the_api,
[fdc57ca]60  int the_class
[6c06288]61)
62{
63  const rtems_assoc_t *api_assoc;
64  const rtems_assoc_t *class_assoc;
[05c1886]65
[74d0cb44]66  if ( the_api == OBJECTS_INTERNAL_API )
67    api_assoc = rtems_object_api_internal_assoc;
68  else if ( the_api == OBJECTS_CLASSIC_API )
69    api_assoc = rtems_object_api_classic_assoc;
[4017ab5]70#ifdef RTEMS_POSIX_API
[74d0cb44]71  else if ( the_api == OBJECTS_POSIX_API )
72    api_assoc = rtems_object_api_posix_assoc;
[4017ab5]73#endif
[74d0cb44]74  else
75    return "BAD API";
[91b8fb9e]76  class_assoc = rtems_assoc_ptr_by_local( api_assoc, the_class );
[6c06288]77  if ( class_assoc )
78    return class_assoc->name;
79  return "BAD CLASS";
80}
Note: See TracBrowser for help on using the repository browser.