FreeBSD kernel kern code
ksched.c File Reference
#include <sys/cdefs.h>
#include "opt_posix.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/posix4.h>
#include <sys/resource.h>
#include <sys/sched.h>
Include dependency graph for ksched.c:

Go to the source code of this file.

Data Structures

struct  ksched
 

Macros

#define p4prio_to_rtpprio(P)   (RTP_PRIO_MAX - (P))
 
#define rtpprio_to_p4prio(P)   (RTP_PRIO_MAX - (P))
 
#define p4prio_to_tsprio(P)   ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))
 
#define tsprio_to_p4prio(P)   ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))
 
#define P1B_PRIO_MIN   rtpprio_to_p4prio(RTP_PRIO_MAX)
 
#define P1B_PRIO_MAX   rtpprio_to_p4prio(RTP_PRIO_MIN)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 FEATURE (kposix_priority_scheduling, "POSIX P1003.1B realtime extensions")
 
int ksched_attach (struct ksched **p)
 
int ksched_detach (struct ksched *ks)
 
static __inline int getscheduler (struct ksched *ksched, struct thread *td, int *policy)
 
int ksched_setparam (struct ksched *ksched, struct thread *td, const struct sched_param *param)
 
int ksched_getparam (struct ksched *ksched, struct thread *td, struct sched_param *param)
 
int ksched_setscheduler (struct ksched *ksched, struct thread *td, int policy, const struct sched_param *param)
 
int ksched_getscheduler (struct ksched *ksched, struct thread *td, int *policy)
 
int ksched_yield (struct ksched *ksched)
 
int ksched_get_priority_max (struct ksched *ksched, int policy, int *prio)
 
int ksched_get_priority_min (struct ksched *ksched, int policy, int *prio)
 
int ksched_rr_get_interval (struct ksched *ksched, struct thread *td, struct timespec *timespec)
 

Macro Definition Documentation

◆ P1B_PRIO_MAX

#define P1B_PRIO_MAX   rtpprio_to_p4prio(RTP_PRIO_MIN)

Definition at line 105 of file ksched.c.

◆ P1B_PRIO_MIN

#define P1B_PRIO_MIN   rtpprio_to_p4prio(RTP_PRIO_MAX)

Definition at line 104 of file ksched.c.

◆ p4prio_to_rtpprio

#define p4prio_to_rtpprio (   P)    (RTP_PRIO_MAX - (P))

Definition at line 96 of file ksched.c.

◆ p4prio_to_tsprio

#define p4prio_to_tsprio (   P)    ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))

Definition at line 99 of file ksched.c.

◆ rtpprio_to_p4prio

#define rtpprio_to_p4prio (   P)    (RTP_PRIO_MAX - (P))

Definition at line 97 of file ksched.c.

◆ tsprio_to_p4prio

#define tsprio_to_p4prio (   P)    ((PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) - (P))

Definition at line 100 of file ksched.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ FEATURE()

FEATURE ( kposix_priority_scheduling  ,
"POSIX P1003.1B realtime extensions"   
)

◆ getscheduler()

static __inline int getscheduler ( struct ksched ksched,
struct thread *  td,
int *  policy 
)
static

Definition at line 108 of file ksched.c.

References pri_to_rtp().

Referenced by ksched_getscheduler(), and ksched_setparam().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ksched_attach()

int ksched_attach ( struct ksched **  p)

Definition at line 62 of file ksched.c.

References hz, malloc(), ksched::rr_interval, and sched_rr_interval().

Here is the call graph for this function:

◆ ksched_detach()

int ksched_detach ( struct ksched ks)

Definition at line 74 of file ksched.c.

References free().

Here is the call graph for this function:

◆ ksched_get_priority_max()

int ksched_get_priority_max ( struct ksched ksched,
int  policy,
int *  prio 
)

Definition at line 226 of file ksched.c.

References P1B_PRIO_MAX.

◆ ksched_get_priority_min()

int ksched_get_priority_min ( struct ksched ksched,
int  policy,
int *  prio 
)

Definition at line 247 of file ksched.c.

References P1B_PRIO_MIN.

◆ ksched_getparam()

int ksched_getparam ( struct ksched ksched,
struct thread *  td,
struct sched_param *  param 
)

Definition at line 142 of file ksched.c.

References pri_to_rtp(), rtpprio_to_p4prio, and tsprio_to_p4prio.

Here is the call graph for this function:

◆ ksched_getscheduler()

int ksched_getscheduler ( struct ksched ksched,
struct thread *  td,
int *  policy 
)

Definition at line 210 of file ksched.c.

References getscheduler().

Here is the call graph for this function:

◆ ksched_rr_get_interval()

int ksched_rr_get_interval ( struct ksched ksched,
struct thread *  td,
struct timespec *  timespec 
)

Definition at line 268 of file ksched.c.

References ksched::rr_interval.

◆ ksched_setparam()

int ksched_setparam ( struct ksched ksched,
struct thread *  td,
const struct sched_param *  param 
)

Definition at line 130 of file ksched.c.

References getscheduler(), and ksched_setscheduler().

Here is the call graph for this function:

◆ ksched_setscheduler()

int ksched_setscheduler ( struct ksched ksched,
struct thread *  td,
int  policy,
const struct sched_param *  param 
)

Definition at line 172 of file ksched.c.

References P1B_PRIO_MAX, P1B_PRIO_MIN, p4prio_to_rtpprio, p4prio_to_tsprio, and rtp_to_pri().

Referenced by ksched_setparam().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ksched_yield()

int ksched_yield ( struct ksched ksched)

Definition at line 218 of file ksched.c.

References sched_relinquish().

Here is the call graph for this function: