summaryrefslogtreecommitdiff
path: root/src/nested.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/nested.zig')
-rw-r--r--src/nested.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nested.zig b/src/nested.zig
index 887d0703..1997d8e4 100644
--- a/src/nested.zig
+++ b/src/nested.zig
@@ -82,11 +82,15 @@ extern "c" fn proc_pidinfo(pid: c_int, flavor: c_int, arg: u64, buffer: *anyopaq
/// The gap is a race only against a fork on another thread, and every caller
/// is past that: `listen` runs before the first pane exists, `acceptLine` runs
/// on a thread of its own long after spawning has settled, and the detached
-/// session forks nothing at all (its ptys live in its frontends).
+/// session — which forks EVERY pane shell in the session, because the daemon
+/// owns them now (`host_io.zig`) — has no other thread to race with, since it
+/// services its pane ptys from the same `poll(2)` that accepts its frontends.
///
-/// CLOEXEC still matters for both: a `--detach` session is long-lived, and an
-/// inherited listener would keep its socket bound long after it ended — the
-/// same shape as the inherited lock fd that once held a flock forever.
+/// CLOEXEC matters MORE for that last one than it did when a frontend forked
+/// the shells: a pane shell is long-lived and arbitrary, and an inherited
+/// listener would keep the session's socket bound long after the session
+/// ended — the same shape as the inherited lock fd that once held a flock
+/// forever.
pub fn setCloexec(fd: c_int) void {
const FD_CLOEXEC: c_int = 1;
_ = libc.fcntl(fd, libc.F.SETFD, FD_CLOEXEC);