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
e0c8dc5e
Unverified
Commit
e0c8dc5e
authored
Dec 07, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups/cgfsng: rework cgfsng_monitor_destroy()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
1359d223
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
cgfsng.c
src/lxc/cgroups/cgfsng.c
+23
-13
No files found.
src/lxc/cgroups/cgfsng.c
View file @
e0c8dc5e
...
...
@@ -1124,12 +1124,23 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
struct
lxc_handler
*
handler
)
{
int
len
;
struct
lxc_conf
*
conf
=
handler
->
conf
;
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)];
struct
lxc_conf
*
conf
;
if
(
!
ops
)
log_error_errno
(
return
,
ENOENT
,
"Called with uninitialized cgroup operations"
);
if
(
!
ops
->
hierarchies
)
return
;
if
(
!
handler
)
log_error_errno
(
return
,
EINVAL
,
"Called with uninitialized handler"
);
if
(
!
handler
->
conf
)
log_error_errno
(
return
,
EINVAL
,
"Called with uninitialized conf"
);
conf
=
handler
->
conf
;
len
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
handler
->
monitor_pid
);
if
(
len
<
0
||
(
size_t
)
len
>=
sizeof
(
pidstr
))
return
;
...
...
@@ -1164,16 +1175,15 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
* Make sure not to pass in the ro string literal PIVOT_CGROUP
* here.
*/
if
(
!
cg_legacy_handle_cpuset_hierarchy
(
h
,
pivot_cgroup
))
{
WARN
(
"Failed to handle legacy cpuset controller"
);
continue
;
}
if
(
!
cg_legacy_handle_cpuset_hierarchy
(
h
,
pivot_cgroup
))
log_warn_errno
(
continue
,
errno
,
"Failed to handle legacy cpuset controller"
);
ret
=
mkdir_p
(
pivot_path
,
0755
);
if
(
ret
<
0
&&
errno
!=
EEXIST
)
{
SYSWARN
(
"Failed to create cgroup
\"
%s
\"\n
"
,
pivot_path
);
continue
;
}
if
(
ret
<
0
&&
errno
!=
EEXIST
)
log_warn_errno
(
continue
,
errno
,
"Failed to create cgroup
\"
%s
\"\n
"
,
pivot_path
);
if
(
chop
)
*
chop
=
'/'
;
...
...
@@ -1182,10 +1192,10 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
* cgroup.
*/
ret
=
lxc_write_to_file
(
pivot_path
,
pidstr
,
len
,
false
,
0666
);
if
(
ret
!=
0
)
{
SYSWARN
(
"Failed to move monitor %s to
\"
%s
\"\n
"
,
pidstr
,
pivot_path
);
continue
;
}
if
(
ret
!=
0
)
log_warn_errno
(
continue
,
errno
,
"Failed to move monitor %s to
\"
%s
\"\n
"
,
pidstr
,
pivot_path
);
ret
=
recursive_destroy
(
h
->
monitor_full_path
);
if
(
ret
<
0
)
...
...
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