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
9c3eb8d5
Unverified
Commit
9c3eb8d5
authored
Feb 22, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: introduce rsp_many_fds()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c2f40088
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
commands.c
src/lxc/commands.c
+50
-0
No files found.
src/lxc/commands.c
View file @
9c3eb8d5
...
...
@@ -250,6 +250,18 @@ static inline int rsp_one_fd(int fd, int fd_send, struct lxc_cmd_rsp *rsp)
return
LXC_CMD_REAP_CLIENT_FD
;
}
static
inline
int
rsp_many_fds
(
int
fd
,
struct
unix_fds
*
fds
,
struct
lxc_cmd_rsp
*
rsp
)
{
int
ret
;
ret
=
lxc_abstract_unix_send_fds
(
fd
,
fds
->
fd
,
fds
->
fd_count_max
,
rsp
,
sizeof
(
*
rsp
));
if
(
ret
<
0
)
return
ret
;
return
LXC_CMD_REAP_CLIENT_FD
;
}
static
int
lxc_cmd_send
(
const
char
*
name
,
struct
lxc_cmd_rr
*
cmd
,
const
char
*
lxcpath
,
const
char
*
hashed_sock_name
)
{
...
...
@@ -545,6 +557,44 @@ static int lxc_cmd_get_seccomp_notify_fd_callback(int fd, struct lxc_cmd_req *re
#endif
}
int
lxc_cmd_get_cgroup_fd
(
const
char
*
name
,
const
char
*
lxcpath
,
const
char
*
controller
,
bool
batch
,
struct
unix_fds
*
ret_fds
)
{
int
ret
,
stopped
;
struct
lxc_cmd_rr
cmd
=
{
.
req
=
{
.
cmd
=
LXC_CMD_GET_CGROUP_FD
,
},
};
if
(
batch
&&
!
is_empty_string
(
controller
))
return
ret_errno
(
EINVAL
);
ret
=
lxc_cmd
(
name
,
&
cmd
,
&
stopped
,
lxcpath
,
NULL
);
if
(
ret
<
0
)
return
log_debug_errno
(
-
1
,
errno
,
"Failed to process cgroup fd command"
);
if
(
cmd
.
rsp
.
ret
<
0
)
return
log_debug_errno
(
-
EBADF
,
errno
,
"Failed to receive cgroup fds"
);
return
0
;
}
static
int
lxc_cmd_get_cgroup_fd_callback
(
int
fd
,
struct
lxc_cmd_req
*
req
,
struct
lxc_handler
*
handler
,
struct
lxc_epoll_descr
*
descr
)
{
struct
cgroup_ops
*
cgroup_ops
=
handler
->
cgroup_ops
;
struct
lxc_cmd_rsp
rsp
=
{};
struct
unix_fds
fds
=
{};
fds
.
fd_count_max
=
cgroup_fds
(
cgroup_ops
,
fds
.
fd
);
if
(
fds
.
fd_count_max
==
0
)
rsp
.
ret
=
-
ENOENT
;
return
rsp_many_fds
(
fd
,
&
fds
,
&
rsp
);
}
/*
* lxc_cmd_get_clone_flags: Get clone flags container was spawned with
*
...
...
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