mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@MIT.EDU>
To: "Albert D. Cahalan" <acahalan@cs.uml.edu>
Cc: david@linux.com, linux-kernel@vger.kernel.org, vpnd@sunsite.auc.dk
Subject: Re: /dev/random probs in 2.4test(12-pre3)
Date: Sat, 2 Dec 2000 18:18:06 -0500	[thread overview]
Message-ID: <200012022318.SAA17498@tsx-prime.MIT.EDU> (raw)
In-Reply-To: Albert D. Cahalan's message of Sat, 2 Dec 2000 17:00:32 -0500 (EST), <200012022200.eB2M0Wu473578@saturn.cs.uml.edu>

   From: "Albert D. Cahalan" <acahalan@cs.uml.edu>
   Date: 	Sat, 2 Dec 2000 17:00:32 -0500 (EST)

   > Any programmer who has evolved sufficiently from a scriptie
   > should take necessary precautions to check how much data was
   > transferred.  Those who don't..well, there is still tomorrow.

   Yeah, people write annoying little wrapper functions that
   bounce right back into the kernel until the job gets done.
   This is slow, it adds both source and object bloat, and it
   is a source of extra bugs. What a lovely API, eh?

Well, that's the Unix interface you.  I you don't like it, why don't you
become a Windows programmer and try your hand at the Win32 interface?  :-)

Seriously, doing something different for /dev/random compared to all
other read(2) calls is a bad idea; it will get people confused.  The
answer is whenever you call read(2), you must check the return values.
People who don't are waiting to get themselves into a lot of trouble,
particularly people who writing network programs.  The number of people
who assume that they can get an entire (variable-length) RPC packet by
doing a single read() call astounds me.  TCP doesn't provide message
boundaries, never did and never will.  The problem is that such program
will work on a LAN, and then blow up when you try using them across the
real Internet.

Secondly, the number of times that you end up going into a kernel is
relatively rare; I doubt you'd be able to notice a performance
difference in the real world using a real-world program.  As far as
source/object code bloat, well, how much space does a while loop take?
And I usyally write a helper function which takes care of the while
loop, checks for errors, calls read again if EINTR is returned, etc.

						- Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-02 23:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-01 17:33 folkert
2000-12-02 11:09 ` Matthew Kirkwood
2000-12-02 18:58   ` Igmar Palsenberg
2000-12-02 18:03     ` Jeff Garzik
2000-12-02 21:32       ` Igmar Palsenberg
2000-12-02 20:42         ` David Ford
2000-12-02 22:00           ` Albert D. Cahalan
2000-12-02 23:18             ` Theodore Y. Ts'o [this message]
2000-12-02 23:34               ` Alexander Viro
2000-12-03  3:01                 ` Theodore Y. Ts'o
2000-12-03 12:20                 ` Andrew Morton
2000-12-03 16:32               ` Igmar Palsenberg
2000-12-03  7:20             ` H. Peter Anvin
2000-12-03  7:41               ` Albert D. Cahalan
2000-12-03 16:25           ` Igmar Palsenberg
2000-12-03 18:52             ` Jeff Garzik
2000-12-03 21:18               ` Igmar Palsenberg
2000-12-03 20:15                 ` David Ford
2000-12-03  7:17         ` H. Peter Anvin
2000-12-19 19:24           ` Kai Henningsen
2000-12-02 21:35       ` Igmar Palsenberg
2000-12-02 20:44         ` David Ford
2000-12-03 16:27           ` Igmar Palsenberg
2000-12-03  7:19         ` H. Peter Anvin
2000-12-03  7:16     ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2000-12-01 17:26 Matthew Kirkwood
2000-12-01 18:18 ` H. Peter Anvin
2000-12-02 12:01   ` Matthew Kirkwood

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=200012022318.SAA17498@tsx-prime.MIT.EDU \
    --to=tytso@mit.edu \
    --cc=acahalan@cs.uml.edu \
    --cc=david@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vpnd@sunsite.auc.dk \
    /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

all inboxes | Powered by JetHome®