The original implementation of `core:os`, to be removed in Q2 2026. Cross-platform `OS` interactions like file `I/O`.

Collection Info

View Source
Collection
core
Path
os/old
Entries
146

Source Files

(hidden platform specific files)

Constants

55

ERROR_ACCESS_DENIED #

Source
ERROR_ACCESS_DENIED :: _Platform_Error(5)

ERROR_ALREADY_EXISTS #

Source
ERROR_ALREADY_EXISTS :: _Platform_Error(183)

ERROR_BUFFER_OVERFLOW #

Source
ERROR_BUFFER_OVERFLOW :: _Platform_Error(111)

ERROR_DIR_NOT_EMPTY #

Source
ERROR_DIR_NOT_EMPTY :: _Platform_Error(145)

ERROR_ENVVAR_NOT_FOUND #

Source
ERROR_ENVVAR_NOT_FOUND :: _Platform_Error(203)

ERROR_FILE_IS_NOT_DIR #

Source
ERROR_FILE_IS_NOT_DIR :: General_Error.Not_Dir

ERROR_FILE_IS_PIPE #

Source
ERROR_FILE_IS_PIPE :: General_Error.File_Is_Pipe

ERROR_FILE_NOT_FOUND #

Source
ERROR_FILE_NOT_FOUND :: _Platform_Error(2)

ERROR_INSUFFICIENT_BUFFER #

Source
ERROR_INSUFFICIENT_BUFFER :: _Platform_Error(122)

ERROR_INVALID_HANDLE #

Source
ERROR_INVALID_HANDLE :: _Platform_Error(6)

ERROR_INVALID_PARAMETER #

Source
ERROR_INVALID_PARAMETER :: _Platform_Error(87)

ERROR_MOD_NOT_FOUND #

Source
ERROR_MOD_NOT_FOUND :: _Platform_Error(126)

ERROR_NEGATIVE_SEEK #

Source
ERROR_NEGATIVE_SEEK :: _Platform_Error(131)

ERROR_NETNAME_DELETED #

Source
ERROR_NETNAME_DELETED :: _Platform_Error(64)

ERROR_NO_MORE_FILES #

Source
ERROR_NO_MORE_FILES :: _Platform_Error(18)

ERROR_NOT_ENOUGH_MEMORY #

Source
ERROR_NOT_ENOUGH_MEMORY :: _Platform_Error(8)

ERROR_OPERATION_ABORTED #

Source
ERROR_OPERATION_ABORTED :: _Platform_Error(995)

ERROR_PATH_NOT_FOUND #

Source
ERROR_PATH_NOT_FOUND :: _Platform_Error(3)

ERROR_PRIVILEGE_NOT_HELD #

Source
ERROR_PRIVILEGE_NOT_HELD :: _Platform_Error(1314)

ERROR_PROC_NOT_FOUND #

Source
ERROR_PROC_NOT_FOUND :: _Platform_Error(127)

File_Mode_Char_Device #

Source
File_Mode_Char_Device :: File_Mode(1 << 19)

File_Mode_Named_Pipe #

Source
File_Mode_Named_Pipe :: File_Mode(1 << 17)

WINDOWS_11_BUILD_CUTOFF #

Source
WINDOWS_11_BUILD_CUTOFF :: 22_000

Windows 11 (preview) has the same major and minor version numbers as Windows 10: 10 and 0 respectively. To determine if you're on Windows 10 or 11, we need to look at the build number. As far as we can tell right now, the cutoff is build 22_000. TODO: Narrow down this range once Win 11 is published and the last Win 10 builds become available.

Types

8

Procedures

75

clear_env #

Source
clear_env :: proc() {…}

clear_env deletes all environment variables

current_thread_id #

Source
@(require_results)
current_thread_id :: proc "contextless" () -> int {…}

environ #

Source
@(require_results)
environ :: proc(allocator := context.allocator) -> []string {…}

environ returns a copy of strings representing the environment, in the form "key=value" NOTE: the slice of strings and the strings with be allocated using the supplied allocator

file_info_slice_delete #

Source
file_info_slice_delete :: proc(infos: []File_Info, allocator := context.allocator) {…}

get_current_directory #

Source
@(require_results)
get_current_directory :: proc(allocator := context.allocator) -> string {…}

get_env_alloc #

Source
@(require_results)
get_env_alloc :: proc(key: string, allocator := context.allocator) -> (value: string) {…}

get_env retrieves the value of the environment variable named by the key It returns the value, which will be empty if the variable is not present To distinguish between an empty value and an unset value, use lookup_env NOTE: the value will be allocated with the supplied allocator

get_last_error #

Source
@(require_results)
@(no_instrumentation)
get_last_error :: proc "contextless" () -> Error {…}

is_platform_error #

Source
@(require_results)
is_platform_error :: proc "contextless" (ferr: Error) -> (err: i32, ok: bool) {…}

is_windows_10 #

Source
@(require_results)
is_windows_10 :: proc "contextless" () -> bool {…}

is_windows_11 #

Source
@(require_results)
is_windows_11 :: proc "contextless" () -> bool {…}

is_windows_7 #

Source
@(require_results)
is_windows_7 :: proc "contextless" () -> bool {…}

is_windows_8 #

Source
@(require_results)
is_windows_8 :: proc "contextless" () -> bool {…}

is_windows_8_1 #

Source
@(require_results)
is_windows_8_1 :: proc "contextless" () -> bool {…}

is_windows_vista #

Source
@(require_results)
is_windows_vista :: proc "contextless" () -> bool {…}

is_windows_xp #

Source
@(require_results)
is_windows_xp :: proc "contextless" () -> bool {…}

lookup_env_alloc #

Source
@(require_results)
lookup_env_alloc :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {…}

lookup_env gets the value of the environment variable named by the key If the variable is found in the environment the value (which can be empty) is returned and the boolean is true Otherwise the returned value will be empty and the boolean will be false NOTE: the value will be allocated with the supplied allocator

lookup_env_buffer #

Source
@(require_results)
lookup_env_buffer :: proc(buf: []u8, key: string) -> (value: string, err: Error) {…}

This version of `lookup_env` doesn't allocate and instead requires the user to provide a buffer. Note that it is limited to environment names and values of 512 utf-16 values each due to the necessary utf-8 <> utf-16 conversion.

processor_core_count #

Source
@(require_results)
processor_core_count :: proc() -> int {…}

read_entire_file_from_filename #

Source
@(require_results)
read_entire_file_from_filename :: proc(name: string, allocator := context.allocator, loc := #caller_location) -> (data: []u8, success: bool) {…}

read_entire_file_from_filename_or_err #

Source
@(require_results)
read_entire_file_from_filename_or_err :: proc(name: string, allocator := context.allocator, loc := #caller_location) -> (data: []u8, err: Error) {…}

read_entire_file_from_handle #

Source
@(require_results)
read_entire_file_from_handle :: proc(fd: Handle, allocator := context.allocator, loc := #caller_location) -> (data: []u8, success: bool) {…}

read_entire_file_from_handle_or_err #

Source
@(require_results)
read_entire_file_from_handle_or_err :: proc(fd: Handle, allocator := context.allocator, loc := #caller_location) -> (data: []u8, err: Error) {…}

replace_environment_placeholders #

Source
replace_environment_placeholders :: proc(path: string, allocator := context.allocator) -> (res: string) {…}

Always allocates for consistency.

set_env #

Source
set_env :: proc(key, value: string) -> Error {…}

set_env sets the value of the environment variable named by the key

Procedure Groups

4

Variables

4

args #

Source
args: []string = _alloc_command_line_arguments()

"Argv" arguments converted to Odin strings

stdin #

Source
stdin: Handle = get_std_handle(uint(win32.STD_INPUT_HANDLE))

NOTE(bill): Uses startup to initialize it