Daku v1.0.0-alpha.0
Daku is a system interface API similar to WASI with different goals.
Since it's currently alpha, things may change but changes are somewhat unlikely. Alpha, beta and pre-release stages will not last very long (once there is an implementation it will be fully stabilized).
Goals
- Async-First
- Immediately Stable
- Simple
- Reduced Syscalls
- Channel-Based
- Security via Portals
- Anti-POSIX
- Full Multimedia Support
API
The daku api exports a single function ar():
(import "daku" "ar" (func $event
(param $size i32) ;; List[Command].size
(param $data i32) ;; List[Command].reference
(param $done i32) ;; List[Ready].reference (capacity=open channel count)
(result i32) ;; List[Ready].size (size truncated at 16384)
))
The function queues a number of asynchronous tasks, passed as a list (first two
parameters). When any asynchronous task completes, the function returns the
new size of $done and it's contents are overwritten.
Command
Types
Time
Date
DateTime
List
Text
Overclock
TimeZone
Lang
Commands
Commands can be added in new versions of the Daku spec, and can be deprecated, but never removed. Because of strict backwards-compatibility their spec should aim to be as mathematical as possible rather than engineered. Command ids are always allocated starting from 0, then incrementing by 1.
When you open a channel, you will receive data whenever it's ready. Some data doesn't change, so you can close the channel after the first receive.
Receiving commands must send a capacity in a size field for variable length
items, and if the capacity is not met, the size field gets set to the required
length and data set to NULL.
-
Get CPU Architecture
recv: u32 -
Get CPU Reference Size
recv: u32 -
Query CPU Extensions description
recv: Text. Results should never be relied on for app features. -
Get overclocking setting
recv: Overclock -
Set overclocking setting
send: Overclock -
Get current UTC DateTime
recv: DateTime -
Get current Time Zone
recv: TimeZone -
Get Kernel Type
recv: Platform -
Get OS Name
recv: Text -
Get (Desktop) Environment
recv: Environment -
Get Wasm Runtime
recv: Runtime -
Get User:Username
recv: Text -
Get User:FullName
recv: Text -
Get User:Language
recv: Lang -
Set User:Username
send: Text -
Set User:FullName
send: Text -
Set User:Language
send: Lang -
Spawn child process / task
send: Task. Becomes "ready" when task sends a message, and shared_memory is written then sent back on next call toar(). If another task is sent, replaces the child task. Close the channel to stop the child task. -
Connect to parent channel
send: MessageOnce connected, send an empty (null) command to wake parent task and transfer message.
-
Log
send: Log -
Debug:
recv: Text -
Set window actions "toolbar"
send: WindowActions, recv: WindowActionEvent -
Set tab navigation "toolbar"
send: NavigationActions, recv: NavigationActionEvent -
Set HUD menu / keyboard shortcuts, and receive events
send: Menu, recv: u32 -
Set vertical tabs hamburger menu
-
Set search enabled/disabled for each mode
-
Get keycode input
-
Get text input
-
Get cursor input
-
Get controller input
-
Set GPIO Interrupts
-
Set GPIO State
-
Record audio (microphone)
-
Play audio (speakers)
-
Record video (webcam)
-
Play video (framebuffer)
-
Serve over HTTP
-
Connect over HTTP
-
Bluetooth device
-
Bluetooth connect
-
Persistent Storage Open File
-
Persistent Storage Share File
-
GPU Compute
-
GPU Command
send: GpuCommand, recv: u32 -
Switch Mode
send: u32