X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=rb2 DBalBpycPoumiQWsuKQxkWL4tsLjf74DOzEcqUzJYn8ew+smG6/MZOTf1cjah6Sz xigc/rNwYm9th3M3hgcT1k9G7PQBDCGaz35JQbkY9ixoOCrs9hMgFkGLt9IO0KSX RhSQupfZ1iwB/QEFfrxhA4zEEL5sTalzUdr/unYY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=8ga70A8Rn IDt6+g4uTszAePF50k=; b=PQig9Xto6x6RL3WhHGr0Kzf7H2hWbETcTlGjTHpdU CSpZT7TokiS14/7KvDE49JZoV3tZapeKUn0NIvufRXdu+Z3+tgvJK+K0QyfW95AL +uwyCa+J1IKmpR35gSZJqwuRm8r1+XzSDBe+FDjlq9qJERGnDtEBIsNy6WKYzuv1 js= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_EXCESS_BASE64,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=0p, i1, pipes, sockets X-HELO: mail-wr1-f51.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:disposition-notification-to:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=d8HPNlMUn2BetFIeqKzEog+LMDIBE+QZmB/G7uOgjn4=; b=XYH57YLbH2iQ0fEsqqR2PW+9Or95dm0E4W6FJr7OzGUU8aQZErIgXW47eV0Vl+LKZV K4Rib/PV0sjyW8z8h0b1niNPClq2d5U4yiwD1QSvwIcOo0UjlHq2bLblSde0P9bQCXVP JlMh4BHkm/a/IZuxLK/L5r64AgCsxBWZSfJFb29BANkvgkF0mOJv1iUHuYc4zvR4/E9b DeOS8Ep4bWigC3CRqNUV30dL/5N2p8CHsyBkUqJXUcF1jCJOZd5WouR0bcOlt7/cHnsb fy0dMgCfy81aNgVZW8v0q8BjP37rWvH6EN6KuzPi8iBjgqZaaD6ywopaCYKX/D1cJnv+ l1UQ== To: cygwin AT cygwin DOT com From: =?UTF-8?B?UGV0ciBTa2/EjcOtaw==?= Subject: Weird behavior with writes to a unix socket pair Message-ID: <6c7635fa-ae36-0c3b-d6fc-979c3d0448a9@gmail.com> Date: Thu, 26 Sep 2019 16:38:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi, I've been testing the effects of the SO_RCVBUF/SO_SNDBUF socket options on unix sockets on various platforms, and I've run into some curious unix socket behavior on Cygwin (independent of the SO_RCVBUF/SO_SNDBUF options). This piece of code should get blocked in one of the writes (and it does so for regular pipes): #include #include #include int main() { int p[2]; socketpair(AF_LOCAL, SOCK_STREAM, 0,p); /*pipe(p);*/ /*setsockopt(p[0], SOL_SOCKET, SO_RCVBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[0], SOL_SOCKET, SO_SNDBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[1], SOL_SOCKET, SO_RCVBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[1], SOL_SOCKET, SO_SNDBUF, &(int){1},sizeof(int));*/ ssize_t n; for(unsigned j=0;j<10000;j++) for(unsigned char i=1; i!=0; i++){ printf("%u\n", j*256+i); if(0>(n=write(p[1],&i,1))) perror("write"); } } but with a unix socket socket pair a first couple of writes proceed quickly and then the writes continue to proceed with ever-increasing intervals between them. I don't see why it should behave like this and I think you guys might want to look into why it does. Best regards, Petr Skocik -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple