Skip to content

Commit baa2412

Browse files
committed
runtime: Replace '--console-socket PATH' with '$LISTEN_FDS + 3'
As Michael requested [1]. The upsides of this approach are: * No need to drop the console onto the filesystem. You can use socketpair(2) in the runtime caller and be done with it. * No need for the runtime to connect (since the connection is already open when 'create' is invoked). This allows you to use SOCK_SEQPACKET or SOCK_STREAM as you see fit. The downsides are: * Overloading $LISTEN_FDS. Using a positional-argument approach to pass the FD number would feel less magical and make me much happier. [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-10-19-21.00.log.html#l-30 Signed-off-by: W. Trevor King <[email protected]>
1 parent bd44334 commit baa2412

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runtime.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ For example, POSIX systems define [`LANG` and related environment variables][pos
4242
* *Options*
4343
* *`--bundle <PATH>`* Override the path to the [bundle directory][bundle] (defaults to the current working directory).
4444
* *`--pid-file <PATH>`* The runtime MUST write the container PID to this path.
45-
* *`--console-socket <PATH>`* The runtime MUST pass the [pseudoterminal master][posix_openpt.3] through the socket at `<PATH>`; the protocol is [described below](#console-socket).
4645
* *Standard streams:*
4746
* If [`process.terminal`][process] is true:
4847
* *stdin:* The runtime MUST NOT attempt to read from its stdin.
@@ -60,14 +59,17 @@ For example, POSIX systems define [`LANG` and related environment variables][pos
6059
* *Environment variables*
6160
* *`LISTEN_FDS`:* The number of file descriptors passed.
6261
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].
62+
* *Additional file descriptors*
63+
* If [`process.terminal`][process] is true, the caller MUST provide an open [`AF_UNIX` socket][unix-socket] on file descriptor `$LISTEN_FDS + 3`.
64+
The runtime MUST pass the [pseudoterminal master][posix_openpt.3] through the socket; the protocol is [described below](#console-socket).
6365
* *Exit code:* Zero if the container was successfully created and non-zero on errors.
6466

6567
Callers MAY block on this command's successful exit to trigger post-create activity.
6668

6769
#### Console socket
6870

69-
The [`AF_UNIX`][unix-socket] used by [`--console-socket`](#create) handles request and response messages between a runtime and server.
70-
The socket type MUST be [`SOCK_SEQPACKET`][socket-types].
71+
The [`AF_UNIX`][unix-socket] used by the [`$LISTEN_FDS + 3` socket](#create) handles request and response messages between a runtime and server.
72+
The socket type MUST be [`SOCK_SEQPACKET`][socket-types] or [`SOCK_STREAM`][socket-types].
7173
The server MUST send a single response for each runtime request.
7274
The [normal data][socket-queue] ([`msghdr.msg_iov*`][socket.h]) of all messages MUST be [UTF-8][] [JSON](glossary.md#json).
7375

0 commit comments

Comments
 (0)