Get scheduler information
#include <sys/neutrino.h> int SchedInfo( pid_t pid, int policy, struct _sched_info* info ); int SchedInfo_r( pid_t pid, int policy, struct _sched_info* info );
- A process ID, or 0 to get information about the current process.
- One of the following:
- SCHED_FIFO — a fixed-priority scheduler in which the highest priority, ready thread runs until it blocks or is preempted by a higher-priority thread.
- SCHED_RR — the same as SCHED_FIFO, except threads at the same priority level timeslice (round robin) every 4 × the clock period (see ClockPeriod() ).
- SCHED_OTHER — currently the same as SCHED_RR.
- SCHED_SPORADIC — sporadic scheduling. For more information, see pthread_attr_setschedpolicy() , and Scheduling policies in the chapter on the Neutrino microkernel in the System Architecture guide.
- A pointer to a _sched_info structure where the function can store the scheduler information.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
These kernel calls return information about the kernel's thread scheduler, including the minimum and maximum thread priority, for the process ID specified by pid when using the specified scheduling policy. If pid is 0, the scheduler information for the current process is returned. In either case, the struct _sched_info pointed to by info is filled in with the appropriate information.
The SchedInfo() and SchedInfo_r() functions are identical except in the way they indicate errors. See the Returns section for details.
The struct _sched_info structure pointed to by info contains at least these members:
- uint64_t interval
- The current execution time limit before the thread is suspended in favor of the scheduler.
- int priority_max
- The maximum priority for a thread using this scheduling policy.
- int priority_min
- The minimum priority for a thread using this scheduling policy.
The only difference between these functions is the way they indicate errors:
- If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
- EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.
- The pid or policy is invalid.
- The SchedInfo() function isn't supported by this system.
- The process specified by pid doesn't exist.