Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- defaultCreateOptions :: Name -> CreateOptions
- newtype Name = NameString {
- nameString :: String
- data CreateOptions = CreateOptions {
- name :: Name
- onExec :: OnExec
- sealing :: Sealing
- fileSystem :: FileSystem
- data OnExec
- data Sealing
- data FileSystem
- data HugeTLBOptions
- data HugeTLBSize
- supportedHugeTLBSizes :: [HugeTLBSize]
The create action
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.
Basic options
defaultCreateOptions :: Name -> CreateOptions Source #
Default options for create
, corresponding to what you get what you
use the C library and don't set any flags
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.
More options
data CreateOptions Source #
CreateOptions | |
|
Instances
Show CreateOptions Source # | |
Defined in Memfd.CreateOptionsType showsPrec :: Int -> CreateOptions -> ShowS # show :: CreateOptions -> String # showList :: [CreateOptions] -> ShowS # | |
Eq CreateOptions Source # | |
Defined in Memfd.CreateOptionsType (==) :: CreateOptions -> CreateOptions -> Bool # (/=) :: CreateOptions -> CreateOptions -> Bool # | |
Ord CreateOptions Source # | |
Defined in Memfd.CreateOptionsType compare :: CreateOptions -> CreateOptions -> Ordering # (<) :: CreateOptions -> CreateOptions -> Bool # (<=) :: CreateOptions -> CreateOptions -> Bool # (>) :: CreateOptions -> CreateOptions -> Bool # (>=) :: CreateOptions -> CreateOptions -> Bool # max :: CreateOptions -> CreateOptions -> CreateOptions # min :: CreateOptions -> CreateOptions -> CreateOptions # |
CloseOnExec | The file descriptor will automatically be closed during a successful execve |
RemainOpenOnExec |
AllowSealing | File seals can be applied to the file descriptor |
DoNotAllowSealing |
Instances
Bounded Sealing Source # | |
Enum Sealing Source # | |
Show Sealing Source # | |
Eq Sealing Source # | |
Ord Sealing Source # | |
data FileSystem Source #
Instances
Show FileSystem Source # | |
Defined in Memfd.FileSystemType showsPrec :: Int -> FileSystem -> ShowS # show :: FileSystem -> String # showList :: [FileSystem] -> ShowS # | |
Eq FileSystem Source # | |
Defined in Memfd.FileSystemType (==) :: FileSystem -> FileSystem -> Bool # (/=) :: FileSystem -> FileSystem -> Bool # | |
Ord FileSystem Source # | |
Defined in Memfd.FileSystemType compare :: FileSystem -> FileSystem -> Ordering # (<) :: FileSystem -> FileSystem -> Bool # (<=) :: FileSystem -> FileSystem -> Bool # (>) :: FileSystem -> FileSystem -> Bool # (>=) :: FileSystem -> FileSystem -> Bool # max :: FileSystem -> FileSystem -> FileSystem # min :: FileSystem -> FileSystem -> FileSystem # |
HugeTLB
data HugeTLBOptions Source #
Not every HugeTLBSize
may be available on your platform.
If you select an unsupported page size, the system default page size will
be used instead.
See supportedHugeTLBSizes
.
DefaultHugeTLB | Use the system default hugetlb page size |
HugeTLBSize HugeTLBSize | Prefer the given hugetlb page size |
Instances
Show HugeTLBOptions Source # | |
Defined in Memfd.HugeTLBOptionsType showsPrec :: Int -> HugeTLBOptions -> ShowS # show :: HugeTLBOptions -> String # showList :: [HugeTLBOptions] -> ShowS # | |
Eq HugeTLBOptions Source # | |
Defined in Memfd.HugeTLBOptionsType (==) :: HugeTLBOptions -> HugeTLBOptions -> Bool # (/=) :: HugeTLBOptions -> HugeTLBOptions -> Bool # | |
Ord HugeTLBOptions Source # | |
Defined in Memfd.HugeTLBOptionsType compare :: HugeTLBOptions -> HugeTLBOptions -> Ordering # (<) :: HugeTLBOptions -> HugeTLBOptions -> Bool # (<=) :: HugeTLBOptions -> HugeTLBOptions -> Bool # (>) :: HugeTLBOptions -> HugeTLBOptions -> Bool # (>=) :: HugeTLBOptions -> HugeTLBOptions -> Bool # max :: HugeTLBOptions -> HugeTLBOptions -> HugeTLBOptions # min :: HugeTLBOptions -> HugeTLBOptions -> HugeTLBOptions # |
data HugeTLBSize Source #
These sizes may not all be available on your platform.
See supportedHugeTLBSizes
.
HugeTLB_64KB | |
HugeTLB_512KB | |
HugeTLB_1MB | |
HugeTLB_2MB | |
HugeTLB_8MB | |
HugeTLB_16MB | |
HugeTLB_32MB | |
HugeTLB_256MB | |
HugeTLB_512MB | |
HugeTLB_1GB | |
HugeTLB_2GB | |
HugeTLB_16GB |
Instances
supportedHugeTLBSizes :: [HugeTLBSize] Source #
List of hugetlb sizes that are supported by your platform