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
87777968
Unverified
Commit
87777968
authored
Jan 31, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: cgfsng_set: handle unified hierarchy
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0069cc61
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
cgfsng.c
src/lxc/cgroups/cgfsng.c
+17
-11
No files found.
src/lxc/cgroups/cgfsng.c
View file @
87777968
...
@@ -2390,28 +2390,34 @@ static int cgfsng_get(const char *filename, char *value, size_t len,
...
@@ -2390,28 +2390,34 @@ static int cgfsng_get(const char *filename, char *value, size_t len,
* Here we don't have a cgroup_data set up, so we ask the running
* Here we don't have a cgroup_data set up, so we ask the running
* container through the commands API for the cgroup path
* container through the commands API for the cgroup path
*/
*/
static
int
cgfsng_set
(
const
char
*
filename
,
const
char
*
value
,
const
char
*
name
,
const
char
*
lxcpath
)
static
int
cgfsng_set
(
const
char
*
filename
,
const
char
*
value
,
const
char
*
name
,
const
char
*
lxcpath
)
{
{
char
*
subsystem
,
*
p
,
*
path
;
struct
hierarchy
*
h
;
int
ret
=
-
1
;
int
ret
=
-
1
;
size_t
controller_len
;
char
*
controller
,
*
p
,
*
path
;
struct
hierarchy
*
h
;
subsystem
=
alloca
(
strlen
(
filename
)
+
1
);
controller_len
=
strlen
(
filename
);
strcpy
(
subsystem
,
filename
);
controller
=
alloca
(
controller_len
+
1
);
if
((
p
=
strchr
(
subsystem
,
'.'
))
!=
NULL
)
strcpy
(
controller
,
filename
);
p
=
strchr
(
controller
,
'.'
);
if
(
p
)
*
p
=
'\0'
;
*
p
=
'\0'
;
path
=
lxc_cmd_get_cgroup_path
(
name
,
lxcpath
,
subsystem
);
path
=
lxc_cmd_get_cgroup_path
(
name
,
lxcpath
,
controller
);
if
(
!
path
)
/* not running */
/* not running */
if
(
!
path
)
return
-
1
;
return
-
1
;
h
=
get_hierarchy
(
subsystem
);
h
=
get_hierarchy
(
controller
);
if
(
h
)
{
if
(
h
)
{
char
*
fullpath
=
build_full_cgpath_from_monitorpath
(
h
,
path
,
filename
);
char
*
fullpath
;
fullpath
=
build_full_cgpath_from_monitorpath
(
h
,
path
,
filename
);
ret
=
lxc_write_to_file
(
fullpath
,
value
,
strlen
(
value
),
false
);
ret
=
lxc_write_to_file
(
fullpath
,
value
,
strlen
(
value
),
false
);
free
(
fullpath
);
free
(
fullpath
);
}
}
free
(
path
);
free
(
path
);
return
ret
;
return
ret
;
...
...
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