2008-10-03 17:58:02 +00:00
|
|
|
/*
|
|
|
|
* cgroup.h: Interface to tools for managing cgroups
|
|
|
|
*
|
|
|
|
* Copyright IBM Corp. 2008
|
|
|
|
*
|
|
|
|
* See COPYING.LIB for the License of this software
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Dan Smith <danms@us.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CGROUP_H
|
|
|
|
#define CGROUP_H
|
|
|
|
|
|
|
|
struct virCgroup;
|
|
|
|
typedef struct virCgroup *virCgroupPtr;
|
|
|
|
|
2009-07-22 15:08:04 +00:00
|
|
|
enum {
|
|
|
|
VIR_CGROUP_CONTROLLER_CPU,
|
|
|
|
VIR_CGROUP_CONTROLLER_CPUACCT,
|
|
|
|
VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
|
VIR_CGROUP_CONTROLLER_MEMORY,
|
|
|
|
VIR_CGROUP_CONTROLLER_DEVICES,
|
2009-09-21 14:31:22 +00:00
|
|
|
VIR_CGROUP_CONTROLLER_FREEZER,
|
2009-07-22 15:08:04 +00:00
|
|
|
|
|
|
|
VIR_CGROUP_CONTROLLER_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
VIR_ENUM_DECL(virCgroupController);
|
|
|
|
|
2009-07-10 10:40:04 +00:00
|
|
|
int virCgroupForDriver(const char *name,
|
|
|
|
virCgroupPtr *group,
|
|
|
|
int privileged,
|
|
|
|
int create);
|
2008-10-03 17:58:02 +00:00
|
|
|
|
2009-07-10 10:40:04 +00:00
|
|
|
int virCgroupForDomain(virCgroupPtr driver,
|
|
|
|
const char *name,
|
|
|
|
virCgroupPtr *group,
|
|
|
|
int create);
|
2008-10-03 17:58:02 +00:00
|
|
|
|
|
|
|
int virCgroupAddTask(virCgroupPtr group, pid_t pid);
|
|
|
|
|
|
|
|
int virCgroupSetMemory(virCgroupPtr group, unsigned long kb);
|
|
|
|
|
|
|
|
int virCgroupDenyAllDevices(virCgroupPtr group);
|
|
|
|
|
|
|
|
int virCgroupAllowDevice(virCgroupPtr group,
|
|
|
|
char type,
|
|
|
|
int major,
|
|
|
|
int minor);
|
2008-10-21 16:46:47 +00:00
|
|
|
int virCgroupAllowDeviceMajor(virCgroupPtr group,
|
|
|
|
char type,
|
|
|
|
int major);
|
2009-07-09 13:11:49 +00:00
|
|
|
int virCgroupAllowDevicePath(virCgroupPtr group,
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
int virCgroupDenyDevice(virCgroupPtr group,
|
|
|
|
char type,
|
|
|
|
int major,
|
|
|
|
int minor);
|
|
|
|
int virCgroupDenyDeviceMajor(virCgroupPtr group,
|
|
|
|
char type,
|
|
|
|
int major);
|
|
|
|
int virCgroupDenyDevicePath(virCgroupPtr group,
|
|
|
|
const char *path);
|
2008-10-03 17:58:02 +00:00
|
|
|
|
2009-07-09 13:11:21 +00:00
|
|
|
int virCgroupSetCpuShares(virCgroupPtr group, unsigned long long shares);
|
|
|
|
int virCgroupGetCpuShares(virCgroupPtr group, unsigned long long *shares);
|
2008-10-08 16:28:48 +00:00
|
|
|
|
2009-03-06 14:44:04 +00:00
|
|
|
int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage);
|
|
|
|
|
2009-09-21 14:31:22 +00:00
|
|
|
int virCgroupSetFreezerState(virCgroupPtr group, const char *state);
|
|
|
|
int virCgroupGetFreezerState(virCgroupPtr group, char **state);
|
|
|
|
|
2008-10-03 17:58:02 +00:00
|
|
|
int virCgroupRemove(virCgroupPtr group);
|
|
|
|
|
|
|
|
void virCgroupFree(virCgroupPtr *group);
|
|
|
|
|
|
|
|
#endif /* CGROUP_H */
|