summaryrefslogtreecommitdiff
path: root/src/machine/machine.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-07 23:38:20 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-08 15:03:31 +0200
commit40e1f4ea7458a0a80eaf1ef356e52bfe0835412e (patch)
tree51243d22f3e9af06b42c229341aa5bf0fa31c7ed /src/machine/machine.c
parenta34ceba66fc0e856d8f76f340389a4768b57a365 (diff)
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.
Diffstat (limited to 'src/machine/machine.c')
-rw-r--r--src/machine/machine.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 0f1942d1f4..7ab84607fb 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -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;