Added a new global __sglue object for all configurations.
Decouples the global file object list from the _GLOBAL_REENT
structure by using this new object instead of the __sglue member
of _GLOBAL_REENT in __sfp() and _fwalk_sglue().
Replaced _fwalk_reent() with _fwalk_sglue(). The change adds an
extra __sglue object as a parameter, which will allow the passing
of a global __sglue object separate from the __sglue member of
struct _reent. The global __sglue object will be added in a
follow-on patch.
fix tty_nr maj/min bits, vmmaxrss units, and x86 format mismatch:
ctty maj is 31:16, min is 15:0; tty_nr s/b maj 15:8, min 31:20, 7:0;
vmmaxrss s/b bytes not pages;
times all 64 bit - change formats of first two instances from %lu to %U;
realign sprintf formats and variables/values in more logical groups
- Previously, script command sometimes crashes by Ctrl-C in Win 7
if it is running in console, and non-cygwin app is foreground.
This patch fixes the issue.
- The recent commit "Cygwin: pty: Fix timing of creating invisible
console." breaks the feature added by commit 72770148, which
prevents pty from changing code page of parent console. This patch
restores that.
- Previously, invisible console was created in fixup_after_exec().
However, actually this should be done in fixup_after_fork(). this
patch fixes the issue.
- When temporarily attaching a console, the timing of acquiring
attach_mutex was not appropriate. This sometimes caused master
forwarding thread to crash on Ctrl-C in Windows 7. This patch
fixes the issue.
Remove the pointer indirection through the read-only _global_impure_ptr and
directly use a externally visible _impure_data object of type struct _reent.
This enables the static initialization of global data structures in a follow up
patch. In addition, we get rid of a machine-specific file.
By including sys/_stdint.h, all types from stdint.h are
exposed even if stdint.h isn't pulled in explicitely. Include
<machine/_default_types.h instead. Fix up newlib and Cygwin
files which rely on stdint.h types, too.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Even after fork, we might need the parent sigmask without having
access to the real _main_tls. There's a short time at process startup,
when _main_tls points to the system-allocated stack, but wait_sig is
already running. If we can't lock _main_tls, because find_tls can't
find it yet, we now access the parent's sigmask via child_info.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The x86_64 thread stack area collides with the share user data in
recent versions of Windows. Let's get ourselvels get out of the
way and move the thread stack area in the former slack space
between DLL area and heap, from 0x6:00000000 to 0x8:00000000.
That quadruplicates the stack area, so allow bigger maximum stack
sizes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Originally the function was designed to be used in forked
processes as well, but it has never been used this way. Drop
the parameter only required for forkees.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
A recent patch fixed gmondump to stop printing "0x0x" as an address
prefix. It turns out the Cygwin User's Guide and the gmondump and
ssp man pages (all from utils.xml) have examples of the same error.
- In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for
non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent
to GDB but to the inferior. This patch fixes the issue.
- The internal handles in HPCON should not be inheritable, however,
the current code duplicates them as inheritable when handing over
ownership of the pseudo console. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html
- Currently, close_pseudoconsole() is called unconditionally from
fhandler_termios::process_sigs() on Ctrl-C. This causes deadlock
if Ctrl-C is pressed while setup_pseudoconsole() is called. With
this patch, close_pseudoconsole() is called only if the master
process is the owner of the nat-pipe to avoid the deadlock.
- As mentioned in commit message of the commit b531d6b0, if multiple
writers including non-cygwin app exist, the non-cygwin app cannot
detect pipe closure on the read side when the pipe is created by
system account or the the pipe creator is running as service.
This is because query_hdl which is held in write side also is a
read end of the pipe, so the pipe is still alive for the non-cygwin
app even after the reader is closed.
To avoid this problem, this patch lets all processes in the same
process group close query_hdl using newly introduced internal signal
__SIGNONCYGCHLD when non-cygwin app is started.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
- Using memcmp() to compare structure such as INPUT_RECORD is not
correct manner because padding may not be initialized. This patch
stops to use memcmp() for comparison of INPUT_RECORD.
- dwControlKeyState also may be null'ed on WriteConsoleInputW().
Therefore ignore it in event comparison as well as wVirtualKeyCode
and wVirtualScanCode.
- The commit "Cygwin: console: Improve the code to avoid typeahead
key swapping." did not solve the problem enough. Two unexpected
things happen.
(1) wVirtualKeyCode and wVirtualScanCode of readback key event may
be null'ed even if they are not zero on WriteConsoleInputW().
Therefore, memcmp() may report the event sequence is not equal.
(2) WriteConsoleInputW() may not be atomic. The event sequence
which is written by WriteConsoleInputW() may be inserted by
key input in the middle of the sequence. Current code gives
up to fix in this situation.
This patch should fix that issue.
When using a compiler that automatically enables -D_FORTIFY_SOURCE,
building winsup fails with errors like below. Since winsup is not
setup to compile itself with _FORTIFY_SOURCE, disable it for now.
make[4]: Entering directory '.../x86_64-pc-cygwin/winsup/cygwin'
CC libc/minires-os-if.o
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:9:1: error: conflicting types for 'recv';
have 'ssize_t(int, void *, size_t, int)' {aka 'long int(int, void *, long unsigned int, int)'}
9 | __ssp_redirect0(ssize_t, recv, \
| ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1022:34: note: previous declaration of 'recv' with
type 'int(SOCKET, char *, int, int)' {aka 'int(long long unsigned int, char *, int, int)'}
1022 | WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
| ^~~~
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:13:1: error: conflicting types for 'recvfrom';
have 'ssize_t(int, void *, size_t, int, struct sockaddr *, socklen_t *)' {aka 'long int(int, void *, long unsigned int, int, struct sockaddr *, int *)'}
13 | __ssp_redirect0(ssize_t, recvfrom, \
| ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1023:34: note: previous declaration of 'recvfrom' with
type 'int(SOCKET, char *, int, int, struct sockaddr *, int *)' {aka 'int(long long unsigned int, char *, int, int, struct sockaddr *, int *)'}
1023 | WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen);
| ^~~~~~~~
make[4]: *** [Makefile:1930: libc/minires-os-if.o] Error 1
CC gmon.o
../../../../../winsup/cygwin/gmon.c:60: error: "bzero" redefined [-Werror]
60 | #define bzero(ptr,size) memset (ptr, 0, size);
|
In file included from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/gmon.h:69,
from ../../../../../winsup/cygwin/gmon.c:47:
.../newlib/newlib/libc/include/ssp/strings.h:43: note: this is the location of the previous definition
43 | #define bzero(dst, len) \
|
cc1: all warnings being treated as errors
Convert all the libc/ subdir makes into the top-level Makefile. This
allows us to build all of libc from the top Makefile without using any
recursive make calls. This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libc.a. The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libc_a_SOURCES.
There's a few dummy.c files that are no longer necessary since we aren't
doing the lib.a accumulating, so punt them.
The winsup code has been pulling the internal newlib ssp library out,
but that doesn't exist anymore, so change that to pull the objects.
- If UNC path for DFS is mounted to a drive with drive letter, the
error "Too many levels of symbolic links" occurs when accessing
to that drive. This is because GetDosDeviceW() returns unexpected
string such as "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver
\dfs\linkname" for the mounted UNC path "\??\UNC\fileserver\share".
This patch adds a workaround for this issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/250979.html
- After the commit "Cygwin: pty, console: Fix handle leak which
occurs on exec() error.", startxwin cannot start X due to the
error "Failed to activate virtual core keyboard: 2". The problem
is access violation in the code retrieving the pgid of the ctty.
This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251013.html