45#include <sys/sysctl.h>
46#include <sys/kernel.h>
49#include <sys/posix4.h>
50#include <sys/resource.h>
53FEATURE(kposix_priority_scheduling,
"POSIX P1003.1B realtime extensions");
96#define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P))
97#define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P))
99#define p4prio_to_tsprio(P) ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))
100#define tsprio_to_p4prio(P) ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))
104#define P1B_PRIO_MIN rtpprio_to_p4prio(RTP_PRIO_MAX)
105#define P1B_PRIO_MAX rtpprio_to_p4prio(RTP_PRIO_MIN)
117 *policy = SCHED_FIFO;
119 case RTP_PRIO_REALTIME:
123 *policy = SCHED_OTHER;
131 struct thread *td,
const struct sched_param *param)
143 struct sched_param *param)
148 if (RTP_PRIO_IS_REALTIME(rtp.type))
151 if (PRI_MIN_TIMESHARE < rtp.prio)
156 param->sched_priority = PRI_MAX_TIMESHARE -
173 const struct sched_param *param)
185 rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO :
193 if (param->sched_priority >= 0 && param->sched_priority <=
194 (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE)) {
195 rtp.type = RTP_PRIO_NORMAL;
237 *prio = PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE;
269 struct timespec *timespec)
void *() malloc(size_t size, struct malloc_type *mtp, int flags)
void free(void *addr, struct malloc_type *mtp)
int rtp_to_pri(struct rtprio *rtp, struct thread *td)
void pri_to_rtp(struct thread *td, struct rtprio *rtp)
static __inline int getscheduler(struct ksched *ksched, struct thread *td, int *policy)
int ksched_detach(struct ksched *ks)
int ksched_setscheduler(struct ksched *ksched, struct thread *td, int policy, const struct sched_param *param)
int ksched_get_priority_min(struct ksched *ksched, int policy, int *prio)
#define rtpprio_to_p4prio(P)
#define p4prio_to_rtpprio(P)
FEATURE(kposix_priority_scheduling, "POSIX P1003.1B realtime extensions")
int ksched_setparam(struct ksched *ksched, struct thread *td, const struct sched_param *param)
int ksched_get_priority_max(struct ksched *ksched, int policy, int *prio)
int ksched_yield(struct ksched *ksched)
int ksched_getscheduler(struct ksched *ksched, struct thread *td, int *policy)
#define p4prio_to_tsprio(P)
int ksched_getparam(struct ksched *ksched, struct thread *td, struct sched_param *param)
#define tsprio_to_p4prio(P)
int ksched_rr_get_interval(struct ksched *ksched, struct thread *td, struct timespec *timespec)
int ksched_attach(struct ksched **p)
int sched_rr_interval(void)
void sched_relinquish(struct thread *td)
struct timespec rr_interval