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
82187eda
Unverified
Commit
82187eda
authored
Feb 25, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: remove unused method and cleanup cgroup_exit()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
bb399820
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
62 deletions
+4
-62
cgfsng.c
src/lxc/cgroups/cgfsng.c
+0
-52
cgroup.c
src/lxc/cgroups/cgroup.c
+4
-9
cgroup.h
src/lxc/cgroups/cgroup.h
+0
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
82187eda
...
@@ -1833,57 +1833,6 @@ on_error:
...
@@ -1833,57 +1833,6 @@ on_error:
return
retval
;
return
retval
;
}
}
static
int
recursive_count_nrtasks
(
char
*
dirname
)
{
__do_free
char
*
path
=
NULL
;
__do_closedir
DIR
*
dir
=
NULL
;
struct
dirent
*
direntp
;
int
count
=
0
,
ret
;
dir
=
opendir
(
dirname
);
if
(
!
dir
)
return
0
;
while
((
direntp
=
readdir
(
dir
)))
{
struct
stat
mystat
;
if
(
!
strcmp
(
direntp
->
d_name
,
"."
)
||
!
strcmp
(
direntp
->
d_name
,
".."
))
continue
;
path
=
must_make_path
(
dirname
,
direntp
->
d_name
,
NULL
);
if
(
lstat
(
path
,
&
mystat
))
continue
;
if
(
!
S_ISDIR
(
mystat
.
st_mode
))
continue
;
count
+=
recursive_count_nrtasks
(
path
);
}
path
=
must_make_path
(
dirname
,
"cgroup.procs"
,
NULL
);
ret
=
lxc_count_file_lines
(
path
);
if
(
ret
!=
-
1
)
count
+=
ret
;
return
count
;
}
__cgfsng_ops
static
int
cgfsng_nrtasks
(
struct
cgroup_ops
*
ops
)
{
__do_free
char
*
path
=
NULL
;
if
(
!
ops
)
return
ret_set_errno
(
-
1
,
ENOENT
);
if
(
!
ops
->
container_cgroup
||
!
ops
->
hierarchies
)
return
ret_set_errno
(
-
1
,
EINVAL
);
path
=
must_make_path
(
ops
->
hierarchies
[
0
]
->
container_full_path
,
NULL
);
return
recursive_count_nrtasks
(
path
);
}
/* Only root needs to escape to the cgroup of its init. */
/* Only root needs to escape to the cgroup of its init. */
__cgfsng_ops
static
bool
cgfsng_escape
(
const
struct
cgroup_ops
*
ops
,
__cgfsng_ops
static
bool
cgfsng_escape
(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
)
struct
lxc_conf
*
conf
)
...
@@ -3279,7 +3228,6 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf)
...
@@ -3279,7 +3228,6 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf)
cgfsng_ops
->
attach
=
cgfsng_attach
;
cgfsng_ops
->
attach
=
cgfsng_attach
;
cgfsng_ops
->
chown
=
cgfsng_chown
;
cgfsng_ops
->
chown
=
cgfsng_chown
;
cgfsng_ops
->
mount
=
cgfsng_mount
;
cgfsng_ops
->
mount
=
cgfsng_mount
;
cgfsng_ops
->
nrtasks
=
cgfsng_nrtasks
;
cgfsng_ops
->
devices_activate
=
cgfsng_devices_activate
;
cgfsng_ops
->
devices_activate
=
cgfsng_devices_activate
;
return
move_ptr
(
cgfsng_ops
);
return
move_ptr
(
cgfsng_ops
);
...
...
src/lxc/cgroups/cgroup.c
View file @
82187eda
...
@@ -53,13 +53,10 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
...
@@ -53,13 +53,10 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
void
cgroup_exit
(
struct
cgroup_ops
*
ops
)
void
cgroup_exit
(
struct
cgroup_ops
*
ops
)
{
{
char
**
cur
;
struct
hierarchy
**
it
;
if
(
!
ops
)
if
(
!
ops
)
return
;
return
;
for
(
cur
=
ops
->
cgroup_use
;
cur
&&
*
cur
;
cur
++
)
for
(
c
har
**
c
ur
=
ops
->
cgroup_use
;
cur
&&
*
cur
;
cur
++
)
free
(
*
cur
);
free
(
*
cur
);
free
(
ops
->
cgroup_pattern
);
free
(
ops
->
cgroup_pattern
);
...
@@ -69,14 +66,12 @@ void cgroup_exit(struct cgroup_ops *ops)
...
@@ -69,14 +66,12 @@ void cgroup_exit(struct cgroup_ops *ops)
if
(
ops
->
cgroup2_devices
)
if
(
ops
->
cgroup2_devices
)
bpf_program_free
(
ops
->
cgroup2_devices
);
bpf_program_free
(
ops
->
cgroup2_devices
);
for
(
it
=
ops
->
hierarchies
;
it
&&
*
it
;
it
++
)
{
for
(
struct
hierarchy
**
it
=
ops
->
hierarchies
;
it
&&
*
it
;
it
++
)
{
char
**
p
;
for
(
char
**
p
=
(
*
it
)
->
controllers
;
p
&&
*
p
;
p
++
)
for
(
p
=
(
*
it
)
->
controllers
;
p
&&
*
p
;
p
++
)
free
(
*
p
);
free
(
*
p
);
free
((
*
it
)
->
controllers
);
free
((
*
it
)
->
controllers
);
for
(
p
=
(
*
it
)
->
cgroup2_chown
;
p
&&
*
p
;
p
++
)
for
(
char
**
p
=
(
*
it
)
->
cgroup2_chown
;
p
&&
*
p
;
p
++
)
free
(
*
p
);
free
(
*
p
);
free
((
*
it
)
->
cgroup2_chown
);
free
((
*
it
)
->
cgroup2_chown
);
...
...
src/lxc/cgroups/cgroup.h
View file @
82187eda
...
@@ -161,7 +161,6 @@ struct cgroup_ops {
...
@@ -161,7 +161,6 @@ struct cgroup_ops {
const
char
*
lxcpath
,
pid_t
pid
);
const
char
*
lxcpath
,
pid_t
pid
);
bool
(
*
mount
)(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
,
bool
(
*
mount
)(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
,
const
char
*
root
,
int
type
);
const
char
*
root
,
int
type
);
int
(
*
nrtasks
)(
struct
cgroup_ops
*
ops
);
bool
(
*
devices_activate
)(
struct
cgroup_ops
*
ops
,
bool
(
*
devices_activate
)(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
);
struct
lxc_handler
*
handler
);
bool
(
*
monitor_delegate_controllers
)(
struct
cgroup_ops
*
ops
);
bool
(
*
monitor_delegate_controllers
)(
struct
cgroup_ops
*
ops
);
...
...
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