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
6c049d3a
Unverified
Commit
6c049d3a
authored
Dec 20, 2017
by
Christian Brauner
Committed by
GitHub
Dec 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2055 from marcosps/cgfsng_debug
cgfsng: Add new macro to print errors
parents
d1de8dda
65d78313
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
cgfsng.c
src/lxc/cgroups/cgfsng.c
+13
-8
No files found.
src/lxc/cgroups/cgfsng.c
View file @
6c049d3a
...
@@ -118,6 +118,11 @@ char *cgroup_use;
...
@@ -118,6 +118,11 @@ char *cgroup_use;
*/
*/
static
bool
lxc_cgfsng_debug
;
static
bool
lxc_cgfsng_debug
;
#define CGFSNG_DEBUG(format, ...) do { \
if (lxc_cgfsng_debug) \
printf("cgfsng: " format, ##__VA_ARGS__); \
} while(0)
static
void
free_string_list
(
char
**
clist
)
static
void
free_string_list
(
char
**
clist
)
{
{
if
(
clist
)
{
if
(
clist
)
{
...
@@ -727,7 +732,7 @@ static bool all_controllers_found(void)
...
@@ -727,7 +732,7 @@ static bool all_controllers_found(void)
struct
hierarchy
**
hlist
=
hierarchies
;
struct
hierarchy
**
hlist
=
hierarchies
;
if
(
!
controller_found
(
hlist
,
"freezer"
))
{
if
(
!
controller_found
(
hlist
,
"freezer"
))
{
ERROR
(
"No freezer controller mountpoint found
"
);
CGFSNG_DEBUG
(
"No freezer controller mountpoint found
\n
"
);
return
false
;
return
false
;
}
}
...
@@ -737,7 +742,7 @@ static bool all_controllers_found(void)
...
@@ -737,7 +742,7 @@ static bool all_controllers_found(void)
for
(
p
=
strtok_r
(
cgroup_use
,
","
,
&
saveptr
);
p
;
for
(
p
=
strtok_r
(
cgroup_use
,
","
,
&
saveptr
);
p
;
p
=
strtok_r
(
NULL
,
","
,
&
saveptr
))
{
p
=
strtok_r
(
NULL
,
","
,
&
saveptr
))
{
if
(
!
controller_found
(
hlist
,
p
))
{
if
(
!
controller_found
(
hlist
,
p
))
{
ERROR
(
"No %s controller mountpoint found
"
,
p
);
CGFSNG_DEBUG
(
"No %s controller mountpoint found
\n
"
,
p
);
return
false
;
return
false
;
}
}
}
}
...
@@ -770,13 +775,13 @@ static char **get_controllers(char **klist, char **nlist, char *line, int type)
...
@@ -770,13 +775,13 @@ static char **get_controllers(char **klist, char **nlist, char *line, int type)
/* note - if we change how mountinfo works, then our caller
/* note - if we change how mountinfo works, then our caller
* will need to verify /sys/fs/cgroup/ in this field */
* will need to verify /sys/fs/cgroup/ in this field */
if
(
strncmp
(
p
,
"/sys/fs/cgroup/"
,
15
))
{
if
(
strncmp
(
p
,
"/sys/fs/cgroup/"
,
15
))
{
INFO
(
"Found hierarchy not under /sys/fs/cgroup:
\"
%s
\"
"
,
p
);
CGFSNG_DEBUG
(
"Found hierarchy not under /sys/fs/cgroup:
\"
%s
\"\n
"
,
p
);
return
NULL
;
return
NULL
;
}
}
p
+=
15
;
p
+=
15
;
p2
=
strchr
(
p
,
' '
);
p2
=
strchr
(
p
,
' '
);
if
(
!
p2
)
{
if
(
!
p2
)
{
ERROR
(
"Corrupt mountinfo
"
);
CGFSNG_DEBUG
(
"Corrupt mountinfo
\n
"
);
return
NULL
;
return
NULL
;
}
}
*
p2
=
'\0'
;
*
p2
=
'\0'
;
...
@@ -1068,7 +1073,7 @@ static bool parse_hierarchies(void)
...
@@ -1068,7 +1073,7 @@ static bool parse_hierarchies(void)
return
false
;
return
false
;
if
((
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
))
==
NULL
)
{
if
((
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
))
==
NULL
)
{
SYSERROR
(
"Failed to open
\"
/proc/self/mountinfo
\"
"
);
CGFSNG_DEBUG
(
"Failed to open
\"
/proc/self/mountinfo
\"\n
"
);
return
false
;
return
false
;
}
}
...
@@ -1099,14 +1104,14 @@ static bool parse_hierarchies(void)
...
@@ -1099,14 +1104,14 @@ static bool parse_hierarchies(void)
mountpoint
=
get_mountpoint
(
line
);
mountpoint
=
get_mountpoint
(
line
);
if
(
!
mountpoint
)
{
if
(
!
mountpoint
)
{
ERROR
(
"Failed parsing mountpoint from
\"
%s
\"
"
,
line
);
CGFSNG_DEBUG
(
"Failed parsing mountpoint from
\"
%s
\"\n
"
,
line
);
free_string_list
(
controller_list
);
free_string_list
(
controller_list
);
continue
;
continue
;
}
}
base_cgroup
=
get_current_cgroup
(
basecginfo
,
controller_list
[
0
]);
base_cgroup
=
get_current_cgroup
(
basecginfo
,
controller_list
[
0
]);
if
(
!
base_cgroup
)
{
if
(
!
base_cgroup
)
{
ERROR
(
"Failed to find current cgroup for controller
\"
%s
\"
"
,
controller_list
[
0
]);
CGFSNG_DEBUG
(
"Failed to find current cgroup for controller
\"
%s
\"\n
"
,
controller_list
[
0
]);
free_string_list
(
controller_list
);
free_string_list
(
controller_list
);
free
(
mountpoint
);
free
(
mountpoint
);
continue
;
continue
;
...
@@ -1155,7 +1160,7 @@ static bool collect_hierarchy_info(void)
...
@@ -1155,7 +1160,7 @@ static bool collect_hierarchy_info(void)
errno
=
0
;
errno
=
0
;
tmp
=
lxc_global_config_value
(
"lxc.cgroup.use"
);
tmp
=
lxc_global_config_value
(
"lxc.cgroup.use"
);
if
(
!
cgroup_use
&&
errno
!=
0
)
{
/* lxc.cgroup.use can be NULL */
if
(
!
cgroup_use
&&
errno
!=
0
)
{
/* lxc.cgroup.use can be NULL */
ERROR
(
"Failed to retrieve list of cgroups to use
"
);
CGFSNG_DEBUG
(
"Failed to retrieve list of cgroups to use
\n
"
);
return
false
;
return
false
;
}
}
cgroup_use
=
must_copy_string
(
tmp
);
cgroup_use
=
must_copy_string
(
tmp
);
...
...
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