]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
2 months agofeatures.h: support POSIX.1-2024
Corinna Vinschen [Thu, 15 Aug 2024 15:40:06 +0000 (17:40 +0200)]
features.h: support POSIX.1-2024

TBD: Align _GNU_SOURCE, too?

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 months agofeatures.h: fix whitespace
Corinna Vinschen [Thu, 15 Aug 2024 15:36:54 +0000 (17:36 +0200)]
features.h: fix whitespace

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 months agoCygwin: Avoid use-after-free warnings in __set_lc_time_from_win() etc.
Jon Turney [Sun, 4 Aug 2024 16:15:50 +0000 (17:15 +0100)]
Cygwin: Avoid use-after-free warnings in __set_lc_time_from_win() etc.

Rewrite to avoid new use-after-free warnings about realloc(), seen with
gcc 12, e.g.:

> In function ‘void rebase_locale_buf(const void*, const void*, const char*, const char*, const char*)’,
>     inlined from ‘int __set_lc_time_from_win(const char*, const lc_time_T*, lc_time_T*, char**, wctomb_p, const char*)’ at ../../../../src/winsup/cygwin/nlsfuncs.cc:705:25:
> ../../../../src/winsup/cygwin/nlsfuncs.cc:338:24: error: pointer ‘new_lc_time_buf’ may be used after ‘void* realloc(void*, size_t)’ [-Werror=use-after-free]
>   338 |       *ptrs += newbase - oldbase;
>       |                ~~~~~~~~^~~~~~~~~
> ../../../../src/winsup/cygwin/nlsfuncs.cc: In function ‘int __set_lc_time_from_win(const char*, const lc_time_T*, lc_time_T*, char**, wctomb_p, const char*)’:
> ../../../../src/winsup/cygwin/nlsfuncs.cc:699:44: note: call to ‘void* realloc(void*, size_t)’ here
>   699 |               char *tmp = (char *) realloc (new_lc_time_buf, len);

Technically, it's UB to later refer to the realloced pointer (even just
for offset computations, without deferencing it), so switch to using
malloc() to create the resized copy.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2 months agoCygwin: Fix warnings about narrowing conversions of socket ioctls
Jon Turney [Sun, 4 Aug 2024 16:02:00 +0000 (17:02 +0100)]
Cygwin: Fix warnings about narrowing conversions of socket ioctls

Fix gcc 12 warnings about narrowing conversions of socket ioctl constants
when used as case labels, e.g:

> ../../../../src/winsup/cygwin/net.cc: In function ‘int get_ifconf(ifconf*, int)’:
> ../../../../src/winsup/cygwin/net.cc:1940:18: error: narrowing conversion of ‘2152756069’ from ‘long int’ to ‘int’ [-Wnarrowing]

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2 months agoCygwin: asm/socket.h: drop outdated casts
Corinna Vinschen [Wed, 7 Aug 2024 15:09:44 +0000 (17:09 +0200)]
Cygwin: asm/socket.h: drop outdated casts

The _IOR anbd _IOW macros cast the sizeof of their third arg
uselessly to long. The _IO definitions have been taken from BSD
in 1995 and never changed again.  The fact that the sizeof() gets
cast to long is probably a remnant from the past when the stuff
was supposed to be used on 16 bit machines, but the value was
supposed to be 32 bit.

Given that the values are not supposed to be ever bigger than 32 bit,
we drop the (long) cast.  Compare with current FreeBSD, which does
not cast at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 months agoCygwin: Fix warning about narrowing conversions in tape options
Jon Turney [Sun, 4 Aug 2024 16:01:38 +0000 (17:01 +0100)]
Cygwin: Fix warning about narrowing conversions in tape options

Fix a gcc 12 warning about a narrowing conversion in case labels for
tape options.

> In file included from /wip/cygwin/src/winsup/cygwin/include/sys/mtio.h:14,
>                  from ../../../../src/winsup/cygwin/fhandler/tape.cc:13:
> ../../../../src/winsup/cygwin/fhandler/tape.cc: In member function ‘int mtinfo_drive::set_options(HANDLE, int32_t)’:
> ../../../../src/winsup/cygwin/fhandler/tape.cc:965:12: error: narrowing conversion of ‘4026531840’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2 months agoCygwin: Fix warning about address known to be non-NULL in /proc/locales
Jon Turney [Sun, 4 Aug 2024 15:37:44 +0000 (16:37 +0100)]
Cygwin: Fix warning about address known to be non-NULL in /proc/locales

Fix a gcc 12 warning about an address known to be non-NULL in
format_proc_locale_proc().

> ../../../../src/winsup/cygwin/fhandler/proc.cc: In function ‘BOOL format_proc_locale_proc(LPWSTR, DWORD, LPARAM)’:
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2156:11: error: the address of ‘iso15924’ will never be NULL [-Werror=address]
>  2156 |       if (iso15924)
>       |           ^~~~~~~~
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2133:11: note: ‘iso15924’ declared here
>  2133 |   wchar_t iso15924[ENCODING_LEN + 1] = { 0 };
>       |           ^~~~~~~~

Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2 months agoCygwin: Fix warnings about narrowing conversions of NTSTATUS constants
Jon Turney [Sun, 4 Aug 2024 15:30:16 +0000 (16:30 +0100)]
Cygwin: Fix warnings about narrowing conversions of NTSTATUS constants

Fix warnings with gcc 12 about narrowing conversions of NTSTATUS
constants when used as case labels, e.g:

> ../../../../src/winsup/cygwin/exceptions.cc: In static member function ‘static int exception::handle(EXCEPTION_RECORD*, void*, CONTEXT*, PDISPATCHER_CONTEXT)’:
> ../../../../src/winsup/cygwin/exceptions.cc:670:10: error: narrowing conversion of ‘-1073741682’ from ‘NTSTATUS’ {aka ‘int’} to ‘unsigned int’ [-Wnarrowing]

See also: c5bdf60ac46401a51a7e974333d9622966e22d67

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2 months agoCygwin: Suppress array-bounds warning from NtCurrentTeb()
Jon Turney [Sun, 4 Aug 2024 14:51:07 +0000 (15:51 +0100)]
Cygwin: Suppress array-bounds warning from NtCurrentTeb()

This disables a warning seen with gcc 12 caused by intrinsics used by
the inline implementation of NtCurrentTeb() inside w32api headers.

> In function ‘long long unsigned int __readgsqword(unsigned int)’,
>     inlined from ‘_TEB* NtCurrentTeb()’ at /usr/include/w32api/winnt.h:10020:86,
> [...]
> /usr/include/w32api/psdk_inc/intrin-impl.h:838:1: error: array subscript 0 is outside array bounds of ‘long long unsigned int [0]’ [-Werror=array-bounds]

See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523#c6

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
3 months agostdatomic: make atomics compatible with GCC-14
Alexey Lapshin [Mon, 8 Jul 2024 07:24:55 +0000 (14:24 +0700)]
stdatomic: make atomics compatible with GCC-14

https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631525.html
brings c_atomic and cxx_atomic definitions into GCC.
This patch makes atomics type detection correct for GCC.

https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf

3 months agoCygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags resync
Brian Inglis [Thu, 18 Jul 2024 16:27:50 +0000 (10:27 -0600)]
Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags resync

Linux 6.10 changed the content of cpufeatures.h to require explicit
quoted flag names for output in comments, instead of requiring a null
quoted string "" at the start of comments to suppress flag name output.
As a result, some flags (not all for output) were renamed and others moved:

- change dts to ds; move intel_ppin down; swap ibpd and ibrs;
- change some flag names and descriptions that are not output.

Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
3 months agoCygwin: fhandler/proc.cc(format_proc_cpuinfo): add newlines
Brian Inglis [Thu, 18 Jul 2024 16:27:49 +0000 (10:27 -0600)]
Cygwin: fhandler/proc.cc(format_proc_cpuinfo): add newlines

Linux cpuinfo follows output for each processor with a blank line,
so we output newlines to get a blank line:
- newline after power management feature flags if printed;
- newline to give blank line after each processor output.

Reported-by: Achim Gratz https://cygwin.com/pipermail/cygwin/2024-July/256223.html
Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
3 months agoCygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags added
Brian Inglis [Thu, 18 Jul 2024 16:27:48 +0000 (10:27 -0600)]
Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags added

0x8000000a EDX 18 x2avic      virtual x2apic
0x80000022 EAX  2 amd_lbr_pmc_freeze AMD last br rec and perf mon ctrs freeze

Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
3 months agonewlib: Add more FreeBSD files for non LDBL_EQ_DBL support
Kito Cheng [Wed, 10 Jul 2024 09:44:59 +0000 (17:44 +0800)]
newlib: Add more FreeBSD files for non LDBL_EQ_DBL support

For RISC-V, AArch64, i386, and x86_64

- k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
  not found when tanl is called.
- s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are already
  available for ld80 but not for ld128.

3 months agosys/tree.h: Removed
Joel Sherrill [Tue, 18 Jun 2024 15:50:22 +0000 (10:50 -0500)]
sys/tree.h: Removed

This file was from a specific older FreeBSD version. There have been
multiple changes to this file with FreeBSD 14 including breaking
changes to the file. Including this file as part of newlib results
in not always having the correct version of sys/tree.h for any
specific software. RTEMS will manage its use of this file outside
of newlib.

3 months agolibc/arm: add missing .cfi_sections
Clément Chigot [Mon, 10 Jun 2024 12:37:57 +0000 (14:37 +0200)]
libc/arm: add missing .cfi_sections

The modifications added by the series "M-profile PACBTI-enablement"
(see 9d6b00511e50a54d2472d11f75f7c0f2b4a98b24) have introduced a couple
of .cfi_* instructions.

Like for e6459123e497409a9e3d845c39829a9602ba55a4, these instructions
create object files which contain .eh_frame sections.  However, ARM uses
its own unwind info format, not .eh_frame, which is generated by
ARM-specific directives, not .cfi_*. The .eh_frame sections are useless,
but also not removed by strip and may be harmful with some linker
scripts.

Adding ".cfi_sections .debug_frame" (as in glibc) moves the generated
directives towards .debug_frame instead of .eh_frame. Making them easier
to handle.

            * libc/machine/arm/aeabi_memmove-thumb2.S: Use .cfi_sections
            .debug_frame.
            * libc/machine/arm/aeabi_memset-thumb2.S: Likewise.
            * libc/machine/arm/memchr.S: Likewise.
            * libc/machine/arm/memcpy-armv7m.S: Likewise.
            * libc/machine/arm/setjmp.S: Likewise.
            * libc/machine/arm/strlen-armv7.S: Likewise.
            * libc/machine/arm/strlen-thumb2-Os.S: Likewise.

3 months agolibc/include/sys/resource.h: Add RUSAGE_THREAD
Joel Sherrill [Mon, 8 Jul 2024 22:22:44 +0000 (17:22 -0500)]
libc/include/sys/resource.h: Add RUSAGE_THREAD

3 months agosys: Remove $FreeBSD$: two-line .h pattern
Warner Losh [Wed, 16 Aug 2023 17:54:11 +0000 (11:54 -0600)]
sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

3 months agospdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

3 months agosys/stdatomic.h: be nicer to c++
Konstantin Belousov [Sun, 27 Mar 2022 21:16:15 +0000 (00:16 +0300)]
sys/stdatomic.h: be nicer to c++

Use of stdatomic.h is undefined in C++, even the C++ 2020 standard does not
list stdatomic.h as a C library header supported by the language.  More,
there are some subtle differences between the <atomic> C++ header, and
C11+ stdatomic.h provided features.

Nonetheless, it is a quality of the implementation aspect, so let mis-users
mis-use stdatomic.h as they want, by making a compat shim for _Bool.

PR: 262683
Reported by: yuri
Reviewed by: dim, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34686

3 months agosys/sys: further adoption of SPDX licensing ID tags.
Pedro F. Giffuni [Mon, 27 Nov 2017 15:01:59 +0000 (15:01 +0000)]
sys/sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

3 months agoCygwin: console: Fix for GNU screen/tmux in ConEmu
Takashi Yano [Mon, 8 Jul 2024 14:09:12 +0000 (23:09 +0900)]
Cygwin: console: Fix for GNU screen/tmux in ConEmu

If the master process of GNU screen or tmux is started in ConEmu
and ConEmu is closed, reattaching to the GNU screen/tmux in another
console will not work correctly. This is because the ConEmu master
process was already closed even though some console APIs are hooked
by ConEmuHk64.dll to communicate with ConEmu master process. With
this patch, to make them unhooked, DllMain() of ConEmuHk64.dll is
called with DLL_PROCESS_DETACH.

Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
3 months agoCygwin: console: Fix race issue on allocating console simultaneously.
Takashi Yano [Sat, 6 Jul 2024 15:34:44 +0000 (00:34 +0900)]
Cygwin: console: Fix race issue on allocating console simultaneously.

Previously, if two or more processes request to allocate a console at
the same time, the same device number could be accidentally allocated.
This patch fixes the issue by creating a named mutex (input_mutex) and
checking if GetLastError() is ERROR_ALREADY_EXIST or not to ensure
the unit number will be allocated in an atomic way. Thanks to this,
EnumWindow() is not necessary anymore to scan console units.

This also makes minor device numbers unique and console devices visible
across sessions. This disallows duplicated device number for different
sessions, so the MAX_CONS_DEV has been increased from 64 to 128.

Additionally, the console allocation and scanning will be faster as
a side effect of eliminating EnumWindows().

Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
3 months agoCygwin: console: Bug fix for the last console code change
Takashi Yano [Sat, 6 Jul 2024 15:16:29 +0000 (00:16 +0900)]
Cygwin: console: Bug fix for the last console code change

The commit baf2764dca43 has a serious bug that shared_info_state is
common for all console devices despite it should be individual for
each console device. This patch fixes that.

Fixes: baf2764dca43 ("Cygwin: console: Fixes an issue that tmux can not run on the console.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
3 months agoCygwin: console: Fixes an issue that tmux can not run on the console.
Takashi Yano [Sat, 6 Jul 2024 04:50:51 +0000 (13:50 +0900)]
Cygwin: console: Fixes an issue that tmux can not run on the console.

After the commit c77a5689f7bd, tmux can not run on the console.
This patch replaces the countermeasure for the race issue between
console setup and close with another mechanism using a mutex.

Fixes: c77a5689f7bd ("Cygwin: console: Do not unmap shared console memory belonging to ctty.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agoCygwin: console: Fix conflict on shared names between sessions.
Takashi Yano [Wed, 3 Jul 2024 13:35:20 +0000 (22:35 +0900)]
Cygwin: console: Fix conflict on shared names between sessions.

Previously, shared names in the console were created using get_minor().
However, get_minor() was not unique to the console across sessions.
This is because EnumWindows(), which is used to look for console windows,
cannot enumerate windows across sessions. This causes conflict on the
shared names between sessions (e.g. sessions of different users,
different services, a service and a user session, etc.).

With this patch, GetConsoleWindow() is used instead of get_minor().
GetConsoleWindow() has been used for the name of shared memory, which
should be unique to each console.

Addresses: https://cygwin.com/pipermail/cygwin/2024-April/255893.html
Fixes: ff4440fcf768 ("Cygwin: console: Introduce new thread which handles input signal.");
Reported-by: Johannes Khoshnazar-Thoma <johannes@johannesthoma.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agolibc/include/complex.h: Add CMPLX, CMPLXF, and CMPLXL
Joel Sherrill [Mon, 1 Jul 2024 20:51:24 +0000 (15:51 -0500)]
libc/include/complex.h: Add CMPLX, CMPLXF, and CMPLXL

4 months agolibc/include/sys/_default_fcntl.h: O_RSYNC and O_DSYNC are POSIX
Joel Sherrill [Sat, 29 Jun 2024 20:57:57 +0000 (15:57 -0500)]
libc/include/sys/_default_fcntl.h: O_RSYNC and O_DSYNC are POSIX

These should not be in a Cygewin conditional.

4 months agoarm: Fix fma & fmaf implementations
Mickaël Thomas [Sat, 29 Jun 2024 20:44:34 +0000 (22:44 +0200)]
arm: Fix fma & fmaf implementations

The vfma.f32|64 z, x, y instruction performs the operation
z += x * y without intermediate rounding.

The register used for z is both read and written by the instruction.
The inline assembly must therefore use the "+" constraint modifier.

4 months agoCygwin: pty: Avoid client deadlock when pty master stops to read.
Takashi Yano [Mon, 1 Jul 2024 08:44:53 +0000 (17:44 +0900)]
Cygwin: pty: Avoid client deadlock when pty master stops to read.

Previsouly, the following commands hangs:
  mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaa | cat'

The mechanism is as follows.

When the child process (timeout) is terminated, mintty seems to stop
reading pty master even if yes or cat still alive.

If the the pipe used to transfer output from pty slave to pty master
is full due to lack of master reader, WriteFile() to the pipe is
blocked. WriteFile() cannot be canceled by cygwin signal, therefore,
pty slave hangs.

This patch avoids hanging by checking pipe space before calling
WriteFile() and prevents writing data more than space.

Addresses: https://cygwin.com/pipermail/cygwin/2024-June/256178.html
Reported-by: jojelino <jojelino@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agoCygwin: console: Add debug print on thread_sync_event creation error
Takashi Yano [Sat, 29 Jun 2024 23:38:11 +0000 (08:38 +0900)]
Cygwin: console: Add debug print on thread_sync_event creation error

Fixes: 55baaac2ef5f ("Cygwin: console: Add error handling for thread_sync_event")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agoCygwin: console: Add error handling for thread_sync_event
Takashi Yano [Sat, 29 Jun 2024 10:03:20 +0000 (19:03 +0900)]
Cygwin: console: Add error handling for thread_sync_event

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agoCygwin: dsp: Fix incorrect openflags when opening multiple /dev/dsp
Takashi Yano [Fri, 28 Jun 2024 04:42:03 +0000 (13:42 +0900)]
Cygwin: dsp: Fix incorrect openflags when opening multiple /dev/dsp

Previously, the following steps failed with error:
  1) Open /dev/dsp with O_RDONLY
  2) Open /dev/dsp with O_WRONLY
  3) Issue SNDCTL_DSP_GETOSPACE ioctl() for 2)
This is because IS_WRITE() returns false for 2) due to incorrect
openflags handling in archetype instance. This patch fixes the
issue by adding open_setup() to fhandler_dev_dsp to set openflags
correctly for each instance.

Fixes: 92ddb7429065 ("* fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
4 months agolibc: sh: add missing prototypes and change functions from K&R to ANSI
Pietro Monteiro [Mon, 24 Jun 2024 23:08:38 +0000 (19:08 -0400)]
libc: sh: add missing prototypes and change functions from K&R to ANSI

The SuperH target doesn't build on GCC 14.1 because of missing
function prototypes or because some function declarations use the
deprecated K&R style.  This patch adds missing prototypes on the files
the functions are used and convert K&R declarations to ANSI-style.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
4 months agoarm: emit .type %function directive in FUNC_START macro
Christophe Lyon [Wed, 19 Jun 2024 15:48:30 +0000 (15:48 +0000)]
arm: emit .type %function directive in FUNC_START macro

The linker needs to know whether a symbol is STT_FUNCTION when
deciding which farcall stub to emit (if needed), this patch adds this
to the FUNC_START macro which is used in crt0.

4 months agoCygwin: suppress a warning generated with w32api >= 12.0.0
Jon Turney [Fri, 7 Jun 2024 16:29:10 +0000 (17:29 +0100)]
Cygwin: suppress a warning generated with w32api >= 12.0.0

w32api 12.0.0 adds the returns_twice attribute to RtlCaptureContext().
There's some data-flow interaction with using it inside a while loop
which causes a maybe-uninitialized warning.

../../../../winsup/cygwin/exceptions.cc: In member function 'int _cygtls::call_signal_handler()':
../../../../winsup/cygwin/exceptions.cc:1720:33: error: '<anonymous>' may be used uninitialized in this function [-Werror=maybe-uninitialized]

4 months agonewlib: libm: skip "long double" complex functions if long double != double
Pietro Monteiro [Tue, 4 Jun 2024 01:35:47 +0000 (21:35 -0400)]
newlib: libm: skip "long double" complex functions if long double != double

The rest of "long double" functions aren't compiled with long double
and double are not the same.  Do the same for all complex functions.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
5 months agoCygwin: disable high-entropy VA for ldh
Jeremy Drake via Cygwin-patches [Tue, 28 May 2024 17:19:22 +0000 (10:19 -0700)]
Cygwin: disable high-entropy VA for ldh

If ldd is run against a DLL which links to the Cygwin DLL, ldh will end
up loading the Cygwin DLL dynamically, much like cygcheck or strace.

Addresses: https://cygwin.com/pipermail/cygwin/2024-May/255991.html
Fixes: 60675f1a7eb2 ("Cygwin: decouple shared mem regions from Cygwin DLL")
Reviewed-by: Ken Brown <kbrown@cornell.edu>, Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
5 months agoCygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82
Takashi Yano [Wed, 29 May 2024 10:12:09 +0000 (19:12 +0900)]
Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82

To avoid race issues, pthread::once() uses pthread_mutex. This caused
the handle leak which was fixed by the commit 2c5433e5da82. However,
this fix introduced another race issue, i.e., the mutex may be used
after it is destroyed. This patch fixes the issue. Special thanks to
Bruno Haible for discussing how to fix this.

Addresses: https://cygwin.com/pipermail/cygwin/2024-May/255987.html
Reported-by: Bruno Haible <bruno@clisp.org>
Fixes: 2c5433e5da82 ("Cygwin: pthread: Fix handle leak in pthread_once.")
Reviewed-by: Ken Brown <kbrown@cornell.edu>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
5 months agoCygwin: mixer: Fix volume control for no WAVECAPS_LRVOLUME device
Takashi Yano [Sat, 1 Jun 2024 06:23:37 +0000 (15:23 +0900)]
Cygwin: mixer: Fix volume control for no WAVECAPS_LRVOLUME device

Currently, if the device does not have capability WAVECAPS_LRVOLUME,
the volume control does not work properly. This patch fixes that.

Fixes: 2a4af3661470 ("Cygwin: Implement sound mixer device.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
5 months agoarc: libgloss: Add build rules for new boards
Yuriy Kolerov [Tue, 21 May 2024 09:56:58 +0000 (10:56 +0100)]
arc: libgloss: Add build rules for new boards

Add build rules to support packages for development boards and
nSIM hostlink.

Makefile.in is generated this way:

    $ autoconf --version
    autoconf (GNU Autoconf) 2.69
    $ automake --version
    automake (GNU automake) 1.15.1
    $ cd libgloss
    $ autoreconf -i

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add support of EM Starter Kit board
Yuriy Kolerov [Tue, 21 May 2024 09:56:57 +0000 (10:56 +0100)]
arc: libgloss: Add support of EM Starter Kit board

These specs files are introduced for EMSK board:

    * emsk1_em4.specs - EMSKv1 with EM4 core, everything in
      ICCM/DCCM memory
    * emsk1_em6.specs - EMSKv1 with EM6 core, everything in
      ICCM/DCCM memory
    * emsk1_em6_ram.specs - EMSKv1 with EM6 core, startup code
      in ICCM and everything else in RAM
    * emsk2.1_em5d.specs - EMSKv2.1 with EM5D core, everything
      in ICCM/DCCM memory
    * emsk2.1_em7d.specs - EMSKv2.1 with EM7D core, everything
      in ICCM/DCCM memory
    * emsk2.1_em7d_ram.specs - EMSKv2.1 with EM7D core, startup
      code in ICCM and everything else in RAM
    * emsk2.2_em7d.specs - EMSKv2.2+ with EM7D core, everything
      in ICCM/DCCM memory
    * emsk2.2_em7d_ram.specs - EMSKv2.2+ with EM7D core, startup
      code in ICCM and everything else in RAM
    * emsk2.2_em9d.specs - EMSKv2.2+ with EM9D core, everything
      in ICCM/DCCM memory
    * emsk2.2_em9d_ram.specs - EMSKv2.2+ with EM9D core, startup
      code in ICCM and everything else in RAM
    * emsk2.2_em11d.specs - EMSKv2.2+ with EM11D core, everything
      in ICCM/DCCM memory
    * emsk2.2_em11d_ram.specs - EMSKv2.2+ with EM11D core, startup
      code in ICCM and everything else in RAM

An example of building an application:

    $ arc-elf32-gcc -mcpu=em -specs=emsk2.2_em11d_ram.specs main.c -o main

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add support of EM SDP board
Yuriy Kolerov [Tue, 21 May 2024 09:56:56 +0000 (10:56 +0100)]
arc: libgloss: Add support of EM SDP board

These specs files are introduced for EM SDP board:

    * emsdp1.1.specs - EM SDP 1.1, everything in ICCM/DCCM memory
    * emsdp1.1_ram.specs - EM SDP 1.1, startup code in ICCM
      memory and everything else in RAM
    * emsdp1.2.specs - EM SDP 1.2, everything in ICCM/DCCM memory
    * emsdp1.2_ram.specs - EM SDP 1.2, startup code in ICCM
      memory and everything else in RAM

An example of building an application:

    $ arc-elf32-gcc -mcpu=em -specs=emsdp1.1_ram.specs main.c -o main

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add support of HS Development Kit board
Yuriy Kolerov [Tue, 21 May 2024 09:56:55 +0000 (10:56 +0100)]
arc: libgloss: Add support of HS Development Kit board

An example of building an application:

    $ arc-elf32-gcc -mcpu=hs -specs=hsdk.specs main.c -o main

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add support of IoT Development Kit board
Yuriy Kolerov [Tue, 21 May 2024 09:56:54 +0000 (10:56 +0100)]
arc: libgloss: Add support of IoT Development Kit board

An example of building an application:

    $ arc-elf32-gcc -mcpu=em -specs=iotdk.specs main.c -o main

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add a linker script common for all boards
Yuriy Kolerov [Tue, 21 May 2024 09:56:53 +0000 (10:56 +0100)]
arc: libgloss: Add a linker script common for all boards

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Add UART 8250 library
Yuriy Kolerov [Tue, 21 May 2024 09:56:52 +0000 (10:56 +0100)]
arc: libgloss: Add UART 8250 library

This library implements libgloss input/output and setup
routines for UART 8250 devices of ARC development boards:

    * EM Starter Kit
    * HS Development Kit
    * EM Software Development Platform
    * IoT Development Kit

_uart_8250_setup function with proper parameteres must be called
to setup UART 8250 device for a particular board (refer to
a board's documentation).

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Clean registers before any use
Yuriy Kolerov [Tue, 21 May 2024 09:56:51 +0000 (10:56 +0100)]
arc: libgloss: Clean registers before any use

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libgloss: Use atexit to setup fini routines
Claudiu Zissulescu [Tue, 21 May 2024 09:56:50 +0000 (10:56 +0100)]
arc: libgloss: Use atexit to setup fini routines

Use atexit funtion to setup fini routines to be called on exit
instead of filling in __atexit structures manually.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
5 months agoarc: libgloss: Introduce hostlink interface
Vladimir Isaev [Tue, 21 May 2024 09:56:49 +0000 (10:56 +0100)]
arc: libgloss: Introduce hostlink interface

There is a special interface built in ARC simulators (such as
nSIM) called MetaWare hostlink IO which can be used to implement
system calls. This commit adds support for this interface to the
ARC port of libgloss.

Here is an example of using this interface:

    $ arc-elf32-gcc -mcpu=hs -specs=hl.specs main.c -o main
    $ nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs48_full.tcf main
    Hello, World!

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
5 months agoarc: libgloss: Use fstat call instead of stat for nSIM
Luis Silva [Tue, 21 May 2024 09:56:48 +0000 (10:56 +0100)]
arc: libgloss: Use fstat call instead of stat for nSIM

This change is needed to meet semi-hosting requirements
for nSIM GNU I/O interface.

Signed-off-by: Luis Silva <luis.m.silva99@hotmail.com>
5 months agoarc: libc: Record r58/r59 in long-jump's buffer
Shahab Vahedi [Tue, 21 May 2024 09:56:47 +0000 (10:56 +0100)]
arc: libc: Record r58/r59 in long-jump's buffer

The "longjmp" expects the "setjmp" to save the r58/r59 registers,
if there is any. With this change they are saved accordingly.

Checked for regression with running GCC's DejaGnu tests:

    $ runtest execute.exp=pr56982.c dg-torture.exp=pr48542.c

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
5 months agoarc: libc, libgloss: Remove .file directive from .S files
Yuriy Kolerov [Tue, 21 May 2024 09:56:46 +0000 (10:56 +0100)]
arc: libc, libgloss: Remove .file directive from .S files

Assembler for ARCv2 always extends the name provided by
.file directive to an absolute form.

On ARCv3 targets .file directive forces assembler to put
a provided string to DW_AT_name field as is without
extending to an absolute path. Then GDB cannot find
source files because of it.

The best way to fix this issue is just delete lines
with .file directive in .S files and let the compiler
to decide what DW_AT_name must contain. Particularly,
the compiler fills this filed by an absolute path to
a .S file because only absolute paths are used in
toolchain's build process.

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
5 months agoarc: libc: Add support of 16-entry register file
Claudiu Zissulescu [Tue, 21 May 2024 09:56:45 +0000 (10:56 +0100)]
arc: libc: Add support of 16-entry register file

ARC supports a restricted register file with 16 registers.
However, optimized routines support only a full register
file. Thus, fallback on default implementation in case
of 16-entry register file.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
5 months agoarc: libgloss: Use long calls attribute for exit_halt
Claudiu Zissulescu [Tue, 21 May 2024 09:56:44 +0000 (10:56 +0100)]
arc: libgloss: Use long calls attribute for exit_halt

According to GCC documentation for ARC, a function marked with
the long_call attribute is always called using register-indirect
jump-and-link instructions, thereby enabling the called function
to be placed anywhere within the 32-bit address space.

exit_halt function is provided by crt0.S and it's used
in nsim-syscalls.c. Thus, we want to ensure that a linkage
issue will not arise.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
5 months agopru: Do not define MISSING_SYSCALL_NAMES for pru
Dimitar Dimitrov [Tue, 21 May 2024 17:02:02 +0000 (20:02 +0300)]
pru: Do not define MISSING_SYSCALL_NAMES for pru

- The PRU newlib port is supposed to implement case #2 as described in
  newlib/libc/include/reent.h .  Thus drop the defining of
  MISSING_SYSCALL_NAMES.
- libgloss/configure: Regenerate.
- libgloss/libnosys/acinclude.m4: Do not define
  MISSING_SYSCALL_NAMES for pru.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
5 months agolibgloss: microblaze: fix read and _write declarations
Neal Frager [Mon, 13 May 2024 06:24:19 +0000 (07:24 +0100)]
libgloss: microblaze: fix read and _write declarations

This patch resolves the following build error which occurs with gcc 14.1.0:
../../.././libgloss/microblaze/linux-outbyte.c: In function 'outbyte':
../../.././libgloss/microblaze/linux-outbyte.c:3:9: error: implicit declaration of function '_write' [-Wimplicit-function-declaration]
    3 |         _write(1, &c, 1);

Signed-off-by: Neal Frager <neal.frager@amd.com>
5 months agolibgloss: fix read and write prototype
Marc [Sun, 5 May 2024 19:16:01 +0000 (21:16 +0200)]
libgloss: fix read and write prototype

Use _READ_WRITE_RETURN_TYPE for read/write in libgloss/{read,write}.c to
avoid mismatching types.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
6 months agolibgloss: riscv: Fix envp parameter for main
Bernd Edlinger [Thu, 11 Apr 2024 12:57:11 +0000 (14:57 +0200)]
libgloss: riscv: Fix envp parameter for main

The envp paramter is currently NULL when crt0.S calls main.
With this patch the envp parameter should now be set correctly.
Tested with riscv32 and riscv64: both gdb/sim and qemu do work.

6 months agoCygwin: globify: read full 32 bit character
Corinna Vinschen [Tue, 9 Apr 2024 20:30:03 +0000 (22:30 +0200)]
Cygwin: globify: read full 32 bit character

While commit 0321fb573654 ("Cygwin: glob: convert wchar_t to wint_t")
switched the entire glob mechanism from wchar_t to wint_t, the globify
function calling glob on a DOS command line did not catch up and only
checked for the next character constituting a 16 bit wchar_t. This
broke reading surrogate pairs from incoming DOS command lines if the
string had to go through glob(3).

Check for an entire 32 bit unicode char instead.

Fixes: 0321fb573654 ("Cygwin: glob: convert wchar_t to wint_t")
Reported-by: David Allsopp <david@tarides.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 months agoCygwin: fhandler_virtual::exists: always set fileid
Corinna Vinschen [Tue, 9 Apr 2024 14:52:58 +0000 (16:52 +0200)]
Cygwin: fhandler_virtual::exists: always set fileid

Commit a0a25849f9dd ("Cygwin: fhandler_virtual: move fileid to path_conv
member") broke `ls -l /proc/<PID>'.  Turns out, the commit forgot to set
the fileid in case of a virtual root dir (i. e., returning virt_rootdir)
in fhandlers utilizing fileid.  This crashed opendir() due to a random
fileid.

Make sure to set fileid in any case.

Fixes: a0a25849f9dd ("Cygwin: fhandler_virtual: move fileid to path_conv member")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: fhandler_base::fstat_by_name: improve debug output.
Corinna Vinschen [Thu, 4 Apr 2024 16:20:28 +0000 (18:20 +0200)]
Cygwin: fhandler_base::fstat_by_name: improve debug output.

Since we're opening the parent dir, it doesn't make sense
to print the name of the file in debug output.  Print parent
dirname instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
Corinna Vinschen [Thu, 4 Apr 2024 15:36:01 +0000 (17:36 +0200)]
Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE

If FILE_DIRECTORY_FILE is given, FILE_OPEN_NO_RECALL is not allowed,
otherwise NtCreateFile returns STATUS_INVALID_PARAMETER.

Drop FILE_OPEN_NO_RECALL where FILE_DIRECTORY_FILE is specified.

Fixes: f6b56abec186 ("Cygwin: try to avoid recalling offline files")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoamdgcn: Implement proper locks: Fix 'newlib/libc/sys/amdgcn/include/sys/lock.h' for C++
Thomas Schwinge [Thu, 4 Apr 2024 14:01:35 +0000 (16:01 +0200)]
amdgcn: Implement proper locks: Fix 'newlib/libc/sys/amdgcn/include/sys/lock.h' for C++

As of commit 7dd4eb1db9e1b1b9f14ef5b743705156e5f370e1
"amdgcn: Implement proper locks", we get, by the thousands, for C++ code:

    In file included from [...]/newlib/libc/include/stdio.h:60,
                     from [...]:
    [...]/newlib/libc/include/sys/reent.h:911:1: error: expected declaration before '}' token

7 months agoCygwin: add a fake 3.5.3 release file
Corinna Vinschen [Wed, 3 Apr 2024 17:47:13 +0000 (19:47 +0200)]
Cygwin: add a fake 3.5.3 release file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: fhandler_virtual: move fileid to path_conv member
Corinna Vinschen [Tue, 2 Apr 2024 12:43:27 +0000 (14:43 +0200)]
Cygwin: fhandler_virtual: move fileid to path_conv member

Commit 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main
function") introduced a bug in fhandler_virtual handling.  While the
assertion that path_conv::check() already calls exists() and sets
FILE_ATTRIBUTE_DIRECTORY accordingly, the exists() function is called
on a fhandler_virtual object created for just this code snippet.  The
side effect of this is that the fileid member in the calling
fhandler_virtual object is not set after path_conv::check().

Move the fhandler_virtual::fileid member to path_conv::_virt_fileid
and create matching path_conv::virt_fileid() and fhandler_virtual::fileid()
methods.

Let path_conv::check() propagate the fileid set in the local
fhandler_virtual::exists() call to its own  _virt_fileid.

Use new fhandler_virtual::fileid() method throughout.

Fixes: 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main function")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: //: fetch only one item per loop
Corinna Vinschen [Wed, 27 Mar 2024 20:57:32 +0000 (21:57 +0100)]
Cygwin: //: fetch only one item per loop

Simplify code in that it only fetches a single entry per
IEnumShellItems::Next call.  For some reason this appears to
be quicker most of the time.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoamdgcn: Implement proper locks
Andrew Stubbs [Fri, 22 Mar 2024 14:53:30 +0000 (14:53 +0000)]
amdgcn: Implement proper locks

This should prevent printf output from multiple threads getting garbled.

I don't know why IO ever worked properly -- probably it was always a bit
broken -- but the GFX11 devices have a different cache architecture and
trying to print from many threads at once corrupted the FILE buffers.

7 months agoCygwin: add //tsclient and //wsl$ support to relnotes
Corinna Vinschen [Sun, 24 Mar 2024 19:06:13 +0000 (20:06 +0100)]
Cygwin: add //tsclient and //wsl$ support to relnotes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: // and //server: add support for WSL
Corinna Vinschen [Sun, 24 Mar 2024 19:02:15 +0000 (20:02 +0100)]
Cygwin: // and //server: add support for WSL

Root dirs of WSL installations are exposed via \\wsl$.
Add support to expose \\wsl$.

While at it, check if TERMSRV and P9 provider exist before
exposing them.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: dir_cache::add: constify input string
Corinna Vinschen [Sun, 24 Mar 2024 18:40:36 +0000 (19:40 +0100)]
Cygwin: dir_cache::add: constify input string

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: fhandler_netdrive: use WNNC_NET_SMB instead of WNNC_NET_LANMAN
Corinna Vinschen [Sun, 24 Mar 2024 18:39:49 +0000 (19:39 +0100)]
Cygwin: fhandler_netdrive: use WNNC_NET_SMB instead of WNNC_NET_LANMAN

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: //tsclient: allow to enumerate shares
Corinna Vinschen [Sat, 23 Mar 2024 22:54:26 +0000 (23:54 +0100)]
Cygwin: //tsclient: allow to enumerate shares

The //tsclient provider is WNNC_NET_TERMSRV.

Fixes: 7db1c6fc4e2a ("Cygwin: //server: revert to using WNet and support NFS shares")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: //server: revert to using WNet and support NFS shares
Corinna Vinschen [Sat, 23 Mar 2024 21:32:16 +0000 (22:32 +0100)]
Cygwin: //server: revert to using WNet and support NFS shares

Continue using WSD for enumerating //, but switch back to
WNet for enumerating shares.

Add trying to enumerate NFS shares for machine names given as FQDN.

Only downcase server names, keep case of shares intact.
Move downcasing into dir_cache class.

Add a comment to explain an extrem weirdness in Windows.

Fixes: 205190a80bd0 ("Cygwin: // and //server: switch to Network Discovery")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: //server: check existence of server with getaddrinfo
Corinna Vinschen [Fri, 22 Mar 2024 14:34:29 +0000 (15:34 +0100)]
Cygwin: //server: check existence of server with getaddrinfo

Checking server existence by trying to enumerate its shares
may result in 2 minutes delay until some internal timeout is hit.

In the light that every network is an IP network anyway these
days, let's try with a simple getaddrinfo() call.  This is usually
back in 3 secs even if the server doesn't exist, and it's usually
back in 8 secs if the DNS server can't be connected.  This is the
fastest method I found to check server existence yet.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: utils: refresh tzmap.h
Corinna Vinschen [Thu, 21 Mar 2024 20:43:45 +0000 (21:43 +0100)]
Cygwin: utils: refresh tzmap.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: tzmap-from-unicode.org: drop "E. Europe Standard Time" default
Corinna Vinschen [Thu, 21 Mar 2024 20:43:10 +0000 (21:43 +0100)]
Cygwin: tzmap-from-unicode.org: drop "E. Europe Standard Time" default

E. Europe Standard Time is available in the unicode.org windowsZones.xml
file, so we can drop the default handling.

Fix a few comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: tzset(1): use GetDynamicTimeZoneInformation
Corinna Vinschen [Thu, 21 Mar 2024 20:24:11 +0000 (21:24 +0100)]
Cygwin: tzset(1): use GetDynamicTimeZoneInformation

Use official GetDynamicTimeZoneInformation() function instead of
scanning the registry for the timezone keyname.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: fix tzmap-from-unicode.org
Corinna Vinschen [Thu, 21 Mar 2024 20:22:49 +0000 (21:22 +0100)]
Cygwin: fix tzmap-from-unicode.org

The previous change introduced a missing end of comment

Fixes: 60ea9c1c4b66 ("Cygwin: tzmap-from-unicode.org: drop support for Vista/2008")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: utils: refresh tzmap.h
Corinna Vinschen [Wed, 20 Mar 2024 22:00:02 +0000 (23:00 +0100)]
Cygwin: utils: refresh tzmap.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: tzmap-from-unicode.org: drop support for Vista/2008
Corinna Vinschen [Wed, 20 Mar 2024 21:59:37 +0000 (22:59 +0100)]
Cygwin: tzmap-from-unicode.org: drop support for Vista/2008

Commit b794f2c6038f ("Cygwin: drop support for systems not supporting
RFC 4646 locales") erroneously changed tzmap.h manually.  Change
the script accordingly.

Fixes: b794f2c6038f ("Cygwin: drop support for systems not supporting RFC 4646 locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: readdir: drop support for NT4/Win2K shares and Samba < 3.0.22
Corinna Vinschen [Wed, 20 Mar 2024 16:45:41 +0000 (17:45 +0100)]
Cygwin: readdir: drop support for NT4/Win2K shares and Samba < 3.0.22

These systems are at least 18 years old and so buggy that they are
hopefully not used anymore.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: /proc: fix mem leak in opendir in error case
Corinna Vinschen [Wed, 20 Mar 2024 13:48:55 +0000 (14:48 +0100)]
Cygwin: /proc: fix mem leak in opendir in error case

Fixes: 1f08558f14e45 ("* fhandler.h (fhandler_proc::opendir): Declare.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: // and //server: switch to Network Discovery
Corinna Vinschen [Wed, 20 Mar 2024 13:32:49 +0000 (14:32 +0100)]
Cygwin: // and //server: switch to Network Discovery

SMBv1 is ultimately deprecated since Novemer 2023.  It's also
not installed by default on latest Windows versions.

Drop using the WNet (SMBv1) API in favor of using Network Discovery.
Given there's no documented Win32 API for that, the code now uses
the Shell API.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: opendir(3): move ENOTDIR check into main function
Corinna Vinschen [Wed, 20 Mar 2024 11:34:51 +0000 (12:34 +0100)]
Cygwin: opendir(3): move ENOTDIR check into main function

So far the check for a directory is in the fhandler::opendir
methods. Given that path_conv::check sets FILE_ATTRIBUTE_DIRECTORY
on virtual files either, we can move the check up into the
opendir(3) function. This avoids calling exists() twice when
calling opendir(3).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: (mostly) drop NT4 and Samba < 3.0 support
Corinna Vinschen [Wed, 20 Mar 2024 11:31:12 +0000 (12:31 +0100)]
Cygwin: (mostly) drop NT4 and Samba < 3.0 support

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: dirent.h: fix a comment
Corinna Vinschen [Tue, 19 Mar 2024 22:21:35 +0000 (23:21 +0100)]
Cygwin: dirent.h: fix a comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: readdir(3): stop support for pre-Cygwin 1.5.0 apps
Corinna Vinschen [Tue, 19 Mar 2024 15:22:40 +0000 (16:22 +0100)]
Cygwin: readdir(3): stop support for pre-Cygwin 1.5.0 apps

We're filling dirent::__d_internal1 with the inode number to
support apps built under Cygwin 1.3 and earlier.  This doesn't
make sense anymore.  Drop this to free up __d_internal1 for
other TBD use.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agowinsup/cygwin/fhandler/proc.cc: format_proc_cpuinfo() Linux 6.8 cpuinfo flags
Brian Inglis [Sat, 16 Mar 2024 16:44:00 +0000 (10:44 -0600)]
winsup/cygwin/fhandler/proc.cc: format_proc_cpuinfo() Linux 6.8 cpuinfo flags

add Linux 6.8 cpuinfo flags:
Intel 0x00000007:1 eax:17 fred Flexible Return and Event Delivery;
AMD   0x8000001f   eax:4  sev_snp SEV secure nested paging;
document unused and some unprinted bits that could look like omissions;
fix typos and misalignments;

Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
7 months agoRevert "Cygwin: glob: perform ignore_case_with_glob on input"
Corinna Vinschen [Mon, 18 Mar 2024 09:50:30 +0000 (10:50 +0100)]
Revert "Cygwin: glob: perform ignore_case_with_glob on input"

This reverts commit a51147467e6cf58618433286f93d17043e00b0fc.

Dumb thinko on my part.  What was supposed to be an optimization
actually broke caseinsensitive globbing in that the entire input
of globbed expressions were downcased.

Drop the unused CCHAR() macro nevertheless.

Fixes: a51147467e6cf ("Cygwin: glob: perform ignore_case_with_glob on input")
Reported-by: Michael Goldshteyn <mgold10000@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agolibc/include/sys/select.h: Use elif not elifdef
Joel Sherrill [Wed, 13 Mar 2024 14:29:36 +0000 (09:29 -0500)]
libc/include/sys/select.h: Use elif not elifdef

The cpp directive "elifdef" is only available in very recent GCC versions.
This should be able to compile on older toolchains in C99 mode.`

7 months agoRTEMS: Increase FS_SETSIZE to 256 bits
Chris Johns [Tue, 20 Feb 2024 00:46:05 +0000 (11:46 +1100)]
RTEMS: Increase FS_SETSIZE to 256 bits

7 months agoCygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.
Takashi Yano [Mon, 11 Mar 2024 13:08:00 +0000 (22:08 +0900)]
Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.

If pipe reader is a non-cygwin app first, and cygwin process reads
the same pipe after that, the pipe has been set to bclocking mode
for the cygwin app. However, the commit 9e4d308cd592 assumes the
pipe for cygwin process always is non-blocking mode. With this patch,
the pipe mode is reset to non-blocking when cygwin app is started.

Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255644.html
Fixes: 9e4d308cd592 ("Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT flag for read pipe.")
Reported-by: wh <wh9692@protonmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
7 months agoCygwin: 3.6.0: add release entries for pinned/unpinned flag handling
Corinna Vinschen [Mon, 11 Mar 2024 11:53:50 +0000 (12:53 +0100)]
Cygwin: 3.6.0: add release entries for pinned/unpinned flag handling

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: add 3.5.2 release entries for latest commits
Corinna Vinschen [Mon, 11 Mar 2024 11:53:24 +0000 (12:53 +0100)]
Cygwin: add 3.5.2 release entries for latest commits

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: getgrent: don't skip SAM-only builtin-accounts
Corinna Vinschen [Mon, 11 Mar 2024 11:38:39 +0000 (12:38 +0100)]
Cygwin: getgrent: don't skip SAM-only builtin-accounts

Since commit 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration
on domain member machines") we skip enumerating local BUILTIN accounts
if we also enumerate AD.  However, there are two local accounts which
are only available in local SAM, not in AD.  Don't skip enumerating
those.

Fixes: 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration on domain member machines")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agolibc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IO
Torbjörn SVENSSON [Sat, 9 Mar 2024 08:15:17 +0000 (09:15 +0100)]
libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IO

Regression tested in basepoints/gcc-14-9032-g945cb8490cb with arm-none-eabi.

Example failure without this change:
$ arm-none-eabi-g++ .../pr100611.C -std=c++20 --specs=nosys.specs -o /dev/null --specs=nano.specs
.../ld: .../libc_nano.a(libc_a-svfwprintf.o): in function `_svfwprintf_r':
(.text._svfwprintf_r+0xd8): undefined reference to `__ssputws_r'
.../ld: (.text._svfwprintf_r+0x834): undefined reference to `__ssputws_r'
.../ld: (.text._svfwprintf_r+0x85c): undefined reference to `__ssputws_r'
.../ld: (.text._svfwprintf_r+0x8a8): undefined reference to `__ssputws_r'
.../ld: (.text._svfwprintf_r+0x8dc): undefined reference to `__ssputws_r'
.../ld: .../libc_nano.a(libc_a-svfwprintf.o):(.text._svfwprintf_r+0x900): more undefined references to `__ssputws_r' follow
collect2: error: ld returned 1 exit status

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
7 months agoCygwin: FS_IOC_[GS]ETFLAGS: handle pinned and unpinned attributes
Corinna Vinschen [Fri, 8 Mar 2024 20:54:58 +0000 (21:54 +0100)]
Cygwin: FS_IOC_[GS]ETFLAGS: handle pinned and unpinned attributes

Add FS_PINNED_FL and FS_UNPINNED_FL flags and handle them with
mode bits 'p' and 'u' in chattr(1) and lsattr(1).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: get/set security descriptors using FILE_OPEN_NO_RECALL
Corinna Vinschen [Fri, 8 Mar 2024 20:30:57 +0000 (21:30 +0100)]
Cygwin: get/set security descriptors using FILE_OPEN_NO_RECALL

Add FILE_OPEN_NO_RECALL to NtOpenFile calls trying to fetch
or write file security descriptors so as not to recall them
from offline storage inadvertently.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 months agoCygwin: try to avoid recalling offline files
Corinna Vinschen [Fri, 8 Mar 2024 19:57:06 +0000 (20:57 +0100)]
Cygwin: try to avoid recalling offline files

Chances are high that Cygwin recalls offline files from remote
storage, even if the file is only accessed during stat(2) or
readdir(3).

To avoid this
- make sure Cygwin is placeholder-aware,
- open files in path_conv handling, as well as in stat(2)/readdir(3)
  scenarios with FILE_OPEN_NO_RECALL, and
- during symlink checking or testing for executablility, don't even
  try to open the file if one of the OFFLINE attributes is set.

Reported-by: Marcin Wisnicki <mwisnicki@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.073032 seconds and 5 git commands to generate.