From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by sourceware.org (Postfix) with ESMTPS id B0164393D024 for ; Mon, 3 May 2021 18:40:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B0164393D024 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 ([217.91.18.234]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mbj3e-1l8R4M0oz0-00dC9P for ; Mon, 03 May 2021 20:40:04 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 98881A80D64; Mon, 3 May 2021 20:40:03 +0200 (CEST) Date: Mon, 3 May 2021 20:40:03 +0200 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: The unreliability of AF_UNIX datagram sockets Message-ID: Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <58da34ac-f2b6-d8b2-e872-834cfcb1ab51@cornell.edu> <6cac30e5-56fc-5bf1-b85b-fe6b91bc5e97@cornell.edu> <16e1d55e-15ea-6c0e-04e4-aa6cb2c0c1bd@cornell.edu> <5564e10e-9099-fc5a-3a8d-c2ffb8ca4cff@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5564e10e-9099-fc5a-3a8d-c2ffb8ca4cff@cornell.edu> X-Provags-ID: V03:K1:rsR93dk/mUktNyBFE+nShcOQo0Lri1GJy79KHz91WmLYKFgsrUH Ixoh5Bsc3266lzbkr3ZaImjhY4r3Me5OqywDDSB93IHZSQYsYhr/hSsSUtyNizhRELvB86U I/iOCCgNf0k5je9/fPzGHns22F26ICAW7sh7Kvy5DV5mnXzeXNtbtxOsCNPTSfY6xTFJFJ5 cD2XpBzI1PfUNzQZEGMng== X-UI-Out-Filterresults: notjunk:1;V03:K0:whYxEDKYqM8=:ymKmtPMI1mZDzvG8lPRogq uCzkKI8zRGX/HXdrn3etKSDPC4+CRem5KbhJeM5ep1Odz9Nu4p7HTY5pEcmzBZFImvfuIGenO m77ADjbOfLq+VRB6hlBjj68F9nAt8el3uDEozEIUcbrJ1okfMIfj7clEhcHXTRLHxT1ESNZDz oD+8EGQm37mINHuG0E4l30TFGAhpPAgqpkjtH6+ig7e7XN1TMsUjUuejc/kom6+BWZiU39aIm tVR4HUbQejRD7ZlrkttC2AYu0aO92PzzsQYe0gtMWnDgQSaALv2REQzUKsTQeWMR2rDSWqHC1 A/I4yyvH/EddgYOwzp8EFUQYgHg03L9NW/DBnT2gTq+scaHz3WYH+nyojzCnabnzfQfu767Kh yM4NAVfinT/ohWtt0PzorirmBGZjMNOif0ET6D1Xi2cqIaxXjTgnZnEXcEL8JIVX7lbQ6i4Or 8aHu1+02ZeQhMNBVIyhq1xB4RK7ikj2jSEOKglZuYYM6fScBJgckfbYYxHKwX+2tCCxeQ7yeA n91FL3evmtBC2u5bzOYI00= X-Spam-Status: No, score=-100.3 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: Mon, 03 May 2021 18:40:07 -0000 On May 3 12:56, Ken Brown wrote: > On 5/3/2021 11:45 AM, Corinna Vinschen wrote: > > 7. The idea of _mq_recv partial reads is entirely broken. Given that > > the information in the queue consists of header info plus payload, > > the entire block has to be read, and then a new block with fixed > > header and shortened payload has to be rewritten with bumped priority. > > This in turn can only be performed by the AF_UNIX code, unless we > > expect knowledge of the AF_UNIX packet layout in the mqueue code. > > The partial read is actually OK as is, since it's comparable to what happens > on a partial read from a pipe. I already have AF_UNIX code (on the > topic/af_unix branch) that deals with that. A boolean variable _unread > keeps track of whether there's unread data from a previous partial read. If > so, the next read just reads data without expecting a header. Ok, never mind. One advantage of the mqueue when utilized as above would be that this kind of state info is not required. The content of a packet would always be self-contained and bumping the priority would automagically move the packet content to the top of the queue. But that's just idle musing at this point. Corinna