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
111ed96e
Unverified
Commit
111ed96e
authored
May 21, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: move file descriptor synchronization with parent into single function
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
493ae3fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
26 deletions
+31
-26
conf.c
src/lxc/conf.c
+28
-2
conf.h
src/lxc/conf.h
+1
-2
start.c
src/lxc/start.c
+2
-22
No files found.
src/lxc/conf.c
View file @
111ed96e
...
@@ -1184,7 +1184,7 @@ on_error:
...
@@ -1184,7 +1184,7 @@ on_error:
return
-
1
;
return
-
1
;
}
}
int
lxc_send_ttys_to_parent
(
struct
lxc_handler
*
handler
)
static
int
lxc_send_ttys_to_parent
(
struct
lxc_handler
*
handler
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -1750,7 +1750,7 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler)
...
@@ -1750,7 +1750,7 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler)
return
0
;
return
0
;
}
}
int
lxc_send_devpts_to_parent
(
struct
lxc_handler
*
handler
)
static
int
lxc_send_devpts_to_parent
(
struct
lxc_handler
*
handler
)
{
{
int
ret
;
int
ret
;
...
@@ -4078,6 +4078,32 @@ int lxc_sync_fds_parent(struct lxc_handler *handler)
...
@@ -4078,6 +4078,32 @@ int lxc_sync_fds_parent(struct lxc_handler *handler)
return
0
;
return
0
;
}
}
int
lxc_sync_fds_child
(
struct
lxc_handler
*
handler
)
{
int
ret
;
ret
=
lxc_seccomp_send_notifier_fd
(
&
handler
->
conf
->
seccomp
,
handler
->
data_sock
[
0
]);
if
(
ret
<
0
)
return
syserror_ret
(
ret
,
"Failed to send seccomp notify fd to parent"
);
ret
=
lxc_send_devpts_to_parent
(
handler
);
if
(
ret
<
0
)
return
syserror_ret
(
ret
,
"Failed to send seccomp devpts fd to parent"
);
ret
=
lxc_send_ttys_to_parent
(
handler
);
if
(
ret
<
0
)
return
syserror_ret
(
ret
,
"Failed to send tty file descriptors to parent"
);
if
(
handler
->
ns_clone_flags
&
CLONE_NEWNET
)
{
ret
=
lxc_network_send_name_and_ifindex_to_parent
(
handler
);
if
(
ret
<
0
)
return
syserror_ret
(
ret
,
"Failed to send network device names and ifindices to parent"
);
}
TRACE
(
"Finished syncing file descriptors with parent"
);
return
0
;
}
int
lxc_setup
(
struct
lxc_handler
*
handler
)
int
lxc_setup
(
struct
lxc_handler
*
handler
)
{
{
int
ret
;
int
ret
;
...
...
src/lxc/conf.h
View file @
111ed96e
...
@@ -517,8 +517,6 @@ __hidden extern int lxc_idmapped_mounts_parent(struct lxc_handler *handler);
...
@@ -517,8 +517,6 @@ __hidden extern int lxc_idmapped_mounts_parent(struct lxc_handler *handler);
__hidden
extern
int
lxc_map_ids
(
struct
lxc_list
*
idmap
,
pid_t
pid
);
__hidden
extern
int
lxc_map_ids
(
struct
lxc_list
*
idmap
,
pid_t
pid
);
__hidden
extern
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_conf
*
conf
);
__hidden
extern
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_conf
*
conf
);
__hidden
extern
void
lxc_delete_tty
(
struct
lxc_tty_info
*
ttys
);
__hidden
extern
void
lxc_delete_tty
(
struct
lxc_tty_info
*
ttys
);
__hidden
extern
int
lxc_send_ttys_to_parent
(
struct
lxc_handler
*
handler
);
__hidden
extern
int
lxc_send_devpts_to_parent
(
struct
lxc_handler
*
handler
);
__hidden
extern
int
lxc_clear_config_caps
(
struct
lxc_conf
*
c
);
__hidden
extern
int
lxc_clear_config_caps
(
struct
lxc_conf
*
c
);
__hidden
extern
int
lxc_clear_config_keepcaps
(
struct
lxc_conf
*
c
);
__hidden
extern
int
lxc_clear_config_keepcaps
(
struct
lxc_conf
*
c
);
__hidden
extern
int
lxc_clear_cgroups
(
struct
lxc_conf
*
c
,
const
char
*
key
,
int
version
);
__hidden
extern
int
lxc_clear_cgroups
(
struct
lxc_conf
*
c
,
const
char
*
key
,
int
version
);
...
@@ -583,6 +581,7 @@ static inline int chown_mapped_root(const char *path, const struct lxc_conf *con
...
@@ -583,6 +581,7 @@ static inline int chown_mapped_root(const char *path, const struct lxc_conf *con
}
}
__hidden
extern
int
lxc_sync_fds_parent
(
struct
lxc_handler
*
handler
);
__hidden
extern
int
lxc_sync_fds_parent
(
struct
lxc_handler
*
handler
);
__hidden
extern
int
lxc_sync_fds_child
(
struct
lxc_handler
*
handler
);
static
inline
const
char
*
get_rootfs_mnt
(
const
struct
lxc_rootfs
*
rootfs
)
static
inline
const
char
*
get_rootfs_mnt
(
const
struct
lxc_rootfs
*
rootfs
)
{
{
...
...
src/lxc/start.c
View file @
111ed96e
...
@@ -1330,32 +1330,12 @@ static int do_start(void *data)
...
@@ -1330,32 +1330,12 @@ static int do_start(void *data)
if
(
!
lxc_sync_barrier_parent
(
handler
,
START_SYNC_CGROUP_LIMITS
))
if
(
!
lxc_sync_barrier_parent
(
handler
,
START_SYNC_CGROUP_LIMITS
))
goto
out_warn_father
;
goto
out_warn_father
;
ret
=
lxc_s
eccomp_send_notifier_fd
(
&
handler
->
conf
->
seccomp
,
data_sock0
);
ret
=
lxc_s
ync_fds_child
(
handler
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to s
end seccomp notify fd to
parent"
);
SYSERROR
(
"Failed to s
ync file descriptors with
parent"
);
goto
out_warn_father
;
goto
out_warn_father
;
}
}
ret
=
lxc_send_devpts_to_parent
(
handler
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to send seccomp devpts fd to parent"
);
goto
out_warn_father
;
}
ret
=
lxc_send_ttys_to_parent
(
handler
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to send tty file descriptors to parent"
);
goto
out_warn_father
;
}
if
(
handler
->
ns_clone_flags
&
CLONE_NEWNET
)
{
ret
=
lxc_network_send_name_and_ifindex_to_parent
(
handler
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to send network device names and ifindices to parent"
);
goto
out_warn_father
;
}
}
if
(
!
lxc_sync_wait_parent
(
handler
,
START_SYNC_READY_START
))
if
(
!
lxc_sync_wait_parent
(
handler
,
START_SYNC_READY_START
))
goto
out_warn_father
;
goto
out_warn_father
;
...
...
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