aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
16 hoursCygwin: console: Fix for GNU screen/tmux in ConEmuHEADgithub/mastergithub/mainmastermainTakashi Yano1-1/+18
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>
16 hoursCygwin: console: Fix race issue on allocating console simultaneously.Takashi Yano6-56/+57
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 daysCygwin: console: Bug fix for the last console code changeTakashi Yano1-4/+7
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 daysCygwin: console: Fixes an issue that tmux can not run on the console.Takashi Yano1-1/+14
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>
6 daysCygwin: console: Fix conflict on shared names between sessions.Takashi Yano2-4/+14
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>
6 dayslibc/include/complex.h: Add CMPLX, CMPLXF, and CMPLXLJoel Sherrill1-0/+13
6 dayslibc/include/sys/_default_fcntl.h: O_RSYNC and O_DSYNC are POSIXJoel Sherrill1-2/+3
These should not be in a Cygewin conditional.
8 daysarm: Fix fma & fmaf implementationsMickaël Thomas2-2/+2
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.
8 daysCygwin: pty: Avoid client deadlock when pty master stops to read.Takashi Yano2-3/+26
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>
9 daysCygwin: console: Add debug print on thread_sync_event creation errorTakashi Yano1-0/+3
Fixes: 55baaac2ef5f ("Cygwin: console: Add error handling for thread_sync_event") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
10 daysCygwin: console: Add error handling for thread_sync_eventTakashi Yano1-17/+34
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
11 daysCygwin: dsp: Fix incorrect openflags when opening multiple /dev/dspTakashi Yano2-13/+20
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>
11 dayslibc: sh: add missing prototypes and change functions from K&R to ANSIPietro Monteiro4-18/+33
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>
13 daysarm: emit .type %function directive in FUNC_START macroChristophe Lyon3-0/+6
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.
2024-06-16Cygwin: suppress a warning generated with w32api >= 12.0.0Jon Turney1-0/+3
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]
2024-06-06newlib: libm: skip "long double" complex functions if long double != doublePietro Monteiro14-6/+47
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>
2024-06-03Cygwin: disable high-entropy VA for ldhJeremy Drake via Cygwin-patches2-0/+4
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>
2024-06-02Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82Takashi Yano3-17/+25
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>
2024-06-01Cygwin: mixer: Fix volume control for no WAVECAPS_LRVOLUME deviceTakashi Yano2-1/+15
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>
2024-05-22arc: libgloss: Add build rules for new boardsYuriy Kolerov2-270/+1038
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>
2024-05-22arc: libgloss: Add support of EM Starter Kit boardYuriy Kolerov25-0/+425
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>
2024-05-22arc: libgloss: Add support of EM SDP boardYuriy Kolerov9-0/+164
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>
2024-05-22arc: libgloss: Add support of HS Development Kit boardYuriy Kolerov3-0/+63
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>
2024-05-22arc: libgloss: Add support of IoT Development Kit boardYuriy Kolerov3-0/+68
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>
2024-05-22arc: libgloss: Add a linker script common for all boardsYuriy Kolerov1-0/+233
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22arc: libgloss: Add UART 8250 libraryYuriy Kolerov3-0/+457
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>
2024-05-22arc: libgloss: Clean registers before any useYuriy Kolerov1-0/+41
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22arc: libgloss: Use atexit to setup fini routinesClaudiu Zissulescu1-20/+5
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>
2024-05-22arc: libgloss: Introduce hostlink interfaceVladimir Isaev27-11/+2111
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>
2024-05-22arc: libgloss: Use fstat call instead of stat for nSIMLuis Silva1-1/+1
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>
2024-05-22arc: libc: Record r58/r59 in long-jump's bufferShahab Vahedi2-7/+19
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>
2024-05-22arc: libc, libgloss: Remove .file directive from .S filesYuriy Kolerov2-5/+2
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>
2024-05-22arc: libc: Add support of 16-entry register fileClaudiu Zissulescu28-56/+84
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>
2024-05-22arc: libgloss: Use long calls attribute for exit_haltClaudiu Zissulescu1-2/+2
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>
2024-05-22pru: Do not define MISSING_SYSCALL_NAMES for pruDimitar Dimitrov2-0/+2
- 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>
2024-05-14libgloss: microblaze: fix read and _write declarationsNeal Frager2-0/+4
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>
2024-05-06libgloss: fix read and write prototypeMarc2-2/+2
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>
2024-04-12libgloss: riscv: Fix envp parameter for mainBernd Edlinger1-1/+3
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.
2024-04-09Cygwin: globify: read full 32 bit characterCorinna Vinschen2-1/+6
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>
2024-04-09Cygwin: fhandler_virtual::exists: always set fileidCorinna Vinschen4-4/+20
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>
2024-04-04Cygwin: fhandler_base::fstat_by_name: improve debug output.Corinna Vinschen1-4/+2
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>
2024-04-04Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILECorinna Vinschen3-3/+6
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>
2024-04-04amdgcn: Implement proper locks: Fix ↵Thomas Schwinge1-0/+4
'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
2024-04-03Cygwin: add a fake 3.5.3 release fileCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-02Cygwin: fhandler_virtual: move fileid to path_conv memberCorinna Vinschen8-24/+36
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>
2024-03-27Cygwin: //: fetch only one item per loopCorinna Vinschen1-13/+9
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>
2024-03-25amdgcn: Implement proper locksAndrew Stubbs4-3/+250
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.
2024-03-24Cygwin: add //tsclient and //wsl$ support to relnotesCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24Cygwin: // and //server: add support for WSLCorinna Vinschen1-10/+43
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>
2024-03-24Cygwin: dir_cache::add: constify input stringCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>