Safe Haskell | None |
---|---|
Language | Haskell2010 |
"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
- defaultCreateOptions :: Name -> CreateOptions
- 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
- supportedHugeTLBSizes :: [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.
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.
data CreateOptions Source #
CreateOptions | |
|
Instances
Eq CreateOptions Source # | |
Defined in CreateOptionsType (==) :: CreateOptions -> CreateOptions -> Bool # (/=) :: CreateOptions -> CreateOptions -> Bool # | |
Ord CreateOptions Source # | |
Defined in 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 # | |
Show CreateOptions Source # | |
Defined in CreateOptionsType showsPrec :: Int -> CreateOptions -> ShowS # show :: CreateOptions -> String # showList :: [CreateOptions] -> ShowS # |
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.
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 # | |
Eq Sealing Source # | |
Ord Sealing Source # | |
Show Sealing Source # | |
data FileSystem Source #
Instances
Eq FileSystem Source # | |
Defined in FileSystemType (==) :: FileSystem -> FileSystem -> Bool # (/=) :: FileSystem -> FileSystem -> Bool # | |
Ord FileSystem Source # | |
Defined in 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 # | |
Show FileSystem Source # | |
Defined in FileSystemType showsPrec :: Int -> FileSystem -> ShowS # show :: FileSystem -> String # showList :: [FileSystem] -> ShowS # |
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
Eq HugeTLBOptions Source # | |
Defined in HugeTLBOptionsType (==) :: HugeTLBOptions -> HugeTLBOptions -> Bool # (/=) :: HugeTLBOptions -> HugeTLBOptions -> Bool # | |
Ord HugeTLBOptions Source # | |
Defined in 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 # | |
Show HugeTLBOptions Source # | |
Defined in HugeTLBOptionsType showsPrec :: Int -> HugeTLBOptions -> ShowS # show :: HugeTLBOptions -> String # showList :: [HugeTLBOptions] -> ShowS # |
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