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
a9f0cecf
Unverified
Commit
a9f0cecf
authored
Jan 29, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: use sync_wait()/sync_wake() where applicable
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
946a0c6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
attach.c
src/lxc/attach.c
+6
-6
sync.h
src/lxc/sync.h
+9
-2
No files found.
src/lxc/attach.c
View file @
a9f0cecf
...
...
@@ -42,6 +42,7 @@
#include "mount_utils.h"
#include "namespace.h"
#include "process_utils.h"
#include "sync.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#include "utils.h"
...
...
@@ -1032,7 +1033,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
{
int
ret_parent
=
-
1
;
struct
lxc_epoll_descr
descr
=
{};
int
ret
,
status
;
int
ret
;
char
*
name
,
*
lxcpath
,
*
new_cwd
;
int
ipc_sockets
[
2
];
pid_t
attached_pid
,
pid
,
to_cleanup_pid
;
...
...
@@ -1176,8 +1177,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
}
/* Wait for the parent to have setup cgroups. */
ret
=
lxc_read_nointr
(
ipc_sockets
[
1
],
&
status
,
sizeof
(
status
)
);
if
(
ret
!=
sizeof
(
status
)
)
{
ret
=
sync_wait
(
ipc_sockets
[
1
],
ATTACH_SYNC_CGROUP
);
if
(
ret
)
{
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
put_attach_context
(
ctx
);
_exit
(
EXIT_FAILURE
);
...
...
@@ -1323,9 +1324,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
}
/* Let the child process know to go ahead. */
status
=
0
;
ret
=
lxc_write_nointr
(
ipc_sockets
[
0
],
&
status
,
sizeof
(
status
));
if
(
ret
!=
sizeof
(
status
))
ret
=
sync_wake
(
ipc_sockets
[
0
],
ATTACH_SYNC_CGROUP
);
if
(
ret
)
goto
close_mainloop
;
TRACE
(
"Told intermediate process to start initializing"
);
...
...
src/lxc/sync.h
View file @
a9f0cecf
...
...
@@ -7,7 +7,11 @@
struct
lxc_handler
;
enum
{
enum
/* generic */
{
SYNC_ERROR
=
-
1
/* Used to report errors from another process */
};
enum
/* start */
{
START_SYNC_STARTUP
=
0
,
START_SYNC_CONFIGURE
=
1
,
START_SYNC_POST_CONFIGURE
=
2
,
...
...
@@ -17,7 +21,10 @@ enum {
START_SYNC_READY_START
=
6
,
START_SYNC_RESTART
=
7
,
START_SYNC_POST_RESTART
=
8
,
SYNC_ERROR
=
-
1
/* Used to report errors from another process */
};
enum
/* attach */
{
ATTACH_SYNC_CGROUP
=
0
,
};
__hidden
extern
int
lxc_sync_init
(
struct
lxc_handler
*
handler
);
...
...
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