Skip to content

Commit e4a1f26

Browse files
authored
Merge pull request #1852 from jclulow/illumos-ucred
add ucred(3C) support for illumos and Solaris systems
2 parents 939623c + 1c9d5ea commit e4a1f26

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/unix/solarish/mod.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub type tcflag_t = ::c_uint;
2222
pub type time_t = ::c_long;
2323
pub type wchar_t = ::c_int;
2424
pub type nfds_t = ::c_ulong;
25+
pub type projid_t = ::c_int;
26+
pub type zoneid_t = ::c_int;
2527

2628
pub type suseconds_t = ::c_long;
2729
pub type off_t = ::c_long;
@@ -46,6 +48,15 @@ impl ::Clone for timezone {
4648
}
4749
}
4850

51+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
52+
pub enum ucred_t {}
53+
impl ::Copy for ucred_t {}
54+
impl ::Clone for ucred_t {
55+
fn clone(&self) -> ucred_t {
56+
*self
57+
}
58+
}
59+
4960
s! {
5061
pub struct in_addr {
5162
pub s_addr: ::in_addr_t,
@@ -2582,6 +2593,28 @@ extern "C" {
25822593

25832594
pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
25842595
pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
2596+
2597+
pub fn ucred_get(pid: ::pid_t) -> *mut ucred_t;
2598+
pub fn getpeerucred(fd: ::c_int, ucred: *mut *mut ucred_t) -> ::c_int;
2599+
2600+
pub fn ucred_free(ucred: *mut ucred_t);
2601+
2602+
pub fn ucred_geteuid(ucred: *const ucred_t) -> ::uid_t;
2603+
pub fn ucred_getruid(ucred: *const ucred_t) -> ::uid_t;
2604+
pub fn ucred_getsuid(ucred: *const ucred_t) -> ::uid_t;
2605+
pub fn ucred_getegid(ucred: *const ucred_t) -> ::gid_t;
2606+
pub fn ucred_getrgid(ucred: *const ucred_t) -> ::gid_t;
2607+
pub fn ucred_getsgid(ucred: *const ucred_t) -> ::gid_t;
2608+
pub fn ucred_getgroups(
2609+
ucred: *const ucred_t,
2610+
groups: *mut *const ::gid_t,
2611+
) -> ::c_int;
2612+
pub fn ucred_getpid(ucred: *const ucred_t) -> ::pid_t;
2613+
pub fn ucred_getprojid(ucred: *const ucred_t) -> projid_t;
2614+
pub fn ucred_getzoneid(ucred: *const ucred_t) -> zoneid_t;
2615+
pub fn ucred_getpflags(ucred: *const ucred_t, flags: ::c_uint) -> ::c_uint;
2616+
2617+
pub fn ucred_size() -> ::size_t;
25852618
}
25862619

25872620
mod compat;

0 commit comments

Comments
 (0)