]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/cgroups/cgroup.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <daniel.lezcano at free.fr>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef __LXC_CGROUP_H
25 #define __LXC_CGROUP_H
29 #include <sys/types.h>
36 CGROUP_LAYOUT_UNKNOWN
= -1,
37 CGROUP_LAYOUT_LEGACY
= 0,
38 CGROUP_LAYOUT_HYBRID
= 1,
39 CGROUP_LAYOUT_UNIFIED
= 2,
51 void *(*init
)(struct lxc_handler
*handler
);
52 void (*destroy
)(void *hdata
, struct lxc_conf
*conf
);
53 bool (*create
)(void *hdata
);
54 bool (*enter
)(void *hdata
, pid_t pid
);
55 bool (*create_legacy
)(void *hdata
, pid_t pid
);
56 const char *(*get_cgroup
)(void *hdata
, const char *subsystem
);
58 int (*num_hierarchies
)();
59 bool (*get_hierarchies
)(int n
, char ***out
);
60 int (*set
)(const char *filename
, const char *value
, const char *name
, const char *lxcpath
);
61 int (*get
)(const char *filename
, char *value
, size_t len
, const char *name
, const char *lxcpath
);
62 bool (*unfreeze
)(void *hdata
);
63 bool (*setup_limits
)(void *hdata
, struct lxc_conf
*conf
, bool with_devices
);
64 bool (*chown
)(void *hdata
, struct lxc_conf
*conf
);
65 bool (*attach
)(const char *name
, const char *lxcpath
, pid_t pid
);
66 bool (*mount_cgroup
)(void *hdata
, const char *root
, int type
);
67 int (*nrtasks
)(void *hdata
);
68 void (*disconnect
)(void);
69 cgroup_driver_t driver
;
72 extern bool cgroup_attach(const char *name
, const char *lxcpath
, pid_t pid
);
73 extern bool cgroup_mount(const char *root
, struct lxc_handler
*handler
, int type
);
74 extern void cgroup_destroy(struct lxc_handler
*handler
);
75 extern bool cgroup_init(struct lxc_handler
*handler
);
76 extern bool cgroup_create(struct lxc_handler
*handler
);
77 extern bool cgroup_setup_limits(struct lxc_handler
*handler
, bool with_devices
);
78 extern bool cgroup_chown(struct lxc_handler
*handler
);
79 extern bool cgroup_enter(struct lxc_handler
*handler
);
80 extern void cgroup_cleanup(struct lxc_handler
*handler
);
81 extern bool cgroup_create_legacy(struct lxc_handler
*handler
);
82 extern int cgroup_nrtasks(struct lxc_handler
*handler
);
83 extern const char *cgroup_get_cgroup(struct lxc_handler
*handler
,
84 const char *subsystem
);
85 extern bool cgroup_escape();
86 extern int cgroup_num_hierarchies();
87 extern bool cgroup_get_hierarchies(int i
, char ***out
);
88 extern bool cgroup_unfreeze(struct lxc_handler
*handler
);
89 extern void cgroup_disconnect(void);
90 extern cgroup_driver_t
cgroup_driver(void);
92 extern void prune_init_scope(char *cg
);
93 extern bool is_crucial_cgroup_subsystem(const char *s
);