4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 12:30:24 +08:00

19802 Commits

Author SHA1 Message Date
Takashi Yano via Cygwin-patches
55c4162360 Cygwin: spawn.cc: Fix typo in comment by commit 974e6d76. 2021-01-23 12:13:59 -05:00
Corinna Vinschen
cc0b331bef Cygwin: rmdir: handle /dev in fhandler_dev::rmdir
The isdev_dev check in rmdir is unclean.  Create a virtual method
fhandler_dev::rmdir to handle this transparently.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-01-23 12:13:59 -05:00
Ken Brown
3359ffa276 Cygwin: document a recent bug fix
This documents commit aec64798, "Cygwin: add flag to indicate reparse
points unknown to WinAPI".
2021-01-23 12:13:59 -05:00
Takashi Yano via Cygwin-patches
815bc23ca3 Cygwin: pty: Set input_available_event only for cygwin pipe.
- cat exits immediately in the following senario.
    1) Execute env CYGWIN=disable_pcon script
    2) Execute cmd.exe
    3) Execute cat in cmd.exe.
  This is caused by setting input_available_event for the pipe for
  non-cygwin app. This patch fixes the issue.
2021-01-23 12:13:59 -05:00
Takashi Yano via Cygwin-patches
ea3f6daab4 Cygwin: pty: Make master thread functions be static.
- The functions pty_master_thread() and pty_master_fwd_thread()
  should be static (i.e. should not access class member) because
  the instance is deleted if the master is dup()'ed and the first
  master is closed. In this case, because the dup()'ed instance
  still exists, these master threads are also still alive even
  though the instance has been deleted. As a result, accesing
  class members in these functions causes accessi violation.

  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2021-January/012030.html
2021-01-23 12:13:58 -05:00
Takashi Yano via Cygwin-patches
652edb0299 Cygwin: pty: Prevent pty from changing code page of parent console.
- After commit 232fde0e, pty changes console code page when the first
  non-cygwin app is executed. If pty is started in real console device,
  pty changes the code page of root console. This causes very annoying
  result because changing code page changes the font of command prompt
  if console is in legacy mode. This patch avoids this by creating a
  new invisible console for the first pty started in console device.
2021-01-23 12:13:58 -05:00
Ben Wijen
b1ea88e6e6 cxx.cc: Fix dynamic initialization for static local variables
The old implementation for __cxa_guard_acquire did not return 1,
therefore dynamic initialization was never performed.

If concurrent-safe dynamic initialisation is ever needed, CXX ABI
must be followed when re-implementing __cxa_guard_acquire (et al.)
2021-01-23 12:13:58 -05:00
Ben Wijen
6fd8636576 syscalls.cc: Use EISDIR
This is the non-POSIX value returned by Linux since 2.1.132.
2021-01-23 12:13:58 -05:00
Ben Wijen
25d2148bbe syscalls.cc: Fix num_links
NtQueryInformationFile on fh_ro needs FILE_READ_ATTRIBUTES
to succeed.
2021-01-23 12:13:58 -05:00
Corinna Vinschen
7c4c9778fe Cygwin: Add Ben Wijen to list of contributors
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-01-23 12:13:58 -05:00
Takashi Yano via Cygwin-patches
24c4e80183 Cygwin: pty: Make close_pseudoconsole() be a static member function.
- The function close_pseudoconsole() should be static so that it
  can be safely called in spawn.cc even after the fhandler_pty_slave
  instance has been deleted. That is, there is a problem with the
  current code. This patch fixes the issue.
2021-01-23 12:13:58 -05:00
Takashi Yano via Cygwin-patches
8b10562b57 Cygwin: console: Revise the code to switch xterm mode.
- If application changes the console mode, mode management introduced
  by commit 10d8c278 will be corrupted. For example, stdout of jansi
  v2.0.1 or later is piped to less, jansi resets the xterm mode flag
  ENABLE_VIRTUAL_TERMINA_PROCESSING when jansi is terminated. This
  causes garbled output in less because less needs this flag enabled.
  This patch fixes the issue.
2021-01-23 12:13:58 -05:00
Takashi Yano via Cygwin-patches
963343f888 Cygwin: pty: Add workaround for rlwrap 0.40 or later.
- The workaround for rlwrap introduced by commit 8199b0cc does not
  take effect for rlwrap 0.40 or later. This patch add a workaround
  for rlwrap 0.40 or later as well.
2021-01-23 12:13:58 -05:00
Ken Brown
494d7f81da Cygwin: fstatat: call fstat64 instead of fstat
This fixes a bug on 32-bit Cygwin that was introduced in commit
84252946, "Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag".

Add a comment explaining why fstat should not be called.

Addresses: https://cygwin.com/pipermail/cygwin/2021-January/247399.html
2021-01-23 12:13:58 -05:00
Ken Brown
a2e279eb68 Cygwin: AF_UNIX: update tests 2021-01-07 13:58:58 -05:00
Ken Brown
6841fcb82f Cygwin: AF_UNIX: SCM_RIGHTS: support pty master descriptors
This requires modifying fhandler_pty_master::dup so that it duplicates
handles when it is called with non-zero src_pid on an fhandler that
doesn't yet have an archetype.
2021-01-07 13:58:58 -05:00
Sebastian Huber
fcaa3a863a RTEMS: Add <poll.h> and <sys/poll.h>
Add the POSIX header file <poll.h> which is used by the GCC 11 Ada
runtime support.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2021-01-07 13:58:58 -05:00
Ken Brown
89ef52df63 Cygwin: poll(2): extend the socket code to all sockets
poll has code that checks whether a socket descriptor has a failed
connect or whether shutdown has been called.  This previously worked
only for wsock sockets.  Tweak the code so that it applies to all
sockets.

To help with this, add a virtual saw_shutdown_read method to the
fhandler_socket class, and define a version of it for AF_UNIX sockets.
A version for wsock sockets already existed.

Untested.
2020-12-29 11:36:16 -05:00
Ken Brown
953308f403 Cygwin: AF_UNIX: update tests 2020-12-28 14:01:30 -05:00
Ken Brown
1b4df3a0be Cygwin: AF_UNIX: code simplification
When duplicating handles in fhandler_pty_slave::dup, there's no need
to use local handles as in fhandler_pty_slave::open.  We can just
directly use the accessors get_handle, get_handle_cyg, etc.
2020-12-23 11:59:36 -05:00
Jeff Johnston
f24ce1da03 Bump up newlib version to 4.1.0 2020-12-23 11:59:36 -05:00
Paul Zimmermann
8169276058 fixes to make compilation succeeds 2020-12-18 16:53:19 -05:00
Jeff Johnston
dad02bce3a Update gamma functions from code in picolibc
- fixes issue with inf sign when x is -0
2020-12-18 16:53:19 -05:00
Brian Inglis
b0593cf5fd fhandler_proc.cc(format_proc_cpuinfo): report Intel SGX bits
Update to Linux next 5.10 cpuinfo flags for Intel SDM 36.7.1 Software
Guard Extensions, and 38.1.4 SGX Launch Control Configuration.
Launch control restricts what software can run with enclave protections,
which helps protect the system from bad enclaves.
2020-12-18 16:53:19 -05:00
Craig Blackmore
633f39361c RISC-V: Add semihosting support 2020-12-18 16:53:19 -05:00
Jeff Johnston
333317dedb Add declarations for __ieee754_tgamma functions to fdlibm.h 2020-12-18 16:53:18 -05:00
Takashi Yano via Cygwin-patches
7fa9adb2ac Cygwin: pty: Revise the workaround for rlwrap.
- Previous workaround has a problem that screen is distorted if up
  arrow key is pressed at the first line after running "rlwrap cmd".
  This patch fixes the issue.
2020-12-18 16:53:18 -05:00
Takashi Yano via Cygwin-patches
6700d80d69 Cygwin: pty: Check response for CSI6n more strictly.
- Previous code to read response for CSI6n allows invalid response
  such as "CSI Pl; Pc H" other than correct response "CSI Pl; Pc R".
  With this patch, the response is checked more strictly.
2020-12-18 16:53:18 -05:00
Ken Brown
255afed438 Cygwin: AF_UNIX: SCM_RIGHTS: support console descriptors
This requires modifying fhandler_console::dup so that it duplicates
handles when it is called with non-zero src_pid on an fhandler that
doesn't yet have an archetype.

As in the recent change to fhandler_pty_slave::dup, dtable::dup_worker
will then create an archetype for the new fhandler after
fhandler_console::dup returns.

Untested.
2020-12-15 11:48:04 -05:00
Ken Brown
56fc7c1f2e Cygwin: AF_UNIX: update tests
The previous test, send_tty, didn't really exercise the new
fhandler_pty_slave::dup code, since the descriptor that was sent was
for a pty slave already open in the subprocess.  So it already had an
archetype, and no handles were duplicated.

Replace it by a new test, send_pty_slave, that does exercise the new
code (successfully).
2020-12-15 11:48:04 -05:00
Corinna Vinschen
d1108f42e4 Cygwin: Make sure newer apps get uname_x even when loading uname dynamically
if an application built after API version 334 loads uname dynamically,
it actually gets the old uname, rather than the new uname_x.  Fix this by
checking the apps API version in uname and call uname_x instead, if it's
a newer app.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-15 11:48:03 -05:00
Sebastian Huber
a79198c251 arm: Fix memchr() for Armv8-R
The Cortex-R52 processor is an Armv8-R processor with a NEON unit.  This
fix prevents conflicting architecture profiles A/R errors issued by the
linker.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2020-12-15 11:48:03 -05:00
Takashi Yano via Cygwin-patches
28ff3b95d0 Cygwin: pty: Add a workaround for rlwrap.
- If rlwrap is used with non-cygwin apps, it fails to setup pseudo
  console. This patch adds a workaround for this issue.
2020-12-14 09:41:47 -05:00
Takashi Yano via Cygwin-patches
dc4e19b90d Cygwin: pty: Revise the code for timeout in term_has_pcon_cap().
- Sometimes timeout period in term_has_pcon_cap() may not be enough
  when the machine slows down for some reason. This patch eases the
  issue. In the new code, effective timeout period is expected to be
  extended as a result due to slowing-down the wait loop as well when
  the machine gets into busy.
2020-12-14 09:41:47 -05:00
Takashi Yano via Cygwin-patches
b8c00a3e16 Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.
- This patch skips unnecessary term_has_pcon_cap() call if pseudo
  console is disabled.
2020-12-14 09:41:47 -05:00
Ken Brown
830ae651d3 Cygwin: AF_UNIX: update tests
Add test for sending a tty.
2020-12-11 17:41:06 -05:00
Ken Brown
c605ea0d6d Cygwin: AF_UNIX: SCM_RIGHTS: support pty slave descriptors
This is the first case where the fhandler being sent uses an
archetype.  This archetype is of no use to the receiving process, so
we have to make the following changes:

- Modify fhandler_pty_slave::dup so that it duplicates handles when it
  is called on an fhandler that doesn't yet have an archetype.

- Modify dtable::dup_worker so that it creates an archetype for the
  new fhandler after fhandler_pty_slave::dup returns.
2020-12-11 17:41:06 -05:00
Ken Brown
81e265492a Cygwin: AF_UNIX: code simplification 2020-12-11 17:41:05 -05:00
Fabian Schriever
39f2545591 Fix error in powf for x close to 1 and large y
This patch fixes the error found by Paul Zimmermann (see
https://homepages.loria.fr/PZimmermann/papers/#accuracy) regarding x
close to 1 and rather large y (specifically he found the case
powf(0x1.ffffeep-1,-0x1.000002p+27) which returns +Inf instead of the
correct value). We found 2 more values for x which show the same faulty
behaviour, and all 3 are fixed with this patch. We have tested all
combinations for x in [+1.fffdfp-1, +1.00020p+0] and y in
[-1.000007p+27, -1.000002p+27] and [1.000002p+27,1.000007p+27].
2020-12-11 17:41:05 -05:00
Jeff Johnston
90400463f3 Bump newlib release to 4.0.0 2020-12-11 17:41:05 -05:00
Jeremy Drake via Cygwin-patches
4b36bbac7e cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn
This allows native processes to get Windows-default error handling
behavior (such as invoking the registered JIT debugger).
2020-12-11 17:41:05 -05:00
Ken Brown
68bcbd0d24 Cygwin: dtable::dup_worker: update comment and debug output
The comment and debug output became obsolete in commit 23771fa1f7 when
dup_worker started calling fhandler_base::clone instead of build_fh_pc
and fhandler_base::operator=.
2020-12-07 16:35:11 -05:00
Mark Geisert
283325de13 Cygwin: Allow to set SO_PEERCRED zero (v2)
The existing code errors as EINVAL any attempt to set a value for
SO_PEERCRED via setsockopt() on an AF_UNIX/AF_LOCAL socket.  But to
enable the workaround set_no_getpeereid behavior for Python one has
to be able to set SO_PEERCRED to zero.  Ergo, this patch.  Python has
no way to specify a NULL pointer for 'optval'.

This v2 of patch allows the original working (i.e., allow NULL,0 for
optval,optlen to mean turn off SO_PEERCRED) in addition to the new
working described above.  The sense of the 'if' stmt is reversed for
readability.
2020-12-07 14:08:39 -05:00
Mark Geisert
0e88654061 Cygwin: Launch cygmagic with bash, not sh
On some systems /bin/sh is not /bin/bash and cygmagic has bash-isms in
it.  So even though cygmagic has a /bin/bash shebang, it also needs to be
launched with bash from within Makefile.in.
2020-12-07 14:08:38 -05:00
Anton Lavrentiev via Cygwin-patches
636c8d3fe8 Fix trace output for getdomainname() 2020-12-07 14:08:38 -05:00
Brian Inglis
262d25044f winsup/doc/Makefile.in: create man5 dir and install proc.5 2020-12-07 14:08:38 -05:00
Brian Inglis
56e1cc4e92 specialnames.xml: add proc(5) Cygwin man page 2020-12-07 14:08:38 -05:00
Corinna Vinschen
66ce092e1d Cygwin: Fix remaining warnings building path testsuite 2020-12-07 14:08:38 -05:00
Jon Turney
54971b2c08 Cygwin: Fix building of utils testsuite
Avoid referencing undefined max_mount_entry.
2020-12-07 14:08:38 -05:00
Corinna Vinschen
b951adce93 Cygwin: add flag to indicate reparse points unknown to WinAPI
https://cygwin.com/pipermail/cygwin/2020-December/246938.html
reports a problem where, when adding a Cygwin default symlink
to $PATH since Cygwin 3.1.5, $PATH handling appears to be broken.

3.1.5 switched to WSL symlinks as Cygwin default symlinks.

A piece of code in path handling skips resolving reparse points
if they are the last component in the path.  Thus a reparse point
in $PATH is not resolved but converted to Windows path syntax
verbatim.

If you do this with a WSL symlink, certain WinAPI functions fail.
The underlying $PATH handling fails to recognize the reparse
point in $PATH and returns with STATUS_IO_REPARSE_TAG_NOT_HANDLED.
As a result, the calling WinAPI function fails, most prominently
so CreateProcess.

Fix this problem by adding a PATH_REP_NOAPI bit to path_types
and a matching method path_conv::is_winapi_reparse_point().

Right now this flag is set for WSL symlinks and Cygwin AF_UNIX
sockets (new type implemented as reparse points).

The aforementioned code skipping repare point path resolution calls
is_winapi_reparse_point() rather than is_known_reparse_point(),
so now path resolution is only skipped for reparse points known
to WinAPI.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-07 14:08:38 -05:00