-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Create new or enter an existing linux namespaces -- -- This library provides bindings to the unshare(2) and -- setns(2) linux system calls. @package linux-namespaces @version 0.1.2.0 -- | This module provides bindings to the unshare(2) and -- setns(2) linux system calls. These functions can be used to -- create new namespaces by detaching the current process from its -- current namespaces, or to move the current process to an already -- existing namespace. Note that linux also provides the -- clone(2) function which can be used to create new namespaces, -- but we do not support this function in this module; the way this -- function works makes it hard to use it from haskell as it interacts -- badly with GHC'c RTS. -- -- Note: Using this module in a program that uses the threaded RTS -- does not make much sense. Namespaces are per process/thread and -- manipulating them in one thread will not affect the namespaces of the -- other threads of the same process. The threaded RTS makes it is hard -- to predict what OS thread will be used to run the haskell threads. -- Therefore, using this module in such applications will result in -- unpredictable behavior. Similarly, using this module in ghci -- is also problematic. module System.Linux.Namespaces -- | Types of namespaces. data Namespace IPC :: Namespace Network :: Namespace Mount :: Namespace PID :: Namespace User :: Namespace UTS :: Namespace -- | Detach the process from one or more namespaces and move it to new -- ones. See the man page of unshare(2) for more details. unshare :: [Namespace] -> IO () -- | Move process to an already existing namespace. See the man page of -- setns(2) for more details. See also enterNamespace for -- a slightly higher level version of this function. setNamespace :: Fd -> Maybe Namespace -> IO () -- | Move process to an already existing namespace. This is a wrapper -- around setNamespace. This function requires /proc to -- be mounted. enterNamespace :: ProcessID -> Namespace -> IO () -- | A unique namespace id. data NamespaceID -- | Retrieve the id of a Namespace. Useful for debugging. This function -- requires /proc to be mounted. getNamespaceID :: Maybe ProcessID -> Namespace -> IO NamespaceID -- | A single user mapping, used with user namespaces. See -- user_namespaces(7) for more details. data UserMapping UserMapping :: UserID -> UserID -> Int -> UserMapping -- | A single group mapping, used with user namespaces. See -- user_namespaces(7) for more details. data GroupMapping GroupMapping :: GroupID -> GroupID -> Int -> GroupMapping -- | Define the user mappings for the specified user namespace. This -- function requires /proc to be mounted. See -- user_namespaces(7) for more details. writeUserMappings :: Maybe ProcessID -> [UserMapping] -> IO () -- | Define the group mappings for the specified user namespace. This -- function requires /proc to be mounted. See -- user_namespaces(7) for more details. writeGroupMappings :: Maybe ProcessID -> [GroupMapping] -> IO () instance Show Namespace instance Read Namespace instance Eq Namespace instance Bounded Namespace instance Enum Namespace instance Eq NamespaceID instance Ord NamespaceID instance Enum NamespaceID instance Integral NamespaceID instance Num NamespaceID instance Real NamespaceID instance Show UserMapping instance Read UserMapping instance Eq UserMapping instance Show GroupMapping instance Read GroupMapping instance Eq GroupMapping instance Read NamespaceID instance Show NamespaceID