git: 3daa43b1bb2c - main - sys: Make priority.h and rtprio.h include all dependencies

From: Alex Richardson <arichardson_at_FreeBSD.org>
Date: Thu, 07 May 2026 05:02:52 UTC
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=3daa43b1bb2cf68f32993e342f59eb146afb7c24

commit 3daa43b1bb2cf68f32993e342f59eb146afb7c24
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2026-05-07 04:20:39 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2026-05-07 04:23:03 +0000

    sys: Make priority.h and rtprio.h include all dependencies
    
    This ensures this header can be included without an explicit or implicit
    sys/types.h include first. This causes issues building SPEC2017 which
    includes sys/rtprio.h and then we get an error due to missing u_char
    definition.
    
    Reviewed by:    emaste
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D52041
---
 sys/sys/priority.h                     | 8 ++++----
 sys/sys/rtprio.h                       | 9 +++++----
 tools/build/test-includes/badfiles.inc | 2 --
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/sys/sys/priority.h b/sys/sys/priority.h
index 93dd5aa90d95..3a3537bee1b2 100644
--- a/sys/sys/priority.h
+++ b/sys/sys/priority.h
@@ -136,10 +136,10 @@
 #endif
 
 struct priority {
-	u_char	pri_class;	/* Scheduling class. */
-	u_char	pri_level;	/* Normal priority level. */
-	u_char	pri_native;	/* Priority before propagation. */
-	u_char	pri_user;	/* User priority based on p_cpu and p_nice. */
+	unsigned char pri_class;	/* Scheduling class. */
+	unsigned char pri_level;	/* Normal priority level. */
+	unsigned char pri_native;	/* Priority before propagation. */
+	unsigned char pri_user;		/* User priority based on p_cpu and p_nice. */
 };
 
 #endif	/* !_SYS_PRIORITY_H_ */
diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h
index 6e0d8c7b0fe7..d6968a9e58a4 100644
--- a/sys/sys/rtprio.h
+++ b/sys/sys/rtprio.h
@@ -34,6 +34,7 @@
 #ifndef _SYS_RTPRIO_H_
 #define _SYS_RTPRIO_H_
 
+#include <sys/_types.h>
 #include <sys/priority.h>
 
 /*
@@ -71,8 +72,8 @@
  * Scheduling class information.
  */
 struct rtprio {
-	u_short type;			/* scheduling class */
-	u_short prio;
+	unsigned short type;	/* scheduling class */
+	unsigned short prio;
 };
 
 #ifdef _KERNEL
@@ -86,8 +87,8 @@ void	pri_to_rtp(struct thread *, struct rtprio *);
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	rtprio(int, pid_t, struct rtprio *);
-int	rtprio_thread(int, lwpid_t, struct rtprio *);
+int	rtprio(int, __pid_t, struct rtprio *);
+int	rtprio_thread(int, __lwpid_t, struct rtprio *);
 __END_DECLS
 #endif	/* !_KERNEL */
 #endif	/* !_SYS_RTPRIO_H_ */
diff --git a/tools/build/test-includes/badfiles.inc b/tools/build/test-includes/badfiles.inc
index a0aada4f016f..e7e9e67c4518 100644
--- a/tools/build/test-includes/badfiles.inc
+++ b/tools/build/test-includes/badfiles.inc
@@ -90,14 +90,12 @@ BADHDRS= \
 	sys/pmckern.h \
 	sys/posix4.h \
 	sys/power.h \
-	sys/priority.h \
 	sys/prng.h \
 	sys/qmath.h \
 	sys/racct.h \
 	sys/resourcevar.h \
 	sys/rman.h \
 	sys/rmlock.h \
-	sys/rtprio.h \
 	sys/runq.h \
 	sys/rwlock.h \
 	sys/sbuf.h \