# Module libvirt-lxc from libvirt-lxc

Provides the interfaces of the libvirt library to handle LXC specific methods

## Table of Contents

### Functions

    int	virDomainLxcEnterCGroup		(virDomainPtr domain,
    					 unsigned int flags)
    int	virDomainLxcEnterNamespace	(virDomainPtr domain,
    					 unsigned int nfdlist,
    					 int * fdlist,
    					 unsigned int * noldfdlist,
    					 int ** oldfdlist,
    					 unsigned int flags)
    int	virDomainLxcEnterSecurityLabel	(virSecurityModelPtr model,
    					 virSecurityLabelPtr label,
    					 virSecurityLabelPtr oldlabel,
    					 unsigned int flags)
    int	virDomainLxcOpenNamespace	(virDomainPtr domain,
    					 int ** fdlist,
    					 unsigned int flags)

## Description

### Functions

### `virDomainLxcEnterCGroup`

    int	virDomainLxcEnterCGroup		(virDomainPtr domain,
    					 unsigned int flags)

This API is LXC specific, so it will only work with hypervisor connections to the LXC driver.

Attaches the process to the control cgroups associated with the container `domain`.

domain
  a domain object
flags
  currently unused, pass 0
Returns
  0 on success, -1 on error

### `virDomainLxcEnterNamespace`

    int	virDomainLxcEnterNamespace	(virDomainPtr domain,
    					 unsigned int nfdlist,
    					 int * fdlist,
    					 unsigned int * noldfdlist,
    					 int ** oldfdlist,
    					 unsigned int flags)

This API is LXC specific, so it will only work with hypervisor connections to the LXC driver.

Attaches the process to the namespaces associated with the FDs in `fdlist`

If `oldfdlist` is non-NULL, it will be populated with file descriptors representing the old namespace. This allows the caller to switch back to its current namespace later

domain
  a domain object
nfdlist
  number of FDs in `fdlist`
fdlist
  list of namespace file descriptors
noldfdlist
  filled with number of old FDs
oldfdlist
  pointer to hold list of old namespace file descriptors
flags
  currently unused, pass 0
Returns
  0 on success, -1 on error

### `virDomainLxcEnterSecurityLabel`

    int	virDomainLxcEnterSecurityLabel	(virSecurityModelPtr model,
    					 virSecurityLabelPtr label,
    					 virSecurityLabelPtr oldlabel,
    					 unsigned int flags)

This API is LXC specific, so it will only work with hypervisor connections to the LXC driver.

Attaches the process to the security label specified by `label`. `label` is interpreted relative to `model` Depending on the security driver, this may not take effect until the next call to exec().

If `oldlabel` is not NULL, it will be filled with info about the current security label. This may let the process be moved back to the previous label if no exec() has yet been performed.

model
  the security model to set
label
  the security label to apply
oldlabel
  filled with old security label
flags
  currently unused, pass 0
Returns
  0 on success, -1 on error

### `virDomainLxcOpenNamespace`

    int	virDomainLxcOpenNamespace	(virDomainPtr domain,
    					 int ** fdlist,
    					 unsigned int flags)

This API is LXC specific, so it will only work with hypervisor connections to the LXC driver.

Open the namespaces associated with the container `domain`. The `fdlist` array will be allocated to a suitable size, and filled with file descriptors for the namespaces. It is the caller's responsibility to close the file descriptors

The returned file descriptors are intended to be used with the setns() system call.

domain
  a domain object
fdlist
  pointer to an array to be filled with FDs
flags
  currently unused, pass 0
Returns
  the number of opened file descriptors, or -1 on error

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
domain | open-namespace | -