1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
pub mod group;
pub mod login_name;
pub mod passwd;
pub mod process;
pub mod time;
pub mod tty;
pub mod utsname;
#[cfg(not(any(target_os = "fuchsia", target_os = "haiku")))]
pub mod load;
#[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "solaris"))]
pub mod utmp;
#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "openbsd")))]
pub mod utmpx;
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
pub mod audit;
#[cfg(target_os = "openbsd")]
pub mod routing_table;
use libc::{
c_int, getegid, geteuid, getgid, getuid, gid_t, pid_t, suseconds_t, time_t, timeval, tm, uid_t,
};
pub type Tm = tm;
pub type TimeVal = timeval;
pub type Gid = gid_t;
pub type Uid = uid_t;
pub type Pid = pid_t;
pub type Time = time_t;
pub type Fields = c_int;
pub type Susec = suseconds_t;
#[inline]
pub fn get_effective_gid() -> Uid { unsafe { getegid() } }
#[inline]
pub fn get_real_gid() -> Uid { unsafe { getgid() } }
#[inline]
pub fn get_effective_uid() -> Uid { unsafe { geteuid() } }
#[inline]
pub fn get_real_uid() -> Uid { unsafe { getuid() } }