[8 Since this system call is usually invoked to lower the priority of a process users who invoke it for their processes are nice to other users

The sys_nice( ) service routine handles the nice( ) system call. Although the increment parameter may have any value, absolute values larger than 40 are trimmed down to 40. Traditionally, negative values correspond to requests for priority increments and require superuser privileges, while positive ones correspond to requests for priority decrements. In the case of a negative increment, the function invokes the capable( ) function to verify whether the process has a cap_sys_nice capability. We discuss that function, together with the notion of capability, in Chapter 20. If the user turns out to have the capability required to change priorities, sys_nice( ) adds the value of increment to the nice field of current. If necessary, the value of this field is trimmed down so it won't be less than - 20 or greater than + 19.

The nice( ) system call is maintained for backward compatibility only; it has been replaced by the setpriority( ) system call described next.

Was this article helpful?

0 0

Post a comment