code: plan9front

Download patch

ref: ed06d703439b70bdc4c5ff96d0d3749ccb8566c9
parent: 19162849bd5986f01034f04172f52386d7e961b2
author: Jacob Moody <moody@posixcafe.org>
date: Sat Sep 10 23:47:48 EDT 2022

window: add wsys 'none' attach to attempted wctl search

While window did work when run under riostart without $wctl,
the change window running from the plumber. It is typical
for lib/profile to contain:

plumber
rio -s riostart

Previously this worked because rio polluted the envgroup
with $wctl and $wsys, but without $wctl or /dev/wctl the
plumber's window fails to find rio. In favor of not breaking
this configuration we allow window to fallback to checking $wsys
and attaching to the none window. This should keep window working
in all cases in which the wctl pollution worked before.

--- a/rc/bin/window
+++ b/rc/bin/window
@@ -91,6 +91,11 @@
 if not {
 	if(~ $wctl ''){
 		if(test -f /dev/wctl) wctl=/dev/wctl
+		if not if(! ~ $wsys '') {
+			rfork n
+			mount -b $wsys /mnt/wsys none
+			wctl=/mnt/wsys/wctl
+		}
 		if not if(test -f /mnt/term/dev/wctl) wctl=/mnt/term/dev/wctl
 		if not if(test -r /mnt/term/env/wctl) wctl=/mnt/term^`{cat /mnt/term/env/wctl}
 		if not {