]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agoCygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c
Jon Turney [Thu, 19 Nov 2020 21:38:47 +0000 (21:38 +0000)]
Cygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c

This has an separate, explicit compilation rule which omits CXXFLAGS, so
expected flags like '-g -O2' aren't being used.

3 years agoCygwin: Drop libgmon.a build dependency on gcrt0.o
Jon Turney [Thu, 19 Nov 2020 21:34:44 +0000 (21:34 +0000)]
Cygwin: Drop libgmon.a build dependency on gcrt0.o

libgmon.a depends on gcrt0.o, but doesn't include it.

3 years agoCygwin: pty: Fix minor style issue.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:04 +0000 (20:03 +0900)]
Cygwin: pty: Fix minor style issue.

3 years agoCygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:03 +0000 (20:03 +0900)]
Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.

- If vim is executed in WSL in mintty, some garbage string caused
  by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
  fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
  output.

3 years agoCygwin: pty: Fix a bug in the code removing "CSI > Pm m".
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:02 +0000 (20:03 +0900)]
Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".

- The code added by 8121b606e843c001d5ca5213d24099e04ebc62ca has a
  bug which fails to remove multiple "CSI > Pm m" sequences. This
  patch fixes the bug.

3 years agoCygwin: Remove surplus autoconf auxiliary files
Jon Turney [Wed, 21 Oct 2020 19:41:58 +0000 (20:41 +0100)]
Cygwin: Remove surplus autoconf auxiliary files

Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.

(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)

3 years agoCygwin: Remove recursive configure
Jon Turney [Tue, 6 Oct 2020 15:22:02 +0000 (16:22 +0100)]
Cygwin: Remove recursive configure

There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.

Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.

Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.

Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory.  (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).

Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.

Remove generated configure and aclocal.m4 in subdirectories.

3 years agoCygwin: fhandler_fifo::cleanup_handlers: improve efficiency
Ken Brown [Thu, 19 Nov 2020 20:22:56 +0000 (15:22 -0500)]
Cygwin: fhandler_fifo::cleanup_handlers: improve efficiency

Traverse the fifo_client_handler list from the top down to try to
avoid copying.

3 years agoCygwin: Testsuite Makefile cleanup
Jon Turney [Thu, 12 Nov 2020 15:40:44 +0000 (15:40 +0000)]
Cygwin: Testsuite Makefile cleanup

Drop unused variables CC_FOR_TARGET, GCC_INCLUDE, ALL_CFLAGS
Stop exporting CC, CFLAGS
Drop unused, empty targets force, dll_ofiles, all_target

3 years agoCygwin: Fix 'make check' in utils
Jon Turney [Thu, 12 Nov 2020 14:56:09 +0000 (14:56 +0000)]
Cygwin: Fix 'make check' in utils

This has a test of the path translation code used in various utilities
(mount, cygpath, strace).

MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.

> $ make check
[...]
> total tests: 63
> pass       : 63 (100.0%)
> fail       : 0 (0.0%)

3 years agoCygwin: Drop duplicate C++ flags used to build utils
Jon Turney [Wed, 11 Nov 2020 14:03:58 +0000 (14:03 +0000)]
Cygwin: Drop duplicate C++ flags used to build utils

'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.

3 years agoCygwin: Use grep in text mode to look for version strings
Jon Turney [Wed, 28 Oct 2020 20:59:53 +0000 (20:59 +0000)]
Cygwin: Use grep in text mode to look for version strings

Invoke grep in text mode when looking for version strings inside the
cygwin DLL, so it outputs something more informative than:

  Binary file ../cygwin/cygwin0.dll matches

3 years agoRISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and...
Kito Cheng [Wed, 18 Nov 2020 03:35:43 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and llround[f].

3 years agoRISC-V: Add machine-specific implementation for isnan[f] and copysign[f]
Kito Cheng [Wed, 18 Nov 2020 03:35:42 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for isnan[f] and copysign[f]

3 years agoRISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c
Kito Cheng [Wed, 18 Nov 2020 03:35:41 +0000 (11:35 +0800)]
RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c

3 years agomalloc/nano-malloc: correctly check for out-of-bounds allocation reqs
Corinna Vinschen [Tue, 17 Nov 2020 09:50:57 +0000 (10:50 +0100)]
malloc/nano-malloc: correctly check for out-of-bounds allocation reqs

The overflow check in mEMALIGn erroneously checks for INT_MAX,
albeit the input parameter is size_t.  Fix this to check for
__SIZE_MAX__ instead.  Also, it misses to check the req against
adding the alignment before calling mALLOc.

While at it, add out-of-bounds checks to pvALLOc, nano_memalign,
nano_valloc, and Cygwin's (unused) dlpvalloc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoFix return type of __locale_ctype_ptr_l()
Sebastian Huber [Mon, 16 Nov 2020 13:38:22 +0000 (14:38 +0100)]
Fix return type of __locale_ctype_ptr_l()

This prevents warnings like this:

ctype.h:118:9: warning: return discards 'const' qualifier from pointer
  target type

3 years agoCygwin: testsuite: fix insecure usage of printf in libltp
Corinna Vinschen [Mon, 16 Nov 2020 14:55:15 +0000 (15:55 +0100)]
Cygwin: testsuite: fix insecure usage of printf in libltp

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agolibc/include/newlib.h: Fix C++ compilation issue
Joel Sherrill [Mon, 9 Nov 2020 21:33:02 +0000 (15:33 -0600)]
libc/include/newlib.h: Fix C++ compilation issue

3 years agoCygwin: path_conv::eq_worker: add NULL pointer checks
Ken Brown [Sat, 14 Nov 2020 14:02:43 +0000 (09:02 -0500)]
Cygwin: path_conv::eq_worker: add NULL pointer checks

Don't call cstrdup on NULL pointers.

This fixes a crash that was observed when cloning an fhandler whose
path_conv member had freed its strings.

3 years agoCygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix
Jon Turney [Mon, 9 Nov 2020 13:48:38 +0000 (13:48 +0000)]
Cygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix

3 years agoCygwin: fhandler_fifo: reduce size
Ken Brown [Sun, 8 Nov 2020 17:02:39 +0000 (12:02 -0500)]
Cygwin: fhandler_fifo: reduce size

Replace the 'WCHAR pipe_name_buf[48]' class member by 'PWCHAR
pipe_name_buf', and allocate space for the latter as needed.

Change the default constructor to accommodate this change, and add a
destructor that frees the allocated space.

Also change get_pipe_name and clone to accommodate this change.

3 years agoCygwin: Ensure temporary directory used by tests exists
Jon Turney [Thu, 29 Oct 2020 14:43:32 +0000 (14:43 +0000)]
Cygwin: Ensure temporary directory used by tests exists

By default, libltp tests will create temporary files in a subdirectory
of /tmp, which will (nowadays) be located relative to the test DLL (by
assuming that it is in /bin).  This will evaluate to the directory
$target_builddir/winsup/tmp, which doesn't exist.

The location used for these temporary files can be explicitly controlled
by setting the TDIRECTORY env var.  Arrange to set that env var to the
/cygdrive path of a tmp subdirectory of the build directory.

Unfortunately, libltp doesn't clean the temporary directory if
TDIRECTORY is set, and some tests assume they are started in a clean
directory, so we need to do that in tcl.

3 years agoCygwin: Set PATH for tests to pick up cygwin0.dll
Jon Turney [Wed, 28 Oct 2020 16:14:55 +0000 (16:14 +0000)]
Cygwin: Set PATH for tests to pick up cygwin0.dll

Set the PATH so that tests can pick up cygwin0.dll.  Looks like this was
dropped by accident in 2e488e95 ("Don't rely on in-build tools"), so
restore it as it was prior to 9d89f634.

3 years agoCygwin: Check exit code of a test, rather than stdout
Jon Turney [Fri, 16 Oct 2020 23:36:26 +0000 (00:36 +0100)]
Cygwin: Check exit code of a test, rather than stdout

In winsup.exp, don't consider a command failed if it produced any output
(e.g. if the compiler produced warnings).  Instead check the exit code.

3 years agoCygwin: Use absolute path to libltp includes
Jon Turney [Wed, 28 Oct 2020 20:20:27 +0000 (20:20 +0000)]
Cygwin: Use absolute path to libltp includes

Use an absolute path to libltp includes, to allow for the fact that
we'll be compiling tests in a subdirectory.

3 years agoCygiwn: Detect and use MinGW compilers for testsuite wrappers
Jon Turney [Wed, 28 Oct 2020 19:22:56 +0000 (19:22 +0000)]
Cygiwn: Detect and use MinGW compilers for testsuite wrappers

Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.

This requires adding AC_CANONICAL_TARGET, to set $target_cpu.

3 years agoCygwin: Define target_builddir autoconf and Makefile variables
Jon Turney [Wed, 28 Oct 2020 19:11:02 +0000 (19:11 +0000)]
Cygwin: Define target_builddir autoconf and Makefile variables

This is now required as cygwin_build is defined in terms of
target_builddir.

(Note that in other subdirectories, the autoconf variable
target_builddir is AC_SUBST-ed as a side-effect of using a macro from
winsup/acinclude.m4, which is perhaps less than ideal)

3 years agoCygwin: Move adding libltp to VPATH after Makefile.common
Jon Turney [Wed, 28 Oct 2020 16:42:09 +0000 (16:42 +0000)]
Cygwin: Move adding libltp to VPATH after Makefile.common

Move adding libltp to the VPATH after Makefile.common, which sets VPATH.

3 years agoCygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning
Jon Turney [Tue, 3 Nov 2020 14:50:40 +0000 (14:50 +0000)]
Cygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning

Avoid a 'Makefile.in seems to ignore the --datarootdir setting' warning
when configuring in testsuite directory.

3 years agoCygwin: Add rule to testsuite Makefile to regenerate it when needed
Jon Turney [Mon, 2 Nov 2020 21:53:37 +0000 (21:53 +0000)]
Cygwin: Add rule to testsuite Makefile to regenerate it when needed

3 years agoCygwin: Always configure in testsuite subdirectory
Jon Turney [Wed, 28 Oct 2020 17:02:40 +0000 (17:02 +0000)]
Cygwin: Always configure in testsuite subdirectory

Doing this properly using AC_CONFIG_SUBDIRS is necessary to get the
correct paths in flags given to the compiler specified in CC/CXX.

3 years agoCygwin: Add testsuite directory to autogen.sh
Jon Turney [Mon, 2 Nov 2020 21:45:07 +0000 (21:45 +0000)]
Cygwin: Add testsuite directory to autogen.sh

Also remove unneeded aclocal.m4 for an old aclocal version.

4 years agoCygwin: FIFO: update_my_handlers: fix handle leak
Ken Brown [Fri, 6 Nov 2020 13:16:45 +0000 (08:16 -0500)]
Cygwin: FIFO: update_my_handlers: fix handle leak

4 years agoFix 32-bit integer overflow when calculating TZ rules
Ivan Grokhotov [Wed, 4 Nov 2020 18:30:58 +0000 (13:30 -0500)]
Fix 32-bit integer overflow when calculating TZ rules

4 years agoCygwin: Drop passing '-c' compiler flag into gentls_offsets
Jon Turney [Mon, 26 Oct 2020 17:53:06 +0000 (17:53 +0000)]
Cygwin: Drop passing '-c' compiler flag into gentls_offsets

That script appends a '-E', since we only use $(CC) to preprocess, and
thus adding '-c' is having no effect.

4 years agoCygwin: Remove rules for building libcygwin_s.a
Jon Turney [Mon, 26 Oct 2020 17:51:32 +0000 (17:51 +0000)]
Cygwin: Remove rules for building libcygwin_s.a

Untouched since added in 66a83f3e, and described as 'non-working'.

4 years agoCygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined
Jon Turney [Mon, 26 Oct 2020 17:48:17 +0000 (17:48 +0000)]
Cygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined

4 years agoCygwin: Drop autoconf variable all_host
Jon Turney [Mon, 26 Oct 2020 13:56:51 +0000 (13:56 +0000)]
Cygwin: Drop autoconf variable all_host

The autoconf variable all_host is used to make building of the stub
library used by the testsuite conditional on not cross-compiling.

Make it unconditional, so we will notice if it's broken when
cross-compiling.

4 years agoCygwin: Remove autoconf variable DLL_NAME
Jon Turney [Fri, 23 Oct 2020 14:33:39 +0000 (15:33 +0100)]
Cygwin: Remove autoconf variable DLL_NAME

Remove autoconf variable DLL_NAME, which has a constant value which is
only used in one place.

4 years agoCygwin: Drop AC_SUBST(build_exeext)
Jon Turney [Wed, 21 Oct 2020 18:59:26 +0000 (19:59 +0100)]
Cygwin: Drop AC_SUBST(build_exeext)

The autoconf variable build_exeext isn't defined, and (since the doc
subdirectory doesn't build any executables) it's value isn't used.

4 years agoCygwin: Remove intro2man.stamp on clean
Jon Turney [Wed, 21 Oct 2020 17:26:58 +0000 (18:26 +0100)]
Cygwin: Remove intro2man.stamp on clean

4 years agoRevert "Cygwin: gendef generates sigfe.s and cygwin.def"
Jon Turney [Wed, 28 Oct 2020 15:31:27 +0000 (15:31 +0000)]
Revert "Cygwin: gendef generates sigfe.s and cygwin.def"

This reverts commit 74a164f1c162645f4389bbd9edb2f89a630853af.

Shame we can't use '&:' for a grouped target here, since that requires
GNU make 4.3

4 years agoRISC-V: Fix wrong including file in s_isinf.c
Kito Cheng [Wed, 28 Oct 2020 15:41:27 +0000 (23:41 +0800)]
RISC-V: Fix wrong including file in s_isinf.c

4 years agoRISC-V: NaN should return 0 for finite[f]
Kito Cheng [Wed, 28 Oct 2020 15:41:26 +0000 (23:41 +0800)]
RISC-V: NaN should return 0 for finite[f]

4 years agoCygwin: Restore setting CC and CXX Makefile variables
Jon Turney [Tue, 27 Oct 2020 15:31:06 +0000 (15:31 +0000)]
Cygwin: Restore setting CC and CXX Makefile variables

b55e3f19 was a bit too aggressive in dropping, rather than just
un-exporting these Makefile variables.  We need to set these to the
configured host compiler if we are cross-compiling, otherwise they
default to the build compiler.

Also export CC to the mkvers.sh script (which requires it since
4eca5e6a).  It's unclear why we can't just cause windres to use the
build 'cpp' as the pre-processor there.

4 years agolibc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMS
Joel Sherrill [Tue, 27 Oct 2020 19:07:08 +0000 (14:07 -0500)]
libc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMS

This type needs to be able to represent a position on a disk or
file system.

4 years agoCygwin: fix return value of sqrtl on negative infinity
Ken Brown [Tue, 27 Oct 2020 13:52:48 +0000 (09:52 -0400)]
Cygwin: fix return value of sqrtl on negative infinity

The return value is now -NaN.

This fixes a bug in the mingw-w64 code that was imported into Cygwin.
The fix is consistent with Posix and Linux.  It is also consistent
with the current mingw-w64 code, with one exception: The mingw-w64
code sets errno to EDOM if the input is -NaN, but this appears to
differ from Posix and Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html

4 years agoCygwin: pty: Disable ResizePseudoConsole() if stdout is redirected.
Takashi Yano via Cygwin-patches [Tue, 27 Oct 2020 08:26:34 +0000 (17:26 +0900)]
Cygwin: pty: Disable ResizePseudoConsole() if stdout is redirected.

- Calling ResizePseudoConsole() generates some escape sequences.
  Due to this behaviour, if the output of non-cygwin app is piped
  to less, screen is sometimes distorted when the screen is resized.
  With this patch, ResizePseudoConsole() is not called if stdout is
  redirected.

4 years agoRISC-V: Implment finite and fpclassify
Kito Cheng [Tue, 27 Oct 2020 06:19:58 +0000 (14:19 +0800)]
RISC-V: Implment finite and fpclassify

4 years agoRISC-V: Add fabs[f], fmax[f] and fmin[f].
Kito Cheng [Tue, 27 Oct 2020 06:19:57 +0000 (14:19 +0800)]
RISC-V: Add fabs[f], fmax[f] and fmin[f].

4 years agoDefine RB_SET_PARENT to do all assignments
dougm [Tue, 23 Jun 2020 20:02:55 +0000 (20:02 +0000)]
Define RB_SET_PARENT to do all assignments

to rb parent pointers. Define RB_SWAP_CHILD to replace the child of a parent
with its twin, and use it in 4 places. Use RB_SET in rb_link_node to remove the
only linuxkpi reference to color, and then drop color- and parent-related
definitions that are defined and used only in rbtree.h.

This is intended to be entirely cosmetic, with no impact on program
behavior, and leave RB_PARENT and RB_SET_PARENT as the only ways to
read and write rb parent pointers.

Reviewed by: markj, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25264

4 years agoIn concluding RB_REMOVE_COLOR, in the case when
dougm [Sat, 20 Jun 2020 20:25:39 +0000 (20:25 +0000)]
In concluding RB_REMOVE_COLOR, in the case when

the sibling of the root of the too-short tree is black and at least one of the
children of that sibling is red, either one or two rotations finish the
rebalancing. In the case when both of the children are red, the current
implementation uses two rotations where only one is necessary. This change
removes that extra rotation, and in that case also removes a needless
black-to-red-to-black recoloring.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25335

4 years agoLinuxkpi uses the rb-tree structures
dougm [Sat, 13 Jun 2020 01:54:09 +0000 (01:54 +0000)]
Linuxkpi uses the rb-tree structures

without using their interfaces, making them break when the representation
changes. Revert changes that eliminated the color field from rb-trees, leaving
everything as it was before.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25250

4 years agoFixup r361997 by balancing parens. Duh.
dougm [Wed, 10 Jun 2020 03:36:17 +0000 (03:36 +0000)]
Fixup r361997 by balancing parens. Duh.

4 years agoRestore an RB_COLOR macro, for the benefit of
dougm [Wed, 10 Jun 2020 02:50:25 +0000 (02:50 +0000)]
Restore an RB_COLOR macro, for the benefit of

a bit of DIAGNOSTIC code that depends on it.

Reported by: rpokala, mjguzik
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25204

4 years agoTo reduce the size of an rb_node, drop the color
dougm [Tue, 9 Jun 2020 20:19:11 +0000 (20:19 +0000)]
To reduce the size of an rb_node, drop the color

field. Set the least significant bit in the pointer to the node from its parent
to indicate that the node is red. Have the tree rotation macros leave the
old-parent/new-child node red and the new-parent/old-child node black.

This change makes RB_LEFT and RB_RIGHT no longer assignable, and
RB_COLOR no longer defined. Any code that modifies the tree or
examines a node color would have to be modified after this change.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25105

4 years agoRemove from RB_REMOVE_COLOR some null checks
dougm [Tue, 2 Jun 2020 17:18:16 +0000 (17:18 +0000)]
Remove from RB_REMOVE_COLOR some null checks

where the pointer checked is provably never null. Restructure the surrounding
code just enough to make the non-nullness obvious.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25089

4 years agoRB_REMOVE invokes RB_REMOVE_COLOR either when
dougm [Sat, 30 May 2020 01:48:12 +0000 (01:48 +0000)]
RB_REMOVE invokes RB_REMOVE_COLOR either when

child is red or child is null. In the first case, RB_REMOVE_COLOR just changes
the child to black and returns. With this change, RB_REMOVE handles that case,
and drops the child argument to RB_REMOVE_COLOR, since that value is always
null.

RB_REMOVE_COLOR is changed to remove a couple of unneeded tests, and
to eliminate some deep indentation.

RB_ISRED is defined to combine a null check with a test for redness,
to replace that combination in several places.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25032

4 years agoFor the case when RB_REMOVE requires a nontrivial
dougm [Thu, 21 May 2020 05:34:02 +0000 (05:34 +0000)]
For the case when RB_REMOVE requires a nontrivial

search to find the node to replace the one being removed, restructure to first
remove the replacement node and correct the parent pointers around it, and then
let the all-cases code at the end deal with the parent of the deleted node,
making it point to the replacement node. This removes one or two conditional
branches.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D24845

4 years agoCorrect the use of RB_AUGMENT in the RB_TREE
dougm [Mon, 27 Jan 2020 15:09:13 +0000 (15:09 +0000)]
Correct the use of RB_AUGMENT in the RB_TREE

macros so that is invoked at the root of every subtree that changes in an
insert or delete, and only once, and ordered from the bottom of the tree to the
top. For intel_gas.c, the only user of RB_AUGMENT I can find, change the
augmenting routine so that it does not climb from entry to tree root on every
call, and remove a 'tree correcting' function that can be supplanted by proper
tree augmentation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23189

4 years agoAdd RB_REINSERT(3), a low overhead alternative to
trasz [Sat, 28 Sep 2019 09:22:52 +0000 (09:22 +0000)]
Add RB_REINSERT(3), a low overhead alternative to

removing a node and reinserting it back with an updated key.

This is one of dependencies for the upcoming stats(3) code.

Reviewed by: cem
Obtained from: Netflix
MFC after: 2 weeks
Sponsored by: Klara Inc, Netflix
Differential Revision: https://reviews.freebsd.org/D21786

4 years agoamd64: prevent KCSan false positives on LAPIC mapping
jah [Sat, 12 Sep 2020 07:04:00 +0000 (07:04 +0000)]
amd64: prevent KCSan false positives on LAPIC mapping

For configurations without x2APIC support (guests, older hardware), the global
LAPIC MMIO mapping will trigger false-positive KCSan reports as it will appear
that multiple CPUs are concurrently reading and writing the same address.
This isn't actually true, as the underlying physical access will be performed
on the local CPU's APIC. Additionally, because LAPIC access can happen during
event timer configuration, the resulting KCSan printf can produce a panic due
to attempted recursion on event timer resources.

Add a __nosanitizethread preprocessor define to prevent the compiler from
inserting TSan hooks, and apply it to the x86 LAPIC accessors.

PR: 249149
Reported by: gbe
Reviewed by: andrew, kib
Tested by: gbe
Differential Revision: https://reviews.freebsd.org/D26354

4 years agosys: clean up empty lines in .c and .h files
mjg [Tue, 1 Sep 2020 22:12:58 +0000 (22:12 +0000)]
sys: clean up empty lines in .c and .h files

4 years agogcc: quiet Wattribute for no_sanitize("address")
rlibby [Sat, 21 Dec 2019 02:43:20 +0000 (02:43 +0000)]
gcc: quiet Wattribute for no_sanitize("address")

This is an unfortunate instance where the __has_attribute check does
not function usefully.  Gcc does have the attribute, but for gcc it only
applies to functions, not variables, and trying to apply it to a
variable generates Wattribute.  So far we only apply the attribute to
variables.  Only enable the attribute for clang, for now.

Reviewed by: Anton Rang <rang at acm.org>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22875

4 years agoDon't sanitize linker_set
dab [Tue, 19 Nov 2019 14:46:28 +0000 (14:46 +0000)]
Don't sanitize linker_set

The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib, rang_acm.org
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22239

4 years agoMake the system C11 atomics headers fully compatible with external GCC.
jhb [Mon, 6 Aug 2018 23:51:08 +0000 (23:51 +0000)]
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585

4 years agoCygwin: pty: Fix race condition in initialization of pseudo console.
Takashi Yano via Cygwin-patches [Mon, 26 Oct 2020 08:29:31 +0000 (17:29 +0900)]
Cygwin: pty: Fix race condition in initialization of pseudo console.

- If output of non-cygwin process is piped to cygwin process, such
  as less, the non-cygwin process sometimes fails to start and hangs.
  This patch fixes the issue.

4 years agoCygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support
Ken Brown via Cygwin-patches [Mon, 12 Oct 2020 18:02:13 +0000 (14:02 -0400)]
Cygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support

If MSG_WAITALL is set, recv_internal calls WSARecv or WSARecvFrom in a
loop, in an effort to fill all the scatter-gather buffers.  The test
for whether all the buffers are full was previously incorrect.

4 years agoCygwin: Drop do-nothing install_target target
Jon Turney [Mon, 19 Oct 2020 13:34:35 +0000 (14:34 +0100)]
Cygwin: Drop do-nothing install_target target

4 years agoCygwin: Drop do-nothing install_host target
Jon Turney [Fri, 16 Oct 2020 14:06:43 +0000 (15:06 +0100)]
Cygwin: Drop do-nothing install_host target

Drop do-nothing install_host target, which is only used when not
cross-compiling.

4 years agoCygwin: Remove nostdlib Makefile variable
Jon Turney [Sat, 3 Oct 2020 20:39:40 +0000 (21:39 +0100)]
Cygwin: Remove nostdlib Makefile variable

It's used in one place, and it's value is unconditional.

4 years agoCygwin: gendef generates sigfe.s and cygwin.def
Jon Turney [Mon, 12 Oct 2020 15:59:02 +0000 (16:59 +0100)]
Cygwin: gendef generates sigfe.s and cygwin.def

Express that gendef generates sigfe.s and cygwin.def in a slightly less
nutty way.

4 years agoCygwin: Drop cygwin version.o from cygserver
Jon Turney [Mon, 12 Oct 2020 15:50:18 +0000 (16:50 +0100)]
Cygwin: Drop cygwin version.o from cygserver

The data it contains isn't referenced since 9e9bc3a4.

4 years agoCygwin: Remove lsaauth
Jon Turney [Mon, 12 Oct 2020 13:47:22 +0000 (14:47 +0100)]
Cygwin: Remove lsaauth

Remove lsaauth, not built since 2741dd05.

4 years agoCygwin: Use aclocal option --system-acdir rather than --acdir
Jon Turney [Thu, 15 Oct 2020 17:47:36 +0000 (18:47 +0100)]
Cygwin: Use aclocal option --system-acdir rather than --acdir

In autogen.sh, use 'aclocal --system-acdir' rather than 'aclocal --acdir'.

'--acdir' was deprecated in automake 1.11 and removed in automake 1.13.

4 years agoCygwin: Remove --with-windows-{libs,headers}
Jon Turney [Wed, 14 Oct 2020 15:49:45 +0000 (16:49 +0100)]
Cygwin: Remove --with-windows-{libs,headers}

4 years agoCygwin: Remove ccwrap
Jon Turney [Sat, 3 Oct 2020 13:41:58 +0000 (14:41 +0100)]
Cygwin: Remove ccwrap

ccwrap massages the compiler's standard include directories to remove
'/usr/include/w32api', with the intent of allowing it to be overriden by
'--with-windows-headers' (See 4c36016b).

I'm not 100% convinced that this is always working as desired, since in
some places w32api includes are done using <w32api/something.h>, which
will find them via the path /usr/include.

If this does turn out to be needed, this could also be implemented by
constructing the appropriate compiler flags once, rather than on every
compiler invocation.

4 years agoCygwin: Stop using c++wrap for MinGW-compiled utilities
Jon Turney [Thu, 16 Mar 2017 15:02:20 +0000 (15:02 +0000)]
Cygwin: Stop using c++wrap for MinGW-compiled utilities

Stop using c++wrap for MinGW-compiled utilities.

(Partially reverts 96079146)

4 years agolibc/time: Move internal newlib tz-structs into own header
Torbjörn SVENSSON via Newlib [Mon, 5 Oct 2020 12:50:13 +0000 (14:50 +0200)]
libc/time: Move internal newlib tz-structs into own header

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch moves the internal struct __tzrule_struct to its own
internal header sys/_tz_structs.h.  This is included from newlib's
time code as well as from Cygwin's localtime wrapper.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: Remove unused doc/ug-info.xml
Jon Turney [Thu, 8 Oct 2020 16:33:24 +0000 (17:33 +0100)]
Cygwin: Remove unused doc/ug-info.xml

Remove doc/ug-info.xml, not used in any document.

4 years agoCygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS
Jon Turney [Thu, 8 Oct 2020 14:41:24 +0000 (15:41 +0100)]
Cygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS

4 years agoCygwin: Remove autoconf variable INSTALL_LICENSE
Jon Turney [Wed, 7 Oct 2020 12:59:45 +0000 (13:59 +0100)]
Cygwin: Remove autoconf variable INSTALL_LICENSE

Remove autoconf variable INSTALL_LICENSE, which has a constant value
which is only used once.

4 years agoCygwin: Drop AC_SUBST(LIBSERVER)
Jon Turney [Mon, 12 Oct 2020 13:27:55 +0000 (14:27 +0100)]
Cygwin: Drop AC_SUBST(LIBSERVER)

The autoconf variable LIBSERVER isn't defined, and it's value isn't
used. (The Makefile.in contains a literal value for the name of this
library instead).

4 years agoCygwin: Remove AC_ARG_PROGRAM/program_transform_name
Jon Turney [Mon, 12 Oct 2020 13:18:17 +0000 (14:18 +0100)]
Cygwin: Remove AC_ARG_PROGRAM/program_transform_name

Not done consistently, and probably never used.

4 years agoCygwin: Remove AC_PROG_MAKE_SET
Jon Turney [Mon, 12 Oct 2020 13:12:40 +0000 (14:12 +0100)]
Cygwin: Remove AC_PROG_MAKE_SET

This is only needed if we are using an ancient make which doesn't set
${MAKE}, but we say "This makefile requires GNU make." everywhere.

It only has an effect if @SET_MAKE@ is used, which we aren't doing
consistently.

4 years agoCygwin: Drop STDINCFLAGS overrides
Jon Turney [Sat, 3 Oct 2020 15:39:38 +0000 (16:39 +0100)]
Cygwin: Drop STDINCFLAGS overrides

This used to turn off -nostdinc on a per-file basis, but has no effect
since 4c36016b5706.

4 years agoCygwin: Drop looking for w32api in winsup/w32api
Jon Turney [Fri, 25 Sep 2020 19:59:14 +0000 (20:59 +0100)]
Cygwin: Drop looking for w32api in winsup/w32api

Stop looking for w32api headers in the (no longer existent)
winsup/w32api directory (removed in commit 61746d6ae850).

4 years agoformat_proc_cpuinfo: add enqcmd cpuinfo flag
Brian Inglis [Tue, 13 Oct 2020 15:11:08 +0000 (09:11 -0600)]
format_proc_cpuinfo: add enqcmd cpuinfo flag

Add linux-next 5.9 cpuinfo flag for Intel enqcmd/s instructions:
x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions:
Work submission instruction comes in two flavors. ENQCMD can be called
both in ring 3 and ring 0 and always uses the contents of a PASID MSR
when shipping the command to the device. ENQCMDS allows a kernel driver
to submit commands on behalf of a user process. The driver supplies the
PASID value in ENQCMDS. There isn't any usage of ENQCMD in the kernel as
of now.
The CPU feature flag is shown as "enqcmd" in /proc/cpuinfo.

4 years agodrop ambiguous-wide behaviour from Unicode CJK locales
Thomas Wolff [Wed, 7 Oct 2020 16:35:54 +0000 (18:35 +0200)]
drop ambiguous-wide behaviour from Unicode CJK locales

4 years agoCygwin: AF_UNIX: open_pipe: call recv_peer_info
Ken Brown [Sun, 4 Oct 2020 15:05:33 +0000 (11:05 -0400)]
Cygwin: AF_UNIX: open_pipe: call recv_peer_info

If open_pipe is called with xchg_sock_info true, call recv_peer_info
in addition to send_sock_info.

4 years agoCygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS
Ken Brown [Sat, 3 Oct 2020 16:37:36 +0000 (12:37 -0400)]
Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS

A successful connection can be indicated by STATUS_SUCCESS or
STATUS_PIPE_CONNECTED.  Previously we were checking only for the
latter.

4 years agoCygwin: AF_UNIX: socket: set the O_RDWR flag
Ken Brown [Sun, 4 Oct 2020 14:18:54 +0000 (10:18 -0400)]
Cygwin: AF_UNIX: socket: set the O_RDWR flag

4 years agoCygwin: always recognize AF_UNIX sockets as reparse points
Ken Brown [Tue, 29 Sep 2020 20:18:15 +0000 (16:18 -0400)]
Cygwin: always recognize AF_UNIX sockets as reparse points

If __WITH_AF_UNIX is defined when Cygwin is built, then a named
AF_UNIX socket is represented by a reparse point with a
Cygwin-specific tag and GUID.  Make such files recognizable as reparse
points (but not as sockets) even if __WITH_AF_UNIX is not defined.
That way utilities such as 'ls' and 'rm' still behave reasonably.

This requires two changes:

- Define the GUID __cygwin_socket_guid unconditionally.

- Make check_reparse_point_target return PATH_REP on a reparse point
  of this type if __WITH_AF_UNIX is not defined.

4 years agoCygwin: fix handling of known reparse points that are not symlinks
Ken Brown [Mon, 28 Sep 2020 20:34:44 +0000 (16:34 -0400)]
Cygwin: fix handling of known reparse points that are not symlinks

Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed check_reparse_point_target so that it could return
a positive value on a known reparse point that is not a symlink.  But
some of the code in check_reparse_point that handles this positive
return value was executed unconditionally, when it should have been
executed only for symlinks.

As a result, posixify could be called on a buffer containing garbage,
and check_reparse_point could erroneously return a positive value on a
non-symlink.  This is now fixed so that posixify is only called if the
reparse point is a symlink, and check_reparse_point returns 0 if the
reparse point is not a symlink.

Also fix symlink_info::check to handle this last case, in which
check_reparse_point returns 0 on a known reparse point.

4 years agoCygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed
Ken Brown [Mon, 28 Sep 2020 19:57:56 +0000 (15:57 -0400)]
Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed

The following Windows system calls currently fail with
STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket:

- NtOpenFile in get_file_sd

- NtOpenFile in set_file_sd

- NtCreateFile in fhandler_base::open

Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls
when the file is a known reparse point.

4 years agolibc/include/wchar.h: Remove parameter name
Torbjörn SVENSSON [Thu, 1 Oct 2020 10:46:51 +0000 (12:46 +0200)]
libc/include/wchar.h: Remove parameter name

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'ptr' parameter name from
wint_t _getwchar_r (struct _reent *);
wint_t _getwchar_unlocked_r (struct _reent *);

to avoid possible clashes with user code in case someone uses
before including Newlib's wchar.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
4 years agolibc/include/inttypes.h: Remove parameter name
Torbjörn SVENSSON [Thu, 1 Oct 2020 10:44:43 +0000 (12:44 +0200)]
libc/include/inttypes.h: Remove parameter name

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'j' parameter name from
extern intmax_t  imaxabs(intmax_t);

to avoid possible clashes with user code in case someone uses
before including Newlib's inttypes.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
4 years agolibgloss: aarch64: Add support for Armv8-R AArch64
Alex Coplan via Newlib [Tue, 29 Sep 2020 16:27:18 +0000 (17:27 +0100)]
libgloss: aarch64: Add support for Armv8-R AArch64

This patch adds support for Armv8-R AArch64.

Armv8-R AArch64 has no EL3, so we don't set vbar_el3, and adjust the
code to set up the MPU for Armv8-R.  So build a different flavour of the
startup code to support that.

We also add a specs file that uses this alternative startup code which
can be used with Armv8-R AArch64 models.

4 years agoCygwin: avoid GCC 10 error with -Werror=narrowing
Jon Turney [Sat, 19 Sep 2020 15:15:40 +0000 (16:15 +0100)]
Cygwin: avoid GCC 10 error with -Werror=narrowing

../../../../src/winsup/cygwin/pinfo.cc: In member function 'DWORD pinfo::status_exit(DWORD)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/pinfo.cc:136:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'

../../../../src/winsup/cygwin/sigproc.cc: In member function 'DWORD child_info::proc_retry(HANDLE)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/sigproc.cc:1120:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'

NT error statuses seem to be variously DWORD (unsigned) or NTSTATUS
(signed)?  So use the one which doesn't cause problems here.

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