On Aug 31 12:05, Corinna Vinschen wrote: > On Aug 31 18:25, Takashi Yano wrote: > > On Tue, 31 Aug 2021 11:08:42 +0200 > > Corinna Vinschenwrote: > > > On Aug 31 17:55, Takashi Yano wrote: > > > > On Mon, 30 Aug 2021 22:14:15 +0200 > > > > Corinna Vinschen wrote: > > > > > Hi Ken, Hi Takashi, > > > > > > > > > > On Aug 30 19:00, Corinna Vinschen wrote: > > > > > Well, what about keeping a duplicate of the read side handle on the > > > > > write side just for calling NtQueryInformationFile? > > > > > > > > > > Attached is an untested patch, can you have a look if that makes sense? > > > > > > > > > > Btw., I think I found a bug in the new fhandler_pipe::create. If the > > > > > function fails to create the write side fhandler, it deletes the read > > > > > side fhandler, but neglects to close the read handle. My patch fixes > > > > > that. > > > > > > > > > > While looking into this I found a problem in fhandler_disk_file in > > > > > terms of handle inheritance of the special handle for pread/pwrite. > > > > > I already force pushed this onto topic/pipe. > > > > > > > > I tested your patch attached. Unfortunately, select() does not work > > > > as expected for write pipe. Even if the select reports write pipe > > > > is available, writing to pipe fails. It seems that your patch fails > > > > to detect pipe full. > > > > > > Bummer. Is that with byte mode pipes or with message mode pipes? If > > > the latter, if you try to write more data than available in the buffer, > > > it's bound to fail. > > > > Both message pipe and byte pipe. > > > > > Did you add debug output to pipe_data_available to see how the > > > information looks like? Or do you have a simple, self-contained > > > testcase in plain C? > > > > The test case is attached. If select() works as expected, the program > > does not show "r" or "w". However, with your patch, the program prints > > many "w" (means write() fails with EAGAIN). > > Thanks! I found th culprit, but we have another problem. Even if > select returns correct info, A write, trying to write more bytes > than are available in the buffer, hangs. This shouldn't happen. > Still digging... That's, of course, correct behaviour for pipes in blocking mode. D'oh! Please try the attached patch on top of topic/pipe. Thanks, Corinna