@@ -941,6 +941,12 @@ pub fn setgid(gid: Gid) -> Result<()> {
941
941
Errno :: result ( res) . map ( drop)
942
942
}
943
943
944
+ /// Get the list of supplementary group IDs of the calling process.
945
+ ///
946
+ /// Note that if the user is added to more group(s) while this call is in
947
+ /// progress then an error (EINVAL) will be returned.
948
+ ///
949
+ /// [Further reading](http://pubs.opengroup.org/onlinepubs/009695399/functions/getgroups.html)
944
950
pub fn getgroups ( ) -> Result < Vec < Gid > > {
945
951
// First get the number of groups so we can size our Vec
946
952
use std:: ptr;
@@ -960,6 +966,9 @@ pub fn getgroups() -> Result<Vec<Gid>> {
960
966
} )
961
967
}
962
968
969
+ /// Set the list of supplementary group IDs for the calling process.
970
+ ///
971
+ /// [Further reading](http://man7.org/linux/man-pages/man2/getgroups.2.html)
963
972
pub fn setgroups ( groups : & [ Gid ] ) -> Result < ( ) > {
964
973
cfg_if ! {
965
974
if #[ cfg( any( target_os = "dragonfly" ,
@@ -979,6 +988,11 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
979
988
Errno :: result ( res) . map ( drop)
980
989
}
981
990
991
+ /// Initialize the supplementary group access list. Sets the supplementary
992
+ /// group IDs for the calling process using all groups that `user` is a member
993
+ /// of. The additional group `group` is also added to the list.
994
+ ///
995
+ /// [Further reading](http://man7.org/linux/man-pages/man3/initgroups.3.html)
982
996
#[ cfg( any( target_os = "android" , target_os = "ios" , target_os = "linux" , target_os = "macos" ) ) ]
983
997
pub fn initgroups ( user : & CString , group : Gid ) -> Result < ( ) > {
984
998
cfg_if ! {
0 commit comments