Get the scheduling policy and parameters for a thread
Synopsis:
#include <sys/neutrino.h>
int SchedGet( pid_t pid,
int tid,
struct sched_param *param );
int SchedGet_r( pid_t pid,
int tid,
struct sched_param *param );
Arguments:
- pid
- 0 or a process ID; see below.
- tid
- 0 or a thread ID; see below.
- param
- NULL, or a pointer to a
sched_param
structure where the function can store the scheduling parameters.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
The SchedGet() and SchedGet_r()
kernel calls return the current scheduling
policy and parameters for the thread specified by tid
in the process specified by pid. If pid is zero,
the current process is used to look up a nonzero tid. If
pid and tid are zero, then the calling thread is
used.
These functions are identical
except in the way they indicate errors.
See the Returns section for details.
Note:
- Instead of using these kernel calls directly, consider calling
pthread_getschedparam(),
sched_getparam(),
or
sched_getscheduler().
- In order to get the scheduling policy and parameters for a thread whose real or saved user ID is different from
the calling process's real or effective user ID, your process must have the
PROCMGR_AID_SCHEDULE ability enabled.
For more information, see
procmgr_ability().
The scheduling policy is returned on success and is one of
SCHED_FIFO, SCHED_RR,
SCHED_SPORADIC,
or SCHED_OTHER.
Blocking states
These calls don't block.
Returns:
The current scheduling policy. If an error occurs:
- SchedGet() returns -1 and sets
errno.
- SchedGet_r() returns the negative of a value from the Errors section and
doesn't set errno.
Errors:
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
- EPERM
- The calling process doesn't have the required permission; see
procmgr_ability().
- ESRCH
- The process indicated by pid or thread indicated by tid doesn't exist.
Classification:
QNX Neutrino
Safety: |
|
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |