9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] echo -n
Date: Mon, 20 Nov 2006 16:55:57 -0500	[thread overview]
Message-ID: <ee9e417a0611201355g2b4a91ffo22b2b66c4a8af5ab@mail.gmail.com> (raw)
In-Reply-To: <8ccc8ba40611201305u114a86fboa765b4dd87a95b4e@mail.gmail.com>

Notice the wording.  "If you're preserving message boundaries..."

If you want to do away with mid-stream zero-length reads from pipes,
then don't have them preserve message boundaries anymore.
Probably nothing will break.  As I said, it used to be very important,
but it's not as important anymore (as of 9P2000).
However, some programs do depend on writes not getting coalesced;
for example, kfs reads /srv/kfs.cmd and expects one command per read.
It's a two-line change to devpipe.c: change qopen's second argument
from 0 to Qcoalesce.  Try it and see what breaks.

That said, in the absence of any compelling argument to change it,
I am inclined to leave it alone.

Changing devpipe is very different from defining that a zero-length write
system call gets dropped from the kernel (which it sounds like you
are proposing).  That would definitely be a mistake.
Other file servers might still want to preserve message boundaries
or otherwise imbue zero-length writes (or reads) with special meaning.
As Federico pointed out, wikifs does use zero-length writes for
its own purposes; Charles once pointed out that USB does as well;
and in fact even HTTP/1.1 uses (framed) zero-length messages.
In all these cases if you had a pipe to a translator, being able to
send an empty message along that pipe could come in handy.

> Isn't it more clean to let zero bytes mean eof?

Okay.  Let's call a zero-byte message an eof.
If you can read an eof, why can't you write one?

One could view the zero-length message on a pipe as an eof,
and then the question is whether echo -n should send an eof.

Russ


  reply	other threads:[~2006-11-20 21:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-20  8:40 arisawa
2006-11-20  9:45 ` Martin Neubauer
2006-11-20 10:42   ` lucio
2006-11-20 17:35     ` maht
2006-11-20 12:46 ` Russ Cox
2006-11-20 14:41   ` John Stalker
2006-11-20 14:59     ` Dave Lukes
2006-11-20 14:59     ` Axel Belinfante
2006-11-20 15:34       ` ron minnich
2006-11-20 15:43       ` erik quanstrom
2006-11-20 16:37   ` Joel Salomon
2006-11-20 18:49     ` Russ Cox
2006-11-20 19:16       ` Francisco J Ballesteros
2006-11-20 19:57         ` Joel Salomon
2006-11-20 20:18           ` Federico Benavento
2006-11-20 20:38           ` Russ Cox
2006-11-20 21:00             ` Joel Salomon
2006-11-20 21:05             ` Francisco J Ballesteros
2006-11-20 21:55               ` Russ Cox [this message]
2006-11-20 22:11                 ` Francisco J Ballesteros
2006-11-20 22:24                   ` Martin Neubauer
2006-11-20 23:14                   ` Gorka guardiola
2006-11-20 23:22                     ` Francisco J Ballesteros
2006-11-20 23:57                       ` Gorka guardiola
2006-11-21  3:24               ` lucio
2006-11-20 19:32       ` Joel Salomon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a0611201355g2b4a91ffo22b2b66c4a8af5ab@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).