[PATCH v8] Cygwin: pipe: Switch pipe mode to blocking mode by default
Takashi Yano
takashi.yano@nifty.ne.jp
Thu Oct 31 08:36:42 GMT 2024
Hi Corinna,
On Mon, 28 Oct 2024 12:57:05 +0100
Corinna Vinschen wrote:
> On Oct 28 20:25, Takashi Yano wrote:
> > Is the test case I used different from yours? Without the 2nd arg,
> > $ ./a.exe 40000
> > pipe capacity: 65536
> > write: writable 1, 40000 25536
> > write: writable 1, SIGALRM 24576 960
> > write: writable 0, SIGALRM -1 / Interrupted system call
>
> This is the same testcase I pasted last week:
>
> $ ./x 40000
> pipe capacity: 65536
> write: writable 1, 40000 25536
> write: writable 1, SIGALRM 24576 960
> write: writable 0, SIGALRM 512 448
> write: writable 0, SIGALRM 256 192
> write: writable 0, SIGALRM 128 64
> write: writable 0, SIGALRM 64 0
> write: writable 0, SIGALRM -1 / Interrupted system call
>
> So why does it not get into the last else case after calling
> pipe_data_available()? Do you get a different return value
> from pipe_data_available()? If so, what and why?
I checked the behaviour in my environment.
__builtin_clzl(960) returns 54 in my environment.
So, result of
len1 = 1 << (31 - __builtin_clzl (avail));
is undefined. If I modify this to:
len1 = 1 << (63 - __builtin_clzl (avail));
I can get:
$ ./a.exe 40000 1
pipe capacity: 65536
write: writable 1, 40000 25536
write: writable 1, 24576 960
write: writable 0, 512 448
write: writable 0, 256 192
write: writable 0, 128 64
write: writable 0, 64 0
write: writable 0, -1 / Resource temporarily unavailable
with the commit 686e46ce7148 as well as with my v9 patch.
Could you please fix?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin-patches
mailing list