Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
528c2bd8
Unverified
Commit
528c2bd8
authored
Jul 21, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: hide unnecessary symbols
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
297b04e2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
24 deletions
+136
-24
Makefile.am
src/lxc/Makefile.am
+75
-0
cgroup.h
src/lxc/cgroups/cgroup.h
+7
-6
cgroup2_devices.h
src/lxc/cgroups/cgroup2_devices.h
+16
-12
cgroup_utils.h
src/lxc/cgroups/cgroup_utils.h
+8
-6
Makefile.am
src/tests/Makefile.am
+30
-0
No files found.
src/lxc/Makefile.am
View file @
528c2bd8
This diff is collapsed.
Click to expand it.
src/lxc/cgroups/cgroup.h
View file @
528c2bd8
...
...
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <sys/types.h>
#include "compiler.h"
#include "macro.h"
#include "memory_utils.h"
...
...
@@ -179,15 +180,15 @@ struct cgroup_ops {
const
char
*
(
*
get_limiting_cgroup
)(
struct
cgroup_ops
*
ops
,
const
char
*
controller
);
};
extern
struct
cgroup_ops
*
cgroup_init
(
struct
lxc_conf
*
conf
);
__hidden
extern
struct
cgroup_ops
*
cgroup_init
(
struct
lxc_conf
*
conf
);
extern
void
cgroup_exit
(
struct
cgroup_ops
*
ops
);
__hidden
extern
void
cgroup_exit
(
struct
cgroup_ops
*
ops
);
define_cleanup_function
(
struct
cgroup_ops
*
,
cgroup_exit
);
extern
void
prune_init_scope
(
char
*
cg
);
__hidden
extern
void
prune_init_scope
(
char
*
cg
);
extern
int
cgroup_attach
(
const
struct
lxc_conf
*
conf
,
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
__hidden
extern
int
cgroup_attach
(
const
struct
lxc_conf
*
conf
,
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
static
inline
bool
pure_unified_layout
(
const
struct
cgroup_ops
*
ops
)
{
...
...
@@ -202,4 +203,4 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops)
return
ops
->
unified
->
cgfd_con
;
}
#endif
#endif
/* __LXC_CGROUP_H */
src/lxc/cgroups/cgroup2_devices.h
View file @
528c2bd8
...
...
@@ -15,6 +15,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "compiler.h"
#include "conf.h"
#include "config.h"
#include "syscall_numbers.h"
...
...
@@ -52,17 +53,17 @@ struct bpf_program {
};
#ifdef HAVE_STRUCT_BPF_CGROUP_DEV_CTX
struct
bpf_program
*
bpf_program_new
(
uint32_t
prog_type
);
int
bpf_program_init
(
struct
bpf_program
*
prog
);
int
bpf_program_append_device
(
struct
bpf_program
*
prog
,
struct
device_item
*
device
);
int
bpf_program_finalize
(
struct
bpf_program
*
prog
);
int
bpf_program_cgroup_attach
(
struct
bpf_program
*
prog
,
int
type
,
const
char
*
path
,
uint32_t
flags
);
int
bpf_program_cgroup_detach
(
struct
bpf_program
*
prog
);
void
bpf_program_free
(
struct
bpf_program
*
prog
);
void
lxc_clear_cgroup2_devices
(
struct
lxc_conf
*
conf
);
bool
bpf_devices_cgroup_supported
(
void
);
__hidden
extern
struct
bpf_program
*
bpf_program_new
(
uint32_t
prog_type
);
__hidden
extern
int
bpf_program_init
(
struct
bpf_program
*
prog
);
__hidden
extern
int
bpf_program_append_device
(
struct
bpf_program
*
prog
,
struct
device_item
*
device
);
__hidden
extern
int
bpf_program_finalize
(
struct
bpf_program
*
prog
);
__hidden
extern
int
bpf_program_cgroup_attach
(
struct
bpf_program
*
prog
,
int
type
,
const
char
*
path
,
uint32_t
flags
);
__hidden
extern
int
bpf_program_cgroup_detach
(
struct
bpf_program
*
prog
);
__hidden
extern
void
bpf_program_free
(
struct
bpf_program
*
prog
);
__hidden
extern
void
lxc_clear_cgroup2_devices
(
struct
lxc_conf
*
conf
);
__hidden
extern
bool
bpf_devices_cgroup_supported
(
void
);
static
inline
void
__auto_bpf_program_free__
(
struct
bpf_program
**
prog
)
{
if
(
*
prog
)
{
...
...
@@ -70,8 +71,11 @@ static inline void __auto_bpf_program_free__(struct bpf_program **prog)
*
prog
=
NULL
;
}
}
int
bpf_list_add_device
(
struct
lxc_conf
*
conf
,
struct
device_item
*
device
);
__hidden
extern
int
bpf_list_add_device
(
struct
lxc_conf
*
conf
,
struct
device_item
*
device
);
#else
/* !HAVE_STRUCT_BPF_CGROUP_DEV_CTX */
static
inline
struct
bpf_program
*
bpf_program_new
(
uint32_t
prog_type
)
{
errno
=
ENOSYS
;
...
...
src/lxc/cgroups/cgroup_utils.h
View file @
528c2bd8
...
...
@@ -6,26 +6,28 @@
#include <stdbool.h>
#include <stdio.h>
#include "compiler.h"
/* Retrieve the cgroup version of a given entry from /proc/<pid>/mountinfo. */
extern
int
get_cgroup_version
(
char
*
line
);
__hidden
extern
int
get_cgroup_version
(
char
*
line
);
/* Check if given entry from /proc/<pid>/mountinfo is a cgroupfs v1 mount. */
extern
bool
is_cgroupfs_v1
(
char
*
line
);
__hidden
extern
bool
is_cgroupfs_v1
(
char
*
line
);
/* Check if given entry from /proc/<pid>/mountinfo is a cgroupfs v2 mount. */
extern
bool
is_cgroupfs_v2
(
char
*
line
);
__hidden
extern
bool
is_cgroupfs_v2
(
char
*
line
);
/* Given a v1 hierarchy @mountpoint and base @path, verify that we can create
* directories underneath it.
*/
extern
bool
test_writeable_v1
(
char
*
mountpoint
,
char
*
path
);
__hidden
extern
bool
test_writeable_v1
(
char
*
mountpoint
,
char
*
path
);
/* Given a v2 hierarchy @mountpoint and base @path, verify that we can create
* directories underneath it and that we have write access to the cgroup's
* "cgroup.procs" file.
*/
extern
bool
test_writeable_v2
(
char
*
mountpoint
,
char
*
path
);
__hidden
extern
bool
test_writeable_v2
(
char
*
mountpoint
,
char
*
path
);
extern
int
unified_cgroup_hierarchy
(
void
);
__hidden
extern
int
unified_cgroup_hierarchy
(
void
);
#endif
/* __LXC_CGROUP_UTILS_H */
src/tests/Makefile.am
View file @
528c2bd8
...
...
@@ -10,6 +10,9 @@ LDADD = ../lxc/liblxc.la \
lxc_test_api_reboot_SOURCES
=
api_reboot.c
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -42,6 +45,9 @@ endif
lxc_test_apparmor_SOURCES
=
aa.c
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -74,6 +80,9 @@ endif
lxc_test_attach_SOURCES
=
attach.c
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -107,6 +116,9 @@ lxc_test_basic_SOURCES = basic.c
lxc_test_cgpath_SOURCES
=
cgpath.c
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -142,6 +154,9 @@ lxc_test_config_jump_table_SOURCES = config_jump_table.c \
lxctest.h
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -185,6 +200,9 @@ lxc_test_list_SOURCES = list.c
lxc_test_locktests_SOURCES
=
locktests.c
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -220,6 +238,9 @@ lxc_test_mount_injection_SOURCES = mount_injection.c \
lxctest.h
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -253,6 +274,9 @@ lxc_test_parse_config_file_SOURCES = parse_config_file.c \
lxctest.h
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
@@ -285,6 +309,9 @@ endif
lxc_test_raw_clone_SOURCES
=
lxc_raw_clone.c
\
lxctest.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/file_utils.c ../lxc/file_utils.h
\
../lxc/log.c ../lxc/log.h
\
../lxc/namespace.c ../lxc/namespace.h
\
...
...
@@ -309,6 +336,9 @@ lxc_test_utils_SOURCES = lxc-test-utils.c \
lxctest.h
\
../lxc/af_unix.c ../lxc/af_unix.h
\
../lxc/caps.c ../lxc/caps.h
\
../lxc/cgroups/cgroup.c ../lxc/cgroups/cgroup.h
\
../lxc/cgroups/cgroup2_devices.c ../lxc/cgroups/cgroup2_devices.h
\
../lxc/cgroups/cgroup_utils.c ../lxc/cgroups/cgroup_utils.h
\
../lxc/commands.c ../lxc/commands.h
\
../lxc/commands_utils.c ../lxc/commands_utils.h
\
../lxc/conf.c ../lxc/conf.h
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment