]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/cgroup.h
use same ifndef/define format for all headers
[mirror_lxc.git] / src / lxc / cgroup.h
1 /*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 *
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.
13 *
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.
18 *
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
22 */
23
24 #ifndef __LXC_CGROUP_H
25 #define __LXC_CGROUP_H
26
27 #include <stdbool.h>
28 #include <stddef.h>
29 #include <sys/types.h>
30
31 struct lxc_handler;
32 struct lxc_conf;
33 struct lxc_list;
34
35 struct cgroup_ops {
36 const char *name;
37
38 void *(*init)(const char *name);
39 void (*destroy)(void *hdata);
40 bool (*create)(void *hdata);
41 bool (*enter)(void *hdata, pid_t pid);
42 bool (*create_legacy)(void *hdata, pid_t pid);
43 const char *(*get_cgroup)(void *hdata, const char *subsystem);
44 int (*set)(const char *filename, const char *value, const char *name, const char *lxcpath);
45 int (*get)(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
46 bool (*unfreeze)(void *hdata);
47 bool (*setup_limits)(void *hdata, struct lxc_list *cgroup_conf, bool with_devices);
48 bool (*chown)(void *hdata, struct lxc_conf *conf);
49 bool (*attach)(const char *name, const char *lxcpath, pid_t pid);
50 bool (*mount_cgroup)(void *hdata, const char *root, int type);
51 int (*nrtasks)(void *hdata);
52 void (*disconnect)(void);
53 };
54
55 extern bool cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
56 extern bool cgroup_mount(const char *root, struct lxc_handler *handler, int type);
57 extern void cgroup_destroy(struct lxc_handler *handler);
58 extern bool cgroup_init(struct lxc_handler *handler);
59 extern bool cgroup_create(struct lxc_handler *handler);
60 extern bool cgroup_setup_limits(struct lxc_handler *handler, bool with_devices);
61 extern bool cgroup_chown(struct lxc_handler *handler);
62 extern bool cgroup_enter(struct lxc_handler *handler);
63 extern void cgroup_cleanup(struct lxc_handler *handler);
64 extern bool cgroup_create_legacy(struct lxc_handler *handler);
65 extern int cgroup_nrtasks(struct lxc_handler *handler);
66 extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
67 extern bool cgroup_unfreeze(struct lxc_handler *handler);
68 extern void cgroup_disconnect(void);
69
70 #endif