Module std::os
Higher-level interfaces to libc::* functions and operating system services.
In general these take and return rust types, use rust idioms (enums, closures, vectors) rather than C idioms, and do more extensive safety checks.
This module is not meant to only contain 1:1 mappings to libc entries; any os-interface code that is reasonably useful and broadly applicable can go here. Including utility routines that merely build on other os code.
We assume the general case is that users do not care, and do not want to be made to care, which operating system they are on. While they may want to special case various special cases -- and so we will not hide the facts of which OS the user is on -- they should be given the opportunity to write OS-ignorant code by default.
Modules
consts | Various useful system-specific constants. |
Structs
MemoryMap | A memory mapped file or chunk of memory. This is a very system-specific
interface to the OS's memory mapping facilities ( |
Pipe | A low-level OS in-memory pipe. |
Enums
MapError | Possible errors when creating a map. |
MapOption | Options the memory map is created with |
MemoryMapKind | Type of memory map |
Statics
pub static TMPBUF_SZ: uint = 1000u |
Functions
args | Returns the arguments which this program was started with (normally passed via the command line). |
args_as_bytes | Returns the arguments which this program was started with (normally passed via the command line) as byte vectors. |
change_dir | Changes the current working directory to the specified path, returning whether the change was completed successfully or not. |
close | Delegates to the libc close() function, returning the same return value. |
dll_filename | Returns the proper dll filename for the given basename of a file. |
env | Returns a vector of (variable, value) pairs for all the environment variables of the current process. |
env_as_bytes | Returns a vector of (variable, value) byte-vector pairs for all the environment variables of the current process. |
errno | Returns the platform-specific value of errno |
get_exit_status | Fetches the process's current exit code. This defaults to 0 and can change
by calling |
getcwd | Returns the current working directory. |
getenv | Fetches the environment variable |
getenv_as_bytes | Fetches the environment variable |
homedir | Returns the path to the user's home directory, if known. |
last_os_error | Get a string representing the platform-dependent last error |
make_absolute | Convert a relative path to an absolute path |
page_size | Returns the page size of the current architecture in bytes. |
pipe | Creates a new low-level OS in-memory pipe. |
self_exe_name | Optionally returns the filesystem path of the current executable which is running. If any failure occurs, None is returned. |
self_exe_path | Optionally returns the filesystem path to the current executable which is running. Like self_exe_name() but without the binary's name. If any failure occurs, None is returned. |
set_exit_status | Sets the process exit code |
setenv | Sets the environment variable |
tmpdir | Returns the path to a temporary directory. |
unsetenv | Remove a variable from the environment entirely |