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
59b1b67e
Unverified
Commit
59b1b67e
authored
Mar 15, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: simplify lxc_init()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b78872c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
+8
-19
start.c
src/lxc/start.c
+8
-19
No files found.
src/lxc/start.c
View file @
59b1b67e
...
@@ -731,27 +731,21 @@ int lxc_init(const char *name, struct lxc_handler *handler)
...
@@ -731,27 +731,21 @@ int lxc_init(const char *name, struct lxc_handler *handler)
handler
->
monitor_pid
=
lxc_raw_getpid
();
handler
->
monitor_pid
=
lxc_raw_getpid
();
status_fd
=
open
(
"/proc/self/status"
,
O_RDONLY
|
O_CLOEXEC
);
status_fd
=
open
(
"/proc/self/status"
,
O_RDONLY
|
O_CLOEXEC
);
if
(
status_fd
<
0
)
{
if
(
status_fd
<
0
)
SYSERROR
(
"Failed to open monitor status fd"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to open monitor status fd"
);
goto
out_close_maincmd_fd
;
}
lsm_init
();
lsm_init
();
TRACE
(
"Initialized LSM"
);
TRACE
(
"Initialized LSM"
);
ret
=
lxc_read_seccomp_config
(
conf
);
ret
=
lxc_read_seccomp_config
(
conf
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
ERROR
(
"Failed loading seccomp policy"
);
return
log_error
(
-
1
,
"Failed loading seccomp policy"
);
goto
out_close_maincmd_fd
;
}
TRACE
(
"Read seccomp policy"
);
TRACE
(
"Read seccomp policy"
);
/* Begin by setting the state to STARTING. */
/* Begin by setting the state to STARTING. */
ret
=
lxc_set_state
(
name
,
handler
,
STARTING
);
ret
=
lxc_set_state
(
name
,
handler
,
STARTING
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
ERROR
(
"Failed to set state to
\"
%s
\"
"
,
lxc_state2str
(
STARTING
));
return
log_error
(
-
1
,
"Failed to set state to
\"
%s
\"
"
,
lxc_state2str
(
STARTING
));
goto
out_close_maincmd_fd
;
}
TRACE
(
"Set container state to
\"
STARTING
\"
"
);
TRACE
(
"Set container state to
\"
STARTING
\"
"
);
/* Start of environment variable setup for hooks. */
/* Start of environment variable setup for hooks. */
...
@@ -824,7 +818,7 @@ int lxc_init(const char *name, struct lxc_handler *handler)
...
@@ -824,7 +818,7 @@ int lxc_init(const char *name, struct lxc_handler *handler)
handler
->
sigfd
=
setup_signal_fd
(
&
handler
->
oldmask
);
handler
->
sigfd
=
setup_signal_fd
(
&
handler
->
oldmask
);
if
(
handler
->
sigfd
<
0
)
{
if
(
handler
->
sigfd
<
0
)
{
ERROR
(
"Failed to setup SIGCHLD fd handler."
);
ERROR
(
"Failed to setup SIGCHLD fd handler."
);
goto
out_
delete_tty
;
goto
out_
aborting
;
}
}
TRACE
(
"Set up signal fd"
);
TRACE
(
"Set up signal fd"
);
...
@@ -867,14 +861,9 @@ out_delete_terminal:
...
@@ -867,14 +861,9 @@ out_delete_terminal:
out_restore_sigmask:
out_restore_sigmask:
(
void
)
pthread_sigmask
(
SIG_SETMASK
,
&
handler
->
oldmask
,
NULL
);
(
void
)
pthread_sigmask
(
SIG_SETMASK
,
&
handler
->
oldmask
,
NULL
);
out_delete_tty:
lxc_delete_tty
(
&
conf
->
ttys
);
out_aborting:
out_aborting:
(
void
)
lxc_set_state
(
name
,
handler
,
ABORTING
);
(
void
)
lxc_set_state
(
name
,
handler
,
ABORTING
);
out_close_maincmd_fd:
close_prot_errno_disarm
(
conf
->
maincmd_fd
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1041,7 +1030,7 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
...
@@ -1041,7 +1030,7 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
handler
->
pidfd
,
handler
->
pid
);
handler
->
pidfd
,
handler
->
pid
);
}
}
if
(
!
ret
||
errno
!=
ESRCH
)
if
(
!
ret
||
errno
!=
ESRCH
&&
handler
->
pid
>
0
)
if
(
kill
(
handler
->
pid
,
SIGKILL
))
if
(
kill
(
handler
->
pid
,
SIGKILL
))
SYSWARN
(
"Failed to send SIGKILL to %d"
,
handler
->
pid
);
SYSWARN
(
"Failed to send SIGKILL to %d"
,
handler
->
pid
);
...
...
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