Commit Graph

219 Commits

Author SHA1 Message Date
Corinna Vinschen e7d0f0eb41 Cygwin: wincap: make capability flags readonly
So far the capability bits were stored in the .cygwin_dll_common
R/W section because we overwrite the is_server bit.  Just don't.
Move the bit to class wincapc instead and define all wincaps
bitfields const.

Fixes: 8937c103ed ("* wincap.cc (all wincaps): Store in .cygwin_dll_common section same as wincap.  Add comment to explain why.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-12 10:34:32 +01:00
Corinna Vinschen 21d098eab1 Cygwin: drop wincaps for Windows 7 and Windows 8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen ef741db52b Cygwin: drop wincap::def_guard_pages
Only required for Windows 7.  Define constant value
DEFAULT_GUARD_PAGE_COUNT instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen ae2829a226 Cygwin: drop wincap::mmap_storage_high
Only required for Windows 7 and Windows 8.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 8af023a357 Cygwin: drop wincap::cons_need_small_input_record_buf
Only required for Windows 7.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 08cd9cfc5c Cygwin: drop wincap::has_broken_attach_console
Only required for Windows 7.

This in turn allows to drop the helper_pid and related
methods from fhandler_pty_common.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 4e40b21464 Cygwin: drop wincap::has_query_process_handle_info
Only required for Windows 7.

This allows to remove fhandler_pipe::get_query_hdl_per_system(),
too.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen c3c71e39f9 Cygwin: drop wincap::has_broken_whoami
Unused for some time. Was only required for Windows 7 anyway.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 5478c5a9ec Cygwin: drop wincap::has_microsoft_accounts
Only required for Windows 7.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 70d77662f5 Cygwin: drop wincap::has_precise_system_time
Only required for Windows 7.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 48953788b3 Cygwin: drop wincap::needs_query_information
Only required for Windows 7 and 8.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-04 14:01:41 +01:00
Corinna Vinschen 49df152de7 Cygwin: memory_layout.h: define absolute MMAP_STORAGE_HIGH values here
Use the symbolic values in wincap.cc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-28 16:26:53 +02:00
Takashi Yano 746c8116dd Cygwin: console: Allow pasting very long text input.
- Currently, if the text longer than 1024 byte is pasted in console,
  some of the text is discarded. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251764.html
2022-07-02 11:24:11 +09:00
Takashi Yano faf1e11592 Cygwin: pty: Fix script command crash on console in Win7.
- Previously, the command "cmd /c script -c cmd" in console of Win7
  crashes. This seems to be due to a bug (?) of AttachConsole().
  This patch adds workaround for this issue.

  Currently, pty reattaches to the console of the process which is
  predetermined by ConsoleProcessList() after temporarily attaching
  to another console. After that, the console output handle opened
  with the name "CONOUT$" may not be accessible in Win7.
  This seems to happen when the attached process does not have the
  same handle even if the console attached is the same. With this
  patch, cygwin-console-helper which is started when pty master is
  opened in console, is utilized to be a target process to which
  pty reattaches if the OS is Win7.
2022-05-15 07:25:56 +09:00
Corinna Vinschen 974163bc18 Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:31:29 +02:00
Corinna Vinschen bf6940a413 Cygwin: wincap: drop has_broken_prefetchvm flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:30:11 +02:00
Corinna Vinschen a70a969c64 Cygwin: wincap: drop no_msv1_0_s4u_logon_in_wow64 flag and related code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:20:42 +02:00
Corinna Vinschen 0f4eb70ee7 Cygwin: wincap: set def_guard_pages to x86_64 value right away
Drop conditional code in wincapc::init.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:18:57 +02:00
Corinna Vinschen 2610b681a4 Cygwin: wincap: drop wow64 flag and all conditions depending on it
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:15:47 +02:00
Takashi Yano 9f1930bf34 Cygwin: wincap: Add capabilities for Windows 11.
- The capability changes since Windows 11 have been reflected in
  wincap.cc. The capability has_con_broken_tabs is added, which is
  false since Windows 11.
2022-02-16 19:59:14 +09:00
Takashi Yano 7e6422fd2a Cygwin: wincap: Add capabilities for Windows 10 2004 and newer.
- The capability changes since Windows 10 2004 have been reflected
  in wincap.cc. (has_con_broken_il_dl has been changed to false.)
2022-02-05 19:28:34 +09:00
Corinna Vinschen a4efb2a669 Cygwin: remove support for Vista entirely
Fix up a few comments while at it

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 080eae709f Cygwin: drop support for systems not supporting the CONSOLE LOGON SID
i. e. Vista/2008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 687c4bad28 Cygwin: drop support for systems not supporting processor groups
i. e., Vista/2008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 4bc8f1adb4 Cygwin: drop support for simple invisible console code
i. e., Vista/2008.

AllocConsole appears to allow creating a console only on the currently
visible desktop since Windows 7, which broke the simple code opening
the console on an invisible desktop in an invisible window station.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen e8bfe36281 Cygwin: drop support for systems not supporting QueryUnbiasedInterruptTime
i. e., Vista/2008

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:40 +02:00
Corinna Vinschen e36811afb4 Cygwin: drop Vista WOW64 specific child process handle bug
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 14:52:58 +02:00
Takashi Yano 6c1f49f83f Cygwin: pipe: Use ProcessHandleInformation if available.
- The commit b531d6b0 introduced temporary_query_hdl() which uses
  SystemHandleInformation. With this patch, ProcessHandleInformation
  rather than SystemHandleInformation is used if it is available.
  This request is faster, however, is only available since Windows 8,
  therefore, SystemHandleInformation is used for Windows Vista and 7
  as before.
2021-09-23 12:24:19 -04:00
Ben Wijen cb41c375a6 syscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
I think we don't need an extra flag as we can utilize: access & FILE_WRITE_ATTRIBUTES
What do you think?

Ben Wijen (1):
  syscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

 winsup/cygwin/ntdll.h     |  3 ++-
 winsup/cygwin/syscalls.cc | 22 +++++++--------
 winsup/cygwin/wincap.cc   | 11 ++++++++
 winsup/cygwin/wincap.h    | 56 ++++++++++++++++++++-------------------
 4 files changed, 53 insertions(+), 39 deletions(-)

--
2.30.0

>From 2d0ff6fec10d03c24d11c747852018b7bc1136ac Mon Sep 17 00:00:00 2001
In-Reply-To: <20210122105201.GD810271@calimero.vinschen.de>
References: <20210122105201.GD810271@calimero.vinschen.de>
From: Ben Wijen <ben@wijen.net>
Date: Tue, 17 Dec 2019 15:15:25 +0100
Subject: [PATCH v3 1/8] syscalls.cc: unlink_nt: Try
 FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

Implement wincap.has_posix_unlink_semantics_with_ignore_readonly and when set
skip setting/clearing of READONLY attribute and instead use
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
2021-01-25 10:50:13 +01:00
Corinna Vinschen ffb07b41bc Cygwin: tcp: Support TCP_USER_TIMEOUT
Use TCP_MAXRTMS on newer systems, TCP_MAXRT on older systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:52 +02:00
Corinna Vinschen 8ccffddc91 Cygwin: tcp: Support TCP_KEEPIDLE, TCP_KEEPCNT, TCP_KEEPINTVL
Use WSAIoctl(SIO_KEEPALIVE_VALS) on older systems.

Make sure that keep-alive timeout is equivalent to
TCP_KEEPIDLE + TCP_KEEPCNT * TCP_KEEPINTVL on older systems,
even with TCP_KEEPCNT being a fixed value on those systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:52 +02:00
Corinna Vinschen 0feb77c260 Cygwin: tcp: Support TCP_FASTOPEN
TCP_FASTOPEN is supported since W10 1607.  Fake otherwise.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:40 +02:00
Corinna Vinschen e18f7f99cc 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-04-07 17:42:02 +02:00
Takashi Yano 0d7bbc0bc3 Cygwin: console: Add support for REP escape sequence to xterm mode.
- In Win10 upto 1809, xterm compatible mode does not have REP
  escape sequence which terminfo declares. This patch adds support
  for "CSI Ps b" (REP). With this patch, bvi (binary editor) works
  normally in Win10 1809. Also, xterm compatible mode does not have
  "CSI Pm `" (HPA), "CSI Pm a" (HPR) and "CSI Ps e" (VPR). However,
  they do not appear to be declared by terminfo. Therefore, these
  have been pending.
2020-02-26 21:17:36 +01:00
Takashi Yano 7dfe04e933 Cygwin: console: Add workaround for broken IL/DL in xterm mode.
- Cygwin console with xterm compatible mode causes problem reported
  in https://www.cygwin.com/ml/cygwin-patches/2020-q1/msg00212.html
  if background/foreground colors are set to gray/black respectively
  in Win10 1903/1909. This is caused by "CSI Ps L" (IL), "CSI Ps M"
  (DL) and "ESC M" (RI) control sequences which are broken. This
  patch adds a workaround for the issue.
2020-02-26 21:17:36 +01:00
Takashi Yano f03806b68a Cygwin: console: Add workaround for broken CSI3J in Win10 1809.
- In Win10 1809, the cursor position sometimes goes out of screen
  by clear command in console. This seems to be caused by escape
  sequence CSI3J (ESC[3J). This happens only for 1809. This patch
  is a workaround for the issue.
2020-01-14 17:17:20 +01:00
Corinna Vinschen e1254add73 Cygwin: Allow accessing 48 bit address space in Windows 8.1 or later
64 bit Windows started out with a 44 bit address space due to a
restriction of the AMD64 CPUs at the time.  Starting with Windows
8.1, these CPUs are not supported anymore and Windows switched to
the full 48 bit address space supported by AMD64.

Cygwin didn't follow suit yet so mmaps are still restricted to
the lower 44 bit address space.  Fix that by using a system-specific
upper address for mmap allocations, 44 bit up to Windows 8, 48 bit
starting with Windows 8.1.

While at it, move the heap by another 8 Gigs to leave some space
for a potential extension of DLL address space, and restrict the
mmap lower address so the heap can grow to 32 Gigs before colliding
with mmaps.
2019-06-04 16:58:53 +02:00
Corinna Vinschen 28182bca18 Cygwin: drop unsupported Windows 10 versions
* Pre-release version still reporting kernel version 6.4.
* Windows 10 1511 is out of support since 2017-10-10.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-19 18:13:02 +02:00
Takashi Yano bd627864ab Cygwin: console: support 24 bit color
- Add 24 bit color support using xterm compatibility mode in
  Windows 10 1703 or later.
- Add fake 24 bit color support for legacy console, which uses
  the nearest color from 16 system colors.
2019-03-31 18:34:58 +02:00
Corinna Vinschen 38dde5f4c4 Cygwin: fork: fix child process permissions, take 3
Per MSDN VirtualQueryEx requires PROCESS_QUERY_INFORMATION.
Testing showed that PROCESS_QUERY_LIMITED_INFORMATION is sufficient
since Windows 8.1.  The assumption that Windows 8 is the same as
Windows 8 was not correct, it requires PROCESS_QUERY_INFORMATION
as well.

Fix that by splitting the Windows 8 wincaps into one for Windows 8
and one for Windows 8.1.  Set needs_query_information for Windows 8.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-03 10:59:13 +01:00
Corinna Vinschen 495ae41891 Cygwin: wincap: fix copy/paste bug
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-28 16:55:39 +01:00
Corinna Vinschen 649911fb40 Cygwin: get_user_groups: fetch a user's group list from identification token
NetUserGetGroups and NetUserGetLocalGroups sometimes take a lot of time
(up to more than 2 mins) for no apparent reason.

Call s4uauth to generate an identification token for the user and fetch
the group list from there.  This is *much* faster.

Keep the old code only for the sake of WOW64 on Vista and Windows 7,
which don't implement MsV1_0S4ULogon.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-22 21:58:51 +01:00
Corinna Vinschen 5a0f2c00aa Cygwin: fork/exec: fix child process permissions
- Exec'ed/spawned processes don't need PROCESS_DUP_HANDLE.  Remove that
  permission from the parent handle.

- PROCESS_QUERY_LIMITED_INFORMATION doesn't work for Windows 7 if the
  process is started as a service.  Add PROCESS_QUERY_INFORMATION for
  pre-Windows 8 in that case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-29 17:59:23 +01:00
Corinna Vinschen 5275b3e3f2 Cygwin: wincap: split has_posix_file_info
While FileRenameInformationEx is defined starting with Windows
10 1709 per MSDN, it only starts working in W10 1809, apparently.
Users of 1803 report "Function not implemented".

Introduce wincap_10_1809 and change the version check in
wincapc::init accordingly.  Split has_posix_file_info into
has_posix_unlink_semantics and has_posix_rename_semantics.
Enable the latter only starting with W10 1809.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-14 20:38:24 +01:00
Corinna Vinschen 92edcf929a Cygwin: wincap: add wincap_10_1803, add has_case_sensitive_dirs item
- Allow to disable the flag by calling disable_case_sensitive_dirs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-12-25 01:07:51 +01:00
Corinna Vinschen 092a768885 Cygwin: wincap: add wincap_10_1709, add has_posix_file_info item
Various new file info class members adding important POSIX semantics
have been added with W10 1709.  We may want to utilize them, so add
a matching wincaps.

Rearrange checking the W10 build number to prefer the latest builds
over the older builds.  Rename wincap_10 to wincap_10_1507 for
enhanced clarity.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-12-23 00:24:05 +01:00
Corinna Vinschen c05df02725 Cygwin: implement extensible clock interface
- Drop hires_[nm]s clocks, rename hires.h to clock.h.

- Implement clk_t class as an extensible clock class in new file clock.cc.

- Introduce get_clock(clock_id) returning a pointer to the clk_t instance
  for clock_id.  Provide the following methods along the lines of the former
  hires classes:

	void		clk_t::nsecs (struct timespec *);
	ULONGLONG	clk_t::nsecs ();
	LONGLONG	clk_t::usecs ();
	LONGLONG	clk_t::msecs ();
	void 		clk_t::resolution (struct timespec *);

- Add CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE
  and CLOCK_BOOTTIME clocks.

- Allow clock_nanosleep, pthread_condattr_setclock and timer_create to use
  all new clocks (both clocks should be usable with a small tweak, though).

- Bump DLL major version to 2.12.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-11-29 11:05:42 +01:00
Corinna Vinschen e7bcf4633e cygwin: wincap: handle W10 1703
Add has_unprivileged_createsymlink flag and set to true on 1703 and
later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-24 17:14:03 +02:00
Corinna Vinschen 63f19278b9 cygwin: wincap: fix evaluation of build number
RtlGetNtVersionNumbers returns the build number with some upper bits
set for no apparent reason.  The fact that RtlGetNtVersionNumbers is
undocumented doesn't exactly help.

Just filter out the upper WORD for now.  If build numbers are in
danger to become 6 digit numbers, re-evaluate.
2017-04-24 17:12:16 +02:00
Corinna Vinschen 67fd2101ab Drop max_sys_priv wincap
Convert sys_privs to const struct with TOKEN_PRIVILEGES layout.
Drop function get_system_priv_list.  Just use pointer to sys_privs.

Dropping max_sys_priv from wincaps requires to make sure that the
bitfield is 8 byte aligned on x86_64, otherwise gcc (5.3 only?)
apparently breaks access to the bitfield (off by 4 bytes).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-24 21:00:04 +02:00