Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucab/memfd-rs
A pure-Rust library to work with Linux memfd
https://github.com/lucab/memfd-rs
Last synced: 2 days ago
JSON representation
A pure-Rust library to work with Linux memfd
- Host: GitHub
- URL: https://github.com/lucab/memfd-rs
- Owner: lucab
- License: apache-2.0
- Created: 2018-08-21T19:56:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-18T16:14:43.000Z (about 1 year ago)
- Last Synced: 2024-04-25T07:02:21.149Z (7 months ago)
- Language: Rust
- Homepage: https://crates.io/crates/memfd
- Size: 93.8 KB
- Stars: 30
- Watchers: 5
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# memfd
[![Build Status](https://travis-ci.org/lucab/memfd-rs.svg?branch=master)](https://travis-ci.org/lucab/memfd-rs)
[![crates.io](https://img.shields.io/crates/v/memfd.svg)](https://crates.io/crates/memfd)
[![Documentation](https://docs.rs/memfd/badge.svg)](https://docs.rs/memfd)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
```rust
extern crate memfd;
use memfd::errors::Result;fn new_sized_memfd() -> Result {
// 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](examples).
## License
Licensed under either of
* MIT license -
* Apache License, Version 2.0 -at your option.