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
67ed60ce
Unverified
Commit
67ed60ce
authored
Feb 21, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: s/container_full_path/path_con/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c0af7b1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
cgfsng.c
src/lxc/cgroups/cgfsng.c
+15
-15
cgroup.c
src/lxc/cgroups/cgroup.c
+1
-1
cgroup.h
src/lxc/cgroups/cgroup.h
+4
-4
No files found.
src/lxc/cgroups/cgfsng.c
View file @
67ed60ce
...
...
@@ -444,7 +444,7 @@ static int cgroup_tree_remove(struct hierarchy **hierarchies, const char *path_p
else
TRACE
(
"Removed cgroup tree %d(%s)"
,
h
->
dfd_base
,
path_prune
);
free_equal
(
h
->
container_limit_path
,
h
->
container_full_path
);
free_equal
(
h
->
container_limit_path
,
h
->
path_con
);
}
return
0
;
...
...
@@ -802,7 +802,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
if
(
payload
)
{
h
->
dfd_con
=
move_fd
(
fd_final
);
h
->
container_full_path
=
move_ptr
(
path
);
h
->
path_con
=
move_ptr
(
path
);
if
(
fd_limit
<
0
)
h
->
dfd_lim
=
h
->
dfd_con
;
...
...
@@ -812,7 +812,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
if
(
limit_path
)
h
->
container_limit_path
=
move_ptr
(
limit_path
);
else
h
->
container_limit_path
=
h
->
container_full_path
;
h
->
container_limit_path
=
h
->
path_con
;
}
else
{
h
->
dfd_mon
=
move_fd
(
fd_final
);
}
...
...
@@ -830,7 +830,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune,
if
(
h
->
dfd_lim
<
0
)
prune
=
false
;
free_equal
(
h
->
container_full_path
,
h
->
container_limit_path
);
free_equal
(
h
->
path_con
,
h
->
container_limit_path
);
close_equal
(
h
->
dfd_con
,
h
->
dfd_lim
);
}
else
{
/* Check whether we actually created the cgroup to prune. */
...
...
@@ -1127,7 +1127,7 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
true
))
continue
;
DEBUG
(
"Failed to create cgroup
\"
%s
\"
"
,
ops
->
hierarchies
[
i
]
->
container_full_path
?:
"(null)"
);
DEBUG
(
"Failed to create cgroup
\"
%s
\"
"
,
ops
->
hierarchies
[
i
]
->
path_con
?:
"(null)"
);
for
(
int
j
=
0
;
j
<=
i
;
j
++
)
cgroup_tree_prune_leaf
(
ops
->
hierarchies
[
j
],
limit_cgroup
,
true
);
...
...
@@ -1244,9 +1244,9 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
ret
=
lxc_writeat
(
h
->
dfd_con
,
"cgroup.procs"
,
pidstr
,
len
);
if
(
ret
!=
0
)
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
container_full_path
);
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
path_con
);
TRACE
(
"Moved container into %s cgroup via %d"
,
h
->
container_full_path
,
h
->
dfd_con
);
TRACE
(
"Moved container into %s cgroup via %d"
,
h
->
path_con
,
h
->
dfd_con
);
}
return
true
;
...
...
@@ -1898,7 +1898,7 @@ static bool cg_legacy_freeze(struct cgroup_ops *ops)
if
(
!
h
)
return
ret_set_errno
(
-
1
,
ENOENT
);
return
lxc_write_openat
(
h
->
container_full_path
,
"freezer.state"
,
return
lxc_write_openat
(
h
->
path_con
,
"freezer.state"
,
"FROZEN"
,
STRLITERALLEN
(
"FROZEN"
));
}
...
...
@@ -1945,13 +1945,13 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout,
if
(
!
h
)
return
ret_set_errno
(
-
1
,
ENOENT
);
if
(
!
h
->
container_full_path
)
if
(
!
h
->
path_con
)
return
ret_set_errno
(
-
1
,
EEXIST
);
if
(
timeout
!=
0
)
{
__do_free
char
*
events_file
=
NULL
;
events_file
=
must_make_path
(
h
->
container_full_path
,
"cgroup.events"
,
NULL
);
events_file
=
must_make_path
(
h
->
path_con
,
"cgroup.events"
,
NULL
);
fd
=
open
(
events_file
,
O_RDONLY
|
O_CLOEXEC
);
if
(
fd
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to open cgroup.events file"
);
...
...
@@ -1968,7 +1968,7 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout,
return
log_error_errno
(
-
1
,
errno
,
"Failed to add cgroup.events fd handler to mainloop"
);
}
ret
=
lxc_write_openat
(
h
->
container_full_path
,
"cgroup.freeze"
,
state_string
,
1
);
ret
=
lxc_write_openat
(
h
->
path_con
,
"cgroup.freeze"
,
state_string
,
1
);
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to open cgroup.freeze file"
);
...
...
@@ -2004,7 +2004,7 @@ static int cg_legacy_unfreeze(struct cgroup_ops *ops)
if
(
!
h
)
return
ret_set_errno
(
-
1
,
ENOENT
);
return
lxc_write_openat
(
h
->
container_full_path
,
"freezer.state"
,
return
lxc_write_openat
(
h
->
path_con
,
"freezer.state"
,
"THAWED"
,
STRLITERALLEN
(
"THAWED"
));
}
...
...
@@ -2041,7 +2041,7 @@ static const char *cgfsng_get_cgroup_do(struct cgroup_ops *ops,
if
(
limiting
)
path
=
h
->
container_limit_path
;
else
path
=
h
->
container_full_path
;
path
=
h
->
path_con
;
if
(
!
path
)
return
NULL
;
...
...
@@ -2677,7 +2677,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
return
log_error_errno
(
-
ENOENT
,
ENOENT
,
"Failed to setup limits for the
\"
%s
\"
controller. The controller seems to be unused by
\"
cgfsng
\"
cgroup driver or not enabled on the cgroup hierarchy"
,
controller
);
if
(
is_cpuset
)
{
int
ret
=
lxc_write_openat
(
h
->
container_full_path
,
filename
,
value
,
strlen
(
value
));
int
ret
=
lxc_write_openat
(
h
->
path_con
,
filename
,
value
,
strlen
(
value
));
if
(
ret
)
return
ret
;
}
...
...
@@ -2839,7 +2839,7 @@ __cgfsng_ops static bool cgfsng_devices_activate(struct cgroup_ops *ops, struct
unified
=
ops
->
unified
;
if
(
!
unified
||
!
unified
->
bpf_device_controller
||
!
unified
->
container_full_path
||
!
unified
->
path_con
||
lxc_list_empty
(
&
(
conf
->
bpf_devices
).
device_item
))
return
true
;
...
...
src/lxc/cgroups/cgroup.c
View file @
67ed60ce
...
...
@@ -88,7 +88,7 @@ void cgroup_exit(struct cgroup_ops *ops)
free
((
*
it
)
->
at_mnt
);
free
((
*
it
)
->
at_base
);
free_equal
((
*
it
)
->
container_full_path
,
free_equal
((
*
it
)
->
path_con
,
(
*
it
)
->
container_limit_path
);
close_equal
((
*
it
)
->
dfd_con
,
(
*
it
)
->
dfd_lim
);
...
...
src/lxc/cgroups/cgroup.h
View file @
67ed60ce
...
...
@@ -61,12 +61,12 @@ typedef enum {
* is created. This will be either the caller's cgroup (if not root), or
* init's cgroup (if root).
*
* @
container_full_path
* @
path_con
* - The full path to the container's cgroup.
*
* @container_limit_path
* - The full path to the container's limiting cgroup. May simply point to
*
container_full_path
.
*
path_con
.
*
* @version
* - legacy hierarchy
...
...
@@ -83,7 +83,6 @@ struct hierarchy {
*/
char
**
cgroup2_chown
;
char
**
controllers
;
char
*
container_full_path
;
char
*
container_limit_path
;
cgroupfs_type_magic_t
fs_type
;
...
...
@@ -91,8 +90,9 @@ struct hierarchy {
unsigned
int
bpf_device_controller
:
1
;
unsigned
int
freezer_controller
:
1
;
/* File descriptor for the container's cgroup @
container_full_path
. */
/* File descriptor for the container's cgroup @
path_con
. */
int
dfd_con
;
char
*
path_con
;
/*
* File descriptor for the container's limiting cgroup
...
...
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