]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
23 months agobump DLL version to 3.4.4
Jon Turney [Fri, 16 Dec 2022 13:30:55 +0000 (13:30 +0000)]
bump DLL version to 3.4.4

23 months agoCygwin: Update 3.4.3 release note cygwin-3.4.3
Jon Turney [Fri, 16 Dec 2022 10:34:38 +0000 (10:34 +0000)]
Cygwin: Update 3.4.3 release note

23 months agoRevert "Cygwin: x86_64: add wmemset assembler entry point"
Jon Turney [Fri, 16 Dec 2022 10:21:13 +0000 (10:21 +0000)]
Revert "Cygwin: x86_64: add wmemset assembler entry point"

This reverts commit 188d5f6c9ad5cbbd6f0fcb9aaf15bc9870597910.

23 months agoCygwin: path handling: never substitute virtual drive with target path
Corinna Vinschen [Mon, 12 Dec 2022 20:56:14 +0000 (21:56 +0100)]
Cygwin: path handling: never substitute virtual drive with target path

Move the drive substitution code after the call to
GetFinalPathNameByHandleW into a local function revert_virtual_drive
and add code to handle non-remote virtual drives, i. e., those
created with the subst command.  (Try to) make sure that virtual
drives are never treated like symlinks.

Fixes: 19d59ce75d53 ("Cygwin: path_conv: Rework handling native symlinks as inner path components")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: add release message for latest path handling patch
Corinna Vinschen [Wed, 14 Dec 2022 10:57:36 +0000 (11:57 +0100)]
Cygwin: add release message for latest path handling patch

5ba5e09b9d39 ("Cygwin: path handling: never substitute virtual drive with target path")

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: Makefile: build new-cygwin1.dll in a single step
Corinna Vinschen [Tue, 13 Dec 2022 12:28:16 +0000 (13:28 +0100)]
Cygwin: Makefile: build new-cygwin1.dll in a single step

The complicated build routine was only required because we needed
the .cygheap section at the end of the file, and the debug sections
broke this.  Now that the cygheap is out of the way, we really don't
have to do this anymore, and the build can just generate a DLL with
integrated debug info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: Makefile: only regenerate cygwin_version.c if it changes
Corinna Vinschen [Tue, 13 Dec 2022 12:25:06 +0000 (13:25 +0100)]
Cygwin: Makefile: only regenerate cygwin_version.c if it changes

Make sure to create a new cygwin_version.c if it either doesn't
exist yet, or if it would be different from the former file.
This avoids unnecessary DLL rebuilding.

Fixes: 97eb64b909bc ("Cygwin: uname: generate default release string from git as well")
Fixes: 4949a82cde98 ("Cygwin: uname: fix building in non-git source dir")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agobump DLL version to 3.4.3
Corinna Vinschen [Sun, 11 Dec 2022 12:12:27 +0000 (13:12 +0100)]
bump DLL version to 3.4.3

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: add 3.4.2 release notes cygwin-3.4.2
Corinna Vinschen [Sun, 11 Dec 2022 10:45:30 +0000 (11:45 +0100)]
Cygwin: add 3.4.2 release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: uname: fix building in non-git source dir
Corinna Vinschen [Wed, 7 Dec 2022 21:22:38 +0000 (22:22 +0100)]
Cygwin: uname: fix building in non-git source dir

commit 97eb64b909bc broke building outside of a git dir, because
the git describe command would fail.  Fix this by checking if
we're in a git tree at all and just generate an empty string
as version string.  Use this in uname_x to generate a fallback
version.

Fixes: 97eb64b909bc ("Cygwin: uname: generate default release
string from git as well"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: uname: generate default release string from git as well
Corinna Vinschen [Wed, 7 Dec 2022 20:14:27 +0000 (21:14 +0100)]
Cygwin: uname: generate default release string from git as well

When building a release with cygport, we get uname version info
from cygport, which in turn gets version info from `git describe'.

During development, the release info for local builds was not
that helpful yet.  Fix that, by creating version info from
`git describe' if CYGPORT_RELEASE_INFO isn't given.  Make sure to
always force rebuild of the version info to pick up source file
changes as well as git actions.

Rearrange code slightly to generate machine info first, release info
after that.  Use snprintf to generate release string safely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoRevert "Cygwin: 3.4-only: uname: drop dot from external release info"
Corinna Vinschen [Sun, 11 Dec 2022 10:19:00 +0000 (11:19 +0100)]
Revert "Cygwin: 3.4-only: uname: drop dot from external release info"

This reverts commit b5eba8e972786275c76ea69a7ce6ef8d7c8279c3.

23 months agobump DLL version to 3.4.2
Corinna Vinschen [Sun, 11 Dec 2022 10:24:53 +0000 (11:24 +0100)]
bump DLL version to 3.4.2

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: pipe: Fix performance degradation for non-cygwin pipe. cygwin-3.4.1
Takashi Yano [Thu, 8 Dec 2022 13:02:43 +0000 (22:02 +0900)]
Cygwin: pipe: Fix performance degradation for non-cygwin pipe.

https://cygwin.com/pipermail/cygwin/2022-December/252628.html

After the commit 9e4d308cd592, the performance of read from non-cygwin
pipe has been degraded. This is because select_sem mechanism does not
work for non-cygwin pipe. This patch fixes the issue.

Fixes: 9e4d308cd592 ("Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT
flag for read pipe.")
Reported-by: tryandbuy <tryandbuy@proton.me>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
23 months agoCygwin: improve release text for FILE issue
Corinna Vinschen [Fri, 9 Dec 2022 11:41:54 +0000 (12:41 +0100)]
Cygwin: improve release text for FILE issue

Add a note in terms of 3.4.0 compatibility.

Suggested-by: Markus Mützel <markus.muetzel@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: add __sFILE64 fix to 3.4.1 release notes
Corinna Vinschen [Thu, 8 Dec 2022 13:19:22 +0000 (14:19 +0100)]
Cygwin: add __sFILE64 fix to 3.4.1 release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: define FILE as struct __sFILE64, not as __sFILE
Corinna Vinschen [Thu, 8 Dec 2022 12:58:37 +0000 (13:58 +0100)]
Cygwin: define FILE as struct __sFILE64, not as __sFILE

Until Cygwin 3.3.6, we define __LARGE64_FILES unconditionally, so we
were using the type __sFILE64 even for 64 bit.  That was lazy and wrong.
so commit 2902b3a09e0a ("Cygwin: drop requirement to build newlib's
stdio64") tried to fix that.

Unfortunately this patch forgot to take the exposure of the typename
__sFILE64 in userspace into account.  This leads to trouble in C++ due
to name mangling.

Commit 0f376ae22036 tried to fix this by just renaming __sFILE to
__sFILE64 by using a macro.  While __sFILE and __sFILE64 are the same
size, they are not exactly congruent.

To avoid backward compatibility problems, make sure to define FILE
as the  real __sFILE64, and make sure that __sFILE is not defined at
all on Cygwin.

Fixes: 0f376ae22036 ("Cygwin: rename __sFILE to __sFILE64 for backward
compatibility")
Fixes: 2902b3a09e0a ("Cygwin: drop requirement to build newlib's stdio64")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: 3.4-only: uname: drop dot from external release info
Corinna Vinschen [Thu, 8 Dec 2022 17:48:45 +0000 (18:48 +0100)]
Cygwin: 3.4-only: uname: drop dot from external release info

Right now, the dot between the version and the machine info in
the release field is expected to come in from CYGPORT_RELEASE_INFO.
But that's just confusing and doesn't match what we now do in 3.5
since commit 97eb64b909bc ("Cygwin: uname: generate default release
string from git as well")

Add the dot when attaching the machine info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: link mcountFunc.o to libgmon.a
Corinna Vinschen [Wed, 7 Dec 2022 11:20:26 +0000 (12:20 +0100)]
Cygwin: link mcountFunc.o to libgmon.a

Commit 188d5f6c9ad5 erroneously moved the mcountFunc.S file to the
TARGET_FILES target, rather than keeping it in GMON_FILES.  The
result is that the __fentry__ entry point is now entirely undefined,
so `gcc -pg' is broken.

Create new target-specific GMON_TARGET_FILES and move mcountFunc.S
into it.  Add $(GMON_TARGET_FILES) to GMON_FILES.

Fixes: 188d5f6c9ad5 ("Cygwin: x86_64: add wmemset assembler entry point")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agobump DLL version to 3.4.1
Corinna Vinschen [Sun, 4 Dec 2022 12:49:57 +0000 (13:49 +0100)]
bump DLL version to 3.4.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: add release message for commit previous commit 8d138c3f66c2 cygwin-3.4.0
Corinna Vinschen [Sat, 3 Dec 2022 15:36:49 +0000 (16:36 +0100)]
Cygwin: add release message for commit previous commit 8d138c3f66c2

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: fix LC_CTYPE in global locale to be a real C.UTF-8 locale
Corinna Vinschen [Sat, 3 Dec 2022 15:16:15 +0000 (16:16 +0100)]
Cygwin: fix LC_CTYPE in global locale to be a real C.UTF-8 locale

https://cygwin.com/pipermail/cygwin/2022-December/252571.html

Cygwin's default locale is "C.UTF-8" as far as LC_CTYPE settings
are concerned.  However, while __global_locale contains fixed
mbtowc and wctomb pointers, the lc_ctype_T pointer is still pointing
to _C_ctype_locale, representing the standard "C" locale.

The problem with this is that the codeset name as well as MB_CUR_MAX
is wrong.

Fix this by introducing a new lc_ctype_T structure called
_C_utf8_ctype_locale, setting the default codeset to "UTF-8" and
MB_CUR_MAX to 6.  Use this as lc_ctype_T pointer in __global_locale
by default on Cygwin.

Fixes: a6a477fa8190 ("POSIX-1.2008 per-thread locales, groundwork part 1")
Co-Authored-By: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: add latest primary group changes to release notes
Corinna Vinschen [Sat, 3 Dec 2022 15:12:49 +0000 (16:12 +0100)]
Cygwin: add latest primary group changes to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: FAQ: convert ulinks to FAQ to xrefs
Corinna Vinschen [Fri, 2 Dec 2022 21:38:47 +0000 (22:38 +0100)]
Cygwin: FAQ: convert ulinks to FAQ to xrefs

Using ulinks here makes the result work on cygwin.com only, while
xrefs to FAQs are creating realtive links.  Add xreflabel where
appropriate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: FAQ: describe test releases, deprecate developer snapshots
Corinna Vinschen [Fri, 2 Dec 2022 20:54:19 +0000 (21:54 +0100)]
Cygwin: FAQ: describe test releases, deprecate developer snapshots

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: uinfo: don't special case current user
Corinna Vinschen [Fri, 2 Dec 2022 15:49:47 +0000 (16:49 +0100)]
Cygwin: uinfo: don't special case current user

fetch_account_from_windows shortcuts the current user in that
it takes the user's domain SID and just adds the matching RID
from the token's primary group to create a group SID.

How wrong this is can be very simply reproduced:

Assuming you run a native process, like cmd, with primary group
set to the Administrators builtin group.  Run Cygwin's id(1) as
child process.  id(1) will print a non-existent group as primary
group and also add it to the group list.

This can only be avoided by not special casing the current user
and thus not creating a group SID from partial information.

Fixes: 6cc7c925ce86 ("(pwdgrp::fetch_account_from_windows): Default primary group for the
current user to primary group from user token.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: uinfo: prefer token primary group
Corinna Vinschen [Fri, 2 Dec 2022 15:37:33 +0000 (16:37 +0100)]
Cygwin: uinfo: prefer token primary group

internal_getlogin overwrites the process token primary group if it
differs from the primary group as stored in the passwd DB.

However, this also overwrites the primary group of the process if
it has been deliberately changed by a former process (e. g., newgrp),
and the current process has a non-Cygwin process as parent.

Our docs claim we restrict overwriting the primary group to local,
non-domain user accounts anyway, and it was actually meant this way.

So check for exactly that before overwriting the primary group
in the token:  It's only allowed if the user is a local account
and the primary group in the token is still the default group
"None".

Fixes: 6cc7c925ce861 ("(internal_getlogin): Give primary group
from user token more weight.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: uinfo: Drop long disabled nss_prefix and nss_separator
Corinna Vinschen [Fri, 2 Dec 2022 14:13:24 +0000 (15:13 +0100)]
Cygwin: uinfo: Drop long disabled nss_prefix and nss_separator

Originally the code was written to allow three ways of prefixing
accounts and to freely define a domain/account separator.  This code
has been disabled even before being officially released, and it was
never re-enabled. Given there has been no complaints for eight years
now, drop this code eventually.  Just add a macro to define the
domain/account separator statically.

Fixes: cc332c9e271b ("(cygheap_pwdgrp::nss_init_line): Disable db_prefix
and db_separator settings.  Add comment")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: exec: don't access cygheap before it's initialized
Corinna Vinschen [Thu, 1 Dec 2022 20:33:14 +0000 (21:33 +0100)]
Cygwin: exec: don't access cygheap before it's initialized

This is a long-standing thinko.

When you exec a process, dll_crt0_0 in the child process calls
child_info_spawn::handle_spawn().  handle_spawn() initialises the
cygheap.

Now consider calling strace.  Strace is a non-Cygwin process dynamically
loading cygwin1.dll via LoadLibrary.  This in turn initializes the DLL:

- dll_crt0_0 finds that the process it attaches to has been exec'd, so
  child_info_spawn::handle_spawn() is called.

- If the DLL is being dynamically loaded, handle_spawn() calls
  child_info_spawn::get_parent_handle().  This in turn tries to set
  the moreinfo->myself_pinfo value inside the cygheap to NULL.

- However, at this time, the cygheap has not yet been initialized.  This
  only occurs in the cygheap_fixup_in_child() call after get_parent_handle()
  returns.

--> SEGV

This thinko never had a negative side effect, because the cygheap was
pre-allocated at DLL load time until commit 2f9b8ff00cce ("Cygwin:
decouple cygheap from Cygwin DLL").  With 2f9b8ff00cce, the cygheap
actually doesn't exist until after the call to cygheap_fixup_in_child().

Fix this problem by moving the assignment after the call to
cygheap_fixup_in_child().

Fixes: 3de7be4c1deb ("* DevNotes: Add entry cgf-000007. [...]")
Fixes: 2f9b8ff00cce ("Cygwin: decouple cygheap from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: multiple_cygwin_problem: drop obsolete check for "cygheap"
Corinna Vinschen [Thu, 1 Dec 2022 20:20:44 +0000 (21:20 +0100)]
Cygwin: multiple_cygwin_problem: drop obsolete check for "cygheap"

After decoupling cygheap from the DLL loading address, the check
for a different _cygheap_start has gone.  So the matching string
check in multiple_cygwin_problem is obsolete now.

Fixes: 2f9b8ff00cce ("Cygwin: decouple cygheap from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: serial: Fix a copy-paste error in DTR setup
Carlo Bramini [Tue, 29 Nov 2022 09:02:43 +0000 (10:02 +0100)]
Cygwin: serial: Fix a copy-paste error in DTR setup

In commit 2dab880c963ce0204c3513d664f610b587a3e6a6 I did a mistake when
I copied the new fhandler_serial::switch_modem_lines() from my modified
3.3.6 branch to the current master and I left a copy paste error. This
patch fixes that error.

Fixes: 2dab880c963c ("Cygwin: fix TIOCMBIS/TIOCMBIC not working when using usbser.sys")
23 months agoCygwin: Update some mentions of x86 in documentation
Jon Turney [Sun, 27 Nov 2022 13:50:19 +0000 (13:50 +0000)]
Cygwin: Update some mentions of x86 in documentation

23 months agoCygwin: Fix typo in FAQ
Jon Turney [Sat, 12 Nov 2022 14:16:36 +0000 (14:16 +0000)]
Cygwin: Fix typo in FAQ

The consonant in 'debug' is doubled in 'debuggee' just as it is in
'debugger'.

Fixes: 8c68a8a4
2 years agoCygwin: pty: Rename fhandler/tty.cc to fhandler/pty.cc.
Takashi Yano [Wed, 23 Nov 2022 23:30:16 +0000 (08:30 +0900)]
Cygwin: pty: Rename fhandler/tty.cc to fhandler/pty.cc.

- Previously, we have two tty.cc, one is winsup/cygwin/tty.cc and
  the other is winsup/cygwin/fhandler/tty.cc. This is somewhat
  confusing. This patch renames fhandler/tty.cc to fhandler/pty.cc.

2 years agoCygwin: uname: allow to specify external release info
Corinna Vinschen [Thu, 24 Nov 2022 11:23:09 +0000 (12:23 +0100)]
Cygwin: uname: allow to specify external release info

When creating regular Cygwin test releases we need a way to
automate unambiguous version information based on the output
of `git describe'.  Allow to inject a release string via a
preprocessor macro CYGPORT__RELEASE_INFO.  Change the default
release info to recognize a local, non-distro build.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop snapshot handling
Corinna Vinschen [Thu, 24 Nov 2022 11:20:50 +0000 (12:20 +0100)]
Cygwin: drop snapshot handling

We're going to switch to regular test releases, rather than the
old, handcrafted snapshots method.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoamdgcn: Use __builtin_gcn_ in libc/machine/amdgcn/getreent.c
Tobias Burnus [Tue, 22 Nov 2022 13:53:48 +0000 (14:53 +0100)]
amdgcn: Use __builtin_gcn_ in libc/machine/amdgcn/getreent.c

Call __builtin_gcn_get_stack_limit and __builtin_gcn_first_call_this_thread_p
to reduce dependency on some register/layout assumptions by using the new
GCC mainline (GCC 13) builtins, if they are available. If not, the existing
code is used.

2 years agoamdgcn: Replace asm("s8") by __builtin_gcn_kernarg_ptr if existing
Tobias Burnus [Fri, 18 Nov 2022 08:50:20 +0000 (09:50 +0100)]
amdgcn: Replace asm("s8") by __builtin_gcn_kernarg_ptr if existing

Check whether __builtin_gcn_kernarg_ptr is available and, if it is,
call it instead using the hard-coded 'asm("s8")' in:
* newlib/libc/machine/amdgcn/exit-value.h (exit_with_int)
* newlib/libc/machine/amdgcn/mlock.c (sbrk)
* newlib/libc/sys/amdgcn/write.c (write)

 newlib/libc/machine/amdgcn/exit-value.h |  6 ++++++
 newlib/libc/machine/amdgcn/mlock.c      | 10 +++++++---
 newlib/libc/sys/amdgcn/write.c          |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)

2 years agoCygwin: pty, console: Encapsulate spawn.cc code related to pty/console.
Takashi Yano [Sat, 19 Nov 2022 08:28:15 +0000 (17:28 +0900)]
Cygwin: pty, console: Encapsulate spawn.cc code related to pty/console.

- The codes related to pty and console in spawn.cc have been moved
  into the new class fhandler_termios::spawn_worker, and make spawn.cc
  call them. The functionality has not been changed at all.

2 years agomakedocbook: Fix false report of unhandled texinfo command
Jon Turney [Sat, 29 Oct 2022 15:43:50 +0000 (16:43 +0100)]
makedocbook: Fix false report of unhandled texinfo command

During 'make man', makedocbook falsely reports "texinfo command
'@modifier' remains in output" while processing the setlocal(3) manpage,
which contains that literal string.

Move the check for unrecognized texinfo commands to before processing
'@@' (an escaped '@') in the texinfo source, and teach it to ignore
them.

Improve that check slightly, so it catches non-alphabetic texinfo
commands, of which there are few.

Now we don't have false positives, we can make unrecognized texinfo
commands fatal to manpage generation, rather than leaving them verbatim
in the generated manpage.

2 years agomakedocbook: Adjust inline whitespace to fix flake8 warnings
Jon Turney [Tue, 1 Nov 2022 11:35:51 +0000 (11:35 +0000)]
makedocbook: Adjust inline whitespace to fix flake8 warnings

2 years agomakedocbook: Drop stray semicolons
Jon Turney [Tue, 1 Nov 2022 11:37:00 +0000 (11:37 +0000)]
makedocbook: Drop stray semicolons

This isn't written in C :)

2 years agomakedocbook: Use sys.exit()
Jon Turney [Tue, 1 Nov 2022 11:21:21 +0000 (11:21 +0000)]
makedocbook: Use sys.exit()

Use sys.exit() to write a message to stderr and terminate with a
non-zero exit code.

2 years agomakedocbook: Use raw strings for regexes
Jon Turney [Tue, 1 Nov 2022 11:15:25 +0000 (11:15 +0000)]
makedocbook: Use raw strings for regexes

Use raw strings for regexes. This is best practice, and fixes a number
of "W605 invalid escape sequence" flakes.

2 years agoCygwin: document bugfix for USB CDC devices
Corinna Vinschen [Fri, 11 Nov 2022 12:09:45 +0000 (13:09 +0100)]
Cygwin: document bugfix for USB CDC devices

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: fix TIOCMBIS/TIOCMBIC not working when using usbser.sys
Carlo Bramini [Fri, 11 Nov 2022 10:15:27 +0000 (11:15 +0100)]
Cygwin: fix TIOCMBIS/TIOCMBIC not working when using usbser.sys

In winsup/cygwin/fhandler/serial.cc, the function
fhandler_serial::switch_modem_lines() is called when TIOCMBIS/TIOCMBIC
are used in an ioctl() call.

This function uses EscapeCommFunction() for setting and resetting RTS
and DTR signals of a serial port.  Unfortunately, this function does not
work on USB CDC devices.

This is not a true bug of CYGWIN but an issue of the usbser.sys driver,
from Windows 2000 to the latest Windows 11.  Both 32bit and 64bit
versions of the operating system are affected.  Actually, I tested
EscapeCommFunction() also when using a real UART, based on the
traditional 16550 driver and it works fine.  Using thirdy party CDC
drivers, like the one provided by FTDI for their USB bridge chips,
probably also works.

However, it is also possible to drive the RTS/DTR signals by writing
their state with SetCommState(), which proved to be working fine all
types of connection.  This is also a better solution for handling these
signals since RTS/DTR can be set at the same time rather than having two
separate calls with a visible delay between them.

2 years agopowerpc/setjmp: Fix 64-bit buffer alignment
Sebastian Huber [Mon, 7 Nov 2022 13:33:42 +0000 (14:33 +0100)]
powerpc/setjmp: Fix 64-bit buffer alignment

The rlwinm is a word-size instruction which clears the remaining 32 bits of a
64-bit register.  Use clrrdi in 64-bit configurations.

2 years agoCygwin: Correct /proc/*/stat for processes without ctty
Andy Koppe [Wed, 9 Nov 2022 20:34:30 +0000 (20:34 +0000)]
Cygwin: Correct /proc/*/stat for processes without ctty

Report 0 instead of 268435455 (i.e. 0xFFFFFFF) in the tty field of
/proc/*/stat for processes without a controlling terminal. This is what
the procps utility expects when selecting or excluding such processes.

2 years agoGenerally make all 'long double complex' methods available in <complex.h>
Thomas Schwinge [Wed, 5 Oct 2022 20:11:41 +0000 (22:11 +0200)]
Generally make all 'long double complex' methods available in <complex.h>

..., not just '#if defined(__CYGWIN__)'.  (Exception: 'clog10l' which currently
indeed is for Cygwin only.)

This completes 2017-07-05 commit be3ca3947402827aa52709e677369bc7ad30aa1d
"Fixed warnings for some long double complex methods" after Aditya Upadhyay's
work on importing "Long double complex methods" from NetBSD.

For example, this changes GCC/nvptx libgfortran 'configure' output as follows:

    [...]
    checking for ccosf... yes
    checking for ccos... yes
    checking for ccosl... [-no-]{+yes+}
    [...]

..., and correspondingly GCC/nvptx 'nvptx-none/libgfortran/config.h' as
follows:

    [...]
     /* Define to 1 if you have the `ccosl' function. */
    -/* #undef HAVE_CCOSL */
    +#define HAVE_CCOSL 1
    [...]

Similarly for 'ccoshl', 'cexpl', 'cpowl', 'csinl', 'csinhl', 'ctanl', 'ctanhl',
'cacoshl', 'cacosl', 'casinhl', 'catanhl'.  ('conjl', 'cprojl' are not
currently being used in libgfortran.)

This in turn simplifies GCC/nvptx 'libgfortran/intrinsics/c99_functions.c'
compilation such that this files doesn't have to provide its own
"Implementation of various C99 functions" for those, when in fact they're
available in newlib libm.

2 years agoCygwin: Improve FAQ on early breakpoint for ASLR
Jon Turney [Tue, 1 Nov 2022 16:52:57 +0000 (16:52 +0000)]
Cygwin: Improve FAQ on early breakpoint for ASLR

gdb supports the 'disable-randomization' setting on Windows since [1]
(included in gdb 13).

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008

2 years agoCygwin: Handle out of order modules for module offsets in stackdump
Jon Turney [Tue, 1 Nov 2022 14:01:08 +0000 (14:01 +0000)]
Cygwin: Handle out of order modules for module offsets in stackdump

Improve address to module+offset conversion, to work correctly in the
presence of out-of-order elements in InMemoryOrderModuleList.

Fixes: d59651d4
2 years agostrftime/wcsftime: use STRLEN, not strlen
Corinna Vinschen [Sat, 29 Oct 2022 18:15:58 +0000 (20:15 +0200)]
strftime/wcsftime: use STRLEN, not strlen

Commit 737e2004a3bb accidentally introduced a call to strlen in
code used with wide character strings in case of wcsftime.  Use
STRLEN instead.

Fixes: 737e2004a3bb ("strftime.c(__strftime): add %q, %v, tests; tweak %Z doc")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agomakedocbook: Add explicit locking for PLY parser table generation
Jon Turney [Fri, 28 Oct 2022 16:56:09 +0000 (17:56 +0100)]
makedocbook: Add explicit locking for PLY parser table generation

Drop 'makedocbook --cache' (any dependency on the man-cache rule which
invokes that was dropped by the non-recursive make changes)

Instead, add some explicit locking which prevents processes colliding
over the file containing generated python code for the parser table.

2 years agoCygwin: Add loaded module base address list to stackdump
Jon Turney [Fri, 28 Oct 2022 12:35:13 +0000 (13:35 +0100)]
Cygwin: Add loaded module base address list to stackdump

This adds an extra section to the stackdump, which lists the loaded
modules and their base address.  This is perhaps useful as it makes it
immediately clear if RandomCrashInjectedDll.dll is loaded...

Future work: It seems like the 'InMemoryOrder' part of
'InMemoryOrderModuleList' is a lie?

> Loaded modules
000100400000 segv-test.exe
7FFF2AC30000 ntdll.dll
7FFF29050000 KERNEL32.DLL
7FFF28800000 KERNELBASE.dll
000180040000 cygwin1.dll
7FFF28FA0000 advapi32.dll
7FFF29F20000 msvcrt.dll
7FFF299E0000 sechost.dll
7FFF29B30000 RPCRT4.dll
7FFF27C10000 CRYPTBASE.DLL
7FFF28770000 bcryptPrimitives.dll

2 years agoCygwin: Add addresses as module offsets in .stackdump file
Jon Turney [Fri, 28 Oct 2022 11:26:56 +0000 (12:26 +0100)]
Cygwin: Add addresses as module offsets in .stackdump file

This adds an additional column to the stack trace in a .stackdump file,
which gives the stack frame return address as a module name+offset. This
makes it a possible to convert the address to a function name without
having to guess what module the address belongs to.

> Stack trace:
> Frame         Function     Args
0007FFFFCC30  0001004010E9 (000180048055000180046FA000000000000200018031E160) segv-test.exe+0x10E9
0007FFFFCD30  0001800480C1 (000000000000000000000000000000000000000000000000) cygwin1.dll+0x80C1
0007FFFFFFF0  000180045C86 (000000000000000000000000000000000000000000000000) cygwin1.dll+0x5C86
0007FFFFFFF0  000180045D34 (000000000000000000000000000000000000000000000000) cygwin1.dll+0x5D34
> End of stack trace

Loosely based on this patch [1] by Brian Dessent.

[1] https://cygwin.com/pipermail/cygwin-patches/2008q1/006306.html

2 years agoCygwin: Tidy up formatting of stackdump
Jon Turney [Fri, 28 Oct 2022 12:43:54 +0000 (13:43 +0100)]
Cygwin: Tidy up formatting of stackdump

Resize stackdump headers for b9e97f58
Consistently use \r\n line endings

2 years agoCygwin: cygheap: make bucket_val a static const array
Corinna Vinschen [Fri, 28 Oct 2022 15:02:05 +0000 (17:02 +0200)]
Cygwin: cygheap: make bucket_val a static const array

Every time the cygheap is initialized, that is, on each fork
or exec, cygheap_init() *again* computes the bucket size values
and stores them in the cgyheap, albeit they are always the
same values anyway.

Make bucket_val a local const array, statically initialized
instead.

Fixes: 61522196c715 ("* Merge in cygwin-64bit-branch.)"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: document ASLR support topic/aslr_support github/topic/aslr_support
Corinna Vinschen [Fri, 28 Oct 2022 08:01:02 +0000 (10:01 +0200)]
Cygwin: document ASLR support

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: Enable dynamicbase on the Cygwin DLL by default
Corinna Vinschen [Fri, 28 Oct 2022 08:00:48 +0000 (10:00 +0200)]
Cygwin: Enable dynamicbase on the Cygwin DLL by default

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: /proc/<PID>/maps: output cygheap info
Corinna Vinschen [Fri, 28 Oct 2022 08:00:17 +0000 (10:00 +0200)]
Cygwin: /proc/<PID>/maps: output cygheap info

Now that the cygheap isn't part of the CYgwin DLL anymore, we have a
known memory location which is not known in maps output.  Fix that by
checking for cygheap address (same in all processes) and add to output.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop objcopy .gnu_debuglink juggle
Corinna Vinschen [Thu, 27 Oct 2022 11:05:36 +0000 (13:05 +0200)]
Cygwin: drop objcopy .gnu_debuglink juggle

Prior to 591fec858d01 ("Cygwin: decouple cygheap from Cygwin DLL")
the .cygheap section was required to stay the last section in the
final binary.  That required some juggling with objcopy to make
sure the .gnu_debuglink section is prior to the .cygheap section
in the final DLL.

This isn't required anymore, so just drop it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: memory_layout.h: define absolute MMAP_STORAGE_HIGH values here
Corinna Vinschen [Wed, 26 Oct 2022 20:04:41 +0000 (22:04 +0200)]
Cygwin: memory_layout.h: define absolute MMAP_STORAGE_HIGH values here

Use the symbolic values in wincap.cc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: memory_layout.h: fix comments
Corinna Vinschen [Wed, 26 Oct 2022 19:26:37 +0000 (21:26 +0200)]
Cygwin: memory_layout.h: fix comments

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: decouple shared mem regions from Cygwin DLL
Corinna Vinschen [Wed, 26 Oct 2022 19:22:19 +0000 (21:22 +0200)]
Cygwin: decouple shared mem regions from Cygwin DLL

Another reason ASLR may fail is the coupling of the standard shared
mem regions (global, userinfo, process info, shared console) to the
address of the Cygwin DLL.  They are always placed in fixed addresses
preceeding the Cygwin DLL's address.  With ASLR this is bound to fail.

Use a fixed, unused memory area to place the shared mem regions.
This also allows to simplify the shared memory creation.  There's
no reason anymore to rebase the regions and rather than offsets,
just use the addresses directly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: decouple cygheap from Cygwin DLL
Corinna Vinschen [Wed, 26 Oct 2022 19:16:35 +0000 (21:16 +0200)]
Cygwin: decouple cygheap from Cygwin DLL

One reason that ASLR is tricky is the fact that the cygheap
is placed at the end of the DLL and especially that it's expected
to be growable.  To support ASLR, this construct must go.

Define dedicated cygheap memory region and reserve entire region.
Commit 3 Megs, as was the default size of the cygheap before.

Fix linker script accordingly, drop a now useless version check
in get_cygwin_startup_info().

2 years agoCygwin: add memory_layout.h
Corinna Vinschen [Wed, 26 Oct 2022 19:06:54 +0000 (21:06 +0200)]
Cygwin: add memory_layout.h

Collect all info about memory layout in one header file, so
the mem layout is documented in one logical place and not
in heap.cc arbitrarily.

Use info from this file throughout.

This is to prepare for ASLR support.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: exceptions: print 48 bit addresses
Corinna Vinschen [Fri, 28 Oct 2022 14:24:00 +0000 (16:24 +0200)]
Cygwin: exceptions: print 48 bit addresses

Exception handling was *still* printing addresses as 44 bit values,
but Windows supports a 48 bit virtual address space since Windows
8.1.  Fix that.

Fixes: e1254add73b1 ("Cygwin: Allow accessing 48 bit address space in Windows 8.1 or later")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: add missing .com entry in new-features.xml
Corinna Vinschen [Fri, 28 Oct 2022 11:01:37 +0000 (13:01 +0200)]
Cygwin: add missing .com entry in new-features.xml

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agopowerpc/setjmp: Fix 64-bit support
Sebastian Huber [Mon, 24 Oct 2022 09:05:14 +0000 (11:05 +0200)]
powerpc/setjmp: Fix 64-bit support

The first attempt to support the 64-bit mode had two bugs:

1. The saved general-purpose register 31 value was overwritten with the saved
   link register value.

2. The link register was saved and restored using 32-bit instructions.

Use 64-bit store/load instructions to save/restore the link register.  Make
sure that the general-purpose register 31 and the link register storage areas
do not overlap.

2 years agoCygwin: stop handling files with .com suffix like .exe files
Corinna Vinschen [Fri, 28 Oct 2022 10:42:51 +0000 (12:42 +0200)]
Cygwin: stop handling files with .com suffix like .exe files

.com is a remnant from the past.  There are only five executables
left:

  chcp.com
  format.com
  mode.com
  more.com
  tree.com

Calling them on the command line already requires to use the
suffix anyway.  So drop useless .com test from the execve test
for scripts (they are handled earlier in the same function
as executables) and do not handle them like .exe suffixes in
other functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoRevert "Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'"
Corinna Vinschen [Fri, 28 Oct 2022 10:24:31 +0000 (12:24 +0200)]
Revert "Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'"

This reverts commit 7589034cc3151bfac8cc3d3af5e91402a78e160b.

The previous commit 14816de9af69 ("Cygwin: spawn: drop special handling
for cmd.exe and command.com") make this patch unnecessary.  The filename
argument (i. e., run_path in the caller) is now always non-NULL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: spawn: drop special handling for cmd.exe and command.com
Corinna Vinschen [Fri, 28 Oct 2022 10:24:13 +0000 (12:24 +0200)]
Cygwin: spawn: drop special handling for cmd.exe and command.com

Apparently at one point handling cmd.exe and command.com special
made sense, but what that should be has never been documented.
There's also no clear reason why cmd.exe is different from any
other native executable.  Additionaly, checking for command.com
is entirely useless on 64 bit Windows anyway.

Just drop this code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoFix warning during manpage generaton
Jon Turney [Thu, 27 Oct 2022 21:51:28 +0000 (22:51 +0100)]
Fix warning during manpage generaton

> ERROR: xref linking to Stubs has no generated link text.
> Error: no ID for constraint linkend: Stubs.

(Despite saying "ERROR", this is actually a warning, and manpages are
still generated)

Improve chapter-texi2docbook so it generates elements for texinfo
sections as well, so that a cross-reference to the "Stubs" section
contains a valid element ID.

2 years agoCygwin: utils: drop 32 bit considerations
Corinna Vinschen [Fri, 28 Oct 2022 09:37:02 +0000 (11:37 +0200)]
Cygwin: utils: drop 32 bit considerations

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: regtool: drop 32 bit hint from help output
Corinna Vinschen [Fri, 28 Oct 2022 09:01:56 +0000 (11:01 +0200)]
Cygwin: regtool: drop 32 bit hint from help output

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: document dropping 32 bit support
Corinna Vinschen [Thu, 27 Oct 2022 19:45:11 +0000 (21:45 +0200)]
Cygwin: document dropping 32 bit support

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoFix typo in faq-programming.xml
Hamish McIntyre-Bhatty [Wed, 26 Oct 2022 13:26:16 +0000 (14:26 +0100)]
Fix typo in faq-programming.xml

2 years agostrftime.c(__strftime): add %q, %v, tests; tweak %Z doc
Brian Inglis [Sat, 22 Oct 2022 05:13:52 +0000 (23:13 -0600)]
strftime.c(__strftime): add %q, %v, tests; tweak %Z doc

%q GNU quarter year 1-4
%v BSD/OSX/Ruby VMS/Oracle %e-%b-%Y
%Z change time zone *name* to *abbreviation*

2 years agostrptime.cc(__strptime): add %q GNU quarter
Brian Inglis [Sat, 22 Oct 2022 05:16:03 +0000 (23:16 -0600)]
strptime.cc(__strptime): add %q GNU quarter

2 years agostrptime.c(strptime_l): add %q GNU quarter
Brian Inglis [Sat, 22 Oct 2022 05:15:18 +0000 (23:15 -0600)]
strptime.c(strptime_l): add %q GNU quarter

2 years agoCygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
Takashi Yano [Sat, 22 Oct 2022 05:05:40 +0000 (14:05 +0900)]
Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'

- If the command executed is 'cmd.exe /c [...]', runpath in spawn.cc
  will be NULL. In this case, is_console_app(runpath) check causes
  access violation. This case also the command executed is obviously
  console app., therefore, treat it as console app to fix this issue.

  Addresses: https://github.com/msys2/msys2-runtime/issues/108

2 years agolibgloss: riscv: Install machine/syscall.h
Simon Cook [Tue, 18 Oct 2022 19:48:56 +0000 (21:48 +0200)]
libgloss: riscv: Install machine/syscall.h

A recent change to the Makefile.in for riscv resulted in the
machine/syscall.h header not being installed. This updates the file
to install this file again.

Signed-off-by: Simon Cook <simon.cook@embecosm.com>
2 years agoCygwin: select: don't report read ready on a FIFO never opened for writing
Ken Brown [Fri, 23 Sep 2022 14:24:04 +0000 (10:24 -0400)]
Cygwin: select: don't report read ready on a FIFO never opened for writing

According to POSIX and the Linux man page, select(2) is supposed to
report read ready if a file is at EOF.  In the case of a FIFO, this
means that the pipe is empty and there are no writers.  But there
seems to be an undocumented exception, observed on Linux and other
platforms:  If no writer has ever been opened, then select(2) does not
report read ready.  This can happen if a reader is opened with
O_NONBLOCK before any writers have opened.

This commit makes Cygwin consistent with those other platforms by
introducing a special EOF test, fhandler_fifo::select_hit_eof, which
returns false if there's never been a writer opened.

To implement this we use a new variable '_writer_opened' in the FIFO's
shared memory, which is set to 1 the first time a writer opens.  New
methods writer_opened() and set_writer_opened() are used to test and
set this variable.

Addresses: https://cygwin.com/pipermail/cygwin/2022-September/252223.html

2 years agoRerun automake in newlib/
Szabolcs Nagy [Wed, 28 Sep 2022 14:32:53 +0000 (15:32 +0100)]
Rerun automake in newlib/

newlib/libc/sys/arm/Makefile.inc was modified but automake was not rerun in

  commit 5230eb7f8c6b43c71d7e38d138935c48de930b76
  Implement sysconf for Arm

on arm-none-eabi target this caused

  ld: B/arm-none-eabi/lib/libg.a(libc_a-mallocr.o): in function `malloc_extend_top':
  S/newlib-cygwin/newlib/libc/stdlib/_mallocr.c:2161: undefined reference to `sysconf'

2 years agoFix missing extern C statement
Markus B. Moessner [Mon, 26 Sep 2022 17:20:08 +0000 (19:20 +0200)]
Fix missing extern C statement

2 years agopowerpc/setjmp: Add 64-bit support
Sebastian Huber [Thu, 22 Sep 2022 07:19:57 +0000 (09:19 +0200)]
powerpc/setjmp: Add 64-bit support

Use 64-bit store/load instructions to save/restore the general-purpose
registers.

2 years agoImplement sysconf for Arm
Jeff Johnston [Fri, 16 Sep 2022 20:04:21 +0000 (16:04 -0400)]
Implement sysconf for Arm

- add support for using sysconf to get page size in _mallocr.c via
  HAVE_SYSCONF_PAGESIZE flag set in configure.host
- set flag in configure.host for arm and add a default sysconf implementation
  in libc/sys/arm that returns the page size
- the default implementation can be overridden outside newlib to allow a
  different page size to improve malloc on devices with a small footprint
  without needing to rebuild newlib
- this patch is based on a contribution from Torbjorn Svensson and
  Niklas Dahlquist (https://ecos.sourceware.org/ml/newlib/current/017616.html)

2 years agoupstream OpenBSD: arc4random: fix indent
tb [Sun, 31 Jul 2022 13:41:45 +0000 (13:41 +0000)]
upstream OpenBSD: arc4random: fix indent

2 years agoupstream OpenBSD: arc4random: Randomise the rekey interval a little.
djm [Sun, 31 Jul 2022 05:10:36 +0000 (05:10 +0000)]
upstream OpenBSD: arc4random: Randomise the rekey interval a little.

Previously, the chacha20 instance would be rekeyed every 1.6MB. This
makes it happen at a random point somewhere in the 1-2MB range.

Feedback deraadt@ visa@, ok tb@ visa@

newlib port: Make REKEY_BASE depend on SIZE_MAX
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoupstream OpenBSD: arc4random: Remove unused ivbits argument from chacha_keysetup
dtucker [Mon, 28 Feb 2022 21:56:29 +0000 (21:56 +0000)]
upstream OpenBSD: arc4random: Remove unused ivbits argument from chacha_keysetup

to match other instances in the tree. ok deraadt@

2 years agoupstream OpenBSD: arc4random: replace abort() with _exit()
deraadt [Sun, 24 Mar 2019 17:56:54 +0000 (17:56 +0000)]
upstream OpenBSD: arc4random: replace abort() with _exit()

In the incredibly unbelievable circumstance where _rs_init() fails to
allocate pages, don't call abort() because of corefile data leakage
concerns, but simply _exit(). The reasoning is _rs_init() will only fail
if someone finds a way to apply specific pressure against this failure
point, for the purpose of leaking information into a core which they can
read. We don't need a corefile in this instance to debug that. So take
this "lever" away from whoever in the future wants to do that.

2 years agoupstream OpenBSD: arc4random: bump file versions
Corinna Vinschen [Sun, 13 Sep 2015 08:31:47 +0000 (08:31 +0000)]
upstream OpenBSD: arc4random: bump file versions

This hides a patch not required in newlib

2 years agoupstream OpenBSD: arc4random: Add support for building arc4random with MSVC.
bcook [Thu, 10 Sep 2015 18:53:50 +0000 (18:53 +0000)]
upstream OpenBSD: arc4random: Add support for building arc4random with MSVC.

By default, MSVC's stdlib.h defines min(), so we need to spell out something
less common to avoid picking it up.

ok deraadt@ beck@ miod@

2 years agoCygwin: cygtls: drop useless alignment directives
Corinna Vinschen [Mon, 5 Sep 2022 17:49:11 +0000 (19:49 +0200)]
Cygwin: cygtls: drop useless alignment directives

The patch fixing the alignment of _cygtls::context accidentally
pushed the desperate attempt to automate the alignment by using
another, non-working variation of attribute((aligned)).  Drop it.

Fixes: dcab768cb93e ("Cygwin: cygtls: fix context alignment")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoDon't allocate another header when merging chunks
Torbjörn SVENSSON [Tue, 30 Aug 2022 13:56:26 +0000 (15:56 +0200)]
Don't allocate another header when merging chunks

In the nano version of malloc, when the last chunk is to be extended,
there is no need to acount for the header again as it's already taken
into account in the overall "alloc_size" at the beginning of the
function.

Contributed by STMicroelectronics

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 years agoUsed chunk needs to be removed from free_list
Torbjörn SVENSSON [Tue, 30 Aug 2022 13:56:25 +0000 (15:56 +0200)]
Used chunk needs to be removed from free_list

When using nano malloc and the remaning heap space is not big enough to
fullfill the allocation, malloc will attempt to merge the last chunk in
the free list with a new allocation in order to create a bigger chunk.
This is successful, but the chunk still remains in the free_list, so
any later call to malloc can give out the same region without it first
being freed.

Possible sequence to verify:

void *p1 = malloc(3000);
void *p2 = malloc(4000);
void *p3 = malloc(5000);
void *p4 = malloc(6000);
void *p5 = malloc(7000);
free(p2);
free(p4);
void *p6 = malloc(35000);
free(p6);
void *p7 = malloc(42000);
void *p8 = malloc(32000);

Without the change, p7 and p8 points to the same address.
Requirement, after malloc(35000), there is less than 42000 bytes
available on the heap.

Contributed by STMicroelectronics

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 years agoFix some Coverity Scan errors.
Jeff Johnston [Wed, 31 Aug 2022 19:18:08 +0000 (15:18 -0400)]
Fix some Coverity Scan errors.

2 years agoRestore _lock initialization in non-single threaded mode
Torbjörn SVENSSON [Tue, 30 Aug 2022 13:54:53 +0000 (15:54 +0200)]
Restore _lock initialization in non-single threaded mode

When __SINGLE_THREAD__ is not defined, stdin, stdout and stderr needs
to have their _lock instance initialized. The __sfp() method is not
invoked for the 3 mentioned fds thus, the std() method needs to handle
the initialization of the lock.

This is more or less a revert of 382550072b49430f8c69adee937a0ba07bd385e6

Contributed by STMicroelectronics

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 years agoCygwin: testsuite: Add x86_64 code to "dynamically load cygwin" test
Jon Turney [Thu, 26 Nov 2020 16:50:43 +0000 (16:50 +0000)]
Cygwin: testsuite: Add x86_64 code to "dynamically load cygwin" test

This still needs some more voudou to actually work.

Also update how-cygtls-works.txt a bit

2 years agoCygwin: testsuite: In pathconf01 use the temporary directory instead of "/tmp"
Jon Turney [Fri, 27 Nov 2020 15:18:37 +0000 (15:18 +0000)]
Cygwin: testsuite: In pathconf01 use the temporary directory instead of "/tmp"

In pathconf01 use the temporary directory, instead of "/tmp" (which may not exist).

This page took 0.07801 seconds and 5 git commands to generate.