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
c8338a6c
Unverified
Commit
c8338a6c
authored
Feb 10, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
criu: mark cgroups methods specific to criu
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
e78117f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
cgfsng.c
src/lxc/cgroups/cgfsng.c
+9
-8
cgroup.h
src/lxc/cgroups/cgroup.h
+3
-3
criu.c
src/lxc/criu.c
+5
-5
No files found.
src/lxc/cgroups/cgfsng.c
View file @
c8338a6c
...
...
@@ -2017,8 +2017,8 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
}
/* Only root needs to escape to the cgroup of its init. */
__cgfsng_ops
static
bool
cgfsng_escape
(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
)
__cgfsng_ops
static
bool
cgfsng_
criu_
escape
(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
)
{
if
(
!
ops
)
return
ret_set_errno
(
false
,
ENOENT
);
...
...
@@ -2048,7 +2048,7 @@ __cgfsng_ops static bool cgfsng_escape(const struct cgroup_ops *ops,
return
true
;
}
__cgfsng_ops
static
int
cgfsng_num_hierarchies
(
struct
cgroup_ops
*
ops
)
__cgfsng_ops
static
int
cgfsng_
criu_
num_hierarchies
(
struct
cgroup_ops
*
ops
)
{
int
i
=
0
;
...
...
@@ -2064,8 +2064,8 @@ __cgfsng_ops static int cgfsng_num_hierarchies(struct cgroup_ops *ops)
return
i
;
}
__cgfsng_ops
static
bool
cgfsng_
get_hierarchies
(
struct
cgroup_ops
*
ops
,
int
n
,
char
***
out
)
__cgfsng_ops
static
bool
cgfsng_
criu_get_hierarchies
(
struct
cgroup_ops
*
ops
,
int
n
,
char
***
out
)
{
int
i
;
...
...
@@ -3515,9 +3515,6 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf)
cgfsng_ops
->
payload_create
=
cgfsng_payload_create
;
cgfsng_ops
->
payload_enter
=
cgfsng_payload_enter
;
cgfsng_ops
->
payload_finalize
=
cgfsng_payload_finalize
;
cgfsng_ops
->
escape
=
cgfsng_escape
;
cgfsng_ops
->
num_hierarchies
=
cgfsng_num_hierarchies
;
cgfsng_ops
->
get_hierarchies
=
cgfsng_get_hierarchies
;
cgfsng_ops
->
get_cgroup
=
cgfsng_get_cgroup
;
cgfsng_ops
->
get
=
cgfsng_get
;
cgfsng_ops
->
set
=
cgfsng_set
;
...
...
@@ -3533,6 +3530,10 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf)
cgfsng_ops
->
devices_activate
=
cgfsng_devices_activate
;
cgfsng_ops
->
get_limiting_cgroup
=
cgfsng_get_limiting_cgroup
;
cgfsng_ops
->
criu_escape
=
cgfsng_criu_escape
;
cgfsng_ops
->
criu_num_hierarchies
=
cgfsng_criu_num_hierarchies
;
cgfsng_ops
->
criu_get_hierarchies
=
cgfsng_criu_get_hierarchies
;
return
move_ptr
(
cgfsng_ops
);
}
...
...
src/lxc/cgroups/cgroup.h
View file @
c8338a6c
...
...
@@ -157,9 +157,9 @@ struct cgroup_ops {
bool
(
*
payload_create
)(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
);
bool
(
*
payload_enter
)(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
);
const
char
*
(
*
get_cgroup
)(
struct
cgroup_ops
*
ops
,
const
char
*
controller
);
bool
(
*
escape
)(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
);
int
(
*
num_hierarchies
)(
struct
cgroup_ops
*
ops
);
bool
(
*
get_hierarchies
)(
struct
cgroup_ops
*
ops
,
int
n
,
char
***
out
);
bool
(
*
criu_
escape
)(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
);
int
(
*
criu_
num_hierarchies
)(
struct
cgroup_ops
*
ops
);
bool
(
*
criu_
get_hierarchies
)(
struct
cgroup_ops
*
ops
,
int
n
,
char
***
out
);
int
(
*
set
)(
struct
cgroup_ops
*
ops
,
const
char
*
filename
,
const
char
*
value
,
const
char
*
name
,
const
char
*
lxcpath
);
int
(
*
get
)(
struct
cgroup_ops
*
ops
,
const
char
*
filename
,
char
*
value
,
...
...
src/lxc/criu.c
View file @
c8338a6c
...
...
@@ -163,7 +163,7 @@ static void exec_criu(struct cgroup_ops *cgroup_ops, struct lxc_conf *conf,
* /actual/ root cgroup so that lxcfs thinks criu has enough rights to
* see all cgroups.
*/
if
(
!
cgroup_ops
->
escape
(
cgroup_ops
,
conf
))
{
if
(
!
cgroup_ops
->
criu_
escape
(
cgroup_ops
,
conf
))
{
ERROR
(
"failed to escape cgroups"
);
return
;
}
...
...
@@ -221,8 +221,8 @@ static void exec_criu(struct cgroup_ops *cgroup_ops, struct lxc_conf *conf,
return
;
}
if
(
cgroup_ops
->
num_hierarchies
(
cgroup_ops
)
>
0
)
static_args
+=
2
*
cgroup_ops
->
num_hierarchies
(
cgroup_ops
);
if
(
cgroup_ops
->
criu_
num_hierarchies
(
cgroup_ops
)
>
0
)
static_args
+=
2
*
cgroup_ops
->
criu_
num_hierarchies
(
cgroup_ops
);
if
(
opts
->
user
->
verbose
)
static_args
++
;
...
...
@@ -279,11 +279,11 @@ static void exec_criu(struct cgroup_ops *cgroup_ops, struct lxc_conf *conf,
DECLARE_ARG
(
"-o"
);
DECLARE_ARG
(
log
);
for
(
i
=
0
;
i
<
cgroup_ops
->
num_hierarchies
(
cgroup_ops
);
i
++
)
{
for
(
i
=
0
;
i
<
cgroup_ops
->
criu_
num_hierarchies
(
cgroup_ops
);
i
++
)
{
char
**
controllers
=
NULL
,
*
fullname
;
char
*
path
,
*
tmp
;
if
(
!
cgroup_ops
->
get_hierarchies
(
cgroup_ops
,
i
,
&
controllers
))
{
if
(
!
cgroup_ops
->
criu_
get_hierarchies
(
cgroup_ops
,
i
,
&
controllers
))
{
ERROR
(
"failed to get hierarchy %d"
,
i
);
goto
err
;
}
...
...
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