-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Open temporary anonymous Linux file handles
--
-- memfd lets us open memory-only files that are not linked into a
-- directory and are not backed by persistent storage. This feature is
-- only available on Linux.
@package memfd
@version 1.0.1.2
-- | 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.
module Memfd
-- | 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.
create :: CreateOptions -> IO Fd
-- | Default options for create, corresponding to what you get what
-- you use the C library and don't set any flags
--
--
defaultCreateOptions :: Name -> CreateOptions
-- | 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.
newtype Name
NameString :: String -> Name
[nameString] :: Name -> String
data CreateOptions
CreateOptions :: Name -> OnExec -> Sealing -> FileSystem -> CreateOptions
[name] :: CreateOptions -> Name
[onExec] :: CreateOptions -> OnExec
[sealing] :: CreateOptions -> Sealing
[fileSystem] :: CreateOptions -> FileSystem
data OnExec
-- | The file descriptor will automatically be closed during a successful
-- execve
CloseOnExec :: OnExec
RemainOpenOnExec :: OnExec
data Sealing
-- | File seals can be applied to the file descriptor
AllowSealing :: Sealing
DoNotAllowSealing :: Sealing
data FileSystem
TemporaryFileSystem :: FileSystem
HugeTLBFileSystem :: HugeTLBOptions -> FileSystem
-- | 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.
data HugeTLBOptions
-- | Use the system default hugetlb page size
DefaultHugeTLB :: HugeTLBOptions
-- | Prefer the given hugetlb page size
HugeTLBSize :: HugeTLBSize -> HugeTLBOptions
-- | These sizes may not all be available on your platform. See
-- supportedHugeTLBSizes.
data HugeTLBSize
HugeTLB_64KB :: HugeTLBSize
HugeTLB_512KB :: HugeTLBSize
HugeTLB_1MB :: HugeTLBSize
HugeTLB_2MB :: HugeTLBSize
HugeTLB_8MB :: HugeTLBSize
HugeTLB_16MB :: HugeTLBSize
HugeTLB_32MB :: HugeTLBSize
HugeTLB_256MB :: HugeTLBSize
HugeTLB_512MB :: HugeTLBSize
HugeTLB_1GB :: HugeTLBSize
HugeTLB_2GB :: HugeTLBSize
HugeTLB_16GB :: HugeTLBSize
-- | List of hugetlb sizes that are supported by your platform
supportedHugeTLBSizes :: [HugeTLBSize]