-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Work with linux namespaces: create new or enter existing ones -- -- This library provides bindings to the unshare(2) and -- setns(2) linux system calls. @package linux-namespaces @version 0.2.0.0 -- | This module provides bindings to the unshare(2) and -- setns(2) linux system calls. The former can be used to create -- new namespaces and move the calling process to them, whereas the -- latter can be used to move the calling process to an already existing -- namespace created by some other process. -- -- Note that linux provides another function related to namespaces which -- is not supported by this module: clone(2). This function -- works like fork(2) and is used to create new namespaces (like -- unshare(2)). Unfortunately, like fork(2), it does -- not interact well with GHC'c RTS which is why it has been omitted from -- this module. -- -- 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 problematic too. module System.Linux.Namespaces -- | Types of namespaces. data Namespace IPC :: Namespace Network :: Namespace Mount :: Namespace PID :: Namespace User :: Namespace UTS :: Namespace CGroup :: Namespace Time :: 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 the 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 the 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] -> Bool -> IO () -- | The virtualized clock whose offset is set time_namespaces(7) -- for more details. data Clock Monotonic :: Clock Boottime :: Clock -- | Set the offset for a virtualized clock. This can only be called before -- any process has been created in the time namespace. This function -- requires /proc to be mounted. See time_namespaces(7) -- for more details. setClockOffset :: Clock -> EpochTime -> CLong -> IO () instance GHC.Enum.Enum System.Linux.Namespaces.Namespace instance GHC.Enum.Bounded System.Linux.Namespaces.Namespace instance GHC.Classes.Eq System.Linux.Namespaces.Namespace instance GHC.Read.Read System.Linux.Namespaces.Namespace instance GHC.Show.Show System.Linux.Namespaces.Namespace instance GHC.Real.Real System.Linux.Namespaces.NamespaceID instance GHC.Num.Num System.Linux.Namespaces.NamespaceID instance GHC.Real.Integral System.Linux.Namespaces.NamespaceID instance GHC.Enum.Enum System.Linux.Namespaces.NamespaceID instance GHC.Classes.Ord System.Linux.Namespaces.NamespaceID instance GHC.Classes.Eq System.Linux.Namespaces.NamespaceID instance GHC.Classes.Eq System.Linux.Namespaces.UserMapping instance GHC.Read.Read System.Linux.Namespaces.UserMapping instance GHC.Show.Show System.Linux.Namespaces.UserMapping instance GHC.Classes.Eq System.Linux.Namespaces.GroupMapping instance GHC.Read.Read System.Linux.Namespaces.GroupMapping instance GHC.Show.Show System.Linux.Namespaces.GroupMapping instance GHC.Classes.Eq System.Linux.Namespaces.Clock instance GHC.Read.Read System.Linux.Namespaces.Clock instance GHC.Show.Show System.Linux.Namespaces.Clock instance GHC.Show.Show System.Linux.Namespaces.NamespaceID instance GHC.Read.Read System.Linux.Namespaces.NamespaceID