aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/libc
AgeCommit message (Collapse)AuthorFilesLines
2024-02-21Cygwin: strptime: fix am/pm handlingCorinna Vinschen1-3/+9
The %p format specifier is handled immediately. It requires that tm_hour is already set. This falls flat in case the am/pm marker preceeds the time specification. Locales with am/pm marker preceeding time spec by default exist (e. g. ko_KR). Also, the code expects that tm_hour might be set to an invalid value because the %p specifier is used in conjunction with %H. But this usage is invalid in itself and now catched as error condition after commit 343a2a558153 ("Cygwin: strptime: make sure to fail on invalid input digits"). Change the %H/%I/%p handling according to GLibC, i. e. - fix tm_hour for pm only if the time value has been specified as 12 hour time %I, and - perform the fixup only after the entire input has been scanned. This decouples the fixup from the %p position relativ to %I. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-21Cygwin: strptime: make sure to fail on invalid input digitsCorinna Vinschen1-3/+12
conv_num returns NULL if the input is invalid, e. g., the numbers are out of range. However, the code fails to test this in a lot of places. Rather than adding checks all over the place, rename conv_num to __conv_num and create a wrapper macro conv_num to perform the task of error checking. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: implement setproctitlegithub/topic/3.6topic/3.6Corinna Vinschen1-0/+34
Make sure to create commandline according to setting of setproctitle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-27Cygwin: fnmatch: fix range comparison in C localeCorinna Vinschen1-1/+1
Commit c36064bbd0c5 introduced operating on character pointers instead of operating on characters, to allow collating symbols. This patch neglected to change the expression for range comparison in case we're in the C locale. Thus it suddenly compared pointers instead of characters. Fix that. Fixes: c36064bbd0c5 ("Cygwin: fnmatch: support collating symbols in [. .] brackets") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-01Cygwin: fnmatch: support collating symbols in [. .] bracketsCorinna Vinschen1-130/+158
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-02-28Cygwin: fnmatch: drop static variableCorinna Vinschen1-11/+2
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-24Cygwin: convert Windows locale handling from LCID to ISO5646 stringsCorinna Vinschen1-1/+1
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-19Cygwin: convert __collate_range_cmp to __wcollate_range_cmpCorinna Vinschen1-8/+4
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=179721 After FreeBSD eventually picked up the bugreport from within only 5 years, rename __collate_range_cmp to __wcollate_range_cmp as suggested all along, and make it type safe (wint_t instead of wchar_t for hopefully obvious reasons...) While at it, drop __collate_load_error and fix the checks for it in glob and fnmatch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15Cygwin: fnmatch: handle equivalence class expressionsCorinna Vinschen1-2/+11
Handle [=x=] expressions in range brackets. Use the new is_unicode_equiv() function to perform the check. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14Cygwin: fnmatch: handle named character classesCorinna Vinschen1-0/+23
Handle [:<character-class>:] expressions in range brackets. TODO: Collating symbols [.<collsym>'.] and Equivalence class expressions [=<equiv-class>=] are recognized but skipped as if they are not present at all. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14Cygwin: fnmatch: convert wchar_t to wint_tCorinna Vinschen1-11/+11
...thus handling all Unicode values sanely. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-24strptime.cc(__strptime): add %q GNU quarterBrian Inglis1-1/+9
2022-08-05Cygwin: Reorganize cygwin source dirCorinna Vinschen1-4/+0
Create subdirs and move files accordingly: - DevDocs: doc files - fhandler: fhandler sources, split fhandler.cc into base.cc and null.cc - local_includes: local include files - scripts: scripts called during build - sec: security sources Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-29Cygwin: simplify some function namesKen Brown4-20/+10
Remove "32" or "64" from each of the following names: acl32, aclcheck32, aclfrommode32, aclfrompbits32, aclfromtext32, aclsort32, acltomode32, acltopbits32, acltotext32, facl32, fchown32, fcntl64, fstat64, _fstat64, _fstat64_r, ftruncate64, getgid32, getgrent32, getgrgid32, getgrnam32, getgroups32, getpwuid32, getpwuid_r32, getuid32, getuid32, initgroups32, lseek64, lstat64, mknod32, mmap64, setegid32, seteuid32, setgid32, setgroups32, setregid32, setreuid32, setuid32, stat64, _stat64_r, truncate64. Remove prototypes and macro definitions of these names. Remove "#ifndef __INSIDE_CYGWIN__" from some headers so that the new names will be available when compiling Cygwin. Remove aliases that are no longer needed. Include <unistd.h> in fhandler_clipboard.cc for the declarations of geteuid and getegid.
2022-01-19Cygwin: resolver: cygwin_query() skip response header on internal errorAnton Lavrentiev via Cygwin-patches1-1/+2
- When dn_comp() failed internally there is no longer any need to fill the response header since it's now all cleared upon entry
2022-01-19Cygwin: resolver: A few fixes for cygwin_query(), part 2Anton Lavrentiev via Cygwin-patches1-4/+5
Make sure Windows ResultSet is free'd when dn_comp failed internally
2022-01-19Cygwin: resolver: Targets in SRV DNS responses may not be compressedAnton Lavrentiev via Cygwin-patches1-0/+1
RFC2782 clearly says so yet it's a common misconception to perform the compression in the violation of the standard. This patch fixes that
2022-01-19Cygwin: resolver: Fix to match response ID with request IDAnton Lavrentiev via Cygwin-patches2-2/+11
In case when the native OS resolver is used (via os_query) the returned response ID is always 0. It should actually match the ID passed in to res_send() in the DNS request header. This patch fixes that
2022-01-19Cygwin: resolver: A few fixes for cygwin_query()Anton Lavrentiev via Cygwin-patches1-8/+13
- Make sure the answer buffer is properly cleared so there is no trailing garbage when the response does not fit entirely in; - Make sure an internal decomp failure gets reported correctly (w/return code -1); - Make sure that the buffer is not overrun when filling out the header.
2022-01-19Cygwin: resolver: Process options forward (not backwards)Anton Lavrentiev via Cygwin-patches1-4/+6
Also, make sure the debug setting propagates to the parser of the remainder of /etc/resolv.conf
2022-01-18Cygwin: resolver: Added processing of AAAA recordsAnton Lavrentiev via Cygwin-patches1-8/+7
AAAA records returned from Windows resolver were flagged as "No structure" in debug output because of being processed (although correctly) in the default catch-all case. This patch makes the AAAA records properly recognized.
2022-01-18Cygwin: resolver: A little more consistency in debug messagesAnton Lavrentiev via Cygwin-patches1-7/+7
2022-01-18Cygwin: resolver: Format spec consistency for Windows errorsAnton Lavrentiev via Cygwin-patches1-4/+4
2022-01-18Cygwin: resolver: Debug to output both IP and port # in native b.o.Anton Lavrentiev via Cygwin-patches1-14/+22
Also, change a few other debug output spots for consistency
2022-01-17Use matching format for NTSTATUSAnton Lavrentiev via Cygwin-patches1-2/+2
2022-01-17Fix format specifier for wide-char stringAnton Lavrentiev via Cygwin-patches1-1/+1
2020-09-01Cygwin: mtx_init: drop glibc workaroundCorinna Vinschen1-7/+0
GLibc will change this code in the forseeable future to align more with FreeBSD, so this hack is not actually desired. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-08-30Cygwin: Add C11 threads APICorinna Vinschen5-0/+494
Code taken from FreeBSD, which implements C11 threads as wrapper around pthreads. Fix up machine/_threads.h which is called from newlib's machine-independent threads.h to match Cygwin's pthreads types. Add the FreeBSD source files to libc subdir and take opportunity to define LIBC_OFILES var in Makefile. Add new symbols to common.din and sort symbols. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-08-05Cygwin: Add 'fallthrough' pseudo keyword for switch/case useCorinna Vinschen7-8/+9
This patch has been inspired by the Linux kernel patch 294f69e662d1 compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use written by Joe Perches <joe AT perches DOT com> based on an idea from Dan Carpenter <dan DOT carpenter AT oracle DOT com>. The following text is from the original log message: Reserve the pseudo keyword 'fallthrough' for the ability to convert the various case block /* fallthrough */ style comments to appear to be an actual reserved word with the same gcc case block missing fallthrough warning capability. All switch/case blocks now should end in one of: break; fallthrough; goto <label>; return [expression]; continue; In C mode, GCC supports the __fallthrough__ attribute since 7.1, the same time the warning and the comment parsing were introduced. Cygwin-only: add an explicit -Wimplicit-fallthrough=5 to the build flags.
2020-03-11Cygwin: fix formatting: drop trailing whitespaceCorinna Vinschen2-3/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11Cygwin: fix formatting: collapse whitespace-only linesCorinna Vinschen1-3/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11Cygwin: fix formatting: drop spaces leading tabsCorinna Vinschen5-11/+11
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-01-19cygwin: add catopen, catgets, catcloseYaakov Selkowitz1-0/+478
The implementation is taken from FreeBSD with #ifdef __CYGWIN__ modifications. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _CONSTYaakov Selkowitz1-1/+1
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-08-29winsup/cygwin/libc/strptime.cc(__strptime) fix %F widthBrian Inglis1-2/+4
2017-08-25winsup/cygwin/libc/strptime.cc(__strptime) add %s support to strptimeBrian Inglis1-0/+20
2017-03-11getrandom: it's MIN, not MAXYaakov Selkowitz1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-01-19Move getentropy/getrandom into own fileCorinna Vinschen1-0/+70
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24login_tty: Rewrite following FreeBSD's tracesCorinna Vinschen1-15/+8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-24Include winsup.h prior to including other headersCorinna Vinschen1-2/+5
Otherwise _GNU_SOURCE is not set when needed in sys/features.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23Implement GNU extension strptime_lCorinna Vinschen1-27/+47
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20Only define __getreent inline function when building newlib or CygwinCorinna Vinschen1-0/+1
Commit 6f3943b erroneously removed the `#ifdef _COMPILING_NEWLIB' guarding the __getreent inline function. This patch ignored the fact that config.h is included when building applications, and the code in question requires internal, auto-generated headers to be available which are not exposed to user-space. Reinstantiate defined(_COMPILING_NEWLIB) test and alternatively check for defined (__INSIDE_CYGWIN__), otherwise we'd have to reinstantiate the __getreent macro in cygtls.h which is really confusing. While testing it turned out that a low number of source codes inside Cygwin won't see the inline __getreent due to a missing __INSIDE_CYGWIN__ definition. For malloc.cc this was actually deliberate to get different definitions from including cygmalloc.h. Change this by defining __INSIDE_CYGWIN__ in malloc.cc but changing the test in cygmalloc.h to test for defined(DLMALLOC_VERSION). This might need a change if we ever get around to replace dlmalloc with a newer, more threading-aware malloc implementation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15Implement strfmon_lCorinna Vinschen1-35/+62
Use latest code from FreeBSD Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15POSIX-1.2008 per-thread locales, groundwork part 2Corinna Vinschen1-2/+3
Move all locale category structure definitions into setlocale.h and remove other headers in locale subdir. Create inline accessor functions for current category struct pointers and use throughout. Use pointers to "C" locale category structs by default in __global_locale. Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen5-10/+0
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-24Throughout Cygwin, use u_intN_t or uintN_tCorinna Vinschen8-33/+38
Don't use u_char, u_short, u_int or u_long in Cygwin, unless it refers to the Winsock types. Use u_intN_t in BSD-based sources, unsigned char where strings are concerned, uintN_t otherwise. Also: * net.cc: Fix comment, we're not using u_long anymore. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-24Change definition of b64_pton from K&R to ANSICorinna Vinschen1-4/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-23Use DnsFree instead of deprecated DnsRecordListFreePeter Foley1-1/+1
The latest version of the mingw headers have been updated to make DnsRecordListFree an alias of DnsFree when targeting Windows XP or later. Use DnsFree directly, avoiding the wrapper function. /home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289: undefined reference to `DnsFree' winsup/cygwin/ChangeLog autoload.cc: Load DnsFree rather then DnsRecordListFree libc/minires-os-if.cc (cygwin_query): Use DnsFree rather then DnsRecordListFree Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-21Move arc4random Cygwin only code to CygwinSebastian Huber1-0/+24
Keep the Newlib arc4random.c identical to the OpenBSD upstream version. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>.
2016-03-18Delete Cygwin's arc4random in favor of new Newlib implementationCorinna Vinschen1-363/+0
* Makefile.in (DLL_OFILES): Remove arc4random.o. * libc/arc4random.c: Remove file. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>