text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>#![allow(unused)]
use std::{
net::{Ipv4Addr, SocketAddrV4},
sync::atomic::{AtomicU16, Ordering},
};
use tracing_test::traced_test;
#[cfg(feature = "remote")]
use crate::RemoteNetworkingServer;
use crate::{
VirtualConnectedSocketExt, VirtualTcpListenerExt, host::LocalNetworking,
meta::Fra... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>e| Self(StoreHandle::from_internal(store_id, handle)))
}
}
}
<|fim_prefix|>use backtrace::Backtrace;
use std::{cell::UnsafeCell, ptr::NonNull};
use wasmer_types::{RawValue, StoreId};
use crate::{StoreHandle, StoreObjects, VMTag, store::InternalStoreHandle};
/// Underlying object referenced b... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>andle<VMTable>),
/// A memory export value.
Memory(InternalStoreHandle<VMMemory>),
/// A global export value.
Global(InternalStoreHandle<VMGlobal>),
/// A tag export value.
Tag(InternalStoreHandle<VMTag>),
}
/// A function export value.
#[derive(Debug)]
pub struct VMFunction {
... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::any::Any;
use wasmer_types::RawValue;
use crate::store::InternalStoreHandle;
/// Underlying object referenced by a `VMExternRef`.
#[derive(Debug)]
pub struct VMExternObj {
contents: Box<dyn Any + Send + Sync + 'static>,
}
impl VMExternObj {
/// Wraps the given value to expose it to Was... | fim | wasmerio/wasmer | rust |
use std::any::Any;
/// Underlying FunctionEnvironment used by a `VMFunction`.
pub struct VMFunctionEnvironment {
/// The contents of the environment.
pub contents: Box<dyn Any + Send + 'static>,
}
impl std::fmt::Debug for VMFunctionEnvironment {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use crate::{store::MaybeInstanceOwned, vmcontext::VMGlobalDefinition};
use std::{cell::UnsafeCell, ptr::NonNull};
use wasmer_types::GlobalType;
/// A Global instance
#[derive(Debug)]
pub struct VMGlobal {
ty: GlobalType,
vm_global_definition: MaybeInstanceOwned<VMGlobalDefinition>,
}
impl VMGlob... | fim | wasmerio/wasmer | rust |
// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
use wasmer_types::entity::{BoxedSlice, PrimaryMap};
use wasmer_types::{FunctionIndex, GlobalIndex... | fim | wasmerio/wasmer | rust |
use super::{Instance, VMInstance};
use crate::vmcontext::VMTableDefinition;
use crate::{VMGlobalDefinition, VMMemoryDefinition};
use std::alloc::{self, Layout};
use std::convert::TryFrom;
use std::mem;
use std::ptr::{self, NonNull};
use wasmer_types::entity::EntityRef;
use wasmer_types::{LocalGlobalIndex, VMOffsets};
u... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>(config, trap_handler)?;
Ok(())
}
/// Return a reference to the vmctx used by compiled wasm code.
pub fn vmctx(&self) -> &VMContext {
self.instance().vmctx()
}
/// Return a raw pointer to the vmctx used by compiled wasm code.
pub fn vmctx_ptr(&self) -> *mut VMCont... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>new `InstanceRef`. It allocates nothing. It fills
/// nothing. The `Instance` must be already valid and
/// filled.
///
/// # Safety
///
/// `instance` must a non-null, non-dangling, properly aligned,
/// and correctly initialized pointer to `Instance`. See
/// [`InstanceAl... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>//! Implements the necessary infrastructure for interrupting running WASM code
//! via OS signals.
//!
//! This module is meant to be used from within the wasmer crate. Embedders
//! should not call any of the functions here; instead, they should go
//! through [`wasmer::Store::get_interrupter`].
// TODO... | fim | wasmerio/wasmer | rust |
use std::{
cell::UnsafeCell,
ffi::CStr,
sync::{
Arc, LazyLock,
atomic::{AtomicUsize, Ordering},
},
};
use dashmap::{DashMap, Entry};
use wasmer_types::StoreId;
use super::*;
/// All necessary data for interrupting a store running WASM code
/// on a thread.
struct StoreInterruptState {... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use wasmer_<|fim_suffix|>n install(store_id: StoreId) -> Result<InterruptInstallGuard, InstallError> {
Ok(InterruptInstallGuard { store_id })
}
pub(super) fn uninstall(_store_id: StoreId) {}
/// Interrupt the given store.
///
/// On unsupported platforms this is a no-op.
pub fn interrupt(_store_id: ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>t-size", derive(loupe::MemoryUsage))]
#[repr(transparent)]
pub struct FunctionBodyPtr(pub *const VMFunctionBody);
impl std::ops::Deref for FunctionBodyPtr {
type Target = *const VMFunctionBody;
fn deref(&self) -> &Self::Target {
&self.0
}
}
/// # Safety
/// The VMFunctionBody that t... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> = unsafe { ptr.cast::<*const u8>().read_unaligned() };
}
log!("(pers) returning ptr value {ptr:?}");
Ok(ptr)
}
<|fim_prefix|>//! Parsing of GCC-style Language-Specific Data Area (LSDA)
//! For details se*const ():
//! * <https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehfram... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>;
result |= ((byte & 0x7F) as u64) << shift;
shift += 7;
if byte & 0x80 == 0 {
break;
}
}
// sign-extend
if shift < u64::BITS && (byte & 0x40) != 0 {
result |= (!0) << shift;
}
result as i64... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>
}
<|fim_prefix|>//! Implementation of personality function and unwinding support for Wasmer.
//!
//! On a native platform, when an exception is thrown, the type info of the
//! exception is known, and can be matched against the LSDA table within the
//! personality function (e.g. __gxx_personality_v0 for... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>// Part of the logic, here, is borrowed as-is from rust's stdlib.
use crate::{InternalStoreHandle, VMContext, VMExceptionObj};
mod dwarf;
cfg_if::cfg_if! {
if #[cfg(any(target_env = "msvc", target_family = "wasm"))] {
/// The implementation of Wasmer's personality function.
///
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>st () as usize,
LibCall::ImportedTableGet => wasmer_vm_imported_table_get as *const () as usize,
LibCall::TableSet => wasmer_vm_table_set as *const () as usize,
LibCall::ImportedTableSet => wasmer_vm_imported_table_set as *const () as usize,
LibCall::TableGrow => wasmer_vm_... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
//! Memory management for linear memories.
//!
//! `Memory` is to WebAssembly linear memories what `Table` is to WebAssembly tables.
use crate::threadconditions::ThreadCon... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>;
} else {
accessible_size = accessible_size.max(len);
}
accessible_size = accessible_size.min(mapping_size);
memory_fd = file.into_raw_fd();
}
// Compute the flags
let mut flags = match memory_fd {
fd if... | fim | wasmerio/wasmer | rust |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>OBESTACK: unsafe extern "C" fn() = compiler_builtins::__rust_probestack;
}
}
<|fim_prefix|>// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
//! This section defines the `PROBESTACK` intrinsic which is used in the
//! ... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
//! Implement a registry of function signatures, for fast indirect call
//! signature checking.
use crate::vmcontext::VMSignatureHash;
use std::collections::HashMap;
use s... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>///
/// # Safety
/// Handling `InternalStoreHandle` values is unsafe because they do not track context ID.
pub unsafe fn from_internal(id: StoreId, internal: InternalStoreHandle<T>) -> Self {
Self { id, internal }
}
}
/// Internal handle to an object owned by the current context.
... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
//! Memory management for tables.
//!
//! `Table` is to WebAssembly tables what `Memory` is to WebAssembly linear memories.
use crate::Trap;
use crate::VMExternRef;
use cr... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::{
sync::{
Arc,
atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering},
},
time::Duration,
};
use dashmap::DashMap;
use fnv::FnvBuildHasher;
use parking_lot::{Condvar, Mutex};
use thiserror::Error;
/// Error that can occur during wait/notify calls.
// Non-exhaustive to ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>ionBody,
*mut wasmer_types::RawValue,
),
unsafe extern "C" fn(VMFunctionContext, *const VMFunctionBody, *mut u8),
>(trampoline)(vmctx, callee, values_vec);
})
}
}
<|fim_prefix|>// This file contains code from external sources.
// ... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use backtrace::Backtrace;
use std::any::Any;
use std::error::Error;
use std::fmt;
use wasmer_types::TrapCode;
use crate::{StoreObjects, VMExceptionRef};
/// Stores trace message with backtrace.
#[derive(Debug)]
pub enum Trap {
/// A user-raised trap through `raise_user_trap`.
User(Box<dyn Error ... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>// This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
#![allow(static_mut_refs)]
//! WebAssembly trap handling, which is built on top of the lower-level
//! signalhandling mechanisms.
use super::trap::UnwindReason;
use crate... | fim | wasmerio/wasmer | rust |
//! Signal-free trap handling (`baremetal` feature).
//!
//! Mirrors the `traphandlers.rs` API without OS signals or coroutine stacks.
//! Traps are routed through a host-installed callback (`install_unwinder`).
//! Without one, they become panics. std is still required (`Mutex`, `thread_local`).
//!
//! Unlike the OS ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>ub fn null() -> Self {
Self {
func_ptr: ptr::null(),
type_signature_hash: VMSignatureHash(0),
vmctx: VMFunctionContext {
host_env: ptr::null_mut(),
},
call_trampoline: null_call_trampoline,
}
}
}
impl PartialE... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use crate::Region;
use thiserror::Error;
<|fim_suffix|>]
InFunc {
funcname: &'static str,
location: &'static str,
#[source]
err: Box<GuestError>,
},
#[error("In data {typename}.{field}:")]
InDataField {
typename: String,
field: String,
... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use crate::AllBytesValid;
use std::cmp::Ordering;
use std::fmt;
use std::mem;
use std::slice;
/// Helper type representing a 1-byte-aligned little-endian value in memory.
///
/// This type is used in slice types for Wasmer host bindings. Guest types are
/// not guaranteed to be either aligned or in the n... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>x: ResourceIndex) -> i32 {
self.slab.get(idx.0).unwrap().wasm
}
pub fn clone(&mut self, idx: ResourceIndex) -> Result<(), RuntimeError> {
let resource = self.slab.get_mut(idx.0).unwrap();
resource.refcnt = match resource.refcnt.checked_add(1) {
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> bc.slice::<u8>(2, 5).unwrap();
bc.slice::<u8>(10, 5).unwrap();
bc.slice::<u8>(15, 5).unwrap();
bc.slice_mut::<u8>(0, 10).unwrap_err();
bc.slice::<u8>(0, 10).unwrap();
}
#[test]
fn zero_length() {
let mut bytes = [0; 100];
let mut bc = Borr... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>t(&self, idx: u32) -> Option<&T> {
match self.storage.get(idx as usize)? {
Entry::Full(b) => Some(b),
Entry::Empty { .. } => None,
}
}
pub fn get_mut(&mut self, idx: u32) -> Option<&mut T> {
match self.storage.get_mut(idx as usize)? {
En... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::convert::TryFrom;
use std::fmt;
use std::mem;
<|fim_suffix|>_empty: self.next,
};
let slot = self.elems.get_mut(index).ok_or(RemoveError::NotAllocated)?;
// Assume that `item` is valid, and if it is, we can return quickly
match mem::replace(slot, new_empty) {
... | fim | wasmerio/wasmer | rust |
use wasmer_derive::ValueType;
#[derive(Debug, Copy, Clone, PartialEq, Eq, ValueType)]
#[repr(C)]
pub struct __wasi_asyncify_t<O>
where
O: wasmer_types::ValueType,
{
pub start: O,
pub end: O,
}
<|endoftext|> | fim | wasmerio/wasmer | rust |
<|fim_suffix|>ocsrs, feature(doc_cfg))]
pub mod asyncify;
pub mod types;
pub mod wasi;
pub mod wasix;
<|fim_prefix|>#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_lo<|fim_middle|>go_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(d<|endoftext|> | fim | wasmerio/wasmer | rust |
<|fim_prefix|>#![deny(unused_mut)]
#![allow(non_camel_case_types, clippy::identity_op)]
//! Wasmer's WASI types implementation.
//!
//! Those types aim at being used by [the `wasmer-wasi`
//! crate](https://github.com/wasmerio/wasmer/blob/main/lib/wasi).
// Needed for #[derive(ValueType)]
extern crate wasmer_types as... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use crate::wasi::bindings::*;
impl Rights {
pub const fn all_socket() -> Self {
Self::from_bits_truncate(
Self::FD_FDSTAT_SET_FLAGS.bits()
| Self::FD_FILESTAT_GET.bits()
| Self::FD_READ.bits()
| Self::FD_WRITE.bits()
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>:*;
<|fim_prefix|>#[allow(unused_imports)]
pub(crate) mod bindings;
pub(crate) mod bindings_manual;
pub use self::bindings::*;
pub use bindings_m<|fim_middle|>anual::*;
mod wasix_manual;
pub use wasix_manual:<|endoftext|> | fim | wasmerio/wasmer | rust |
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
use std::mem::MaybeUninit;
use wasmer::{FromToNativeWasmType, MemorySize, ValueType};
use super::{
Errno, ErrnoSignal, EventFdReadwrite, Eventtype, Fd, JoinStatusType, ProcSpawnFdOp, Signal,
SignalDisposition, Snapshot0SubscriptionClock, Su... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>is marked as none readable/writable so stack overflows cause an exception
/// TODO: This field will need to be used to mark the guard memory as inaccessible
#[allow(dead_code)]
pub guard_size: u64,
/// Total size of the stack
pub stack_size: u64,
/// Pointer to the thread's TLS (Th... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::{
path::{Path, PathBuf},
sync::Arc,
};
use anyhow::Context;
use once_cell::sync::OnceCell;
use sha2::Digest;
use virtual_fs::{FileSystem, MountFileSystem};
use wasmer_config::package::{PackageHash, PackageId, PackageSource};
use wasmer_package::package::Package;
use webc::Container;
use ... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>#![allow(clippy::result_large_err)]
use super::{BinaryPackage, BinaryPackageCommand};
use crate::{
RewindState, SpawnError, WasiError, WasiRuntimeError,
os::task::{
TaskJoinHandle,
thread::{RewindResultType, WasiThreadRunGuard},
},
runtime::{
ModuleInput, TaintReaso... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> + Sync + 'static>,
pub(crate) local: Arc<RwLock<HashMap<String, Option<Arc<BinaryPackage>>>>>,
}
impl BinFactory {
pub fn new(runtime: Arc<dyn Runtime + Send + Sync + 'static>) -> BinFactory {
BinFactory {
commands: Commands::new_with_builtins(runtime.clone()),
ru... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>lities) {
let Capabilities {
insecure_allow_all,
http_client,
threading,
} = other;
self.insecure_allow_all |= insecure_allow_all;
self.http_client.update(http_client);
self.threading.update(threading);
}
}
impl Default for C... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>InodeVal {
pub fn read(&self) -> RwLockReadGuard<'_, Kind> {
self.kind.read().unwrap()
}
pub fn write(&self) -> RwLockWriteGuard<'_, Kind> {
self.kind.write().unwrap()
}
}
/// The core of the filesystem abstraction. Includes directories,
/// files, and symlinks.
#[derive... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> // on self.first_free
Some(free) => {
self.fds[free] = Some(fd);
free as WasiFd
}
// No holes - insert at the end
None => {
self.fds.pu... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>und in standard device location")
}
}
}
impl VirtualFile for WasiStateFileGuard {
fn last_accessed(&self) -> u64 {
let guard = self.lock_read();
if let Some(file) = guard.as_ref() {
file.last_accessed()
} else {
0
}
}
fn las... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>ate.lock().unwrap();
state.add_waker(waker);
match state.dec() {
0 => Poll::Pending,
res => Poll::Ready(res),
}
}
pub fn try_read(&self) -> Option<u64> {
let mut state = self.state.lock().unwrap();
match state.dec() {
0 =... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>elf.as_str();
let relative = relative.as_str();
if relative.is_empty() || relative == "." {
return PosixPathBuf::from(base);
}
if relative.starts_with('/') || base.is_empty() || base == "." {
PosixPathBuf::from(relative)
} else if base == "... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::{collections::BTreeSet, ops::Deref, sync::Arc};
use futures::future::BoxFuture;
use http::{HeaderMap, Method, StatusCode};
use url::Url;
/// Defines http client permissions.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct HttpClientCapabilityV1 {
pub allow_all: bool,
pub allowed... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>mod client;
#[cfg(feature = "host-reqwest")]
pub mod reqwest;
#[cfg(feature = "js")]
mod web_http_client;
#[cfg(feature = "js")]
pub use self::web_http_client::WebHttpClient;
pub use self::client::*;
pub(crate) cons<|fim_suffix|>http_client::WebHttpClient::default())
} else {
// N... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> tracing::warn!(timeout= "timeout while downloading response body");
return Err(anyhow::anyhow!("Timeout while downloading response body"));
} else {
tracing::debug!(downloaded_body_size_bytes=%buf.len(... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>t(http::header::CONTENT_TYPE)
.unwrap()
.to_str()
.unwrap(),
"application/json",
);
let body: serde_json::Value =
serde_json::from_slice(response.body.as_deref().unwrap()).unwrap();
let frontend_url = body
... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::collections::{BTreeMap, hash_map};
#[allow(unused)]
use lz4_flex::{
self, block, compress_prepend_size, decompress, decompress_into, decompress_size_prepended,
};
use crate::os::task::process::MemorySnapshotRegion;
use super::*;
/// This value is tweaked to minimize the amount of journal
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>#[cfg(feature = "journal")]
mod process_exit;
#[cfg(feature = "journal")]
mod save_event;
#[cfg(feature = "journal")]
mod thread_exit;
#[cfg(feature = "journal")]
mod thread_state;
/// The journal effector is an adapter that will be removed in a future refactor.
/// Its purpose is to put the code that do... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>escriptors but we don't actually send
// any signals
if env.replaying_journal {
let state = env.state.clone();
block_on(state.fs.close_all());
} else {
env.blocking_on_exit(exit_code);
}
// Reset the memory back to a zero size
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>nt, "saving journal event");
ctx.data()
.active_journal()?
.write(event)
.map_err(map_snapshot_err)?;
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub(crate) fn save<|fim_middle|>_event(
ctx: &mut FunctionEnvMut<'_, Was... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEff<|fim_suffix|> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry::ChangeDirectoryV1 { path: path.into() })
}
pub fn apply_chdir(ctx: &mut FunctionEnvMut<'_, WasiEnv>, path: &str) -> anyhow::Result<()> {
crate::syscalls::chdir_internal(ctx.data()... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>e::syscalls::clock_time_set_internal(ctx, clock_id, time);
if ret != Errno::Success {
bail!(
"journal restore error: failed to set clock time (clock_id={clock_id:?}, time={time}) - {ret}"
);
}
Ok(())
}
}
<|fim_prefix|>use super::*;
impl ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_epoll_cre<|fim_middle|>ate(ctx: &mut FunctionEnvMut<'_, WasiEnv>, fd: Fd) -> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry::EpollCreateV1 { fd })
}
pub fn apply_epoll_create(ctx: &mut Fu... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffect<|fim_suffix|>on<EpollEventCtl>,
) -> anyhow::Result<()> {
crate::syscalls::epoll_ctl_internal(ctx, pfd, op, fd, event.as_ref())
.map_err(|err| {
anyhow::format_err!(
"journal restore error: failed to epoll ctl (p... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_advise(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
<|fim_suffix|>fset, len, advice).map_err(|err| {
anyhow::format_err!(
"journal restore error: failed to advise file descriptor (fd={fd}, offset={offset}, len={len},... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_allocate(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
offset: Filesize,
len: Filesize,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
JournalEntry::FileDescriptorAllocateV1 { f... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
use crate::syscalls::flush_captured_handle;
impl JournalEffector {
pub fn save_fd_close(ctx: &mut FunctionEnvMut<'_, WasiEnv>, fd: Fd) -> anyhow::Result<()> {
Self::save_event(ct<|fim_suffix|> if outcome.skipped_preopen {
return Ok(());
}
if !outcom... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_duplicate(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
original_fd: Fd,
copied_fd: Fd,
cloexec: bool,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
JournalEntry::DuplicateFileDescript... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use wasmer_wasix_types::wasi::Ev<|fim_suffix|>(ctx, initial_val, flags, Some(fd))
.map(|r| r.map_err(|err| err.to_string()))
.unwrap_or_else(|err| Err(err.to_string()))
.map_err(|err| {
anyhow::format_err!("journal restore error: failed to create event -... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> ctx: &mut FunctionEnvMut<'_, WasiEnv>,
read_fd: Fd,
write_fd: Fd,
) -> anyhow::Result<()> {
crate::syscalls::fd_pipe_internal(ctx, Some(read_fd), Some(write_fd)).map_err(|err| {
anyhow::format_err!("journal restore error: failed to create pipe - {err}")
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>renumber descriptor (from={}, to={}) - {}",
from,
to,
ret.unwrap_or(Errno::Unknown)
);
}
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_renumber(
ctx: &mut FunctionEnvMut<'_, WasiEnv>... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_seek(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
offset: i64,
whence: Whence,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
JournalEntry::FileDescriptorSeekV1 { fd, offset, w... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_set_fdflags(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
flags: Fdflagsext,
) -><|fim_suffix|>) - {err}"
)
})?;
Ok(())
}
}
<|fim_middle|> anyhow::Result<()> {
Self::save_event(ct... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_set_flags(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
f<|fim_suffix|>{ fd, flags })
}
pub fn apply_fd_set_flags(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
flags: Fdflags,
) -> any... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_set_rights(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
fs_rights_base: Rights,
fs_rights_inheriting: <|fim_suffix|> fs_rights_inheriting,
},
)
}
pub fn apply_fd_set_rights(
... | fim | wasmerio/wasmer | rust |
use super::*;
impl JournalEffector {
pub fn save_fd_set_size(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
st_size: Filesize,
) -> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry::FileDescriptorSetSizeV1 { fd, st_size })
}
pub fn apply_fd_set_size(
ctx... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super:<|fim_suffix|> Ok(())
}
}
<|fim_middle|>:*;
impl JournalEffector {
pub fn save_fd_set_times(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
st_atim: Timestamp,
st_mtim: Timestamp,
fst_flags: Fstflags,
) -> anyhow::Result<()> {
Sel... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_fd_write<M: MemorySize>(
ctx: &FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
mut offset: u64,
written: usize,
iovs: WasmPtr<__wasi_ciovec_t<M>, M>,
iovs_len: M::Offset,
) -> anyhow::Result<()> {
let en... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>d: Fd,
path: String,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
JournalEntry::CreateDirectoryV1 {
fd,
path: path.into(),
},
)
}
pub fn apply_path_create_directory(
ctx: &mut FunctionEnvMu... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_path_link(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
old_fd: Fd,
old_flags: LookupFlags,
old_path: String,
new_fd: Fd,
new_path: String,
) -> anyhow::Result<()> {
Self::save_event(
ct... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> dirfd,
dirflags,
path,
o_flags,
fs_rights_base,
fs_rights_inheriting,
fs_flags,
fd_flags,
Some(fd),
);
match res? {
Ok(fd) => fd,
Err(err) => {
ba... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>us<|fim_suffix|>ils as to why this exists
if fd == VIRTUAL_ROOT_FD {
ctx.data().state.fs.root_fs.remove_dir(Path::new(path))?;
} else {
let base_dir = ctx.data().state.fs.get_fd(fd).map_err(|err| {
anyhow::format_err!(
"journal re... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use crate::{VIRTUAL_ROOT_FD, syscalls::__asyncify_light};
use super::*;
<|fim_suffix|>path: Cow::Owned(new_path),
},
)
}
pub fn apply_path_rename(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
old_fd: Fd,
old_path: &str,
new_fd: Fd,
new_path: ... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>g,
st_atim: Timestamp,
st_mtim: Timestamp,
fst_flags: Fstflags,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
JournalEntry::PathSetTimesV1 {
fd,
flags,
path: path.into(),
st_atim,... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_path_symlink(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
old_path: String,
fd: <|fim_suffix|>_path: &str,
fd: Fd,
new_path: &str,
) -> anyhow::Result<()> {
crate::syscalls::path_symlink_internal(ctx, old_... | fim | wasmerio/wasmer | rust |
use std::path::Path;
use virtual_fs::FileSystem;
use crate::VIRTUAL_ROOT_FD;
use super::*;
impl JournalEffector {
pub fn save_path_unlink(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
path: String,
) -> anyhow::Result<()> {
Self::save_event(
ctx,
Jou... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use virtual_net::IpCidr;
use super::*;
impl JournalEffector {
pub fn save_port_addr_add(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
cidr: IpCidr,
) -> anyhow::Result<()> {
Self::save_<|fim_suffix|>restore error: failed to add address to port file descriptor (cidr={cidr:?}) - ... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_port_addr_clear(ctx: &mut FunctionEnvMut<'_, WasiEnv>) -> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry<|fim_suffix|>ormat_err!("journal restore error: failed to clear port addresses - {err}")
})?;
Ok(())
}
}
<... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>)> {
crate::syscalls::port_addr_remove_internal(ctx, addr)
.map(|r| r.map_err(|err| err.to_string()))
.unwrap_or_else(|err| Err(err.to_string()))
.map_err(|err| {
anyhow::format_err!(
"journal restore error: failed to remove a... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>yhow::format_err!(
"journal restore error: failed to bridge the network file descriptor (network={network}, security={security:?}) - {err}")
})?;
Ok(())
}
}
<|fim_prefix|>use virtual_net::StreamSecurity;
use super::*;
impl JournalEffector {
pub fn save_por... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>rror: failed to acquire DHCP address - {err}")
})?;
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_port_dhcp_acquire(ctx: &mut FunctionEnvMut<'_, WasiEnv>) -> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry::PortDhcpAcquireV1)
}
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>restore error: failed to set gateway address (ip={ip}) - {err}"
)
})?;
Ok(())
}
}
<|fim_prefix|>use std::net::IpAddr;
use super::*;
impl JournalEffector {
pub fn save_port_gateway_set(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
ip: IpAddr,
) ->... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::{net::IpAddr, ti<|fim_suffix|>ort_route_add_internal(
ctx,
cidr,
via_router,
preferred_until,
expires_at,
)
.map(|r| r.map_err(|err| err.to_string()))
.unwrap_or_else(|err| Err(err.to_string()))
.map_err(|... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>string()))
.unwrap_or_else(|err| Err(err.to_string()))
.map_err(|err| {
anyhow::format_err!("journal restore error: failed to clear routing table - {err}")
})?;
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_po... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>})?;
Ok(())
}
}
<|fim_prefix|>use std::net::IpAddr;
use super::*;
impl JournalEffector {
pub fn save_port_route_remove(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
ip: IpAddr,
) -> anyhow::Result<()> {
Self::save_event(ctx, JournalEntry::PortRouteDelV1 { ip })
... | fim | wasmerio/wasmer | rust |
<|fim_suffix|>to_string()))
.map_err(|err| {
anyhow::format_err!("journal restore error: failed to un-bridge network - {err}")
})?;
Ok(())
}
}
<|fim_prefix|>use super::*;
impl JournalEffector {
pub fn save_port_unbridge(ctx: &mut FunctionEnvMut<'_, WasiEnv>) -> a... | fim | wasmerio/wasmer | rust |
<|fim_prefix|>use std::net::SocketAddr;
use wasmer_wasix_types::wasi::{Addressfamily, SockProto, Socktype};
use crate::{
fs::Kind,
net::socket::{InodeSocket, InodeSocketKind, SocketProperties},
};
use super::*;
impl JournalEffector {
pub fn save_sock_accepted(
ctx: &mut FunctionEnvMut<'_, WasiEn... | fim | wasmerio/wasmer | rust |
<|fim_suffix|> "journal restore error: failed to bind socket to address (fd={fd}, addr={addr}) - {err}")
})?;
Ok(())
}
}
<|fim_prefix|>use std::net::SocketAddr;
use super::*;
impl JournalEffector {
pub fn save_sock_bind(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
fd: Fd,
... | fim | wasmerio/wasmer | rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.