1GETPRIORITY(2) 386BSD Programmer's Manual GETPRIORITY(2) 2 3NNAAMMEE 4 ggeettpprriioorriittyy, sseettpprriioorriittyy - get/set program scheduling priority 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<ssyyss//ttiimmee..hh>> 8 ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>> 9 10 _i_n_t 11 ggeettpprriioorriittyy(_i_n_t _w_h_i_c_h, _i_n_t _w_h_o) 12 13 _i_n_t 14 sseettpprriioorriittyy(_i_n_t _w_h_i_c_h, _i_n_t _w_h_o, _i_n_t _p_r_i_o) 15 16DDEESSCCRRIIPPTTIIOONN 17 The scheduling priority of the process, process group, or user, as 18 indicated by _w_h_i_c_h and _w_h_o is obtained with the ggeettpprriioorriittyy() call and 19 set with the sseettpprriioorriittyy() call. _W_h_i_c_h is one of PRIO_PROCESS, 20 PRIO_PGRP, or PRIO_USER, and _w_h_o is interpreted relative to _w_h_i_c_h (a 21 process identifier for PRIO_PROCESS, process group identifier for 22 PRIO_PGRP, and a user ID for PRIO_USER). A zero value of _w_h_o denotes the 23 current process, process group, or user. _P_r_i_o is a value in the range 24 -20 to 20. The default priority is 0; lower priorities cause more 25 favorable scheduling. 26 27 The ggeettpprriioorriittyy() call returns the highest priority (lowest numerical 28 value) enjoyed by any of the specified processes. The sseettpprriioorriittyy() call 29 sets the priorities of all of the specified processes to the specified 30 value. Only the super-user may lower priorities. 31 32RREETTUURRNN VVAALLUUEESS 33 Since ggeettpprriioorriittyy() can legitimately return the value -1, it is necessary 34 to clear the external variable _e_r_r_n_o prior to the call, then check it 35 afterward to determine if a -1 is an error or a legitimate value. The 36 sseettpprriioorriittyy() call returns 0 if there is no error, or -1 if there is. 37 38EERRRROORRSS 39 GGeettpprriioorriittyy() and sseettpprriioorriittyy() will fail if: 40 41 [ESRCH] No process was located using the _w_h_i_c_h and _w_h_o values 42 specified. 43 44 [EINVAL] _W_h_i_c_h was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER. 45 46 In addition to the errors indicated above, sseettpprriioorriittyy() will fail if: 47 48 [EPERM] A process was located, but neither its effective nor real 49 user ID matched the effective user ID of the caller. 50 51 [EACCES] A non super-user attempted to lower a process priority. 52 53SSEEEE AALLSSOO 54 nice(1), fork(2), renice(8) 55 56HHIISSTTOORRYY 57 The ggeettpprriioorriittyy function call appeared in 4.2BSD. 58 594th Berkeley Distribution March 10, 1991 1 60 61 62 63 64 65 66 67