git: 3020792db818 - stable/14 - runq: Hide function prototypes under _KERNEL

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Mon, 28 Jul 2025 13:31:10 UTC
The branch stable/14 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=3020792db81819455f3b9ad6ca29f420c54e6971

commit 3020792db81819455f3b9ad6ca29f420c54e6971
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-03-28 13:32:17 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-07-28 13:28:01 +0000

    runq: Hide function prototypes under _KERNEL
    
    And some structure definitions as well.
    
    This header really is not supposed to be included by userland, so should
    just error in this case.  However, there is one remaining use for it in
    a test: Getting the value of RQ_PPQ to ensure a big enough priority
    level difference in order to guarantee that a realtime thread preempts
    another.  This use will soon be obsoleted by guaranteeing that
    a realtime thread always preempts another one with lower priority, even
    if the priority level is very close.
    
    Reviewed by:    kib
    MFC after:      1 month
    Event:          Kitchener-Waterloo Hackathon 202506
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45387
    
    (cherry picked from commit 28b54827f5c10212de752a8e2c4eaf07170d242c)
---
 sys/sys/runq.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/sys/runq.h b/sys/sys/runq.h
index d40fee25846e..b9cfa847617b 100644
--- a/sys/sys/runq.h
+++ b/sys/sys/runq.h
@@ -30,7 +30,6 @@
 #define	_RUNQ_H_
 
 #include <sys/_param.h>
-#include <sys/queue.h>
 
 #ifdef _KERNEL
 #include <sys/libkern.h>
@@ -38,8 +37,6 @@
 #include <strings.h>
 #endif
 
-struct thread;
-
 /*
  * Run queue parameters.
  */
@@ -59,6 +56,12 @@ typedef	unsigned long	rqb_word_t;	/* runq's status words type. */
 #define	RQB_BIT(idx)	(1ul << ((idx) % RQB_BPW))
 #define	RQB_FFS(word)	(ffsl((long)(word)) - 1) /* Assumes two-complement. */
 
+
+#ifdef _KERNEL
+#include <sys/queue.h>
+
+struct thread;
+
 /*
  * Head of run queues.
  */
@@ -90,5 +93,6 @@ struct	thread *runq_choose_fuzz(struct runq *, int);
 void	runq_init(struct runq *);
 void	runq_remove(struct runq *, struct thread *);
 void	runq_remove_idx(struct runq *, struct thread *, u_char *);
+#endif /* _KERNEL */
 
 #endif