aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2018-10-11Make some standard open() flags visibleSebastian Huber1-21/+27
Make the POSIX O_CLOEXEC, O_NOFOLLOW, O_DIRECTORY, O_EXEC, and O_SEARCH open() flags available also to non-Cygwin systems. Make the BSD/glibc O_DIRECT open() flag available also to non-Cygwin systems. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-10-10newlib: Build internal strtold code only if HAVE_LONG_DOUBLE definedCorinna Vinschen2-8/+9
Commit fbace81684f8cbb80a2048c01dc545af247f5cb7 ("Import correctly working strtold from David M. Gay.") introduced two new files, strtorx.c and strtodg.c. The functions are only called from strtold.c. However, while strtold.c is only built if HAVE_LONG_DOUBLE is defined, the patch erroneously added the two new files to GENERAL_SOURCES unconditionally. Fix this by building both files only if HAVE_LONG_DOUBLE has been defined. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10newlib: strtold: use __builtin_nanl to avoid libm dependencyCorinna Vinschen1-1/+1
Commit 6c212a8b7873703c4f98c6b68579b234918be83a ("Fix strtod ("nan") and strtold ("nan") returns wrong negative NaN") introduced an unconditional dependency to nanl and, in turn, to libm. Rather than including nanl in libc as well, just call __builtin_nanl from here. Requires GCC 3.3 or later. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10Implement nanl in newlib onlyCorinna Vinschen1-0/+6
Drop Cygwin-specific nanl in favor of a generic implementation in newlib. Requires GCC 3.3 or later. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10newlib: Drop incorrect const qualifier from __loadlocale parameterCorinna Vinschen2-3/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10Add attributes to malloc-like functionsSebastian Huber4-6/+7
These attributes help static analysis tools to produce less false positives, e.g. double free warnings. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-10-08[ARM] Make _kill() a noreturn function.Christophe Lyon1-5/+8
AngelSWI_Reason_ReportException does not return accoring to the ARM documentation, so it is valid to mark _kill() as noreturn. This way, the compiler does not warn about _exit() returning a value despite being noreturn. 2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * libgloss/arm/_exit.c (_exit): Declare _kill() as noreturn. * libgloss/arm/_exit.c (_kill): Likewise. Remove the return statements. * newlib/libc/sys/arm/syscalls.c (_kill): Likewise..
2018-10-05Define _COMPILING_NEWLIB on aarch64 to define function prototypes from unistd.h.Christophe Lyon1-0/+3
2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * newlib/configure.host: Define _COMPILING_NEWLIB for aarch64.
2018-10-05 [ARM] Cast string pointers to int to avoid compiler warnings.Christophe Lyon1-4/+4
2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * newlib/libc/sys/arm/syscalls.c (_unlink): Cast 'path' to int. (_system): Cast 's' to int. (_rename): Cast 'newpath' and 'oldpath' to int.
2018-09-28Update Arm copyright notices in new math filesWilco Dijkstra26-47/+79
While working on the strstr patch I noticed several copyright headers of the new math functions are missing closing quotes after ``AS IS. I've added these. Also update spellings of Arm Ltd in a few places (but still use ARM LTD in upper case portion). Finally add SPDX identifiers to make everything consistent.
2018-09-18Fix the documentation comment of checkintSzabolcs Nagy2-2/+4
checkint in pow is not supposed to be used with 0, inf or nan inputs.
2018-09-13Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 2Hans-Peter Nilsson1-0/+6
It's been a while... I see the CRIS port broke with the time_t-default-to-64-bit change, observable by a few test-cases in the gcc fortran(!) tests failing, regressing when trying a recent newlib. This is a two-part belt-and-suspenders change: adjust the CRIS port gettimeofday syscall (the only one in newlib/CRIS passing a time_t or struct timeval) to handle a userspace 64-bit time_t and secondly default time_t to 32-bit long anyway. I considered making the local "kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t being 64 bits, but thought it not worth bothering with the few move insns. The effect of a 64-bit time_t is however observable as longer simulation time when running the gcc testsuite and as bigger binaries without any actual upside from the larger time_t size, so I thought better make the default for this port go back to being a "long" again. Tested by running the gcc testsuite over the three combinations of two parts of the patch and observing the expected changes. Committed. newlib: * configure.host (cris, crisv32): Default to "long" time_t. Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
2018-09-06search: Fix Berkeley DB hash code for 16-bit targets.Jon Beniston3-20/+32
hash.h: Use 32-bit type for data stored on disk, so code works for 16 and 64-bit targets. Reduce maximum bucket size on 16-bit targets, so it fits in available memory. hash.c: Check bucket size isn't too big for target. hash_buf.c: Fix overflow warning on 16-bit targets.
2018-09-06Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]Keith Packard3-0/+19
When __HAVE_LOCALE_INFO__ is not selected, directly access the existing _ctype_ variable from __locale_ctype_ptr() and __locale_ctype_ptr_l(), eliminating the need for any locale or reent structure Signed-off-by: Keith Packard <keithp@keithp.com> v2: locale: fix conflict with __locale_ctype_ptr macro If we are building without __HAVE_LOCALE_INFO__, there is a macro providing __locale_ctype_ptr which in turn fouls up this declaration. Signed-off-by: Michael Lyle <mlyle@lyle.org>
2018-09-06stdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_pointKeith Packard5-13/+14
The string/float conversion functions need to get the locale decimal point. Instead of calling __localeconv_l (which copies locale data into lconv form from __get_numeric_locale), use __get_numeric_locale directly. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-09-06Include sys/syslimits.h in limits.hKeith Packard1-0/+1
This makes sure any system-defined limits are specified before the defaults are checked. Without this, ARG_MAX and PATH_MAX end up getting the default definitions from limits.h rather than the defines from syslimits.h. This could potentially cause problems when different files used different values for the same name. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-09-06xdr_private.h needs sys/types.h for u_charKeith Packard1-0/+1
u_char is defined in sys/types.h, which doesn't appear to get included, at least in my environments. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-09-06Document the log table generation methodSzabolcs Nagy3-0/+74
Add comments with enough detail so the log lookup tables can be recreated.
2018-09-06stdlib/arc4random.c: Fix reseed count for 16-bit targets.Jon Beniston1-1/+1
2018-09-05Improve strstr performance of short needlesWilco Dijkstra1-10/+65
Improve strstr performance for the common case of short needles. For a single character strchr is best, for 2-4 characters a small loop is fastest. For these the speedup over the Two-Way algorithm is ~10 times on large strings. Newlib builds, the new code passes GLIBC testsuite. OK for commit?
2018-09-03math_config.h: Fix signed overflow warning for 16-bit targetscygwin-2_11_1-releaseJon Beniston1-1/+1
2018-09-03e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure ↵Jon Beniston1-0/+5
constant fits in an int.
2018-09-03Avoid ARM SWI Seek when querying file positionAndy Koppe1-2/+9
Issuing an ARM semi-hosting Seek command when just querying file position with SEEK_CUR and offset zero is unnecessary, because unlike the lseek() Unix system call the Seek command does not actually return the file position. For that reason, syscalls.c for ARM keeps track of file position in the 'poslog', so we can just return that. Moreover, since the Seek command only accepts an absolute file position, SEEK_CUR operations are implemented by adding the relative offset to the position in the poslog. If the host implements non-binary files with implicit carriage return characters but doesn't discount those implicit CRs when implementing Seek (by just mapping straight to Windows file operations), this actually ended up wrongly changing file position when using SEEK_CUR with offset zero or functions like ftell() or fgetpos() that are based on that. Also, use off_t rather than int for the poslog.
2018-08-31Add --disable-newlib-fno-builtin to allow compilation without -fno-builtin ↵newlib-snapshot-20180831Jon Beniston102-228/+1436
for smaller and faster code.
2018-08-29Drop non-reserved parameter names from sys/signal.hcygwin-2_11_0-releaseAndy Koppe1-8/+7
Standard headers shouldn't use non-reserved identifiers as parameter names in function declarations, because programs could in theory define macros with such names before including a header.
2018-08-29Use __inhibit_loop_to_libcall in all memset/memcpy implementationsKeith Packard10-2/+28
This macro selects a compiler option that disables recognition of common memset/memcpy patterns and converting those to direct memset/memcpy calls. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-29Remove unused variable 'one' from sf_cos.cKeith Packard1-6/+0
Defined, never mentioned. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-29Use nanf("") instead of nanf(NULL)Keith Packard5-8/+8
Newer GCC versions require a non-NULL argument to this function for some reason. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-24RTEMS: Add kvaddr_t and ksize_tSebastian Huber1-0/+3
These types were introduced by FreeBSD commit: "Make struct xinpcb and friends word-size independent. Replace size_t members with ksize_t (uint64_t) and pointer members (never used as pointers in userspace, but instead as unique idenitifiers) with kvaddr_t (uint64_t). This makes the structs identical between 32-bit and 64-bit ABIs. On 64-bit bit systems, the ABI is maintained. On 32-bit systems, this is an ABI breaking change. The ABI of most of these structs was previously broken in r315662. This also imposes a small API change on userspace consumers who must handle kernel pointers becoming virtual addresses. PR: 228301 (exp-run by antoine) Reviewed by: jtl, kib, rwatson (various versions) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15386" In RTEMS, there is no user/kernel space separation. So, use the types size_t and uintptr_t. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_mman.h>Sebastian Huber1-48/+5
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_socket.h>Sebastian Huber1-54/+3
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_if.h>Sebastian Huber1-7/+4
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_in.h>Sebastian Huber1-26/+4
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_in6.h>Sebastian Huber1-163/+7
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Introduce <machine/_kernel_uio.h>Sebastian Huber1-54/+6
This helps to avoid Newlib updates due to FreeBSD kernel space changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Add __BSD_VISIBLE in <sys/_termios.h>Sebastian Huber1-3/+3
The __XSI_VISIBLE is not enabled by default in Newlib. This is an incompatiblity between FreeBSD and glibc. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24RTEMS: Update FreeBSD version tagsSebastian Huber24-24/+24
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24Add SOL_SOCKET level socket optiontuexen1-0/+1
with name SO_DOMAIN to get the domain of a socket. This is helpful when testing and Solaris and Linux have the same socket option using the same name. Reviewed by: bcr@, rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16791
2018-08-24Implement a limit on on the number of IPv6 reassemblyjtl1-1/+2
queues per bucket. There is a hashing algorithm which should distribute IPv6 reassembly queues across the available buckets in a relatively even way. However, if there is a flaw in the hashing algorithm which allows a large number of IPv6 fragment reassembly queues to end up in a single bucket, a per- bucket limit could help mitigate the performance impact of this flaw. Implement such a limit, with a default of twice the maximum number of reassembly queues divided by the number of buckets. Recalculate the limit any time the maximum number of reassembly queues changes. However, allow the user to override the value using a sysctl (net.inet6.ip6.maxfragbucketsize). Reviewed by: jhb Security: FreeBSD-SA-18:10.ip Security: CVE-2018-6923
2018-08-24Add a limit of the number of fragments per IPv6 packet.jtl1-1/+2
The IPv4 fragment reassembly code supports a limit on the number of fragments per packet. The default limit is currently 17 fragments. Among other things, this limit serves to limit the number of fragments the code must parse when trying to reassembly a packet. Add a limit to the IPv6 reassembly code. By default, limit a packet to 65 fragments (64 on the queue, plus one final fragment to complete the packet). This allows an average fragment size of 1,008 bytes, which should be sufficient to hold a fragment. (Recall that the IPv6 minimum MTU is 1280 bytes. Therefore, this configuration allows a full-size IPv6 packet to be fragmented on a link with the minimum MTU and still carry approximately 272 bytes of headers before the fragmented portion of the packet.) Users can adjust this limit using the net.inet6.ip6.maxfragsperpacket sysctl. Reviewed by: jhb Security: FreeBSD-SA-18:10.ip Security: CVE-2018-6923
2018-08-24This commit brings in a new refactored TCP stack called Rack.rrs2-0/+67
Rack includes the following features: - A different SACK processing scheme (the old sack structures are not used). - RACK (Recent acknowledgment) where counting dup-acks is no longer done instead time is used to knwo when to retransmit. (see the I-D) - TLP (Tail Loss Probe) where we will probe for tail-losses to attempt to try not to take a retransmit time-out. (see the I-D) - Burst mitigation using TCPHTPS - PRR (partial rate reduction) see the RFC. Once built into your kernel, you can select this stack by either socket option with the name of the stack is "rack" or by setting the global sysctl so the default is rack. Note that any connection that does not support SACK will be kicked back to the "default" base FreeBSD stack (currently known as "default"). To build this into your kernel you will need to enable in your kernel: makeoptions WITH_EXTRA_TCP_STACKS=1 options TCPHPTS Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D15525
2018-08-24Load balance sockets with new SO_REUSEPORT_LB option.sbruno1-17/+18
This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple programs or threads to bind to the same port and incoming connections will be load balanced using a hash function. Most of the code was copied from a similar patch for DragonflyBSD. However, in DragonflyBSD, load balancing is a global on/off setting and can not be set per socket. This patch allows for simultaneous use of both the current SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system. Required changes to structures: Globally change so_options from 16 to 32 bit value to allow for more options. Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets. Limitations: As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or threads sharing the same socket). This is a substantially different contribution as compared to its original incarnation at svn r332894 and reverted at svn r332967. Thanks to rwatson@ for the substantive feedback that is included in this commit. Submitted by: Johannes Lundberg <johalun0@gmail.com> Obtained from: DragonflyBSD Relnotes: Yes Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D11003
2018-08-24iflib(9): Add support for cloning pseudo interfacesmmacy1-0/+3
Part 3 of many ... The VPC framework relies heavily on cloning pseudo interfaces (vmnics, vpc switch, vcpswitch port, hostif, vxlan if, etc). This pulls in that piece. Some ancillary changes get pulled in as a side effect. Reviewed by: shurd@ Approved by: sbruno@ Sponsored by: Joyent, Inc. Differential Revision: https://reviews.freebsd.org/D15347
2018-08-24Revert r332894 at the request of the submitter.sbruno1-3/+0
Submitted by: Johannes Lundberg <johalun0_gmail.com> Sponsored by: Limelight Networks
2018-08-24Load balance sockets with new SO_REUSEPORT_LB optionsbruno1-0/+3
This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple programs or threads to bind to the same port and incoming connections will be load balanced using a hash function. Most of the code was copied from a similar patch for DragonflyBSD. However, in DragonflyBSD, load balancing is a global on/off setting and can not be set per socket. This patch allows for simultaneous use of both the current SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system. Required changes to structures Globally change so_options from 16 to 32 bit value to allow for more options. Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets. Limitations As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or threads sharing the same socket). Submitted by: Johannes Lundberg <johanlun0@gmail.com> Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D11003
2018-08-24Add 32-bit compat for ioctls that take struct ifgroupreq.brooks1-0/+2
Use an accessor to access ifgr_group and ifgr_groups. Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such as "case SIOCAIFGROUP:". This avoids poluting the switch statements with large numbers of #ifdefs. Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14960
2018-08-24Use an accessor function to access ifr_data.brooks1-0/+2
This fixes 32-bit compat (no ioctl command defintions are required as struct ifreq is the same size). This is believed to be sufficent to fully support ifconfig on 32-bit systems. Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14900
2018-08-24Implement several enhancements to NUMA policies.jeff1-0/+6
Add a new "interleave" allocation policy which stripes pages across domains with a stride or width keeping contiguity within a multi-page region. Move the kernel to the dedicated numbered cpuset #2 making it possible to assign kernel threads and memory policy separately from user. This also eliminates the need for the complicated interrupt binding code. Add a sysctl API for viewing and manipulating domainsets. Refactor some of the cpuset_t manipulation code using the generic bitset type so that it can be used for both. This probably belongs in a dedicated subr file. Attempt to improve the include situation. Reviewed by: kib Discussed with: jhb (cpuset parts) Tested by: pho (before review feedback) Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14839
2018-08-24Fix access to ifru_buffer on freebsd32.brooks1-0/+2
Make all kernel accesses to ifru_buffer go via access functions which take the process ABI into account and use an appropriate union to access members in the correct place in struct ifreq. Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14846
2018-08-24Allow to specify PCP on packets not belonging to any VLAN.kib2-0/+6
According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged, and only PCP and DEI values from the VLAN tag are meaningful. See for instance https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html. Make it possible to specify PCP value for outgoing packets on an ethernet interface. When PCP is supplied, the tag is appended, VLAN id set to 0, and PCP is filled by the supplied value. The code to do VLAN tag encapsulation is refactored from the if_vlan.c and moved into if_ethersubr.c. Drivers might have issues with filtering VID 0 packets on receive. This bug should be fixed for each driver. Reviewed by: ae (previous version), hselasky, melifaro Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D14702