1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Thu Oct 31 12:04:29 1996 by Eric S. Raymond <esr@thyrsus.com>
.\"
.\" Translated 8 Jan 1996 Miguel A. Sepulveda (miguel@typhoon.harvard.edu)
.\" Modified 1 Jul 1996 Miguel A. Sepulveda (angel@vivaldi.princeton.edu)
.\" Translation revised on Wed Apr 29 18:30:20 CEST 1998 by Gerardo
.\" Aburruzaga García <gerardo.aburruzaga@uca.es>
.\" Translation revised Tue Aug 18 1998 by Juan Piernas <piernas@ditec.um.es>
.\" Revisado por Miguel Pérez Ibars <mpi79470@alu.um.es> el 11-noviembre-2004
.\"
.TH GETGROUPS 2 "10 Diciembre 1997" "Linux 2.0.32" "Manual del Programador de Linux"
.SH NOMBRE
getgroups, setgroups \- obtiene/asigna la lista de IDs de grupo suplementarios
.SH SINOPSIS
.B #include <sys/types.h>
.br
.B #include <unistd.h>
.sp
.BI "int getgroups(int " size ", gid_t " list []);
.sp
.B #include <grp.h>
.sp
.BI "int setgroups(size_t " size ", const gid_t *" list );
.SH DESCRIPCIÓN
.TP
.B getgroups
Se devuelven como mucho
.I size
identificadores de grupo suplementarios en
.IR list .
Queda sin especificar si el identificador de grupo efectivo del proceso
invocador se incluye en la lista devuelta. (Así, una aplicación debería llamar
también a
.BR getegid (2)
y añadir o eliminar el valor resultante.)
Si
.I size
es cero,
.I list
no se modifica, pero se devuelve el número total de identificadores de grupo
suplementarios para el
proceso.
.TP
.B setgroups
Asigna los identificadores de grupo suplementarios para el proceso. Sólo el superusuario
puede usar esta función.
.SH "VALOR DEVUELTO"
.TP
.B getgroups
En caso de éxito, se devuelve el número de grupos suplementarios.
En caso de error, se devuelve \-1 y se pone en
.I errno
un valor apropiado.
.TP
.B setgroups
En caso de éxito, se devuelve 0. Si hay un error, \-1, y se pone en
.I errno
un valor apropiado.
.SH ERRORES
.TP
.B EFAULT
.I list
tiene una dirección inválida.
.TP
.B EPERM
Para
.BR setgroups ,
el usuario no es el superusuario.
.TP
.B EINVAL
Para
.BR setgroups ,
.I size
es más grande que
.B NGROUPS
(32 para Linux 2.0.32).
Para
.BR getgroups ,
.I size
es menor que el número de IDs de grupos suplementarios, pero no es cero.
.SH OBSERVACIONES
Un proceso puede tener como máximo al menos NGROUPS_MAX identificadores
de grupo suplementarios además del identificador de grupo efectivo (EGID).
El conjunto de identificadores de grupo suplementarios es heredado del proceso
padre y puede ser modificado usando
.BR setgroups .
El número máximo de identificadores de grupo suplementarios puede averiguarse usando
.BR sysconf (3):
.nf
long ngroups_max;
ngroups_max = sysconf(_SC_NGROUPS_MAX);
.fi
El valor máximo devuelto por
.B getgroups
no puede ser mayor que el valor obtenido de esta manera más uno.
.LP
El prototipo para
.B setgroups
está disponible solamente si
.B _BSD_SOURCE
está definida (bien explícitamente, o implícitamente, no definiendo
_POSIX_SOURCE o compilando con la opción -ansi).
.SH "CONFORME A"
SVr4, SVID (sólo en la distribución 4; estas llamadas al sistema no
estaban presentes en SVr3), X/OPEN, 4.3BSD. La función
.B getgroups
está en POSIX.1. Puesto que
.B setgroups
requiere privilegios, no está cubierta por POSIX.1.
.SH "VÉASE TAMBIÉN"
.BR initgroups (3),
.BR getgid (2),
.BR setgid (2)
|