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
fb87aa6a
Unverified
Commit
fb87aa6a
authored
Feb 27, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: s/peerpty/proxy/
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0ed9b1bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
conf.c
src/lxc/conf.c
+3
-3
terminal.c
src/lxc/terminal.c
+18
-18
terminal.h
src/lxc/terminal.h
+1
-1
No files found.
src/lxc/conf.c
View file @
fb87aa6a
...
@@ -2613,9 +2613,9 @@ struct lxc_conf *lxc_conf_init(void)
...
@@ -2613,9 +2613,9 @@ struct lxc_conf *lxc_conf_init(void)
new
->
console
.
log_size
=
0
;
new
->
console
.
log_size
=
0
;
new
->
console
.
path
=
NULL
;
new
->
console
.
path
=
NULL
;
new
->
console
.
peer
=
-
1
;
new
->
console
.
peer
=
-
1
;
new
->
console
.
p
eerpt
y
.
busy
=
-
1
;
new
->
console
.
p
rox
y
.
busy
=
-
1
;
new
->
console
.
p
eerpt
y
.
master
=
-
1
;
new
->
console
.
p
rox
y
.
master
=
-
1
;
new
->
console
.
p
eerpt
y
.
slave
=
-
1
;
new
->
console
.
p
rox
y
.
slave
=
-
1
;
new
->
console
.
master
=
-
1
;
new
->
console
.
master
=
-
1
;
new
->
console
.
slave
=
-
1
;
new
->
console
.
slave
=
-
1
;
new
->
console
.
name
[
0
]
=
'\0'
;
new
->
console
.
name
[
0
]
=
'\0'
;
...
...
src/lxc/terminal.c
View file @
fb87aa6a
...
@@ -515,12 +515,12 @@ static void lxc_terminal_peer_proxy_free(struct lxc_terminal *terminal)
...
@@ -515,12 +515,12 @@ static void lxc_terminal_peer_proxy_free(struct lxc_terminal *terminal)
lxc_terminal_signal_fini
(
terminal
->
tty_state
);
lxc_terminal_signal_fini
(
terminal
->
tty_state
);
terminal
->
tty_state
=
NULL
;
terminal
->
tty_state
=
NULL
;
}
}
close
(
terminal
->
p
eerpt
y
.
master
);
close
(
terminal
->
p
rox
y
.
master
);
close
(
terminal
->
p
eerpt
y
.
slave
);
close
(
terminal
->
p
rox
y
.
slave
);
terminal
->
p
eerpt
y
.
master
=
-
1
;
terminal
->
p
rox
y
.
master
=
-
1
;
terminal
->
p
eerpt
y
.
slave
=
-
1
;
terminal
->
p
rox
y
.
slave
=
-
1
;
terminal
->
p
eerpt
y
.
busy
=
-
1
;
terminal
->
p
rox
y
.
busy
=
-
1
;
terminal
->
p
eerpt
y
.
name
[
0
]
=
'\0'
;
terminal
->
p
rox
y
.
name
[
0
]
=
'\0'
;
terminal
->
peer
=
-
1
;
terminal
->
peer
=
-
1
;
}
}
...
@@ -534,7 +534,7 @@ static int lxc_terminal_peer_proxy_alloc(struct lxc_terminal *terminal, int sock
...
@@ -534,7 +534,7 @@ static int lxc_terminal_peer_proxy_alloc(struct lxc_terminal *terminal, int sock
ERROR
(
"Terminal not set up"
);
ERROR
(
"Terminal not set up"
);
return
-
1
;
return
-
1
;
}
}
if
(
terminal
->
p
eerpt
y
.
busy
!=
-
1
||
terminal
->
peer
!=
-
1
)
{
if
(
terminal
->
p
rox
y
.
busy
!=
-
1
||
terminal
->
peer
!=
-
1
)
{
NOTICE
(
"Terminal already in use"
);
NOTICE
(
"Terminal already in use"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -546,28 +546,28 @@ static int lxc_terminal_peer_proxy_alloc(struct lxc_terminal *terminal, int sock
...
@@ -546,28 +546,28 @@ static int lxc_terminal_peer_proxy_alloc(struct lxc_terminal *terminal, int sock
/* this is the proxy pty that will be given to the client, and that
/* this is the proxy pty that will be given to the client, and that
* the real pty master will send to / recv from
* the real pty master will send to / recv from
*/
*/
ret
=
openpty
(
&
terminal
->
p
eerpty
.
master
,
&
terminal
->
peerpt
y
.
slave
,
ret
=
openpty
(
&
terminal
->
p
roxy
.
master
,
&
terminal
->
prox
y
.
slave
,
terminal
->
p
eerpt
y
.
name
,
NULL
,
NULL
);
terminal
->
p
rox
y
.
name
,
NULL
,
NULL
);
if
(
ret
)
{
if
(
ret
)
{
SYSERROR
(
"failed to create proxy pty"
);
SYSERROR
(
"failed to create proxy pty"
);
return
-
1
;
return
-
1
;
}
}
if
(
lxc_setup_tios
(
terminal
->
p
eerpt
y
.
slave
,
&
oldtermio
)
<
0
)
if
(
lxc_setup_tios
(
terminal
->
p
rox
y
.
slave
,
&
oldtermio
)
<
0
)
goto
err1
;
goto
err1
;
ts
=
lxc_terminal_signal_init
(
terminal
->
p
eerpt
y
.
master
,
terminal
->
master
);
ts
=
lxc_terminal_signal_init
(
terminal
->
p
rox
y
.
master
,
terminal
->
master
);
if
(
!
ts
)
if
(
!
ts
)
goto
err1
;
goto
err1
;
terminal
->
tty_state
=
ts
;
terminal
->
tty_state
=
ts
;
terminal
->
peer
=
terminal
->
p
eerpt
y
.
slave
;
terminal
->
peer
=
terminal
->
p
rox
y
.
slave
;
terminal
->
p
eerpt
y
.
busy
=
sockfd
;
terminal
->
p
rox
y
.
busy
=
sockfd
;
ret
=
lxc_terminal_mainloop_add_peer
(
terminal
);
ret
=
lxc_terminal_mainloop_add_peer
(
terminal
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
err1
;
goto
err1
;
DEBUG
(
"%d peermaster:%d sockfd:%d"
,
lxc_raw_getpid
(),
terminal
->
p
eerpt
y
.
master
,
sockfd
);
DEBUG
(
"%d peermaster:%d sockfd:%d"
,
lxc_raw_getpid
(),
terminal
->
p
rox
y
.
master
,
sockfd
);
return
0
;
return
0
;
err1
:
err1
:
...
@@ -584,7 +584,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
...
@@ -584,7 +584,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
if
(
*
ttyreq
==
0
)
{
if
(
*
ttyreq
==
0
)
{
if
(
lxc_terminal_peer_proxy_alloc
(
terminal
,
sockfd
)
<
0
)
if
(
lxc_terminal_peer_proxy_alloc
(
terminal
,
sockfd
)
<
0
)
goto
out
;
goto
out
;
masterfd
=
terminal
->
p
eerpt
y
.
master
;
masterfd
=
terminal
->
p
rox
y
.
master
;
goto
out
;
goto
out
;
}
}
...
@@ -628,8 +628,8 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
...
@@ -628,8 +628,8 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
ttys
->
tty
[
i
].
busy
=
0
;
ttys
->
tty
[
i
].
busy
=
0
;
}
}
if
(
terminal
->
p
eerpt
y
.
busy
==
fd
)
{
if
(
terminal
->
p
rox
y
.
busy
==
fd
)
{
lxc_mainloop_del_handler
(
terminal
->
descr
,
terminal
->
p
eerpt
y
.
slave
);
lxc_mainloop_del_handler
(
terminal
->
descr
,
terminal
->
p
rox
y
.
slave
);
lxc_terminal_peer_proxy_free
(
terminal
);
lxc_terminal_peer_proxy_free
(
terminal
);
}
}
}
}
...
@@ -1143,7 +1143,7 @@ void lxc_terminal_init(struct lxc_terminal *pty)
...
@@ -1143,7 +1143,7 @@ void lxc_terminal_init(struct lxc_terminal *pty)
pty
->
master
=
-
EBADF
;
pty
->
master
=
-
EBADF
;
pty
->
peer
=
-
EBADF
;
pty
->
peer
=
-
EBADF
;
pty
->
log_fd
=
-
EBADF
;
pty
->
log_fd
=
-
EBADF
;
lxc_terminal_info_init
(
&
pty
->
p
eerpt
y
);
lxc_terminal_info_init
(
&
pty
->
p
rox
y
);
}
}
void
lxc_terminal_conf_free
(
struct
lxc_terminal
*
terminal
)
void
lxc_terminal_conf_free
(
struct
lxc_terminal
*
terminal
)
...
...
src/lxc/terminal.h
View file @
fb87aa6a
...
@@ -79,7 +79,7 @@ struct lxc_terminal {
...
@@ -79,7 +79,7 @@ struct lxc_terminal {
int
slave
;
int
slave
;
int
master
;
int
master
;
int
peer
;
int
peer
;
struct
lxc_terminal_info
p
eerpt
y
;
struct
lxc_terminal_info
p
rox
y
;
struct
lxc_epoll_descr
*
descr
;
struct
lxc_epoll_descr
*
descr
;
char
*
path
;
char
*
path
;
char
name
[
MAXPATHLEN
];
char
name
[
MAXPATHLEN
];
...
...
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