Namespaces | |
api | |
provision | |
Typedefs | |
typedef std::vector< Attr > | Attrs |
typedef std::vector < provision::File > | FileVector |
typedef std::vector < provision::Mount > | MountVector |
typedef std::vector < provision::Link > | LinkVector |
Enumerations | |
enum | InetAddrType { InetAddrType::IPV4, InetAddrType::IPV6 } |
Suported address types. More... | |
enum | RoutingTable { RoutingTable::UNSPEC, RoutingTable::COMPAT, RoutingTable::DEFAULT, RoutingTable::MAIN, RoutingTable::LOCAL, RoutingTable::USER } |
enum | AttrName { AttrName::MAC, AttrName::FLAGS, AttrName::CHANGE, AttrName::TYPE, AttrName::MTU, AttrName::LINK, AttrName::TXQLEN } |
enum | InterfaceType : int { InterfaceType::VETH, InterfaceType::BRIDGE, InterfaceType::MACVLAN } |
Created interface type. More... | |
enum | MacVLanMode { MacVLanMode::PRIVATE, MacVLanMode::VEPA, MacVLanMode::BRIDGE, MacVLanMode::PASSTHRU } |
Suported MacVLan modes. More... | |
enum | NetStatus { NetStatus::DOWN, NetStatus::UP } |
Functions | |
void | dropCapsFromBoundingExcept (unsigned long long mask) |
void | setgroups (const std::vector< gid_t > &gids) |
void | setregid (const gid_t rgid, const gid_t egid) |
void | setreuid (const uid_t ruid, const uid_t euid) |
pid_t | setsid () |
void | clearenvExcept (const std::vector< std::string > &names) |
Clears the env variables except those listed. More... | |
void | clearenv () |
std::string | getenv (const std::string &name) |
void | setenv (const std::string &name, const std::string &value) |
void | setenv (const std::vector< std::pair< std::string, std::string >> &variables) |
void | mount (const std::string &source, const std::string &target, const std::string &filesystemtype, unsigned long mountflags, const std::string &data) |
void | umount (const std::string &path, const int flags) |
bool | isMountPoint (const std::string &path) |
bool | isMountPointShared (const std::string &path) |
Detect whether path is mounted as MS_SHARED. More... | |
void | fchdir (int fd) |
void | chdir (const std::string &path) |
Container * | createContainer (const std::string &name, const std::string &rootPath, const std::string &workPath) |
std::string | nsToString (const int ns) |
std::string | getNsPath (const pid_t pid) |
std::string | getPath (const pid_t pid, const int ns) |
std::string | toString (const in_addr &addr) |
std::string | toString (const in6_addr &addr) |
void | fromString (const std::string &s, in_addr &addr) |
void | fromString (const std::string &s, in6_addr &addr) |
std::string | toString (const InetAddr &a) |
static rt_class_t | getRoutingTableClass (const RoutingTable rt) |
static RoutingTable | getRoutingTable (unsigned tbl) |
static std::vector< Route > | getRoutesImpl (pid_t pid, rt_class_t tbl, const std::string &ifname, int family) |
static bool | operator== (const in_addr &a, const in_addr &b) |
static bool | operator== (const in6_addr &a, const in6_addr &b) |
static bool | operator== (const InetAddr &a, const InetAddr &b) |
std::string | toString (const RoutingTable rt) |
std::ostream & | operator<< (std::ostream &os, const AttrName &a) |
pid_t | fork () |
pid_t | clone (int(*function)(void *), void *args, const int flags) |
void | setns (const pid_t pid, int requestedNamespaces) |
int | waitpid (const pid_t pid) |
void | unshare (const int ns) |
void | execve (const std::vector< std::string > &argv) |
int | nullStdFDs () |
Nullifies all standard file descriptors (stdin, stdout, stderr) replacing them with file descriptor to /dev/null. More... | |
bool | isatty (int fd) |
Checks if a file descriptor is a terminal. More... | |
void | tcgetattr (const int fd, struct termios *termios_p) |
Get terminal attributes. More... | |
void | tcsetattr (const int fd, const int optional_actions, const struct termios *termios_p) |
Set terminal attributes. More... | |
void | setupIOControlTTY (const int ttyFD) |
Setups the passed fd as a new control and IO (in, out, err) terminal. More... | |
std::pair< int, std::string > | openPty (bool rawMode) |
This function creates a new pair of virtual character devices using a pseudtoreminal interface. More... | |
void | setProcTitle (const std::string &title) |
Changes the tittle of a current process title (e.g. More... | |
void | setupMountPoints () |
bool | setupControlTTY (const int ttyFD) |
typedef std::vector<Attr> lxcpp::Attrs |
typedef std::vector<provision::File> lxcpp::FileVector |
typedef std::vector<provision::Link> lxcpp::LinkVector |
typedef std::vector<provision::Mount> lxcpp::MountVector |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
void lxcpp::chdir | ( | const std::string & | path | ) |
void lxcpp::clearenv | ( | ) |
void lxcpp::clearenvExcept | ( | const std::vector< std::string > & | names | ) |
Clears the env variables except those listed.
There's a race condition - a moment when listed variables aren't set Function should be used only for setting up a new process.
names | names of the variables to keep |
pid_t lxcpp::clone | ( | int(*)(void *) | function, |
void * | args, | ||
const int | flags | ||
) |
Container * lxcpp::createContainer | ( | const std::string & | name, |
const std::string & | rootPath, | ||
const std::string & | workPath | ||
) |
void lxcpp::dropCapsFromBoundingExcept | ( | unsigned long long | mask | ) |
void lxcpp::execve | ( | const std::vector< std::string > & | argv | ) |
void lxcpp::fchdir | ( | int | fd | ) |
pid_t lxcpp::fork | ( | ) |
void lxcpp::fromString | ( | const std::string & | s, |
in_addr & | addr | ||
) |
void lxcpp::fromString | ( | const std::string & | s, |
in6_addr & | addr | ||
) |
std::string lxcpp::getenv | ( | const std::string & | name | ) |
std::string lxcpp::getNsPath | ( | const pid_t | pid | ) |
std::string lxcpp::getPath | ( | const pid_t | pid, |
const int | ns | ||
) |
|
static |
|
static |
|
static |
bool lxcpp::isatty | ( | int | fd | ) |
Checks if a file descriptor is a terminal.
bool lxcpp::isMountPoint | ( | const std::string & | path | ) |
bool lxcpp::isMountPointShared | ( | const std::string & | path | ) |
Detect whether path is mounted as MS_SHARED.
Parses /proc/self/mountinfo
path | mount point |
void lxcpp::mount | ( | const std::string & | source, |
const std::string & | target, | ||
const std::string & | filesystemtype, | ||
unsigned long | mountflags, | ||
const std::string & | data | ||
) |
std::string lxcpp::nsToString | ( | const int | ns | ) |
int lxcpp::nullStdFDs | ( | ) |
Nullifies all standard file descriptors (stdin, stdout, stderr) replacing them with file descriptor to /dev/null.
Used to as a part of a process to detach a process from a control terminal.
This function has to be safe in regard to signal(7)
std::pair< int, std::string > lxcpp::openPty | ( | bool | rawMode | ) |
This function creates a new pair of virtual character devices using a pseudtoreminal interface.
It also configures as much as it can so the devices are immediately usable.
rawMode | Whether to set the terminal in the raw mode (termios(2)) |
|
inline |
|
inlinestatic |
|
inlinestatic |
void lxcpp::setenv | ( | const std::string & | name, |
const std::string & | value | ||
) |
void lxcpp::setenv | ( | const std::vector< std::pair< std::string, std::string >> & | variables | ) |
void lxcpp::setgroups | ( | const std::vector< gid_t > & | gids | ) |
void lxcpp::setns | ( | const pid_t | pid, |
int | requestedNamespaces | ||
) |
void lxcpp::setProcTitle | ( | const std::string & | title | ) |
Changes the tittle of a current process title (e.g.
visible in ps tool).
title | A new tittle to be set |
void lxcpp::setregid | ( | const gid_t | rgid, |
const gid_t | egid | ||
) |
void lxcpp::setreuid | ( | const uid_t | ruid, |
const uid_t | euid | ||
) |
pid_t lxcpp::setsid | ( | ) |
bool lxcpp::setupControlTTY | ( | const int | ttyFD | ) |
void lxcpp::setupIOControlTTY | ( | const int | ttyFD | ) |
Setups the passed fd as a new control and IO (in, out, err) terminal.
void lxcpp::setupMountPoints | ( | ) |
void lxcpp::tcgetattr | ( | const int | fd, |
struct termios * | termios_p | ||
) |
Get terminal attributes.
void lxcpp::tcsetattr | ( | const int | fd, |
const int | optional_actions, | ||
const struct termios * | termios_p | ||
) |
Set terminal attributes.
|
inline |
std::string lxcpp::toString | ( | const in_addr & | addr | ) |
std::string lxcpp::toString | ( | const in6_addr & | addr | ) |
std::string lxcpp::toString | ( | const InetAddr & | a | ) |
void lxcpp::umount | ( | const std::string & | path, |
const int | flags | ||
) |
void lxcpp::unshare | ( | const int | ns | ) |
int lxcpp::waitpid | ( | const pid_t | pid | ) |