Tanguv0.35.0
System & I/O8 exports
Raw Markdown

/os

Host operating system, CPU architecture, hostname, and environment introspection.

(use /os)

Functions & symbols#

arch#

function
(os/arch) -> String

Returns the CPU architecture (e.g. "x86_64", "aarch64").

Returns:Any
(let target-arch (os/arch))

cpu-count#

function
(os/cpu-count) -> Int

Returns the number of logical CPU cores available to the current process.

Returns:Any
(let concurrency (os/cpu-count))

family#

function
(os/family) -> String

Returns the operating system family (e.g. "unix", "windows").

Returns:Any
(if (= (os/family) "unix") (writeln "POSIX compliant"))

home-dir#

function
(os/home-dir) -> (Or String ())

Returns the current user's home directory path, or () if not found.

Returns:Any
(let home (os/home-dir))

host-name#

function
(os/host-name) -> String

Returns the network hostname of the host system.

Returns:Any
(let host (os/host-name))

os-name#

function
(os/os-name) -> String

Returns the operating system name (e.g. "linux", "macos", "windows").

Returns:Any
(let os (os/os-name))

temp-dir#

function
(os/temp-dir) -> String

Returns the default directory path for temporary files.

Returns:Any
(let tmp (os/temp-dir))

uptime#

function
(os/uptime) -> Float

Returns system uptime in seconds as a floating-point number.

Returns:Any
(let secs (os/uptime))