Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lxcpp::Subsystem Class Reference

#include <subsystem.hpp>

Public Member Functions

 Subsystem (const std::string &name)
 Define subsystem object. More...
 
const std::string & getName () const
 
bool isAvailable () const
 Check if named subsystem is supported by the kernel. More...
 
bool isAttached () const
 Check if named subsystem is mounted (added to hierarchy) More...
 
const std::string & getMountPoint () const
 Get mount point of this subsystem. More...
 

Static Public Member Functions

static void attach (const std::string &path, const std::vector< std::string > &subs)
 Attach subsystem hierarchy to filesystem Equivalent of: mount -t cgroup -o subs(coma-sep) cgroup path Note: cgroup root must be already mounted (eg. More...
 
static void detach (const std::string &path)
 Detach subsstem hierarchy from filesystem Equivalent of: umount path. More...
 
static std::vector< std::string > availableSubsystems ()
 Get list of available subsytems. More...
 
static std::vector< std::string > getCGroups (pid_t pid)
 Get control groups list for a process (in format subsys_name:cgroup_name) eg. More...
 

Private Attributes

std::string mName
 
std::string mPath
 

Constructor & Destructor Documentation

lxcpp::Subsystem::Subsystem ( const std::string &  name)

Define subsystem object.

Member Function Documentation

void lxcpp::Subsystem::attach ( const std::string &  path,
const std::vector< std::string > &  subs 
)
static

Attach subsystem hierarchy to filesystem Equivalent of: mount -t cgroup -o subs(coma-sep) cgroup path Note: cgroup root must be already mounted (eg.

/sys/fs/cgroup) as tmpfs

std::vector< std::string > lxcpp::Subsystem::availableSubsystems ( )
static

Get list of available subsytems.

Returns
parse contents of /proc/cgroups
void lxcpp::Subsystem::detach ( const std::string &  path)
static

Detach subsstem hierarchy from filesystem Equivalent of: umount path.

std::vector< std::string > lxcpp::Subsystem::getCGroups ( pid_t  pid)
static

Get control groups list for a process (in format subsys_name:cgroup_name) eg.

"cpu:/user/test_user" Equivalent of: cat /proc/pid/cgroup

const std::string & lxcpp::Subsystem::getMountPoint ( ) const

Get mount point of this subsystem.

Returns
subsystem mount point (as read from /proc/mounts)
const std::string& lxcpp::Subsystem::getName ( ) const
inline
bool lxcpp::Subsystem::isAttached ( ) const

Check if named subsystem is mounted (added to hierarchy)

Returns
true if subsystem has a mount point (as read from /proc/mounts)
bool lxcpp::Subsystem::isAvailable ( ) const

Check if named subsystem is supported by the kernel.

Returns
true if subsystem is listed in /proc/cgroups

Member Data Documentation

std::string lxcpp::Subsystem::mName
private
std::string lxcpp::Subsystem::mPath
private

The documentation for this class was generated from the following files: