This file is indexed.

/usr/include/xenomai/nucleus/sched-rt.h is in libxenomai-dev 2.6.4+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*!\file sched-rt.h
 * \brief Definitions for the RT scheduling class.
 * \author Philippe Gerum
 *
 * Copyright (C) 2008 Philippe Gerum <rpm@xenomai.org>.
 *
 * Xenomai is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * Xenomai 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Xenomai; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#ifndef _XENO_NUCLEUS_SCHED_RT_H
#define _XENO_NUCLEUS_SCHED_RT_H

#ifndef _XENO_NUCLEUS_SCHED_H
#error "please don't include nucleus/sched-rt.h directly"
#endif

/* Priority scale for the RT scheduling class. */
#define XNSCHED_RT_MIN_PRIO	0
#define XNSCHED_RT_MAX_PRIO	257
#define XNSCHED_RT_NR_PRIO	(XNSCHED_RT_MAX_PRIO - XNSCHED_RT_MIN_PRIO + 1)

/*
 * Builtin priorities shared by all core APIs.  Those APIs, namely
 * POSIX, native and RTDM, only use a sub-range of the available
 * priority levels from the RT scheduling class, in order to exhibit a
 * 1:1 mapping with Linux's SCHED_FIFO ascending priority scale
 * [1..99]. Non-core APIs with inverted priority scales (e.g. VxWorks,
 * VRTX), normalize the priority values internally when calling the
 * priority-sensitive services of the nucleus, so that they fit into
 * the RT priority scale.
 */
#define XNSCHED_LOW_PRIO	0
#define XNSCHED_HIGH_PRIO	99
#define XNSCHED_IRQ_PRIO	XNSCHED_RT_MAX_PRIO /* For IRQ servers. */

#if defined(__KERNEL__) || defined(__XENO_SIM__)

#if XNSCHED_RT_NR_PRIO > XNSCHED_CLASS_MAX_PRIO ||	\
  (defined(CONFIG_XENO_OPT_SCALABLE_SCHED) &&		\
   XNSCHED_RT_NR_PRIO > XNSCHED_MLQ_LEVELS)
#error "RT class has too many priority levels"
#endif

extern struct xnsched_class xnsched_class_rt;

extern struct xnsched_class xnsched_class_idle;

#define xnsched_class_default xnsched_class_rt

static inline void __xnsched_rt_requeue(struct xnthread *thread)
{
	sched_insertpql(&thread->sched->rt.runnable,
			&thread->rlink, thread->cprio);
}

static inline void __xnsched_rt_enqueue(struct xnthread *thread)
{
	sched_insertpqf(&thread->sched->rt.runnable,
			&thread->rlink, thread->cprio);
}

static inline void __xnsched_rt_dequeue(struct xnthread *thread)
{
	sched_removepq(&thread->sched->rt.runnable, &thread->rlink);
}

static inline struct xnthread *__xnsched_rt_pick(struct xnsched *sched)
{
	struct xnpholder *h = sched_getpq(&sched->rt.runnable);
	return h ? link2thread(h, rlink) : NULL;
}

static inline void __xnsched_rt_setparam(struct xnthread *thread,
					 const union xnsched_policy_param *p)
{
	thread->cprio = p->rt.prio;
	if (xnthread_test_state(thread, XNSHADOW | XNBOOST) == XNSHADOW) {
		if (thread->cprio)
			xnthread_clear_state(thread, XNOTHER);
		else
			xnthread_set_state(thread, XNOTHER);
	}
}

static inline void __xnsched_rt_getparam(struct xnthread *thread,
					 union xnsched_policy_param *p)
{
	p->rt.prio = thread->cprio;
}

static inline void __xnsched_rt_trackprio(struct xnthread *thread,
					  const union xnsched_policy_param *p)
{
	if (p)
		__xnsched_rt_setparam(thread, p);
	else
		thread->cprio = thread->bprio;
}

static inline void __xnsched_rt_forget(struct xnthread *thread)
{
}

static inline int xnsched_rt_init_tcb(struct xnthread *thread)
{
	return 0;
}

void xnsched_rt_tick(struct xnthread *curr);

#ifdef CONFIG_XENO_OPT_PRIOCPL

static inline struct xnthread *__xnsched_rt_push_rpi(struct xnsched *sched,
						     struct xnthread *thread)
{
	sched_insertpqf(&sched->rt.relaxed, &thread->xlink, thread->cprio);
	return link2thread(sched_getheadpq(&sched->rt.relaxed), xlink);
}

static inline void __xnsched_rt_pop_rpi(struct xnthread *thread)
{
	struct xnsched *sched = thread->rpi;
	sched_removepq(&sched->rt.relaxed, &thread->xlink);
}

static inline struct xnthread *__xnsched_rt_peek_rpi(struct xnsched *sched)
{
	struct xnpholder *h = sched_getheadpq(&sched->rt.relaxed);
	return h ? link2thread(h, xlink) : NULL;
}

static inline void __xnsched_rt_suspend_rpi(struct xnthread *thread)
{
}

static inline void __xnsched_rt_resume_rpi(struct xnthread *thread)
{
}

#endif /* CONFIG_XENO_OPT_PRIOCPL */

#endif /* __KERNEL__ || __XENO_SIM__ */

#endif /* !_XENO_NUCLEUS_SCHED_RT_H */