9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Bread + note -> loss
@ 2014-05-12 15:10 erik quanstrom
  2014-05-12 16:18 ` cinap_lenrek
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2014-05-12 15:10 UTC (permalink / raw)
  To: 9fans

in looking at a particular situation with Bread, i noticed that it
Bgetc, and Bgetrune differ from Brdstr in what it does with read
returns a count <= 0. Brdstr just returns nil.  Bread sets Binactive.

this wouldn't matter if there were not two fundamentally different
types of notes: alarms and everything else.  (from this perspective
it seems a shame that plan 9 doesn't allow syscalls to be restarted.)

for the interrupted case, this Bread with a different, undocumented,
(and bizarre) recovery strategy.  a Bseek(b, 0, 1) will rejuvinate the
Biobuf for Bread, but one must carefully paste the interrupted slop
together with a second response if one wishes to recover from an
interrupted read.

so, boo.  this seems like a real painful corner case.  and i don't see
any easy way out, unless bio were modified to allow read and write
to be replaced with indirect function calls.  this might be very interesting
for threaded applications.

crazy?

- erik



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

* Re: [9fans] Bread + note -> loss
  2014-05-12 15:10 [9fans] Bread + note -> loss erik quanstrom
@ 2014-05-12 16:18 ` cinap_lenrek
  2014-05-12 16:21   ` erik quanstrom
  2014-05-12 16:31   ` erik quanstrom
  0 siblings, 2 replies; 8+ messages in thread
From: cinap_lenrek @ 2014-05-12 16:18 UTC (permalink / raw)
  To: 9fans

why not check the error string in Bread() and see if its "interrupted"
and in that case, dont inactivate the stream? or are i'm missing
something?

--
cinap



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

* Re: [9fans] Bread + note -> loss
  2014-05-12 16:18 ` cinap_lenrek
@ 2014-05-12 16:21   ` erik quanstrom
  2014-05-12 16:31   ` erik quanstrom
  1 sibling, 0 replies; 8+ messages in thread
From: erik quanstrom @ 2014-05-12 16:21 UTC (permalink / raw)
  To: 9fans

On Mon May 12 12:19:47 EDT 2014, cinap_lenrek@felloff.net wrote:
> why not check the error string in Bread() and see if its "interrupted"
> and in that case, dont inactivate the stream? or are i'm missing
> something?

that's an excellent suggestion.  i thought about it before posting, but
sort of discarded that line of thinking.  i think the difficulty might
be in disturbing programs that depend on this behavior.

- erik



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

* Re: [9fans] Bread + note -> loss
  2014-05-12 16:18 ` cinap_lenrek
  2014-05-12 16:21   ` erik quanstrom
@ 2014-05-12 16:31   ` erik quanstrom
  2014-05-12 16:41     ` cinap_lenrek
  1 sibling, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2014-05-12 16:31 UTC (permalink / raw)
  To: 9fans

i should elaborate.  the case were any error or interrupt looks like Beof
seems like the right thing for any program that looks like a filter.  this
is the majority of programs.  and this is the current behavior.  i wouldn't
want to make the simple case tricky.  but the hard case should also not
be impossible or impossibly tricky, either.

the suggestion of having Biobuf.^(read|write) skirts this issue buy allowing
a sophisticated program to interrupt itself and recover gracefully, without
letting Bio in on the joke.

- erik



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

* Re: [9fans] Bread + note -> loss
  2014-05-12 16:31   ` erik quanstrom
@ 2014-05-12 16:41     ` cinap_lenrek
  2014-05-14 16:59       ` erik quanstrom
  0 siblings, 1 reply; 8+ messages in thread
From: cinap_lenrek @ 2014-05-12 16:41 UTC (permalink / raw)
  To: 9fans

why? if the program doesnt handle the note, then it shouldnt matter if it
clunks the biobuf or not as it will be exited by the default handler.

--
cinap



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

* Re: [9fans] Bread + note -> loss
  2014-05-12 16:41     ` cinap_lenrek
@ 2014-05-14 16:59       ` erik quanstrom
  2014-05-16 19:24         ` cinap_lenrek
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2014-05-14 16:59 UTC (permalink / raw)
  To: 9fans

On Mon May 12 12:42:21 EDT 2014, cinap_lenrek@felloff.net wrote:
> why? if the program doesnt handle the note, then it shouldnt matter if it
> clunks the biobuf or not as it will be exited by the default handler.

you're right.

- erik



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

* Re: [9fans] Bread + note -> loss
  2014-05-14 16:59       ` erik quanstrom
@ 2014-05-16 19:24         ` cinap_lenrek
  2014-05-16 19:29           ` erik quanstrom
  0 siblings, 1 reply; 8+ messages in thread
From: cinap_lenrek @ 2014-05-16 19:24 UTC (permalink / raw)
  To: 9fans

btw, whats the program that gets hit by alarm notes but wants to
continue with Bread()?

--
cinap



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

* Re: [9fans] Bread + note -> loss
  2014-05-16 19:24         ` cinap_lenrek
@ 2014-05-16 19:29           ` erik quanstrom
  0 siblings, 0 replies; 8+ messages in thread
From: erik quanstrom @ 2014-05-16 19:29 UTC (permalink / raw)
  To: 9fans

On Fri May 16 15:26:28 EDT 2014, cinap_lenrek@felloff.net wrote:
> btw, whats the program that gets hit by alarm notes but wants to
> continue with Bread()?

there's one you wrote, but more on that offline.

- erik



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

end of thread, other threads:[~2014-05-16 19:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-12 15:10 [9fans] Bread + note -> loss erik quanstrom
2014-05-12 16:18 ` cinap_lenrek
2014-05-12 16:21   ` erik quanstrom
2014-05-12 16:31   ` erik quanstrom
2014-05-12 16:41     ` cinap_lenrek
2014-05-14 16:59       ` erik quanstrom
2014-05-16 19:24         ` cinap_lenrek
2014-05-16 19:29           ` erik quanstrom

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