Skip to content

Commit ec9917b

Browse files
committed
tests/utils/kernel: add statics for the uid and gid
1 parent f0d6adc commit ec9917b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/tests/utils/kernel.rs

+10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use regex::{Captures, Regex};
3232

3333
lazy_static! {
3434
pub static ref PAGE_SIZE: usize = page_size();
35+
pub static ref UID: libc::uid_t = getuid();
36+
pub static ref GID: libc::gid_t = getgid();
3537
pub static ref KEY_INFO: KeyQuota = key_user_info();
3638
}
3739

@@ -120,3 +122,11 @@ fn key_user_info() -> KeyQuota {
120122
.get(&uid)
121123
.expect("the current user has no keys?")
122124
}
125+
126+
fn getuid() -> libc::uid_t {
127+
unsafe { libc::getuid() }
128+
}
129+
130+
fn getgid() -> libc::gid_t {
131+
unsafe { libc::getgid() }
132+
}

0 commit comments

Comments
 (0)