Re: [PATCH 00/21] FIFO: Support multiple readers

2020-05-18 Thread Ken Brown via Cygwin-patches
On 5/18/2020 1:36 AM, Takashi Yano via Cygwin-patches wrote: On Mon, 18 May 2020 14:25:19 +0900 Takashi Yano via Cygwin-patches wrote: However, mc hangs by several operations. To reproduce this: 1. Start mc with 'env SHELL=tcsh mc -a' I mean 'env SHELL=/bin/tcsh mc -a' 2. Select a file

Re: [PATCH 00/21] FIFO: Support multiple readers

2020-05-18 Thread Ken Brown via Cygwin-patches
Hi Takashi, On 5/18/2020 12:03 PM, Ken Brown via Cygwin-patches wrote: On 5/18/2020 1:36 AM, Takashi Yano via Cygwin-patches wrote: On Mon, 18 May 2020 14:25:19 +0900 Takashi Yano via Cygwin-patches wrote: However, mc hangs by several operations. To reproduce this: 1. Start mc with 'env

Re: [PATCH 00/21] FIFO: Support multiple readers

2020-05-19 Thread Ken Brown via Cygwin-patches
On 5/19/2020 2:15 AM, Takashi Yano via Cygwin-patches wrote: On Tue, 19 May 2020 10:26:09 +0900 Takashi Yano via Cygwin-patches wrote: Hi Ken, On Mon, 18 May 2020 13:42:19 -0400 Ken Brown via Cygwin-patches wrote: Hi Takashi, On 5/18/2020 12:03 PM, Ken Brown via Cygwin-patches wrote: On 5

[PATCH 05/21] Cygwin: FIFO: remove the arm method

2020-05-07 Thread Ken Brown via Cygwin-patches
There's no reason to check for errors when we set read_ready or write_ready. We don't do that for other events. --- winsup/cygwin/fhandler.h | 1 - winsup/cygwin/fhandler_fifo.cc | 34 +++--- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git

[PATCH 16/21] Cygwin: FIFO: add a shared fifo_client_handler list

2020-05-07 Thread Ken Brown via Cygwin-patches
This is in a new shared memory section. We will use it for temporary storage of the owner's fc_handler list when we need to change owner. The new owner can then duplicate the pipe handles from that list before taking ownership. Add several shared data members and methods that are needed for the

[PATCH 12/21] Cygwin: FIFO: keep track of the number of readers

2020-05-07 Thread Ken Brown via Cygwin-patches
Add data and methods to the shared memory that keep track of the number of open readers. Increment this number in open, dup, fork, and exec. Decrement it in close. Reset read_ready if there are no readers left. --- winsup/cygwin/fhandler.h | 8 winsup/cygwin/fhandler_fifo.cc |

[PATCH 09/21] Cygwin: FIFO: make opening a writer more robust

2020-05-07 Thread Ken Brown via Cygwin-patches
- Make read_ready a manual-reset event. - Signal read_ready in open instead of in the listen_client_thread. - Don't reset read_ready when the listen_client thread terminates; instead do it in close(). - Rearrange open and change its error handling. - Add a wait_open_pipe method that waits

[PATCH 04/21] Cygwin: FIFO: simplify the listen_client_thread code

2020-05-07 Thread Ken Brown via Cygwin-patches
Always return 0; no one is doing anything with the return value anyway. Remove the return value from stop_listen_client. Make the connection event auto-reset, so that we don't have to reset it later. Simplify the process of connecting a bogus client when thread termination is signaled. Make

[PATCH 01/21] Cygwin: FIFO: minor change - use NtClose

2020-05-07 Thread Ken Brown via Cygwin-patches
Replace CloseHandle by NtClose since all handles are created by NT functions. --- winsup/cygwin/fhandler_fifo.cc | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index

[PATCH 20/21] Cygwin: FIFO: support opening multiple readers

2020-05-07 Thread Ken Brown via Cygwin-patches
Although we can have multiple readers open because of dup/fork/exec, the current code does not support multiple readers opening a FIFO by explicitly calling 'open'. The main complication in supporting this is that when a blocking reader tries to open and there's already one open, it has to check

[PATCH 08/21] Cygwin: FIFO: fix hit_eof

2020-05-07 Thread Ken Brown via Cygwin-patches
According to Posix, a FIFO open for reading is at EOF if it is empty and there are no writers open. The only way to test this is to poll the fifo_client_handlers as in raw_read and select.cc:peek_fifo. The current hit_eof instead relies on the value of nconnected, which can be out of date. On

[PATCH 17/21] Cygwin: FIFO: take ownership on exec

2020-05-07 Thread Ken Brown via Cygwin-patches
If fixup_after_exec is called on a non-close-on-exec reader whose parent is the owner, transfer ownership to the child. Otherwise the parent's pipe handles will be closed before any other reader can duplicate them. To help with this, make the cancel_evt and thr_sync_evt handles inheritable, so

[PATCH 18/21] Cygwin: FIFO: find a new owner when closing

2020-05-07 Thread Ken Brown via Cygwin-patches
If the owning reader is closing, wait for another reader (if there is one) to take ownership before closing the owner's pipe handles. To synchronize the ownership transfer, add events owner_needed_evt and owner_found_evt, and add methods owner_needed and owner_found to set/reset them. Modify the

[PATCH 10/21] Cygwin: FIFO: use a cygthread instead of a homemade thread

2020-05-07 Thread Ken Brown via Cygwin-patches
This will simplify future work. Rename the thread from "listen_client_thread" to "fifo_reader_thread" because it will be used for more than just listening. Remove the fixup_before stuff, which won't be needed after future changes to fixup_after_fork and fixup_after_exec. ---

[PATCH 06/21] Cygwin: FIFO: honor the flags argument in dup

2020-05-07 Thread Ken Brown via Cygwin-patches
Also improve the error handling. --- winsup/cygwin/fhandler_fifo.cc | 60 +++--- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 44919c19e..f61e2fe72 100644 ---

[PATCH 07/21] Cygwin: FIFO: dup/fork/exec: make sure child starts unlocked

2020-05-07 Thread Ken Brown via Cygwin-patches
There can be deadlocks if the child starts with its fifo_client_lock in the locked state. --- winsup/cygwin/fhandler_fifo.cc | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index

[PATCH 03/21] Cygwin: FIFO: change the fifo_client_connect_state enum

2020-05-07 Thread Ken Brown via Cygwin-patches
Make the values correspond to the possible return values of fifo_client_handler::pipe_state(). When cleaning up the fc_handler list in listen_client_thread(), don't delete handlers in the fc_closing state. I think the pipe might still have input to be read in that case. Set the state to

[PATCH 02/21] Cygwin: FIFO: simplify the fifo_client_handler structure

2020-05-07 Thread Ken Brown via Cygwin-patches
Replace the 'fhandler_base *' member by a HANDLE to the server side of the Windows named pipe instance. Make the corresponding simplifications throughout. --- winsup/cygwin/fhandler.h | 19 +++--- winsup/cygwin/fhandler_fifo.cc | 65 -- 2 files changed,

[PATCH 15/21] Cygwin: FIFO: allow fc_handler list to grow dynamically

2020-05-07 Thread Ken Brown via Cygwin-patches
Make fc_handler a pointer to malloc'd memory instead of a fixed-size array. The size is now a new data member 'shandlers'. Call realloc in add_client_handler if we need to grow the array. free fc_handler in close. As long as we're touching that code, also remove an unneeded lock. ---

[PATCH 00/21] FIFO: Support multiple readers

2020-05-07 Thread Ken Brown via Cygwin-patches
This project began as a an attempt to allow a FIFO to be opened multiple times for reading. The initial motivation was that Midnight Commander running under tcsh does this (unsuccessfully on Cygwin). See https://sourceware.org/pipermail/cygwin/2019-December/243317.html It quickly became

[PATCH 11/21] Cygwin: FIFO: add shared memory

2020-05-07 Thread Ken Brown via Cygwin-patches
Even though we currently allow a FIFO to be opened for reading only once, we can still have more than one reader open because of dup and fork. Add a named shared memory section accessible to all readers of a given FIFO. In future commits we will add information needed by all readers to this

[PATCH 19/21] Cygwin: FIFO: allow any reader to take ownership

2020-05-07 Thread Ken Brown via Cygwin-patches
Add a take_ownership method, used by raw_read and select.cc:peek_fifo. It wakes up all fifo_reader_threads and allows the caller to become owner. The work is done by the fifo_reader_threads. For synchronization we introduce several new fhandler_fifo data members and methods: - update_needed_evt

[PATCH 13/21] Cygwin: FIFO: introduce a new type, fifo_reader_id_t

2020-05-07 Thread Ken Brown via Cygwin-patches
This uniquely identifies an fhandler_fifo open for reading in any process. Add a new data member 'me' of this type, which is set in open, dup, fork, and exec. --- winsup/cygwin/fhandler.h | 23 +++ winsup/cygwin/fhandler_fifo.cc | 9 - 2 files changed, 31

[PATCH 14/21] Cygwin: FIFO: designate one reader as owner

2020-05-07 Thread Ken Brown via Cygwin-patches
Among all the open readers of a FIFO, one is declared to be the owner. This is the only reader that listens for client connections, and it is the only one that has an accurate fc_handler list. Add shared data and methods for getting and setting the owner, as well as a lock to prevent more than

[PATCH 21/21] Cygwin: FIFO: update commentary

2020-05-07 Thread Ken Brown via Cygwin-patches
The beginning of fhandler_fifo.cc contains a long comment giving an overview of the FIFO implementation. This is now updated to describe the support for multiple readers. --- winsup/cygwin/fhandler_fifo.cc | 58 -- 1 file changed, 35 insertions(+), 23 deletions(-)

Re: [PATCH 00/21] FIFO: Support multiple readers

2020-05-19 Thread Ken Brown via Cygwin-patches
On 5/19/2020 8:51 AM, Ken Brown via Cygwin-patches wrote: On 5/19/2020 2:15 AM, Takashi Yano via Cygwin-patches wrote: On Tue, 19 May 2020 10:26:09 +0900 Takashi Yano via Cygwin-patches wrote: Hi Ken, On Mon, 18 May 2020 13:42:19 -0400 Ken Brown via Cygwin-patches wrote: Hi Takashi, On 5

Re: [PATCH] Cygwin: pty: Make system_printf() work after closing pty slave.

2020-05-19 Thread Ken Brown via Cygwin-patches
Hi Takashi, On 5/19/2020 7:35 AM, Takashi Yano via Cygwin-patches wrote: - Current pty cannot show system_printf() output after closing pty slave. This patch fixes the issue. Sorry to be returning the favor so soon, but this patch causes 'make check' in the texinfo source tree to hang. I

Re: [PATCH 00/21] FIFO: Support multiple readers

2020-05-22 Thread Ken Brown via Cygwin-patches
On 5/19/2020 10:07 AM, Takashi Yano wrote: On Tue, 19 May 2020 09:37:17 -0400 Ken Brown via Cygwin-patches wrote: On 5/19/2020 8:51 AM, Ken Brown via Cygwin-patches wrote: On 5/19/2020 2:15 AM, Takashi Yano via Cygwin-patches wrote: On Tue, 19 May 2020 10:26:09 +0900 Takashi Yano via Cygwin

Re: [PATCH] Cygwin: pty: Revise code to make system_printf() work after close.

2020-05-21 Thread Ken Brown via Cygwin-patches
On 5/21/2020 4:25 AM, Takashi Yano via Cygwin-patches wrote: - After commit 0365031ce1347600d854a23f30f1355745a1765c, the issue https://cygwin.com/pipermail/cygwin-patches/2020q2/010259.html occurs. This patch fixes the issue. Thanks. I can confirm that it's fixed. Ken

[PATCH 0/2] Fix problems with /proc//fd checking

2020-09-08 Thread Ken Brown via Cygwin-patches
This fixes the assertion failure reported here: https://sourceware.org/pipermail/cygwin/2020-September/246160.html with a simple test case here: https://sourceware.org/pipermail/cygwin/2020-September/246188.html That test case now fails as follows, as on Linux: $ ./proc_bug.exe open: Not

[PATCH 1/2] Cygwin: format_process_fd: add directory check

2020-09-08 Thread Ken Brown via Cygwin-patches
The incoming path is allowed to have the form "$PID/fd/[0-9]*/.*" provided the descriptor symlink points to a directory. Check that this is indeed the case. --- winsup/cygwin/fhandler_process.cc | 15 +++ 1 file changed, 15 insertions(+) diff --git

[PATCH 2/2] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches
fhandler_process::exists is called when we are checking a path starting with "/proc//fd". If it returns virt_none and sets an errno, there is no need for further checking. Just set 'error' and return. --- winsup/cygwin/path.cc | 6 ++ 1 file changed, 6 insertions(+) diff --git

Re: [PATCH 2/2] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches
On 9/8/2020 12:50 PM, Ken Brown via Cygwin-patches wrote: fhandler_process::exists is called when we are checking a path starting with "/proc//fd". If it returns virt_none and sets an errno, there is no need for further checking. Just set 'error' and return. --- winsup/cygwin/p

Re: [PATCH v2 2/3] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches
On 9/8/2020 3:02 PM, Ken Brown via Cygwin-patches wrote: fhandler_process::exists is called when we are checking a path starting with "/proc//fd". If it returns virt_none and sets an errno, there is no need for further checking. Just set 'error' and return. --- winsup/cygwin/p

[PATCH v2 2/3] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches
fhandler_process::exists is called when we are checking a path starting with "/proc//fd". If it returns virt_none and sets an errno, there is no need for further checking. Just set 'error' and return. --- winsup/cygwin/path.cc | 9 + 1 file changed, 9 insertions(+) diff --git

Re: [PATCH v2 0/6] Some AF_UNIX fixes

2020-10-08 Thread Ken Brown via Cygwin-patches
On 10/4/2020 12:49 PM, Ken Brown via Cygwin-patches wrote: I'm about to push these. Corinna, please check them when you return. The only difference between v2 and v1 is that there are a few more fixes. I'm trying to help get the AF_UNIX development going again. I'm mostly working on the topic

[PATCH v2 0/6] Some AF_UNIX fixes

2020-10-04 Thread Ken Brown via Cygwin-patches
I'm about to push these. Corinna, please check them when you return. The only difference between v2 and v1 is that there are a few more fixes. I'm trying to help get the AF_UNIX development going again. I'm mostly working on the topic/af_unix branch. But when I find bugs that exist on master,

[PATCH v2 3/6] Cygwin: always recognize AF_UNIX sockets as reparse points

2020-10-04 Thread Ken Brown via Cygwin-patches
If __WITH_AF_UNIX is defined when Cygwin is built, then a named AF_UNIX socket is represented by a reparse point with a Cygwin-specific tag and GUID. Make such files recognizable as reparse points (but not as sockets) even if __WITH_AF_UNIX is not defined. That way utilities such as 'ls' and 'rm'

[PATCH v2 2/6] Cygwin: fix handling of known reparse points that are not symlinks

2020-10-04 Thread Ken Brown via Cygwin-patches
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path handling", changed check_reparse_point_target so that it could return a positive value on a known reparse point that is not a symlink. But some of the code in check_reparse_point that handles this positive return value was executed

[PATCH v2 1/6] Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed

2020-10-04 Thread Ken Brown via Cygwin-patches
The following Windows system calls currently fail with STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket: - NtOpenFile in get_file_sd - NtOpenFile in set_file_sd - NtCreateFile in fhandler_base::open Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls when the

[PATCH v2 5/6] Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS

2020-10-04 Thread Ken Brown via Cygwin-patches
A successful connection can be indicated by STATUS_SUCCESS or STATUS_PIPE_CONNECTED. Previously we were checking only for the latter. --- winsup/cygwin/fhandler_socket_unix.cc | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc

[PATCH v2 4/6] Cygwin: AF_UNIX: socket: set the O_RDWR flag

2020-10-04 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/fhandler_socket_unix.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 429aa8a90..0ae7fe125 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@

[PATCH v2 6/6] Cygwin: AF_UNIX: open_pipe: call recv_peer_info

2020-10-04 Thread Ken Brown via Cygwin-patches
If open_pipe is called with xchg_sock_info true, call recv_peer_info in addition to send_sock_info. --- winsup/cygwin/fhandler_socket_unix.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc

[PATCH 1/1] Cygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support

2020-10-12 Thread Ken Brown via Cygwin-patches
If MSG_WAITALL is set, recv_internal calls WSARecv or WSARecvFrom in a loop, in an effort to fill all the scatter-gather buffers. The test for whether all the buffers are full was previously incorrect. --- winsup/cygwin/fhandler_socket_inet.cc | 2 +- winsup/cygwin/fhandler_socket_local.cc | 2

[PATCH 0/1] Fix MSG_WAITALL support

2020-10-12 Thread Ken Brown via Cygwin-patches
It looks to me like there's been a bug in the MSG_WAITALL support for AF_INET and AF_LOCAL sockets ever since that support was first introduced 13 years ago in commit 023a2fa7. If I'm right, MSG_WAITALL has never worked. This patch fixes it. I'll push it in a few days if no one sees anything

Re: [PATCH 0/1] Fix MSG_WAITALL support

2020-10-12 Thread Ken Brown via Cygwin-patches
On 10/12/2020 2:02 PM, Ken Brown via Cygwin-patches wrote: It looks to me like there's been a bug in the MSG_WAITALL support for AF_INET and AF_LOCAL sockets ever since that support was first introduced 13 years ago in commit 023a2fa7. If I'm right, MSG_WAITALL has never worked. This patch

Re: [PATCH v2 5/6] Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS

2020-10-13 Thread Ken Brown via Cygwin-patches
On 10/13/2020 7:28 AM, Corinna Vinschen wrote: > On Oct 4 12:49, Ken Brown via Cygwin-patches wrote: >> A successful connection can be indicated by STATUS_SUCCESS or >> STATUS_PIPE_CONNECTED. > > THanks for catching but... huh? How does Windows generate two different > s

Re: [PATCH v2 0/6] Some AF_UNIX fixes

2020-10-14 Thread Ken Brown via Cygwin-patches
On 10/13/2020 7:49 AM, Corinna Vinschen wrote: On Oct 8 17:36, Ken Brown via Cygwin-patches wrote: On 10/4/2020 12:49 PM, Ken Brown via Cygwin-patches wrote: I'm about to push these. Corinna, please check them when you return. The only difference between v2 and v1 is that there are a few

[PATCH] Cygwin: main exception handler (64-bit): continue GCC exceptions

2020-08-17 Thread Ken Brown via Cygwin-patches
This is necessary in order to be consistent with the following comment in the definition of _Unwind_RaiseException() in the GCC source file libgcc/unwind-seh.c: The exception handler installed in crt0 will continue any GCC exception that reaches there (and isn't marked non-continuable).

[PATCH] Cygwin: sigproc.cc: add comment

2020-08-29 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/sigproc.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 2a9734f00..47352c213 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -44,7 +44,11 @@ char NO_COPY

Re: [PATCH] Cygwin: strace: ignore GCC exceptions

2020-08-20 Thread Ken Brown via Cygwin-patches
On 8/20/2020 10:06 AM, Corinna Vinschen wrote: Wouldn't it make sense to create a header defining the GCC status values as in libgcc/unwind-seh.c and share this between exceptions.cc and strace.cc? Yes, thanks for the suggestion. New patch(es) on the way. I called the header "gcc_seh.h".

[PATCH] Cygwin: strace: ignore GCC exceptions

2020-08-20 Thread Ken Brown via Cygwin-patches
Any C++ app that calls 'throw' on 64-bit Cygwin results in an exception of type STATUS_GCC_THROW (0x20474343) generated by the C++ runtime. Don't pollute the strace output by printing information about this and other GCC exceptions. --- winsup/utils/strace.cc | 7 +++ 1 file changed, 7

[PATCH 1/2] Cygwin: add header defining GCC exception codes

2020-08-20 Thread Ken Brown via Cygwin-patches
Include it in exceptions.cc instead of defining the exception codes there. --- winsup/cygwin/exceptions.cc | 10 +- winsup/cygwin/gcc_seh.h | 19 +++ 2 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 winsup/cygwin/gcc_seh.h diff --git

[PATCH 0/2] GCC exception codes

2020-08-20 Thread Ken Brown via Cygwin-patches
Ken Brown (2): Cygwin: add header defining GCC exception codes Cygwin: strace: ignore GCC exceptions winsup/cygwin/exceptions.cc | 10 +- winsup/cygwin/gcc_seh.h | 19 +++ winsup/utils/strace.cc | 8 3 files changed, 28 insertions(+), 9 deletions(-)

[PATCH 2/2] Cygwin: strace: ignore GCC exceptions

2020-08-20 Thread Ken Brown via Cygwin-patches
Any C++ app that calls 'throw' on 64-bit Cygwin results in an exception of type STATUS_GCC_THROW (0x20474343) generated by the C++ runtime. Don't pollute the strace output by printing information about this and other GCC exceptions. --- winsup/utils/strace.cc | 8 1 file changed, 8

[PATCH] Cygwin: fhandler_fifo::delete_client_handler: improve efficiency

2020-08-26 Thread Ken Brown via Cygwin-patches
Delete a client handler by swapping it with the last one in the list instead of calling memmove. --- winsup/cygwin/fhandler_fifo.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index b3c4c4a25..75c8406fe

[PATCH] Cygwin: sigproc.cc: fix typo in comment describing nprocs

2020-08-27 Thread Ken Brown via Cygwin-patches
nprocs is the number of children, not the number of deceased children. The incorrect comment used to apply to a variable nzombies. The latter was removed in commit 8cb359d9 in 2004, but the comment was never updated. --- winsup/cygwin/sigproc.cc | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] Cygwin: cwdstuff::get: clean up debug_printf output

2020-08-23 Thread Ken Brown via Cygwin-patches
Set errno = 0 at the beginning so that the debug_printf call at the end doesn't report a nonzero errno left over from some other function call. --- winsup/cygwin/path.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f3b9913bd..95faf8ca7

[PATCH 3/3] Cygwin: always recognize AF_UNIX sockets as reparse points

2020-09-29 Thread Ken Brown via Cygwin-patches
If __WITH_AF_UNIX is defined when Cygwin is built, then a named AF_UNIX socket is represented by a reparse point with a Cygwin-specific tag and GUID. Make such files recognizable as reparse points (but not as sockets) even if __WITH_AF_UNIX is not defined. That way utilities such as 'ls' and 'rm'

[PATCH 2/3] Cygwin: fix handling of known reparse points that are not symlinks

2020-09-29 Thread Ken Brown via Cygwin-patches
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path handling", changed check_reparse_point_target so that it could return a positive value on a known reparse point that is not a symlink. But some of the code in check_reparse_point that handles this positive return value was executed

[PATCH 1/3] Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed

2020-09-29 Thread Ken Brown via Cygwin-patches
There are two Windows system calls that currently fail with STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket: a call to NtOpenFile in get_file_sd and a call to NtCreateFile in fhandler_base::open. Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls when the file

[PATCH 0/3] Some AF_UNIX fixes

2020-09-29 Thread Ken Brown via Cygwin-patches
I'll push these in a few days if no one sees anything wrong. Corinna, please check them when you return. Ken Brown (3): Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed Cygwin: fix handling of known reparse points that are not symlinks Cygwin: always recognize AF_UNIX sockets as

Re: [PATCH 0/3] Warning fixes for gcc 10.2

2020-09-21 Thread Ken Brown via Cygwin-patches
On 9/21/2020 3:25 PM, Jon Turney wrote: Jon Turney (3): Cygwin: avoid GCC 10 error with -Werror=parentheses Cygwin: avoid GCC 10 error with -Werror=narrowing Cygwin: avoid GCC 10 error with -Werror=narrowing winsup/cygwin/fhandler_console.cc | 4 ++--

[PATCH] Cygwin: winlean.h: remove most of extended memory API

2020-09-23 Thread Ken Brown via Cygwin-patches
This was added as a temporary measure in commit e18f7f99 because it wasn't yet in the mingw-w64 headers. With one exception, it is now in the current release of the headers (version 8.0.0), so we don't need it in winlean.h. The exception is that VirtualAlloc2 is only declared conditionally in ,

Re: [PATCH] Cygwin: winlean.h: remove most of extended memory API

2020-09-24 Thread Ken Brown via Cygwin-patches
On 9/24/2020 10:04 AM, Jon Turney wrote: On 24/09/2020 00:52, Ken Brown via Cygwin-patches wrote: This was added as a temporary measure in commit e18f7f99 because it wasn't yet in the mingw-w64 headers.  With one exception, it is now in the current release of the headers (version 8.0.0), so we

Re: [PATCH v2] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-21 Thread Ken Brown via Cygwin-patches
On 9/21/2020 3:22 PM, Jon Turney wrote: On 18/09/2020 22:17, Ken Brown via Cygwin-patches wrote: Do you have to run something to regen the docs, FAQ.html, and push to the web site, or does it run periodically, so I can follow up to the OP and get feed back from the responder? No, sorry.  I

Re: [PATCH v2] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-18 Thread Ken Brown via Cygwin-patches
On 9/18/2020 11:29 AM, Brian Inglis wrote: On 2020-09-18 05:59, Ken Brown via Cygwin-patches wrote: On 9/17/2020 10:53 PM, Brian Inglis wrote: enumerate Vista, 7, 8, 10 progression to be clear, and earliest server 2008; add 8.1, exclude S mode, add Cygwin32 on ARM, specify 64 bit only AMD

Re: [PATCH] fhandler_proc.cc(format_proc_cpuinfo): add tsxldtrk, sev_es flags

2020-09-17 Thread Ken Brown via Cygwin-patches
On 9/17/2020 2:51 PM, Brian Inglis wrote: Add linux-next cpuinfo flags for Intel TSX suspend load address tracking instructions and AMD Secure Encrypted Virtualization with Encrypted State --- winsup/cygwin/fhandler_proc.cc | 8 1 file changed, 8 insertions(+) diff --git

Re: [PATCH] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-17 Thread Ken Brown via Cygwin-patches
On 9/17/2020 2:29 PM, Brian Inglis wrote: Based on thread https://cygwin.com/pipermail/cygwin/2020-September/246318.html enumerate Vista, 7, 8, 10 progression to be clear, and earliest server 2008 --- winsup/doc/faq-what.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

Re: [PATCH v2] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-18 Thread Ken Brown via Cygwin-patches
On 9/17/2020 10:53 PM, Brian Inglis wrote: enumerate Vista, 7, 8, 10 progression to be clear, and earliest server 2008; add 8.1, exclude S mode, add Cygwin32 on ARM, specify 64 bit only AMD/Intel --- winsup/doc/faq-what.xml | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)

[PATCH] Cygwin: fix return value of sqrtl on negative infinity

2020-10-27 Thread Ken Brown via Cygwin-patches
The return value is now -NaN. This fixes a bug in the mingw-w64 code that was imported into Cygwin. The fix is consistent with Posix and Linux. It is also consistent with the current mingw-w64 code, with one exception: The mingw-w64 code sets errno to EDOM if the input is -NaN, but this appears

Re: [PATCH] Cygwin: mmap: Remove AT_ROUND_TO_PAGE workaround

2020-07-20 Thread Ken Brown via Cygwin-patches
Hi Corinna, On 7/20/2020 2:55 PM, Corinna Vinschen wrote: From: Corinna Vinschen It's working on 32 bit OSes only anyway. It even fails on WOW64. Signed-off-by: Corinna Vinschen --- Notes: Hi Ken, can you please review this patch and check if it doesn't break your

Re: [PATCH] Cygwin: mmap: fix mapping beyond EOF on 64 bit

2020-07-20 Thread Ken Brown via Cygwin-patches
On 7/20/2020 4:29 PM, Brian Inglis wrote: On 2020-07-20 09:41, Corinna Vinschen wrote: Ultimately, I wonder if we really should keep all the 32 bit OS stuff in. The number of real 32 bit systems (not WOW64) is dwindling fast. Keeping all the AT_ROUND_TO_PAGE stuff in just for what? 2%? of the

[PATCH] Cygwin: cygserver: build with -Wimplicit-fallthrough=5

2020-08-07 Thread Ken Brown via Cygwin-patches
Define the pseudo keyword 'fallthrough' in woutsup.h to support this. --- winsup/cygserver/Makefile.in | 2 +- winsup/cygserver/bsd_helper.cc | 2 +- winsup/cygserver/bsd_mutex.cc | 2 +- winsup/cygserver/woutsup.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH 1/8] Cygwin: FIFO: lock fixes

2020-08-04 Thread Ken Brown via Cygwin-patches
Add some missing locks and remove one extra unlock. Clarify for some functions whether caller or callee acquires lock, and add appropriate comments. --- winsup/cygwin/fhandler_fifo.cc | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git

[PATCH 2/8] Cygwin: FIFO: fix timing issue with owner change

2020-08-04 Thread Ken Brown via Cygwin-patches
fhandler_fifo::take_ownership() tacitly assumes that the current owner's fifo_reader_thread will be woken up from WFMO when update_needed_evt is signaled. But it's possible that the the current owner's fifo_reader_thread is at the beginning of its main loop rather than in its WFMO call when that

[PATCH 0/8] FIFO: bug fixes and small improvements

2020-08-04 Thread Ken Brown via Cygwin-patches
The second patch in this series fixes a serious bug that has resulted in observable hangs. The other patches are minor bug fixes or minor performance improvements. Ken Brown (8): Cygwin: FIFO: lock fixes Cygwin: FIFO: fix timing issue with owner change Cygwin: FIFO: add a timeout to

[PATCH 5/8] Cygwin: FIFO: don't read from pipes that are closing

2020-08-04 Thread Ken Brown via Cygwin-patches
Don't try to read from fifo_client_handlers that are in the fc_closing state. Experiments have shown that this always yields STATUS_PIPE_BROKEN, so it just wastes a Windows system call. Re-order the values in enum fifo_client_connect_state to reflect the new status of fc_closing. ---

[PATCH 4/8] Cygwin: FIFO: reorganize some fifo_client_handler methods

2020-08-04 Thread Ken Brown via Cygwin-patches
Rename the existing set_state() to query_and_set_state() to reflect what it really does. (It queries the O/S for the pipe state.) Add a new set_state() method, which is a standard setter, and a corresponding getter get_state(). --- winsup/cygwin/fhandler.h | 9 --

[PATCH 3/8] Cygwin: FIFO: add a timeout to take_ownership

2020-08-04 Thread Ken Brown via Cygwin-patches
fhandler_fifo::take_ownership() is called from select.cc::peek_fifo and fhandler_fifo::raw_read and could potentially block indefinitely if something goes wrong. This is always undesirable in peek_fifo, and it is undesirable in a nonblocking read. Fix this by adding a timeout parameter to

[PATCH 6/8] Cygwin: FIFO: synchronize the fifo_reader and fifosel threads

2020-08-04 Thread Ken Brown via Cygwin-patches
The fifo_reader thread function and the function select.cc:peek_fifo() can both change the state of a fifo_client_handler. These changes are made under fifo_client_lock, so there is no race, but the changes can still be incompatible. Add code to make sure that only one of these functions can

[PATCH 8/8] Cygwin: FIFO: add a third pass to raw_read

2020-08-04 Thread Ken Brown via Cygwin-patches
Currently raw_read makes two passes through the list of clients. On the first pass it tries to read from the client from which it last read successfully. On the second pass it tries to read from all connected clients. Add a new pass in between these two, in which raw_read tries to read from all

[PATCH 7/8] Cygwin: FIFO: fix indentation

2020-08-04 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/fhandler_fifo.cc | 96 +- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 2b829eb6c..017d44e54 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++

Re: Cygwin 3.1.6

2020-07-06 Thread Ken Brown via Cygwin-patches
On 7/6/2020 3:50 PM, Corinna Vinschen wrote: Hi guys, Do you have anything in the loop which should go into 3.1.6? Given https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=bb96bd0, I'd like to release 3.1.6 this week. I'm working on some FIFO fixes, but it could be another week

Re: [PATCH v3] Cygwin: pty: Fix screen distortion after less for native apps again.

2020-06-09 Thread Ken Brown via Cygwin-patches
On 6/3/2020 9:43 PM, Takashi Yano via Cygwin-patches wrote: - Commit c4b060e3fe3bed05b3a69ccbcc20993ad85e163d seems to be not enough. Moreover, it does not work as expected at all in Win10 1809. This patch essentially reverts that commit and add another fix. After all, the cause of the

[PATCH 10/12] Cygwin: FIFO: allow take_ownership to be interrupted

2020-07-16 Thread Ken Brown via Cygwin-patches
Use cygwait in take_ownership to allow interruption while waiting to become owner. Return the cygwait return value or a suitable value to indicate an error. raw_read now checks the return value and acts accordingly. --- winsup/cygwin/fhandler.h | 2 +- winsup/cygwin/fhandler_fifo.cc | 54

[PATCH 12/12] Cygwin: FIFO: update commentary

2020-07-16 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/fhandler_fifo.cc | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 30486304f..e9d0187d4 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc

[PATCH 05/12] Cygwin: FIFO: improve taking ownership in fifo_reader_thread

2020-07-16 Thread Ken Brown via Cygwin-patches
When a reader takes ownership in fifo_reader_thread, it now goes directly to the part of the main loop that listens for a connection. Previously it went back to the beginning of the loop. Also, if the reader has to delay taking ownership because the previous owner has not finished updating the

[PATCH 04/12] Cygwin: FIFO: reduce I/O interleaving

2020-07-16 Thread Ken Brown via Cygwin-patches
Add a bool member 'last_read' to the fifo_client_handler structure, which is set to true on a successful read. This is used by raw_read as follows. When raw_read is called, it first locates the writer (if any) for which last_read is true. raw_read tries to read from that writer and returns if

[PATCH 07/12] Cygwin: FIFO: make certain errors non-fatal

2020-07-16 Thread Ken Brown via Cygwin-patches
If update_my_handlers fails to duplicate one or more handles, just mark the corresponding handlers as being in an error state. But if update_my_handlers is unable to open the process of the previous owner, it's likely that something serious has gone wrong, so we continue to make that a fatal

[PATCH 01/12] Cygwin: FIFO: fix problems finding new owner

2020-07-16 Thread Ken Brown via Cygwin-patches
When the owning reader closes and there are still readers open, the owner needs to wait for a new owner to be found before closing its fifo_client handlers. This involves a loop in which dec_nreaders is called at the beginning and inc_nreaders is called at the end. Any other reader that tries to

[PATCH 03/12] Cygwin: fhandler_fifo::hit_eof: improve reliability

2020-07-16 Thread Ken Brown via Cygwin-patches
Use the writer count introduced in the previous commit to help detect EOF. Drop the maybe_eof method, which is no longer needed. --- winsup/cygwin/fhandler.h | 7 +++ winsup/cygwin/fhandler_fifo.cc | 26 ++ winsup/cygwin/select.cc| 3 +-- 3 files

[PATCH 06/12] Cygwin: FIFO: fix indentation

2020-07-16 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/fhandler_fifo.cc | 168 - 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 1fb319fcf..69dda0811 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++

[PATCH 00/12] FIFO: fix multiple reader support

2020-07-16 Thread Ken Brown via Cygwin-patches
There were several flaws in my previous attempt to add support for explicitly opening a FIFO multiple times for reading. (By "explicitly" I mean by calling open rather than by calling fork/exec/dup.) See https://sourceware.org/pipermail/cygwin/2020-July/245456.html for one indication of

[PATCH 08/12] Cygwin: FIFO: add missing lock

2020-07-16 Thread Ken Brown via Cygwin-patches
--- winsup/cygwin/fhandler_fifo.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 91a276ee9..b6e172ddc 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -422,7 +422,9 @@

[PATCH 02/12] Cygwin: FIFO: keep a writer count in shared memory

2020-07-16 Thread Ken Brown via Cygwin-patches
When a reader opens, it needs to block if there are no writers open (unless is is opened with O_NONBLOCK). This is easy for the first reader to test, since it can just wait for a writer to signal that it is open (via the write_ready event). But when a second reader wants to open, all writers

[PATCH 09/12] Cygwin: fhandler_fifo::take_ownership: don't set event unnecessarily

2020-07-16 Thread Ken Brown via Cygwin-patches
Don't set update_needed_evt if there's currently no owner. This will cause unnecessary churn once I'm the owner and am listening for connections. --- winsup/cygwin/fhandler_fifo.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_fifo.cc

[PATCH 11/12] Cygwin: FIFO: clean up

2020-07-16 Thread Ken Brown via Cygwin-patches
Remove the fhandler_fifo::get_me method, which is no longer used. Make the methods get_owner, set_owner, owner_lock, and owner_unlock private. --- winsup/cygwin/fhandler.h | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler.h

[PATCH] Cygwin: mmap: fix mapping beyond EOF on 64 bit

2020-07-20 Thread Ken Brown via Cygwin-patches
Commit 605bdcd410384dda6db66b9b8cd19e863702e1bb enabled mapping beyond EOF in 64 bit environments. But the variable 'orig_len' did not get rounded up to a multiple of 64K. This rounding was done on 32 bit only. Fix this by rounding up orig_len on 64 bit, in the same place where 'len' is rounded

Re: [PATCH] Cygwin: mmap: fix mapping beyond EOF on 64 bit

2020-07-20 Thread Ken Brown via Cygwin-patches
On 7/20/2020 10:23 AM, Corinna Vinschen wrote: On Jul 20 09:34, Ken Brown via Cygwin-patches wrote: Commit 605bdcd410384dda6db66b9b8cd19e863702e1bb enabled mapping beyond EOF in 64 bit environments. But the variable 'orig_len' did not get rounded up to a multiple of 64K. This rounding

  1   2   >