aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-02-13Cygwin: pty: Fix potential handle leak regarding CallNamedPipe().Takashi Yano1-2/+18
In pty master_thread, 6 handles are duplicated when CallNamedPipe() requests that. Though some of them are not used so should be closed, they were not. This causes handle leak potentially. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-02-13Cygwin: pty: Fix handle leak in master process.Takashi Yano2-0/+5
If non-cygwin process is started in pty, closing from_master_nat pipe handle was missing in fhandler_pty_slave::input_transfer(). This occured because the handle was duplicated but not closed. https://github.com/msys2/msys2-runtime/issues/198 Fixes: 29431fcb5b14 ("Cygwin: pty: Inherit typeahead data between two input pipes.") Reported-by: Hakkin Lain Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-02-12include/ansidecl.h: import from binutils-gdbCorinna Vinschen1-52/+77
Import include/ansidecl.h version from 2024-01-04, binutils-gdb commit fd67aa1129fd. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-12Cygwin: dumper: use void* in place of PTRCorinna Vinschen1-1/+1
The definition of PTR has been dropped from newer versions of ansidecl.h. Convert definition of print_section_name to use void * instead, as required by bfd_map_over_sections. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-05getlocalename_l: fix _reent for _REENT_SMALL targetsCorinna Vinschen1-1/+6
The new _MB_CAPABALE-only _misc_reent member getlocalename_l_buf was incorrectly initialized in the _REENT_INIT_MISC macro, so the build failed for _REENT_SMALL targets, independet of the _MB_CAPABALE setting. Fixes: 71511d4ac868 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-03Cygwin: fix typo in winjitdebug descriptionCorinna Vinschen1-5/+5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-03Cygwin: document new winjitdebug optionCorinna Vinschen2-2/+18
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-03Cygwin: reorder list of CYGWIN env var options alphabetically againCorinna Vinschen1-2/+2
This has been turned upside down for a short while. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-03Cygwin: Do not show Error dialogs by defaultJohannes Schindelin3-1/+3
...in a non-Cygwin child process. Backported from MSYS2. Downstream commit message follows. In https://github.com/msys2/msys2-runtime/pull/18, we discussed a change that would allow default Windows error handling of spawned processes to kick in (such as registered JIT debuggers). We even agreed that it would make sense to hide this functionality behind a flag, `winjitdebug`. However, when this got upstreamed as 21ec498d7f (cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn, 2020-12-09), that flag was deemed unnecessary. But it would appear that it _is_ necessary: As reported in https://github.com/msys2/MSYS2-packages/pull/2414#issuecomment-810841296 this new behavior is pretty disruptive e.g. in CI scenarios. So let's introduce that `winjitdebug` flag (settable via the environment variable `MSYS`) at long last. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-03Cygwin: net: Make if_nametoindex, etc. consistent with if_nameindex.Takashi Yano3-4/+32
Currently, if_nametoindex() and if_indextoname() handle interface names such as "ethernet_32777", while if_nameindex() returns the names such as "{5AF7ACD0-D52E-4DFC-A4D0-54D3E6D6B2AC}". This patch unifies the interface names to the latter. Fixes: c356901f0d69 ("Rename if_indextoname to cygwin_if_indextoname (analag for if_nametoindex)") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-02-03Cygwin: Document recent bug fix in release note.Takashi Yano1-0/+5
2024-02-03Cygwin: console: Avoid slipping past disable_master_thread check.Takashi Yano1-2/+6
If disable_master_thread flag is set between the code checking that flag not be set and the code acquiring input_mutex, input record is processed once after setting disable_master_thread flag. This patch prevents that. Fixes: d4aacd50e6cf ("Cygwin: console: Add missing input_mutex guard.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-02-02Cygwin: console: Fix exit code for non-cygwin process.Takashi Yano1-3/+3
If non-cygwin process is executed in console, the exit code is not set correctly. This is because the stub process for non-cygwin app crashes in fhandler_console::set_disable_master_thread() due to NULL pointer dereference. This bug was introduced by the commit: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals."), that the pointer cons is accessed before fixing when it is NULL. This patch fixes the issue. Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-02-01Cygwin: ps: avoid long lines on ttyCorinna Vinschen1-22/+55
If stdout is a tty, restrict line output to tty width. Also, rename a weird buffer name.
2024-02-01Cygwin: ps: make sure later format flags override earlier format flagsCorinna Vinschen1-0/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-01Cygwin: CW_CMDLINE_ALLOC: fix a pontentially undefined return valueCorinna Vinschen1-1/+1
cmdline has to be initialized, otherwise the return value is undefined in case generating the command line fails. Fixes: 732afede9358 ("Cygwin: redefine CW_CMDLINE to CW_CMDLINE_ALLOC") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-02-01Cygwin: document showing command line on ps -fCorinna Vinschen2-3/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: implement setproctitletopic/3.6Corinna Vinschen7-20/+67
Make sure to create commandline according to setting of setproctitle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: commune_process: don't use IsBadStringPtrCorinna Vinschen1-4/+1
IsBadStringPtr is deprecated and just gives a wrong sense of memory safety. Replace with check for NULL pointer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: globals: make __progname an alias of program_invocation_short_nameCorinna Vinschen5-19/+22
On Linux, __progname and program_invocation_short_name are just different exported names of the same string. Do the same in Cygwin. This requires to tweak the mkglobals_h so as not to touch the EXPORT_ALIAS expression. Also, use the base variable program_invocation_short_name throughout. __progname is just the export for getopt. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: cygwin_GetCommandLineW/A: don't rely on __argv[0] contentCorinna Vinschen1-2/+5
Since it's possible to change the __argv array, we should not rely on __argv[0] actually representing the windows executable path in any way. Use the real path stored in global_progname instead. Fixes: 521953a83a885 ("* common.din: Export GetCommandLine{A,W}.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: ps -f: output command lineCorinna Vinschen2-2/+18
So far ps(1) always prints the full path of the executable under the COMMAND heading. With -f, print the command line instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: redefine CW_CMDLINE to CW_CMDLINE_ALLOCCorinna Vinschen2-4/+41
Make sure to - append a trailing \0 as with Windows multistrings, so the end of the string can be recognized by the caller, and - allocate cmdline on the user heap so the caller can free the multistring after usage. Fixes: 831d6fa520ed4 ("* external.cc (cygwin_internal): Implement CW_CMDLINE.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: pinfo: use stpcpy where appropriateCorinna Vinschen1-9/+3
...rather than strcpy/strchr. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31sys/stat.h: drop __INSIDE_CYGWIN__ guardsCorinna Vinschen2-6/+2
These were only necessary until we dropped 32 bit Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: posix_getdents: implement per SUS Base Specifications Issue 8 draftCorinna Vinschen9-8/+131
- Basically maintain a hidden DIR* inside fhandlers. - lseek has to be tweaked to allow basic seeking on the directory descriptor. - the current implementation does not keep the dir positions between duplicated descriptor in sync. In fact, every descriptor keeps its own copy of the DIR* and after dup/fork/exec, the directory position is reset to 0, i. e., to the start of the directory, as if rewinddir() has been called on the new descriptors. While this behaviour isn't yet covered by the Issue 8 draft, a bug report along these lines exists and will probably be picked up for TC1. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: devices.h: drop useless mode checkCorinna Vinschen1-4/+1
use IFTODT to generate type from mode. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: dirent.h: make definition of struct __DIR opaqueCorinna Vinschen2-16/+32
The content of DIR should never have been exposed into userspace. Move struct __DIR to local dirent.h and only keep forward declaration in exported dirent.h. This allows to tweak the structure in future, for instance, to add thread-safety. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: implement fdclosedirCorinna Vinschen4-7/+33
fdclosedir is BSD-only but already present in dirent.h for a couple of years. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: implement dirent.d_reclenCorinna Vinschen3-8/+23
This change is in preparation of adding posix_getdents() from the upcoming POSIX Base Specification Issue 8. - Add d_reclen - Add GLibC compatible test macros for dirent members - Bump dirent version - Set d_reclen to the fixed size of the dirent struct We can do that because the size is a multiple of 8, so it fits snugly in the buffer filled by posix_getdents and keep the alignement. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: export getlocalename_lCorinna Vinschen3-1/+11
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31getlocalename_l: implement per SUS Base Specifications Issue 8 draftCorinna Vinschen5-0/+116
#include <locale.h> const char *getlocalename_l(int category, locale_t locobj); Most notably, we need a per-thread space to store the string returned if locobj is LC_GLOBAL_LOCALE. No errors are defined for getlocalename_l. So we can't use buffer allocation which might lead to an ENOMEM error. We have to use a "static" buffer in the per-thread state. Note that the feature test macro in locale.h is not quite correct. This needs to be fixed as soon as the Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: path: convert symlink_info to classCorinna Vinschen1-140/+165
encapsulate everything Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: files: slightly simplify suffix handlingCorinna Vinschen3-32/+17
- drop appending .exe.lnk to files - drop exe_suffixes, it's the same as stat_suffixes for a long time Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: bump DLL version to 3.6.0cygwin-3.6.0-devCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Hide itoa, utoa, __itoa and __utoa in stdlib.h on Cygwin onlycygwin-3.5.0Christian Franke1-1/+3
These functions are non-standard and not exported by Cygwin. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-29Cygwin: machine/_arc4random.h: Fix copy/paste bugCorinna Vinschen1-1/+0
Remove a stray __END_DECLS. It didn't hurt in the only (plain C) file including this header, but still... Fixes: 030a762535c1 ("Cygwin: fix arc4random after fork(2)") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-29ssp: add support for _FORTIFY_SOURCE=3Christian Franke4-8/+23
If specified, use __builtin_dynamic_object_size() instead of __builtin_object_size() if supported (GCC 12.0 or later). This enables buffer overflow checks if the buffer size is non-const but known during runtime. Use new macro __ssp_bos_known() instead of the (bos(p) != (size_t)-1) checks. The latter is no longer a compile time constant in all cases. This avoids the generation of unused code. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-29Cygwin: fix arc4random after fork(2)Corinna Vinschen2-0/+17
After using fork(), arc4random does not reseed itself, which causes the results to become predictable. Activate droppingfork-recognition Fixes: e0fc33322d50 ("Delete Cygwin's arc4random in favor of new Newlib implementation") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-29Cygwin: redefine how to recognize forkee stateCorinna Vinschen5-16/+27
So far the global variable in_forkee only indicated if the process is the child process during fork(2) itself. However, we need an indicator accessible from plain C code in newlib, allowing to check for a process being a forked process all the time, after fork(2) succeeded. Redefine bool in_forkee to int __in_forkee to allow exposing it to newlib. Redefine how it indicates fork state (not forked, forking, forked). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-25Cygwin: Add a timeout to ensure we don't wait forever for dumperJon Turney1-2/+6
2024-01-24libgloss: start a MAINTAINERS fileMike Frysinger1-0/+13
2024-01-24Cygwin: pthread: Fix handle leak in pthread_once.Takashi Yano1-0/+3
If pthread_once() is called with pthread_once_t initialized using PTREAD_ONCE_INIT, pthread_once does not release pthread_mutex used internally. This patch fixes that by calling pthread_mutex_destroy() in the thread which has called init_routine. Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-01-23Cygwin: Don't terminate via dumperJon Turney2-4/+9
A process which is exiting due to a core dumping signal doesn't propagate the correct exist status after dumping core, because 'dumper' itself forcibly terminates the process. Use 'dumper -n' to avoid killing the dumped process, so we continue to the end of signal_exit(), to exit with the 128+signal exit status. Busy-wait in exec_prepared_command() in an attempt to reliably notice the dumper attaching, so we don't get stuck there. Also: document these important facts for custom uses of error_start.
2024-01-23libgloss: merge cr16 into top-level MakefileMike Frysinger6-421/+458
Avoid a recursive make to speed things up a bit. A cr16-elf build shows installed objects & libs produce same code. The test targets were dropped as they didn't actually work -- there is no test.o rule in here.
2024-01-23configure.ac: configurable tooldir install pathNeal Frager2-3/+39
This patch is required to fix how the newlib headers are installed when using a sysroot install directory. The cross compiler expects headers to be in .../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h by default newlib installed the headers into .../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h ${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path ${target_noncanonical} provides an extra arm-none-eabi/ that must be removed. With this patch, users can specify the tooldir path that is needed. Signed-off-by: Neal Frager <neal.frager@amd.com> Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
2024-01-23libgloss: pru: Trim crt0-minrt.oDimitar Dimitrov1-14/+1
Strip a few more instructions from crt0-minrt.S: - Remove "halt" and rely on the infinite loop after main()'s return. - Remove main()'s argc and argv argument initialization. Host loader does not set them, and typical firmware does not use them, either. - Remove the __dso_handle symbol. This should be safe because the default crt0.S is fully standards compliant. Whereas crt0-minrt.S has been documented from the beginning to intentionally miss features in order to reduce firmware size, while still enabling typical PRU firmware to operate. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-01-23libgloss: merge pru into top-level MakefileDimitar Dimitrov8-302/+388
Avoid a recursive make to speed things up a bit. This change was inspired by the recent similar patch for c6x: https://sourceware.org/pipermail/newlib/2023/020869.html While at it, fork crt0-minrt.S into a separate source file instead of relying on a predefined macro to generate two different object files. This improves clarity, simplifies the build rules, and would allow further optimization in crt0-minrt.S to be implemented more cleanly. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-01-23Cygwin: seekdir: don't set errnoCorinna Vinschen1-1/+0
Commit 3f3bd1010455 ("* Throughout, use __try/__except/__endtry blocks [...]") introduced setting EINVAL, marked as "Diagnosis". The reason for this is lost in time and space, but looks very much like a debug helper which was supposed to be removed before release. It's rather pointless, so remove it. Fixes: 3f3bd1010455 ("* Throughout, use __try/__except/__endtry blocks [...]") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-22newlib: docs: add "Function " to every function nodeMike Frysinger20-436/+436
When creating a split manual with one-node-per-page, the main index.html ends up getting clobbered by the page for the index() function because it uses "@node index" which, for html, also creates an index.html page. To remedy this, add "Function " to every function node so now we output "Function-index.html" and avoid clobbering. It also namespaces every other function and helps make sure we don't clobber anything else. Otherwise, there isn't really much rendering difference as @node text is mostly internal. Node title text comes from @section instead.