os: add getuid and geteuid (#10002)

pull/10022/head
Miccah 2021-05-05 06:20:11 -05:00 committed by GitHub
parent 4bc56dc0a2
commit 12c3f85507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -75,6 +75,10 @@ fn C.pclose(stream &C.FILE) int
[trusted]
fn C.getpid() int
fn C.getuid() int
fn C.geteuid() int
fn C.system(cmd &char) int
fn C.posix_spawn(child_pid &int, path &char, file_actions voidptr, attrp voidptr, argv &&char, envp &&char) int

View File

@ -332,6 +332,16 @@ pub fn getpid() int {
return C.getpid()
}
[inline]
pub fn getuid() int {
return C.getuid()
}
[inline]
pub fn geteuid() int {
return C.geteuid()
}
// Turns the given bit on or off, depending on the `enable` parameter
pub fn posix_set_permission_bit(path_s string, mode u32, enable bool) {
mut s := C.stat{}