X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=man2%2Fgetgroups.2;h=043e60677aa83adc978e2ee97c020a057a978ffa;hb=4d4708bfd2d03c430d94017173a556bd6472b660;hp=1873a7aecf90a78aa5d2f6137d9929fd90a33764;hpb=68e4db0a44094791f80de4fef12eb3797d1193ca;p=thirdparty%2Fman-pages.git diff --git a/man2/getgroups.2 b/man2/getgroups.2 index 1873a7aecf..043e60677a 100644 --- a/man2/getgroups.2 +++ b/man2/getgroups.2 @@ -29,7 +29,7 @@ .\" 2008-05-03, mtk, expanded and rewrote parts of DESCRIPTION and RETURN .\" VALUE, made style of page more consistent with man-pages style. .\" -.TH GETGROUPS 2 2016-10-08 "Linux" "Linux Programmer's Manual" +.TH GETGROUPS 2 2019-03-06 "Linux" "Linux Programmer's Manual" .SH NAME getgroups, setgroups \- get/set list of supplementary group IDs .SH SYNOPSIS @@ -38,7 +38,7 @@ getgroups, setgroups \- get/set list of supplementary group IDs .B #include .PP .BI "int getgroups(int " size ", gid_t " list []); -.PP + .B #include .PP .BI "int setgroups(size_t " size ", const gid_t *" list ); @@ -66,12 +66,13 @@ buffer pointed to by If the calling process is a member of more than .I size supplementary groups, then an error results. +.PP It is unspecified whether the effective group ID of the calling process is included in the returned list. (Thus, an application should also call .BR getegid (2) and add or remove the resulting value.) - +.PP If .I size is zero, @@ -93,6 +94,13 @@ The argument specifies the number of supplementary group IDs in the buffer pointed to by .IR list . +A process can drop all of its supplementary groups with the call: +.PP +.in +4n +.EX +setgroups(0, NULL); +.EE +.in .SH RETURN VALUE On success, .BR getgroups () @@ -100,7 +108,7 @@ returns the number of supplementary group IDs. On error, \-1 is returned, and .I errno is set appropriately. - +.PP On success, .BR setgroups () returns 0. @@ -147,10 +155,11 @@ See the description of in .BR user_namespaces (7). .SH CONFORMING TO +.BR getgroups (): +SVr4, 4.3BSD, POSIX.1-2001, POSIX.1-2008. +.PP +.BR setgroups (): SVr4, 4.3BSD. -The -.BR getgroups () -function is in POSIX.1-2001 and POSIX.1-2008. Since .BR setgroups () requires privilege, it is not covered by POSIX.1. @@ -166,22 +175,24 @@ is defined in The set of supplementary group IDs is inherited from the parent process, and preserved across an .BR execve (2). - +.PP The maximum number of supplementary group IDs can be found at run time using .BR sysconf (3): -.nf - - long ngroups_max; - ngroups_max = sysconf(_SC_NGROUPS_MAX); - -.fi +.PP +.in +4n +.EX +long ngroups_max; +ngroups_max = sysconf(_SC_NGROUPS_MAX); +.EE +.in +.PP The maximum return value of .BR getgroups () cannot be larger than one more than this value. Since Linux 2.6.4, the maximum number of supplementary group IDs is also exposed via the Linux-specific read-only file, .IR /proc/sys/kernel/ngroups_max . - +.PP The original Linux .BR getgroups () system call supported only 16-bit group IDs.