Safe Haskell | None |
---|---|
Language | Haskell2010 |
Memfd
Description
"memfd" (memory file descriptor) lets us open pseudo-"files" that are not actually stored in the "real" file system. This feature is only available on Linux.
This module is a small FFI wrapper around the memfd_create
C system call. Some documentation in this package is copied/paraphrased from the Linux Programmer's Manual. Run "man 2 memfd_create" to see the full documentation.
Synopsis
- create :: CreateOptions -> IO Fd
- data CreateOptions = CreateOptions {
- name :: Name
- onExec :: OnExec
- sealing :: Sealing
- fileSystem :: FileSystem
- newtype Name = NameString {
- nameString :: String
- data OnExec
- data Sealing
- data FileSystem
- data HugeTLBOptions
- data HugeTLBSize
Documentation
create :: CreateOptions -> IO Fd Source #
Creates an anonymous file
The file behaves like a regular file, and so can be modified, truncated, memory-mapped, and so on. However, unlike a regular file, it lives in RAM and has a volatile backing storage. Once all references to the file are dropped, it is automatically released.
data CreateOptions Source #
Constructors
CreateOptions | |
Fields
|
The name of an anonymous file
The name is used as a filename and will be displayed as the target of the corresponding symbolic link in the directory /proc/self/fd/
. The displayed name is always prefixed with "memfd:" and serves only for debugging purposes. Names do not affect the behavior of the file descriptor, and as such multiple files can have the same name without any side effects.
Constructors
NameString | |
Fields
|
Constructors
CloseOnExec | The file descriptor will automatically be closed during a successful execve |
RemainOpenOnExec |
Constructors
AllowSealing | File seals can be applied to the file descriptor |
DoNotAllowSealing |
data FileSystem Source #
Constructors
TemporaryFileSystem | |
HugeTLBFileSystem HugeTLBOptions |
data HugeTLBOptions Source #
Constructors
DefaultHugeTLB | |
HugeTLBSize HugeTLBSize |