9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] /net like file trees and scripting.
@ 2002-10-05  8:45 Geoff Collyer
  2002-10-08 23:35 ` Roman V. Shaposhnick
  0 siblings, 1 reply; 6+ messages in thread
From: Geoff Collyer @ 2002-10-05  8:45 UTC (permalink / raw)
  To: 9fans

how about `tail -f'?  or are you looking for some subtlety that's in
the Unix tail but not the Plan 9 one?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /net like file trees and scripting.
  2002-10-05  8:45 [9fans] /net like file trees and scripting Geoff Collyer
@ 2002-10-08 23:35 ` Roman V. Shaposhnick
  0 siblings, 0 replies; 6+ messages in thread
From: Roman V. Shaposhnick @ 2002-10-08 23:35 UTC (permalink / raw)
  To: 9fans

On Sat, Oct 05, 2002 at 01:45:26AM -0700, Geoff Collyer wrote:
> how about `tail -f'?  or are you looking for some subtlety that's in
> the Unix tail but not the Plan 9 one?

  Nope. tail -f just didn't work for me the first time, but then, I
  have a pretty tricky setup. Thanks anyway.

Roman.

P.S. I'm just curious -- does name 'glenda' have exactly the same origin as
'Plan 9' itself, or am I stretching my imagination too far ?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /net like file trees and scripting.
  2002-10-03  2:18 Russ Cox
@ 2002-10-05  8:31 ` Roman V. Shaposhnick
  0 siblings, 0 replies; 6+ messages in thread
From: Roman V. Shaposhnick @ 2002-10-05  8:31 UTC (permalink / raw)
  To: 9fans

On Wed, Oct 02, 2002 at 10:18:46PM -0400, Russ Cox wrote:
> here's rlogin.

 Aha! So there is no requirement for the files in /net/tcp/nnn to be opened
 in the same process, right? It works great for me -- thank you:

 $ < /net/tcp/clone sleep 1000 &
 $ cd /net/tcp/21/
 $ echo connect 1.1.1.1!7 > ctl
 $ echo Hello world > data
 $ cat data
 Hello world

 by the way, can somebody suggest me Plan 9 moral equivalent of the
 $ tail -f in UNIX?

Thanks,
Roman.

P.S. All numbers are fictional, any resemblance to a living data is pure
coincidental.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /net like file trees and scripting.
@ 2002-10-05  8:25 Charles Forsyth
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Forsyth @ 2002-10-05  8:25 UTC (permalink / raw)
  To: 9fans

>>by the way, can somebody suggest me Plan 9 moral equivalent of the
>> $ tail -f in UNIX?

i believe that in Plan 9 it's `tail -f', unless i misunderstood.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /net like file trees and scripting.
@ 2002-10-03  2:18 Russ Cox
  2002-10-05  8:31 ` Roman V. Shaposhnick
  0 siblings, 1 reply; 6+ messages in thread
From: Russ Cox @ 2002-10-03  2:18 UTC (permalink / raw)
  To: 9fans

here's rlogin.

#!/bin/rc
# produce a zero byte on stdout
fn zero {
	dd -if /dev/zero -count 1 -bs 1 >[2]/dev/null
}

# translate a network address
fn cslookup {
	echo $1 | ndb/csquery >[2]/dev/null |tr -d '>'
}

# translate the network address for rlogin
x=`{cslookup net!$1!login}
if(~ $#x 0){
	echo couldn''t translate $1
	exit 'unknown host'
}
clonefile=$x(1)
dialstring=$x(2)

# hold the clone file open to keep the connection ours
<[4] $clonefile {
	netdir=`{basename -d $clonefile} ^ / ^  `{cat /fd/4}

	# write connect string to /net/tcp/N/ctl
	echo connect $dialstring >$netdir/ctl || exit 'cannot connect'

	# proxy data from remote system
	cat $netdir/data | tr -d '' &

	# must do bsd authentication protocol at beginning.
	{
		zero
	&&	echo -n $user	# local user
	&&	zero
	&&	echo -n $user	# remote user
	&&	zero
	&&	echo -n p9	# terminal type
	&&	zero
	} >$netdir/data || exit 'cannot talk bsd'

	# proxy data to remote system from keyboard
	# hold /dev/cons open to keep raw mode on
	</dev/cons >/dev/consctl {
		echo rawon
		cat >$netdir/data
	}
}



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] /net like file trees and scripting.
@ 2002-10-03  2:09 Roman V. Shaposhnick
  0 siblings, 0 replies; 6+ messages in thread
From: Roman V. Shaposhnick @ 2002-10-03  2:09 UTC (permalink / raw)
  To: 9fans

While doing C programming and using /net/tcp for example in its
raw form ( without dial & co. ) I had no problems whatsoever since
everything was confined in one process.

The problem showed up when I tried to do roughly the same in rc. E.g.:

$ cat t
#!/bin/rc

a=`{cat /net/tcp/clone}
echo -n 'connect lambda!7' > /net/tcp/$a/ctl
cat /net/tcp/$a/status
echo 'hello' > /net/tcp/$a/data
cat /net/tcp/$a/data

$ ./t
Time_wait srtt 0 mdev 0 cwin 1461 swin 24820 rwin 65535 timer.start 200 timer.count 190 rerecv 0
echo: write error: i/o on hungup channel

As far as I can tell, I can't get away with this since /net/tcp/clone is being
closed before /net/tcp/$a/data gets opened and there is no way for me to
change that since first cat and subsequent cats are different process. And
of course they close everything on exit.

Am I doomed to use C in such case, or is there any clever way to trick the
system ?

Thanks,
Roman.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-08 23:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-05  8:45 [9fans] /net like file trees and scripting Geoff Collyer
2002-10-08 23:35 ` Roman V. Shaposhnick
  -- strict thread matches above, loose matches on Subject: below --
2002-10-05  8:25 Charles Forsyth
2002-10-03  2:18 Russ Cox
2002-10-05  8:31 ` Roman V. Shaposhnick
2002-10-03  2:09 Roman V. Shaposhnick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).