source: rtems/cpukit/libcsupport/src/assocthreadstatestostring.c @ a3730b38

5
Last change on this file since a3730b38 was a3730b38, checked in by Sebastian Huber <sebastian.huber@…>, on 01/11/17 at 10:04:35

Add and use rtems_assoc_thread_states_to_string()

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 * Copyright (c) 2016 embedded brains GmbH.
3 *
4 * The license and distribution terms for this file may be
5 * found in the file LICENSE in this distribution or at
6 * http://www.rtems.org/license/LICENSE.
7 */
8
9#if HAVE_CONFIG_H
10#include "config.h"
11#endif
12
13#include <rtems/assoc.h>
14#include <rtems/score/statesimpl.h>
15
16static const rtems_assoc_32_pair state_pairs[] = {
17  { STATES_THREAD_QUEUE_WITH_IDENTIFIER,   "ID" },
18  { STATES_WAITING_FOR_MUTEX,              "MTX" },
19  { STATES_WAITING_FOR_SEMAPHORE,          "SEM" },
20  { STATES_WAITING_FOR_EVENT,              "EV" },
21  { STATES_WAITING_FOR_SYSTEM_EVENT,       "SYSEV" },
22  { STATES_WAITING_FOR_MESSAGE,            "MSG" },
23  { STATES_WAITING_FOR_CONDITION_VARIABLE, "CV" },
24  { STATES_WAITING_FOR_FUTEX,              "FTX" },
25  { STATES_WAITING_FOR_BSD_WAKEUP,         "WK" },
26  { STATES_WAITING_FOR_TIME,               "TIME" },
27  { STATES_WAITING_FOR_PERIOD,             "PER" },
28  { STATES_WAITING_FOR_SIGNAL,             "SIG" },
29  { STATES_WAITING_FOR_BARRIER,            "BAR" },
30  { STATES_WAITING_FOR_RWLOCK,             "RW" },
31  { STATES_WAITING_FOR_JOIN_AT_EXIT,       "JATX" },
32  { STATES_WAITING_FOR_JOIN,               "JOIN" },
33  { STATES_SUSPENDED,                      "SUSP" },
34  { STATES_WAITING_FOR_SEGMENT,            "SEG" },
35  { STATES_LIFE_IS_CHANGING,               "LIFE" },
36  { STATES_DEBUGGER,                       "DBG" },
37  { STATES_INTERRUPTIBLE_BY_SIGNAL,        "IS" },
38  { STATES_WAITING_FOR_RPC_REPLY,          "RPC" },
39  { STATES_ZOMBIE,                         "ZOMBI" },
40  { STATES_DORMANT,                        "DORM" }
41};
42
43size_t rtems_assoc_thread_states_to_string(
44  uint32_t  states,
45  char     *buffer,
46  size_t    buffer_size
47)
48{
49  return rtems_assoc_32_to_string(
50    states,
51    buffer,
52    buffer_size,
53    state_pairs,
54    RTEMS_ARRAY_SIZE( state_pairs ),
55    ":",
56    "READY"
57  );
58}
Note: See TracBrowser for help on using the repository browser.