Skip to main content

KernelVm

Struct KernelVm 

Source
pub struct KernelVm<F> { /* private fields */ }

Implementations§

Source§

impl<F: VirtualFileSystem + 'static> KernelVm<F>

Source

pub fn new(filesystem: F, config: KernelVmConfig) -> Self

Source

pub fn vm_id(&self) -> &str

Source

pub fn state(&self) -> LifecycleState

Source

pub fn commands(&self) -> BTreeMap<String, String>

Source

pub fn filesystem(&self) -> &PermissionedFileSystem<DeviceLayer<F>>

Source

pub fn filesystem_mut(&mut self) -> &mut PermissionedFileSystem<DeviceLayer<F>>

Source

pub fn user_manager(&self) -> &UserManager

Source

pub fn environment(&self) -> &BTreeMap<String, String>

Source

pub fn process_identity( &self, requester_driver: &str, pid: u32, ) -> KernelResult<ProcessIdentity>

Source

pub fn user_profile(&self) -> UserManager

Source

pub fn getuid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn getgid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn geteuid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn getegid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn getgroups( &self, requester_driver: &str, pid: u32, ) -> KernelResult<Vec<u32>>

Source

pub fn getresuid( &self, requester_driver: &str, pid: u32, ) -> KernelResult<(u32, u32, u32)>

Source

pub fn getresgid( &self, requester_driver: &str, pid: u32, ) -> KernelResult<(u32, u32, u32)>

Source

pub fn setuid( &self, requester_driver: &str, pid: u32, uid: u32, ) -> KernelResult<()>

Source

pub fn seteuid( &self, requester_driver: &str, pid: u32, euid: u32, ) -> KernelResult<()>

Source

pub fn setreuid( &self, requester_driver: &str, pid: u32, uid: Option<u32>, euid: Option<u32>, ) -> KernelResult<()>

Source

pub fn setresuid( &self, requester_driver: &str, pid: u32, uid: Option<u32>, euid: Option<u32>, suid: Option<u32>, ) -> KernelResult<()>

Source

pub fn setgid( &self, requester_driver: &str, pid: u32, gid: u32, ) -> KernelResult<()>

Source

pub fn setegid( &self, requester_driver: &str, pid: u32, egid: u32, ) -> KernelResult<()>

Source

pub fn setregid( &self, requester_driver: &str, pid: u32, gid: Option<u32>, egid: Option<u32>, ) -> KernelResult<()>

Source

pub fn setresgid( &self, requester_driver: &str, pid: u32, gid: Option<u32>, egid: Option<u32>, sgid: Option<u32>, ) -> KernelResult<()>

Source

pub fn setgroups( &self, requester_driver: &str, pid: u32, groups: Vec<u32>, ) -> KernelResult<()>

Source

pub fn switch_user( &self, requester_driver: &str, pid: u32, uid: u32, ) -> KernelResult<()>

Source

pub fn getpwuid(&self, uid: u32) -> KernelResult<String>

Source

pub fn getpwnam(&self, username: &str) -> KernelResult<String>

Source

pub fn getpwent(&self, index: usize) -> KernelResult<String>

Source

pub fn getgrgid(&self, gid: u32) -> KernelResult<String>

Source

pub fn getgrnam(&self, name: &str) -> KernelResult<String>

Source

pub fn getgrent(&self, index: usize) -> KernelResult<String>

Source

pub fn resource_snapshot(&self) -> ResourceSnapshot

Source

pub fn resource_limits(&self) -> &ResourceLimits

Source

pub fn set_permissions(&mut self, permissions: Permissions)

Source

pub fn set_loopback_exempt_ports(&mut self, ports: BTreeSet<u16>)

Source

pub fn extend_loopback_exempt_ports( &mut self, ports: impl IntoIterator<Item = u16>, )

Source

pub fn resolve_dns( &self, hostname: &str, policy: DnsLookupPolicy, ) -> KernelResult<DnsResolution>

Source

pub fn resolve_dns_records( &self, hostname: &str, record_type: RecordType, policy: DnsLookupPolicy, ) -> KernelResult<DnsRecordResolution>

Source

pub fn register_driver(&mut self, driver: CommandDriver) -> KernelResult<()>

Source

pub fn exec( &mut self, command: &str, options: ExecOptions, ) -> KernelResult<KernelProcessHandle>

Source

pub fn open_shell( &mut self, options: OpenShellOptions, ) -> KernelResult<OpenShellHandle>

Source

pub fn read_file(&mut self, path: &str) -> KernelResult<Vec<u8>>

Source

pub fn pread_file( &mut self, path: &str, offset: u64, length: usize, ) -> KernelResult<Vec<u8>>

Source

pub fn pread_file_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, offset: u64, length: usize, ) -> KernelResult<Vec<u8>>

Source

pub fn read_file_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<Vec<u8>>

Source

pub fn write_file( &mut self, path: &str, content: impl Into<Vec<u8>>, ) -> KernelResult<()>

Source

pub fn resolve_unix_socket_bind_target_for_process( &mut self, requester_driver: &str, pid: u32, cwd: &str, path: &str, ) -> KernelResult<String>

Resolve the canonical candidate for an AF_UNIX pathname bind without mutating the filesystem.

This is the preflight used by sidecars to enforce host-mount policy on the actual symlink-resolved destination before the socket inode is created. The subsequent bind call repeats every lookup and DAC check.

Source

pub fn bind_unix_socket_path_for_process( &mut self, requester_driver: &str, pid: u32, cwd: &str, path: &str, ) -> KernelResult<UnixSocketPathNode>

Perform Linux pathname lookup and materialize the persistent inode for an AF_UNIX bind.

Unlike the generic file helpers, this preserves raw ./.. traversal, follows symlinks only in the dirname, checks POSIX DAC with the process’s effective credentials, and never creates missing parent directories. The returned canonical path and (dev, ino) identify the exact dentry the sidecar must register.

Source

pub fn resolve_unix_socket_connect_target_for_process( &mut self, requester_driver: &str, pid: u32, cwd: &str, path: &str, ) -> KernelResult<UnixSocketPathNode>

Resolve an AF_UNIX connect target with Linux pathname and DAC rules. The final symlink is followed, search permission is required on every traversed directory, and the selected socket inode must be writable by the process’s effective credentials.

Source

pub fn pwrite_file( &mut self, path: &str, offset: u64, content: impl Into<Vec<u8>>, ) -> KernelResult<()>

Writes content at offset within an existing file, growing (and zero-filling) it as needed. This is the positional counterpart to Self::pread_file: it lets a descriptor-based caller (the shared WASI runner over the browser wire, which has no kernel fd offsets) write a region without the lossy, non-atomic read-modify-write it would otherwise have to do client-side. Enforcement matches write_file: read-only paths are rejected and the resulting file size is charged against the resource limits before the write.

Source

pub fn write_file_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, content: impl Into<Vec<u8>>, mode: Option<u32>, ) -> KernelResult<()>

Source

pub fn create_dir(&mut self, path: &str) -> KernelResult<()>

Source

pub fn create_dir_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, mode: Option<u32>, ) -> KernelResult<()>

Source

pub fn mkdir(&mut self, path: &str, recursive: bool) -> KernelResult<()>

Source

pub fn mkdir_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, recursive: bool, mode: Option<u32>, ) -> KernelResult<()>

Source

pub fn mknod_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, mode: u32, rdev: u64, ) -> KernelResult<()>

Source

pub fn umask( &self, requester_driver: &str, pid: u32, new_mask: Option<u32>, ) -> KernelResult<u32>

Source

pub fn exists(&self, path: &str) -> KernelResult<bool>

Source

pub fn exists_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<bool>

Source

pub fn stat(&mut self, path: &str) -> KernelResult<VirtualStat>

Source

pub fn stat_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<VirtualStat>

Source

pub fn filesystem_stats_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<FileSystemStats>

Source

pub fn access_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, access: u32, effective_ids: bool, ) -> KernelResult<()>

Source

pub fn lstat(&self, path: &str) -> KernelResult<VirtualStat>

Source

pub fn lstat_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<VirtualStat>

Source

pub fn read_dir(&mut self, path: &str) -> KernelResult<Vec<String>>

Source

pub fn read_dir_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<Vec<String>>

Source

pub fn read_dir_with_types_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<Vec<VirtualDirEntry>>

Source

pub fn read_dir_with_types( &mut self, path: &str, ) -> KernelResult<Vec<VirtualDirEntry>>

Lists a directory with each child’s file type in one call. This is the typed counterpart to Self::read_dir: it lets a descriptor-based caller recover Dirent kinds (readdir({ withFileTypes })) without an extra lstat round-trip per entry. Reuses read_dir_internal so proc, the readdir-entry limit, and read-permission checks behave identically; the per-entry lstat is in-process (no wire hops).

Source

pub fn read_dir_recursive( &mut self, path: &str, max_depth: Option<usize>, ) -> KernelResult<Vec<RecursiveDirEntry>>

Source

pub fn copy_path( &mut self, from: &str, to: &str, recursive: bool, ) -> KernelResult<()>

Source

pub fn remove_path(&mut self, path: &str, recursive: bool) -> KernelResult<()>

Source

pub fn move_path(&mut self, from: &str, to: &str) -> KernelResult<()>

Source

pub fn remove_file(&mut self, path: &str) -> KernelResult<()>

Source

pub fn remove_file_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<()>

Source

pub fn remove_dir(&mut self, path: &str) -> KernelResult<()>

Source

pub fn remove_dir_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<()>

Source

pub fn rename(&mut self, old_path: &str, new_path: &str) -> KernelResult<()>

Source

pub fn rename_at2( &mut self, old_path: &str, new_path: &str, flags: u32, ) -> KernelResult<()>

Source

pub fn rename_for_process( &mut self, requester_driver: &str, pid: u32, old_path: &str, new_path: &str, ) -> KernelResult<()>

Source

pub fn rename_at2_for_process( &mut self, requester_driver: &str, pid: u32, old_path: &str, new_path: &str, flags: u32, ) -> KernelResult<()>

Source

pub fn realpath(&self, path: &str) -> KernelResult<String>

Source

pub fn realpath_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<String>

Source

pub fn chmod(&mut self, path: &str, mode: u32) -> KernelResult<()>

Source

pub fn chmod_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, mode: u32, ) -> KernelResult<()>

Source

pub fn chown(&mut self, path: &str, uid: u32, gid: u32) -> KernelResult<()>

Source

pub fn chown_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, uid: u32, gid: u32, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn lchown_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, uid: u32, gid: u32, ) -> KernelResult<()>

Source

pub fn get_xattr( &mut self, path: &str, name: &str, follow_symlinks: bool, ) -> KernelResult<Vec<u8>>

Source

pub fn get_xattr_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, name: &str, follow_symlinks: bool, ) -> KernelResult<Vec<u8>>

Source

pub fn list_xattrs( &mut self, path: &str, follow_symlinks: bool, ) -> KernelResult<Vec<String>>

Source

pub fn list_xattrs_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, follow_symlinks: bool, ) -> KernelResult<Vec<String>>

Source

pub fn set_xattr( &mut self, path: &str, name: &str, value: Vec<u8>, flags: u32, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn set_xattr_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, name: &str, value: Vec<u8>, flags: u32, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn remove_xattr( &mut self, path: &str, name: &str, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn remove_xattr_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, name: &str, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn utimes( &mut self, path: &str, atime_ms: u64, mtime_ms: u64, ) -> KernelResult<()>

Source

pub fn utimes_spec( &mut self, path: &str, atime: VirtualUtimeSpec, mtime: VirtualUtimeSpec, ) -> KernelResult<()>

Source

pub fn utimes_spec_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, atime: VirtualUtimeSpec, mtime: VirtualUtimeSpec, follow_symlinks: bool, ) -> KernelResult<()>

Source

pub fn lutimes( &mut self, path: &str, atime: VirtualUtimeSpec, mtime: VirtualUtimeSpec, ) -> KernelResult<()>

Source

pub fn futimes( &mut self, requester_driver: &str, pid: u32, fd: u32, atime: VirtualUtimeSpec, mtime: VirtualUtimeSpec, ) -> KernelResult<()>

Source

pub fn truncate(&mut self, path: &str, length: u64) -> KernelResult<()>

Source

pub fn truncate_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, length: u64, ) -> KernelResult<()>

Source

pub fn fd_truncate( &mut self, requester_driver: &str, pid: u32, fd: u32, length: u64, ) -> KernelResult<()>

Source

pub fn fd_allocate( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: u64, length: u64, ) -> KernelResult<()>

Source

pub fn fd_punch_hole( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: u64, length: u64, ) -> KernelResult<()>

Source

pub fn fd_zero_range( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: u64, length: u64, keep_size: bool, ) -> KernelResult<()>

Source

pub fn fd_insert_range( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: u64, length: u64, ) -> KernelResult<()>

Source

pub fn fd_collapse_range( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: u64, length: u64, ) -> KernelResult<()>

Source

pub fn fd_allocated_ranges( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<Vec<(u64, u64)>>

Source

pub fn fd_unwritten_ranges( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<Vec<(u64, u64)>>

Source

pub fn check_execute_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, ) -> KernelResult<()>

Source

pub fn list_processes(&self) -> BTreeMap<u32, ProcessInfo>

Source

pub fn zombie_timer_count(&self) -> usize

Source

pub fn reap_due_zombies(&self)

Source

pub fn next_zombie_reap_deadline(&self) -> Option<Instant>

Source

pub fn spawn_process( &mut self, command: &str, args: Vec<String>, options: SpawnOptions, ) -> KernelResult<KernelProcessHandle>

Source

pub fn spawn_process_with_process_group( &mut self, command: &str, args: Vec<String>, options: SpawnOptions, requested_pgid: Option<u32>, ) -> KernelResult<KernelProcessHandle>

Source

pub fn spawn_process_with_process_group_preserving_cloexec( &mut self, command: &str, args: Vec<String>, options: SpawnOptions, requested_pgid: Option<u32>, ) -> KernelResult<KernelProcessHandle>

Create the fork half of a process whose exec is deferred until the caller has applied POSIX spawn file actions.

Unlike ordinary combined spawn, this preserves FD_CLOEXEC sources. The caller must invoke Self::close_process_cloexec_fds after all file actions succeed and before exposing the new process image.

Source

pub fn exec_process( &mut self, requester_driver: &str, pid: u32, command: &str, args: Vec<String>, env: BTreeMap<String, String>, cwd: String, ) -> KernelResult<()>

Replace a running process image without allocating a new PID or FD table. This is the kernel half of execve(2): supplied argv/env replace the old image, cwd and process relationships remain attached to the same process, and only FD_CLOEXEC descriptors are closed.

Source

pub fn validate_executable_path( &mut self, path: &str, cwd: &str, ) -> KernelResult<String>

Validate the literal pathname supplied to execve(2) without committing a process-image replacement. This preserves Linux pathname/type/mode errno behavior for sidecars that launch the file through an internal language-runtime driver.

Source

pub fn validate_wasm_exec_image( &mut self, path: &str, cwd: &str, ) -> KernelResult<()>

Validate the image chain for an in-place WASM exec replacement. Linux applies the same pathname/type/mode checks to each #! interpreter as it does to the originally requested script. The runner compiles the resulting WASM image before asking the sidecar to commit, but the trusted kernel remains responsible for enforcing those guest-visible checks and errno values.

Source

pub fn exec_process_retaining_internal_fds( &mut self, requester_driver: &str, pid: u32, command: &str, args: Vec<String>, env: BTreeMap<String, String>, _cwd: String, retained_internal_fds: &[u32], additional_cloexec_fds: &[u32], image_command: Option<&str>, ) -> KernelResult<()>

Sidecar variant of Self::exec_process which keeps host-only plumbing descriptors that are stored in the process FD table as an implementation detail. Those descriptors are never part of the guest’s Linux-visible FD set; all guest descriptors still obey FD_CLOEXEC.

Source

pub fn create_virtual_process( &mut self, requester_driver: &str, driver: &str, command: &str, args: Vec<String>, options: VirtualProcessOptions, ) -> KernelResult<KernelProcessHandle>

Source

pub fn create_virtual_process_with_process_group( &mut self, requester_driver: &str, driver: &str, command: &str, args: Vec<String>, options: VirtualProcessOptions, requested_pgid: Option<u32>, ) -> KernelResult<KernelProcessHandle>

Source

pub fn read_process_stdin( &mut self, requester_driver: &str, pid: u32, length: usize, timeout: Option<Duration>, ) -> KernelResult<Option<Vec<u8>>>

Source

pub fn write_process_stdout( &mut self, requester_driver: &str, pid: u32, data: &[u8], ) -> KernelResult<usize>

Source

pub fn write_process_stderr( &mut self, requester_driver: &str, pid: u32, data: &[u8], ) -> KernelResult<usize>

Source

pub fn exit_process( &mut self, requester_driver: &str, pid: u32, exit_code: i32, ) -> KernelResult<()>

Source

pub fn waitpid(&mut self, pid: u32) -> KernelResult<WaitPidResult>

Source

pub fn waitpid_with_options( &mut self, requester_driver: &str, waiter_pid: u32, pid: i32, flags: WaitPidFlags, ) -> KernelResult<Option<WaitPidEventResult>>

Source

pub fn take_nonterminal_wait_event( &self, requester_driver: &str, waiter_pid: u32, pid: i32, flags: WaitPidFlags, ) -> KernelResult<Option<WaitPidEventResult>>

Source

pub fn wait_and_reap(&mut self, pid: u32) -> KernelResult<(u32, i32)>

Source

pub fn open_pipe( &mut self, requester_driver: &str, pid: u32, ) -> KernelResult<(u32, u32)>

Source

pub fn fd_pipe_has_reader_in_other_process( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<bool>

Source

pub fn fd_snapshot( &self, requester_driver: &str, pid: u32, ) -> KernelResult<Vec<ProcessFdSnapshotEntry>>

Source

pub fn fd_socketpair( &mut self, requester_driver: &str, pid: u32, socket_type: SocketType, nonblocking: bool, close_on_exec: bool, ) -> KernelResult<(u32, u32)>

Create a connected AF_UNIX socket pair whose endpoints live in the process descriptor table. The socket records are owned by their open file descriptions rather than by a PID so SCM_RIGHTS and spawn inheritance preserve them after the creating process exits.

Source

pub fn fd_adopt_socket( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, status_flags: u32, ) -> KernelResult<u32>

Attach an existing kernel socket to a description-owned fd. Sidecar transports use this when a raw socket becomes transferable through SCM_RIGHTS; owner 0 keeps process teardown from destroying the socket while the open description is queued in another process.

Source

pub fn fd_adopt_socket_transfer( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, status_flags: u32, ) -> KernelResult<TransferredFd>

Attach an existing kernel socket directly to a transferable open file description. Unlike fd_adopt_socket, this does not allocate a temporary descriptor in the sender, matching SCM_RIGHTS behavior when the sender is already at its per-process fd limit.

Source

pub fn fd_transfer( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<TransferredFd>

Source

pub fn fd_install_transfer_at( &mut self, requester_driver: &str, pid: u32, fd: u32, fd_flags: u32, transfer: &TransferredFd, ) -> KernelResult<()>

Install a transferred open file description at an exact descriptor in another process. Unlike reopening TransferredFd’s path, this preserves the same description identity, offset, status flags, and special-resource ownership that existed when the transfer was captured.

Source

pub fn fd_socket_sendmsg( &mut self, requester_driver: &str, pid: u32, socket_fd: u32, data: &[u8], rights_fds: &[u32], ) -> KernelResult<usize>

Source

pub fn fd_socket_sendmsg_transfers( &mut self, requester_driver: &str, pid: u32, socket_fd: u32, data: &[u8], transfer_requests: &[FdTransferRequest], ) -> KernelResult<usize>

Source

pub fn fd_socket_recvmsg( &mut self, requester_driver: &str, pid: u32, socket_fd: u32, max_bytes: usize, max_rights: usize, close_on_exec: bool, peek: bool, dontwait: bool, waitall: bool, ) -> KernelResult<Option<ReceivedFdMessage>>

Source

pub fn fd_socket_shutdown( &mut self, requester_driver: &str, pid: u32, socket_fd: u32, how: SocketShutdown, ) -> KernelResult<()>

Source

pub fn open_pty( &mut self, requester_driver: &str, pid: u32, ) -> KernelResult<(u32, u32, String)>

Source

pub fn socket_create( &mut self, requester_driver: &str, pid: u32, spec: SocketSpec, ) -> KernelResult<SocketId>

Source

pub fn set_socket_resource_ledger( &mut self, resources: Arc<ResourceLedger>, ) -> KernelResult<()>

Source

pub fn set_socket_readiness_sink<S>(&mut self, sink: Option<S>)
where S: Fn(SocketReadiness) + Send + Sync + 'static,

Source

pub fn socket_get(&self, socket_id: SocketId) -> Option<SocketRecord>

Source

pub fn socket_records_for_pid(&self, pid: u32) -> Vec<SocketRecord>

Source

pub fn socket_bind_inet( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, address: InetSocketAddress, ) -> KernelResult<()>

Source

pub fn socket_bind_unix( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, path: impl Into<String>, ) -> KernelResult<()>

Source

pub fn socket_listen( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, backlog: usize, ) -> KernelResult<()>

Source

pub fn socket_queue_incoming_tcp_connection( &mut self, requester_driver: &str, pid: u32, listener_socket_id: SocketId, peer_address: InetSocketAddress, ) -> KernelResult<()>

Source

pub fn socket_accept( &mut self, requester_driver: &str, pid: u32, listener_socket_id: SocketId, ) -> KernelResult<SocketId>

Source

pub fn socket_connect_pair( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, peer_socket_id: SocketId, ) -> KernelResult<()>

Source

pub fn socket_connect_unix( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, target_path: impl Into<String>, ) -> KernelResult<()>

Source

pub fn socket_connect_inet_loopback( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, target_address: InetSocketAddress, ) -> KernelResult<()>

Source

pub fn socket_send_to_inet_loopback( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, target_address: InetSocketAddress, data: &[u8], ) -> KernelResult<usize>

Source

pub fn socket_connect_udp_loopback( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, target_address: InetSocketAddress, ) -> KernelResult<()>

Source

pub fn socket_disconnect_udp( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, ) -> KernelResult<()>

Source

pub fn socket_recv_datagram( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, max_bytes: usize, ) -> KernelResult<Option<ReceivedDatagram>>

Source

pub fn socket_recv_datagram_charged( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, max_bytes: usize, ) -> KernelResult<Option<ChargedReceivedDatagram>>

Source

pub fn socket_set_datagram_option( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, option: DatagramSocketOption, enabled: bool, ) -> KernelResult<()>

Source

pub fn socket_add_membership( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, membership: SocketMulticastMembership, ) -> KernelResult<()>

Source

pub fn socket_drop_membership( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, membership: SocketMulticastMembership, ) -> KernelResult<()>

Source

pub fn socket_set_state( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, state: SocketState, ) -> KernelResult<()>

Source

pub fn socket_write( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, data: &[u8], ) -> KernelResult<usize>

Source

pub fn socket_read( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, max_bytes: usize, ) -> KernelResult<Option<Vec<u8>>>

Source

pub fn socket_shutdown( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, how: SocketShutdown, ) -> KernelResult<()>

Source

pub fn socket_close( &mut self, requester_driver: &str, pid: u32, socket_id: SocketId, ) -> KernelResult<()>

Source

pub fn fd_open( &mut self, requester_driver: &str, pid: u32, path: &str, flags: u32, mode: Option<u32>, ) -> KernelResult<u32>

Source

pub fn fd_open_tmpfile( &mut self, requester_driver: &str, pid: u32, directory: &str, flags: u32, mode: u32, linkable: bool, ) -> KernelResult<u32>

Source

pub fn fd_read( &mut self, requester_driver: &str, pid: u32, fd: u32, length: usize, ) -> KernelResult<Vec<u8>>

Source

pub fn fd_read_with_timeout_result( &mut self, requester_driver: &str, pid: u32, fd: u32, length: usize, timeout: Option<Duration>, ) -> KernelResult<Option<Vec<u8>>>

Source

pub fn fd_write( &mut self, requester_driver: &str, pid: u32, fd: u32, data: &[u8], ) -> KernelResult<usize>

Source

pub fn fd_write_nonblocking( &mut self, requester_driver: &str, pid: u32, fd: u32, data: &[u8], ) -> KernelResult<usize>

Attempt one write without blocking on bounded kernel transport state.

This preserves the descriptor’s guest-visible status flags. Trusted sidecar actors use it to park a synchronous guest write and retry after readiness changes instead of blocking the process-wide reactor.

Source

pub fn fd_write_nonblocking_pipe( &mut self, requester_driver: &str, pid: u32, fd: u32, data: &[u8], ) -> KernelResult<usize>

Probe a pipe write without parking the caller when the pipe is full. Other descriptor kinds retain the regular fd_write behavior.

Source

pub fn poll_fds( &self, requester_driver: &str, pid: u32, fds: Vec<PollFd>, timeout_ms: i32, ) -> KernelResult<PollResult>

Source

pub fn poll_wait_handle(&self) -> PollWaitHandle

A cloneable, Send handle for waiting on kernel poll-state changes off the kernel owner’s thread. Pair with a zero-timeout poll_fds / fd_read_with_timeout_result re-check on the owning thread.

Source

pub fn poll_targets( &self, requester_driver: &str, pid: u32, targets: Vec<PollTargetEntry>, timeout_ms: i32, ) -> KernelResult<PollTargetResult>

Source

pub fn fd_seek( &mut self, requester_driver: &str, pid: u32, fd: u32, offset: i64, whence: u8, ) -> KernelResult<u64>

Source

pub fn fd_pread( &mut self, requester_driver: &str, pid: u32, fd: u32, length: usize, offset: u64, ) -> KernelResult<Vec<u8>>

Source

pub fn fd_pwrite( &mut self, requester_driver: &str, pid: u32, fd: u32, data: &[u8], offset: u64, ) -> KernelResult<usize>

Source

pub fn fd_chmod( &mut self, requester_driver: &str, pid: u32, fd: u32, mode: u32, ) -> KernelResult<()>

Source

pub fn fd_chmod_for_process( &mut self, requester_driver: &str, pid: u32, fd: u32, mode: u32, ) -> KernelResult<()>

Source

pub fn fd_chown_for_process( &mut self, requester_driver: &str, pid: u32, fd: u32, uid: u32, gid: u32, ) -> KernelResult<()>

Source

pub fn fd_dup( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<u32>

Source

pub fn fd_dup2( &mut self, requester_driver: &str, pid: u32, old_fd: u32, new_fd: u32, ) -> KernelResult<()>

Source

pub fn fd_close( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<()>

Source

pub fn close_process_cloexec_fds( &mut self, requester_driver: &str, pid: u32, ) -> KernelResult<()>

Commit the descriptor half of exec by closing every descriptor still marked FD_CLOEXEC after POSIX spawn file actions have completed.

Source

pub fn fd_fcntl( &mut self, requester_driver: &str, pid: u32, fd: u32, command: u32, arg: u32, ) -> KernelResult<u32>

Source

pub fn fd_named_pipe_peer_ready( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<bool>

Source

pub fn fd_flock( &self, requester_driver: &str, pid: u32, fd: u32, operation: u32, ) -> KernelResult<()>

Source

pub fn fd_record_lock( &self, requester_driver: &str, pid: u32, fd: u32, lock_type: RecordLockType, start: u64, length: u64, query: bool, ) -> KernelResult<Option<RecordLock>>

Source

pub fn fd_record_lock_wait( &self, requester_driver: &str, pid: u32, fd: u32, lock_type: RecordLockType, start: u64, length: u64, ) -> KernelResult<()>

Source

pub fn fd_record_lock_cancel( &self, requester_driver: &str, pid: u32, ) -> KernelResult<()>

Source

pub fn fd_stat( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<FdStat>

Source

pub fn fd_sync( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<()>

Synchronize a descriptor’s committed data and metadata. The in-memory VFS applies writes synchronously, so successful regular-file and directory syncs require no extra flush. Descriptor validation and Linux type errors still happen here rather than being silently ignored.

Source

pub fn fd_read_dir_with_types( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<Vec<ProcessFdDirEntry>>

Source

pub fn fd_path( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<String>

Source

pub fn isatty( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<bool>

Source

pub fn pty_window_size( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<PtyWindowSize>

Source

pub fn pty_set_discipline( &self, requester_driver: &str, pid: u32, fd: u32, config: LineDisciplineConfig, ) -> KernelResult<()>

Source

pub fn pty_set_raw_mode( &self, requester_driver: &str, pid: u32, fd: u32, enabled: bool, ) -> KernelResult<Option<u64>>

Toggle PTY raw mode and, when the caller belongs to the terminal’s foreground process group, create a generation-scoped recovery lease. The lease can be released during process cleanup without overwriting a newer terminal mutation from another process.

Source

pub fn pty_release_raw_mode( &self, requester_driver: &str, descriptor_owner_pid: u32, fd: u32, raw_mode_owner_pid: u32, generation: u64, ) -> KernelResult<bool>

Release a raw-mode recovery lease through any descriptor for the same PTY. fd normally belongs to the terminal owner because the exiting child may already have closed its own descriptor zero.

Source

pub fn pty_set_foreground_pgid( &self, requester_driver: &str, pid: u32, fd: u32, pgid: u32, ) -> KernelResult<()>

Source

pub fn tcgetattr( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<Termios>

Source

pub fn tcsetattr( &self, requester_driver: &str, pid: u32, fd: u32, termios: PartialTermios, ) -> KernelResult<()>

Source

pub fn tcgetpgrp( &self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<u32>

Source

pub fn pty_resize( &self, requester_driver: &str, pid: u32, fd: u32, cols: u16, rows: u16, ) -> KernelResult<()>

Source

pub fn signal_process( &self, requester_driver: &str, pid: i32, signal: i32, ) -> KernelResult<()>

Source

pub fn kill_process( &self, requester_driver: &str, pid: u32, signal: i32, ) -> KernelResult<()>

Source

pub fn setpgid( &self, requester_driver: &str, pid: u32, pgid: u32, ) -> KernelResult<()>

Source

pub fn getpgid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn getpid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn sigprocmask( &self, requester_driver: &str, pid: u32, how: SigmaskHow, set: SignalSet, ) -> KernelResult<SignalSet>

Source

pub fn sigpending( &self, requester_driver: &str, pid: u32, ) -> KernelResult<SignalSet>

Source

pub fn getppid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn setsid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn getsid(&self, requester_driver: &str, pid: u32) -> KernelResult<u32>

Source

pub fn dev_fd_read_dir( &self, requester_driver: &str, pid: u32, ) -> KernelResult<Vec<String>>

Source

pub fn dev_fd_stat( &mut self, requester_driver: &str, pid: u32, fd: u32, ) -> KernelResult<VirtualStat>

Source

pub fn dispose(&mut self) -> KernelResult<()>

Source§

impl KernelVm<MountTable>

Source

pub fn mount_filesystem( &mut self, path: &str, filesystem: impl VirtualFileSystem + 'static, options: MountOptions, ) -> KernelResult<()>

Source

pub fn mount_boxed_filesystem( &mut self, path: &str, filesystem: Box<dyn MountedFileSystem>, options: MountOptions, ) -> KernelResult<()>

Source

pub fn unmount_filesystem(&mut self, path: &str) -> KernelResult<()>

Source

pub fn remount_filesystem_for_process( &mut self, requester_driver: &str, pid: u32, path: &str, options: &str, ) -> KernelResult<()>

Source

pub fn mounted_filesystems(&self) -> Vec<MountEntry>

Source

pub fn root_filesystem_mut(&mut self) -> Option<&mut RootFileSystem>

Source

pub fn snapshot_root_filesystem( &mut self, ) -> KernelResult<RootFilesystemSnapshot>

Source

pub fn snapshot_root_filesystem_bounded( &mut self, max_bytes: u64, ) -> KernelResult<RootFilesystemSnapshot>

Snapshot the root filesystem without allowing caller-selected export work to materialize or return more than max_bytes. Raw content usage is checked before traversal; the encoded snapshot is checked before it can leave the kernel.

Trait Implementations§

Source§

impl<F> Drop for KernelVm<F>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<F> !RefUnwindSafe for KernelVm<F>

§

impl<F> !UnwindSafe for KernelVm<F>

§

impl<F> Freeze for KernelVm<F>
where F: Freeze,

§

impl<F> Send for KernelVm<F>
where F: Send,

§

impl<F> Sync for KernelVm<F>
where F: Sync,

§

impl<F> Unpin for KernelVm<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for KernelVm<F>
where F: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more