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
773fb9ca
Commit
773fb9ca
authored
Sep 04, 2012
by
Serge Hallyn
Committed by
Stéphane Graber
Oct 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace HOOK define with proper code.
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
8215fe8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
11 deletions
+16
-11
conf.c
src/lxc/conf.c
+5
-1
conf.h
src/lxc/conf.h
+0
-6
start.c
src/lxc/start.c
+11
-4
No files found.
src/lxc/conf.c
View file @
773fb9ca
...
...
@@ -2181,7 +2181,11 @@ int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
return
-
1
;
}
HOOK
(
name
,
"mount"
,
lxc_conf
);
if
(
run_lxc_hooks
(
name
,
"mount"
,
lxc_conf
))
{
ERROR
(
"failed to run mount hooks for container '%s'."
,
name
);
return
-
1
;
}
if
(
setup_cgroup
(
name
,
&
lxc_conf
->
cgroup
))
{
ERROR
(
"failed to setup the cgroups for '%s'"
,
name
);
return
-
1
;
...
...
src/lxc/conf.h
View file @
773fb9ca
...
...
@@ -232,12 +232,6 @@ struct lxc_conf {
};
int
run_lxc_hooks
(
const
char
*
name
,
char
*
hook
,
struct
lxc_conf
*
conf
);
/* we don't want to stick with the HOOK define, it's just to easily start */
#define HOOK(name, which, conf) \
do { \
int hookret = run_lxc_hooks(name, which, conf); \
if (hookret) return -1; \
} while (0);
/*
* Initialize the lxc configuration structure
...
...
src/lxc/start.c
View file @
773fb9ca
...
...
@@ -359,7 +359,10 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf)
goto
out_free_name
;
}
HOOK
(
name
,
"pre-start"
,
conf
);
if
(
run_lxc_hooks
(
name
,
"pre-start"
,
conf
))
{
ERROR
(
"failed to run pre-start hooks for container '%s'."
,
name
);
goto
out_aborting
;
}
if
(
lxc_create_tty
(
name
,
conf
))
{
ERROR
(
"failed to create the ttys"
);
...
...
@@ -405,7 +408,8 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
lxc_set_state
(
name
,
handler
,
STOPPING
);
lxc_set_state
(
name
,
handler
,
STOPPED
);
HOOK
(
name
,
"post-stop"
,
handler
->
conf
);
if
(
run_lxc_hooks
(
name
,
"post-stop"
,
handler
->
conf
))
ERROR
(
"failed to run post-stop hooks for container '%s'."
,
name
);
/* reset mask set by setup_signal_fd */
if
(
sigprocmask
(
SIG_SETMASK
,
&
handler
->
oldmask
,
NULL
))
...
...
@@ -526,9 +530,12 @@ static int do_start(void *data)
if
(
apparmor_load
(
handler
)
<
0
)
goto
out_warn_father
;
close
(
handler
->
sigfd
);
if
(
run_lxc_hooks
(
handler
->
name
,
"start"
,
handler
->
conf
))
{
ERROR
(
"failed to run start hooks for container '%s'."
,
handler
->
name
);
goto
out_warn_father
;
}
HOOK
(
handler
->
name
,
"start"
,
handler
->
conf
);
close
(
handler
->
sigfd
);
/* after this call, we are in error because this
* ops should not return as it execs */
...
...
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