Psetpriority()

LONG Psetpriority(which, who, pri)

WORD which;
WORD who;
WORD pri;
Psetpriority() sets the current priority value for a process.
Opcode345 (0x0159)
AvailabilityAvailable when a MiNT kernel of a version at least 1.15.0 release is detected.
Parameters Pgetpriority() sets the priority pri (not an increment but an absolute value) for the processes specified by which and who. The interpretation of parameter who depends on which:

PRIO_PROCESS (0) sets the priority of process with process id which. A who of 0 implies the process id of the calling process.

PRIO_PGRP (1) sets the priority of the process group with process group id who. A who of 0 implies the process group id of the calling process.

PRIO_USER (2) sets the priority of the process of the user with user id who. A who of 0 implies the user id of the calling process.

The pri argument is silently changed to the maximum (resp. minimum) possible value if it is not in the range between PRIO_MIN (-20) and PRIO_MAX (+20).

Binding
move.w	pri,-(sp)
move.w	who,-(sp)
move.w	which,-(sp)
move.w	#$0159,-(sp)
trap	#1
addq.l	#8,sp
Return ValueThe function returns E_OK on success or a negative error code otherwise. The following error conditions are defined:

EINVAL, invalid argument for who, which or pri.

EACCES, the calling process is not an owner of one or more of the selected processes. The other selected processes are still affected.

EPERM, the calling process does not have privileges to change the priority of one or more of the selected processes. This can only happen if an attempt was made to change the priority of a process to a positive value.

ESRCH, the combination of which and who does not match any existing process.

The error condition reported is the last error condition encountered (in other words if both EACCES and EPERM occur the return value is arbitrary).

CommentsThis call makes calls Pnice() and Prenice() obsolete.
See Also Pgetpriority()