Commit Graph

21345 Commits

Author SHA1 Message Date
Corinna Vinschen 5da71b6059 Cygwin: add support for GB18030 codeset
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 18:25:09 +01:00
Corinna Vinschen 2285cf0d1c Cygwin: regex: NONCHAR: re-add cast to int
wint_t is unsigned int and the test checks for a negative value.  Thus,
it's optimized out by gcc.  Add the cast from commit 44caccfca2 to
avoid this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 13:47:10 +01:00
Corinna Vinschen 0bdc764b42 Cygwin: regex: wgetnext: Re-add kludge to be more glibc compatible
Add comment to explain.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 13:46:01 +01:00
Corinna Vinschen 585e7f9891 Cygwin: regex: convert wchar_t to wint_t throughout
...and use __wcollate_range_cmp.  This will have to be tweaked further
when supporting collation symbols...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 13:45:37 +01:00
Corinna Vinschen 988c304ec2 Cygwin: regex: fix build errors
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 12:50:08 +01:00
Corinna Vinschen 24f34edc2a Cygwin: replace regex with latest verbatim FreeBSD version
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16 11:12:08 +01:00
Corinna Vinschen 2a4dd6a239 Cygwin: kill(1): Add -L to documentation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-15 22:08:04 +01:00
Corinna Vinschen 915c6eb026 Cygwin: kill(1): Align list options to latest Linux kill(1)
- Don't print all RT signals, just the allowed patterns
- Add -L/--table option to print a table of signals with signal
  numbers

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-15 22:08:04 +01:00
Corinna Vinschen 3dfb3217af Cygwin: kill(1): align real-time signal naming to Linux kill(1)
Allow RT<N>, RTMIN+<N> and RTMAX-<N> for RT signals.
Translate RT signal numbers to an "RT<N>" string.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-15 22:08:04 +01:00
Corinna Vinschen 3569e3577c Cygwin: kill(1): don't print spurious error message
Make kill -V and kill -l exit immediately, thus stopping to
print "not enough arguments" accidentally.

Fixes: ef48a2cad3 ("* kill.cc (prog_name) New global variable.")
Fixes: c49fa76263 ("* Makefile.in (kill.exe): Add as a specific target.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-15 22:08:04 +01:00
Corinna Vinschen 07b5d3726f Cygwin: signals: drop accidental spaces from real-time signal names
The signal names for the real-time signals contain spaces from
the beginning of their availability.  Fix that.

Fixes: 61522196c7 ("* Merge in cygwin-64bit-branch.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-15 21:44:52 +01:00
Jon Turney c553a95243
Cygwin: doc: Update postinstall/preremove scripts
setup >=2.925 indicates to postinstall and preremove scripts the Start
Menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var.

It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option
to disable Start Menu shortcut creation is supplied.

Update the Cygwin documentation postinstall and preremove scripts to
take these env vars into consideration.
2023-03-14 14:14:01 +00:00
Mark Geisert dfd14093e3 Cygwin: Fix type mismatch on sys/cpuset.h
Addresses https://cygwin.com/pipermail/cygwin/2023-March/253220.html

Take the opportunity to follow FreeBSD's and Linux's lead in recasting
macro inline code as calls to static inline functions.  This allows the
macros to be type-safe.  In addition, added a lower bound check to the
functions that use a cpu number to avoid a potential buffer underrun on
a bad argument.  h/t to Corinna for the advice on recasting.

Fixes: 362b98b49a ("Cygwin: Implement CPU_SET(3) macros")
2023-03-14 11:26:13 +01:00
Sebastian Huber 59de816715 libgloss/epiphany: Fix move instruction in crt0.S
This patch relates to bug report:

https://sourceware.org/bugzilla/show_bug.cgi?id=30212
2023-03-08 14:27:52 -05:00
Takashi Yano 93f70d7849 Cygwin: ctty: Remove old 'kludge' code.
Remove old 'kludge' code which does not seem necessary anymore. The
comment of the 'kludge' is as follows.

  * syscalls.cc (setsid): On second thought, in the spirit of keeping
    things kludgy, set ctty to -2 here as a special flag, and...
    (open): ...only eschew setting O_NOCTTY when that case is detected.

Fixes: c38a2d8373
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-03-07 10:51:44 +09:00
Takashi Yano 13a84ac79b Cygwin: ctty: Replace ctty constant with more descriptive macros.
This patch replaces ctty constants with more descriptive macros
(CTTY_UNINITIALIZED and CTTY_RELEASED) rather than -1 and -2 as
well as checking sign with CTTY_IS_VALID().

Fixes: 3b7df69aaa (Cygwin: ctty: Add comments for the special values: -1 and -2.)
Suggested-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-03-07 10:51:29 +09:00
Takashi Yano ce979464f3 Cygwin: console: Suppress unnecessary open_shared_console() calls.
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-03-07 10:50:59 +09:00
Takashi Yano 523985b31e Cygwin: ctty: Add missing fixup_after_{exec,fork}() call.
Previously, fixup_after_{exec,fork}() calls for CTTY were missing.
This patch fixes that.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-03-07 10:14:25 +09:00
Corinna Vinschen 5ca1c57a82 Cygwin: is_unicode_equiv: fix comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-03 18:19:18 +01:00
Corinna Vinschen 6bc687e35d Cygwin: glob: fix conversion from UTF-32 to multibyte
The conversion function g_Ctoc missed to drop the flag
values from the wint_t value.  That wasn't noticable with
the original version because it used a 64 bit Char type
and the flags were in the upper 32 bit region.  So the
flag values were silently dropped when wcrtomb was called.
After converting Char to wint_t, we have to do drop the
flags explicitely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-03 18:19:17 +01:00
Srinath Parvathaneni 1d3d2ba54b arm: Restrict processor mode change when in hypervisor mode
If a CPU implements EL2 as its highest exception level then programs
using newlib may start in hypervisor mode.  In that state it is not
trivial to switch into the various EL1 modes to configure the
individual exception stacks, so do not try.
2023-03-03 13:27:31 +00:00
Srinath Parvathaneni b782dcb2b3 arm: Fix the SP used in setting stack limit for standalone application.
Move the instruction that saves SP before the mode check so that
applications that start in USER mode correctly set the stack limit.
2023-03-03 13:20:29 +00:00
Corinna Vinschen 68db1fa7ba Cygwin: define CHARCLASS_NAME_MAX
CHARCLASS_NAME_MAX isn't defined yet, accidentally.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 21:22:56 +01:00
Corinna Vinschen c0aba3141b Cygwin: add collating symbols support to release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 11:49:52 +01:00
Corinna Vinschen c36064bbd0 Cygwin: fnmatch: support collating symbols in [. .] brackets
This requires quite a few changes in how fnmatch operates.
It always operates on wint_t strings now, just like regex and glob,
and it always keeps a pointer on the character inside the string,
rather than operating on a single character.

As a result, just drop the ifdef's for Cygwin.  The code is
non-portable now anyway...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 10:54:52 +01:00
Corinna Vinschen 149cabea82 Cygwin: mbsnrtowci: like mbsnrtowcs, just for wint_t
Deviation from standard: If the input is broken, the output will be
broken.  I. e., we just copy the current byte over into the wint_t
destination and try to pick up on the next byte.  This is in line
with the way fnmatch works.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 10:54:52 +01:00
Corinna Vinschen 9870f1d1ff Cygwin: wcichr: add wint_t replacement for wcschr
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 10:54:52 +01:00
Corinna Vinschen b81969345d Cygwin: add wcipcpy and wcipncpy helper functions
wint_t replacements for wcpcpy and wcpncpy

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 10:54:52 +01:00
Corinna Vinschen 77883ac914 Cygwin: wcitoascii: move to wchar.h as inline function
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01 10:54:52 +01:00
Corinna Vinschen 0d2ad77c40 Cygwin: fnmatch: drop static variable
fnmatch calls fnmatch1 with a static mbstate_t.  This breaks
calling fnmatch from multiple threads.  Fix it by folding
fnmatch1 into fnmatch and moving all mbstates to local variables.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-28 16:45:52 +01:00
Corinna Vinschen 6e75277b12 Cygwin: __wscollate_range_cmp: fix incorrect comment
The comment that the first arg must be the pattern was added
during development, before it turned out that __wscollate_range_cmp
can be implemented in an order independent way.

Better explain why this function uses pointers to strings.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-28 12:24:29 +01:00
Henrik Nilsson via Newlib c8397ae817 nano-mallocr: Prevent NULL pointer de-reference in free_list
The existing code checked if there was a chunk in free_list and
that the tail was not the next chunk.

The check if there is a chunk is not needed since it's already
known but the case of a single chunk in free_list needs to be
handled differently.
2023-02-27 10:54:26 +01:00
Corinna Vinschen 5011c8cc48 Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling
As the former call to `locale -av' has the unwanted side effect
to shorten the locale name to <= 15 chars, don't use it.  Use
`locale -a' instead and fetch the codeset from another call to
`locale' for each locale.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-26 20:14:54 +01:00
Corinna Vinschen abd81bc01f Cygwin: locale: fix devanagari modifier
Effectively revert commit 57bac33359.  The fact that the
devanagari modifier was called devanagar (missing the trailing 'i')
is a result of `locale -av' shortening the locale name to a maximum
of 15 characters.

D'oh.  I guess we need a better way to do this...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-26 17:17:33 +01:00
Corinna Vinschen c42b98bdc6 Cygwin: introduce /proc/codesets and /proc/locales
So far locale(1) had to have knowledge how to construct, thus
duplicating the effort how Cygwin handles locale strings.

Move locale list and codeset list generation into Cygwin by
providing /proc/codesets and /proc/locales files.  /proc/locales
does not list aliases, those are still handled in locale(1).

locale(1) opens the files and ueses that info for printing,
like any other application can do now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-26 17:07:06 +01:00
Corinna Vinschen a31d4039d0 Cygwin: fetch-lc-def-codesets-from-linux: speed up
Drop shell read loop in favor of performing the locale output
evaluation inside a single awk invocation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 20:15:53 +01:00
Corinna Vinschen 6e6111671a Cygwin: locale(1): redefine rule for adding a @euro locale
The @euro locale is only useful, if the locale uses the EUR currency
and the codeset of the base locale is ISO-8859-1, or the locale is
el_GR.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 19:43:08 +01:00
Corinna Vinschen 2483e54be8 Cygwin: locale: Set default charset from Linux locale -> codeset mapping
Generate lc_def_codeset.h header containing the default mapping from
locale to codeset on Linux.  Use this mapping in __set_charset_from_locale
in the first place.

For every locale not covered by this table, just map Windows codepages
to equivalent codesets used on Linux/Unix, getting rid of LCIDs entirely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Corinna Vinschen 7b591704b8 Cygwin: locale: new script creating linux default codeset mapping
New script creating a mapping table from locale to default codeset
for this locale.  We use that in Cygwin now to generate the own
default codeset mapping based on Linux locale names.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Corinna Vinschen 57bac33359 Cygwin: locale: fix devanagar modifier
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Corinna Vinschen f20aee9091 ctype_cp.h/ctype_iso.h: clean whitespace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Corinna Vinschen 2b052b3c50 Cygwin: fully support KOI8-T codeset
Commit 89eb4bce15 was pretty half-hearted, missing
the codepage character type tables and wctomb/mbtowc
mappings.

Fixes: 89eb4bce15 ("Cygwin: support KOI8-T codeset")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Corinna Vinschen 98aed7943e Cygwin: locale(1): fix typo
Windows locales need a dash instead of an underscore.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-25 16:12:51 +01:00
Takashi Yano 0ab22f0af9 Cygwin: dsp: Fix SNDCTL_DSP_{POST,SYNC} ioctl() behaviour.
Previously, SNDCTL_DSP_POST and SNDCTL_DSP_SYNC were implemented
wrongly. Due to this issue, module-oss of pulseaudio generates
choppy sound when SNDCTL_DSP_POST is called. This patch fixes that.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-02-25 10:28:34 +09:00
Corinna Vinschen e95a7a7955 Cygwin: convert Windows locale handling from LCID to ISO5646 strings
Since Windows Vista, locale handling is converted from using numeric
locale identifiers (LCID) to using ISO5646 locale strings.  In the
meantime Windows introduced new locales which don't even have a LCID
attached.  Those were unusable in Cygwin because locale information
for these locales required to call the new locale functions taking
a locale string.

Convert Cygwin to drop LCIDs and use Windows ISO5646 locales instead.

The last place using LCIDs is the __set_charset_from_locale function.
Checking numerically is easier and uslay faster than checking strings.
However, this function is clearly a TODO
2023-02-24 16:40:58 +01:00
Corinna Vinschen 89eb4bce15 Cygwin: support KOI8-T codeset
Used on Linux as default codeset for Tajik. There's no matching
Windows codepage, so fake it as CP103.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-24 16:40:58 +01:00
Corinna Vinschen ac405ab9bc Cygwin: locale(1): drop using LCID, use Windows locale names
LCIDs are deprecated since Windows Vista.  Worse, lots of new locales
have been added in the meantime which have no LCID attached.  They
are only available by locale name.

As first step, rearrange the locale(1) tool to use Windows locale
names, rather than LCIDs, so we can now enumerate *all* locales
available in more recent Windows versions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-24 16:40:58 +01:00
Jeff Johnston 17ac400c11 Fix libgloss/newlib build to conditionally use top include dir
- conditionally use -idirafter option for arm
2023-02-22 14:53:05 -05:00
Hau Hsu 97d483c2f8 RISC-V: Use the new libm code if possible
Set  __OBSOLETE_MATH_DEFAULT to 0 if 'd' extension is supported (i.e.
__riscv_flen == 64).

Base on the comment for  __OBSOLETE_MATH_DEFAULT:

> ... it assumes that the toolchain has ISO C99 support (hexfloat
> literals, standard fenv semantics), the target has IEEE-754 conforming
> binary32 float and binary64 double (not mixed endian) representation,
> standard SNaN representation, double and single precision arithmetics
> has similar latency and it has no legacy SVID matherr support, only
> POSIX errno and fenv exception based error handling.

Signed-off-by: Hau Hsu <hau.hsu@sifive.com>
2023-02-22 12:20:57 +01:00
Corinna Vinschen 2229f42400 Cygwin: __wscollate_range_cmp: workaround wcscoll's case-insensitivity
Most locales using latin characters ignore case while sorting.
This is what wcscoll does (correctly so).  However, there's an
internal order of collating sequences compared to the base
character, which is case-sensitive, at least in GLibc.

There's no way to express this in Windows, because CompareString
and LCMapString *always* use case-insensitivity in those locales,
even if none of the *IGNORECASE sorting flags are used.

We want to follow glibc's behaviour more closely, so we add an
extra check for the case and make sure upper and lower cased
letters don't comapre as identical.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-22 12:20:32 +01:00