Commit Graph

19650 Commits

Author SHA1 Message Date
Sebastian Huber 14a1e7ce42 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
2020-11-16 19:34:30 +01:00
Corinna Vinschen 3b80191f33 Cygwin: testsuite: fix insecure usage of printf in libltp
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-11-16 15:57:31 +01:00
Joel Sherrill 302b82afee libc/include/newlib.h: Fix C++ compilation issue 2020-11-16 08:15:18 -06:00
Ken Brown 22d1ebacfc 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.
2020-11-16 08:15:31 -05:00
Jon Turney 140b0a6484
Cygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix 2020-11-12 15:30:35 +00:00
Ken Brown f505e7a032 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.
2020-11-09 08:47:29 -05:00
Jon Turney f3ed5f2fe0
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.
2020-11-08 14:42:02 +00:00
Jon Turney 9cdb799806
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.
2020-11-08 14:41:55 +00:00
Jon Turney 0c448d53e1
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.
2020-11-08 14:41:46 +00:00
Jon Turney fb967562b0
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.
2020-11-08 14:41:38 +00:00
Jon Turney e6248c2fd0
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.
2020-11-08 14:41:28 +00:00
Jon Turney 20b5e6375c
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)
2020-11-08 14:41:08 +00:00
Jon Turney 551df57fa0
Cygwin: Move adding libltp to VPATH after Makefile.common
Move adding libltp to the VPATH after Makefile.common, which sets VPATH.
2020-11-08 14:40:59 +00:00
Jon Turney 187281b711
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.
2020-11-08 14:40:47 +00:00
Jon Turney 7b65f83c22
Cygwin: Add rule to testsuite Makefile to regenerate it when needed 2020-11-08 14:40:41 +00:00
Jon Turney a7cb126b14
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.
2020-11-08 14:40:34 +00:00
Jon Turney 58ca21cf78
Cygwin: Add testsuite directory to autogen.sh
Also remove unneeded aclocal.m4 for an old aclocal version.
2020-11-08 14:40:26 +00:00
Ken Brown 26a5aff2a9 Cygwin: FIFO: update_my_handlers: fix handle leak 2020-11-06 08:16:45 -05:00
Ivan Grokhotov b7a357e92e Fix 32-bit integer overflow when calculating TZ rules 2020-11-04 13:33:36 -05:00
Jon Turney 5f3a301fd5
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.
2020-11-02 16:49:03 +00:00
Jon Turney 22d79c79b5
Cygwin: Remove rules for building libcygwin_s.a
Untouched since added in 66a83f3e, and described as 'non-working'.
2020-11-02 16:49:02 +00:00
Jon Turney a5398eaecb
Cygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined 2020-11-02 16:49:01 +00:00
Jon Turney f4bfaddb3c
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.
2020-11-02 16:49:00 +00:00
Jon Turney 29817cc41e
Cygwin: Remove autoconf variable DLL_NAME
Remove autoconf variable DLL_NAME, which has a constant value which is
only used in one place.
2020-11-02 16:48:59 +00:00
Jon Turney d555072c94
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.
2020-11-02 16:48:58 +00:00
Jon Turney 174268f4bb
Cygwin: Remove intro2man.stamp on clean 2020-11-02 16:48:57 +00:00
Jon Turney 9517e5f503
Revert "Cygwin: gendef generates sigfe.s and cygwin.def"
This reverts commit 74a164f1c1.

Shame we can't use '&:' for a grouped target here, since that requires
GNU make 4.3
2020-10-30 16:31:08 +00:00
Kito Cheng ff2c8fcfc7 RISC-V: Fix wrong including file in s_isinf.c 2020-10-29 09:39:35 +01:00
Kito Cheng 0020d2dd7c RISC-V: NaN should return 0 for finite[f] 2020-10-29 09:39:35 +01:00
Jon Turney 7fa743ca94
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.
2020-10-28 15:23:56 +00:00
Joel Sherrill fcaaf40c9d 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.
2020-10-28 09:45:21 -05:00
Ken Brown 262de3ecf0 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
2020-10-27 10:23:27 -04:00
Takashi Yano via Cygwin-patches 490d4862df 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.
2020-10-27 10:03:42 +01:00
Kito Cheng b847c83294 RISC-V: Implment finite and fpclassify 2020-10-27 08:56:30 +01:00
Kito Cheng b5f03509d1 RISC-V: Add fabs[f], fmax[f] and fmin[f]. 2020-10-27 08:56:30 +01:00
dougm 17b7dfc0b5 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
2020-10-26 14:18:46 +01:00
dougm d03eaf36dc 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
2020-10-26 14:18:46 +01:00
dougm 977a827d29 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
2020-10-26 14:18:46 +01:00
dougm 87b42171dc Fixup r361997 by balancing parens. Duh. 2020-10-26 14:18:46 +01:00
dougm e83aad1851 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
2020-10-26 14:18:46 +01:00
dougm 5b29be92e3 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
2020-10-26 14:18:46 +01:00
dougm 123df813ee 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
2020-10-26 14:18:46 +01:00
dougm 640a96a231 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
2020-10-26 14:18:46 +01:00
dougm 9db2b54571 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
2020-10-26 14:18:46 +01:00
dougm 1256d090ad 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
2020-10-26 14:18:46 +01:00
trasz fd4cbaba7a 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
2020-10-26 14:18:46 +01:00
jah 303c61925d 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
2020-10-26 14:18:46 +01:00
mjg 47efca5ac3 sys: clean up empty lines in .c and .h files 2020-10-26 14:18:46 +01:00
rlibby b9af5041bd 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
2020-10-26 14:18:46 +01:00
dab b9967c3f90 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
2020-10-26 14:18:46 +01:00