setiopri Subroutine

Purpose

Enables the setting of a process I/O priority.

Syntax

short setiopri (ProcessID, IOPriority);
pid_t ProcessID;ushort IOPriority

Description

The setiopri subroutine sets the I/O scheduling priority of all threads in a process to be a constant. If the target process ID does not match the process ID of the caller, the caller must either be running as root or have an effective and real user ID that matches the target process. A smaller value for the IOPriority designates a higher scheduling priority. Only a few I/O devices support priorities.

Parameters

Item Description
ProcessID Specifies the process ID. If this value is -1, the current process I/O scheduling priority is set to a constant.
IOPriority Specifies the I/O scheduling priority for the process. The IOPriority parameter must be in the range IOPRIORITY_MINIOPriority<IOPRIORITY_MAX. (See the sys/extendio.h file.)

Return Values

Upon successful completion, the setiopri subroutine returns the former I/O scheduling priority of the process just changed. A returned value of IOPRIORITY_UNSET indicates that the I/O priority was not set. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Errors

Item Description
EINVAL IOPriority value is invalid.
EPERM The calling process is not root. It does not have the same process ID as the target process, and does not have the same real effective user ID as the target process.
ESRCH No process can be found corresponding to the specified ProcessID.

Implementation Specifics

  1. Implementation requires an additional field in the proc structure.
  2. The default setting for process I/O priority is IOPRIORITY_UNSET.
  3. Once set, process I/O priorities should be inherited across a fork. I/O priorities should not be inherited across an exec.
  4. The setiopri system call generates an auditing event using audit_svcstart if auditing is enabled on the system (audit_flag is true).