Skip to main content

Crate bux_krun

Crate bux_krun 

Source
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:

  1. Downloads the pre-built dynamic library from GitHub Releases (or uses a local path via BUX_DEPS_DIR).
  2. 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.

Type Aliases§

__gid_t
__uid_t
gid_t
uid_t