Hash :
e28fbd78
Author :
Date :
2013-05-22T14:21:36
getgroups: document portability issues 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>
@node initgroups
@subsection @code{initgroups}
@findex initgroups
Gnulib module: ---
Portability problems fixed by Gnulib:
@itemize
@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. Instead, use @code{getgroups} or
@code{getgrouplist} (or use the gnulib module @code{mgetgroups})
before forking, and @code{setgroups} in the child.
@item
This function is missing on some platforms:
mingw, MSVC 9, Interix 3.5, BeOS.
@end itemize