<div dir="auto">This looks ok if these priorities are mapped to Classic or Score. POSIX thread priorities run opposite.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 23, 2020, 2:36 PM <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a>><br>
<br>
It seems we need valid values or assumptions in the FreeBSD about<br>
these values breaks some of the code.<br>
<br>
Closes #4207<br>
---<br>
cpukit/include/sys/priority.h | 102 ++++++++++++++++++++++++++++------<br>
1 file changed, 85 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/cpukit/include/sys/priority.h b/cpukit/include/sys/priority.h<br>
index 025de6290c..855edb63c2 100644<br>
--- a/cpukit/include/sys/priority.h<br>
+++ b/cpukit/include/sys/priority.h<br>
@@ -1,5 +1,7 @@<br>
-/*<br>
- * Copyright (c) 2015 embedded brains GmbH<br>
+/*-<br>
+ * SPDX-License-Identifier: BSD-4-Clause<br>
+ *<br>
+ * Copyright (c) 1994, Henrik Vestergaard Draboel<br>
* All rights reserved.<br>
*<br>
* Redistribution and use in source and binary forms, with or without<br>
@@ -10,6 +12,11 @@<br>
* 2. Redistributions in binary form must reproduce the above copyright<br>
* notice, this list of conditions and the following disclaimer in the<br>
* documentation and/or other materials provided with the distribution.<br>
+ * 3. All advertising materials mentioning features or use of this software<br>
+ * must display the following acknowledgement:<br>
+ * This product includes software developed by Henrik Vestergaard Draboel.<br>
+ * 4. The name of the author may not be used to endorse or promote products<br>
+ * derived from this software without specific prior written permission.<br>
*<br>
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND<br>
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
@@ -22,23 +29,84 @@<br>
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY<br>
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF<br>
* SUCH DAMAGE.<br>
+ *<br>
+ * $FreeBSD$<br>
*/<br>
<br>
#ifndef _SYS_PRIORITY_H_<br>
-#define _SYS_PRIORITY_H_<br>
-<br>
-/* Dummy values to make the libbsd happy */<br>
-#define PRI_MAX_ITHD 0<br>
-#define PI_NET 0<br>
-#define PI_DISK 0<br>
-#define PI_SOFT 0<br>
-#define PI_SWI(x) 0<br>
-#define PRI_MIN_KERN 0<br>
-#define PVM 0<br>
-#define PRIBIO 0<br>
-#define PZERO 0<br>
-#define PSOCK 0<br>
-#define PWAIT 0<br>
-#define PPAUSE 0<br>
+#define _SYS_PRIORITY_H_<br>
+<br>
+/*<br>
+ * Process priority specifications.<br>
+ */<br>
+<br>
+/*<br>
+ * Priority classes.<br>
+ */<br>
+<br>
+#define PRI_ITHD 1 /* Interrupt thread. */<br>
+#define PRI_REALTIME 2 /* Real time process. */<br>
+#define PRI_TIMESHARE 3 /* Time sharing process. */<br>
+#define PRI_IDLE 4 /* Idle process. */<br>
+<br>
+/*<br>
+ * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)<br>
+ * are insignificant. Ranges are as follows:<br>
+ *<br>
+ * Interrupt threads: 0 - 47<br>
+ * Realtime user threads: 48 - 79<br>
+ * Top half kernel threads: 80 - 119<br>
+ * Time sharing user threads: 120 - 223<br>
+ * Idle user threads: 224 - 255<br>
+ *<br>
+ * XXX If/When the specific interrupt thread and top half thread ranges<br>
+ * disappear, a larger range can be used for user processes.<br>
+ */<br>
+<br>
+#define PRI_MIN (0) /* Highest priority. */<br>
+#define PRI_MAX (255) /* Lowest priority. */<br>
+<br>
+#define PRI_MIN_ITHD (PRI_MIN)<br>
+#define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1)<br>
+<br>
+#define PI_REALTIME (PRI_MIN_ITHD + 0)<br>
+#define PI_AV (PRI_MIN_ITHD + 4)<br>
+#define PI_NET (PRI_MIN_ITHD + 8)<br>
+#define PI_DISK (PRI_MIN_ITHD + 12)<br>
+#define PI_TTY (PRI_MIN_ITHD + 16)<br>
+#define PI_DULL (PRI_MIN_ITHD + 20)<br>
+#define PI_SOFT (PRI_MIN_ITHD + 24)<br>
+#define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ)<br>
+<br>
+#define PRI_MIN_REALTIME (48)<br>
+#define PRI_MAX_REALTIME (PRI_MIN_KERN - 1)<br>
+<br>
+#define PRI_MIN_KERN (80)<br>
+#define PRI_MAX_KERN (PRI_MIN_TIMESHARE - 1)<br>
+<br>
+#define PSWP (PRI_MIN_KERN + 0)<br>
+#define PVM (PRI_MIN_KERN + 4)<br>
+#define PINOD (PRI_MIN_KERN + 8)<br>
+#define PRIBIO (PRI_MIN_KERN + 12)<br>
+#define PVFS (PRI_MIN_KERN + 16)<br>
+#define PZERO (PRI_MIN_KERN + 20)<br>
+#define PSOCK (PRI_MIN_KERN + 24)<br>
+#define PWAIT (PRI_MIN_KERN + 28)<br>
+#define PLOCK (PRI_MIN_KERN + 32)<br>
+#define PPAUSE (PRI_MIN_KERN + 36)<br>
+<br>
+#define PRI_MIN_TIMESHARE (120)<br>
+#define PRI_MAX_TIMESHARE (PRI_MIN_IDLE - 1)<br>
+<br>
+#define PUSER (PRI_MIN_TIMESHARE)<br>
+<br>
+#define PRI_MIN_IDLE (224)<br>
+#define PRI_MAX_IDLE (PRI_MAX)<br>
+<br>
+#ifdef _KERNEL<br>
+/* Other arguments for kern_yield(9). */<br>
+#define PRI_USER -2 /* Change to current user priority. */<br>
+#define PRI_UNCHANGED -1 /* Do not change priority. */<br>
+#endif<br>
<br>
#endif /* !_SYS_PRIORITY_H_ */<br>
-- <br>
2.24.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>