Debian Codegraph @

/

debian rust-memfd 0.6.5-1debian librust-memfd-dev debian librust-memfd+default-dev debian librust-memfd-0-dev debian librust-memfd-0+default-dev debian librust-memfd-0.6-dev debian librust-memfd-0.6+default-dev debian librust-memfd-0.6.5-dev debian librust-memfd-0.6.5+default-dev cargo memfd 0.6.5 debianjsonmakefilemarkdownrustrust-c-abishelltomlyaml 24 files · 185 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • cargo, debhelper-compat, librust-rustix-1+default-dev, librust-rustix-1+fs-dev, libstd-rust-dev, rustc
README (full)

memfd

crates.io Documentation

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.

Example

extern crate memfd;
use memfd::errors::Result;

fn new_sized_memfd() -> Result<memfd::Memfd> {
    // 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.
    let mut seals = memfd::SealsHashSet::new();
    seals.insert(memfd::FileSeal::SealShrink);
    seals.insert(memfd::FileSeal::SealGrow);
    mfd.add_seals(&seals)?;

    // Prevent further sealing changes.
    mfd.add_seal(memfd::FileSeal::SealSeal);

    Ok(mfd)
}

Some more examples are available under examples.

License

Licensed under either of

at your option.

dir .github/
dir debian/
dir examples/
dir src/
dir tests/
file .cargo_vcs_info.json
file Cargo.lock
file Cargo.toml
file Cargo.toml.orig
file LICENSE-APACHE
file LICENSE-MIT
file README.md