<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.vmssoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24SETPRI</id>
	<title>$SETPRI - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.vmssoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24SETPRI"/>
	<link rel="alternate" type="text/html" href="https://wiki.vmssoftware.com/index.php?title=$SETPRI&amp;action=history"/>
	<updated>2026-04-30T09:43:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://wiki.vmssoftware.com/index.php?title=$SETPRI&amp;diff=1409&amp;oldid=prev</id>
		<title>Jane.doe: Created page with &quot;&#039;&#039;&#039;$SETPRI&#039;&#039;&#039;, or &#039;&#039;&#039;Set Priority&#039;&#039;&#039;, is a system service that changes the base priority of a process.  =Description=  The Set Priority se...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.vmssoftware.com/index.php?title=$SETPRI&amp;diff=1409&amp;oldid=prev"/>
		<updated>2019-11-13T10:26:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;$SETPRI&amp;#039;&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;&amp;#039;Set Priority&amp;#039;&amp;#039;&amp;#039;, is a &lt;a href=&quot;/System_Service&quot; title=&quot;System Service&quot;&gt;system service&lt;/a&gt; that changes the &lt;a href=&quot;/Base_Priority&quot; title=&quot;Base Priority&quot;&gt;base priority&lt;/a&gt; of a process.  =Description=  The Set Priority se...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;$SETPRI&amp;#039;&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;&amp;#039;Set Priority&amp;#039;&amp;#039;&amp;#039;, is a [[System Service|system service]] that changes the [[Base Priority|base priority]] of a process.&lt;br /&gt;
&lt;br /&gt;
=Description=&lt;br /&gt;
&lt;br /&gt;
The Set Priority service changes the base priority of the process or, optionally, changes the scheduling policy of the process. The base priority is used to determine the order in which executable processes are to run.&lt;br /&gt;
The scheduling policy denotes the following:&lt;br /&gt;
&lt;br /&gt;
* The basic scheduling discipline (FIFO, round-robin, and so forth).&lt;br /&gt;
* The preemption/compensation rules by which a running process is descheduled in favor of another process and, ultimately, rescheduled.&lt;br /&gt;
&lt;br /&gt;
A source process can modify the priority or scheduling policy of a target process if any of the following are true:&lt;br /&gt;
* The source and target processes are in the same job tree.&lt;br /&gt;
* The source and target processes have the same UIC.&lt;br /&gt;
* The source process has WORLD privilege enabled.&lt;br /&gt;
* The source and target processes are in the same process group.&lt;br /&gt;
&lt;br /&gt;
The value to which the priority of a process can be set can be subject to limitations. If the source has [[ALTPRI]] privilege enabled, the target can be set to any valid priority. Otherwise, the priority value specified by the source process is compared to the authorized priority of the target process and the smaller of the two values is used as the new base priority of the target process.&lt;br /&gt;
&lt;br /&gt;
If you specify neither the [[#pidadr|pidadr]] nor the [[#prcnam|prcnam]] argument, $SETPRI sets the base priority of the calling process.&lt;br /&gt;
&lt;br /&gt;
If the longword at address [[#pidadr|pidadr]] is the value 0, the [[PID]] of the target process is returned. The base priority of a process remains in effect until specifically changed or until the process is deleted.&lt;br /&gt;
&lt;br /&gt;
To determine the priority set by the $SETPRI service, use the [[$GETJPI|Get Job/Process Information ($GETJPI)]] service.&lt;br /&gt;
&lt;br /&gt;
=Syntax=&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;SYS$SETPRI [&amp;lt;/nowiki&amp;gt;[[#pidadr|pidadr]]&amp;lt;nowiki&amp;gt;] ,[&amp;lt;/nowiki&amp;gt;[[#prcnam|prcnam]]&amp;lt;nowiki&amp;gt;] ,&amp;lt;/nowiki&amp;gt;[[#pri|pri]]&amp;lt;nowiki&amp;gt; ,[&amp;lt;/nowiki&amp;gt;[[#prvpri|prvpri]]&amp;lt;nowiki&amp;gt;] ,[&amp;lt;/nowiki&amp;gt;[[#nullarg|nullarg]]&amp;lt;nowiki&amp;gt;] ,[&amp;lt;/nowiki&amp;gt;[[#nullarg|nullarg]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C prototype:&lt;br /&gt;
int sys$setpri&lt;br /&gt;
    (unsigned int *pidadr, void *prcnam, unsigned int pri,&lt;br /&gt;
     unsigned int *prvpri, unsigned int *pol, unsigned int *prvpol);&lt;br /&gt;
&lt;br /&gt;
=Arguments=&lt;br /&gt;
==pidadr==&lt;br /&gt;
{{SyservArgument|process_id|longword (unsigned)|modify|by reference}}&lt;br /&gt;
&lt;br /&gt;
[[PID|Process identification (PID)]] of the process whose [[Base Priority|priority]] is to be set. The pidadr argument is the address of the PID. The pidadr argument can refer to a process running on the local node or a process running on another node in the [[Cluster|cluster]].&lt;br /&gt;
&lt;br /&gt;
==prcnam==&lt;br /&gt;
{{SyservArgument|process_name|character-coded text string|read only|by descriptor-fixed-length string descriptor}}&lt;br /&gt;
&lt;br /&gt;
Process name of the process whose priority is to be changed. The prcnam argument is the address of a character string descriptor pointing to the process name.&lt;br /&gt;
&lt;br /&gt;
A process running on the local node can be identified with a 1- to 15-character string. To identify a process on a particular node on a cluster, specify the full process name, which includes the node name as well as the process name. The full process name can contain up to 23 characters.&lt;br /&gt;
&lt;br /&gt;
You can use the prcnam argument only on behalf of processes in the same UIC group as the calling process. To set the priority for processes in other groups, you must specify the pidadr argument.&lt;br /&gt;
&lt;br /&gt;
==pri==&lt;br /&gt;
{{SyservArgument|longword_unsigned|longword (unsigned)|read only|by value}}&lt;br /&gt;
&lt;br /&gt;
New base priority to be established for the process. The pri argument is a longword value containing the new priority. Priorities that are not real time are in the range 0 through 15; real-time priorities are in the range 16 through 31.&lt;br /&gt;
&lt;br /&gt;
If the specified priority is higher than the base priority of the target process, and if the caller does not have [[ALTPRI]] privilege, then the base priority of the target process is used.&lt;br /&gt;
&lt;br /&gt;
==prvpri==&lt;br /&gt;
{{SyservArgument|longword_unsigned|longword (unsigned)|read only|by reference}}&lt;br /&gt;
&lt;br /&gt;
Base priority of the process before the call to $SETPRI. The prvpri argument is the address of a longword into which $SETPRI writes the previous base priority of the process.&lt;br /&gt;
&lt;br /&gt;
==policy==&lt;br /&gt;
{{SyservArgument|longword_unsigned|longword (unsigned)|read only|by reference}}&lt;br /&gt;
&lt;br /&gt;
On [[Alpha]] and [[Integrity]] server systems, address of a longword containing the new scheduling policy for the process. The [[$JPIDEF]] macro defines the following symbols for the policy argument:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;col&amp;quot; | Symbol&lt;br /&gt;
! colspan=&amp;quot;col&amp;quot; | Meaning&lt;br /&gt;
|-&lt;br /&gt;
| JPI$K_DEFAULT_POLICY&lt;br /&gt;
| The normal scheduling policy. The priority interval for this policy is defined as [0.. n], such that priorities [0..15] are interactive and priorities [16.. n] are real time.&lt;br /&gt;
|-&lt;br /&gt;
| JPI$K_PSX_FIFO_POLICY&lt;br /&gt;
| POSIX FIFO scheduling policy. The priority interval for this policy is defined as [ n.. m] real-time priorities.&lt;br /&gt;
|-&lt;br /&gt;
| JPI$K_PSX_RR_POLICY &lt;br /&gt;
| POSIX round-robin policy. The priority interval for this policy is defined as [ n.. m] real-time priorities.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==prvpol==&lt;br /&gt;
{{SyservArgument|longword_unsigned|longword (unsigned)|write only|by reference}}&lt;br /&gt;
&lt;br /&gt;
On [[Alpha]] and [[Integrity]] server systems, address of a longword into which the previous scheduling policy for the process is written. If the policy argument is null, no change in policy is requested and prvpol returns the current policy.&lt;br /&gt;
&lt;br /&gt;
The valid priority intervals for specific scheduling policies might change in the future. Applications should, therefore, not use embedded numeric constants for scheduling priority, but should use the appropriate $GETSYI item codes to fetch the legal priority intervals. The application can then dynamically select a priority value that is within the interval. The $GETSYI item codes are:&lt;br /&gt;
&lt;br /&gt;
* SYI$_DEF_PRIO_MAX, SYI$_DEF_PRIO_MIN&lt;br /&gt;
* SYI$_PSXFIFO_PRIO_MAX, SYI$_PSXFIFO_PRIO_MIN&lt;br /&gt;
* SYI$_PSXRR_PRIO_MAX, SYI$_PSXRR_PRIO_MIN&lt;br /&gt;
&lt;br /&gt;
See the Item Codes section of the [[$GETSYI]] service description for more information about these item codes.&lt;br /&gt;
&lt;br /&gt;
==nullarg==&lt;br /&gt;
{{SyservArgument|ef_number|longword (unsigned)|read only|by value}}&lt;br /&gt;
&lt;br /&gt;
Placeholding argument reserved to OpenVMS.&lt;br /&gt;
&lt;br /&gt;
=Condition Values Returned=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;col&amp;quot; | Value&lt;br /&gt;
! colspan=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| SS$_NORMAL&lt;br /&gt;
| The service completed successfully.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_ACCVIO&lt;br /&gt;
| The process name string or string descriptor cannot be read by the caller, or the process identification or previous priority longword cannot be written by the caller.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_ILLPOLICY&lt;br /&gt;
| An invalid scheduling policy was specified.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_ILLPRIPOL&lt;br /&gt;
| Setting the process to the specified priority and/or policy would result in an illegal policy/priority combination. The illegal combination can occur between the SETPRI policy and priority parameters themselves, or it can occur between either of the parameters and the current policy and/or priority of the target process.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_INCOMPAT&lt;br /&gt;
| The remote node is running an incompatible version of the operating system.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_IVLOGNAM&lt;br /&gt;
| The process name string has a length of 0 or has more than 15 characters.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_NONEXPR&lt;br /&gt;
| The specified process does not exist, or an invalid process identification was specified.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_NOPRIV&lt;br /&gt;
| The process does not have the privilege to affect other processes.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_NOSUCHNODE&lt;br /&gt;
| The process name refers to a node that is not currently recognized as part of the cluster.&lt;br /&gt;
|-&lt;br /&gt;
| SS$_REMRSRC&lt;br /&gt;
| The remote node has insufficient resources to respond to the request. (Bring this error to the attention of your system manager.)&lt;br /&gt;
|-&lt;br /&gt;
| SS$_UNREACHABLE&lt;br /&gt;
| The remote node is a member of the cluster but is not accepting requests. (This is normal for a brief period early in the system boot process.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Privileges Required=&lt;br /&gt;
Depending on the operation, the calling process might need one of the following privileges to use $SETPRI:&lt;br /&gt;
* [[GROUP]] privilege to change the priority of a process in the same group, unless the target process has the same UIC as the calling process.&lt;br /&gt;
* [[WORLD]] privilege to change the priority of any other process in the system.&lt;br /&gt;
* [[ALTPRI]] privilege to set any process&amp;#039;s priority to a value greater than the target process&amp;#039;s initial base priority. If a process does not have [[ALTPRI]] privilege, the priority value specified by the source process is compared to the authorized priority of the target process and the smaller of the two values is used as the new base priority of the target process.&lt;br /&gt;
&lt;br /&gt;
=Quota Required=&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [http://www.eight-cubed.com/examples/framework.php?file=sys_setpri.c James F. Duff&amp;#039;s example on eight-cubed.com]&lt;br /&gt;
* [[$CANEXH]]&lt;br /&gt;
* [[$CREPRC]]&lt;br /&gt;
* [[$DCLEXH]]&lt;br /&gt;
* [[$DELPRC]]&lt;br /&gt;
* [[$EXIT]]&lt;br /&gt;
* [[$FORCEX]]&lt;br /&gt;
* [[$GETJPI]]&lt;br /&gt;
* [[$GETJPIW]]&lt;br /&gt;
* [[$HIBER]]&lt;br /&gt;
* [[$PROCESS_SCAN]]&lt;br /&gt;
* [[$RESUME]]&lt;br /&gt;
* [[$SETPRN]]&lt;br /&gt;
* [[$SETPRV]]&lt;br /&gt;
* [[$SETRWM]]&lt;br /&gt;
* [[$SUSPND]]&lt;br /&gt;
* [[$WAKE]]&lt;br /&gt;
&lt;br /&gt;
[[Category:System Services]]&lt;/div&gt;</summary>
		<author><name>Jane.doe</name></author>
	</entry>
</feed>