.\" Copyright (c) 1980, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)getpriority.2 6.9 (Berkeley) 3/10/91 .\" .\" Modified Sat Jul 24 16:33:19 1993 by Rik Faith .\" Modified Mon Jul 1 21:59:57 1996 by Andries Brouwer .\" Modified Wed Nov 6 03:55:47 1996 by Eric S. Raymond .\" .TH GETPRIORITY 2 "24 julio 1993" "Página de Manual BSD" "Manual del Programador de Linux" .SH NOMBRE getpriority, setpriority \- obtiene/asigna la prioridad de planificación de un programa .SH SINOPSIS .B #include .br .B #include .sp .BI "int getpriority(int " which ", int " who ); .br .BI "int setpriority(int " which ", int " who ", int " prio ); .SH DESCRIPCIÓN La prioridad de planificación del proceso, grupo de procesos o usuario, según se indique en .I which y .I who se obtiene con la función .B getpriority y se asigna con .B setpriority. .I Which puede ser .BR PRIO_PROCESS , .BR PRIO_PGRP , o .BR PRIO_USER , y .I who se interpreta en función de .I which (un indentificador de proceso para .BR PRIO_PROCESS , un indentificador de grupo de procesos para .BR PRIO_PGRP , y un identificador de usuario para .BR PRIO_USER ). Un valor cero de .I who indica el proceso actual, grupo de procesos actual o usuario actual. .I Prio es un valor que puede variar de \-20 a 20. La prioridad por defecto es 0; cuanto más baja es la prioridad más favorable es la planificación. La llamada .B getpriority devuelve la prioridad más alta (el valor numérico más bajo) de la que disfruta cualquiera de los procesos especificados. La llamada .B setpriority asigna el valor especificado a las prioridades de todos los procesos especificados. Sólo el superusuario puede decrementar las prioridades (haciéndolas, por tanto, más altas). .SH "VALOR DEVUELTO" Ya que .B getpriority legítimamente puede devolver el valor \-1, es necesario borrar la variable externa .I errno antes de la llamada a la función y comprobar su valor más adelante para determinar si \-1 es un error o un valor legítimo. La función .B setpriority devuelve 0 si no hay error o \-1 si lo hay. .SH ERRORES .TP 0.8i .B ESRCH No se encontró ningún proceso que cumpliera con los valores especificados por .I which y .I who. .TP .B EINVAL .I Which no era .BR PRIO_PROCESS , .BR PRIO_PGRP , ni .BR PRIO_USER . .PP Además de los errores indicados arriba, .B setpriority fallará si: .TP .B EPERM Se encontró un proceso, pero ni su identificador de usuario efectivo ni su identificador de usuario real coincidieron con el identificador de usuario efectivo del invocador. .TP .B EACCES Un no superusuario intentó decrementar la prioridad de un proceso. .SH CONFORME A SVr4, 4.4BSD (estas funciones aparecieron por primera vez en 4.2BSD). .SH "VÉASE TAMBIÉN" .BR nice (1), .BR fork (2), .BR renice (8)