4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-22 15:07:43 +08:00

12488 Commits

Author SHA1 Message Date
Corinna Vinschen
9a8768233e Cygwin: add release message for fixed floppy bugs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
5b3594d4f9 Cygwin: raw disk I/O: lock floppys as well
The workaround to access the full disk required since Vista
and described in http://support.microsoft.com/kb/942448
(NOT ACCESSIBLE at the time of writing this commit message)
is required on floppy drives as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
e7bcd47bd5 Cygwin: raw disk I/O: Fix return value in error case
The cast to generate the return value uses a DWORD variable
as test and set value.  The error case is the constant -1.
Given the type of the other half of the conditioal expression,
-1 is cast to DWORD as well.

On 64 bit, this results in the error case returning a 32 bit
-1 value which is equivalent to (ssize_t) 4294967295 rather
than (ssize_t) -1.

Add a fixing cast.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
726ad38d42 Cygwin: file I/O: make sure to treat write return value as ssize_t
The return type of fhandler write methods is ssize_t.  Don't
use an int to store the return value, use ssize_t.  Use ptrdiff_t
for the buffer size.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
David Macek via Cygwin-patches
2d04009839 Cygwin: accounts: Report unrecognized db_* nsswitch.conf keywords
Signed-off-by: David Macek <david.macek.0@gmail.com>
2020-10-14 10:54:17 -04:00
David Macek via Cygwin-patches
e8a9e5f7d8 Cygwin: accounts: Don't keep old schemes when parsing nsswitch.conf
The implicit assumption seemed to be that any subsequent occurence of
the same setting in nsswitch.conf is supposed to rewrite the previous
ones completely.  This was not the case if the third or any further
schema was previously defined and the last line defined less than that
(but at least 2), for example:

```
db_home: windows cygwin /myhome/%U
db_home: cygwin desc
```

Let's document this behavior as well.

Signed-off-by: David Macek <david.macek.0@gmail.com>
2020-10-14 10:54:17 -04:00
David Macek via Cygwin-patches
0531a163d3 Cygwin: accounts: Unify nsswitch.conf db_* defaults
Signed-off-by: David Macek <david.macek.0@gmail.com>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
82ad860b2b Cygwin: Add David Macek to CONTRIBUTORS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
3435658492 Cygwin: symlinks: fix WSL symlink creation if cygdrive prefix is /
If the cygdrive prefix is /, then the following happens right now:

  $ ln -s /tmp/foo .
  $ ls -l foo
  lrwxrwxrwx 1 user group 12 Apr 15 23:44 foo -> /mnt/tmp/foo

Fix this by skipping cygdrive prefix conversion to WSL drive
prefix "/mnt", if the cygdrive prefix is just "/".  There's no
satisfying way to do the right thing all the time in this case
anyway.  For a description and the alternatives, see
https://cygwin.com/pipermail/cygwin-developers/2020-April/011859.html

Also, fix a typo in a comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
David Macek via Cygwin-patches
a4ee2c5550 cygheap_pwdgrp: Handle invalid db_* entries correctly
If the first scheme in db_* was invalid, the code would think there
were no schemes specified and replace the second scheme with
NSS_SCHEME_DESC.

Signed-off-by: David Macek <david.macek.0@gmail.com>
2020-10-14 10:54:17 -04:00
Corinna Vinschen
32c529deeb Cygwin: faq: disable outdated "sshd in domain" faq
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:17 -04:00
Brian Inglis
dc27f5a3ce proc_cpuinfo: Add PPIN support for AMD
Newer AMD CPUs support a feature called protected processor
identification number (PPIN). This feature can be detected via
CPUID_Fn80000008_EBX[23].
2020-10-14 10:54:17 -04:00
Corinna Vinschen
06ab3932ab Cygwin: utils: override definition of PMEM_EXTENDED_PARAMETER
PMEM_EXTENDED_PARAMETER is defined in the local winlean.h as long
as mingw-w64 doesn't define it (in winnt.h).  ntdll.h needs the
definition for declaring NtMapViewOfSectionEx.  cygpath.cc and ps.cc
both include ntdll.h but not winlean.h, so they complain about the
missing definition.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
b6df67537b Cygwin: mmap_alloc: fix comment to document using the extended memory API
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
725b690bba Cygwin: threads: use extended memory API if available
So far Cygwin was jumping through hoops to restrict memory
allocation to specific regions.  With the advent of VirtualAlloc2
and MapViewOfFile3 (and it's NT counterpart NtMapViewOfSectionEx),
we can skip searching for free space in the specific regions
and just call these functions and let the OS do the job more
efficiently and less racy.

Use VirtualAlloc2 on W10 1803 and later in thread stack allocation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
5942ea58df Cygwin: mmap: use extended memory API if available
So far Cygwin was jumping through hoops to restrict memory
allocation to specific regions.  With the advent of VirtualAlloc2
and MapViewOfFile3 (and it's NT counterpart NtMapViewOfSectionEx),
we can skip searching for free space in the specific regions
and just call these functions and let the OS do the job more
efficiently and less racy.

Use the new functions on W10 1803 and later in mmap.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
686e9259a8 Cygwin: memory: declare extended memory API
Windows 10 1803 introduced an extended memory API allowing
to specify memory regions allocations are to be taken off.

In preparation of using this API, define the struct
MEM_EXTENDED_PARAMETER and friends.  Declare and allow to
autoload the functions VirtualAlloc2 and NtMapViewOfSectionEx.

Introduce a wincap flag has_extended_mem_api.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
a9cafb56c1 Cygwin: threads: add missing include of mmap_alloc.h
This is needed for using mmap_alloc.alloc()

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
d9574d7867 Cygwin: threads: lower thread size from pool to 256 Megs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
6a078e48c3 Cygwin: threads: use mmap area to fulfill requests for big stacks
Otherwise big stacks have a higher probability to collide with
randomized PEBs and TEBs after fork.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
0ef2f480fc Cygwin: symlinks: Allow traversing WSL symlinks
Unfortunately Windows doesn't understand WSL symlinks,
despite being a really easy job.  NT functions trying
to access paths traversing WSL symlinks return the status
code STATUS_IO_REPARSE_TAG_NOT_HANDLED.  Handle this
status code same as STATUS_OBJECT_PATH_NOT_FOUND in
symlink_info::check to align behaviour to traversing
paths with other non-NTFS type symlinks.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
6c3e17dd79 Cygwin: docs: revamp docs explaining symlinks
The descriptions of symlink handling are a bit dated, so
revamp them and add the new WSL symlink type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
b949568678 Cygwin: symlinks: create WSL symlinks on supporting filesystems
WSL symlinks are reparse points containing a POSIX path in UTF-8.
On filesystems supporting reparse points, use this symlink type.
On other filesystems, or in case of error, fall back to the good
old plain SYSTEM file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
2aa47e7d12 Cygwin: symlinks: fix WSL symlinks pointing to /mnt
Commit 4a36897af392 allowed to convert /mnt/<drive> path
prefixes to Cygwin cygdrive prefixes on the fly.  However,
the patch neglected WSL symlinks pointing to the /mnt
directory.  Rearrange path conversion so /mnt is converted
to the cygdrive prefix path itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Biswapriyo Nath
c2a4b866db winsup/cygwin: remove defines added in mingw-w64 v7.0.0
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
31c3c0e306 Cygwin: symlinks: support WSL symlinks
Treat WSL symlinks just like other symlinks.  Convert
absolute paths pointing to Windows drives via
/mnt/<driveletter> to Windows-style paths <driveletter>:

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
f2b68dd7de Cygwin: serial: fix GCC warning
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
222995a873 Revert "Cygwin: serial: read: if VMIN > 0, wait for VMIN chars in inbound queue"
This reverts commit 082f2513c721e942d0fd563c4dc9117eee3513ab.

Turns out, Linux as well as BSD really only wait for the smaller
number, MIN or # of requested bytes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
8c6111e83d fhandler_serial: fix comments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:16 -04:00
Corinna Vinschen
7b4f798418 Cygwin: serial: read: if VMIN > 0, wait for VMIN chars in inbound queue
Per termios, read waits for MIN chars even if the number of requested
bytes is less.  This requires to add WaitCommEvent to wait non-busily
for MIN chars prior to calling ReadFile, so, reintroduce it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
faf5cd406e Cygwin: serial: use per call OVERLAPPED structs
Sharing the OVERLAPPED struct and event object in there between
read and select calls in the fhandler might have been a nice
optimization way back when, but it is a dangerous, not thread-safe
approach.  Fix this by creating per-fhandler, per-call OVERLAPPED
structs and event objects on demand.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
2b234474b4 Cygwin: serial: select: call ClearCommError prior to calling WaitCommEvent
This (hopefully) eliminates a race condition

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
9f389e005e Cygwin: serial: select: fix WaitCommEvent request
- make sure event object is reset
- set read_ready to true if WaitCommEvent returns success
- improve debugging

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
9eaa579a01 Cygwin: serial: tcsetattr: set timeouts unconditionally
tcsetattr checks if the VTIME and VMIN values changed and only
calls SetCommTimeouts if so.  That's a problem if tcsetattr
is supposed to set VTIME and VIMN to 0, because these are the
start values anyway.  But this requires to set ReadIntervalTimeout
to MAXDWORD, which just doesn't happen.

Fix this by dropping the over-optimization of checking the old
values before calling SetCommTimeouts,

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
9b7387746a Cygwin: serial: avoid overrun of vtime
After changing the type of fhandler_serial::vtime_ to cc_t, vtime_
must be stored in 10s of seconds, not in milliseconds.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Åke Rehnman
03416f94e7 Cygwin: serial: select: fix previous revamp patch
- We need a verify function.
- The event object referenced in WaitCommEvent must not be a local var,
  move it into fhandler_serial.
2020-10-14 10:54:15 -04:00
Corinna Vinschen
7c4a4a8e26 Cygwin: serial: revamp overlapped IO in read and select
Get rid of WaitCommEvent and using overlapped_armed to share the
same overlapped operation between read and select.  Rather, make
sure to cancel the overlapped IO before leaving any of these functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
8c7e43e2e2 Cygwin: serial: read: revamp raw_read, change vmin_ and vtime_ to cc_t
- Datatypes were incorrect, especially vmin_ and vtime_.
  Change them to cc_t, as in user space.

- Error checking had a gap or two.  Debug output used the
  wrong formatting.

- Don't use ev member for ClearCommError and WaitCommEvent.
  Both returned values are different (error value vs. event
  code).  The values are not used elsewhere so it doesn't make
  sense to store them in the object.  Therefore, drop ev member.

- Some variable names were not very helpful.  Especially using
  n as lpNumberOfBytesTransferred from GetOverlappedResult and
  then actually printing it as if it makes sense was quite
  puzzeling.

- Rework the loop and the definition of minchars so that it
  still makes sense when looping.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
84eae151cb Cygwin: serial: select: simplify peek_serial
- Don't use ev member for ClearCommError and WaitCommEvent.
  Both returned values are different (error value vs. event
  code).  The values are not used elsewhere so it doesn't make
  sense to store them in the object.

- Drop local variable ready which is used inconsequentially.

- Since WFSO already waits 10 ms, don't wait again if no char
  is in the inbound queue.

- Avoid else if chains.

- Only print one line of debug output on error.

- Drop overlapped_armed < 0 check.  This value is only set in
  fhandler_serial::raw_read if VTIME > 0, and even then it's only
  set to be immediately reset to 0 before calling ReadFile.  So
  overlapped_armed is never actually < 0 when calling select.

- Fix a screwed up statement order.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Jon Turney
93c653165b Cygwin: Use a separate Start Menu folder for WoW64 installs
This aligns the shortcuts to documentation with the setup changes in
https://sourceware.org/pipermail/cygwin-apps/2020-March/039873.html

v2:
Create/remove the Start Menu directory as needed/possible
Correctly use that directory when making shortcuts
2020-10-14 10:54:15 -04:00
Corinna Vinschen
bb132f4463 Cygwin: serial: wait for CancelIo completion
Per https://devblogs.microsoft.com/oldnewthing/20110202-00/?p=11613
GetOverlappedResult must be called blocking, waiting for the overlapped
operation to complete.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Takashi Yano via Cygwin-patches
807148827d Cygwin: pty: Add FreeConsole to destructor of pty slave.
- When pseudo console is closed, all the processes attched to the
  pseudo console are terminated. This causes the problem reported
  in https://sourceware.org/pipermail/cygwin/2020-March/244046.html.
  This patch fixes the issue.
2020-10-14 10:54:15 -04:00
Corinna Vinschen
df159e6598 Cygwin: serial: try fix o_nonblock 2020-10-14 10:54:15 -04:00
Corinna Vinschen
c9df2deab5 Cygwin: belatedly add Hans-Bernhard to CONTRIBUTORS file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:15 -04:00
Corinna Vinschen
bf2df0e237 Cygwin: fix formatting: drop trailing whitespace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:14 -04:00
Corinna Vinschen
8f35cc67e5 Cygwin: fix formatting: collapse whitespace-only lines
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:14 -04:00
Corinna Vinschen
5af45fd943 Cygwin: fix formatting: drop spaces leading tabs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:14 -04:00
Corinna Vinschen
2aa7cf3af9 Cygwin: fix formatting: replace TAB char with \t in string constant
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-14 10:54:14 -04:00
Takashi Yano
0782e247b6 Cygwin: console: Fix behaviour of "ESC 8" after reset.
- This patch matches the behaviour of "ESC 8" (DECRC) to the real
  xterm after full reset (RIS), soft reset (DECSTR) and "CSI 3 J".
2020-10-14 10:54:14 -04:00
Hans-Bernhard Broeker
1e9e71b204 Do not bother passing optional argument to WriteConsoleA.
Passing a pointer to a local variable to WriteConsoleA is
not actually needed if we're not going to do anything with
what WriteConsoleA would put in there.

For the wpbuf class the pointer argument was made optional,
so it can be just left out; other call places now pass a
NULL pointer instead.  The local variables `wn' and `n'
are no unused, so they go away.
2020-10-14 10:54:14 -04:00