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

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

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
Line 
1/**
2 *  @file
3 *
4 *  @brief Get Class Name
5 *  @ingroup ClassicClassInfo
6 */
7
8/*
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
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/object.h>
22#include <rtems/score/objectimpl.h>
23
24#include <rtems/assoc.h>
25
26static const rtems_assoc_t rtems_object_api_internal_assoc[] = {
27  { "Thread",                  OBJECTS_INTERNAL_THREADS, 0},
28  { NULL,                      0, 0}
29};
30
31static const rtems_assoc_t rtems_object_api_classic_assoc[] = {
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},
42  { NULL,                      0, 0}
43};
44
45#ifdef RTEMS_POSIX_API
46static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
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},
53  { "Shared Memory",           OBJECTS_POSIX_SHMS, 0},
54  { NULL,                      0, 0}
55};
56#endif
57
58const char *rtems_object_get_api_class_name(
59  int the_api,
60  int the_class
61)
62{
63  const rtems_assoc_t *api_assoc;
64  const rtems_assoc_t *class_assoc;
65
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;
70#ifdef RTEMS_POSIX_API
71  else if ( the_api == OBJECTS_POSIX_API )
72    api_assoc = rtems_object_api_posix_assoc;
73#endif
74  else
75    return "BAD API";
76  class_assoc = rtems_assoc_ptr_by_local( api_assoc, the_class );
77  if ( class_assoc )
78    return class_assoc->name;
79  return "BAD CLASS";
80}
Note: See TracBrowser for help on using the repository browser.