From: "Boyd Roberts" <boyd@fr.inter.net>
To: <9fans@cse.psu.edu>
Subject: Re: Re[2]: [9fans] weird print(2) problems...
Date: Thu, 6 Sep 2001 11:16:25 +0200 [thread overview]
Message-ID: <03e101c136b4$9abe9900$a2b9c6d4@SOMA> (raw)
In-Reply-To: <633379943@snellwilcox.com>
> Re: zero length messages on pipes
>
> I understood that read would return 0 for a zero length message,
> and -1 on a read of a hungup (broken) pipe.
on unix a broken pipe is when the reader goes away. the writer
then gets sigpiped/epipe on the next write. the writer can exit
before the reader, with no ill effects.
err, if you were using a version of csh (all versions?) this could
bite you badly 'cos a pipeline was incorrectly constructed; csh
would wait on the first process and not the _last_. you have to
fork the pipeline in reverse to get the right semantics, but csh
did not do this. sh did.
if your pipeline is:
cmd | grep something > /dev/null
it's the exit status of the grep that you want, not the exit
status of cmd.
8th ed was modified to deal with dumb readers/writers by sigpipe,
then sigkill after some number of bogus i/o's -- this was to
trap programs that ignored error conditions. i guess this was
initially added to limit the consumption of stream resources.
dennis will correct me. it's early, i haven't even finished
my first coke.
next prev parent reply other threads:[~2001-09-06 9:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-06 8:58 steve.simon
2001-09-06 9:16 ` Boyd Roberts [this message]
2001-09-06 12:39 David Gordon Hogan
2001-09-06 20:33 ` Boyd Roberts
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='03e101c136b4$9abe9900$a2b9c6d4@SOMA' \
--to=boyd@fr.inter.net \
--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).