Skip to content

Commit

Permalink
Auto merge of #726 - JayH5:init-get-groups, r=alexcrichton
Browse files Browse the repository at this point in the history
Add getgrouplist(), add initgroups() to BSD platforms
  • Loading branch information
bors committed Aug 12, 2017
2 parents 09d9209 + d5326a1 commit aa2b54f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,10 @@ extern {
pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char,
flags: ::c_int) -> ::c_int;

pub fn getgrouplist(name: *const ::c_char,
basegid: ::c_int,
groups: *mut ::c_int,
ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;

#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
Expand Down
5 changes: 5 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,11 @@ extern {
pub fn setutxent();
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
pub fn getgrouplist(name: *const ::c_char,
basegid: ::gid_t,
groups: *mut ::gid_t,
ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
}

#[link(name = "util")]
Expand Down
6 changes: 6 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,12 @@ extern {
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
abstime: *const ::timespec) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;

pub fn getgrouplist(name: *const ::c_char,
basegid: ::gid_t,
groups: *mut ::gid_t,
ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
}

cfg_if! {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,10 @@ extern {
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn setgroups(ngroups: ::size_t,
ptr: *const ::gid_t) -> ::c_int;
pub fn getgrouplist(user: *const ::c_char,
group: ::gid_t,
groups: *mut ::gid_t,
ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
Expand Down

0 comments on commit aa2b54f

Please sign in to comment.