machined: when opening a shell via machined, pass tty fds in

With this change we'll open the shell's tty right from machined and then
pass it to the transient unit we create. This way we make sure the pty
is opened exactly as long as the transient service is around, and no
longer, and vice versa. This way pty forwarders do not have to deal with
EIO problems due to vhangup, as the pty is open all the time from the
point we set things up to the point where the service goes away.
This commit is contained in:
Lennart Poettering
2015-10-08 15:03:31 +02:00
parent a34ceba66f
commit 40e1f4ea74
6 changed files with 82 additions and 10 deletions
+19
View File
@@ -572,6 +572,25 @@ int machine_openpt(Machine *m, int flags) {
}
}
int machine_open_terminal(Machine *m, const char *path, int mode) {
assert(m);
switch (m->class) {
case MACHINE_HOST:
return open_terminal(path, mode);
case MACHINE_CONTAINER:
if (m->leader <= 0)
return -EINVAL;
return open_terminal_in_namespace(m->leader, path, mode);
default:
return -EOPNOTSUPP;
}
}
MachineOperation *machine_operation_unref(MachineOperation *o) {
if (!o)
return NULL;