Index of Section 2 Manual Pages

Interix / SUAgetpriority.2Interix / SUA

getpriority(2)                                           getpriority(2)

  getpriority()

  NAME

    getpriority(), setpriority() - get or set process' nice value

  SYNOPSIS

    #include 

    int getpriority(int which, id_t who)
    int setpriority(int which, id_t who, int value)

  DESCRIPTION

    The getpriority(2) call returns the current nice value for a process,
    process group, or a user. The returned nice value is in the range of [-
    NZERO, NZERO-1]. NZERO is defined in /usr/include/limits.h and specifies
    the default process priority. (This is the value that would be set with
    setpriority(2) minus NZERO.)

    The setpriority(2) call sets the current nice value for a process, process
    group, or a user to the value of value + NZERO.

    For both calls, the target processes are identified by the which and who
    arguments: which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER
    (indicating a process, a process group, and a user, respectively); the who
    argument is the process ID, process group ID, or effective user ID,
    depending upon the value of which. If who is 0, it indicates the current
    process, process group, or user.

    The third argument to setpriority(2) is value, the new nice value. This is
    an integer in the range of [0, 2*NZERO-1]. If value is too low, the nice
    value is set to the lowest possible value; if value is too high, the nice
    value is set to the highest possible value. Lower values cause better
    scheduling. However, only a process with appropriate privileges can lower
    its own nice value.

    Since -1 is a valid return value for getpriority(2), set errno to 0 before
    calling getpriority(2); then, if getpriority(2) returns -1, check to see
    if errno is non-zero.

  RETURN VALUES

    If it succeeds, the getpriority(2) call returns a value in the range of [-
    NZERO, NZERO-1], which is the nice value of the target process, process
    group, or user. If it fails, the getpriority(2) call returns -1 and sets
    errno to indicate the error.

    The setpriority(2) call returns 0 on successful completion. Otherwise, it
    returns -1 and sets errno to indicate the error.

  ERRORS

    The getpriority(2) and setpriority(2) calls can fail for these reasons:

    [EINVAL]
        The which argument was not recognized or the who argument is not a
        valid ID.

    [ESRCH]
        There was no process matching the which and who arguments.

    The setpriority(2) call can also fail for these reasons:

    [EACCES]
        The value of value was negative and the process did not have the
        appropriate privileges to lower the nice value.

    [EPERM]
        Although a process was located, its effective user ID did not match
        either the real or effective user ID of the executing process.

  SEE ALSO

    nice(1)

    renice(1)

    nice(3)

  USAGE NOTES

    All of these functions are thread safe.

    None of these functions are async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA