1use crate::fd::OwnedFd;
2use crate::{backend, io, path};
3
4pub use backend::fs::types::MemfdFlags;
5
6/// `memfd_create(path, flags)`
7///
8/// # References
9///  - [Linux]
10///
11/// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
12#[inline]
13pub fn memfd_create<P: path::Arg>(path: P, flags: MemfdFlags) -> io::Result<OwnedFd> {
14    path.into_with_c_str(|path| backend::fs::syscalls::memfd_create(path, flags))
15}
16