Expand description
Raw FFI bindings to libkrun — a lightweight VM engine for sandboxed execution.
All types and functions are auto-generated by bindgen
from the libkrun.h header. Do not edit bindings.rs manually.
§Build
The build script (build.rs) automatically:
- Downloads the pre-built dynamic library from GitHub Releases
(or uses a local path via
BUX_DEPS_DIR). - Configures the linker for dynamic linking.
For local development, set BUX_DEPS_DIR to point at a directory
containing the pre-built libkrun dynamic library.
Constants§
- COMPAT_
NET_ FEATURES - KRUN_
DISK_ FORMAT_ QCOW2 - KRUN_
DISK_ FORMAT_ RAW - KRUN_
DISK_ FORMAT_ VMDK - KRUN_
FEATURE_ AMD_ SEV - KRUN_
FEATURE_ AWS_ NITRO - KRUN_
FEATURE_ BLK - KRUN_
FEATURE_ EFI - KRUN_
FEATURE_ GPU - KRUN_
FEATURE_ INPUT - KRUN_
FEATURE_ INTEL_ TDX - KRUN_
FEATURE_ NET - KRUN_
FEATURE_ SND - KRUN_
FEATURE_ TEE - KRUN_
FEATURE_ VIRGL_ RESOURCE_ MAP2 - KRUN_
KERNEL_ FORMAT_ ELF - KRUN_
KERNEL_ FORMAT_ IMAGE_ BZ2 - KRUN_
KERNEL_ FORMAT_ IMAGE_ GZ - KRUN_
KERNEL_ FORMAT_ IMAGE_ ZSTD - KRUN_
KERNEL_ FORMAT_ PE_ GZ - KRUN_
KERNEL_ FORMAT_ RAW - KRUN_
LOG_ LEVEL_ DEBUG - KRUN_
LOG_ LEVEL_ ERROR - KRUN_
LOG_ LEVEL_ INFO - KRUN_
LOG_ LEVEL_ OFF - KRUN_
LOG_ LEVEL_ TRACE - KRUN_
LOG_ LEVEL_ WARN - KRUN_
LOG_ OPTION_ NO_ ENV - KRUN_
LOG_ STYLE_ ALWAYS - KRUN_
LOG_ STYLE_ AUTO - KRUN_
LOG_ STYLE_ NEVER - KRUN_
LOG_ TARGET_ DEFAULT - KRUN_
MAX_ DISPLAYS - KRUN_
SYNC_ FULL - KRUN_
SYNC_ NONE - KRUN_
SYNC_ RELAXED - KRUN_
TSI_ HIJACK_ INET - KRUN_
TSI_ HIJACK_ UNIX - NET_
FEATURE_ CSUM - NET_
FEATURE_ GUEST_ CSUM - NET_
FEATURE_ GUEST_ TSO4 - NET_
FEATURE_ GUEST_ TSO6 - NET_
FEATURE_ GUEST_ UFO - NET_
FEATURE_ HOST_ TSO4 - NET_
FEATURE_ HOST_ TSO6 - NET_
FEATURE_ HOST_ UFO - NET_
FLAG_ VFKIT - VIRGLRENDERER_
DRM - VIRGLRENDERER_
NO_ VIRGL - VIRGLRENDERER_
RENDER_ SERVER - VIRGLRENDERER_
THREAD_ SYNC - VIRGLRENDERER_
USE_ ASYNC_ FENCE_ CB - VIRGLRENDERER_
USE_ EGL - VIRGLRENDERER_
USE_ EXTERNAL_ BLOB - VIRGLRENDERER_
USE_ GLES - VIRGLRENDERER_
USE_ GLX - VIRGLRENDERER_
USE_ SURFACELESS - VIRGLRENDERER_
VENUS
Functions§
- krun_
add_ ⚠console_ port_ inout - krun_
add_ ⚠console_ port_ tty - krun_
add_ ⚠disk - Adds a disk image to be used as a general partition for the microVM. The only supported image format is “raw”.
- krun_
add_ ⚠disk2 - Adds a disk image to be used as a general partition for the microVM. The supported image formats are: “raw” and “qcow2”.
- krun_
add_ ⚠disk3 - Adds a disk image to be used as a general partition for the microVM.
- krun_
add_ ⚠display - Configure a display output for the VM.
- krun_
add_ ⚠input_ device - Adds an input device with separate config and events objects.
- krun_
add_ ⚠input_ device_ fd - Creates a passthrough input device from a host /dev/input/* file descriptor. The device configuration will be automatically queried from the host device using ioctls.
- krun_
add_ ⚠net_ tap - Adds an independent virtio-net device with the tap backend. Call to this function disables TSI backend.
- krun_
add_ ⚠net_ unixgram - Adds an independent virtio-net device with a unixgram-based backend, such as gvproxy or vmnet-helper.
- krun_
add_ ⚠net_ unixstream - Adds an independent virtio-net device connected to a unixstream-based userspace network proxy, such as passt or socket_vmnet.
- krun_
add_ ⚠serial_ console_ default - krun_
add_ ⚠virtio_ console_ default - krun_
add_ ⚠virtio_ console_ multiport - krun_
add_ ⚠virtiofs - Adds an independent virtio-fs device pointing to a host’s directory with a tag.
- krun_
add_ ⚠virtiofs2 - Adds an independent virtio-fs device pointing to a host’s directory with a tag. This variant allows specifying the size of the DAX window.
- krun_
add_ ⚠vsock - Add a vsock device with specified TSI features.
- krun_
add_ ⚠vsock_ port - Adds a port-path pairing for guest IPC with a process in the host.
- krun_
add_ ⚠vsock_ port2 - Adds a port-path pairing for guest IPC with a process in the host.
- krun_
check_ ⚠nested_ virt - Check the system if Nested Virtualization is supported
- krun_
create_ ⚠ctx - Creates a configuration context.
- krun_
disable_ ⚠implicit_ console - krun_
disable_ ⚠implicit_ vsock - Disable the implicit vsock device.
- krun_
display_ ⚠set_ dpi - Configure DPI of the display reported to the guest
- krun_
display_ ⚠set_ edid - Configure a custom EDID blob for a display
- krun_
display_ ⚠set_ physical_ size - Configure physical size of the display reported to the guest
- krun_
display_ ⚠set_ refresh_ rate - Configure refresh rate for a display
- krun_
free_ ⚠ctx - Frees an existing configuration context.
- krun_
get_ ⚠max_ vcpus - Get the maximum number of vCPUs supported by the hypervisor.
- krun_
get_ ⚠shutdown_ eventfd - Returns the eventfd file descriptor to signal the guest to shut down orderly. This must be called before starting the microVM with “krun_start_event”. Only available in libkrun-efi.
- krun_
has_ ⚠feature - Checks if a specific feature was enabled at build time.
- krun_
init_ ⚠log - Initializes logging for the library.
- krun_
set_ ⚠console_ output - Configures the console device to ignore stdin and write the output to “c_filepath”.
- krun_
set_ ⚠data_ disk - DEPRECATED. Use krun_add_disk instead.
- krun_
set_ ⚠display_ backend - Configures a krun_display_backend struct to be used for display output. (see libkrun_display.h)
- krun_
set_ ⚠env - Sets environment variables to be configured in the context of the executable.
- krun_
set_ ⚠exec - Sets the path to the executable to be run inside the microVM, the arguments to be passed to the executable, and the environment variables to be configured in the context of the executable.
- krun_
set_ ⚠firmware - Sets the path to the firmware to be loaded into the microVM.
- krun_
set_ ⚠gpu_ options - Enables and configures a virtio-gpu device.
- krun_
set_ ⚠gpu_ options2 - Enables and configures a virtio-gpu device. This variant allows specifying the size of the host window (acting as vRAM in the guest).
- krun_
set_ ⚠gvproxy_ path - DEPRECATED. Use krun_add_net_unixgram instead.
- krun_
set_ ⚠kernel - Sets the path to the kernel to be loaded in the microVM.
- krun_
set_ ⚠kernel_ console - krun_
set_ ⚠log_ level - Sets the log level for the library.
- krun_
set_ ⚠mapped_ volumes - NO LONGER SUPPORTED. DO NOT USE.
- krun_
set_ ⚠nested_ virt - Configures the microVM to support Nested Virtualization
- krun_
set_ ⚠net_ mac - Sets the MAC address for the virtio-net device when using the passt backend.
- krun_
set_ ⚠passt_ fd - DEPRECATED. Use krun_add_net_unixstream instead.
- krun_
set_ ⚠port_ map - Configures a map of host to guest TCP ports for the microVM.
- krun_
set_ ⚠rlimits - Configures a map of rlimits to be set in the guest before starting the isolated binary.
- krun_
set_ ⚠root - Sets the path to be use as root for the microVM. Not available in libkrun-SEV.
- krun_
set_ ⚠root_ disk - DEPRECATED. Use krun_add_disk instead.
- krun_
set_ ⚠root_ disk_ remount - Configure block device to be used as root filesystem.
- krun_
set_ ⚠smbios_ oem_ strings - Sets the SMBIOS OEM Strings.
- krun_
set_ ⚠snd_ device - Enables or disables a virtio-snd device.
- krun_
set_ ⚠tee_ config_ file - Sets the file path to the TEE configuration file. Only available in libkrun-sev.
- krun_
set_ ⚠vm_ config - Sets the basic configuration parameters for the microVM.
- krun_
set_ ⚠workdir - Sets the working directory for the executable to be run inside the microVM.
- krun_
setgid ⚠ - Configures gid which is set right before the microVM is started.
- krun_
setuid ⚠ - Configures uid which is set right before the microVM is started.
- krun_
split_ ⚠irqchip - Specify whether to split IRQCHIP responsibilities between the host and the guest.
- krun_
start_ ⚠enter - Starts and enters the microVM with the configured parameters. The VMM will attempt to take over stdin/stdout to manage them on behalf of the process running inside the isolated environment, simulating that the latter has direct control of the terminal.