提交 a6e10dbd 编写于 作者: D Daniel P. Berrangé

lxc: remove use of the terms 'master' and 'slave' in PTY setup

The two sides of a PTY can be referred to as primary and secondary
TTYs.
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 bd2502ce
...@@ -2054,25 +2054,25 @@ static int lxcSetPersonality(virDomainDefPtr def) ...@@ -2054,25 +2054,25 @@ static int lxcSetPersonality(virDomainDefPtr def)
} }
/* Create a private tty using the private devpts at PTMX, returning /* Create a private tty using the private devpts at PTMX, returning
* the master in *TTYMASTER and the name of the slave, _from the * the primary in @ttyprimary and the name of the secondary, _from the
* perspective of the guest after remounting file systems_, in * perspective of the guest after remounting file systems_, in
* *TTYNAME. Heavily borrowed from glibc, but doesn't require that * @ttyName. Heavily borrowed from glibc, but doesn't require that
* devpts == "/dev/pts" */ * devpts == "/dev/pts" */
static int static int
lxcCreateTty(virLXCControllerPtr ctrl, int *ttymaster, lxcCreateTty(virLXCControllerPtr ctrl, int *ttyprimary,
char **ttyName, char **ttyHostPath) char **ttyName, char **ttyHostPath)
{ {
int ret = -1; int ret = -1;
int ptyno; int ptyno;
int unlock = 0; int unlock = 0;
if ((*ttymaster = open(ctrl->devptmx, O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0) if ((*ttyprimary = open(ctrl->devptmx, O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0)
goto cleanup; goto cleanup;
if (ioctl(*ttymaster, TIOCSPTLCK, &unlock) < 0) if (ioctl(*ttyprimary, TIOCSPTLCK, &unlock) < 0)
goto cleanup; goto cleanup;
if (ioctl(*ttymaster, TIOCGPTN, &ptyno) < 0) if (ioctl(*ttyprimary, TIOCGPTN, &ptyno) < 0)
goto cleanup; goto cleanup;
/* If mount() succeeded at honoring newinstance, then the kernel /* If mount() succeeded at honoring newinstance, then the kernel
...@@ -2088,7 +2088,7 @@ lxcCreateTty(virLXCControllerPtr ctrl, int *ttymaster, ...@@ -2088,7 +2088,7 @@ lxcCreateTty(virLXCControllerPtr ctrl, int *ttymaster,
cleanup: cleanup:
if (ret != 0) { if (ret != 0) {
VIR_FORCE_CLOSE(*ttymaster); VIR_FORCE_CLOSE(*ttyprimary);
g_free(*ttyName); g_free(*ttyName);
*ttyName = NULL; *ttyName = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册