Commit Graph

18971 Commits

Author SHA1 Message Date
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
Jon Turney a577c601e7 fenv: Update makedocbook for eae68bfc
Teach makedocbook how to handle some new things seen in the makedoc markup
since eae68bfc:
- 'link with' lines appearing in SYNOPSIS sections

Also, don't raise a NoneType exception when there's something we don't
know how to handle in a SYNOPSIS section, just exit.
2020-10-14 10:53:58 -04:00
Jon Turney bbee9557b4 fenv: Fix typo-ed variable name in documentation 2020-10-14 10:53:58 -04:00
Jon Turney 300ac8e178 fenv: Fix mangled makedoc markup
See makedoc.c:657:
Variables are marked up as '<[foo]>'.
Code is marked up as '<<foo>>'.
2020-10-14 10:53:58 -04:00
Jon Turney d7e062ad4e fenv: fe_dfl_env.c doesn't contain any documentation
fe_dfl_env.c doesn't contain any documentation, so drop it from makedoc
processing.
2020-10-14 10:53:58 -04:00
Corinna Vinschen cb1469277a Cygwin: fix potential SEGV in sigwaitinfo/signalfd scenario
On sigwaitinfo or reading from a signalfd, signal processing sets up
signal handling via sigdelayed even if the handler address is NULL.
This doesn't have any impact on sigwaitinfo scenarios (or at least, I
wasn't able to come up with a reproducer) but it breaks signalfd
scenarios, where eventually a call to call_signal_handler from
sigdelayed will try to call the NULL function.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:58 -04:00
Corinna Vinschen d7921caf20 sched.h: Declare affinity functions only on targets supporting them 2020-10-14 10:53:58 -04:00
Corinna Vinschen 9f3eace21f Cygwin: ps: fix a compiler warning
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:58 -04:00
Takashi Yano aa058617e4 Cygwin: console: Fix cursor position restore after screen alternation.
- If screen is alternated on console, cursor position is not restored
  correctly in the case of xterm compatible mode is enabled. For example,
  the shell prompt is shown at incorrect position after using vim.
  This patch fixes this problem.
2020-10-14 10:53:58 -04:00
Takashi Yano 4348014d21 Cygwin: console: Add workaround for windows xterm compatible mode bug.
- The horizontal tab positions are broken after resizing console window.
  This seems to be a bug of xterm compatible mode of windows console.
  This workaround fixes this problem.
2020-10-14 10:53:58 -04:00
Takashi Yano 72a762c36b Cygwin: console: Fix deadlock at calling fork().
- Calling fork() on console occasionally falls into deadlock. The reason
  is not clear, however, this patch fixes this problem anyway.
2020-10-14 10:53:58 -04:00
Joel Sherrill 22026eb194 Regenerated files from fenv.h addition 2020-10-14 10:53:58 -04:00
Joel Sherrill 0efd05546a Add default implementation of fenv.h and all methods
The default implementation of the fenv.h methods return
	-EOPNOTSUP. Some of these have implementations appropriate
        for soft-float.

	The intention of the new fenv.h is that it be portable
	and that architectures provide their own implementation
	of sys/fenv.h.
2020-10-14 10:53:58 -04:00
Joel Sherrill 613a074e7e Miscellaneous Makefile.in regenerated 2020-10-14 10:53:58 -04:00
Corinna Vinschen 8f9ccad72c Cygwin: drop preliminary 3.0.8 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:58 -04:00
Corinna Vinschen 5b50e403a4 Cygwin: add missing bugfix release messages for 3.1.0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:57 -04:00
Corinna Vinschen 13bcb08856 Cygwin: shmat: use mmap allocator strategy on 64 bit
This avoids collisions of shmat maps with Windows own datastructures
when allocating top-down.

This patch moves the mmap_allocator class definition into its
own files and just uses it from mmap and shmat.
2020-10-14 10:53:57 -04:00
Lavrentiev, Anton 332c11b97a Cygwin: getpriority() and top display for priority is inconsistent
Fix this by aligning /proc/[PID]/stat to the values returned by getpriority().
2020-10-14 10:53:57 -04:00
Michael Haubenwallner f5ffd27dc6 Cygwin: build_env: fix off-by-one bug when re-adding PATH
Adding default winvar 'PATH=C:\cygwin64\binZ' to an environment that is
already allocated for 'SYSTEMROOT=ZWINDIR=Z', we need to count that
trailing (Z)ero as well.  Otherwise we trigger this assertion failure:

$ /bin/env -i SYSTEMROOT= WINDIR= /bin/env
assertion "(s - envblock) <= tl" failed: file "/home/corinna/src/cygwin/cygwin-3.0.7/cygwin-3.0.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/environ.cc", line 1302, function: char** build_env(const char* const*, WCHAR*&, int&, bool, HANDLE)
Aborted (core dumped)
2020-10-14 10:53:57 -04:00
Corinna Vinschen 4fe789e6c5 Cygwin: exec: check execute bit prior to evaluating script
When the exec family of functions is called for a script-like
file, the av::setup function handles the exec[vl]p case as
well.  The execve case for files not starting with a she-bang
is handled first by returning ENOEXEC.  Only after that, the
file's executability is checked.

This leads to the problem that ENOEXEC is returned for non-executable
files as well.  A calling shell interprets this as a file it should try
to run as script.  This is not desired for non-executable files.

Fix this problem by checking the file for executability first.  Only
after that, follow the other potential code paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:53:57 -04:00
Alexander Fedotov fe7189833a Align libgloss/arm and libc/sys/arm sources: miscellaneous fixes
1. Trim trailing spaces
2. Align comments, function declarations and definitions
2020-10-14 10:53:57 -04:00
Alexander Fedotov 408152f885 Align libgloss/arm and libc/sys/arm sources: Lite exit support
Applied changes from commit 2404223:

	* arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini
		when lite exit is enabled.
2020-10-14 10:53:57 -04:00
Alexander Fedotov e538b63421 Align libgloss/arm and libc/sys/arm sources: HeapInfo and __heap_limit
Applied changes from commit 8d98f95:

	* arm/crt0.S: Initialise __heap_limit when ARM_RDI_MONITOR is defined.
	* arm/syscalls.c: define __heap_limit global symbol.
	* arm/syscalls.c (_sbrk): Honour __heap_limit.

Applied changes from commit 8d98f95:
	Fixed semihosting for ARM when heapinfo not provided by debugger
2020-10-14 10:53:57 -04:00
Alexander Fedotov ecf2fbe4f3 Align libgloss/arm and libc/sys/arm sources: Fix GetCmdLine semihosting directives
Applied changes from the commit 9b11672:

	When simulating arm code, the target program startup code (crt0) uses
	semihosting invocations to get the command line from the simulator. The
	simulator returns the command line and its size into the area passed in
	parameter. (ARM 32-bit specifications :
	http://infocenter.arm.com/help/topic/com.arm.doc.dui0058d/DUI0058.pdf
	chapter "5.4.19 SYS_GET_CMDLINE").

	The memory area pointed by the semihosting register argument is located
	in .text section (usually not writtable (RX)).

	If we run this code on a simulator that respects this rights properties
	(qemu user-mode for instance), the command line will not be written to
	the .text program memory, in particular the length of the string. The
	program runs with an empty command line. This problem hasn't been seen
	earlier probably because qemu user-mode is not so much used, but this can
	happen with another simulator that refuse to write in a read-only segment.

	With this modification, the command line can be correctly passed to the
	target program.

	Changes:
	- newlib/libc/sys/arm/crt0.S : Arguments passed to the
	AngelSWI_Reason_GetCmdLine semihosting invocation are placed into .data
	section instead of .text
2020-10-14 10:53:57 -04:00
Mark Geisert bb7eb423b2 Cygwin: Implement CPU_SET(3) macros
This patch supplies an implementation of the CPU_SET(3) processor
affinity macros as documented on the relevant Linux man page.

There is a mostly superset implementation of cpusets under newlib's
libc/sys/RTEMS/include/sys that has Linux and FreeBSD compatibility
and is built on top of FreeBSD bitsets.  This Cygwin implementation
and the RTEMS one could be combined if desired at some future point.
2020-10-14 10:53:57 -04:00
Kito Cheng 0c5971fb07 RISC-V: Fix header guard for sys/fenv.h 2020-10-14 10:53:57 -04:00
Michael Haubenwallner 721ed1f466 Cygwin: fork: attach child not before success
Do not attach to the child before it was successfully initialized, or we
would need more sophisticated cleanup on child initialization failure,
like suppressing SIGCHILD delivery with multiple threads ("waitproc")
involved.

Improves "Cygwin: fork: Remember child not before success.",
commit f03ea8e1c5, which leads to fork
problems if cygserver is running:

https://cygwin.com/ml/cygwin-patches/2019-q2/msg00155.html
2020-10-14 10:53:57 -04:00