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>
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>
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>
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.
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")
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>
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>
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>
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.
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
Rather than converting single chars on the fly to lowercase
in case ignore_case_with_glob is set, perform the conversion
on the entire input (pattern and filenames).
g_Ctoc, converting the UTF-32 filenames to multibyte, still
used UTF-16 to multibyte conversion. Introduce a wirtomb
helper and fix that.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Allow the [.<sym>.] expression
This requires a string comparision rather than a character
comparison. Introduce and use __wscollate_range_cmp.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
uint_fast64_t doesn't allow easy string handling, so convert
the internal "Char" type to wint_t. Given that UTF-32 only
needs 21 bits, we're well off with 28 usable character bits.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
lc_collelem.h: autogenerated table of collating element, taken
from glibc
is_unicode_coll_elem: Check if a UTF-32 string is a collating element
next_unicode_char: return length of prefix from a string constituting
a complete character in the current locale, taking
collating elements into acocunt.
wcintowcs: convert UTF-16 to UTF-32 string
wcilen: return number of characters in a UTF-32 string
wcincmp: compare two fixed-size UTF-32 strings
Used in followup patches introducing collating symbols
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>