hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * Copyright (C) 2013 Philippe Gerum <rpm@xenomai.org>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#ifndef _COBALT_UAPI_KERNEL_THREAD_H
#define _COBALT_UAPI_KERNEL_THREAD_H
 
#include <cobalt/uapi/kernel/types.h>
 
/**
 * @ingroup cobalt_core_thread
 * @defgroup cobalt_core_thread_states Thread state flags
 * @brief Bits reporting permanent or transient states of threads
 * @{
 */
 
/* State flags (shared) */
 
#define XNSUSP    0x00000001 /**< Suspended. */
#define XNPEND    0x00000002 /**< Sleep-wait for a resource. */
#define XNDELAY   0x00000004 /**< Delayed */
#define XNREADY   0x00000008 /**< Linked to the ready queue. */
#define XNDORMANT 0x00000010 /**< Not started yet */
#define XNZOMBIE  0x00000020 /**< Zombie thread in deletion process */
#define XNMAPPED  0x00000040 /**< Thread is mapped to a linux task */
#define XNRELAX   0x00000080 /**< Relaxed shadow thread (blocking bit) */
#define XNHELD    0x00000200 /**< Thread is held to process emergency. */
#define XNBOOST   0x00000400 /**< PI/PP boost undergoing */
#define XNSSTEP   0x00000800 /**< Single-stepped by debugger */
#define XNLOCK    0x00001000 /**< Scheduler lock control (pseudo-bit, not in ->state) */
#define XNRRB     0x00002000 /**< Undergoes a round-robin scheduling */
#define XNWARN    0x00004000 /**< Issue SIGDEBUG on error detection */
#define XNFPU     0x00008000 /**< Thread uses FPU */
#define XNROOT    0x00010000 /**< Root thread (that is, Linux/IDLE) */
#define XNWEAK    0x00020000 /**< Non real-time shadow (from the WEAK class) */
#define XNUSER    0x00040000 /**< Shadow thread running in userland */
#define XNJOINED  0x00080000 /**< Another thread waits for joining this thread */
#define XNTRAPLB  0x00100000 /**< Trap lock break (i.e. may not sleep with sched lock) */
#define XNDEBUG   0x00200000 /**< User-level debugging enabled */
#define XNDBGSTOP 0x00400000 /**< Stopped for synchronous debugging */
 
/** @} */
 
/**
 * @ingroup cobalt_core_thread
 * @defgroup cobalt_core_thread_info Thread information flags
 * @brief Bits reporting events notified to threads
 * @{
 */
 
/* Information flags (shared) */
 
#define XNTIMEO   0x00000001 /**< Woken up due to a timeout condition */
#define XNRMID    0x00000002 /**< Pending on a removed resource */
#define XNBREAK   0x00000004 /**< Forcibly awaken from a wait state */
#define XNKICKED  0x00000008 /**< Forced out of primary mode */
#define XNWAKEN   0x00000010 /**< Thread waken up upon resource availability */
#define XNROBBED  0x00000020 /**< Robbed from resource ownership */
#define XNCANCELD 0x00000040 /**< Cancellation request is pending */
#define XNPIALERT 0x00000080 /**< Priority inversion alert (SIGDEBUG sent) */
#define XNSCHEDP  0x00000100 /**< schedparam propagation is pending */
#define XNCONTHI  0x00000200 /**< Continue in primary mode after debugging */
 
/* Local information flags (private to current thread) */
 
#define XNMOVED   0x00000001 /**< CPU migration in primary mode occurred */
#define XNLBALERT 0x00000002 /**< Scheduler lock break alert (SIGDEBUG sent) */
#define XNDESCENT 0x00000004 /**< Adaptive transitioning to secondary mode */
#define XNSYSRST  0x00000008 /**< Thread awaiting syscall restart after signal */
#define XNHICCUP  0x00000010 /**< Just left from ptracing */
 
/** @} */
 
/*
 * Must follow strictly the declaration order of the state flags
 * defined above. Status symbols are defined as follows:
 *
 * 'S' -> Forcibly suspended.
 * 'w'/'W' -> Waiting for a resource, with or without timeout.
 * 'D' -> Delayed (without any other wait condition).
 * 'R' -> Runnable.
 * 'U' -> Unstarted or dormant.
 * 'X' -> Relaxed shadow.
 * 'H' -> Held in emergency.
 * 'b' -> Priority boost undergoing.
 * 'T' -> Ptraced and stopped.
 * 'l' -> Locks scheduler.
 * 'r' -> Undergoes round-robin.
 * 't' -> Runtime mode errors notified.
 * 'L' -> Lock breaks trapped.
 * 's' -> Ptraced, stopped synchronously.
 */
#define XNTHREAD_STATE_LABELS  "SWDRU..X.HbTlrt.....L.s"
 
struct xnthread_user_window {
   __u32 state;
   __u32 info;
   __u32 grant_value;
   __u32 pp_pending;
};
 
#endif /* !_COBALT_UAPI_KERNEL_THREAD_H */