]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/cgroups/cgroup_utils.h
cgfsng: controller_found()
[mirror_lxc.git] / src / lxc / cgroups / cgroup_utils.h
CommitLineData
6328fd9c
CB
1/*
2 * lxc: linux Container library
3 *
4 * Copyright © 2017 Canonical Ltd.
5 *
6 * Authors:
7 * Serge Hallyn <serge.hallyn@ubuntu.com>
8 * Christian Brauner <christian.brauner@ubuntu.com>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef __LXC_CGROUP_UTILS_H
26#define __LXC_CGROUP_UTILS_H
27
28#include <stdbool.h>
29#include <stdio.h>
30
49ff3958
CB
31/* Retrieve the cgroup version of a given entry from /proc/<pid>/mountinfo. */
32extern int get_cgroup_version(char *line);
33
6328fd9c
CB
34/* Check if given entry from /proc/<pid>/mountinfo is a cgroupfs v1 mount. */
35extern bool is_cgroupfs_v1(char *line);
36
37/* Check if given entry from /proc/<pid>/mountinfo is a cgroupfs v2 mount. */
38extern bool is_cgroupfs_v2(char *line);
39
40/* Given a v1 hierarchy @mountpoint and base @path, verify that we can create
41 * directories underneath it.
42 */
43extern bool test_writeable_v1(char *mountpoint, char *path);
44
45/* Given a v2 hierarchy @mountpoint and base @path, verify that we can create
46 * directories underneath it and that we have write access to the cgroup's
47 * "cgroup.procs" file.
48 */
49extern bool test_writeable_v2(char *mountpoint, char *path);
50
51#endif /* __LXC_CGROUP_UTILS_H */