Commit Graph

13330 Commits

Author SHA1 Message Date
Corinna Vinschen 830a9b707c Cygwin: drop PROCESSOR_ARCHITECTURE_INTEL from uname
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-16 18:17:06 +02:00
Corinna Vinschen 83f8e24f0b Cygwin: document why we can't drop the _pei386_runtime_relocator dummy
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-16 18:17:06 +02:00
Corinna Vinschen b3b9e231de Cygwin: drop i386 refs from header files where source isn't affected
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-16 18:17:06 +02:00
Corinna Vinschen 866ae2c254 Cygwin: drop 32 bit considerations in crt0 code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-16 18:17:06 +02:00
Takashi Yano b79d60b7d2 Cygwin: add 3.3.6 release notes 2022-05-16 20:15:17 +09:00
Takashi Yano faf1e11592 Cygwin: pty: Fix script command crash on console in Win7.
- Previously, the command "cmd /c script -c cmd" in console of Win7
  crashes. This seems to be due to a bug (?) of AttachConsole().
  This patch adds workaround for this issue.

  Currently, pty reattaches to the console of the process which is
  predetermined by ConsoleProcessList() after temporarily attaching
  to another console. After that, the console output handle opened
  with the name "CONOUT$" may not be accessible in Win7.
  This seems to happen when the attached process does not have the
  same handle even if the console attached is the same. With this
  patch, cygwin-console-helper which is started when pty master is
  opened in console, is utilized to be a target process to which
  pty reattaches if the OS is Win7.
2022-05-15 07:25:56 +09:00
Corinna Vinschen 8f66bc28ae Cygwin: fix new sigfe.o generation in optimized case
Commit 0597c84b9b ("Cygwin: revamp TLS offsets computation")
introduced a really weird problem when building Cygwin with
optimization.

First of all, the tlsoffsets file is broken with -O2.  This
can easily be fixed by running the compiler with -O0 when called
from the gentls_offsets script.

But it gets worse:

When creating sigfe.o with optimization, the generated machine code
uses incorrect offsets: For some reason the assembler codes using
_cygtls.stackptr as offset value are assembled into machine code
using _cygtls.pstackptr as offsets.

And as if that isn't already absurd enough, renaming _cygtls.pstackptr
to, say, _cygtls.blurb, fixes the assembled machine code expressions;
they use the value of _cygtls.stackptr again.

So I changed gentls_offsets and gendef to use _cygtls.foo_p rather
than _cygtls.pfoo and that fixes the assembled code in the optimized
case.

No, I can't explain that.  There's no system in that behaviour.
It looks absolutely crazy.

Fixes: 0597c84b9b ("Cygwin: revamp TLS offsets computation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 21:22:44 +02:00
Corinna Vinschen 4f034daba7 Cygwin: utils: drop unnecessary wow64 checks
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:34:20 +02:00
Corinna Vinschen d4df9c6de1 Cygwin: drop a few minor references to WOW64
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:32:21 +02:00
Corinna Vinschen 974163bc18 Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:31:29 +02:00
Corinna Vinschen bf6940a413 Cygwin: wincap: drop has_broken_prefetchvm flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:30:11 +02:00
Corinna Vinschen 24363cffef Cygwin: drop system_wow64_directory and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:28:49 +02:00
Corinna Vinschen ca313dd8f4 Cygwin: drop create_token and dependent functions
Given we only called create_token on W7 WOW64 anyway, we can now
drop this function and all other functions only called from there
entirely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:21:52 +02:00
Corinna Vinschen a70a969c64 Cygwin: wincap: drop no_msv1_0_s4u_logon_in_wow64 flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:20:42 +02:00
Corinna Vinschen 0f4eb70ee7 Cygwin: wincap: set def_guard_pages to x86_64 value right away
Drop conditional code in wincapc::init.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:18:57 +02:00
Corinna Vinschen 2610b681a4 Cygwin: wincap: drop wow64 flag and all conditions depending on it
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:15:47 +02:00
Corinna Vinschen 0597c84b9b Cygwin: revamp TLS offsets computation
- convert gentls_offsets to a shell script, only running the target
  compiler and gawk.

- Simplify cygtls.h.  The new gentls_offsets script only requires two
  lines with the "public:" keyword as markers.  The comments are not
  used anymore, the output is a preprocesses file without comments.
  Align Makefile rules accordingly.

- Rather than generating perl variables and C #defines, just generate
  .ecu statements and .include the TLS offsets file right from the
  generated assembler file sigfe.s.  It's the only place we really
  need (some of) the offsets.

- Drop the target-specific name of the TLS offsets file and generate
  it on the fly in the build dir.  Fix configure and Makefile rules
  accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:11:58 +02:00
Corinna Vinschen c0d5bb262d Cygwin: configure: Define default valus for target specific variables
Define default values for DLL_ENTRY, DIN_FILE, and TLSOFFSETS_H
and drop them from the x86_64-specific branch.  Keep the mechanism
intact to allow other target CPUs if there ever will be.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:00:52 +02:00
Corinna Vinschen d4fa3b4abb Cygwin: config.h: stop including auto-generated tlsoffsets.h file
This was a hack to begin with.  Clean this mess up:

- Move definition of CYGTLS_PADSIZE to cygwin/config.h and drop
  local cygtls_padsize.h
- Rename CYGTLS_PADSIZE to __CYGTLS_PADSIZE__ to keep namespace
  clean.  Redefine as macro, rather than as const.
- Move struct _reent first in struct _cygtls to allow using
  __CYGTLS_PADSIZE__ as offset in __getreent().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:58:39 +02:00
Corinna Vinschen 2aa37fed76 Cygwin: drop i686-only files
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:45:45 +02:00
Corinna Vinschen e0df580bf9 Cygwin: configure: drop unused DEF_DLL_ENTRY variable
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:42:54 +02:00
Corinna Vinschen fcb32b7374 Cygwin: configure: disable i686 builds
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:42:54 +02:00
Corinna Vinschen d02421e7f7 Cygwin: switch to _REENT_GLOBAL_STDIO_STREAMS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:41:13 +02:00
Sebastian Huber 01c823efb7 Make cleanup_glue() static
Remove cleanup_glue from the list of symbols exported by Cygwin.
2022-05-13 12:47:29 +02:00
Matt Joyce 8b96542ed1 Add global __sglue object for all configurations
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().
2022-05-13 12:41:10 +02:00
Sebastian Huber 3941c8a88a stdio: Replace _fwalk_reent() with _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.
2022-05-13 12:40:10 +02:00
Matt Joyce 26747c47bc Add stdio_exit_handler()
Add a dedicated stdio exit handler to avoid using _GLOBAL_REENT in exit().
2022-05-13 12:35:00 +02:00
Corinna Vinschen 7c804d160d Cygwin: Implement GSO/GRO support
- getsockopt (SOL_UDP, UDP_SEGMENT)
- setsockopt (SOL_UDP, UDP_SEGMENT)
- getsockopt (SOL_UDP, UDP_GRO)
- setsockopt (SOL_UDP, UDP_GRO)
- sendmsg with SOL_UDP/UDP_SEGMENT control message
- recvmsg, convert Winsock UDP_COALESCED_INFO (DWORD) control message to
  Linux compatible SOL_UDP/UDP_GRO (uint16_t)
2022-05-13 11:11:38 +02:00
Corinna Vinschen 34a9570ff8 Cygwin: socket.h: add socket options added in recent Windows releases
Add new socket options equivalent to their Linux counterpart.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-12 11:33:29 +02:00
Sebastian Huber 6238b1877d Cygwin: signal.cc: Include <unistd.h>
Include <unistd.h> for sleep() and usleep() declarations.  Fix return type of
usleep().
2022-05-12 11:21:08 +02:00
Brian Inglis 437d0a8f88 fhandler_process.cc(format_process_stat): fix /proc/pid/stat issues
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
2022-05-11 09:57:52 +02:00
Takashi Yano 92b576dcc1 Cygwin: pty: Avoid script command crash in console.
- 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.
2022-05-09 20:32:05 +09:00
Takashi Yano a19161a6d3 Cygwin: pty: Not to change code page of parent console.
- 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.
2022-05-09 12:53:28 +09:00
Takashi Yano a6d06056e1 Cygwin: pty: Add missing attach_mutex guard. 2022-05-09 00:54:35 +09:00
Takashi Yano cc94490f6e Cygwin: pty: Avoid deadlock when pcon is started on console.
- Previously, "env SHELL=cmd script" command in console caused
  deadlock when starting cmd.exe. This patch fixes the issue.
2022-05-09 00:19:47 +09:00
Takashi Yano aea6940043 Cygwin: pty: Change the condition to send Ctrl-C event.
- Previously, non-cygwin app started by "script -c <non-cygwin app>"
  receives Ctrl-C twice. This patch fixes the issue.
2022-05-08 22:04:38 +09:00
Takashi Yano 67f12b2ea0 Cygwin: pty: Fix timing of creating invisible console.
- Previously, invisible console was created in fixup_after_exec().
  However, actually this should be done in fixup_after_fork(). this
  patch fixes the issue.
2022-05-08 19:47:05 +09:00
Takashi Yano b29fd96cac Cygwin: pty: Fix acquiring attach_mutex timing.
- 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.
2022-05-08 19:45:31 +09:00
Takashi Yano aa9b5262f2 Cygwin: sigproc: Avoid segfault caused by signal just after fork().
- The commit "Cygwin: always add sigmask to child info" also tries
  to fix this issue, however, did not fix enough. This patch fixes
  that.
2022-05-05 21:35:04 +09:00
Sebastian Huber ad51d0006a Remove _global_impure_ptr indirection
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.
2022-05-04 17:31:04 +02:00
Corinna Vinschen a404165959 Revert "sys/types.h: Don't include sys/_stdint.h"
This reverts commit 4232d171a6.
2022-05-04 15:08:44 +02:00
Corinna Vinschen 4232d171a6 sys/types.h: Don't include sys/_stdint.h
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>
2022-05-03 18:58:18 +02:00
Corinna Vinschen 5a6de512ab Cygwin: always add sigmask to child info
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>
2022-05-03 15:16:18 +02:00
Corinna Vinschen 28970dae34 Cygwin: move x86_64 thread stack area
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>
2022-05-03 15:10:24 +02:00
Corinna Vinschen b827d4d36a Cygwin: simplify create_new_main_thread_stack
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>
2022-05-03 14:39:28 +02:00
Jon Turney 01c734b0d7
Cygwin: Fix typo KERB_S4U_LOGON_FLAG_IDENTITY -> IDENTIFY 2022-04-27 15:02:46 +01:00
Jon Turney 0b44b06b05
Cygwin: Fix build with w32api 10.0.0
> ../../../../src/winsup/cygwin/sec_auth.cc:1240:16: error: redefinition of ‘struct _MSV1_0_S4U_LOGON’
>  1240 | typedef struct _MSV1_0_S4U_LOGON
>       |                ^~~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1425:18: note: previous definition of ‘struct _MSV1_0_S4U_LOGON’
>  1425 |   typedef struct _MSV1_0_S4U_LOGON {
>       |                  ^~~~~~~~~~~~~~~~~
> ../../../../src/winsup/cygwin/sec_auth.cc:1246:3: error: conflicting declaration ‘typedef int MSV1_0_S4U_LOGON’
>  1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |   ^~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1430:5: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON MSV1_0_S4U_LOGON’
>  1430 |   } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |     ^~~~~~~~~~~~~~~~
> ../../../../src/winsup/cygwin/sec_auth.cc:1246:22: error: conflicting declaration ‘typedef int* PMSV1_0_S4U_LOGON’
>  1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
>       |                      ^~~~~~~~~~~~~~~~~
> In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10,
>                  from ../../../../src/winsup/cygwin/sec_auth.cc:13:
> /usr/include/w32api/ntsecapi.h:1430:24: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON* PMSV1_0_S4U_LOGON’
>  1430 |   } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
2022-04-27 15:02:44 +01:00
Mark Geisert 23a3ec3392 Cygwin: Fix "0x0x" in gmondump and ssp man pages
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.
2022-04-27 11:40:09 +02:00
Takashi Yano 0a67adb0f5 Cygwin: pty: Fix Ctrl-C behaviour in latest GDB.
- 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.
2022-04-18 20:07:48 +09:00
Takashi Yano 98b6f23d98 Cygwin: pty: Fix deadlock caused by Ctrl-C in setup_pseudoconsole().
- If Ctrl-C is pressed just after setup_pseudoconsole() is called,
  mintty stops to respond a while when CPU load is high. This patch
  fixes the issue.

Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251272.html
2022-04-18 19:56:14 +09:00