delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/01/07:41:15

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 461BfEM8818893
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=iWfxwyl8
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E90353815FEB
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1719834072;
bh=OjMZCvXm/luaabunepQgmpv0bzXHlPIcjIb6dveJ3IM=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=iWfxwyl8P2H8WnD12g2OAWLKJPiEz9CwRYV0rhNoyEDDtX6Or3IikzPtCc7+NQBi6
Er2Xn5ZBZ4tSt4KSnz8XBNdwpVfzbwvV/LwUdwplomVdETrQBJs6sEODbIcc1DaD3b
lezoKJubOp9mBuELPEKloGhr686kcg8VtgmfmqAE=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 874ED389941E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 874ED389941E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719834047; cv=none;
b=R0+YTt5uDh6EzBGZBLJwykCqU+zA/g5L37X76ygyglXJoSyMu0Bi2T3rGQter0iWzfqpZhROREQqM65plD46WlMSpdiG3nXvIWEKo+STM/b27CVQA4Ah8j8hpDpFcB5eHn24pCIsVJSq/npD3xBRZ59EgEx37vgodk5rtoH8QlU=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1719834047; c=relaxed/simple;
bh=wbL5x1MrIMhnR4jKBbHFJpclF60J1Z7lDQYrcijGUzk=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=EJZxA1rvCN3Kr8TzZDGeq+JbmDpAiSi4H1Gzcqp6lqkKsdWqx0sqNmvZVHnv7pxON1oFUmFis3iEC7lWK4qPSeNEJFw57vvCYQ6BfeBeVjg+cXnCKTi4rvIt4yXb5MKt0I+p4U0Xu+ka537I4MWfAJw914+TIYj2oqdQUn8t8mk=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Mon, 1 Jul 2024 20:40:38 +0900
To: cygwin AT cygwin DOT com
Subject: Re: SIGALRM is not interrupting a blocking write to a pipe
Message-Id: <20240701204038.1a80dd18267a2302ca838e3e@nifty.ne.jp>
In-Reply-To: <10838112-58af-4b53-baac-39ab849662a4@gmail.com>
References: <10838112-58af-4b53-baac-39ab849662a4 AT gmail DOT com>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 6 May 2024 23:01:49 +0300
ilya Basin wrote:
> I need your help with troubleshooting an issue with "pv": https://codeberg.org/a-j-wood/pv/issues/87
> 
> This app uses SIGALRM to interrupt a blocking write to STDOUT and read more data into the buffer.
> On Linuxes write() returns 0 after the signal, but on Cygwin even though the signal handler is called, the write call does not return, at least when writing to a pipe.

What Linux environment you assume? I run the STC below on Debuan GNU/Linux,

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <signal.h>
#include <string.h>

void handler(int sig)
{
	printf("sig=%d\n", sig);
}

int main()
{
	int fd[2];

	signal(SIGALRM, handler);
	pipe(fd);
	for (;;) {
		int l = write(fd[1], "A", 1);
		if (l == 1) {
			printf("."); fflush(stdout); /* Normal */
		} else {
			printf("%d: %s\n", l, strerror(errno)); /* Interrupt */
		}
	}
}

but,
kill -ALRM <pid of STC>
does not make output /* Interrupt */ line, but only /* Normal */ line.

uname -a:
Linux debian2 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux

The behaviour is same with cygwin.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019