From 26440a5153a074276d1094764292c6c784333812 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 8 Feb 2017 20:50:09 -0800 Subject: [PATCH] runtime: Replace '$LISTEN_FDS + 3' with '--console-socket FD' This bridges the gap between my original '--console-socket PATH' proposal from 15350b31 (runtime: Add --console-socket for terminal handling, 2017-02-08) and Michael's approach from baa24120 (runtime: Replace '--console-socket PATH' with '$LISTEN_FDS + 3', 2017-02-08). All of the benefits of not needing an on-disk socket, and none of the magic of overloading $LISTEN_FDS. I don't know why Michael didn't like this approach as much [1], but it feels a lot better to me. [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-10-19-21.00.log.html#l-31 Signed-off-by: W. Trevor King --- runtime.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/runtime.md b/runtime.md index e312846..e637c58 100644 --- a/runtime.md +++ b/runtime.md @@ -41,6 +41,7 @@ For example, POSIX systems define [`LANG` and related environment variables][pos * *``* Set the container ID to create. * *Options* * *`--bundle `* Override the path to the [bundle directory][bundle] (defaults to the current working directory). + * *`--console-socket `* The runtime MUST pass the [pseudoterminal master][posix_openpt.3] through the open socket at file descriptor ``; the protocol is [described below](#console-socket). * *`--pid-file `* The runtime MUST write the container PID to this path. * *Standard streams:* * If [`process.terminal`][process] is true: @@ -59,16 +60,13 @@ For example, POSIX systems define [`LANG` and related environment variables][pos * *Environment variables* * *`LISTEN_FDS`:* The number of file descriptors passed. For example, `LISTEN_FDS=2` would mean that the runtime MUST pass file descriptors 3 and 4 to the container process (in addition to the standard streams) to support [socket activation][systemd-listen-fds]. -* *Additional file descriptors* - * If [`process.terminal`][process] is true, the caller MUST provide an open [`AF_UNIX` socket][unix-socket] on file descriptor `$LISTEN_FDS + 3`. - The runtime MUST pass the [pseudoterminal master][posix_openpt.3] through the socket; the protocol is [described below](#console-socket). * *Exit code:* Zero if the container was successfully created and non-zero on errors. Callers MAY block on this command's successful exit to trigger post-create activity. #### Console socket -The [`AF_UNIX`][unix-socket] used by the [`$LISTEN_FDS + 3` socket](#create) handles request and response messages between a runtime and server. +The [`AF_UNIX`][unix-socket] used by [`--console-socket`](#create) handles request and response messages between a runtime and server. The socket type MUST be [`SOCK_SEQPACKET`][socket-types] or [`SOCK_STREAM`][socket-types]. The server MUST send a single response for each runtime request. The [normal data][socket-queue] ([`msghdr.msg_iov*`][socket.h]) of all messages MUST be [UTF-8][] [JSON](glossary.md#json).