kona_common

Trait BasicKernelInterface

Source
pub trait BasicKernelInterface {
    // Required methods
    fn write(fd: FileDescriptor, buf: &[u8]) -> IOResult<usize>;
    fn read(fd: FileDescriptor, buf: &mut [u8]) -> IOResult<usize>;
    fn exit(code: usize) -> !;
}
Expand description

The BasicKernelInterface trait describes the functionality of several core system calls inside of the FPVM kernel.

Commonly, FPVMs delegate IO operations to custom file descriptors in the client program. It is a safe wrapper around the raw system calls available to the client program.

In cases where the set of system calls defined in this trait need to be extended, an additional trait should be created that extends this trait.

Required Methods§

Source

fn write(fd: FileDescriptor, buf: &[u8]) -> IOResult<usize>

Write the given buffer to the given file descriptor.

Source

fn read(fd: FileDescriptor, buf: &mut [u8]) -> IOResult<usize>

Read from the given file descriptor into the passed buffer.

Source

fn exit(code: usize) -> !

Exit the process with the given exit code. The implementation of this function should always panic after invoking the EXIT syscall.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§