Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cgroups.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License version 2.1 as published by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 
24 #ifndef LXCPP_COMMANDS_CGROUPS_HPP
25 #define LXCPP_COMMANDS_CGROUPS_HPP
26 
29 
30 
31 namespace lxcpp {
32 
33 class CGroupMakeAll final: Command {
34 public:
39  mCgroups(cfg)
40  {
41  }
42 
43  void execute();
44 
45 private:
47 };
48 
49 class SubsystemMake final: Command {
50 public:
55  mSubsys(cfg)
56  {
57  }
58 
59  void execute();
60 
61 private:
63 };
64 
65 class CGroupMake final: Command {
66 public:
70  CGroupMake(const CGroupConfig& cfg) :
71  mCgroup(cfg)
72  {
73  }
74 
75  void execute();
76 
77 private:
79 };
80 
82 public:
86  CGroupAssignPidAll(const CGroupsConfig& cfg, pid_t pid) :
87  mCgroups(cfg),
88  mPid(pid)
89  {
90  }
91 
92  void execute();
93 
94 private:
96  pid_t mPid;
97 };
98 
99 class CGroupAssignPid final: Command {
100 public:
104  CGroupAssignPid(const std::string& subsys, const std::string& cgroup, pid_t pid) :
105  mSubsysName(subsys),
106  mCgroupName(cgroup),
107  mPid(pid)
108  {
109  }
110 
111  void execute();
112 
113 private:
114  std::string mSubsysName;
115  std::string mCgroupName;
116  pid_t mPid;
117 };
118 
119 } // namespace lxcpp
120 
121 #endif //LXCPP_COMMANDS_CGROUPS_HPP
const CGroupsConfig & mCgroups
Definition: cgroups.hpp:46
void execute()
Definition: cgroups.cpp:31
CGroupMake(const CGroupConfig &cfg)
Creates and configures cgroup.
Definition: cgroups.hpp:70
void execute()
Definition: cgroups.cpp:72
Definition: cgroup-config.hpp:71
pid_t mPid
Definition: cgroups.hpp:96
Definition: cgroups.hpp:65
Definition: cgroups.hpp:81
const CGroupConfig & mCgroup
Definition: cgroups.hpp:78
std::string mSubsysName
Definition: cgroups.hpp:114
void execute()
Definition: cgroups.cpp:80
void execute()
Definition: cgroups.cpp:42
pid_t mPid
Definition: cgroups.hpp:116
CGroupMakeAll(const CGroupsConfig &cfg)
Creates and configures cgroups.
Definition: cgroups.hpp:38
Command interface definition.
CGroupAssignPidAll(const CGroupsConfig &cfg, pid_t pid)
Assign pid to all configured cgroups.
Definition: cgroups.hpp:86
Definition: cgroups.hpp:33
void execute()
Definition: cgroups.cpp:55
Definition: command.hpp:29
Definition: cgroup-config.hpp:34
Control-groups configuration.
std::string mCgroupName
Definition: cgroups.hpp:115
const SubsystemConfig & mSubsys
Definition: cgroups.hpp:62
SubsystemMake(const SubsystemConfig &cfg)
Creates and configures cgroup subsystem.
Definition: cgroups.hpp:54
const CGroupsConfig & mCgroups
Definition: cgroups.hpp:95
Definition: cgroups.hpp:99
Definition: cgroups.hpp:49
CGroupAssignPid(const std::string &subsys, const std::string &cgroup, pid_t pid)
Assign pid to existing group.
Definition: cgroups.hpp:104
Definition: cgroup-config.hpp:56