lxc-0.2: High level Haskell bindings to LXC (Linux containers).

Copyright(c) Nickolay Kudasov 2014
LicenseBSD-style (see the file LICENSE)
Maintainernickolay.kudasov@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.LXC.Internal.AttachOptions

Description

Internal module to support options and structures to run commands inside LXC containers. Normally you should import System.LXC module only.

Synopsis

Documentation

newtype AttachExecFn Source

exec function to use for attach.

See attachRunCommand and attachRunShell.

data AttachEnvPolicy Source

LXC environment policy.

Constructors

AttachKeepEnv

Retain the environment.

AttachClearEnv

Clear the environment.

fromAttachEnvPolicy :: Num a => AttachEnvPolicy -> a Source

Convert AttachEnvPolicy to internal representation.

data AttachFlag Source

Flags for attach.

Constructors

AttachMoveToCGroup

Move to cgroup. On by default.

AttachDropCapabilities

Drop capabilities. On by default.

AttachSetPersonality

Set personality. On by default

AttachLSMExec

Execute under a Linux Security Module. On by default.

AttachRemountProcSys

Remount /proc filesystem. Off by default.

AttachLSMNow

FIXME: unknown. Off by default.

AttachDefault

Mask of flags to apply by default.

AttachLSM

All Linux Security Module flags.

fromAttachFlag :: Num a => AttachFlag -> a Source

Convert AttachFlag to bit flag.

data AttachOptions Source

LXC attach options for attach.

  • NOTE: for stdin, stdout and stderr descriptors dup2() will be used before calling exec_function, (assuming not 0, 1 and 2 are specified) and the original fds are closed before passing control over. Any O_CLOEXEC flag will be removed after that.

Constructors

AttachOptions 

Fields

attachFlags :: [AttachFlag]

Any combination of AttachFlag flags.

attachNamespaces :: Int

The namespaces to attach to (CLONE_NEW... flags). | Initial personality (Nothing to autodetect).

  • This may be ignored if lxc is compiled without personality support
attachPersonality :: Maybe Int64
 
attachInitialCWD :: Maybe FilePath

Inital current directory, Nothing to use cwd.

If the current directory does not exist in the container, the root directory will be used instead because of kernel defaults.

attachUID :: UserID

The user-id to run as.

  • NOTE: Set to -1 for default behaviour (init uid for userns containers or 0 (super-user) if detection fails).
attachGID :: GroupID

The group-id to run as.

  • NOTE: Set to -1 for default behaviour (init gid for userns containers or 0 (super-user) if detection fails).
attachEnvPolicy :: AttachEnvPolicy

Environment policy.

attachExtraEnvVars :: [String]

Extra environment variables to set in the container environment.

attachExtraKeepEnv :: [String]

Names of environment variables in existing environment to retain in container environment.

attachStdinFD :: Fd

stdin file descriptor.

attachStdoutFD :: Fd

stdout file descriptor.

attachStderrFD :: Fd

stderr file descriptor.

Instances

defaultAttachOptions :: AttachOptions Source

Default attach options to use.

data AttachCommand Source

Representation of a command to run in a container.

Constructors

AttachCommand 

Fields

attachProgram :: String

The program to run (passed to execvp).

attachArgv :: [String]

The argv of that program, including the program itself as the first element.

withC'lxc_attach_options_t :: AttachOptions -> (Ptr C'lxc_attach_options_t -> IO a) -> IO a Source

Allocate lxc_attach_options_t structure in a temporary storage.

withC'lxc_attach_command_t :: AttachCommand -> (Ptr C'lxc_attach_command_t -> IO a) -> IO a Source

Allocate lxc_attach_command_t structure in a temporary storage.

attachRunCommand :: AttachExecFn Source

Run a command in the container.

attachRunShell :: AttachExecFn Source

Run a shell command in the container.