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
dcb579a2
Unverified
Commit
dcb579a2
authored
Dec 24, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: add lxc_pty_map_ids()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
fd543fe0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
21 deletions
+27
-21
conf.c
src/lxc/conf.c
+0
-18
conf.h
src/lxc/conf.h
+0
-1
console.c
src/lxc/console.c
+22
-0
console.h
src/lxc/console.h
+1
-0
start.c
src/lxc/start.c
+2
-1
lxc_attach.c
src/lxc/tools/lxc_attach.c
+2
-1
No files found.
src/lxc/conf.c
View file @
dcb579a2
...
...
@@ -2864,24 +2864,6 @@ int chown_mapped_root(char *path, struct lxc_conf *conf)
return
ret
;
}
int
lxc_ttys_shift_ids
(
struct
lxc_conf
*
c
)
{
if
(
lxc_list_empty
(
&
c
->
id_map
))
return
0
;
if
(
!
strcmp
(
c
->
console
.
name
,
""
))
return
0
;
if
(
chown_mapped_root
(
c
->
console
.
name
,
c
)
<
0
)
{
ERROR
(
"failed to chown console
\"
%s
\"
"
,
c
->
console
.
name
);
return
-
1
;
}
TRACE
(
"chowned console
\"
%s
\"
"
,
c
->
console
.
name
);
return
0
;
}
/* NOTE: Must not be called from inside the container namespace! */
int
lxc_create_tmp_proc_mount
(
struct
lxc_conf
*
conf
)
{
...
...
src/lxc/conf.h
View file @
dcb579a2
...
...
@@ -348,7 +348,6 @@ extern int lxc_setup(struct lxc_handler *handler);
extern
int
find_unmapped_nsid
(
struct
lxc_conf
*
conf
,
enum
idtype
idtype
);
extern
int
mapped_hostid
(
unsigned
id
,
struct
lxc_conf
*
conf
,
enum
idtype
idtype
);
extern
int
chown_mapped_root
(
char
*
path
,
struct
lxc_conf
*
conf
);
extern
int
lxc_ttys_shift_ids
(
struct
lxc_conf
*
c
);
extern
int
userns_exec_1
(
struct
lxc_conf
*
conf
,
int
(
*
fn
)(
void
*
),
void
*
data
,
const
char
*
fn_name
);
extern
int
userns_exec_full
(
struct
lxc_conf
*
conf
,
int
(
*
fn
)(
void
*
),
...
...
src/lxc/console.c
View file @
dcb579a2
...
...
@@ -910,3 +910,25 @@ void lxc_pty_conf_free(struct lxc_console *console)
free
(
console
->
log_path
);
free
(
console
->
path
);
}
int
lxc_pty_map_ids
(
struct
lxc_conf
*
c
,
struct
lxc_console
*
pty
)
{
int
ret
;
if
(
lxc_list_empty
(
&
c
->
id_map
))
return
0
;
ret
=
strcmp
(
pty
->
name
,
""
);
if
(
ret
==
0
)
return
0
;
ret
=
chown_mapped_root
(
pty
->
name
,
c
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to chown
\"
%s
\"
"
,
pty
->
name
);
return
-
1
;
}
TRACE
(
"Chowned
\"
%s
\"
"
,
pty
->
name
);
return
0
;
}
src/lxc/console.h
View file @
dcb579a2
...
...
@@ -235,5 +235,6 @@ extern int lxc_login_pty(int fd);
extern
void
lxc_pty_conf_free
(
struct
lxc_console
*
console
);
extern
void
lxc_pty_info_init
(
struct
lxc_pty_info
*
pty
);
extern
void
lxc_pty_init
(
struct
lxc_console
*
pty
);
extern
int
lxc_pty_map_ids
(
struct
lxc_conf
*
c
,
struct
lxc_console
*
pty
);
#endif
src/lxc/start.c
View file @
dcb579a2
...
...
@@ -749,7 +749,8 @@ int lxc_init(const char *name, struct lxc_handler *handler)
}
TRACE
(
"Created console"
);
if
(
lxc_ttys_shift_ids
(
conf
)
<
0
)
{
ret
=
lxc_pty_map_ids
(
conf
,
&
conf
->
console
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to shift tty into container."
);
goto
out_restore_sigmask
;
}
...
...
src/lxc/tools/lxc_attach.c
View file @
dcb579a2
...
...
@@ -338,7 +338,8 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
conf
->
console
.
descr
=
&
descr
;
/* Shift ttys to container. */
if
(
lxc_ttys_shift_ids
(
conf
)
<
0
)
{
ret
=
lxc_pty_map_ids
(
conf
,
&
conf
->
console
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Failed to shift tty into container
\n
"
);
goto
err1
;
}
...
...
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