Files
oldlinux-files/Ref-docs/syscalls/syscalls_86.html
2024-02-19 00:21:47 -05:00

51 lines
2.2 KiB
HTML

<html><!-- This HTML file has been created by texi2html 1.29
from syscalls.texi on 4 June 1994 -->
<TITLE>Syscall specifications of Linux - getgroups</TITLE>
<P>Go to the <A HREF="syscalls_85.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_85.html">previous</A>, <A HREF="syscalls_87.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_87.html">next</A> section.<P>
<H2><A NAME="SEC86" HREF="syscalls_toc.html#SEC86" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC86">getgroups and setgroups</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int getgroups(int <VAR>size</VAR>, gid_t <VAR>list</VAR>[]);</CODE>
<P>
<CODE>int setgroups(size_t <VAR>size</VAR>, const gid_t *<VAR>list</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>size</VAR>: [in] the maximum size of <VAR>list</VAR>.
<P>
<VAR>list</VAR>: (For <CODE>getgroups</CODE>) [out] the array where to put the
groups returned. (For <CODE>setgroups</CODE>) [in] the new supplemental groups.
<P>
<H3>DESCRIPTION</H3>
<P>
<CODE>getgroups</CODE>: up to <VAR>size</VAR> supplemental group entries of the
current task are returned in <VAR>list</VAR>. If <VAR>size</VAR> is zero, no
groups but instead the total number of supplemental groups is returned.
<P>
<CODE>setgroups</CODE>: sets the supplemental groups for the current task.
Only the superuser may call this function.
<P>
<H3>RETURN VALUE</H3>
<P>
On success, for <CODE>getgroups</CODE>, the number of groups returned in
<VAR>list</VAR> is returned. If <VAR>size</VAR> is zero, then the number of
supplemental groups is returned. In the case of <CODE>setgroups</CODE>, zero
is returned on success.
<P>
On error, -1 is returned and <CODE>errno</CODE> is set to one of the following
values:
<P>
For both calls: <CODE>EFAULT</CODE>.
<P>
For <CODE>setgroups</CODE>:
<P>
<UL>
<LI><CODE>EPERM</CODE>: the current taks does not have superuser permission.
<LI><CODE>EINVAL</CODE>: <VAR>size</VAR> is greater than the maximum possible number of
supplemental groups.
</UL>
<P>
<P>Go to the <A HREF="syscalls_85.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_85.html">previous</A>, <A HREF="syscalls_87.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_87.html">next</A> section.<P>