#[repr(C)]pub struct XilaApi {Show 84 fields
pub version: u32,
pub size: u32,
pub directory_open: unsafe extern "C" fn(parent: *const Directory, path: *const c_char, path_length: usize, rights: u32, directory: *mut *mut Directory) -> Status,
pub directory_close: unsafe extern "C" fn(directory: *mut Directory) -> Status,
pub directory_create: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize) -> Status,
pub directory_remove: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, flags: u32) -> Status,
pub directory_rename: unsafe extern "C" fn(from: *const Directory, from_path: *const c_char, from_length: usize, to: *const Directory, to_path: *const c_char, to_length: usize) -> Status,
pub file_open: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, path_length: usize, flags: u32, file: *mut *mut File) -> Status,
pub file_read: unsafe extern "C" fn(file: *mut File, buffer: *mut c_void, size: usize, count: *mut usize) -> Status,
pub file_write: unsafe extern "C" fn(file: *mut File, buffer: *const c_void, size: usize, count: *mut usize) -> Status,
pub file_seek: unsafe extern "C" fn(file: *mut File, offset: i64, whence: u32, position: *mut u64) -> Status,
pub file_flush: unsafe extern "C" fn(file: *mut File) -> Status,
pub file_close: unsafe extern "C" fn(file: *mut File) -> Status,
pub file_set_size: unsafe extern "C" fn(file: *mut File, size: u64) -> Status,
pub file_get_statistics: unsafe extern "C" fn(file: *mut File, output: *mut Statistics) -> Status,
pub directory_get_statistics: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, flags: u32, output: *mut Statistics) -> Status,
pub directory_iterator_open: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, output: *mut *mut DirectoryIterator) -> Status,
pub directory_iterator_next: unsafe extern "C" fn(iterator: *mut DirectoryIterator, name_buffer: *mut c_char, capacity: usize, name_length: *mut usize, kind: *mut u32) -> Status,
pub directory_iterator_rewind: unsafe extern "C" fn(iterator: *mut DirectoryIterator) -> Status,
pub directory_iterator_close: unsafe extern "C" fn(iterator: *mut DirectoryIterator) -> Status,
pub time_monotonic: unsafe extern "C" fn(nanoseconds: *mut u64) -> Status,
pub time_realtime: unsafe extern "C" fn(nanoseconds: *mut i64) -> Status,
pub network_close: unsafe extern "C" fn(network: *mut Network) -> Status,
pub tcp_connect: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, timeout_ms: u32, connection: *mut *mut Tcp) -> Status,
pub tcp_listen: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, listener: *mut *mut TcpListener) -> Status,
pub tcp_accept: unsafe extern "C" fn(listener: *mut TcpListener, connection: *mut *mut Tcp) -> Status,
pub tcp_close: unsafe extern "C" fn(socket: *mut Tcp) -> Status,
pub tcp_listener_close: unsafe extern "C" fn(socket: *mut TcpListener) -> Status,
pub tcp_shutdown: unsafe extern "C" fn(socket: *mut Tcp, direction: u32) -> Status,
pub tcp_send: unsafe extern "C" fn(socket: *mut Tcp, buffer: *const c_void, size: usize, count: *mut usize) -> Status,
pub tcp_receive: unsafe extern "C" fn(socket: *mut Tcp, buffer: *mut c_void, size: usize, count: *mut usize) -> Status,
pub tcp_local_address: unsafe extern "C" fn(socket: *const Tcp, address: *mut NetworkAddress) -> Status,
pub tcp_peer_address: unsafe extern "C" fn(socket: *const Tcp, address: *mut NetworkAddress) -> Status,
pub udp_bind: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, socket: *mut *mut Udp) -> Status,
pub udp_close: unsafe extern "C" fn(socket: *mut Udp) -> Status,
pub udp_send_to: unsafe extern "C" fn(socket: *mut Udp, buffer: *const c_void, size: usize, address: *const NetworkAddress, count: *mut usize) -> Status,
pub udp_receive_from: unsafe extern "C" fn(socket: *mut Udp, buffer: *mut c_void, size: usize, address: *mut NetworkAddress, count: *mut usize) -> Status,
pub network_resolve: unsafe extern "C" fn(network: *const Network, host: *const c_char, host_length: usize, family: u32, addresses: *mut NetworkAddress, count: *mut usize) -> Status,
pub heap_allocate: unsafe extern "C" fn(heap: *mut Heap, size: usize, allocation: *mut *mut c_void) -> Status,
pub heap_reallocate: unsafe extern "C" fn(heap: *mut Heap, pointer: *mut c_void, size: usize, allocation: *mut *mut c_void) -> Status,
pub heap_free: unsafe extern "C" fn(heap: *mut Heap, pointer: *mut c_void) -> Status,
pub time_resolution: unsafe extern "C" fn(clock: u32, nanoseconds: *mut u64) -> Status,
pub time_sleep: unsafe extern "C" fn(nanoseconds: u64) -> Status,
pub random_fill: unsafe extern "C" fn(buffer: *mut c_void, size: usize) -> Status,
pub process_id: unsafe extern "C" fn(process: *const Process, id: *mut u32) -> Status,
pub process_parent_id: unsafe extern "C" fn(process: *const Process, id: *mut u32) -> Status,
pub process_exit: unsafe extern "C" fn(process: *const Process, status: i32) -> Status,
pub process_spawn: unsafe extern "C" fn(process: *const Process, directory: *const Directory, path: *const c_char, path_length: usize, spawn: *const Spawn, child: *mut *mut Child) -> Status,
pub process_wait: unsafe extern "C" fn(process: *const Process, child: *mut Child, flags: u32, status: *mut i32) -> Status,
pub process_child_close: unsafe extern "C" fn(child: *mut Child) -> Status,
pub env_get: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize, buffer: *mut c_char, capacity: usize, value_length: *mut usize) -> Status,
pub env_set: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize, value: *const c_char, value_length: usize) -> Status,
pub env_remove: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize) -> Status,
pub env_entry: unsafe extern "C" fn(process: *const Process, index: usize, buffer: *mut c_char, capacity: usize, entry_length: *mut usize) -> Status,
pub thread_spawn: unsafe extern "C" fn(process: *const Process, stack_size: usize, entry: ThreadEntry, argument: *mut c_void, thread: *mut usize) -> Status,
pub thread_join: unsafe extern "C" fn(thread: usize, result: *mut *mut c_void) -> Status,
pub thread_detach: unsafe extern "C" fn(thread: usize) -> Status,
pub thread_yield: unsafe extern "C" fn() -> Status,
pub thread_current: unsafe extern "C" fn(thread: *mut usize) -> Status,
pub thread_key_create: unsafe extern "C" fn(key: *mut usize) -> Status,
pub thread_key_delete: unsafe extern "C" fn(key: usize) -> Status,
pub thread_tls_get: unsafe extern "C" fn(key: usize, value: *mut *mut c_void) -> Status,
pub thread_tls_set: unsafe extern "C" fn(key: usize, value: *mut c_void) -> Status,
pub thread_libc: unsafe extern "C" fn(location: *mut *mut ThreadLibc) -> Status,
pub mutex_init: unsafe extern "C" fn(mutex: *mut Mutex, flags: u32) -> Status,
pub mutex_destroy: unsafe extern "C" fn(mutex: *mut Mutex) -> Status,
pub mutex_lock: unsafe extern "C" fn(mutex: *mut Mutex, flags: u32) -> Status,
pub mutex_unlock: unsafe extern "C" fn(mutex: *mut Mutex) -> Status,
pub condition_init: unsafe extern "C" fn(condition: *mut Condition) -> Status,
pub condition_destroy: unsafe extern "C" fn(condition: *mut Condition) -> Status,
pub condition_wait: unsafe extern "C" fn(condition: *mut Condition, mutex: *mut Mutex, clock: u32, deadline: *const i64) -> Status,
pub condition_notify: unsafe extern "C" fn(condition: *mut Condition, all: bool) -> Status,
pub thread_has_workers: unsafe extern "C" fn(live: *mut bool) -> Status,
pub thread_stop_others: unsafe extern "C" fn(process: *const Process) -> Status,
pub thread_exit: unsafe extern "C" fn(result: *mut c_void) -> Status,
pub poll_wait: unsafe extern "C" fn(entries: *mut PollEntry, count: usize, timeout_ms: i32, ready_count: *mut usize) -> Status,
pub file_read_at: unsafe extern "C" fn(file: *mut File, buffer: *mut c_void, size: usize, offset: u64, count: *mut usize) -> Status,
pub file_write_at: unsafe extern "C" fn(file: *mut File, buffer: *const c_void, size: usize, offset: u64, count: *mut usize) -> Status,
pub file_duplicate: unsafe extern "C" fn(file: *const File, output: *mut *mut File) -> Status,
pub file_control: unsafe extern "C" fn(file: *mut File, command: u32, input: *const c_void, input_size: usize, output: *mut c_void, output_size: usize) -> Status,
pub file_is_terminal: unsafe extern "C" fn(file: *mut File, terminal: *mut bool) -> Status,
pub pipe_create: unsafe extern "C" fn(process: *const Process, flags: u32, reader: *mut *mut File, writer: *mut *mut File) -> Status,
pub graphics_call: unsafe extern "C" fn(process: *const Process, function: u32, arguments: *const usize, argument_count: usize, result: *mut c_void) -> Status,
pub process_child_id: unsafe extern "C" fn(child: *const Child, id: *mut u32) -> Status,
}Expand description
Native application entry points, in slot order. The header precedes slot zero. Networking slots return Unsupported when the runtime omits networking, and so does the graphics slot when it omits graphics.
Fields§
§version: u32Packed major and minor Xila version: (major << 16) | minor.
size: u32Total size in bytes, including this header.
directory_open: unsafe extern "C" fn(parent: *const Directory, path: *const c_char, path_length: usize, rights: u32, directory: *mut *mut Directory) -> Status§directory_close: unsafe extern "C" fn(directory: *mut Directory) -> Status§directory_create: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize) -> Status§directory_remove: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, flags: u32) -> Status§directory_rename: unsafe extern "C" fn(from: *const Directory, from_path: *const c_char, from_length: usize, to: *const Directory, to_path: *const c_char, to_length: usize) -> Status§file_open: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, path_length: usize, flags: u32, file: *mut *mut File) -> Status§file_read: unsafe extern "C" fn(file: *mut File, buffer: *mut c_void, size: usize, count: *mut usize) -> Status§file_write: unsafe extern "C" fn(file: *mut File, buffer: *const c_void, size: usize, count: *mut usize) -> Status§file_seek: unsafe extern "C" fn(file: *mut File, offset: i64, whence: u32, position: *mut u64) -> Status§file_flush: unsafe extern "C" fn(file: *mut File) -> Status§file_close: unsafe extern "C" fn(file: *mut File) -> Status§file_set_size: unsafe extern "C" fn(file: *mut File, size: u64) -> Status§file_get_statistics: unsafe extern "C" fn(file: *mut File, output: *mut Statistics) -> Status§directory_get_statistics: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, flags: u32, output: *mut Statistics) -> Status§directory_iterator_open: unsafe extern "C" fn(directory: *const Directory, path: *const c_char, length: usize, output: *mut *mut DirectoryIterator) -> Status§directory_iterator_next: unsafe extern "C" fn(iterator: *mut DirectoryIterator, name_buffer: *mut c_char, capacity: usize, name_length: *mut usize, kind: *mut u32) -> Status§directory_iterator_rewind: unsafe extern "C" fn(iterator: *mut DirectoryIterator) -> Status§directory_iterator_close: unsafe extern "C" fn(iterator: *mut DirectoryIterator) -> Status§time_monotonic: unsafe extern "C" fn(nanoseconds: *mut u64) -> Status§time_realtime: unsafe extern "C" fn(nanoseconds: *mut i64) -> Status§network_close: unsafe extern "C" fn(network: *mut Network) -> Status§tcp_connect: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, timeout_ms: u32, connection: *mut *mut Tcp) -> Status§tcp_listen: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, listener: *mut *mut TcpListener) -> Status§tcp_accept: unsafe extern "C" fn(listener: *mut TcpListener, connection: *mut *mut Tcp) -> Status§tcp_close: unsafe extern "C" fn(socket: *mut Tcp) -> Status§tcp_listener_close: unsafe extern "C" fn(socket: *mut TcpListener) -> Status§tcp_shutdown: unsafe extern "C" fn(socket: *mut Tcp, direction: u32) -> Status§tcp_send: unsafe extern "C" fn(socket: *mut Tcp, buffer: *const c_void, size: usize, count: *mut usize) -> Status§tcp_receive: unsafe extern "C" fn(socket: *mut Tcp, buffer: *mut c_void, size: usize, count: *mut usize) -> Status§tcp_local_address: unsafe extern "C" fn(socket: *const Tcp, address: *mut NetworkAddress) -> Status§tcp_peer_address: unsafe extern "C" fn(socket: *const Tcp, address: *mut NetworkAddress) -> Status§udp_bind: unsafe extern "C" fn(network: *const Network, address: *const NetworkAddress, socket: *mut *mut Udp) -> Status§udp_close: unsafe extern "C" fn(socket: *mut Udp) -> Status§udp_send_to: unsafe extern "C" fn(socket: *mut Udp, buffer: *const c_void, size: usize, address: *const NetworkAddress, count: *mut usize) -> Status§udp_receive_from: unsafe extern "C" fn(socket: *mut Udp, buffer: *mut c_void, size: usize, address: *mut NetworkAddress, count: *mut usize) -> Status§network_resolve: unsafe extern "C" fn(network: *const Network, host: *const c_char, host_length: usize, family: u32, addresses: *mut NetworkAddress, count: *mut usize) -> Status§heap_allocate: unsafe extern "C" fn(heap: *mut Heap, size: usize, allocation: *mut *mut c_void) -> StatusAllocate uninitialized memory aligned to XILA_HEAP_ALIGNMENT.
heap_reallocate: unsafe extern "C" fn(heap: *mut Heap, pointer: *mut c_void, size: usize, allocation: *mut *mut c_void) -> StatusResize an allocation. Zero size frees the block and stores null.
heap_free: unsafe extern "C" fn(heap: *mut Heap, pointer: *mut c_void) -> StatusRelease an allocation from this heap. Null succeeds.
time_resolution: unsafe extern "C" fn(clock: u32, nanoseconds: *mut u64) -> StatusRead a clock’s nominal resolution: XILA_CLOCK_MONOTONIC or XILA_CLOCK_REALTIME. Returns Unavailable when the host installed no clock.
time_sleep: unsafe extern "C" fn(nanoseconds: u64) -> StatusSuspend for at least the given nanoseconds on the executor’s clock. A zero wait yields once inside a coroutine and returns at once outside one.
random_fill: unsafe extern "C" fn(buffer: *mut c_void, size: usize) -> StatusFill a buffer from the host-granted entropy source. Zero size succeeds. The buffer contents are unspecified after a failure.
process_id: unsafe extern "C" fn(process: *const Process, id: *mut u32) -> StatusRead the process’s identifier.
process_parent_id: unsafe extern "C" fn(process: *const Process, id: *mut u32) -> StatusRead the identifier of the process that spawned this one, or zero (the root task) once that process has exited.
process_exit: unsafe extern "C" fn(process: *const Process, status: i32) -> StatusEnd the process with an exit status. Does not return on success; outside a native process coroutine it returns Unsupported.
process_spawn: unsafe extern "C" fn(process: *const Process, directory: *const Directory, path: *const c_char, path_length: usize, spawn: *const Spawn, child: *mut *mut Child) -> StatusStart an executable below a directory capability as a child process.
process_wait: unsafe extern "C" fn(process: *const Process, child: *mut Child, flags: u32, status: *mut i32) -> StatusCollect a child’s exit status. Only the spawning process may wait; flags: XILA_WAIT_NO_HANG.
process_child_close: unsafe extern "C" fn(child: *mut Child) -> StatusRelease a child handle. Null succeeds.
env_get: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize, buffer: *mut c_char, capacity: usize, value_length: *mut usize) -> StatusRead an environment variable; BufferTooSmall stores the required length.
env_set: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize, value: *const c_char, value_length: usize) -> StatusSet an environment variable of this process.
env_remove: unsafe extern "C" fn(process: *const Process, name: *const c_char, name_length: usize) -> StatusRemove an environment variable of this process. A missing one succeeds.
env_entry: unsafe extern "C" fn(process: *const Process, index: usize, buffer: *mut c_char, capacity: usize, entry_length: *mut usize) -> StatusRead a counted NAME=VALUE entry by index; NotFound marks the end.
thread_spawn: unsafe extern "C" fn(process: *const Process, stack_size: usize, entry: ThreadEntry, argument: *mut c_void, thread: *mut usize) -> StatusSpawn a worker of the current process; stack_size zero chooses the default.
thread_join: unsafe extern "C" fn(thread: usize, result: *mut *mut c_void) -> StatusCollect the worker result. Only the thread that created it may join.
thread_detach: unsafe extern "C" fn(thread: usize) -> Status§thread_yield: unsafe extern "C" fn() -> Status§thread_current: unsafe extern "C" fn(thread: *mut usize) -> Status§thread_key_create: unsafe extern "C" fn(key: *mut usize) -> Status§thread_key_delete: unsafe extern "C" fn(key: usize) -> Status§thread_tls_get: unsafe extern "C" fn(key: usize, value: *mut *mut c_void) -> Status§thread_tls_set: unsafe extern "C" fn(key: usize, value: *mut c_void) -> Status§thread_libc: unsafe extern "C" fn(location: *mut *mut ThreadLibc) -> StatusAddress of the SDK-reserved libc state, valid until the current thread ends.
mutex_init: unsafe extern "C" fn(mutex: *mut Mutex, flags: u32) -> Status§mutex_destroy: unsafe extern "C" fn(mutex: *mut Mutex) -> Status§mutex_lock: unsafe extern "C" fn(mutex: *mut Mutex, flags: u32) -> StatusA contended XILA_MUTEX_TRY returns WouldBlock.
mutex_unlock: unsafe extern "C" fn(mutex: *mut Mutex) -> Status§condition_init: unsafe extern "C" fn(condition: *mut Condition) -> Status§condition_destroy: unsafe extern "C" fn(condition: *mut Condition) -> Status§condition_wait: unsafe extern "C" fn(condition: *mut Condition, mutex: *mut Mutex, clock: u32, deadline: *const i64) -> StatusUnlock and sleep atomically, then reacquire before returning. A null deadline means infinite; otherwise use absolute nanoseconds on the selected ABI clock.
condition_notify: unsafe extern "C" fn(condition: *mut Condition, all: bool) -> Status§thread_has_workers: unsafe extern "C" fn(live: *mut bool) -> StatusReport whether any worker is live, including the caller if it is a worker.
thread_stop_others: unsafe extern "C" fn(process: *const Process) -> StatusBegin terminal cleanup. The process driver will only resume the caller.
thread_exit: unsafe extern "C" fn(result: *mut c_void) -> StatusEnd a worker with a join result. This returns only on failure.
poll_wait: unsafe extern "C" fn(entries: *mut PollEntry, count: usize, timeout_ms: i32, ready_count: *mut usize) -> StatusWait for readiness across file, pipe, directory and socket handles. timeout_ms is relative; negative means infinite, zero probes once.
file_read_at: unsafe extern "C" fn(file: *mut File, buffer: *mut c_void, size: usize, offset: u64, count: *mut usize) -> StatusTransfer from an explicit offset without changing the shared cursor.
file_write_at: unsafe extern "C" fn(file: *mut File, buffer: *const c_void, size: usize, offset: u64, count: *mut usize) -> StatusTransfer to an explicit offset without changing the shared cursor.
file_duplicate: unsafe extern "C" fn(file: *const File, output: *mut *mut File) -> StatusReturn an owned file that shares the original cursor and status flags.
file_control: unsafe extern "C" fn(file: *mut File, command: u32, input: *const c_void, input_size: usize, output: *mut c_void, output_size: usize) -> StatusQuery queued pipe bytes or get/set file flags using a uint32_t buffer.
file_is_terminal: unsafe extern "C" fn(file: *mut File, terminal: *mut bool) -> StatusReport whether an open file is an interactive terminal.
pipe_create: unsafe extern "C" fn(process: *const Process, flags: u32, reader: *mut *mut File, writer: *mut *mut File) -> StatusCreate the read and write handles of an unnamed pipe. The only supported flag is XILA_OPEN_NON_BLOCKING.
graphics_call: unsafe extern "C" fn(process: *const Process, function: u32, arguments: *const usize, argument_count: usize, result: *mut c_void) -> StatusRun one graphics call by its ID from xila/graphics.h. arguments holds
argument_count words (at most seven; null at zero) and result receives the
call’s word or 32-bit result. The SDK’s generated functions pack the words.
process_child_id: unsafe extern "C" fn(child: *const Child, id: *mut u32) -> StatusRead a child’s process identifier, the value its process_id reports.