Commit Graph

20886 Commits

Author SHA1 Message Date
Corinna Vinschen 719224492a Cygwin: drop building modelibs
They never worked as desired anyway. Use the object files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-10 18:05:11 +02:00
Ken Brown 5cdf8ade28 Cygwin: fix return value of symlink_info::check
Currently it is possible for symlink_info::check to return -1 in case
we're searching for foo and find foo.lnk that is not a Cygwin symlink.
This contradicts the new meaning attached to a negative return value
in commit 19d59ce75d.  Fix this by setting "res" to 0 at the beginning
of the main loop and not seting it to -1 later.

Also fix the commentary preceding the function definition to reflect
the current behavior.

Addresses: https://cygwin.com/pipermail/cygwin/2022-August/252030.html
2022-08-09 16:58:08 -04:00
Corinna Vinschen 34872ce1a1 Cygwin: pthreads: merge pthread.cc into thread.cc
provide entire internal and external pthread API from inside the
same file.

While I dislike to have another even larger file, this is basically
cleaning up the source and grouping the external API into useful
chunks. Splitting the file cleanly is tricky due to usage of inline
methods is_good_object and verifyable_object_isvalid.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-09 22:48:43 +02:00
Corinna Vinschen 1556b96b1b Cygwin: stop exporting _alloca
This is a remnant from 32 bit times, mindlessly copied into
the 64 bit export table.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 18:16:09 +02:00
Corinna Vinschen 3ba050dfcd Cygwin: fold common.din and x86_64.din into cygwin.din
We don't need a target-specific DEF file anymore

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 17:47:46 +02:00
Corinna Vinschen 5858c23015 Cygwin: move mcountFunc.S to x86_64 target dir
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 16:50:04 +02:00
Corinna Vinschen 188d5f6c9a Cygwin: x86_64: add wmemset assembler entry point
So far, wmemset used the C implemantation from newlib.  Let's use
the optimized assembler code instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 16:50:04 +02:00
Corinna Vinschen 3e13d93554 Cygwin: split out x86_64 memset/memcpy functions
move the assembler memset and memcpy functions into their own
assembler files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 16:25:41 +02:00
Corinna Vinschen 4d6c88e030 Cygwin: fhandler/null.cc: remove redundant includes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 12:02:11 +02:00
Ken Brown 1213f7bf15 Cygwin: update the "dirs" variable in Makefile.am
Add the new fhandler and sec subdirs.
2022-08-05 12:02:11 +02:00
Corinna Vinschen 007e23d639 Cygwin: Reorganize cygwin source dir
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-08-05 12:02:11 +02:00
Corinna Vinschen 1e428bee1c Cygwin: mount_info::get_mounts_here: alloc temp mountpoint info on cygheap
That *should* be slightly faster than allocating on the user heap.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 12:01:45 +02:00
Corinna Vinschen d097a96e6e Cygwin: drop last usage of RtlCreateUnicodeStringFromAsciiz
This function is just bad.  It really only works for ASCII
chars, everything else is broken after the conversion.

Introduce new helper function sys_mbstouni to replace
RtlCreateUnicodeStringFromAsciiz in hash_path_name.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 11:45:49 +02:00
Takashi Yano 249f42d07a Cygwin: pty: Fix a small bug in is_console_app().
- Previsouly, there was potential risk of buffer over run in
  is_console_app(). This patch fixes the issue.
2022-08-05 17:59:40 +09:00
Corinna Vinschen 58e981a5a4 Cygwin: use locale-aware conversion to UNICODE_STRING checking mount points
mount_info::get_mounts_here used RtlCreateUnicodeStringFromAsciiz
which translates bytes into wide chars verbatim.

Create a new function sys_mbstouni_alloc which can be used from
mount_info::get_mounts_here to convert multibyte mount point
strings to UNICODE_STRINGS in a locale-aware way.

For symmetry, create a function mount_info::free_mounts_here,
so the knwoledge how to free the UNICODE_STRING buffers is
encapsulated in the same class.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 23:48:19 +02:00
Corinna Vinschen 35c5017438 Cygwin: drop all usages of NTAPI
and drop unused prototypes from ntdll.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 22:13:59 +02:00
Corinna Vinschen b28edc7b86 Cygwin: drop all usages of WINAPI
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 22:13:59 +02:00
Corinna Vinschen 73aefcb5c2 Cygwin: clock.cc: Drop redundant Windows prototypes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 22:13:59 +02:00
Corinna Vinschen e71628b889 Cygwin: drop obsolete _cygwin_noncygwin_dll_entry entry point
This was obsoleted more than 22 years ago. Time to drop it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 22:13:59 +02:00
Ken Brown c2aa5b6d74 Cygwin: syscalls.cc: remove ".dll" from blessed_executable_suffixes
This reverts commit d9e9c7b5a7.  The latter added ".dll" to the
blessed_executable_suffixes array because on 32-bit Windows, the
GetBinaryType function would report that a 64-bit DLL is an
executable, contrary to the documentation of that function.

That anomaly does not exist on 64-bit Windows, so we can remove ".dll"
from the list.  Reverting the commit does, however, change the
behavior of the rename(2) syscall in the following unlikely situation:
Suppose we have an executable foo.exe and we make the call

  rename ("foo", "bar.dll");

Previously, foo.exe would be renamed to bar.dll.  So bar.dll would
then be an executable without the .exe extension.  The new behavior is
that foo.exe will be renamed to bar.dll.exe.  [Exception: If there
already existed an executable (not a DLL!) with the name bar.dll, then
.exe will not be appended.]
2022-08-04 15:51:39 -04:00
Corinna Vinschen 288788f91e Cygwin: Drop outdated IsWow64Process2 prototype
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 20:55:52 +02:00
Corinna Vinschen 12a3b696a4 Cygwin: drop outdated __MINGW64_VERSION_MAJOR checks
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 20:55:25 +02:00
Corinna Vinschen 7073ef4e8f Cygwin: drop __stdcall usage
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 20:54:09 +02:00
Corinna Vinschen 7718cb70d4 Cygwin: syscalls.cc: drop masking macros for standard IO functions
The actual reason for these wrappers are lost in time, there's no
hint even in the pre-2000 ChangeLog files.  Apparently they were
masking the prototypes or, alternatively, macros from newlib to
clash with the definitions in syscalls.cc.

They are not needed anymore, so just drop them.

This uncovered that the buffer pointer to pwrite is erronously
non-const.  Fix this on the way out.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 20:32:49 +02:00
Corinna Vinschen 9f6057d203 Cygwin: Drop export aliases and masking macros for stdio64 functions
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 17:30:48 +02:00
Corinna Vinschen cc88ef77e7 Cygwin: create sparse errmap array
To avoid linear searches for error codes, autogenerate errmap as
simple array of errno values indexed by Windows error codes.
Restrict to the first 9000 Windows error codes, we don't care for
most of them anyway.

Define errmap in its own file errmap.h to clean up errno.cc.

Change geterrno_from_win_error accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 15:16:48 +02:00
Markus Mützel ab31794e8a cacosh: Use approximation for large input.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 12:55:52 +02:00
Markus Mützel d939b16adc casinh: Use approximation for large input.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 12:55:17 +02:00
Corinna Vinschen 70c7e8c1ba Cygwin: net.cc: convert wsock_errmap into a simple array of error codes
Avoid linear searches for error codes by converting wsock_errmap
to a ordered array, indexed by WinSock error code (subtracted by
WSABASEERR.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 11:45:58 +02:00
Corinna Vinschen a8c1dd2ce0 Cygwin: net.cc: create own type host_errmap_t for host_errmap
This decouples host_errmap from the errmap_t definition which is
about to be changed in a followup patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 11:37:58 +02:00
Corinna Vinschen 8053ccd44b Cygwin: net.cc: constify gai_errmap
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04 11:36:24 +02:00
Corinna Vinschen f418195dc9 Cygwin: fix/drop a few comments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 18:14:39 +02:00
Corinna Vinschen b226e4228a Cygwin: __WORDSIZE: Drop 32 bit considerations
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 17:48:20 +02:00
Corinna Vinschen 7ad791c1ee Cygwin: drop macro and code for CYGWIN_VERSION_DLL_EPOCH
fix a comment in check_sanity_and_sync() on the way

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 16:16:14 +02:00
Corinna Vinschen c41f0e700a Cygwin: drop unused CYGWIN_VERSION_CYGWIN_CONV macro
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 16:09:00 +02:00
Corinna Vinschen dad3dd33ab Cygwin: version.h: document API_VERSION of the first 64 bit build
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 16:04:42 +02:00
Corinna Vinschen 12360f10ff Cygwin: drop macro and code for CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 16:01:29 +02:00
Corinna Vinschen c874161ec5 Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_CTYPE
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:59:37 +02:00
Corinna Vinschen fee7b24beb Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:57:30 +02:00
Corinna Vinschen 57c3ca8d51 Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:53:41 +02:00
Corinna Vinschen 741f9a61c6 Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:52:07 +02:00
Corinna Vinschen dcd78ece45 Cygwin: drop unused CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES macro
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:50:52 +02:00
Corinna Vinschen c2743614bf Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:48:56 +02:00
Corinna Vinschen 7de1be0472 Cygwin: drop unused CYGWIN_VERSION_CHECK_FOR_S_IEXEC macro
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:39:14 +02:00
Corinna Vinschen 8883f0ea39 Cygwin: drop macro and code for CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:38:11 +02:00
Corinna Vinschen efa6611982 Cygwin: drop macro and code for CYGWIN_VERSION_DLL_MALLOC_ENV
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:35:34 +02:00
Corinna Vinschen 02b273a688 Cygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 15:35:29 +02:00
Corinna Vinschen 2902b3a09e Cygwin: drop requirement to build newlib's stdio64
Given that 64 bit Cygwin defines all file access types (off_t,
fpos_t, and derived types) as 64 bit anyway, there's no reason
left to rely on the stdio64 part of newlib.  Use base functions
and base types.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03 13:41:35 +02:00
Takashi Yano 8b502d8635 Cygwin: path: Make some symlinks to /cygdrive/* work.
- Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C,
  /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes
  the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html
2022-08-03 13:36:09 +09:00
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