Commit Graph

13390 Commits

Author SHA1 Message Date
Takashi Yano bfee9c6ab0 Cygwin: console: Modify ConEmu cygwin connector hook.
- Previously, LoadLibraryA() is hooked for ConEmu cygwin connector.
  With this patch, GetProcAddress() for "RequestTermConnector" is
  hooked instead which is more essential for ConEmu cygwin connector.
2022-08-02 07:52:52 +09:00
Takashi Yano d5229f8211 Cygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.
- If *.bat or *.cmd is executed directly from cygwin shell, pty
  failed to switch I/O pipe to that for native apps. This patch
  fixes the issue.
2022-07-31 17:55:42 +09:00
Takashi Yano 8d564b62b7 Cygwin: console: Avoid accessing NULL pointer via cygheap->ctty.
- Recent commit "Cygwin: console: Add missing input_mutex guard."
  has a problem that causes NULL pointer access if cygheap->ctty
  is NULL. This patch fixes the issue.
2022-07-29 21:59:11 +09:00
Jon Turney d4689b99c6
Cygwin: Set threadnames with SetThreadDescription()
gdb master recently learnt how to use GetThreadDescription() [1], so set
threadnames using SetThreadDescription() [available since Windows 10
1607] as well.

This is superior to using a special exception to indicate the thread
name to the debugger, because the thread name isn't missed if you don't
have a debugger attached at the time it's set.

It's not clear what the encoding of a thread name string is, we assume
UTF8 for the moment.

For the moment, continue to use the old method as well, for the benefit
of older gdb versions etc.

[1] https://sourceware.org/pipermail/gdb-patches/2022-April/187833.html
2022-07-29 11:58:43 +01:00
Corinna Vinschen f145174f80 Cygwin: uname: drop useless support for unsupported CPU arches
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-29 12:19:54 +02:00
Corinna Vinschen 87a9ca4a95 Cygwin: gmon.h: drop 32 bit considerations
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-29 12:19:18 +02:00
Corinna Vinschen 20adacdca2 Cygwin: profile.c: drop i686 register access
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-29 12:17:43 +02:00
Corinna Vinschen 7f42498be6 Cygwin: rename __cygwin_environ and drop env redirection via cur_environ()
Back in early Cygwin development a function based access to the
environment was exported, the internal environ in Cygwin was called
__cygwin_environ and cur_environ() was used to access the environment
indirectly .  The history of that necessity is not documented,
but kept in i686 for backward compatibility.

The x86_64 port eventually used __cygwin_environ directly and exported
it as DATA under the usual name environ.

We don't need the i686 workaround anymore, so just rename
__cygwin_environ to environ, drop the cur_environ() macro and
simply export environ under its own name.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-28 22:00:40 +02:00
Corinna Vinschen cea26c7570 Cygwin: perl scripts: drop support for i686
- rename "is64bit" to "is_x86_64"
- Always set sym_prefix to empty string and add a FIXME
- speclib: rename uscore to sym_prefix and fix bug in string handling

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-28 20:28:45 +02:00
Takashi Yano f2e39d5230 Cygwin: console: Add workaround for ConEmu cygwin connector.
- ConEmu cygwin connector conflicts with cons_master_thread since
  it does not use read() to read console input. With this patch,
  cons_master_thread is disabled in ConEmu cygwin connector.
2022-07-28 23:56:42 +09:00
Takashi Yano d4aacd50e6 Cygwin: console: Add missing input_mutex guard.
- Setting con.disable_master_thread flag should be guarded by
  input_mutex, however, it was not. This patch fixes that.
2022-07-28 23:56:34 +09:00
Corinna Vinschen 33395637a1 Cygwin: Fix previous attempt to drop i386 targets from hookapi
Somehow this patch looks like it was pushed before having been
finished.  Let's try again...

Fixes: e46f15c2d1 ("Cygwin: hookapi: drop handling i386 targets")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-28 16:38:01 +02:00
Corinna Vinschen 5192d5ea51 Cygwin: _dll_crt0: minimize target-specific conditional code
Only the assembler snippet is really x86_64-specific, so minimize the
conditional code block to this snippet.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 20:08:58 +02:00
Corinna Vinschen e46f15c2d1 Cygwin: hookapi: drop handling i386 targets
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 20:06:09 +02:00
Corinna Vinschen 1f962581ff Cygwin: fix or delete a few comments to drop 32 bit references
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 18:32:53 +02:00
Corinna Vinschen 4ce1a1ddc4 Cygwin: drop cyglsa.h. LSA subauth is not supported anymore
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 12:48:39 +02:00
Corinna Vinschen cb4b49470f Cygwin: drop 32 bit target from linker script
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 12:33:21 +02:00
Corinna Vinschen f25e61dfea Cygwin: drop tmpfile export alias for 32 bit systems
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-14 11:41:01 +02:00
Matt Joyce f89ce35d83 Add _REENT_CLEANUP(ptr)
Add a _REENT_CLEANUP() macro to encapsulate access to the
__cleanup member of struct reent. This will help to replace the
struct member with a thread-local storage object in a follow up
patch.
2022-07-13 06:55:46 +02:00
Matt Joyce f3b8138239 Add _REENT_ERRNO(ptr)
Add a _REENT_ERRNO() macro to encapsulate the access to the
_errno member of struct reent. This will help to replace the
structure member with a thread-local storage object in a follow
up patch.

Replace uses of __errno_r() with _REENT_ERRNO().  Keep __errno_r() macro for
potential users outside of Newlib.
2022-07-13 06:55:41 +02:00
Jon Turney 56d5a57e5f
Update FAQs which are out of date on the details of setup UI 2022-07-12 13:58:59 +01:00
Jon Turney b441bad182
Update FAQs for removal of 32-bit Cygwin
Update FAQs for removal of 32-bit Cygwin
Also update FAQs for dropping support for Windows Vista/Server 20008
2022-07-12 13:58:58 +01:00
Takashi Yano 9193f6efde Cygwin: clipboard: Add workaround for setting clipboard failure.
- OpenClipboard() just after CloseClipboard() sometimes fails. Due
  to this, /dev/clipboard sometimes fails to set CF_UNICODETEXT
  data. This patch add a workaround for this issue.
2022-07-12 19:59:38 +09:00
Takashi Yano 421dcf72fb Cygwin: console: Fix an issue which causes when realloc() fails. 2022-07-09 14:43:24 +09:00
Ken Brown 5d4f405d3b Cygwin: redefine some macros for Linux compatibility
Define FD_SETSIZE (<sys/select.h>) to be 1024 by default, and define
NOFILE (<sys/param.h>) to be OPEN_MAX (== 3200) by default.

Remove the comment in <sys/select.h> that FD_SETSIZE should be >=
NOFILE.

Bump API minor.

Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251839.html
2022-07-07 08:22:40 -04:00
Christian Franke d908a30fdc winsup/doc/faq-setup.xml: align help text with setup 2.919 2022-07-07 13:10:46 +02:00
Takashi Yano fc74dbf22f Cygwin: spawn: Treat empty path as the current directory.
- With this patch, the empty path (empty element in PATH or PATH is
  absent) is treated as the current directory as Linux does. This
  feature is added for Linux compatibility, but it is deprecated.
  POSIX notes that a conforming application shall use an explicit
  pathname to specify the current working directory.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251730.html
2022-07-05 13:44:56 +09:00
Takashi Yano b3e25f0bc1 Cygwin: console: Fix issue of pasting very long text input again.
- The recent commit "Cygwin: console: Allow pasting very long text
  input." did not fix the issue enough. This patch adds fixes for
  that.
2022-07-05 11:48:40 +09:00
Ken Brown 72f855f32b Cygwin: implement getfacl(1) for socket files
Do this by defining the acl_get method for the fhandler_socket_local
and fhandler_socket_unix classes.  Also define acl_set for these
classes.

Partially addresses: https://cygwin.com/pipermail/cygwin/2022-July/251768.html
2022-07-04 18:55:19 -04:00
Ken Brown 1503d14af1 Cygwin: stdio: don't try again to read after EOF
This reverts commit 1f8f7e2d54, "* libc/stdio/refill.c (__srefill):
Try again after EOF on Cygwin."  If EOF is set on a file, the stdio
input functions will now immediately return EOF rather than trying
again to read.  This aligns Cygwin's behavior to that of Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251672.html
2022-07-04 18:55:08 -04:00
Takashi Yano 2c2c2b631b Cygwin: console: Fix new bugs in cons_master_thread().
- The previous commit for console introduced new bugs in error
  handling in cons_master_thread(). This patch fixes that.
2022-07-03 11:02:28 +09:00
Takashi Yano 746c8116dd Cygwin: console: Allow pasting very long text input.
- Currently, if the text longer than 1024 byte is pasted in console,
  some of the text is discarded. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251764.html
2022-07-02 11:24:11 +09:00
Takashi Yano 54930ae7d7 Cygwin: poll: Fix a bug on inquiring same fd with different events.
- poll() has a bug that it returns event which is not inquired if
  events are inquired in multiple pollfd entries on the same fd at
  the same time. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251732.html
2022-06-27 10:54:24 +09:00
Takashi Yano fe10e8f03a Cygwin: console: Handle setting very long window title correctly.
- Previously, the console code could not handle escape sequence
  setting window title longer than 256 byte correctly. This patch
  fixes the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html
2022-06-19 18:02:09 +09:00
Takashi Yano fdbd153932 Cygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag.
- Currently, ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is disabled
  unconditionally when exiting from cygwin. This causes ANSI escape
  sequence disabled in Windows Terminal where it is enables by
  default. This patch retains that flag if it is originally enabled.
2022-06-14 21:11:56 +09:00
Ken Brown ddce45112d Cygwin: restore one more '#ifdef __x86_64__' 2022-06-11 08:56:08 -04:00
Ken Brown bbfe79fb72 Cygwin: restore '#ifdef __x86_64__' for CPU-specific code
Commit e1ce752a1d, "Cygwin: remove miscellaneous 32-bit code", removed
most occurrences of '#ifdef __x86_64__'.  Restore those occurrences
that guarded code specific to the AMD64 processor, and #error out if
the processor is different.  This will make it easier to find
AMD64-specific code if we ever want to add support for a different
64-bit processor (e.g., ARM64).
2022-06-10 16:38:34 -04:00
Sebastian Huber b0cb9f85ca Use global stdio streams for all configurations
The _REENT_GLOBAL_STDIO_STREAMS was introduced by commit
668a4c8722 in 2017.  Since then it was enabled by
default for RTEMS.  Recently, the option was enabled for Cygwin which
previously used an alternative implementation to use global stdio streams.

In Newlib, the stdio streams are defined to thread-specific pointers
_reent::_stdin, _reent::_stdout and _reent::_stderr.  If the option is disabled
(the default for most systems), then these pointers are initialized to
thread-specific FILE objects which use file descriptors 0, 1, and 2,
respectively.  There are at least three problems with this:

(1) The thread-specific FILE objects are closed by _reclaim_reent().  This
    leads to problems with language run-time libraries that provide wrappers to
    the C/POSIX stdio streams (for example C++ and Ada), since they use the
    thread-specific FILE objects of the initialization thread.  In case the
    initialization thread is deleted, then they use freed memory.

(2) Since thread-specific FILE objects are used with a common output device via
    file descriptors 0, 1 and 2, the locking at FILE object level cannot ensure
    atomicity of the output, e.g. a call to printf().

(3) There are resource managment issues, see:

    https://sourceware.org/pipermail/newlib/2022/019558.html

    https://bugs.linaro.org/show_bug.cgi?id=5841

This patch enables the _REENT_GLOBAL_STDIO_STREAMS behaviour for all Newlib
configurations and removes the option.  This removes a couple of #ifdef blocks.
2022-06-10 20:13:52 +02:00
Mark Geisert aa460cc0ca Cygwin: Have gmondump support ssp-generated gmon.out
Cygwin tool ssp generates gmon.out files with different address
resolution than other tools do. Two address bytes per bucket rather than
the usual four address bytes. Gprof can deal with the difference but
gmondump can't because the latter's gmon.out header validation fails.

- Remove the offending portion of the header validation code.
- Make sure all code can handle differing address resolutions.
- Display address resolution in verbose data dumps.
- Change "rawarc" to "struct rawarc" in certain sizeof expressions to
  avoid buffer overrun faults.
- When "-v" (verbose) is specified, note when there is missing bucket
  data or rawarc data.
2022-06-10 12:12:26 +02:00
Ken Brown 07cf763095 Cygwin: restore two instances of __stdcall
In the previous commit, __stdcall was removed from _dll_crt0 in
winsup.h and dcrt0.cc but not in lib/cygwin_crt0.c.  For consistency,
restore the first two occurrences of __stdcall.  We could instead
remove it from the declaration in lib/cygwin_crt0.c, but this might
appear to affect binary compatibility, even though it really doesn't.
2022-06-07 13:46:31 -04:00
Ken Brown 30c5411d07 Cygwin: remove most occurrences of __stdcall and __cdecl
These have no effect on x86_64.  Retain a few occurrences of __cdecl
in files imported from other sources.

Also retain all occurrences of WINAPI, even though the latter is
simply a macro that expands to __stdcall.  Most of these occurrences
are associated with Windows API functions, and removing them might
make the code confusing instead of simpler.
2022-06-06 12:00:45 -04:00
Ken Brown cb4b4548c8 Cygwin: remove ntsecapi.h
This was a wrapper for w32api/ntsecapi.h.  It was introduced to fix a
bug that only affected 32-bit Cygwin, so it is no longer needed.
2022-06-06 10:44:01 -04:00
Ken Brown 1f8235f6ba Cygwin: child_info.h: remove declaration of init_child_info
The function was removed long ago, but its declaration remained.
2022-06-06 10:16:48 -04:00
Jon Turney f36dd40275
Cygwin: Drop use of loadlib.h in regtool
Link directly with RegDeleteKeyExW(), available since Vista.

(It's unclear the LoadLibrary wrapper was ever doing anything useful
here, as (i) DLL lookup in PATH was avoided as advapi32 is already
loaded into the process, and (ii) advapi32 is a 'known DLL' which is
only ever loaded from system directory)
2022-06-06 11:21:44 +01:00
Jon Turney f344134a19
Cygwin: Drop pointless loadlib.h includes in utilities
These utilities used to LoadLibrary()/GetProcAddress(), but don't
anymore.
2022-06-06 11:21:43 +01:00
Ken Brown e1ce752a1d Cygwin: remove miscellaneous 32-bit code 2022-05-29 17:54:32 -04:00
Ken Brown b1e304cbd3 Cygwin: remove 32-bit only clipboard code 2022-05-29 17:45:52 -04:00
Ken Brown f6bb8bfaa0 Cygwin: remove some 32-bit only environment code 2022-05-29 17:45:52 -04:00
Ken Brown 3e917daec1 Cygwin: remove some 32-bit only path conversion functions 2022-05-29 17:45:52 -04:00
Ken Brown 2126f966ae Cygwin: remove regparm.h
This file defines the macros __reg1, __reg2, and __reg3, which are
defined to be empty on 64-bit Cygwin.  Remove all occurrences of these
macros.
2022-05-29 17:45:52 -04:00