renice: support posix-compliant -n (via POSIXLY_CORRECT) and add --relative flag
As noted in bug #1892, renice is not 100% posix compliant
as the '-n' option should update the priority 'relative'
to the current priority.
As such change would break compatibility, the current
approach was taken:
- donice() has now a new param to denote if priority is
absolute or relative.
- main() interprets '-n' as absolute if environment
variable POSIXLY_CORRECT is **not set**. Otherwise,
it uses a relative value, as POSIX mandates.
- The option '--priority' is left as it is: uses an
absolute value.
- A new option '--relative' is added, should a user
want a posix compatible variant without setting up
an environment variable.
- manpage is updated to display all these changes.
After this patch:
- Calling renice with '-n 2' on a process with current
priority '2' and POSIXLY_CORRECT, will try to update
it to priority '4', instead of '2'.
- Calling renice with '--priority 2' on a process with
current priority '2', leaves the process at priority
'2'.
- Calling renice with '--relative 2' on a process with
current priority '2' will try to update the it to
priority '4', regardless of environment flags.