From 34834165e2b54dd6ac26babd1e9d0443f1f53ee4 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:39:51 -0300 Subject: 9ns: under --mntgen the program also gets NINE_MNTGEN=1, so it can tell the registry from a mounted session $NINE_MOUNT was the mountpoint either way: under --mntgen the registry, each session at $NINE_MOUNT//; under --unix the session itself. A program working out its own session's directory (pardes's $PARDES_MOUNT for its panes) could not tell which without statting the mount. NINE_MNTGEN=1 now says so; an inherited one is dropped, so a 9ns nested in a registry's program is not taken for one. Co-Authored-By: Claude Opus 5.5 --- 9ns/src/main.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '9ns/src/main.zig') diff --git a/9ns/src/main.zig b/9ns/src/main.zig index eac0a5e..86763a7 100644 --- a/9ns/src/main.zig +++ b/9ns/src/main.zig @@ -38,7 +38,8 @@ const usage_text = \\ --no-direct-io let the kernel cache file pages (trusts stat length) \\ --debug trace FUSE and 9P operations on stderr \\ --help, --version - \\PROGRAM defaults to $SHELL (else /bin/sh). The mountpoint is exported as $NINE_MOUNT. + \\PROGRAM defaults to $SHELL (else /bin/sh). The mountpoint is exported as $NINE_MOUNT, + \\and under --mntgen NINE_MNTGEN=1 says it is the registry, a session at $NINE_MOUNT//. \\Default name: --unix PATH -> basename of PATH without .sock/.9p/.socket; \\--tcp IP:PORT -> tcp-IP-PORT (':' becomes '-'); --spawn CMD -> basename of its \\first word; --fd N -> fdN; 9p when nothing usable comes out of that. @@ -391,6 +392,7 @@ fn runMntgen(init: std.process.Init, envp: [*:null]const ?[*:0]const u8, cfg: Co .uid = uid, .gid = gid, .max_read = bridge.max_write, + .mntgen = true, }) catch return own_failure; bridge.serveMntgen(gpa, child.fuse_fd, stop_fd, .{ -- cgit v1.3