summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-01-13 19:42:20 +0000
committerLaurent Bercot <ska@appnovation.com>2022-01-13 19:42:20 +0000
commitd719a54a6401b47e7eb1930ab8da6b04389323c6 (patch)
treec4efb8dfbe3f0898b661bac57c7aac3ae80ee3e6
parent654ab33e97830a4eba4427407776f85abd6f95cf (diff)
downloads6-linux-init-d719a54a6401b47e7eb1930ab8da6b04389323c6.tar.xz
Better documentation of the satanic verses
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/init/s6-linux-init.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c
index 4168523..e6b0d60 100644
--- a/src/init/s6-linux-init.c
+++ b/src/init/s6-linux-init.c
@@ -119,11 +119,12 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned
/*
This is ugly voodoo, keep away from innocent eyes.
- If stdin is a terminal, it means we're in a "docker run -it" container
-(or equivalent) and stdin is a ctty. We don't want the supervision tree to
-have this ctty (else ^C kills everything) but we want stage 2 to keep it,
-so that if we have a CMD run by stage 2 (as is the case with s6-overlay),
-it remains interactive (control sequences can be sent to it).
+ If ttyfd exists, it means we're in a "docker run -it" container or
+equivalent, and ttyfd (a copy of the original stdin) is a ctty. We don't
+want the supervision tree to have this ctty (else ^C kills everything)
+but we want stage 2 to keep it if possible, so that if we have a CMD run
+by stage 2 (as is the case with s6-overlay), it remains interactive, i.e.
+control sequences can be sent to it.
In order to achieve that, we have the child (future stage 2) steal the
ctty from the parent (future s6-svscan). But that may not work, for instance
in a USER container, where we don't have the appropriate permissions; in