3.3.0: Possible regression in cygwin DLL (Win10); fixed in snapshot

Takashi Yano takashi.yano@nifty.ne.jp
Sun Nov 7 03:46:06 GMT 2021


On Sat, 6 Nov 2021 12:38:43 -0400
Ken Brown wrote:
> On 11/6/2021 7:42 AM, Corinna Vinschen wrote:
> > On Nov  6 15:10, Takashi Yano wrote:
> >> Ken Brown wrote:
> >>> On 11/5/2021 3:41 PM, Takashi Yano via Cygwin wrote:
> >>>> What about setting pipe mode to byte by default?
> >>>
> >>> I have a vague recollection that this caused some other problem, but I'll have
> >>> to review the email discussions from a few months ago.  I'm traveling at the
> >>> moment and won't get to this for a few days.
> 
> I found it:
> 
>    https://cygwin.com/pipermail/cygwin-developers/2021-August/012219.html

Thanks!

I tested the current pipe behaviour using the following test code.
With both message and byte pipe, the result are the same:
w:65536
r:2048
w:-1
which complies with POSIX requirement.
I have tested under Windows Vista, 7 and 10 and got same results.


#include <unistd.h>
#include <stdio.h>
#include <limits.h>
#include <fcntl.h>

#define PIPE_SIZE 65536

int main()
{
	int fd[2];
	char buf[PIPE_SIZE];
	int flags;

	pipe(fd);

	/* Set non-blocking */
	flags = fcntl(fd[1], F_GETFL);
	flags |= O_NONBLOCK;
	fcntl(fd[1], F_SETFL, flags);

	/* Fill pipe */
	printf("w:%d\n", write(fd[1], buf, PIPE_SIZE));
	/* Free PIPE_BUF/2 bytes */
	printf("r:%d\n", read(fd[0], buf, PIPE_BUF/2));
	/* Write PIPE_BUF bytes */
	printf("w:%d\n", write(fd[1], buf, PIPE_BUF));

	return 0;
}

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-developers mailing list