3 # Serve Unix u9fs over SSH
5 # Basically, try each of the following until you find one that works:
13 # and then never look back. Note that "srvssh unix" should always
14 # work. It's just that if you're talking with certain sshd's, you'll get
15 # hit by Nagle's algorithm and need to explore the other flags.
17 # When using ssh to start u9fs, the only way to turn off
18 # Nagle's algorithm (which kills the performance of RPC-based
19 # protocols like 9P) is to allocate a pseudo-terminal. The
20 # command ssh -Rmp attempts to allocate a pseudo-terminal and
21 # then put it in a transparent mode. Especially when
22 # connected to older SSH daemons, the connection ends up not
23 # quite transparent. To get around this, we explicity set the tty
24 # mode on the command line as well. The hope is that -Rmp makes
25 # the connection transparent enough for the Tversion, and the stty
26 # command will do the rest. If -Rmp doesn't make the connection
27 # transparent enough for the Tversion (but the stty commands do
28 # make the connection fully transparent) then add "-s 5" to the srv
29 # command to tell it to wait 5 seconds before sending the Tversion.
30 # That should be enough time for the stty to take effect.
35 echo 'usage: srvssh [-R] [-r] [-s] [-u u9fspath] system [srvname [mtpt]]' >[1=2]
51 rawhack=('stty raw -echo '';''')
61 u9fspath=`{echo $1 | sed s/-u//}
83 x=(srv $sleephack -e \
84 'ssh '$rawflags' '$1' '$rawhack' '$u9fspath' -na none -u ''$''USER -l ''$''HOME/u9fs.log' \
88 # Sometimes /srv/whatever can be a closed pipe, in which case
89 # srv will have been killed for writing to it, without a chance to
90 # defend itself. Rerun it in this case.
93 if(~ $ss *'write on closed pipe'*){
100 echo srvssh: $ss >[1=2]