mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-16 01:22:18 +03:00
Because I actually managed to hit deadlock in libvirt's child process due to glibc's mutex use in user database lookup, I figured it is worth documenting the issue for others to be aware of when writing a privileged multithreaded parent app that spawns child processes owned by non-privileged ids. * doc/glibc-functions/initgroups.texi (initgroups): Mention multithread safety. * doc/posix-functions/getpwuid.texi (getpwuid): Likewise. * doc/posix-functions/getpwuid_r.texi (getpwuid_r): Likewise. * doc/glibc-functions/getgrouplist.texi (getgrouplist): Mention getugroups. * doc/posix-functions/getgroups.texi (getgroups): Mention multithread safety and mgetgroups. Signed-off-by: Eric Blake <eblake@redhat.com>
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
@node getgroups
|
|
@section @code{getgroups}
|
|
@findex getgroups
|
|
|
|
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getgroups.html}
|
|
|
|
Gnulib module: getgroups
|
|
|
|
Portability problems fixed by Gnulib:
|
|
@itemize
|
|
@item
|
|
This function is missing on some platforms:
|
|
mingw, MSVC 9.
|
|
@item
|
|
On some platforms, this function fails to reject a negative count,
|
|
even though that is less than the size that would be returned:
|
|
FreeBSD 7.2.
|
|
@item
|
|
On Ultrix 4.3, @code{getgroups (0, NULL)} always fails. See macro
|
|
@samp{AC_FUNC_GETGROUPS}.
|
|
@item
|
|
On very old systems, this function operated on an array of @samp{int},
|
|
even though that was a different size than an array of @samp{gid_t}.
|
|
@end itemize
|
|
|
|
Portability problems not fixed by Gnulib:
|
|
@itemize
|
|
@item
|
|
This function is unsafe to call between @code{fork} and @code{exec} if
|
|
the parent process is multi-threaded.
|
|
@item
|
|
It is unspecified whether the effective group id will be included in
|
|
the returned list, nor whether the list will be sorted in any
|
|
particular order. For that matter, some platforms include the
|
|
effective group id twice, if it is also a member of the current
|
|
supplemental group ids.
|
|
@end itemize
|
|
|
|
The Gnulib module @code{mgetgroups} provides a similar API.
|