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
65633592
Unverified
Commit
65633592
authored
May 13, 2020
by
Stéphane Graber
Committed by
GitHub
May 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3410 from brauner/2020-05-13/fixes
reboot fixes
parents
bee9ba72
4e2d6b9a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
78 deletions
+74
-78
criu.c
src/lxc/criu.c
+1
-1
log.c
src/lxc/log.c
+9
-4
log.h
src/lxc/log.h
+2
-1
lxccontainer.c
src/lxc/lxccontainer.c
+16
-27
start.c
src/lxc/start.c
+33
-40
start.h
src/lxc/start.h
+13
-5
No files found.
src/lxc/criu.c
View file @
65633592
...
@@ -942,7 +942,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
...
@@ -942,7 +942,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
close
(
fd
);
close
(
fd
);
}
}
handler
=
lxc_init_handler
(
c
->
name
,
c
->
lxc_conf
,
c
->
config_path
,
false
);
handler
=
lxc_init_handler
(
NULL
,
c
->
name
,
c
->
lxc_conf
,
c
->
config_path
,
false
);
if
(
!
handler
)
if
(
!
handler
)
goto
out
;
goto
out
;
...
...
src/lxc/log.c
View file @
65633592
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
#define LXC_LOG_TIME_SIZE ((INTTYPE_TO_STRLEN(uint64_t)) * 2)
#define LXC_LOG_TIME_SIZE ((INTTYPE_TO_STRLEN(uint64_t)) * 2)
int
lxc_log_fd
=
-
EBADF
;
int
lxc_log_fd
=
-
EBADF
;
static
int
syslog_enable
=
0
;
static
bool
wants_syslog
=
false
;
int
lxc_quiet_specified
;
int
lxc_quiet_specified
;
int
lxc_log_use_global_fd
;
int
lxc_log_use_global_fd
;
static
int
lxc_loglevel_specified
;
static
int
lxc_loglevel_specified
;
...
@@ -128,7 +128,7 @@ static int log_append_syslog(const struct lxc_log_appender *appender,
...
@@ -128,7 +128,7 @@ static int log_append_syslog(const struct lxc_log_appender *appender,
__do_free
char
*
msg
=
NULL
;
__do_free
char
*
msg
=
NULL
;
const
char
*
log_container_name
;
const
char
*
log_container_name
;
if
(
!
syslog_enable
)
if
(
!
wants_syslog
)
return
0
;
return
0
;
log_container_name
=
lxc_log_get_container_name
();
log_container_name
=
lxc_log_get_container_name
();
...
@@ -738,9 +738,14 @@ int lxc_log_syslog(int facility)
...
@@ -738,9 +738,14 @@ int lxc_log_syslog(int facility)
return
0
;
return
0
;
}
}
inline
void
lxc_log_enable_syslog
(
void
)
void
lxc_log_syslog_enable
(
void
)
{
{
syslog_enable
=
1
;
wants_syslog
=
true
;
}
void
lxc_log_syslog_disable
(
void
)
{
wants_syslog
=
false
;
}
}
/*
/*
...
...
src/lxc/log.h
View file @
65633592
...
@@ -563,7 +563,8 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
...
@@ -563,7 +563,8 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
extern
int
lxc_log_fd
;
extern
int
lxc_log_fd
;
extern
int
lxc_log_syslog
(
int
facility
);
extern
int
lxc_log_syslog
(
int
facility
);
extern
void
lxc_log_enable_syslog
(
void
);
extern
void
lxc_log_syslog_enable
(
void
);
extern
void
lxc_log_syslog_disable
(
void
);
extern
int
lxc_log_set_level
(
int
*
dest
,
int
level
);
extern
int
lxc_log_set_level
(
int
*
dest
,
int
level
);
extern
int
lxc_log_get_level
(
void
);
extern
int
lxc_log_get_level
(
void
);
extern
bool
lxc_log_has_valid_level
(
void
);
extern
bool
lxc_log_has_valid_level
(
void
);
...
...
src/lxc/lxccontainer.c
View file @
65633592
...
@@ -830,14 +830,12 @@ static bool wait_on_daemonized_start(struct lxc_handler *handler, int pid)
...
@@ -830,14 +830,12 @@ static bool wait_on_daemonized_start(struct lxc_handler *handler, int pid)
DEBUG
(
"First child %d exited"
,
pid
);
DEBUG
(
"First child %d exited"
,
pid
);
/* Close write end of the socket pair. */
/* Close write end of the socket pair. */
close
(
handler
->
state_socket_pair
[
1
]);
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
1
]);
handler
->
state_socket_pair
[
1
]
=
-
1
;
state
=
lxc_rcv_status
(
handler
->
state_socket_pair
[
0
]);
state
=
lxc_rcv_status
(
handler
->
state_socket_pair
[
0
]);
/* Close read end of the socket pair. */
/* Close read end of the socket pair. */
close
(
handler
->
state_socket_pair
[
0
]);
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
0
]);
handler
->
state_socket_pair
[
0
]
=
-
1
;
if
(
state
<
0
)
{
if
(
state
<
0
)
{
SYSERROR
(
"Failed to receive the container state"
);
SYSERROR
(
"Failed to receive the container state"
);
...
@@ -867,7 +865,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -867,7 +865,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
NULL
,
NULL
,
};
};
char
**
init_cmd
=
NULL
;
char
**
init_cmd
=
NULL
;
int
keepfds
[
3
]
=
{
-
1
,
-
1
,
-
1
};
/* container does exist */
/* container does exist */
if
(
!
c
)
if
(
!
c
)
...
@@ -901,7 +898,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -901,7 +898,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
conf
=
c
->
lxc_conf
;
conf
=
c
->
lxc_conf
;
/* initialize handler */
/* initialize handler */
handler
=
lxc_init_handler
(
c
->
name
,
conf
,
c
->
config_path
,
c
->
daemonize
);
handler
=
lxc_init_handler
(
NULL
,
c
->
name
,
conf
,
c
->
config_path
,
c
->
daemonize
);
container_mem_unlock
(
c
);
container_mem_unlock
(
c
);
if
(
!
handler
)
if
(
!
handler
)
...
@@ -918,7 +915,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -918,7 +915,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
if
(
!
argv
)
{
if
(
!
argv
)
{
if
(
useinit
)
{
if
(
useinit
)
{
ERROR
(
"No valid init detected"
);
ERROR
(
"No valid init detected"
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
return
false
;
return
false
;
}
}
argv
=
default_args
;
argv
=
default_args
;
...
@@ -936,7 +933,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -936,7 +933,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
pid_first
=
fork
();
pid_first
=
fork
();
if
(
pid_first
<
0
)
{
if
(
pid_first
<
0
)
{
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
return
false
;
return
false
;
}
}
...
@@ -953,7 +950,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -953,7 +950,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
started
=
wait_on_daemonized_start
(
handler
,
pid_first
);
started
=
wait_on_daemonized_start
(
handler
,
pid_first
);
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
return
started
;
return
started
;
}
}
...
@@ -985,7 +982,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -985,7 +982,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
/* second parent */
/* second parent */
if
(
pid_second
!=
0
)
{
if
(
pid_second
!=
0
)
{
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
_exit
(
EXIT_SUCCESS
);
_exit
(
EXIT_SUCCESS
);
}
}
...
@@ -998,11 +995,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -998,11 +995,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
}
}
keepfds
[
0
]
=
handler
->
conf
->
maincmd_fd
;
ret
=
inherit_fds
(
handler
,
true
);
keepfds
[
1
]
=
handler
->
state_socket_pair
[
0
];
keepfds
[
2
]
=
handler
->
state_socket_pair
[
1
];
ret
=
lxc_check_inherited
(
conf
,
true
,
keepfds
,
sizeof
(
keepfds
)
/
sizeof
(
keepfds
[
0
]));
if
(
ret
<
0
)
if
(
ret
<
0
)
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
...
@@ -1020,7 +1013,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1020,7 +1013,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
}
else
if
(
!
am_single_threaded
())
{
}
else
if
(
!
am_single_threaded
())
{
ERROR
(
"Cannot start non-daemonized container when threaded"
);
ERROR
(
"Cannot start non-daemonized container when threaded"
);
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
return
false
;
return
false
;
}
}
...
@@ -1034,7 +1027,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1034,7 +1027,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
w
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
lxc_raw_getpid
());
w
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
lxc_raw_getpid
());
if
(
w
<
0
||
(
size_t
)
w
>=
sizeof
(
pidstr
))
{
if
(
w
<
0
||
(
size_t
)
w
>=
sizeof
(
pidstr
))
{
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
SYSERROR
(
"Failed to write monitor pid to
\"
%s
\"
"
,
c
->
pidfile
);
SYSERROR
(
"Failed to write monitor pid to
\"
%s
\"
"
,
c
->
pidfile
);
...
@@ -1047,7 +1040,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1047,7 +1040,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
ret
=
lxc_write_to_file
(
c
->
pidfile
,
pidstr
,
w
,
false
,
0600
);
ret
=
lxc_write_to_file
(
c
->
pidfile
,
pidstr
,
w
,
false
,
0600
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
SYSERROR
(
"Failed to write monitor pid to
\"
%s
\"
"
,
c
->
pidfile
);
SYSERROR
(
"Failed to write monitor pid to
\"
%s
\"
"
,
c
->
pidfile
);
...
@@ -1065,7 +1058,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1065,7 +1058,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
ret
=
unshare
(
CLONE_NEWNS
);
ret
=
unshare
(
CLONE_NEWNS
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to unshare mount namespace"
);
SYSERROR
(
"Failed to unshare mount namespace"
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
ret
=
1
;
ret
=
1
;
goto
on_error
;
goto
on_error
;
}
}
...
@@ -1073,7 +1066,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1073,7 +1066,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
ret
=
mount
(
NULL
,
"/"
,
NULL
,
MS_SLAVE
|
MS_REC
,
NULL
);
ret
=
mount
(
NULL
,
"/"
,
NULL
,
MS_SLAVE
|
MS_REC
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to make / rslave at startup"
);
SYSERROR
(
"Failed to make / rslave at startup"
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
ret
=
1
;
ret
=
1
;
goto
on_error
;
goto
on_error
;
}
}
...
@@ -1082,20 +1075,16 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1082,20 +1075,16 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
reboot
:
reboot
:
if
(
conf
->
reboot
==
REBOOT_INIT
)
{
if
(
conf
->
reboot
==
REBOOT_INIT
)
{
/* initialize handler */
/* initialize handler */
handler
=
lxc_init_handler
(
c
->
name
,
conf
,
c
->
config_path
,
c
->
daemonize
);
handler
=
lxc_init_handler
(
handler
,
c
->
name
,
conf
,
c
->
config_path
,
c
->
daemonize
);
if
(
!
handler
)
{
if
(
!
handler
)
{
ret
=
1
;
ret
=
1
;
goto
on_error
;
goto
on_error
;
}
}
}
}
keepfds
[
0
]
=
handler
->
conf
->
maincmd_fd
;
ret
=
inherit_fds
(
handler
,
c
->
daemonize
);
keepfds
[
1
]
=
handler
->
state_socket_pair
[
0
];
keepfds
[
2
]
=
handler
->
state_socket_pair
[
1
];
ret
=
lxc_check_inherited
(
conf
,
c
->
daemonize
,
keepfds
,
sizeof
(
keepfds
)
/
sizeof
(
keepfds
[
0
]));
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
ret
=
1
;
ret
=
1
;
goto
on_error
;
goto
on_error
;
}
}
...
...
src/lxc/start.c
View file @
65633592
...
@@ -212,6 +212,13 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
...
@@ -212,6 +212,13 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
if
(
conf
&&
conf
->
close_all_fds
)
if
(
conf
&&
conf
->
close_all_fds
)
closeall
=
true
;
closeall
=
true
;
/*
* Disable syslog at this point to avoid the above logging
* function to open a new fd and make the check_inherited function
* enter an infinite loop.
*/
lxc_log_syslog_disable
();
restart:
restart:
dir
=
opendir
(
"/proc/self/fd"
);
dir
=
opendir
(
"/proc/self/fd"
);
if
(
!
dir
)
if
(
!
dir
)
...
@@ -272,21 +279,24 @@ restart:
...
@@ -272,21 +279,24 @@ restart:
#endif
#endif
if
(
closeall
)
{
if
(
closeall
)
{
close
(
fd
);
if
(
close
(
fd
))
closedir
(
dir
);
SYSINFO
(
"Closed inherited fd %d"
,
fd
);
else
INFO
(
"Closed inherited fd %d"
,
fd
);
INFO
(
"Closed inherited fd %d"
,
fd
);
closedir
(
dir
);
goto
restart
;
goto
restart
;
}
}
WARN
(
"Inherited fd %d"
,
fd
);
WARN
(
"Inherited fd %d"
,
fd
);
}
}
closedir
(
dir
);
/* Only enable syslog at this point to avoid the above logging function
/*
* to open a new fd and make the check_inherited function enter an
* Only enable syslog at this point to avoid the above logging
* infinite loop.
* function to open a new fd and make the check_inherited function
* enter an infinite loop.
*/
*/
lxc_log_
enable_syslog
();
lxc_log_
syslog_enable
();
closedir
(
dir
);
/* cannot fail */
return
0
;
return
0
;
}
}
...
@@ -605,32 +615,7 @@ out_sigfd:
...
@@ -605,32 +615,7 @@ out_sigfd:
return
ret
;
return
ret
;
}
}
void
lxc_zero_handler
(
struct
lxc_handler
*
handler
)
void
lxc_put_handler
(
struct
lxc_handler
*
handler
)
{
memset
(
handler
,
0
,
sizeof
(
struct
lxc_handler
));
handler
->
state
=
STOPPED
;
handler
->
pinfd
=
-
EBADF
;
handler
->
pidfd
=
-
EBADF
;
handler
->
sigfd
=
-
EBADF
;
for
(
int
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
handler
->
nsfd
[
i
]
=
-
EBADF
;
handler
->
data_sock
[
0
]
=
-
EBADF
;
handler
->
data_sock
[
1
]
=
-
EBADF
;
handler
->
state_socket_pair
[
0
]
=
-
EBADF
;
handler
->
state_socket_pair
[
1
]
=
-
EBADF
;
handler
->
sync_sock
[
0
]
=
-
EBADF
;
handler
->
sync_sock
[
1
]
=
-
EBADF
;
}
void
lxc_free_handler
(
struct
lxc_handler
*
handler
)
{
{
close_prot_errno_disarm
(
handler
->
pinfd
);
close_prot_errno_disarm
(
handler
->
pinfd
);
close_prot_errno_disarm
(
handler
->
pidfd
);
close_prot_errno_disarm
(
handler
->
pidfd
);
...
@@ -642,22 +627,27 @@ void lxc_free_handler(struct lxc_handler *handler)
...
@@ -642,22 +627,27 @@ void lxc_free_handler(struct lxc_handler *handler)
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
0
]);
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
0
]);
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
1
]);
close_prot_errno_disarm
(
handler
->
state_socket_pair
[
1
]);
cgroup_exit
(
handler
->
cgroup_ops
);
cgroup_exit
(
handler
->
cgroup_ops
);
handler
->
conf
=
NULL
;
if
(
handler
->
conf
&&
handler
->
conf
->
reboot
==
REBOOT_NONE
)
free_disarm
(
handler
);
free_disarm
(
handler
);
else
handler
->
conf
=
NULL
;
}
}
struct
lxc_handler
*
lxc_init_handler
(
const
char
*
name
,
struct
lxc_conf
*
conf
,
struct
lxc_handler
*
lxc_init_handler
(
struct
lxc_handler
*
old
,
const
char
*
name
,
struct
lxc_conf
*
conf
,
const
char
*
lxcpath
,
bool
daemonize
)
const
char
*
lxcpath
,
bool
daemonize
)
{
{
int
nr_keep_fds
=
0
;
int
ret
;
int
ret
;
struct
lxc_handler
*
handler
;
struct
lxc_handler
*
handler
;
handler
=
malloc
(
sizeof
(
*
handler
));
if
(
!
old
)
handler
=
zalloc
(
sizeof
(
*
handler
));
else
handler
=
old
;
if
(
!
handler
)
if
(
!
handler
)
return
NULL
;
return
NULL
;
memset
(
handler
,
0
,
sizeof
(
*
handler
));
/* Note that am_guest_unpriv() checks the effective uid. We
/* Note that am_guest_unpriv() checks the effective uid. We
* probably don't care if we are real root only if we are running
* probably don't care if we are real root only if we are running
* as root so this should be fine.
* as root so this should be fine.
...
@@ -701,6 +691,8 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
...
@@ -701,6 +691,8 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
TRACE
(
"Created anonymous pair {%d,%d} of unix sockets"
,
TRACE
(
"Created anonymous pair {%d,%d} of unix sockets"
,
handler
->
state_socket_pair
[
0
],
handler
->
state_socket_pair
[
0
],
handler
->
state_socket_pair
[
1
]);
handler
->
state_socket_pair
[
1
]);
handler
->
keep_fds
[
nr_keep_fds
++
]
=
handler
->
state_socket_pair
[
0
];
handler
->
keep_fds
[
nr_keep_fds
++
]
=
handler
->
state_socket_pair
[
1
];
}
}
if
(
handler
->
conf
->
reboot
==
REBOOT_NONE
)
{
if
(
handler
->
conf
->
reboot
==
REBOOT_NONE
)
{
...
@@ -709,6 +701,7 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
...
@@ -709,6 +701,7 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
ERROR
(
"Failed to set up command socket"
);
ERROR
(
"Failed to set up command socket"
);
goto
on_error
;
goto
on_error
;
}
}
handler
->
keep_fds
[
nr_keep_fds
++
]
=
handler
->
conf
->
maincmd_fd
;
}
}
TRACE
(
"Unix domain socket %d for command server is ready"
,
TRACE
(
"Unix domain socket %d for command server is ready"
,
...
@@ -717,7 +710,7 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
...
@@ -717,7 +710,7 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
return
handler
;
return
handler
;
on_error:
on_error:
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1008,7 +1001,7 @@ void lxc_end(struct lxc_handler *handler)
...
@@ -1008,7 +1001,7 @@ void lxc_end(struct lxc_handler *handler)
if
(
handler
->
conf
->
ephemeral
==
1
&&
handler
->
conf
->
reboot
!=
REBOOT_REQ
)
if
(
handler
->
conf
->
ephemeral
==
1
&&
handler
->
conf
->
reboot
!=
REBOOT_REQ
)
lxc_destroy_container_on_signal
(
handler
,
name
);
lxc_destroy_container_on_signal
(
handler
,
name
);
lxc_
free
_handler
(
handler
);
lxc_
put
_handler
(
handler
);
}
}
void
lxc_abort
(
struct
lxc_handler
*
handler
)
void
lxc_abort
(
struct
lxc_handler
*
handler
)
...
...
src/lxc/start.h
View file @
65633592
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <sys/un.h>
#include <sys/un.h>
#include "conf.h"
#include "conf.h"
#include "macro.h"
#include "namespace.h"
#include "namespace.h"
#include "state.h"
#include "state.h"
...
@@ -122,6 +123,9 @@ struct lxc_handler {
...
@@ -122,6 +123,9 @@ struct lxc_handler {
int
exit_status
;
int
exit_status
;
struct
cgroup_ops
*
cgroup_ops
;
struct
cgroup_ops
*
cgroup_ops
;
/* Internal fds that always need to stay open. */
int
keep_fds
[
3
];
};
};
struct
execute_args
{
struct
execute_args
{
...
@@ -143,12 +147,11 @@ extern int lxc_serve_state_clients(const char *name,
...
@@ -143,12 +147,11 @@ extern int lxc_serve_state_clients(const char *name,
struct
lxc_handler
*
handler
,
struct
lxc_handler
*
handler
,
lxc_state_t
state
);
lxc_state_t
state
);
extern
void
lxc_abort
(
struct
lxc_handler
*
handler
);
extern
void
lxc_abort
(
struct
lxc_handler
*
handler
);
extern
struct
lxc_handler
*
lxc_init_handler
(
const
char
*
name
,
extern
struct
lxc_handler
*
lxc_init_handler
(
struct
lxc_handler
*
old
,
const
char
*
name
,
struct
lxc_conf
*
conf
,
struct
lxc_conf
*
conf
,
const
char
*
lxcpath
,
const
char
*
lxcpath
,
bool
daemonize
);
bool
daemonize
);
extern
void
lxc_put_handler
(
struct
lxc_handler
*
handler
);
extern
void
lxc_zero_handler
(
struct
lxc_handler
*
handler
);
extern
void
lxc_free_handler
(
struct
lxc_handler
*
handler
);
extern
int
lxc_init
(
const
char
*
name
,
struct
lxc_handler
*
handler
);
extern
int
lxc_init
(
const
char
*
name
,
struct
lxc_handler
*
handler
);
extern
void
lxc_end
(
struct
lxc_handler
*
handler
);
extern
void
lxc_end
(
struct
lxc_handler
*
handler
);
...
@@ -161,6 +164,11 @@ extern void lxc_end(struct lxc_handler *handler);
...
@@ -161,6 +164,11 @@ extern void lxc_end(struct lxc_handler *handler);
*/
*/
extern
int
lxc_check_inherited
(
struct
lxc_conf
*
conf
,
bool
closeall
,
extern
int
lxc_check_inherited
(
struct
lxc_conf
*
conf
,
bool
closeall
,
int
*
fds_to_ignore
,
size_t
len_fds
);
int
*
fds_to_ignore
,
size_t
len_fds
);
static
inline
int
inherit_fds
(
struct
lxc_handler
*
handler
,
bool
closeall
)
{
return
lxc_check_inherited
(
handler
->
conf
,
closeall
,
handler
->
keep_fds
,
ARRAY_SIZE
(
handler
->
keep_fds
));
}
extern
int
__lxc_start
(
struct
lxc_handler
*
,
struct
lxc_operations
*
,
void
*
,
extern
int
__lxc_start
(
struct
lxc_handler
*
,
struct
lxc_operations
*
,
void
*
,
const
char
*
,
bool
,
int
*
);
const
char
*
,
bool
,
int
*
);
...
...
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