Subject: Re: Observations on select.cc (19990922 snapshot)
From: Chris Faylor <[email-masked]>
To: "Patrick J. LoPresti" <[email-masked]>
Cc: [email-masked]
Date: Sat, 25 Sep 1999 13:33:49 -0400

On Fri, Sep 24, 1999 at 04:40:20PM -0400, Patrick J. LoPresti wrote:
>Just some observations from reading the code and playing with strace.
>Pull up select.cc and follow along.
>
>The peek_pipe() function frequently gets called on the input side of a
>pipe.  That causes the call to PeekNamedPipe() to fail with a
>permission error (Win32 only lets you peek at the output side), which
>is kind of annoying.  Perhaps peek_pipe() could check read_selected
>before doing the PeekNamedPipe?

Looking at a recent strace output, I don't see any occurrences of
PeekNamedPipe failures.  So, I'm not sure where this is frequently being
called.

PeekNamedPipe is supposed to be called with a pipe handle which has
GENERIC_READ attributes.  I don't know what you consider the output side
of a pipe but I wouldn't expect an output handle to have GENERIC_READ
attributes.

>Also, there currently seem to be only clunky attempts to enforce the
>invariant that the bits set in the fd_sets when select() returns are
>subsets of the bits which were passed in.  (I'm not even certain this
>is always true.)  Wouldn't it make sense for the set_bits() function
>to enforce this invariant by checking {read,write,except}_selected
>before setting the corresponding bit?  Then many of the read_selected
>tests around the file could be removed.

Hmm.  I assume that this paragraph is your "clunky" way of trying to
start a technical discussion.  You do realize that when you send mail
here mailing list you stand a chance of communicating with the original
author of the code, right?  I'll grant you that the word "clunky" did
get my attention but certainly not in a positive way.

However, you're right that the *_selected test should be in set_bits.  I
don't agree that all of the *_selected tests should be eliminated
elsewhere, however.

-chris

--
Want to unsubscribe from this list?
Send a message to [email-masked]