Commit Graph

19483 Commits

Author SHA1 Message Date
Ken Brown 02cf27d948 Cygwin: FIFO: fix problems finding new owner
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 access shmem->_nreaders during this loop
will therefore get an inaccurate answer.

Fix this by adding an nreaders method and using it instead of
dec_nreaders and inc_nreaders.  Also add nreaders_lock to control
access to the shmem->_nreaders.

Make various other changes to improve the reliability of finding a new
owner.
2020-10-14 10:54:23 -04:00
Aschref Ben Thabet 916d8fed42 ctype.h: Fix unused variable warnings
If __HAVE_LOCALE_INFO__ is not defined, then the locale in the
locale-specific ctype functions is ignored.  In the previous
implementation this resulted in compiler warnings.  For example:

int main()
{
  locale_t locale;
  locale = duplocale(uselocale((locale_t)0));
  isspace_l('x', locale);
  return 0;
}

gcc -Wall main.c
main.c: In function 'main':
main.c:6:11: warning: variable 'locale' set but not used [-Wunused-but-set-variable]
    6 |  locale_t locale;
      |           ^~~~~~
2020-10-14 10:54:23 -04:00
Corinna Vinschen 25706d7f68 Cygwin: document previous poll/select patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:23 -04:00
Marc Hoersken 55165a1ae3 Cygwin: make sure failed sockets always signal writability
Since FD_CONNECT is only given once, we manually need to set
FD_WRITE for connection failed sockets to have consistent
behaviour in programs calling poll/select multiple times.

Example test to non-listening port: curl -v 127.0.0.1:47
2020-10-14 10:54:23 -04:00
Brian Inglis 9397816de7 Cygwin: FAQ 1.6: Update "Who's behind the project?"
winsup/doc/faq-what.xml: remove Red Hat, Net, Win32 references and clean up
2020-10-14 10:54:23 -04:00
Brian Inglis 8d4ff724e4 Cygwin: FAQ 1.5: Clarify "What version is this"
Patch to:
https://sourceware.org/git/?p=newlib-cygwin.git;f=winsup/doc/faq-what.xml;a=blob
as a result of thread:
	https://cygwin.com/pipermail/cygwin/2020-July/245442.html
and comments:
	https://cygwin.com/pipermail/cygwin-patches/2020q3/010331.html
Relate Cygwin DLL to Unix kernel,
add required options to command examples,
differentiate Unix and Cygwin commands;
mention that the cygwin package contains the DLL,
replace setup.exe reference by Cygwin Setup program wording.
2020-10-14 10:54:23 -04:00
Jon Turney 5347ab3498 Cygwin: Make dumper scan more than first 4GB of VM on x86_64
It's unclear that we need an end address here at all, or can just rely
on VirtualQueryEx() failing when we reach the end of memory regions.
2020-10-14 10:54:23 -04:00
Jon Turney c7d3540d2c Cygwin: Add a new win32_pstatus data type for modules on x86_64
Also take a bit more care with sizes in other data types to ensure they
are the same on x86 and x86_64.

Add some explanatory comments.
2020-10-14 10:54:23 -04:00
Jon Turney 56b1442e75 Cygwin: Update ELF target used by dumper on x86_64
Like [1], but actually making the effort to be 'usable' and 'tested'.

[1] https://cygwin.com/pipermail/cygwin/2019-October/242815.html
2020-10-14 10:54:23 -04:00
Jon Turney f44c184c6c Cygwin: Slightly improve error_start documentation 2020-10-14 10:54:23 -04:00
Keith Packard via Newlib aa683f399a testsuite: Fix iconv tests to use new encoding config defines
_ICONV_CONVERTER -> ICONV_FROM_ENCODING. It's not perfect, as the
library can support different from/to encodings now, but at least in
the default configurations the tests now work.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-10-14 10:54:23 -04:00
Keith Packard via Newlib 940ac9e35d libc/iconv: find_alias was mis-computing remaining alias table length
This caused the strnstr to walk off the end of the alias array and
fetch invalid data. Instead of attempting to update 'len', just
re-compute it based on the table end pointer that is already known.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-10-14 10:54:23 -04:00
Keith Packard via Newlib 5660c28317 libc/iconv: Remove unneeded pointer var for _iconv_aliases
The pointer value for the iconv alias data never changes, so get rid
of the pointer and make it an array instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-10-14 10:54:23 -04:00
Keith Packard via Newlib 7efb02b55b libc/iconv: Detect CES handler loading failure
Fix the code checking for character set loading failure so that
it checks the return value from the init function.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-10-14 10:54:22 -04:00
David Allsopp 16bc04dabe Fix invalid acl_entry_t on 32-bit Cygwin
If the acl_t struct was at or above 0x80000000 then the pointer was
sign-extended to 0xffff_ffff_8000_0000 and so the index was lost.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2020-10-14 10:54:22 -04:00
Corinna Vinschen dfa37a4b42 Cygwin: convert sys_wcstombs/sys_mbstowcs wrapper to inline functions
This should slightly speed up especially path conversions,
given there's one less function call rearranging all function
arguments in registers/stack (and less stack pressure).

For clarity, rename overloaded  sys_wcstombs to _sys_wcstombs
and sys_cp_mbstowcs to _sys_mbstowcs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Corinna Vinschen f007b6e24a Cygwin: Bump DLL version to 3.1.7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Corinna Vinschen 279b4f773e Cygwin: add microcode patch to release messages
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Brian Inglis 25e9b9d3ab format_proc_cpuinfo: fix microcode revision shift direction 2020-10-14 10:54:22 -04:00
Brian Inglis c08137a2bd fhandler_proc.cc(format_proc_cpuinfo): add microcode registry lookup values
Re: CPU microcode reported wrong in /proc/cpuinfo
    https://sourceware.org/pipermail/cygwin/2020-May/245063.html
earlier Windows releases used different registry values to store microcode
revisions depending on the MSR name being used to get microcode revisions:
add these alternative registry values to the cpuinfo registry value lookup;
iterate thru the registry data until a valid microcode revision is found;
some revision values are in the high bits, so if the low bits are all clear,
shift the revision value down into the low bits
2020-10-14 10:54:22 -04:00
Eshan dhawan via Newlib dc3dab6104 Removed #ifndef _ARM_PCS_VFP_ from sys/fenv.h for arm
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:22 -04:00
Corinna Vinschen 5216ec9458 Cygwin: fix buffer overrun in cygwin_strcasecmp
sys_mbstowcs is called with the destination buffer length
set to MaximumLength from the receiving UNICODE_STRING buffer.
This is twice as much as the actual size of the buffer in
wchar_t units, which is the unit expected by sys_mbstowcs.

sys_mbstowcs always attaches a NUL, within the destination
buffersize given.  But if the string is exactly one wchar_t
less than the actual buffer, and the buffersize is given too
large, sys_mbstowcs writes a NUL one wchar_t beyond the buffer.

This has only been exposed with Cygwin 3.1.5 because alloca
on newer gcc 9 apparently allocates more tightly.  The alloca
buffer here is requested with 16 bytes, which is exactly the
number of bytes required for the string L"cmd.exe".  Older gcc
apparently allocated a few more bytes on the stack, while gcc 9
allocates in 16 byte granularity...

Fix this by giving the correct destination buffer size to
sys_mbstowcs.

Fixes: https://cygwin.com/pipermail/cygwin/2020-June/245226.html
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Corinna Vinschen 1d0b1e9bd5 libm: machine: Add missing sparc and mips configuration
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Eshan dhawan via Newlib 011d459484 mips fenv support
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:22 -04:00
Eshan dhawan via Newlib 09f5b05014 SPARC fenv support
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:22 -04:00
Eshan dhawan via Newlib 9fc5eb7747 fenv aarch64 support
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:22 -04:00
Dimitar Dimitrov a5cd471c7c pru: Fix memory corruption on syscall return
In the initial code I missed one level of pointer indirection. Instead
of storing errno in impure_data, _impure_ptr was corrupted.

Only simulator is impacted. Real targets have no OS and no syscalls.

This resolves a bunch of stdio cases from the GCC testsuite:
  FAIL->PASS: gcc.c-torture/execute/printf-2.c   -O0  execution test

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-10-14 10:54:22 -04:00
Corinna Vinschen 26338189a8 Cygwin: add new IPPROTO_TCP options to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Corinna Vinschen fd4b5bd9b2 Cygwin: tcp: Support TCP_QUICKACK
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:22 -04:00
Corinna Vinschen 48656e7834 Cygwin: tcp: Support TCP_USER_TIMEOUT
Use TCP_MAXRTMS on newer systems, TCP_MAXRT on older systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Corinna Vinschen 140029a099 Cygwin: tcp: Support TCP_KEEPIDLE, TCP_KEEPCNT, TCP_KEEPINTVL
Use WSAIoctl(SIO_KEEPALIVE_VALS) on older systems.

Make sure that keep-alive timeout is equivalent to
TCP_KEEPIDLE + TCP_KEEPCNT * TCP_KEEPINTVL on older systems,
even with TCP_KEEPCNT being a fixed value on those systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Corinna Vinschen 1acd185bea Cygwin: tcp: Support TCP_FASTOPEN
TCP_FASTOPEN is supported since W10 1607.  Fake otherwise.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Corinna Vinschen 310ab6345e Cygwin: tcp: fix IPPROTO_TCP option handling
- Drop definitions from <cygwin/sockets.h>
- Drop options only available on BSD
- Fix value of TCP_MAXSEG.  It was still defined as the BSD value
  while WinSock uses another value
- Handle the fact that TCP_MAXSEG is a R/O value in WinSock

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches 2f5bd00569 Cygwin: pty, termios: Unify thoughts of read ahead beffer handling.
- Return value of eat_readahead() is redefined. The return values
  of fhandler_termios::eat_readahead() and fhandler_pty_slave::
  eat_readahead() were little bit different. This patch unifies
  them to number of bytes eaten by eat_readahead().
- Considerration for raixget() is added to fhandler_pty_master::
  accept_input() code.
- Transfering contents of read ahead buffer in
  fhandler_pty_master::transfer_input_to_pcon() is removed since
  it is not necessary.
- fhandler_pty_slave::eat_readahead() ckecks EOL only when ICANON
  is set.
- Guard for _POSIX_VDISABLE is added in checking EOL.
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches c42fd9415f Cygwin: pty: Discard CSI > Pm m sequence from native windows apps.
- If vim is started from WSL (Ubuntu) which is executed in pseudo
  console in mintty, shift key and ctrl key do not work. Though
  this issue is similar to the issue resolved by commit
  4527541ec6, that commit is not
  effective for this issue. This patch fixes the issue by discarding
  "CSI > Pm m" in fhandler_pty_master::pty_master_fwd_thread().
2020-10-14 10:54:21 -04:00
Eshan dhawan via Newlib c5bb4fc899 fenv support arm
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:21 -04:00
Jeff Johnston db57a46672 Regenerate libm/machine configuration files for powerpc 2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches 93d5b64449 Cygwin: pty: Fix screen distortion after less for native apps again.
- Commit c4b060e3fe 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 problem was a race issue in
  switch_to_pcon_out flag. That is, this flag is set when native
  app starts, however, it is delayed by wait_pcon_fwd(). Since the
  flag is not set yet when less starts, the data which should go
  into the output_handle accidentally goes into output_handle_cyg.
  This patch fixes the problem more essentially for the cause of
  the problem than previous one.
2020-10-14 10:54:21 -04:00
Eshan dhawan via Newlib 3ef3750910 hard float support for PowerPC taken from FreeBSD
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
2020-10-14 10:54:21 -04:00
Corinna Vinschen a4327f2576 Bump version to 3.1.6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches c4244a0200 Cygwin: pty: Fix screen distortion after using less for native apps.
- If the output of non-cygwin apps is browsed using less, screen is
  ocasionally distorted after less exits. This frequently happens
  if cmd.exe is executed after less. This patch fixes the issue.
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches 87d8065bdb Cygwin: pty: Revise the code which prevents undesired window title.
- In current pty, the window title can not be set from non-cygwin
  program due to the code which prevents overwriting the window
  title to "cygwin-console-helper.exe" in fhandler_pty_master::pty_
  master_fwd_thread(). This patch fixes the issue.
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches 3be69c5100 Cygwin: pty: Clean up fhandler_pty_master::pty_master_fwd_thread().
- Remove the code which is not necessary anymore.
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches a615ec9d49 Cygwin: console: Discard some unsupported escape sequences.
- If the cygwin vim is started from a non-cygwin process which is
  executed in pseudo console, shift key and ctrl key do not work.
  In this case, vim is executed under /dev/cons*. If vim outputs
  escape sequence which is not supported by pseudo console, the
  escape sequence is leaked into the parent pty. This causes
  unexpected results. This patch fixes the issue by discarding
  "CSI > Pm m". "OSC 10;? BEL/ST" and "OSC 11;? BEL/ST" are
  discarded as well.
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches 32edd9570d Cygwin: pty: Prevent garbage remained in read ahead buffer.
- After commit 29431fcb5b, the issue
  reported in https://cygwin.com/pipermail/cygwin/2020-May/245057.html
  occurs. This is caused by the following mechanism. Cygwin less
  called from non-cygwin git is executed under /dev/cons* rather
  than /dev/pty* because parent git process only inherits pseudo
  console handle. Therefore, less sets ICANON flag for /dev/cons*
  rather than original /dev/pty*. When pty is switched to non-cygwin
  git process, line_edit() is used in fhandler_pty_master::write()
  only to set input_available_event and read ahead buffer is supposed
  to be flushed in accept_input(). However, ICANON flag is not set
  for /dev/pty*, so accept_input() is not called unless newline
  is entered. As a result, the input data remains in the read ahead
  buffer. This patch fixes the issue.
2020-10-14 10:54:21 -04:00
Corinna Vinschen 1b5fb1f5bc Cygwin: update C++ dialect to gnu++14
Disable -std option since gnu++14 is default anyway, but keep
it available as comment.

Update dynamic exception specifications deprecated with
C++11 to C++11-introduced noexcept expression.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:21 -04:00
Takashi Yano via Cygwin-patches eec0f19adb Cygwin: console: Make cursor keys work in vim under ConEmu.
- After commit 774b8996d1, cursor
  keys do not work in vim under ConEmu without cygwin-connector.
  This patch fixes the issue.
2020-10-14 10:54:20 -04:00
Ken Brown a2627c34dc Cygwin: stat: fix st_mode of fifos again
This partially reverts commit
f36262d56a.  That commit incorrectly
made the st_mode of a fifo reflect the Windows permissions of the disk
file underlying the fifo.
2020-10-14 10:54:20 -04:00
Takashi Yano via Cygwin-patches 896f6dc387 Cygwin: pty: Prevent meaningless ResizePseudoConsole() calls.
- This patch prevents to call ResizePseudoConsole() unless the pty
  is resized.
2020-10-14 10:54:20 -04:00
Takashi Yano via Cygwin-patches fe59ac0da7 Cygwin: pty: Fix a bug in free_attached_console().
- After commit 7659ff0f5a, nohup does
  not work as expected. This patch fixes the issue.

  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2020-May/011885.html
2020-10-14 10:54:20 -04:00