9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Detecting EOF vs. Interrupt across 9P
@ 2010-01-15 21:49 Lyndon Nerenberg (VE6BBM/VE7TFX)
  2010-01-15 22:45 ` Charles Forsyth
  0 siblings, 1 reply; 6+ messages in thread
From: Lyndon Nerenberg (VE6BBM/VE7TFX) @ 2010-01-15 21:49 UTC (permalink / raw)
  To: 9fans

Given a foofs which serves the writable file /mnt/foo, is there
any reliable way to distinguish between

	% cat > /mnt/foo
	type some
	text and quit
	^D
	%

and

	% cat > /mnt/foo
	type some
	text, then change your mind and hit <DEL>
	%

at the server end?  I know I read something about this, somewhere, but
I can't find it now.  It could very well have been buried in some
source I was reading (about Tflush vs. 0 length Twrites or some
such?).

--lyndon




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

* Re: [9fans] Detecting EOF vs. Interrupt across 9P
  2010-01-15 21:49 [9fans] Detecting EOF vs. Interrupt across 9P Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2010-01-15 22:45 ` Charles Forsyth
  2010-01-15 23:01   ` Russ Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Charles Forsyth @ 2010-01-15 22:45 UTC (permalink / raw)
  To: 9fans

in the first case, you'll see the last Twrite and then a Tclunk.
in the second, you'll see the first Twrite and then a Tflush (followed by
a Tclunk when cat exits).



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

* Re: [9fans] Detecting EOF vs. Interrupt across 9P
  2010-01-15 22:45 ` Charles Forsyth
@ 2010-01-15 23:01   ` Russ Cox
  2010-01-15 23:22     ` Lyndon Nerenberg (VE6BBM/VE7TFX)
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Russ Cox @ 2010-01-15 23:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Jan 15, 2010 at 2:45 PM, Charles Forsyth <forsyth@terzarima.net> wrote:
> in the first case, you'll see the last Twrite and then a Tclunk.
> in the second, you'll see the first Twrite and then a Tflush (followed by
> a Tclunk when cat exits).

i don't believe these two cases can be distinguished.
in particular i think you'd only see the Tflush if the first
Twrite was still in flight when you typed DEL.  assuming
the first write had completed before DEL, the two scenarios
are indistinguishable other than the different values being
written.

> at the server end?  I know I read something about this, somewhere, but
> I can't find it now.  It could very well have been buried in some
> source I was reading (about Tflush vs. 0 length Twrites or some
> such?).

wikifs uses a trick to convey errors back at the end of
the file: clients can send a zero-length write before closing
the file, and the zero-length write will fail if the page
cannot be committed.  but i don't recommend this in
general.  it's pretty gross and means, among other things,
that cat is not as useful as a custom client.

russ


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

* Re: [9fans] Detecting EOF vs. Interrupt across 9P
  2010-01-15 23:01   ` Russ Cox
@ 2010-01-15 23:22     ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2010-01-16  0:56     ` Charles Forsyth
  2010-01-16  0:56     ` Charles Forsyth
  2 siblings, 0 replies; 6+ messages in thread
From: Lyndon Nerenberg (VE6BBM/VE7TFX) @ 2010-01-15 23:22 UTC (permalink / raw)
  To: 9fans

Russ says:
> i don't believe these two cases can be distinguished.
> in particular i think you'd only see the Tflush if the first
> Twrite was still in flight when you typed DEL.  assuming
> the first write had completed before DEL, the two scenarios
> are indistinguishable other than the different values being
> written.

And after more digging through the docs and kernel this seems to
be the case. (And it describes the behaviour I'm seeing.)

--lyndon




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

* Re: [9fans] Detecting EOF vs. Interrupt across 9P
  2010-01-15 23:01   ` Russ Cox
  2010-01-15 23:22     ` Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2010-01-16  0:56     ` Charles Forsyth
  2010-01-16  0:56     ` Charles Forsyth
  2 siblings, 0 replies; 6+ messages in thread
From: Charles Forsyth @ 2010-01-16  0:56 UTC (permalink / raw)
  To: 9fans

>i don't believe these two cases can be distinguished.

you're right, and indeed don't believe it either.



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

* Re: [9fans] Detecting EOF vs. Interrupt across 9P
  2010-01-15 23:01   ` Russ Cox
  2010-01-15 23:22     ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2010-01-16  0:56     ` Charles Forsyth
@ 2010-01-16  0:56     ` Charles Forsyth
  2 siblings, 0 replies; 6+ messages in thread
From: Charles Forsyth @ 2010-01-16  0:56 UTC (permalink / raw)
  To: 9fans

>you're right, and indeed don't believe it either.

i meant: and indeed I don't believe it either.



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

end of thread, other threads:[~2010-01-16  0:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-15 21:49 [9fans] Detecting EOF vs. Interrupt across 9P Lyndon Nerenberg (VE6BBM/VE7TFX)
2010-01-15 22:45 ` Charles Forsyth
2010-01-15 23:01   ` Russ Cox
2010-01-15 23:22     ` Lyndon Nerenberg (VE6BBM/VE7TFX)
2010-01-16  0:56     ` Charles Forsyth
2010-01-16  0:56     ` Charles Forsyth

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).