Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (n - p) nice(2)
If the sum of the old nice value and the increment is
less than 0 (zero), then the new nice value is 0 (zero).
greater than 39, then the new nice value is 39 because the current value of 2*NZERO -1
is 39.
Refer to NOTES for a description of the relative priorities of Guardian and OSS processes.
Use From the Guardian Environment
The nice() function can be used from the Guardian environment.
NOTES
Changing the Guardian priority of a process does not affect the nice value of the process.
The nice value of a process can also be changed by a call to the Guardian procedure
PROCESS_SETINFO_. The nice value can be determined by a call to the Guardian procedure
PROCESS_GETINFOLIST_. Refer to the
Guardian Procedure Calls Reference Manual for
additional information.
The nice value is not the value used by the operating system to compare scheduling priorities
among processes in all environments.
The scheduling priority for processes running in the Guardian environment is dened as increas-
ing as the priority number increases. This convention is the opposite of the convention used on
UNIX systems, where a lower priority number means a higher scheduling priority.
Processes running in the OSS environment have their scheduling priorities determined using
UNIX conventions. The OSS priority of a process after a call to the nice() function is calculated
as follows:
New OSS priority = 199 - new Guardian priority
- new nice value
which is the same as:
New OSS priority = 199 - new Guardian priority
- (old nice value + increment)
RETURN VALUES
Upon successful completion, the nice() function returns the new nice value minus the value of
NZERO. If the function call fails, the value -1 is returned, the nice value for the process is not
changed, and errno is set to indicate the error.
Because a value of -1 also can be returned by a successful completion of the function call, an
application program that needs to check for failure of the function call should set errno to 0
(zero) before calling the nice() function.
ERRORS
If the following condition occurs, nice() sets errno to the corresponding value:
[EPERM] The calling process specied a negative value for the increment parameter but
does not have appropriate privileges.
RELATED INFORMATION
Functions: execl(2), execle(2), execlp(2), execv(2), execve(2), execvp(2), fork(2),
tdm_execve(2), tdm_execvep(2), tdm_fork(2), tdm_spawn(2), tdm_spawnp(2).
527186-003 Hewlett-Packard Company 53