Set the scheduling policy and parameters for a thread
Synopsis:
#include <sys/neutrino.h>
int SchedSet(
pid_t pid,
int tid,
int policy,
const struct sched_param *param );
int SchedSet_r(
pid_t pid,
int tid,
int policy,
const struct sched_param *param );
Arguments:
- pid
- 0 or a process ID; see below.
- tid
- 0 or a thread ID; see below.
- policy
- The scheduling policy; one of:
For more information, see
Thread scheduling
in the QNX Neutrino Microkernel chapter of the
System Architecture guide.
- param
- A pointer to a
sched_param
structure that holds the new scheduling parameters.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
The SchedSet() and SchedSet_r()
kernel calls set both the scheduling
policy and the associated 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 tid is zero, then the calling thread is
used and pid is ignored.
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_setschedparam(),
pthread_setschedprio(),
sched_setparam(),
or
sched_setscheduler().
- In order to set the scheduling policy and parameters for a process whose user ID is different from
the calling process's real or effective user ID, your process must have the
PROCMGR_AID_SCHEDULE ability enabled.
In order to set the priority above the maximum allowed for unprivileged processes, your process must have the
PROCMGR_AID_PRIORITY ability enabled.
For more information, see
procmgr_ability().
Blocking states
These calls don't block.
Returns:
The only difference between these functions is the way they indicate errors:
- SchedSet()
- If an error occurs, -1 is returned and
errno
is set.
Any other value returned indicates success.
- SchedSet_r()
- EOK is returned on success.
This function does NOT set errno.
If an error occurs, any value in the Errors section may be returned.
Errors:
- EFAULT
- A fault occurred when the kernel tried to access the buffers you provided.
- EINVAL
- The given scheduling policy is invalid.
- 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 |