std/sys/user

The std/sys/user module provides access to user and group identification information, wrapping POSIX unistd.h.

Overview

Usage

import "std/sys/user.zc"
import "std/io.zc"

fn main() {
    println(f"Current UID: {User::get_uid()}");
    println(f"Current GID: {User::get_gid()}");
    
    if (User::get_euid() == 0) {
        println("Running with root privileges.");
    }
}

Struct Definition

struct User {}

Methods

User Methods

MethodSignatureDescription
get_uidUser::get_uid() -> u32Returns the real User ID of the current process.
get_gidUser::get_gid() -> u32Returns the real Group ID of the current process.
get_euidUser::get_euid() -> u32Returns the effective User ID.
get_egidUser::get_egid() -> u32Returns the effective Group ID.