Sha256: 5918764af6b11d3e2f3f3b3b6f6149b7551b91d09aa2df00e8ab8a8fc4a2cb94

Contents?: true

Size: 1.42 KB

Versions: 36

Compression:

Stored size: 1.42 KB

Contents

//! A pure-Rust library to work with Linux memfd and seals.
//!
//! It provides support for creating `memfd` objects on Linux
//! and handling seals on them. This was first introduced in
//! Linux kernel 3.17.
//! For further details, see `memfd_create(2)` manpage.
//!
//! ```rust
//! use memfd;
//!
//! fn new_sized_memfd() -> Result<memfd::Memfd, Box<dyn std::error::Error>> {
//!     // Create a sealable memfd.
//!     let opts = memfd::MemfdOptions::default().allow_sealing(true);
//!     let mfd = opts.create("sized-1K")?;
//!
//!     // Resize to 1024B.
//!     mfd.as_file().set_len(1024)?;
//!
//!     // Add seals to prevent further resizing.
//!     mfd.add_seals(&[
//!         memfd::FileSeal::SealShrink,
//!         memfd::FileSeal::SealGrow
//!     ])?;
//!
//!     // Prevent further sealing changes.
//!     mfd.add_seal(memfd::FileSeal::SealSeal)?;
//!
//!     Ok(mfd)
//! }
//! ```
#![deny(
    missing_docs,
    broken_intra_doc_links,
    clippy::all,
    unreachable_pub,
    unused
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, doc(cfg(any(target_os = "android", target_os = "linux"))))]
// No-op crate on platforms that do not support memfd_create, instead of failing to link, or at
// runtime.
#![cfg(any(target_os = "android", target_os = "linux"))]

mod errors;
mod memfd;
mod sealing;

pub use crate::{
    errors::Error,
    memfd::{HugetlbSize, Memfd, MemfdOptions},
    sealing::{FileSeal, SealsHashSet},
};

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
wasmtime-27.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-26.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-25.0.2 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-25.0.1 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-25.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-24.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-23.0.2 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-22.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-21.0.1 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-20.0.2 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-20.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-18.0.3 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-17.0.1 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-17.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-16.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-15.0.1 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-15.0.0 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-14.0.4 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-14.0.3 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs
wasmtime-14.0.1 ./ext/cargo-vendor/memfd-0.6.4/src/lib.rs