This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
fs.h
78 lines (75 loc) · 3.5 KB
/
fs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
*
* Copyright © 2013 Serge Hallyn
* Author: Serge Hallyn <[email protected]>
*
* based on cgroup.c from
* lxc: linux Container library
* (C) Copyright IBM Corp. 2007, 2008
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define UNIFIED_DIR CGDIR "/.cgm_unified"
#define UNIFIED_PIN UNIFIED_DIR "/.cgpin"
#define U_LEAF_NAME ".cgm_leaf"
#define U_LEAF "/" U_LEAF_NAME
extern char *all_controllers;
extern char *allow_autoremove_premounted;
extern int autoremove_premounted_set_release_agent;
struct keys_return_type;
bool premounted_should_allow_autoremove(const char *controller);
int collect_subsystems(char *extra_mounts, char *skip_mounts);
int setup_cgroup_mounts(void);
bool compute_pid_cgroup(pid_t pid, const char *controller, const char *cgroup,
char *path, int *depth);
bool compute_proxy_cgroup(pid_t pid, const char *controller, const char *cgroup,
char *path, int *depth);
bool may_access(pid_t pid, uid_t uid, gid_t gid, const char *path, int mode);
void get_pid_creds(pid_t pid, uid_t *uid, gid_t *gid);
char *file_read_string(void *parent, const char *path);
int file_read_pids(void *parent, const char *path, int32_t **pids,
int *alloced_pids, int *nrpids);
void get_pid_creds(pid_t pid, uid_t *uid, gid_t *gid);
const char *get_controller_path(const char *controller);
bool hostuid_to_ns(uid_t uid, pid_t pid, uid_t *answer);
bool chown_cgroup_path(const char *path, uid_t uid, gid_t gid,
bool all_children, bool is_unified);
bool chmod_cgroup_path(const char *path, int mode);
bool set_value(const char *controller, const char *path, const char *value);
bool set_value_trusted(const char *path, const char *value);
unsigned long read_pid_ns_link(int pid);
unsigned long read_user_ns_link(int pid);
bool realpath_escapes(char *path, char *safety);
bool file_exists(const char *path);
bool dir_exists(const char *path);
bool move_self_to_root(void);
int get_directory_children(void *parent, const char *path, char ***output);
int get_directory_contents(void *parent, const char *path, struct keys_return_type ***output);
bool setup_base_run_path(void);
bool create_agent_symlinks(void);
bool was_premounted(const char *controller);
void do_prune_comounts(char *controllers);
bool prune_verify_comounts(char *controllers);
void do_list_controllers(void *parent, char ***output);
void convert_directory_contents(struct keys_return_type **keys, struct ucred r);
bool path_is_under_proxycg(pid_t pid, const char *contr,const char *path);
bool unified_copy_controllers(const char *controller, const char *path);
bool is_unified_controller(const char *controller);
bool create_leaf(const char *controller, const char *path, uid_t u, gid_t g);
bool ensure_leafdir(const char *controller, const char *path);
void turn_mount_rw(const char *path);
bool is_ro_mount(const char *path);