Skip to content

Commit 12c3f85

Browse files
authored
os: add getuid and geteuid (#10002)
1 parent 4bc56dc commit 12c3f85

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

vlib/builtin/cfns.c.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ fn C.pclose(stream &C.FILE) int
7575
[trusted]
7676
fn C.getpid() int
7777

78+
fn C.getuid() int
79+
80+
fn C.geteuid() int
81+
7882
fn C.system(cmd &char) int
7983

8084
fn C.posix_spawn(child_pid &int, path &char, file_actions voidptr, attrp voidptr, argv &&char, envp &&char) int

vlib/os/os_nix.c.v

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,16 @@ pub fn getpid() int {
332332
return C.getpid()
333333
}
334334

335+
[inline]
336+
pub fn getuid() int {
337+
return C.getuid()
338+
}
339+
340+
[inline]
341+
pub fn geteuid() int {
342+
return C.geteuid()
343+
}
344+
335345
// Turns the given bit on or off, depending on the `enable` parameter
336346
pub fn posix_set_permission_bit(path_s string, mode u32, enable bool) {
337347
mut s := C.stat{}

0 commit comments

Comments
 (0)