_lwp_setscheduler.2 (2010 09)
_
_lwp_setscheduler(2) _lwp_setscheduler(2)
NAME
_lwp_setscheduler() - set LWP(Lightweight Process) scheduling policy and parameters
SYNOPSIS
cc [ flag... ] file... -lpthread
#include <sys/lwp_sched.h>
int _lwp_setscheduler(int cmd, lwpid_t target_lwp, int policy, struct
sched_param *param);
DESCRIPTION
The _lwp_setscheduler()
function allows the scheduling policy and parameters of an individual
LWP in any process to be set. For
SCHED_FIFO and SCHED_RR the only required member of the
sched_param structure is the priority sched_priority.
The cmd argument determines the action to be performed by the
_lwp_setscheduler()
system call
and supports one of the following values. Other values of cmd are reserved for use by HP and may
change without notice. The behavior of _lwp_setscheduler is undefined if any other value is passed to the
cmd argument and it may change without notice.
LWP_SCHED_SPECIFIC
This request sets the scheduling policy and associated scheduling parameters for the LWP
whose LWP ID is specified by target_lwp to the policy and associated parameters provided in
policy and param respectively. The LWPID specified by target_lwp can be in any process. If
the value of target_lwp is zero (0), the target LWP will be the calling LWP.
LWP_SCHED_ALLTHREADS
This request sets the scheduling policy and associated scheduling parameters for all LWPs in
the target process specified by target_lwp to the policy and associated parameters provided in
policy and param , respectively. For this request, the PID value should be passed in the
target_lwp parameter. The policy and param arguments are stored in the process so they may
be assigned to the child process during a fork operation.
If the
_lwp_setscheduler()
function fails, no scheduling parameters or policies shall be changed for
the specified LWP(s).
Appropriate privileges are required to change the scheduling parameters of another LWP. The calling
LWP must have appropriate privileges or be a member of a group having
PRIV_RTSCHED
access to suc-
cessfully call
_lwp_setscheduler().
Refer to the rtsched (2) manpage for a complete description of scheduling policies and priorities available.
_lwp_setscheduler()
is similar to the function sched_setscheduler() except that it operates
on lightweight processes instead of processes.
RETURN VALUE
Upon successful completion,
_lwp_setscheduler() returns with a value of 0; otherwise, it returns
an error number to indicate the error. The errno variable is NOT set if an error occurs.
ERRORS
For each of the following conditions, if the condition is detected, the
_lwp_setscheduler() function
fails and returns the corresponding error number:
[EACCES] The target process could not be accessed due to compartmental restrictions.
[EFAULT] The param parameter points to an illegal address.
[EINVAL] The cmd parameter is invalid.
[EINVAL] The value of the policy parameter is invalid, or the param parameter is NULL, or
one or more parameters contained in param is outside the valid range for the
specified scheduling policy.
[EPERM] The requesting LWP does not have permission to set the scheduling policy and
parameter for the specified LWP(s).
[ESRCH] No LWP can be found corresponding to that specified by target_lwp .
[ESRCH] No process can be found corresponding to that specified by target_lwp for the
LWP_SCHED_ALLTHREADS request.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1