The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Dave Horsfall <dave@horsfall.org>
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] V6 networking & alarm syscall
Date: Sat, 12 Jan 2019 12:58:28 +1100 (EST)	[thread overview]
Message-ID: <alpine.BSF.2.21.9999.1901121237300.90857@aneurin.horsfall.org> (raw)
In-Reply-To: <20190112012439.7D56A18C073@mercury.lcs.mit.edu>

On Fri, 11 Jan 2019, Noel Chiappa wrote:

[ ... ]

>         ioctl (0, FIONREAD, &nch);
>                        if (nch == 0) {
>                                tk_yield ();
>                                continue;
>                        }
>                }
>                if ((c = getchar()) == EOF) {
>
> so that ioctl() must look to see if there is any data waiting in the 
> terminal input buffer (I'm too lazy to go see what FIONREAD does, right 
> at the moment).

As I dimly recall (because I'm too sick/lazy to look it up), it returns 
the number of characters in the input queue (at that time) so that you 
won't block (and time out, if you wrote it thus).

It was quite useful, if you didn't like the horrible semantics of 
select(), or, for that matter, SysV poll() (?) which was only slightly 
better.

Of course, FIONREAD wasn't always reliable, because by the time you got to 
using it the keyboard (l)user could have deleted some characters etc, and 
you *could* be left there hanging on a timeout (with signals, which for 
some reason I hate with a passion, as I've posted here before, as they 
are just too brutal).

No doubt someone here will tell me that Plan9 did it right :-)  I really 
must run it up some time, before I finally kark it (I'm in my late 60s).

-- Dave

  reply	other threads:[~2019-01-12  1:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12  1:24 Noel Chiappa
2019-01-12  1:58 ` Dave Horsfall [this message]
2019-01-12  2:33   ` Warner Losh
  -- strict thread matches above, loose matches on Subject: below --
2019-01-13 10:52 Paul Ruizendaal
2019-01-13 15:39 ` Warner Losh
     [not found] <mailman.1.1547258402.6716.tuhs@minnie.tuhs.org>
2019-01-12 11:13 ` Paul Ruizendaal
2019-01-12  4:14 Noel Chiappa
2019-01-11 23:27 Paul Ruizendaal
2019-01-10 23:12 Paul Ruizendaal
2019-01-11  0:17 ` Clem cole
2019-01-11 15:33 ` ron
2019-01-11 18:45   ` Clem Cole
2019-01-11 19:06     ` David
2019-01-11 22:08     ` reed
2019-01-11 22:18       ` Larry McVoy
2019-01-12 12:04         ` reed
2019-01-12 17:20           ` Clem Cole
2019-01-12 18:16             ` Eric Allman
2019-01-13  1:16               ` Madeline Autumn-Rose
2019-01-11 22:47       ` Clem Cole
2019-01-11 22:55         ` Eric Allman
2019-01-11 23:32         ` Warner Losh

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=alpine.BSF.2.21.9999.1901121237300.90857@aneurin.horsfall.org \
    --to=dave@horsfall.org \
    --cc=tuhs@tuhs.org \
    /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).