| 1 | use crate::fd::OwnedFd; |
| 2 | use crate::{backend, io, path}; |
| 3 | use backend::fs::types::MemfdFlags; |
| 4 | |
| 5 | /// `memfd_create(name, flags)` |
| 6 | /// |
| 7 | /// # References |
| 8 | /// - [Linux] |
| 9 | /// - [glibc] |
| 10 | /// - [FreeBSD] |
| 11 | /// |
| 12 | /// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html |
| 13 | /// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Memory_002dmapped-I_002fO.html#index-memfd_005fcreate |
| 14 | /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?memfd_create |
| 15 | #[inline ] |
| 16 | pub fn memfd_create<P: path::Arg>(name: P, flags: MemfdFlags) -> io::Result<OwnedFd> { |
| 17 | name.into_with_c_str(|name: &CStr| backend::fs::syscalls::memfd_create(name, flags)) |
| 18 | } |
| 19 | |