mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
std.posix: add getuid()/geteuid()
This commit is contained in:
parent
dc66f4384f
commit
fb188c3d18
@ -10547,6 +10547,8 @@ pub extern "c" fn setregid(rgid: gid_t, egid: gid_t) c_int;
|
||||
pub extern "c" fn setresuid(ruid: uid_t, euid: uid_t, suid: uid_t) c_int;
|
||||
pub extern "c" fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) c_int;
|
||||
pub extern "c" fn setpgid(pid: pid_t, pgid: pid_t) c_int;
|
||||
pub extern "c" fn getuid() uid_t;
|
||||
pub extern "c" fn geteuid() uid_t;
|
||||
|
||||
pub extern "c" fn malloc(usize) ?*anyopaque;
|
||||
pub extern "c" fn calloc(usize, usize) ?*anyopaque;
|
||||
|
||||
@ -3505,6 +3505,14 @@ pub fn setpgid(pid: pid_t, pgid: pid_t) SetPgidError!void {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getuid() uid_t {
|
||||
return system.getuid();
|
||||
}
|
||||
|
||||
pub fn geteuid() uid_t {
|
||||
return system.geteuid();
|
||||
}
|
||||
|
||||
/// Test whether a file descriptor refers to a terminal.
|
||||
pub fn isatty(handle: fd_t) bool {
|
||||
if (native_os == .windows) {
|
||||
|
||||
@ -509,6 +509,12 @@ test "getcwd" {
|
||||
_ = posix.getcwd(&buf) catch undefined;
|
||||
}
|
||||
|
||||
test "getuid" {
|
||||
if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
|
||||
_ = posix.getuid();
|
||||
_ = posix.geteuid();
|
||||
}
|
||||
|
||||
test "sigaltstack" {
|
||||
if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user