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.y...@nifty.ne.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