Commit Graph

18997 Commits

Author SHA1 Message Date
Takashi Yano 82d338d78c Cygwin: pty: Unify the charset conversion codes into a function. 2020-10-14 10:54:01 -04:00
Takashi Yano f7e74231cd Cygwin: pty: Make GDB work again on pty. 2020-10-14 10:54:01 -04:00
Takashi Yano dc80badc50 Cygwin: pty: Avoid potential segfault in PTY code when ppid = 1. 2020-10-14 10:54:01 -04:00
Takashi Yano 5764f3dd50 Cygwin: console: Revive Win7 compatibility.
- The commit fca4cda7a4 broke Win7
  compatibility. This patch fixes the issue.
2020-10-14 10:54:01 -04:00
Ken Brown 1daa31008a Cygwin: document last change 2020-10-14 10:54:01 -04:00
Achim Gratz 7513fee1bb winsup/cygwin/times.cc (times): follow Linux and allow for a NULL buf argument
Adresses the problem reported here:

  https://cygwin.com/ml/cygwin/2019-09/msg00141.html
2020-10-14 10:54:01 -04:00
Takashi Yano 9103de7028 Cygwin: pty: Use autoload feature for pseudo console system calls.
- The autoload feature is used rather than GetModuleHandle(),
  GetProcAddress() for CreatePseudoConsole(), ResizePseudoConsole()
  and ClosePseudoConsole().
2020-10-14 10:54:01 -04:00
Takashi Yano 55f0eb2e84 Cygwin: pty: Correct typos that do not fit the coding style. 2020-10-14 10:54:00 -04:00
Takashi Yano b23705f60b Cygwin: pty: Change the timing of clearing screen.
- The code which clears screen is moved from reset_switch_to_pcon()
  to fixup_after_exec() because it seems not too early even at this
  timing.
2020-10-14 10:54:00 -04:00
Takashi Yano 53b381dec9 Cygwin: pty: Use system NLS function instead of PTY's own one.
- Since calling system __loadlocale() caused execution error,
  PTY used its own NLS function. The cause of the error has been
  found, the corresponding code has been rewritten using system
  function.
2020-10-14 10:54:00 -04:00
Takashi Yano 36c814d0fd Cygwin: pty: Fix bad file descriptor error in some environment.
- The bad file descriptor problem reported in:
  https://cygwin.com/ml/cygwin-patches/2019-q3/msg00104.html
  was recurring. Fixed again.
2020-10-14 10:54:00 -04:00
Mark Geisert 52593b8619 Cygwin: fix CPU_SET macro visibility
The CPU_SET macros defined in Cygwin's include/sys/cpuset.h must not
be visible in an application's namespace unless _GNU_SOURCE has been
#defined.  Internally this means wrapping them in #if __GNU_VISIBLE.
2020-10-14 10:54:00 -04:00
Takashi Yano 991511fbda Cygwin: console: Fix read() in non-canonical mode.
- In non-canonical mode, cygwin console returned only one character
  even if several keys are typed before read() called. This patch
  fixes this behaviour.
2020-10-14 10:54:00 -04:00
Takashi Yano 527b44af0d Cygwin: pty: Switch input and output pipes individually.
- Previously, input and output pipes were switched together between
  the traditional pty and the pseudo console. However, for example,
  if stdin is redirected to another device, it is better to leave
  input pipe traditional pty side even for non-cygwin program. This
  patch realizes such behaviour.
2020-10-14 10:54:00 -04:00
Takashi Yano 7eedc9b1a0 Cygwin: pty: Prevent the helper process from exiting by Ctrl-C. 2020-10-14 10:54:00 -04:00
Takashi Yano 0d1678f52d Cygwin: pty: Fix screen alternation while pseudo console switching.
- If screen alternated while pseudo console switching, it sometimes
  failed. This might happen when the output of the non-cygwin program
  is piped to less. This patch fixes this issue.
2020-10-14 10:54:00 -04:00
Takashi Yano a0e1fe0ba1 Cygwin: pty: Fix the behaviour of Ctrl-C in the pseudo console mode.
- When the I/O pipe is switched to the pseudo console side, the
  behaviour of Ctrl-C was unstable. This rarely happens, however,
  for example, shell sometimes crashes by Ctrl-C in that situation.
  Furthermore, Ctrl-C was ignored if output of non-cygwin program
  is redirected to pipe. This patch fixes these issues.
2020-10-14 10:54:00 -04:00
Joel Sherrill 6a4264d5fd libc/include/devctl.h: Add SOCKCLOSE per FACE Technical Standard, Edition 3.0
The FACE Technical Standard, Edition 3.0 and later require the
	definition of the subcommand SOCKCLOSE in <devctl.h>.
	Reference: https://www.opengroup.org/face
2020-10-14 10:54:00 -04:00
Takashi Yano 381b74f6b4 Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.
- Win32 API SetConsoleCursorPosition() injects ANSI escape sequence
  to pseudo console. Therefore, it should be added to the API list
  to be hooked.
2020-10-14 10:54:00 -04:00
Takashi Yano b38e10fdbe Cygwin: pty: Make sure to show system error messages
- Forcibly attach to pseudo console in advance so that the error
  messages by system_printf() are displayed to screen reliably.
  This is needed when stdout is redirected to another pty. In this
  case, process has two ptys opened. However, process can attach
  to only one console. So it is necessary to change console attached.
2020-10-14 10:54:00 -04:00
Takashi Yano 421f80d23d Cygwin: pty: Fix potential state mismatch regarding pseudo console.
- PTY with pseudo console support sitll has problem which potentially
  cause state mismatch between state variable and real console state.
  This patch fixes this issue.
2020-10-14 10:54:00 -04:00
Takashi Yano 79f20739a8 Cygwin: pty: Fix select() with pseudo console support.
- select() did not work correctly when both read and except are
  polled simultaneously for the same fd and the r/w pipe is switched
  to pseudo console side. This patch fixes this isseu.
2020-10-14 10:54:00 -04:00
Takashi Yano 66d098fe8e Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.
- Pseudo console support introduced by commit
  169d65a577 shows garbage ^[[H^[[J in
  some of emacs screens. These screens do not handle ANSI escape
  sequences. Therefore, clear screen is disabled on these screens.
2020-10-14 10:54:00 -04:00
Takashi Yano 55a5c4253a Cygwin: pty: Add a workaround for ^C handling.
- Pseudo console support introduced by commit
  169d65a577 sometimes cause random
  crash or freeze by pressing ^C while cygwin and non-cygwin
  processes are executed simultaneously in the same pty. This
  patch is a workaround for this issue.
2020-10-14 10:54:00 -04:00
Takashi Yano 6bfb266cf5 Cygwin: pty: Limit API hook to the program linked with the APIs.
- API hook used for pseudo console support causes slow down.
  This patch limits API hook to only program which is linked
  with the corresponding APIs. Normal cygwin program is not
  linked with such APIs (such as WriteFile, etc...) directly,
  therefore, no slow down occurs. However, console access by
  cygwin.dll itself cannot switch the r/w pipe to pseudo console
  side. Therefore, the code to switch it forcely to pseudo
  console side is added to smallprint.cc and strace.cc.
2020-10-14 10:54:00 -04:00
Takashi Yano 16c42abfc2 Cygwin: pty: Fix state management for pseudo console support.
- Pseudo console support introduced by commit
  169d65a577 has some bugs which
  cause mismatch between state variables and real pseudo console
  state regarding console attaching and r/w pipe switching. This
  patch fixes this issue by redesigning the state management.
2020-10-14 10:54:00 -04:00
Takashi Yano b0a701a3b0 Cygwin: pty: Move function hook_api() into hookapi.cc.
- PTY uses Win32 API hook for pseudo console suppot. The function
  hook_api() is used for this purpose and defined in fhandler_tty.cc
  previously. This patch moves it into hookapi.cc.
2020-10-14 10:53:59 -04:00
Takashi Yano e9be4fc14f Cygwin: pty: Speed up a little hooked Win32 API for pseudo console.
- Some Win32 APIs are hooked in pty code for pseudo console support.
  This causes slow down. This patch improves speed a little.
2020-10-14 10:53:59 -04:00
Takashi Yano 9c9b883aa8 Cygwin: pty: Code cleanup
- Cleanup the code which is commented out by #if 0 regarding pseudo
  console.
- Remove #if 1 for experimental code which seems to be stable.
2020-10-14 10:53:59 -04:00
Sandra Loosemore ff57c55bad Adjust nios2 and m68k semihosting for sys/stat.h changes.
Commit 72ff9acad2 caused st_atime,
st_ctime, and st_mtime to be defined as macros.  This collided with
use of these identifiers as field names in struct gdb_stat (which
represents the GDB RSP encoding of struct stat) in libgloss
semihosting support for nios2 and m68k.  This patch renames the
affected fields of struct gdb_stat.

Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
2020-10-14 10:53:59 -04:00
Corinna Vinschen 598b631b18 Cygwin: sys/wait.h: Add _wait prototype to avoid compiler warning
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:59 -04:00
Joel Sherrill c1199c286f fe_dfl_env.c: Fix typo in comment 2020-10-14 10:53:59 -04:00
Joel Sherrill 63b094610d riscv/include/fenv.h: Use shared fenv.h.
libc/include/fenv.h was a direct copy of this file.
2020-10-14 10:53:59 -04:00
Corinna Vinschen 4255526195 Cygwin: add W10 pseudo console support to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:59 -04:00
Takashi Yano 5543b44273 Cygwin: pty: add pseudo console support.
- Support pseudo console in PTY. Pseudo console is a new feature
  in Windows 10 1809, which provides console APIs on virtual
  terminal. With this patch, native console applications can work
  in PTYs such as mintty, ssh, gnu screen or tmux.
2020-10-14 10:53:59 -04:00
Ken Brown 22fe938fb5 Cygwin: get_posix_access: avoid negative subscript
Don't refer to lacl[pos] unless we know that pos >= 0.
2020-10-14 10:53:59 -04:00
Jeff Law d90a69b953 Fix regression in visium caused by sys/stat.h change 2020-10-14 10:53:59 -04:00
Martin Storsjö 412965ab98 Cygwin: math: Properly propagate input NANs in a few functions
While the C99 standard doesn't explicitly require this, the standard
says it is recommended (F.9.13).

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-10-14 10:53:59 -04:00
Martin Storsjö a1c0608a88 Cygwin: math: Fix cosh(-INFINITY) to return +INFINITY
Signed-off-by: Martin Storsjö <martin@martin.st>
2020-10-14 10:53:59 -04:00
Martin Storsjö a262d9a6a3 Cygwin: math: Fix the return value for tgammal for zero and negative integers
For zero, it should return HUGE_VAL (INFINITY), for negative integers,
it should return NAN.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-10-14 10:53:59 -04:00
Jeff Johnston 6d7e9786b9 Revert previous change to sys/stat.h and fix cris libgloss
- revert previous fix which altered sys/stat.h
- fix libgloss/cris/gensyscalls to undef st_atime, st_mtime,
  and st_ctime macros which cannot be used with new_stat structure
2020-10-14 10:53:59 -04:00
Jeff Johnston b1f61c03ec Fix regression in cris-elf caused by sys/stat.h change 2020-10-14 10:53:59 -04:00
Corinna Vinschen 41d071d581 Cygwin: select: revamp non-polling code for signalfd
Rather than waiting for signalfd_select_wait in a thread, which is racy,
create a global event "my_pendingsigs_evt" which is set and reset by
wait_sig depending only on the fact if blocked signals are pending or not.

This in turn allows to WFMO on this event in select as soon as signalfds
are present in the read descriptor set.  Select's peek and verify
will then check if one of the present signalfds is affected.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:59 -04:00
Corinna Vinschen 5993fdab0b Revert "Cygwin: fix potential SEGV in sigwaitinfo/signalfd scenario"
This reverts commit 92115a83a4.

This was utterly wrong.
2020-10-14 10:53:59 -04:00
Corinna Vinschen 0f44c923b2 stat.h: use POSIX-required timefields throughout
...except in certain SysV R4 cases for backward compat.
This is probably not required anymore, but it doesn't hurt
to keep it in.
2020-10-14 10:53:59 -04:00
Joel Sherrill 758e445159 fenv: Include documentation in generated .info file 2020-10-14 10:53:58 -04:00
Mark Geisert acc342c27b Cygwin: ldd: Try harder to get dll names
Borrow a trick from strace to lessen occurrences of "??? => ???" in ldd
output.  Specifically, if the module name isn't found in the usual place
in the mapped image, use the file handle we have to look up the name.
2020-10-14 10:53:58 -04:00
Takashi Yano fae6075d2d Cygwin: console: Fix the condition to interrupt select() by SIGWINCH
- Add code so that select() is not interrupted by SIGWINCH if it is
  ignored (SIG_IGN or SIG_DFL).
2020-10-14 10:53:58 -04:00
Takashi Yano e548c131d8 Cygwin: console: Fix workaround for horizontal tab position
- The workaround commit 33a21904a7
  does not work as expected if window size is changed while screen
  is alternated. Fixed.
2020-10-14 10:53:58 -04:00
Giacomo Tesio 8d81fcc18e memmem.c and strstr.c: do not require -std=c99 2020-10-14 10:53:58 -04:00