4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 04:20:28 +08:00

19777 Commits

Author SHA1 Message Date
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
Corinna Vinschen
43cbc3f5b6 Cygwin: path.h: add comments to briefly explain path_types
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-07 14:08:38 -05:00
Corinna Vinschen
889759571b Cygwin: testsuite: libltp: fix warnings showing up with -Wall
This libltp is old as old dirt and still using K&R style.
If it's really to be used again at all, it needs a serious
refresh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-07 14:08:38 -05:00
Corinna Vinschen
a29d4a8fee Cygwin: /proc/sys FS: don't export NFS and DFS as block devices
Network filesystems are not block devices.  Apparently this code
hasn't been executed anyway, given how network filesystems are
hidden behind \Device\Mup.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-07 14:08:38 -05:00
Christian Franke
33cfa777a1 Cygwin: Fix access to block devices below /proc/sys.
Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.

Signed-off-by: Christian Franke <franke@computer.org>
2020-12-07 14:08:38 -05:00
Ken Brown
63f6443bba Cygwin: AF_UNIX: add FIXME comment 2020-11-28 09:40:56 -05:00
Ken Brown
5fba23a0fe Cygwin: AF_UNIX: socket_tests: update README.txt 2020-11-28 09:40:16 -05:00
Ken Brown
816c8dfecd Cygwin: AF_UNIX: update tests
There's now a (successful) test of sending socket descriptors.
2020-11-25 15:32:03 -05:00
Jon Turney
e496754853 Cygwin: Have cygmagic not create output if an error occurs
Improve the 'cygmagic' script, so it doesn't create the output file if
an error occurs, even in one of the backtick-enclosed pipelines it runs.
2020-11-25 15:06:41 -05:00
Jon Turney
4d8bc5e889 Cygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c
This has an separate, explicit compilation rule which omits CXXFLAGS, so
expected flags like '-g -O2' aren't being used.
2020-11-25 15:06:41 -05:00
Jon Turney
aace6db332 Cygwin: Drop libgmon.a build dependency on gcrt0.o
libgmon.a depends on gcrt0.o, but doesn't include it.
2020-11-25 15:06:41 -05:00
Takashi Yano via Cygwin-patches
5e2f9e3d83 Cygwin: pty: Fix minor style issue. 2020-11-25 15:06:41 -05:00
Takashi Yano via Cygwin-patches
fd70323047 Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
- If vim is executed in WSL in mintty, some garbage string caused
  by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
  fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
  output.
2020-11-25 15:06:41 -05:00
Takashi Yano via Cygwin-patches
43d5338620 Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".
- The code added by 8121b606e843c001d5ca5213d24099e04ebc62ca has a
  bug which fails to remove multiple "CSI > Pm m" sequences. This
  patch fixes the bug.
2020-11-25 15:06:41 -05:00
Ken Brown
3b8be197f7 Cygwin: AF_UNIX: SCM_RIGHTS: support socket descriptors
This requires modifying fhandler_socket_wsock::dup and
fhandler_socket_unix::dup to use the src_pid argument.

First cut.  Not yet tested.
2020-11-22 15:02:39 -05:00
Ken Brown
877427fbaa Cygwin: AF_UNIX: add _pipe_end member and related methods
Use this to keep track of whether our pipe handle is for the server or
client end of the pipe.
2020-11-22 14:17:52 -05:00
Ken Brown
d9bb7965f9 Cygwin: AF_UNIX: code simplification
Add a 'src_pid' argument to dtable::dup_worker.

Use the latter in serialize/deserialize rather than repeating much of
what it does.

Don't duplicate the path_conv handle; it isn't needed.
2020-11-22 14:13:00 -05:00
Ken Brown
81ceb96528 Cygwin: AF_UNIX: create an ack mechanism for SCM_RIGHTS
When a process sends a file descriptor via an SCM_RIGHTS control
message, it creates a temporary copy of the fhandler associated with
that descriptor and sends a serialization of that copy.  The
deserialization done by the receiver involves duplicating handles from
the copy, so the latter must stay alive until the deserialization is
done.  But it must ultimately be closed in order to avoid a memory
leak.

We coordinate all this as follows:

- Introduce a new struct scm_pending_fd that contains information
  about the temporary copy.  For brevity, call such a struct a
  "pending fd" in what follows.

- Maintain a list of pending fds in shared memory.

- Add several methods for manipulating the list to the af_unix_shmem_t
  and fhandler_socket_unix classes.

- Also add a lock, 'scm_fd_lock', to control access to the list.

- When a serialized fhandler is received, the receiver sends an ack
  back to the sender in an administrative packet with a control
  message of a new (Cygwin-specific) type SCM_RIGHTS_ACK.

- grab_admin_pkt is called in various places to process these packets.
  A complication here is that the process that calls grab_admin_pkt
  might not be the process that originally sent the serialized
  fhandler.  (It could be a subprocess of the original process, for
  example.)  This is why we need to maintain the list of pending fds
  in shared memory.

- Each fhandler_socket_unix keeps a count of the pending fds that it
  has created but not yet processed; this count is in a new data
  member 'my_npending_fd'.

- fhandler_socket_unix::close tries to process any remaining pending
  fds before closing, but it gives up after a short timeout and
  forcibly deletes them if necessary.
2020-11-21 08:01:10 -05:00
Ken Brown
ee4f7ec67e Cygwin: AF_UNIX: add a unique id to struct fh_ser 2020-11-21 08:01:10 -05:00
Ken Brown
5a98fbb4f8 Cygwin: AF_UNIX: tweak serialize/deserialize
Make them member functions of the fhandler_socket_unix class.

Make them use void * instead of fh_ser * so that fhandler.h doesn't
need to know about fh_ser.
2020-11-21 08:01:10 -05:00
Ken Brown
0dac3caaf5 Cygwin: AF_UNIX: update tests 2020-11-21 08:01:10 -05:00
Ken Brown
9e6f77d4ef Cygwin: AF_UNIX: peek_pipe_poll: fix thinko
The variable 'sleep_time' was being reset to 0 on every loop
iteration.
2020-11-21 08:01:10 -05:00
Jon Turney
2547ad3807 Cygwin: Remove surplus autoconf auxiliary files
Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.

(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)
2020-11-21 08:01:10 -05:00
Jon Turney
e707b18446 Cygwin: Remove recursive configure
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.

Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.

Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.

Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory.  (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).

Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.

Remove generated configure and aclocal.m4 in subdirectories.
2020-11-21 08:01:09 -05:00
Ken Brown
1395b4ea2c Cygwin: fhandler_fifo::cleanup_handlers: improve efficiency
Traverse the fifo_client_handler list from the top down to try to
avoid copying.
2020-11-21 08:01:09 -05:00
Jon Turney
0cd9136981 Cygwin: Testsuite Makefile cleanup
Drop unused variables CC_FOR_TARGET, GCC_INCLUDE, ALL_CFLAGS
Stop exporting CC, CFLAGS
Drop unused, empty targets force, dll_ofiles, all_target
2020-11-18 14:18:28 -05:00