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
e33870e5
Unverified
Commit
e33870e5
authored
Feb 21, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: s/cgfd_con/dfd_con/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a58be2ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
cgfsng.c
src/lxc/cgroups/cgfsng.c
+9
-9
cgroup.c
src/lxc/cgroups/cgroup.c
+1
-1
cgroup.h
src/lxc/cgroups/cgroup.h
+3
-3
commands.c
src/lxc/commands.c
+1
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
e33870e5
...
@@ -401,7 +401,7 @@ static int cgroup_hierarchy_add(struct cgroup_ops *ops, int dfd_mnt, char *mnt,
...
@@ -401,7 +401,7 @@ static int cgroup_hierarchy_add(struct cgroup_ops *ops, int dfd_mnt, char *mnt,
if
(
!
new
)
if
(
!
new
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
new
->
cg
fd_con
=
-
EBADF
;
new
->
d
fd_con
=
-
EBADF
;
new
->
cgfd_limit
=
-
EBADF
;
new
->
cgfd_limit
=
-
EBADF
;
new
->
cgfd_mon
=
-
EBADF
;
new
->
cgfd_mon
=
-
EBADF
;
...
@@ -801,11 +801,11 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
...
@@ -801,11 +801,11 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
return
syserrno
(
false
,
"Failed to create %s cgroup %d(%s)"
,
payload
?
"payload"
:
"monitor"
,
h
->
dfd_base
,
cgroup_limit_dir
);
return
syserrno
(
false
,
"Failed to create %s cgroup %d(%s)"
,
payload
?
"payload"
:
"monitor"
,
h
->
dfd_base
,
cgroup_limit_dir
);
if
(
payload
)
{
if
(
payload
)
{
h
->
cg
fd_con
=
move_fd
(
fd_final
);
h
->
d
fd_con
=
move_fd
(
fd_final
);
h
->
container_full_path
=
move_ptr
(
path
);
h
->
container_full_path
=
move_ptr
(
path
);
if
(
fd_limit
<
0
)
if
(
fd_limit
<
0
)
h
->
cgfd_limit
=
h
->
cg
fd_con
;
h
->
cgfd_limit
=
h
->
d
fd_con
;
else
else
h
->
cgfd_limit
=
move_fd
(
fd_limit
);
h
->
cgfd_limit
=
move_fd
(
fd_limit
);
...
@@ -831,7 +831,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune,
...
@@ -831,7 +831,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune,
prune
=
false
;
prune
=
false
;
free_equal
(
h
->
container_full_path
,
h
->
container_limit_path
);
free_equal
(
h
->
container_full_path
,
h
->
container_limit_path
);
close_equal
(
h
->
cg
fd_con
,
h
->
cgfd_limit
);
close_equal
(
h
->
d
fd_con
,
h
->
cgfd_limit
);
}
else
{
}
else
{
/* Check whether we actually created the cgroup to prune. */
/* Check whether we actually created the cgroup to prune. */
if
(
h
->
cgfd_mon
<
0
)
if
(
h
->
cgfd_mon
<
0
)
...
@@ -1242,11 +1242,11 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
...
@@ -1242,11 +1242,11 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
(
handler
->
clone_flags
&
CLONE_INTO_CGROUP
))
(
handler
->
clone_flags
&
CLONE_INTO_CGROUP
))
continue
;
continue
;
ret
=
lxc_writeat
(
h
->
cg
fd_con
,
"cgroup.procs"
,
pidstr
,
len
);
ret
=
lxc_writeat
(
h
->
d
fd_con
,
"cgroup.procs"
,
pidstr
,
len
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
container_full_path
);
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
container_full_path
);
TRACE
(
"Moved container into %s cgroup via %d"
,
h
->
container_full_path
,
h
->
cg
fd_con
);
TRACE
(
"Moved container into %s cgroup via %d"
,
h
->
container_full_path
,
h
->
d
fd_con
);
}
}
return
true
;
return
true
;
...
@@ -1306,7 +1306,7 @@ static int chown_cgroup_wrapper(void *data)
...
@@ -1306,7 +1306,7 @@ static int chown_cgroup_wrapper(void *data)
destuid
=
0
;
destuid
=
0
;
for
(
int
i
=
0
;
arg
->
hierarchies
[
i
];
i
++
)
{
for
(
int
i
=
0
;
arg
->
hierarchies
[
i
];
i
++
)
{
int
dirfd
=
arg
->
hierarchies
[
i
]
->
cg
fd_con
;
int
dirfd
=
arg
->
hierarchies
[
i
]
->
d
fd_con
;
(
void
)
fchowmodat
(
dirfd
,
""
,
destuid
,
nsgid
,
0775
);
(
void
)
fchowmodat
(
dirfd
,
""
,
destuid
,
nsgid
,
0775
);
...
@@ -1381,7 +1381,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
...
@@ -1381,7 +1381,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
* lot of them.
* lot of them.
*/
*/
if
(
!
is_unified_hierarchy
(
h
))
if
(
!
is_unified_hierarchy
(
h
))
close_prot_errno_disarm
(
h
->
cg
fd_con
);
close_prot_errno_disarm
(
h
->
d
fd_con
);
}
}
/*
/*
...
@@ -1399,7 +1399,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
...
@@ -1399,7 +1399,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
* for our container which means we check here.
* for our container which means we check here.
*/
*/
if
(
pure_unified_layout
(
ops
)
&&
if
(
pure_unified_layout
(
ops
)
&&
!
faccessat
(
ops
->
unified
->
cg
fd_con
,
"cgroup.freeze"
,
F_OK
,
!
faccessat
(
ops
->
unified
->
d
fd_con
,
"cgroup.freeze"
,
F_OK
,
AT_SYMLINK_NOFOLLOW
))
{
AT_SYMLINK_NOFOLLOW
))
{
TRACE
(
"Unified hierarchy supports freezer"
);
TRACE
(
"Unified hierarchy supports freezer"
);
ops
->
unified
->
freezer_controller
=
1
;
ops
->
unified
->
freezer_controller
=
1
;
...
...
src/lxc/cgroups/cgroup.c
View file @
e33870e5
...
@@ -91,7 +91,7 @@ void cgroup_exit(struct cgroup_ops *ops)
...
@@ -91,7 +91,7 @@ void cgroup_exit(struct cgroup_ops *ops)
free_equal
((
*
it
)
->
container_full_path
,
free_equal
((
*
it
)
->
container_full_path
,
(
*
it
)
->
container_limit_path
);
(
*
it
)
->
container_limit_path
);
close_equal
((
*
it
)
->
cg
fd_con
,
(
*
it
)
->
cgfd_limit
);
close_equal
((
*
it
)
->
d
fd_con
,
(
*
it
)
->
cgfd_limit
);
if
((
*
it
)
->
cgfd_mon
>=
0
)
if
((
*
it
)
->
cgfd_mon
>=
0
)
close
((
*
it
)
->
cgfd_mon
);
close
((
*
it
)
->
cgfd_mon
);
...
...
src/lxc/cgroups/cgroup.h
View file @
e33870e5
...
@@ -92,12 +92,12 @@ struct hierarchy {
...
@@ -92,12 +92,12 @@ struct hierarchy {
unsigned
int
freezer_controller
:
1
;
unsigned
int
freezer_controller
:
1
;
/* File descriptor for the container's cgroup @container_full_path. */
/* File descriptor for the container's cgroup @container_full_path. */
int
cg
fd_con
;
int
d
fd_con
;
/*
/*
* File descriptor for the container's limiting cgroup
* File descriptor for the container's limiting cgroup
* @container_limit_path.
* @container_limit_path.
* Will be equal to @
cg
fd_con if no limiting cgroup has been requested.
* Will be equal to @
d
fd_con if no limiting cgroup has been requested.
*/
*/
int
cgfd_limit
;
int
cgfd_limit
;
...
@@ -233,7 +233,7 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops)
...
@@ -233,7 +233,7 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops)
if
(
!
ops
->
unified
)
if
(
!
ops
->
unified
)
return
-
EBADF
;
return
-
EBADF
;
return
ops
->
unified
->
cg
fd_con
;
return
ops
->
unified
->
d
fd_con
;
}
}
#define make_cgroup_path(__hierarchy, __first, ...) \
#define make_cgroup_path(__hierarchy, __first, ...) \
...
...
src/lxc/commands.c
View file @
e33870e5
...
@@ -1519,7 +1519,7 @@ static int lxc_cmd_get_cgroup2_fd_callback_do(int fd, struct lxc_cmd_req *req,
...
@@ -1519,7 +1519,7 @@ static int lxc_cmd_get_cgroup2_fd_callback_do(int fd, struct lxc_cmd_req *req,
return
lxc_cmd_rsp_send
(
fd
,
&
rsp
);
return
lxc_cmd_rsp_send
(
fd
,
&
rsp
);
send_fd
=
limiting_cgroup
?
ops
->
unified
->
cgfd_limit
send_fd
=
limiting_cgroup
?
ops
->
unified
->
cgfd_limit
:
ops
->
unified
->
cg
fd_con
;
:
ops
->
unified
->
d
fd_con
;
rsp
.
ret
=
0
;
rsp
.
ret
=
0
;
ret
=
lxc_abstract_unix_send_fds
(
fd
,
&
send_fd
,
1
,
&
rsp
,
sizeof
(
rsp
));
ret
=
lxc_abstract_unix_send_fds
(
fd
,
&
send_fd
,
1
,
&
rsp
,
sizeof
(
rsp
));
...
...
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