File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,22 @@ pub use self::linux::*;
24
24
pub struct Uid ( uid_t ) ;
25
25
26
26
impl Uid {
27
+ /// Creates `Uid` from raw `uid_t`.
27
28
pub fn from_raw ( uid : uid_t ) -> Self {
28
29
Uid ( uid)
29
30
}
30
31
32
+ /// Returns Uid of calling process. This is practically a more Rusty alias for `getuid`.
31
33
pub fn current ( ) -> Self {
32
34
getuid ( )
33
35
}
34
36
37
+ /// Returns effective Uid of calling process. This is practically a more Rusty alias for `geteuid`.
35
38
pub fn effective ( ) -> Self {
36
39
geteuid ( )
37
40
}
38
41
42
+ /// Returns true if the `Uid` represents privileged user - root. (If it equals zero.)
39
43
pub fn is_root ( & self ) -> bool {
40
44
self . 0 == 0
41
45
}
@@ -64,14 +68,17 @@ pub const ROOT: Uid = Uid(0);
64
68
pub struct Gid ( gid_t ) ;
65
69
66
70
impl Gid {
71
+ /// Creates `Gid` from raw `gid_t`.
67
72
pub fn from_raw ( gid : gid_t ) -> Self {
68
73
Gid ( gid)
69
74
}
70
75
76
+ /// Returns Gid of calling process. This is practically a more Rusty alias for `getgid`.
71
77
pub fn current ( ) -> Self {
72
78
getgid ( )
73
79
}
74
80
81
+ /// Returns effective Gid of calling process. This is practically a more Rusty alias for `getgid`.
75
82
pub fn effective ( ) -> Self {
76
83
getegid ( )
77
84
}
@@ -97,14 +104,17 @@ impl fmt::Display for Gid {
97
104
pub struct Pid ( pid_t ) ;
98
105
99
106
impl Pid {
107
+ /// Creates `Pid` from raw `pid_t`.
100
108
pub fn from_raw ( pid : pid_t ) -> Self {
101
109
Pid ( pid)
102
110
}
103
111
112
+ /// Returns PID of calling process
104
113
pub fn this ( ) -> Self {
105
114
getpid ( )
106
115
}
107
116
117
+ /// Returns PID of parent of calling process
108
118
pub fn parent ( ) -> Self {
109
119
getppid ( )
110
120
}
You can’t perform that action at this time.
0 commit comments