public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
* Questions about select for sockets
@ 2021-04-03 18:16 Ken Brown
  2021-04-06 14:20 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Ken Brown @ 2021-04-03 18:16 UTC (permalink / raw)
  To: cygwin-devel

Some time ago I did a preliminary implementation of select for AF_UNIX sockets 
on the topic/af_unix branch.  I copied some things from the 
fhandler_socket_wsock case without really understanding them.  I'm taking a 
second look now, and would like to clean this up.  I'll start with just a few 
questions, but there may be more to follow.

1. What's the purpose of 'except_on_write'?  AFAICS, its only use is in 
set_bits, to indicate that the readfds entry should be set in case of a failed 
connect.  But shouldn't that entry always be set if there's a failed connect 
since a read won't block?

2. In that same place in set_bits where UNIX_FD_SET (me->fd, readfds) is called, 
shouldn't ready be incremented?

3. In fhandler_socket_wsock::select_write where except_on_write is set, 
except_ready is also set.  Why is that done there?  It seems to me that this is 
redundant, because the same setting of except_ready is done in 
fhandler_socket_wsock::select_except.

4. Why do we set

   except_ready = saw_shutdown_write () || saw_shutdown_read () ?

I can't find any documentation that says that a shutdown should be considered an 
exceptional condition.  On the other hand, POSIX does say, "Other circumstances 
under which a socket may be considered to have an exceptional condition pending 
are protocol-specific and implementation-defined."  So maybe there's some 
Cygwin-specific reason for doing this?

Thanks.

Ken

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-04-07 15:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-03 18:16 Questions about select for sockets Ken Brown
2021-04-06 14:20 ` Corinna Vinschen
2021-04-06 14:33   ` Corinna Vinschen
2021-04-06 15:44     ` Ken Brown
2021-04-06 16:28       ` Corinna Vinschen
2021-04-06 17:37         ` Ken Brown
2021-04-06 18:24           ` Corinna Vinschen
2021-04-06 19:36             ` Corinna Vinschen
2021-04-07 14:04               ` Ken Brown
2021-04-07 15:31                 ` Corinna Vinschen

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 read-only IMAP folder(s) and NNTP newsgroup(s).