IORequest

enum IORequest

A low-level operation sent through the ambient 'io effect.

Payloads intentionally mirror the runtime's scalar ABI: descriptors, raw pointers, lengths, and flags. Variant order is an ABI operation table and new cases must be appended. Public high-level modules validate lengths and wrap negative errno results; direct callers must do so themselves.

Cases

case read(Int, RawPtr, Int)

Reads bytes from a host file descriptor into a buffer.

case write(Int, RawPtr, Int)

Writes bytes from a buffer to a host file descriptor.

case open(RawPtr, Int, Int)

Opens a NUL-terminated host path with the supplied flags and mode.

case close(Int)

Closes a host file descriptor.

case sleep(Int)

Sleeps the current worker for a number of milliseconds.

case poll(RawPtr, Int, Int)

Polls host file descriptors for readiness.

case ctl(Int, Int, Int)

Sends a runtime control operation and integer argument to a descriptor.

case socket(Int, Int, Int)

Creates a host socket.

case bind(Int, Int, Int)

Binds a host socket to an address and port.

case listen(Int, Int)

Marks a host socket as a listener.

case connect(Int, Int, Int)

Connects a host socket to an address and port.

case accept(Int)

Accepts one connection from a host listener.

case cwd_len

Returns the byte length required to store the current working directory.

case cwd_copy(RawPtr)

Copies the current working directory into the supplied buffer.

case getenv_len(RawPtr, Int)

Returns the byte length of an environment variable's value.

case getenv_copy(RawPtr, Int, RawPtr)

Copies an environment variable's value into the supplied buffer.

case argc

Returns the process argument count.

case arg_len(Int)

Returns the byte length of the process argument at an index.

case arg_copy(Int, RawPtr)

Copies the process argument at an index into the supplied buffer.

case dir_count(RawPtr)

Returns the number of entries in a NUL-terminated directory path.

case dir_entry_kind(RawPtr, Int)

Returns the file-type code of an indexed directory entry.

case dir_entry_len(RawPtr, Int)

Returns the byte length of an indexed directory entry's name.

case dir_entry_copy(RawPtr, Int, RawPtr)

Copies an indexed directory entry's name into the supplied buffer.

case exit(Int)

Terminates the process with the supplied status.

case realpath_len(RawPtr)

Returns the byte length of a canonicalized path, or a negative errno. Its position preserves the runtime operation-table ABI.

case realpath_copy(RawPtr, RawPtr)

Resolves a path and copies its canonical spelling into a buffer.

case seek(Int, Int, Int)

Moves a file descriptor's offset and returns its absolute position.

case file_size(Int)

Returns the byte size of the file behind a descriptor.

case monotonic_nanos

Reads a monotonic clock as nanoseconds from a process-local anchor.