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
d71e4764
Unverified
Commit
d71e4764
authored
Feb 04, 2021
by
Stéphane Graber
Committed by
GitHub
Feb 04, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3655 from brauner/2021-02-04/fixes_1
Tiny fixes in attach and utils
parents
5ee510d6
7f40f061
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
attach.c
src/lxc/attach.c
+9
-11
utils.c
src/lxc/utils.c
+2
-0
No files found.
src/lxc/attach.c
View file @
d71e4764
...
...
@@ -1472,7 +1472,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
* that.
*
* IPC mechanism: (X is receiver)
* initial process
intermediate attached
* initial process
transient process attached process
* X <--- send pid of
* attached proc,
* then exit
...
...
@@ -1495,7 +1495,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
return
log_error_errno
(
-
1
,
errno
,
"Could not set up required IPC mechanism for attaching"
);
}
/* Create
intermediate sub
process, two reasons:
/* Create
transient
process, two reasons:
* 1. We can't setns() in the child itself, since we want to make
* sure we are properly attached to the pidns.
* 2. Also, the initial thread has to put the attached process
...
...
@@ -1533,8 +1533,6 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
_exit
(
EXIT_FAILURE
);
}
TRACE
(
"Intermediate process starting to initialize"
);
cwd
=
getcwd
(
NULL
,
0
);
/*
...
...
@@ -1597,6 +1595,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
/* Does not return. */
do_attach
(
&
ap
);
}
TRACE
(
"Attached process %d started initializing"
,
pid
);
if
(
options
->
attach_flags
&
LXC_ATTACH_TERMINAL
)
lxc_attach_terminal_close_pts
(
&
terminal
);
...
...
@@ -1614,12 +1613,11 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
_exit
(
EXIT_FAILURE
);
}
TRACE
(
"Sending pid %d of attached process"
,
pid
);
/* The rest is in the hands of the initial and the attached process. */
put_attach_context
(
ctx
);
_exit
(
EXIT_SUCCESS
);
}
TRACE
(
"Transient process %d started initializing"
,
pid
);
to_cleanup_pid
=
pid
;
...
...
@@ -1652,7 +1650,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
goto
on_error
;
}
TRACE
(
"Moved
intermediate process %d into container's cgroups
"
,
pid
);
TRACE
(
"Moved
transient process %d into container cgroup
"
,
pid
);
}
/* Setup /proc limits */
...
...
@@ -1685,9 +1683,9 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
if
(
!
sync_wake
(
ipc_sockets
[
0
],
ATTACH_SYNC_CGROUP
))
goto
close_mainloop
;
TRACE
(
"Told
intermediate
process to start initializing"
);
TRACE
(
"Told
transient
process to start initializing"
);
/* Get pid of attached process from
intermediate
process. */
/* Get pid of attached process from
transient
process. */
if
(
!
sync_wait_pid
(
ipc_sockets
[
0
],
ATTACH_SYNC_PID
(
&
attached_pid
)))
goto
close_mainloop
;
...
...
@@ -1699,12 +1697,12 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
signal
(
SIGQUIT
,
SIG_IGN
);
}
/* Reap
intermediate
process. */
/* Reap
transient
process. */
ret
=
wait_for_pid
(
pid
);
if
(
ret
<
0
)
goto
close_mainloop
;
TRACE
(
"
Intermediate
process %d exited"
,
pid
);
TRACE
(
"
Transient
process %d exited"
,
pid
);
/* We will always have to reap the attached process now. */
to_cleanup_pid
=
attached_pid
;
...
...
src/lxc/utils.c
View file @
d71e4764
...
...
@@ -1301,6 +1301,8 @@ int mount_from_at(int dfd_from, const char *path_from,
ret
=
snprintf
(
dst_buf
,
sizeof
(
dst_buf
),
"/proc/self/fd/%d"
,
fd_to
);
}
if
(
ret
<
0
||
ret
>=
sizeof
(
src_buf
))
return
-
EIO
;
if
(
is_empty_string
(
src_buf
))
ret
=
mount
(
NULL
,
dst_buf
,
fstype
,
mnt_flags
,
data
);
...
...
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