Functions

fn abort() noreturn

No documentation provided.

fn args() ArgIterator

Holds the command-line arguments, with the program name as the first entry. Use…

Holds the command-line arguments, with the program name as the first entry. Use argsWithAllocator() for cross-platform code.

fn argsAlloc(allocator: Allocator) ![][:0]u8

Caller must call argsFree on result.

fn argsFree(allocator: Allocator, args_alloc: []const [:0]u8) void

No documentation provided.

fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator

You must deinitialize iterator’s internal buffers by calling deinit when done.

fn changeCurDir(dir_path: []const u8) ChangeCurDirError!void

No documentation provided.

fn cleanExit() void

Indicate that we are now terminating with a successful exit code. In debug buil…

Indicate that we are now terminating with a successful exit code. In debug builds, this is a no-op, so that the calling code’s cleanup mechanisms are tested and so that external tools that check for resource leaks can be accurate. In release builds, this calls exit(0), and does not return.

fn execv(allocator: Allocator, argv: []const []const u8) ExecvError

Replaces the current process image with the executed process. This function mus…

Replaces the current process image with the executed process. This function must allocate memory to add a null terminating bytes on path and each arg. It must also convert to KEY=VALUE\0 format for environment variables, and include null pointers after the args and after the environment variables. argv[0] is the executable path. This function also uses the PATH environment variable to get the full path to the executable. Due to the heap-allocation, it is illegal to call this function in a fork() child. For that use case, use the std.os functions directly.

fn execve(allocator: Allocator, argv: []const []const u8, env_map: ?*const EnvMap) ExecvError

Replaces the current process image with the executed process. This function mus…

Replaces the current process image with the executed process. This function must allocate memory to add a null terminating bytes on path and each arg. It must also convert to KEY=VALUE\0 format for environment variables, and include null pointers after the args and after the environment variables. argv[0] is the executable path. This function also uses the PATH environment variable to get the full path to the executable. Due to the heap-allocation, it is illegal to call this function in a fork() child. For that use case, use the std.os functions directly.

fn exit(status: u8) noreturn

No documentation provided.

fn getBaseAddress() usize

No documentation provided.

fn getCwd(out_buffer: []u8) ![]u8

The result is a slice of out_buffer, from index 0.

fn getCwdAlloc(allocator: Allocator) ![]u8

Caller must free the returned memory.

fn getEnvMap(allocator: Allocator) !EnvMap

Returns a snapshot of the environment variables of the current process. Any mod…

Returns a snapshot of the environment variables of the current process. Any modifications to the resulting EnvMap will not be not reflected in the environment, and likewise, any future modifications to the environment will not be reflected in the EnvMap. Caller owns resulting EnvMap and should call its deinit fn when done.

fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError![]u8

Caller must free returned memory.

fn getUserInfo(name: []const u8) !UserInfo

POSIX function which gets a uid from username.

fn hasEnvVar(allocator: Allocator, key: []const u8) error{OutOfMemory}!bool

No documentation provided.

fn hasEnvVarConstant(comptime key: []const u8) bool

No documentation provided.

fn posixGetUserInfo(name: []const u8) !UserInfo

TODO this reads /etc/passwd. But sometimes the user/id mapping is in something e…

TODO this reads /etc/passwd. But sometimes the user/id mapping is in something else like NIS, AD, etc. See man nss or look at an strace for id myuser.

fn totalSystemMemory() TotalSystemMemoryError!usize

Returns the total system memory, in bytes.

Values

ExecvError
type
can_execv
type

Tells whether calling the execv or execve functions will be a compile error.

can_spawn
type

Tells whether spawning child processes is supported (e.g. via ChildProcess)

changeCurDirC
undefined