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
87297f60
Commit
87297f60
authored
Mar 10, 2016
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #890 from hallyn/2016-03-10/cgfix
cgfsng: get_cgroup_path: return the cgroup path not full mounted path
parents
1a4faf51
371f834d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
cgfsng.c
src/lxc/cgfsng.c
+23
-6
No files found.
src/lxc/cgfsng.c
View file @
87297f60
...
...
@@ -1344,7 +1344,25 @@ static const char *cgfsng_get_cgroup(void *hdata, const char *subsystem)
if
(
!
h
)
return
NULL
;
return
h
->
fullcgpath
;
return
h
->
fullcgpath
?
h
->
fullcgpath
+
strlen
(
h
->
mountpoint
)
:
NULL
;
}
/*
* Given a cgroup path returned from lxc_cmd_get_cgroup_path, build a
* full path, which must be freed by the caller.
*/
static
char
*
build_full_cgpath_from_monitorpath
(
struct
hierarchy
*
h
,
const
char
*
inpath
,
const
char
*
filename
)
{
/*
* XXX Remove this case after 2.0 release. It's for dealing with
* containers spawned under the old buggy cgfsng which wasn't around
* for long.
*/
if
(
strncmp
(
inpath
,
"/sys/fs/cgroup/"
,
15
)
==
0
)
return
must_make_path
(
inpath
,
filename
,
NULL
);
return
must_make_path
(
h
->
mountpoint
,
inpath
,
filename
,
NULL
);
}
static
bool
cgfsng_attach
(
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
)
...
...
@@ -1369,15 +1387,14 @@ static bool cgfsng_attach(const char *name, const char *lxcpath, pid_t pid)
if
(
!
path
)
// not running
continue
;
fullpath
=
must_make_path
(
path
,
"cgroup.procs"
,
NULL
);
fullpath
=
build_full_cgpath_from_monitorpath
(
h
,
path
,
"cgroup.procs"
);
free
(
path
);
if
(
lxc_write_to_file
(
fullpath
,
pidstr
,
len
,
false
)
!=
0
)
{
SYSERROR
(
"Failed to attach %d to %s"
,
(
int
)
pid
,
fullpath
);
free
(
fullpath
);
free
(
path
);
free_handler_data
(
d
);
return
false
;
}
free
(
path
);
free
(
fullpath
);
}
...
...
@@ -1414,7 +1431,7 @@ static int cgfsng_get(const char *filename, char *value, size_t len, const char
h
=
get_hierarchy
(
d
,
subsystem
);
if
(
h
)
{
char
*
fullpath
=
must_make_path
(
path
,
filename
,
NULL
);
char
*
fullpath
=
build_full_cgpath_from_monitorpath
(
h
,
path
,
filename
);
ret
=
lxc_read_from_file
(
fullpath
,
value
,
len
);
free
(
fullpath
);
}
...
...
@@ -1454,7 +1471,7 @@ static int cgfsng_set(const char *filename, const char *value, const char *name,
h
=
get_hierarchy
(
d
,
subsystem
);
if
(
h
)
{
char
*
fullpath
=
must_make_path
(
path
,
filename
,
NULL
);
char
*
fullpath
=
build_full_cgpath_from_monitorpath
(
h
,
path
,
filename
);
ret
=
lxc_write_to_file
(
fullpath
,
value
,
strlen
(
value
),
false
);
free
(
fullpath
);
}
...
...
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