-
Robert Schmidt authored
SYS_NICE is a capability that allows a process to set thread affinity and priority, among other things (see capabilities(7) for more info). In this commit, add a function that allows to determine if the process has this capability, and try to change the thread affinity and priority, if requested. If the capability does not exist, the function will simply not attempt to change the corresponding thread attributes. To determine if the process has SYS_NICE, libcap can be used. However, it might not be installed by default. To avoid requiring another dependency, if we detect that libcap is not present, use a workaround by try to set a real-time scheduling policy; if it's present, or can be changed, we assume that the process has SYS_NICE (and clean up, if relevant). Simplify reading of capabilities
66bf27bc