From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by sourceware.org (Postfix) with ESMTPS id BE00C384402F for ; Tue, 6 Apr 2021 16:28:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BE00C384402F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin@cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MXHBo-1l5Axc1nW2-00Yip7 for ; Tue, 06 Apr 2021 18:28:46 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id D86DEA8089E; Tue, 6 Apr 2021 18:28:45 +0200 (CEST) Date: Tue, 6 Apr 2021 18:28:45 +0200 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: Questions about select for sockets Message-ID: Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <6b50ec89-5c02-c49f-ad85-e581589d21d3@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:PgQAcDkvnTL48hO77HUf7HNmQeh9Tp3REG8aGuBCsCRIz71+J0k 9U+ddW3mW+OybIDAgy7LZUi0348Ow/CuHMFHU/AP31RoyWcmFXnDHIl6rzcuZh1llp/WNTH lqc2IA5uJtyN4/LYQyGXRGjn3H5cHO0icynuHbu9QCIAaL8yKCKF2+mIm2UwNoloOoSGWL9 f6eU19JyE+zTly81L0pRQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:RjzkvGSTwT0=:vbkTFlkDkS5GKVrXIF6CLh nPYcLXZD/uxVYJmjkXlUM8UKLIHYgCjZWU1x5tlFY1f1lIDJzhlNJ3+VDX4qiZHjK4N4ub4iL 3ck+Qde9El40Idl5iYjt8Mhw1wVRM1lvqbbuKh5hgHCeXpwxZwxkkQas2jQXyl61smVXf985o VG63X9W6A5ImKYHg8bA7fPsFyKRAXfjvsVmMezQq/Hnh8gYmgUL2xNYsZxsWRb1QVklGYONKq TNKB83ZKWYkT9pV3dKepDaZsE0EWr3Dju3qcqm4X+Bpymr9/jto9FbvLCVOXghXVVTQJy2dEf qSKJ6yawe8nf5eZdLlVe/ZsAL8iL66t6izvzd5kW3kiJReB3Hj2AiwclvVaVOaKJ2qqZxwyN2 7iB/UipNNdH7kJdDNRgkmObxi3TdDP4uQDsFpS+FAx2NaQSbtH2zTZwNPKRGskwUeBwtMUrZ4 jisKhkemnKoS6WiWCVfWE72H2/ASpp3kI+uticAJsOAPt0r8Bjkw X-Spam-Status: No, score=-101.2 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 16:28:50 -0000 On Apr 6 11:44, Ken Brown wrote: > On 4/6/2021 10:33 AM, Corinna Vinschen wrote: > > On Apr 6 16:20, Corinna Vinschen wrote: > > > On Apr 3 14:16, Ken Brown via Cygwin-developers wrote: > > > > 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? > > > > > > Nope, this is old (and wrong) cruft. Neither Steven's book nor the > > > Linux man pages, nor testing on Linux imply that ready for exception > > > is used to indicate anything other than out-of-band data. This should > > > be fixed. > > > > We may also have to change the saw_shutdown_read/saw_shutdown_write > > handling. I checked this on Linux and what happens is: > > > > After shutdown (fd, SHUT_RD), the socket is ready for reading and writing > > This seems surprising to me. Is it really the shutdown that caused it to be > ready for writing in your test, or was it ready for writing anyway (e.g., > because the relevant buffer was empty)? I guess so, too. How to make sure the socket isn't ready for writing without going to great lengths? Corinna