]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
6 years agoFollow the RFC6980 and silently ignore following IPv6 NDP messages
ae@FreeBSD.org [Fri, 15 Dec 2017 12:37:32 +0000 (12:37 +0000)]
Follow the RFC6980 and silently ignore following IPv6 NDP messages

that had the IPv6 fragmentation header:
o Neighbor Solicitation
o Neighbor Advertisement
o Router Solicitation
o Router Advertisement
o Redirect

Introduce M_FRAGMENTED mbuf flag, and set it after IPv6 fragment reassembly
is completed. Then check the presence of this flag in correspondig ND6
handling routines.

PR: 224247
MFC after: 2 weeks

6 years agoSPDX: license IDs for some ISC-related files.
pfg [Fri, 8 Dec 2017 15:57:29 +0000 (15:57 +0000)]
SPDX: license IDs for some ISC-related files.

6 years agoGarbage collect IFCAP_POLLING_NOCOUNT.
glebius [Wed, 6 Dec 2017 23:03:34 +0000 (23:03 +0000)]
Garbage collect IFCAP_POLLING_NOCOUNT.

It wasn't used since very beginning of polling(4). The module always
ignored return value from driver polling handler.

6 years agosys/sys: further adoption of SPDX licensing ID tags.
pfg [Mon, 27 Nov 2017 15:01:59 +0000 (15:01 +0000)]
sys/sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

6 years agoinclude: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:45:28 +0000 (19:45 +0000)]
include: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

6 years agosys: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:43:44 +0000 (19:43 +0000)]
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

6 years agoUse hardware timestamps to report packet timestamps
kib [Tue, 7 Nov 2017 09:46:26 +0000 (09:46 +0000)]
Use hardware timestamps to report packet timestamps

for SO_TIMESTAMP and other similar socket options.

Provide new control message SCM_TIME_INFO to supply information about
timestamp.  Currently it indicates that the timestamp was
hardware-assisted and high-precision, for software timestamps the
message is not returned.  Reserved fields are added to ABI to report
additional info about it, it is expected that raw hardware clock value
might be useful for some applications.

Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12638

6 years agoAdd a place for a driver to report rx timestamps
kib [Tue, 7 Nov 2017 09:29:14 +0000 (09:29 +0000)]
Add a place for a driver to report rx timestamps

in nanoseconds from boot for the received packets.

The rcv_tstmp field overlaps the place of Ln header length indicators,
not used by received packets.  The basic pkthdr rearrangement change
in sys/mbuf.h was provided by gallatin.

There are two accompanying M_ flags: M_TSTMP means that there is the
timestamp (and it was generated by hardware).

Another flag M_TSTMP_HPREC indicates that the timestamp is
high-precision.  Practically M_TSTMP_HPREC means that hardware
provided additional precision comparing with the stamps when the flag
is not set.  E.g., for ConnectX all packets are stamped by hardware
when PCIe transaction to write out the completion descriptor is
performed, but PTP packet are stamped on port.  For Intel cards, when
PTP assist is enabled, only PTP packets are stamped in the limited
number of registers, so if Intel cards ever start support this
mechanism, they would always set M_TSTMP | M_TSTMP_HPREC if hardware
timestamp is present for the given packet.

Add IFCAP_HWRXTSTMP interface capability to indicate the support for
hardware rx timestamping, and ifconfig(8) command to toggle it.

Based on the patch by: gallatin
Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks (? mbuf KBI issue)
X-Differential revision: https://reviews.freebsd.org/D12638

6 years agoif: Add ioctls to get RSS key and hash type/function.
sephe [Tue, 5 Sep 2017 05:28:52 +0000 (05:28 +0000)]
if: Add ioctls to get RSS key and hash type/function.

It will be needed by hn(4) to configure its RSS key and hash
type/function in the transparent VF mode in order to match VF's
RSS settings. The description of the transparent VF mode and
the RSS hash value issue are here:
https://svnweb.freebsd.org/base?view=revision&revision=322299
https://svnweb.freebsd.org/base?view=revision&revision=322485

These are generic enough to promise two independent IOCs instead
of abusing SIOCGDRVSPEC.

Setting RSS key and hash type/function is a different story,
which probably requires more discussion.

Comment about UDP_{IPV4,IPV6,IPV6_EX} were only in the patch
in the review request; these hash types are standardized now.

Reviewed by: gallatin
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12174

6 years agoCorrect sysctl names.
des [Wed, 9 Aug 2017 07:24:58 +0000 (07:24 +0000)]
Correct sysctl names.

6 years agoRelax visibility for some termios symbols.
kib [Fri, 4 Aug 2017 09:45:40 +0000 (09:45 +0000)]
Relax visibility for some termios symbols.

They are defined by XSI or newer SUS.
This is a follow-up to r318780.

Reported by: jbeich
Obtained from: DragonflyBSD commit e08b3836c962
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoImplement address space guards.
kib [Sat, 24 Jun 2017 17:01:11 +0000 (17:01 +0000)]
Implement address space guards.

Guard, requested by the MAP_GUARD mmap(2) flag, prevents the reuse of
the allocated address space, but does not allow instantiation of the
pages in the range.  It is useful for more explicit support for usual
two-stage reserve then commit allocators, since it prevents accidental
instantiation of the mapping, e.g. by mprotect(2).

Use guards to reimplement stack grow code.  Explicitely track stack
grow area with the guard, including the stack guard page.  On stack
grow, trivial shift of the guard map entry and stack map entry limits
makes the stack expansion.  Move the code to detect stack grow and
call vm_map_growstack(), from vm_fault() into vm_map_lookup().

As result, it is impossible to get random mapping to occur in the
stack grow area, or to overlap the stack guard page.

Enable stack guard page by default.

Reviewed by: alc, markj
Man page update reviewed by: alc, bjk, emaste, markj, pho
Tested by: pho, Qualys
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11306 (man pages)

6 years agoListening sockets improvements.
glebius [Thu, 8 Jun 2017 21:30:34 +0000 (21:30 +0000)]
Listening sockets improvements.

o Separate fields of struct socket that belong to listening from
  fields that belong to normal dataflow, and unionize them.  This
  shrinks the structure a bit.
  - Take out selinfo's from the socket buffers into the socket. The
    first reason is to support braindamaged scenario when a socket is
    added to kevent(2) and then listen(2) is cast on it. The second
    reason is that there is future plan to make socket buffers pluggable,
    so that for a dataflow socket a socket buffer can be changed, and
    in this case we also want to keep same selinfos through the lifetime
    of a socket.
  - Remove struct struct so_accf. Since now listening stuff no longer
    affects struct socket size, just move its fields into listening part
    of the union.
  - Provide sol_upcall field and enforce that so_upcall_set() may be called
    only on a dataflow socket, which has buffers, and for listening sockets
    provide solisten_upcall_set().

o Remove ACCEPT_LOCK() global.
  - Add a mutex to socket, to be used instead of socket buffer lock to lock
    fields of struct socket that don't belong to a socket buffer.
  - Allow to acquire two socket locks, but the first one must belong to a
    listening socket.
  - Make soref()/sorele() to use atomic(9).  This allows in some situations
    to do soref() without owning socket lock.  There is place for improvement
    here, it is possible to make sorele() also to lock optionally.
  - Most protocols aren't touched by this change, except UNIX local sockets.
    See below for more information.

o Reduce copy-and-paste in kernel modules that accept connections from
  listening sockets: provide function solisten_dequeue(), and use it in
  the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4),
  infiniband, rpc.

o UNIX local sockets.
  - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX
    local sockets.  Most races exist around spawning a new socket, when we
    are connecting to a local listening socket.  To cover them, we need to
    hold locks on both PCBs when spawning a third one.  This means holding
    them across sonewconn().  This creates a LOR between pcb locks and
    unp_list_lock.
  - To fix the new LOR, abandon the global unp_list_lock in favor of global
    unp_link_lock.  Indeed, separating these two locks didn't provide us any
    extra parralelism in the UNIX sockets.
  - Now call into uipc_attach() may happen with unp_link_lock hold if, we
    are accepting, or without unp_link_lock in case if we are just creating
    a socket.
  - Another problem in UNIX sockets is that uipc_close() basicly did nothing
    for a listening socket.  The vnode remained opened for connections.  This
    is fixed by removing vnode in uipc_close().  Maybe the right way would be
    to do it for all sockets (not only listening), simply move the vnode
    teardown from uipc_detach() to uipc_close()?

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9770

6 years agoImplement INHERIT_ZERO for minherit(2).
delphij [Tue, 14 Mar 2017 17:10:42 +0000 (17:10 +0000)]
Implement INHERIT_ZERO for minherit(2).

INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR: 182610
Reviewed by: kib (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D427

6 years agoRenumber copyright clause 4
imp [Tue, 28 Feb 2017 23:42:47 +0000 (23:42 +0000)]
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96

6 years agomprotect(): Change prototype to comply to POSIX.
ed@FreeBSD.org [Wed, 3 Aug 2016 06:33:04 +0000 (06:33 +0000)]
mprotect(): Change prototype to comply to POSIX.

Our mprotect() function seems to take a "const void *" address to the
pages whose permissions need to be adjusted. POSIX uses "void *". Simply
stick to the POSIX one to prevent us from writing unportable code.

PR: 211423 (exp-run)
Tested by: antoine@ (Thanks!)

6 years agoImplement process-shared locks support
kib [Sun, 28 Feb 2016 17:52:33 +0000 (17:52 +0000)]
Implement process-shared locks support

for libthr.so.3, without breaking the ABI. Special value is stored in
the lock pointer to indicate shared lock, and offline page in the shared
memory is allocated to store the actual lock.

Reviewed by: vangyzen (previous version)
Discussed with: deischen, emaste, jhb, rwatson,
Martin Simmons <martin@lispworks.com>
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoAdd a new file operations hook for mmap
jhb [Thu, 4 Jun 2015 19:41:15 +0000 (19:41 +0000)]
Add a new file operations hook for mmap

operations. File type-specific logic is now placed in the mmap hook
implementation rather than requiring it to be placed in
sys/vm/vm_mmap.c. This hook allows new file types to support mmap() as
well as potentially allowing mmap() for existing file types that do not
currently support any mapping.

The vm_mmap() function is now split up into two functions.  A new
vm_mmap_object() function handles the "back half" of vm_mmap() and accepts
a referenced VM object to map rather than a (handle, handle_type) tuple.
vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a
a VM object and then calling vm_mmap_object() to handle the actual mapping.
The vm_mmap() function remains for use by other parts of the kernel
(e.g. device drivers and exec) but now only supports mapping vnodes,
character devices, and anonymous memory.

The mmap() system call invokes vm_mmap_object() directly with a NULL object
for anonymous mappings.  For mappings using a file descriptor, the
descriptors fo_mmap() hook is invoked instead.  The fo_mmap() hook is
responsible for performing type-specific checks and adjustments to
arguments as well as possibly modifying mapping parameters such as flags
or the object offset.  The fo_mmap() hook routines then call
vm_mmap_object() to handle the actual mapping.

The fo_mmap() hook is optional.  If it is not set, then fo_mmap() will
fail with ENODEV.  A fo_mmap() hook is implemented for regular files,
character devices, and shared memory objects (created via shm_open()).

While here, consistently use the VM_PROT_* constants for the vm_prot_t
type for the 'prot' variable passed to vm_mmap() and vm_mmap_object()
as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines.
Previously some places were using the mmap()-specific PROT_* constants
instead.  While this happens to work because PROT_xx == VM_PROT_xx,
using VM_PROT_* is more correct.

Differential Revision: https://reviews.freebsd.org/D2658
Reviewed by: alc (glanced over), kib
MFC after: 1 month
Sponsored by: Chelsio

6 years agoRetire the unimplemented MAP_RENAME
jhb [Sat, 18 Oct 2014 12:28:51 +0000 (12:28 +0000)]
Retire the unimplemented MAP_RENAME

and MAP_NORESERVE flags to mmap(2). Older binaries are still permitted
to use these flags.

PR: 193961 (exp-run in ports)
Differential Revision: https://reviews.freebsd.org/D848
Reviewed by: kib

6 years agoAdd a new fo_fill_kinfo fileops method
jhb [Mon, 22 Sep 2014 16:20:47 +0000 (16:20 +0000)]
Add a new fo_fill_kinfo fileops method

to add type-specific information to struct kinfo_file. - Move the
various fill_*_info() methods out of kern_descrip.c and into the various
file type implementations. - Rework the support for kinfo_ofile to
generate a suitable kinfo_file object for each file and then convert
that to a kinfo_ofile structure rather than keeping a second, different
set of code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.

Differential Revision: https://reviews.freebsd.org/D775
Reviewed by: kib, glebius (earlier version)

6 years agoAdd MAP_EXCL flag for mmap(2).
kib [Thu, 19 Jun 2014 05:00:39 +0000 (05:00 +0000)]
Add MAP_EXCL flag for mmap(2).

It should be combined with MAP_FIXED, and prevents the request from
deleting existing mappings in the region, failing instead.

Reviewed by: alc
Discussed with: jhb
Tested by: markj, pho (previous version, as part of the bigger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd a mmap flag (MAP_32BIT) on 64-bit platforms
jhb [Mon, 9 Sep 2013 18:11:59 +0000 (18:11 +0000)]
Add a mmap flag (MAP_32BIT) on 64-bit platforms

to request that a mapping use an address in the first 2GB of the
process's address space. This flag should have the same semantics as the
same flag on Linux.

To facilitate this, add a new parameter to vm_map_find() that specifies an
optional maximum virtual address.  While here, fix several callers of
vm_map_find() to use a VMFS_* constant for the findspace argument instead of
TRUE and FALSE.

Reviewed by: alc
Approved by: re (kib)

6 years agoImplement read(2)/write(2) and neccessary lseek(2)
kib [Wed, 21 Aug 2013 17:45:00 +0000 (17:45 +0000)]
Implement read(2)/write(2) and neccessary lseek(2)

for posix shmfd. Add MAC framework entries for posix shm read and write.

Do not allow implicit extension of the underlying memory segment past
the limit set by ftruncate(2) by either of the syscalls.  Read and
write returns short i/o, lseek(2) fails with EINVAL when resulting
offset does not fit into the limit.

Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoAdd __nl_item to <sys/_types.h> and use it
Sebastian Huber [Thu, 23 Aug 2018 10:13:02 +0000 (12:13 +0200)]
Add __nl_item to <sys/_types.h> and use it

Add __nl_item to <sys/_types.h> for FreeBSD compatibility.  Use it in
<langinfo.h> and the Cygwin <nl_types.h>.  Make the enum __nl_item in
<langinfo.h> anonymous.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoCYgwin: fix typo in comment
Corinna Vinschen [Fri, 24 Aug 2018 11:36:06 +0000 (13:36 +0200)]
CYgwin: fix typo in comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoRTEMS: Add __tls_get_addr() to crt0
Sebastian Huber [Mon, 20 Aug 2018 11:20:06 +0000 (13:20 +0200)]
RTEMS: Add __tls_get_addr() to crt0

Add __tls_get_addr() for all targets to crt0.  This is not only used on
ARM.  In particular, it is used on RISC-V.  This helps to adequately
support the GCC libgomp.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de
6 years agoCygwin: get_mem_values: Fix prototype
Corinna Vinschen [Fri, 17 Aug 2018 18:40:18 +0000 (20:40 +0200)]
Cygwin: get_mem_values: Fix prototype

Incomplete change unsigned long -> size_t was only visible on 32 bit, sigh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: document /proc/<PID>/status and /proc/<PID>/statm patches
Corinna Vinschen [Fri, 17 Aug 2018 17:21:51 +0000 (19:21 +0200)]
Cygwin: document /proc/<PID>/status and /proc/<PID>/statm patches

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: get_mem_values: Return number of Cygwin pages in arguments
Corinna Vinschen [Fri, 17 Aug 2018 18:31:24 +0000 (20:31 +0200)]
Cygwin: get_mem_values: Return number of Cygwin pages in arguments

Simplify callers accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: get_mem_values: Convert arguments to call-by-reference
Corinna Vinschen [Fri, 17 Aug 2018 18:30:32 +0000 (20:30 +0200)]
Cygwin: get_mem_values: Convert arguments to call-by-reference

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: get_mem_values: Return allocation as size_t values
Corinna Vinschen [Fri, 17 Aug 2018 17:30:28 +0000 (19:30 +0200)]
Cygwin: get_mem_values: Return allocation as size_t values

Use size_t in callers, too.  Fix __small_sprintf format specifiers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoRevert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well...
Corinna Vinschen [Fri, 17 Aug 2018 17:16:42 +0000 (19:16 +0200)]
Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm"

This reverts commit 8a32c24a7bdb0f3d80daa8f267cc63d15edcf771.

Replacing page_size() with allocation_granularity() was incorrect.
The values returned by get_mem_values() are # of pages of size
page_size().  Multiplying with allocation_granularity() here
results in values 16 times too big.

6 years agoCygwin: Add missing items to release notes
Corinna Vinschen [Fri, 17 Aug 2018 09:49:21 +0000 (11:49 +0200)]
Cygwin: Add missing items to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agosetfacl: Rename the option --file to --set-file, as on Linux
Ken Brown [Thu, 16 Aug 2018 18:55:28 +0000 (14:55 -0400)]
setfacl: Rename the option --file to --set-file, as on Linux

Retain --file as an undocumented option for backwards compatibility.

6 years agoFix strtof ("-nan") returns positive NaN
Masamichi Hosoda [Tue, 14 Aug 2018 23:39:22 +0000 (08:39 +0900)]
Fix strtof ("-nan") returns positive NaN

strtof ("-nan") returned positive NaN instead of negative NaN.
strtod ("-nan") and strtold ("-nan") return negative NaN.

Linux glibc has been fixed
that strto{f|d|ld} ("-nan") returns negative NaN.
https://sourceware.org/bugzilla/show_bug.cgi?id=23007

This commit makes strtof preserves the negative sign bit
when parsing "-nan" like glibc.

6 years agoRemove unused NaN's integer representation definitions
Masamichi Hosoda [Thu, 16 Aug 2018 00:46:43 +0000 (09:46 +0900)]
Remove unused NaN's integer representation definitions

By previous commit, strto{d|ld} ("nan")
does not use the definition of NaN.
There is no other function that uses the definitions.

This commit remove the definitions.

6 years agoFix strtod ("nan") and strtold ("nan") returns wrong negative NaN
Masamichi Hosoda [Thu, 16 Aug 2018 00:18:50 +0000 (09:18 +0900)]
Fix strtod ("nan") and strtold ("nan") returns wrong negative NaN

The definition of qNaN for x86_64 and i386 was wrong.
strto{d|ld} ("nan") returned wrong negative NaN
instead of correct positive NaN
since it used the wrong definition.

On the other hand, strtof ("nan") returns correct positive NaN
since it uses nanf ("") instead of the wrong definition.

This commit makes strto{d|ld} ("nan") uses {nan|nanl} ("")
like strtof ("nan") using.
So strto{d|ld} ("nan") returns positive NaN.

6 years agoImprove sincosf comments
Wilco Dijkstra [Thu, 16 Aug 2018 10:39:35 +0000 (10:39 +0000)]
Improve sincosf comments

Improve comments in sincosf implementation to make the code easier
to understand.  Rename the constant pi64 to pi63 since it's actually
PI * 2^-63.  Add comments for fields of sincos_t structure.  Add comments
describing implementation details to reduce_fast.

6 years agoCygwin: Add FE_ALL_EXCEPT change to release notes.
Corinna Vinschen [Wed, 15 Aug 2018 16:01:27 +0000 (18:01 +0200)]
Cygwin: Add FE_ALL_EXCEPT change to release notes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoKeep the denormal-operand exception masked; modify FE_ALL_EXCEPT accordingly.
J.H. van de Water [Wed, 15 Aug 2018 10:59:23 +0000 (12:59 +0200)]
Keep the denormal-operand exception masked; modify FE_ALL_EXCEPT accordingly.

By excluding the denormal-operand exception from FE_ALL_EXCEPT, it will not
be possible anymore to UNmask this exception by means of the API defined by
/usr/include/fenv.h

Note: terminology has changed since IEEE Std 854-1987; denormalized numbers
are called subnormal numbers nowadays.

This modification has basically been motivated by the fact that it is also
not possible on Linux to manipulate the denormal-operand exception by means
of the interface as defined by /usr/include/fenv.h. This has been the state
of affairs on Linux since 2001 (Andreas Jaeger).

The exceptions required by the standard (IEEE Std 754), in case they can be
supported by the implementation, are:
FE_INEXACT, FE_UNDERFLOW, FE_OVERFLOW, FE_DIVBYZERO and FE_INVALID.

Although it is allowed to define additional exceptions, there is no reason
to support the "denormal-operand exception" in this case (fenv.h), because
the subnormal numbers can be handled almost as fast the normalized numbers
by the hardware of the x86/x86_64 architecture. Said differently, a reason
to trap on the input of subnormal numbers does not exist. At least that is
what William Kahan and others at Intel asserted around 2000.
(that is William Kahan of the K-C-S draft, the precursor to the standard)

This commit modifies winsup/cygwin/include/fenv.h as follows:
 - redefines FE_ALL_EXCEPT from 0x3f to 0x3d
 - removes the definition for FE_DENORMAL
 - introduces __FE_DENORM (0x2) (enum in Linux also uses __FE_DENORM)
 - introduces FE_ALL_EXCEPT_X86 (0x3f), i.e. ALL x86/x86_64 FP exceptions

6 years agoCygwin: Add J.H. van de Water to CONTRIBUTORS
Corinna Vinschen [Wed, 15 Aug 2018 16:00:15 +0000 (18:00 +0200)]
Cygwin: Add J.H. van de Water to CONTRIBUTORS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fenv.h: Convert to ASCII-only
Corinna Vinschen [Tue, 14 Aug 2018 09:48:29 +0000 (11:48 +0200)]
Cygwin: fenv.h: Convert to ASCII-only

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoAdded Restriction on base value
Aditya Upadhyay [Sun, 12 Aug 2018 14:09:52 +0000 (19:39 +0530)]
Added Restriction on base value

6 years agoCygwin: utils: ps: use fputs to print fixed strings
Corinna Vinschen [Thu, 9 Aug 2018 06:41:18 +0000 (08:41 +0200)]
Cygwin: utils: ps: use fputs to print fixed strings

Avoid gcc warning "format not a string literal and no format arguments"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: strftime: fix over-enthusiastic fix from 0283642f35ce
Corinna Vinschen [Wed, 8 Aug 2018 21:59:16 +0000 (23:59 +0200)]
newlib: strftime: fix over-enthusiastic fix from 0283642f35ce

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoAdd BSP and semihosting library for nios2-generic-nommu QEMU emulation.
Sandra Loosemore [Tue, 7 Aug 2018 21:15:47 +0000 (14:15 -0700)]
Add BSP and semihosting library for nios2-generic-nommu QEMU emulation.

6 years agonewlib: don't use __visibility__ attrribute on Cygwin
Corinna Vinschen [Wed, 8 Aug 2018 08:44:38 +0000 (10:44 +0200)]
newlib: don't use __visibility__ attrribute on Cygwin

gcc doesn't support visibility attribute on PE/COFF platforms

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: don't check malloc/free pointer
Corinna Vinschen [Wed, 8 Aug 2018 08:42:48 +0000 (10:42 +0200)]
newlib: don't check malloc/free pointer

use preprocessor check for MALLOC_PROVIDED instead

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: fix various gcc warnings
Corinna Vinschen [Wed, 8 Aug 2018 08:41:58 +0000 (10:41 +0200)]
newlib: fix various gcc warnings

* unused variables
* potentially used uninitialized
* suggested bracketing
* misleading indentation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: wordexp: drop dangerous fprintf
Corinna Vinschen [Wed, 8 Aug 2018 08:39:45 +0000 (10:39 +0200)]
newlib: wordexp: drop dangerous fprintf

wordexp uses fprintf in a dangerous way.  It uses an unchecked
input string as format string, rather than as parameter to a %s.
Replace fprintf with fputs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: utils: strace: fix format string
Corinna Vinschen [Wed, 8 Aug 2018 07:26:20 +0000 (09:26 +0200)]
Cygwin: utils: strace: fix format string

%ll is long valid for mingw builds.  Use this rather than %I64
to avoid a gcc warning

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: utils: change 3rd readlink param to size_t
Corinna Vinschen [Wed, 8 Aug 2018 07:25:12 +0000 (09:25 +0200)]
Cygwin: utils: change 3rd readlink param to size_t

Avoid gcc warnings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: utils: cygcheck: fix filesystem output format
Corinna Vinschen [Wed, 8 Aug 2018 07:24:23 +0000 (09:24 +0200)]
Cygwin: utils: cygcheck: fix filesystem output format

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: newlocale: fix typo rendering ctype_ptr invalid
Corinna Vinschen [Tue, 7 Aug 2018 13:23:19 +0000 (15:23 +0200)]
newlib: newlocale: fix typo rendering ctype_ptr invalid

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib: strftime: fix gcc warning on __ctloc
Corinna Vinschen [Tue, 7 Aug 2018 13:20:29 +0000 (15:20 +0200)]
newlib: strftime: fix gcc warning on __ctloc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoRTEMS: Add aligned_alloc() to crt0
Sebastian Huber [Wed, 8 Aug 2018 06:36:13 +0000 (08:36 +0200)]
RTEMS: Add aligned_alloc() to crt0

This is necessary to build the latest GCC 7 branch.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85904

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoCygwin: implement sched_getcpu
Corinna Vinschen [Tue, 7 Aug 2018 12:51:10 +0000 (14:51 +0200)]
Cygwin: implement sched_getcpu

* create new function __get_cpus_per_group to evaluate # of CPU groups
* Call from  format_proc_cpuinfo and sched_getcpu
* Bump API minor version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoDeclare GNU-specific sched_getcpu()
Sebastian Huber [Tue, 7 Aug 2018 11:46:13 +0000 (13:46 +0200)]
Declare GNU-specific sched_getcpu()

This is a glibc extension.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoFix return value on aio_read/write success
Mark Geisert [Tue, 7 Aug 2018 05:54:06 +0000 (22:54 -0700)]
Fix return value on aio_read/write success

Internally track resultant byte counts as ssize_t, but return 0 as int
for success indication, per POSIX.

6 years agoCygwin: Document fegetenv patch
Corinna Vinschen [Fri, 3 Aug 2018 07:35:31 +0000 (09:35 +0200)]
Cygwin: Document fegetenv patch

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fegetenv() should not disable exceptions
J.H. van de Water [Thu, 2 Aug 2018 23:45:12 +0000 (01:45 +0200)]
Cygwin: fegetenv() should not disable exceptions

fnstenv MUST be followed by fldenv in fegetenv(), as the former disables all
exceptions in the x87 FPU, which is not appropriate here (fegetenv() ).
fldenv after fnstenv should reload the x87 FPU w/ the configuration that was
saved by fnstenv, i.e. a configuration that might have exceptions enabled.

Note: x86_64 uses SSE for floating-point, not the x87 FPU. However, because
feraiseexcept() attempts to provoke an exception using the x87 FPU, the bug
in fegetenv() will make this attempt futile here (x86_64).

Note: WoW uses the x87 FPU for floating-point, not SSE. Here anything that
would normally result in triggering an exception, not only feraiseexcept(),
will not be able to, as result of the bug in fegetenv().

6 years agoPatch from Richard Earnshaw <Richard.Earnshaw@arm.com> newlib-snapshot-20180802
Jeff Johnston [Wed, 1 Aug 2018 17:58:10 +0000 (13:58 -0400)]
Patch from Richard Earnshaw <Richard.Earnshaw@arm.com>

* aarch64/cpu-init/rdimon-aem-el3.S (cpu_init_hook): Simplify
  entry/exit sequences.  Add CFI unwind rules.

6 years agoRISC-V: Do not use _init/_fini
Sebastian Huber [Fri, 27 Jul 2018 08:11:44 +0000 (10:11 +0200)]
RISC-V: Do not use _init/_fini

Introduce new host configuration variable "have_init_fini" which is set
to "yes" by default.  Override it for RISC-V to "no".

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoAdd attributes to allocator functions
Sebastian Huber [Thu, 26 Jul 2018 08:52:44 +0000 (10:52 +0200)]
Add attributes to allocator functions

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoFreeBSD compat. __alloc_size(), __alloc_align()
Sebastian Huber [Thu, 26 Jul 2018 08:36:06 +0000 (10:36 +0200)]
FreeBSD compat. __alloc_size(), __alloc_align()

Restore FreeBSD compatibility for __alloc_size() and __alloc_align().

This is a follow-up to commit e494b560350cabef94126a4478096aae89ae35a0.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoDefine a new __alloc_size2 attribute to complement the exiting support.
pfg [Sun, 21 Jan 2018 20:27:47 +0000 (20:27 +0000)]
Define a new __alloc_size2 attribute to complement the exiting support.

At least on GCC7 calling __alloc_size(x) twice is not equivalent to
calling using the attribute once with two arguments. The later is the
documented use in GCC documentation so add a new alloc_size(n, x)
alternative to cover for the few places where it is used: basically:
calloc(3), reallocarray(3) and  mallocarray(9).

Submitted by: Mark Millard
MFC after: 3 days
Reference:
http://docs.freebsd.org/cgi/mid.cgi?F227842D-6BE2-4680-82E7-07906AF61CD7

6 years agoRemove lint support from system headers and MD x86 headers.
kib [Thu, 23 Nov 2017 11:40:16 +0000 (11:40 +0000)]
Remove lint support from system headers and MD x86 headers.

Reviewed by: dim, jhb
Discussed with: imp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D13156

6 years agosys: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:43:44 +0000 (19:43 +0000)]
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

6 years agoMake _Static_assert() work with GCC in older C++ standards.
ed@FreeBSD.org [Mon, 28 Aug 2017 09:35:17 +0000 (09:35 +0000)]
Make _Static_assert() work with GCC in older C++ standards.

GCC only activates C11 keywords in C mode, not C++ mode. This means
that when targeting an older C++ standard, we cannot fall back to using
_Static_assert(). In this case, do define _Static_assert() as a macro
that uses a typedef'ed array.

Discussed in: r322875 commit thread
Reported by: Mark MIllard
MFC after: 1 month

6 years agoctype: Avoid GCC note in towctrans_l.c
Sebastian Huber [Fri, 27 Jul 2018 07:28:55 +0000 (09:28 +0200)]
ctype: Avoid GCC note in towctrans_l.c

The previous version genenerated the following GCC note:

towctrans_l.c:44:1: note: offset of packed bit-field 'diff' has changed in GCC 4.4
 caseconv_table [] = {
 ^~~~~~~~~~~~~~

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoctype: Fix integer type for caseconv_entry::delta
Sebastian Huber [Fri, 27 Jul 2018 07:16:53 +0000 (09:16 +0200)]
ctype: Fix integer type for caseconv_entry::delta

The commit 46ba1675c457324b0eeef4670a09101ef3f34c50 accidently changed a
bit-field from signed to unsigned.  The caseconv_entry::delta must be a
signed integer, see also "newlib/libc/ctype/caseconv.t".

Unfortunately, a standard GCC/Newlib build is done without
-Wsign-conversion.  Using this warning option would have helped to avoid
this bug:

caseconv.t:2:22: warning: unsigned conversion from 'int' to 'unsigned int:17' changes value from '-32' to '131040' [-Wsign-conversion]
   {0x0061, 25, TOUP, -32},

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoFix comparison between two character arrays
Jordi Sanfeliu [Fri, 27 Jul 2018 09:02:55 +0000 (11:02 +0200)]
Fix comparison between two character arrays

Hello,

The member 'id' in the 'utmp' struct is not a numeric but a character array,
hence the strncmp() function is needed to compare two members.

6 years agoCygwin: fpathconf: update _PC_ASYNC_IO return value
Yaakov Selkowitz [Wed, 25 Jul 2018 20:00:43 +0000 (15:00 -0500)]
Cygwin: fpathconf: update _PC_ASYNC_IO return value

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoCygwin: define _POSIX_ASYNCHRONOUS_IO
Yaakov Selkowitz [Wed, 25 Jul 2018 15:48:55 +0000 (10:48 -0500)]
Cygwin: define _POSIX_ASYNCHRONOUS_IO

This feature is now available as of the recent AIO commits.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoPOSIX Asynchronous I/O support: other files
Mark Geisert [Tue, 24 Jul 2018 05:31:59 +0000 (22:31 -0700)]
POSIX Asynchronous I/O support: other files

Updates to misc files to integrate AIO into the Cygwin source tree.
Much of it has to be done when adding any new syscalls.  There are
some updates to limits.h for AIO-specific limits.  And some doc mods.

6 years agoPOSIX Asynchronous I/O support: fhandler files
Mark Geisert [Tue, 24 Jul 2018 05:31:58 +0000 (22:31 -0700)]
POSIX Asynchronous I/O support: fhandler files

This code is where the AIO implementation is wired into existing Cygwin
mechanisms for file and device I/O: the fhandler* functions.  It makes
use of an existing internal routine prw_open to supply a "shadow fd"
that permits asynchronous operations on a file the user app accesses
via its own fd.  This allows AIO to read or write at arbitrary locations
within a file without disturbing the app's file pointer.  (This was
already the case with normal pread|pwrite; we're just adding "async"
to the mix.)

6 years agoPOSIX Asynchronous I/O support: aio files
Mark Geisert [Tue, 24 Jul 2018 05:31:57 +0000 (22:31 -0700)]
POSIX Asynchronous I/O support: aio files

This is the core of the AIO implementation: aio.cc and aio.h.  The
latter is used within the Cygwin DLL by aio.cc and the fhandler* modules,
as well as by user programs wanting the AIO functionality.

6 years agogetfacl: Simplify by using acl_to_any_text
Ken Brown [Mon, 23 Jul 2018 21:46:41 +0000 (17:46 -0400)]
getfacl: Simplify by using acl_to_any_text

6 years agogetfacl and setfacl: Align with Linux
Ken Brown [Mon, 23 Jul 2018 14:10:03 +0000 (10:10 -0400)]
getfacl and setfacl: Align with Linux

Make getfacl print two colons instead of one after "other" and "mask".
Change the help text for setfacl to indicate that there can be either
one colon or two.

6 years agoctype: Fix bitfield types on 16-bit targets newlib-snapshot-20180720
Sebastian Huber [Fri, 20 Jul 2018 11:04:56 +0000 (13:04 +0200)]
ctype: Fix bitfield types on 16-bit targets

This prevents errors like this:

newlib/libc/ctype/categories.c:6:3: error: width of 'first' exceeds its type
   unsigned int first: 24;
   ^

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoCygwin: move FP environment exports to common.din
Corinna Vinschen [Fri, 20 Jul 2018 11:55:26 +0000 (13:55 +0200)]
Cygwin: move FP environment exports to common.din

We only have the symbols defined for i686 by accident since 2013...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoRTEMS: Unconditionally define _off_t to int64_t
Sebastian Huber [Thu, 19 Jul 2018 13:30:18 +0000 (15:30 +0200)]
RTEMS: Unconditionally define _off_t to int64_t

Exotic RTEMS targets can define this back to int32_t as an exception if
there are good reasons.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRemove myself from MAINTAINERS
DJ Delorie [Fri, 20 Jul 2018 01:32:40 +0000 (21:32 -0400)]
Remove myself from MAINTAINERS

Stepping down from target-specific maintainerships.

6 years agofix duration handling in sigtimedwait
Mark Geisert [Thu, 19 Jul 2018 09:35:40 +0000 (02:35 -0700)]
fix duration handling in sigtimedwait

6 years agoPrint sign of NaN values to nano-vfprintf.
Kumar Gala [Thu, 12 Jul 2018 18:13:53 +0000 (13:13 -0500)]
Print sign of NaN values to nano-vfprintf.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
6 years agoFix to stop a fall-through in a switch statement
Jordi Sanfeliu [Fri, 13 Jul 2018 10:15:46 +0000 (12:15 +0200)]
Fix to stop a fall-through in a switch statement

The following fixes a fall-through that prevented from reading the
next entry in the UTMP file and terminated the program with an abort().

6 years agostrcmp.S: Improve performance for misaligned strings
Siddhesh Poyarekar [Fri, 29 Jun 2018 12:38:22 +0000 (18:08 +0530)]
strcmp.S: Improve performance for misaligned strings

Replace the simple byte-wise compare in the misaligned case with a
dword compare with page boundary checks in place.  For simplicity I've
chosen a 4K page boundary so that we don't have to query the actual
page size on the system.

This results in up to 3x improvement in performance in the unaligned
case on falkor and about 2.5x improvement on mustang as measured using
bench-strcmp in glibc.

6 years agomemcmp.S: optimize for medium to large sizes
Siddhesh Poyarekar [Fri, 29 Jun 2018 12:38:21 +0000 (18:08 +0530)]
memcmp.S: optimize for medium to large sizes

This improved memcmp provides a fast path for compares up to 16 bytes
and then compares 16 bytes at a time, thus optimizing loads from both
sources.  The glibc memcmp microbenchmark retains performance (with an
error of ~1ns) for smaller compare sizes and reduces up to 31% of
execution time for compares up to 4K on the APM Mustang.  On Qualcomm
Falkor this improves to almost 48%, i.e. it is almost 2x improvement
for sizes of 2K and above.

6 years agoImprove strncmp for mutually misaligned inputs
Siddhesh Poyarekar [Fri, 29 Jun 2018 12:38:20 +0000 (18:08 +0530)]
Improve strncmp for mutually misaligned inputs

The mutually misaligned inputs on aarch64 are compared with a simple
byte copy, which is not very efficient.  Enhance the comparison
similar to strcmp by loading a double-word at a time.  The peak
performance improvement (i.e. 4k maxlen comparisons) due to this on
the strncmp microbenchmark in glibc is as follows:

falkor: 3.5x (up to 72% time reduction)
cortex-a73: 3.5x (up to 71% time reduction)
cortex-a53: 3.5x (up to 71% time reduction)

All mutually misaligned inputs from 16 bytes maxlen onwards show
upwards of 15% improvement and there is no measurable effect on the
performance of aligned/mutually aligned inputs.

6 years agoCygwin: Treat PROCESSOR_ARCHITECTURE_INTEL as running under WOW64 on ARM64
Corinna Vinschen [Thu, 12 Jul 2018 13:28:13 +0000 (15:28 +0200)]
Cygwin: Treat PROCESSOR_ARCHITECTURE_INTEL as running under WOW64 on ARM64

Bug in current ARM64 WOW64: GetNativeSystemInfo returns
PROCESSOR_ARCHITECTURE_INTEL rather than PROCESSOR_ARCHITECTURE_ARM64.
Provide for this.

Make code better readable.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoFix AArch32 semihosting SYS_EXIT call on semihosting v1.
Tamar Christina [Wed, 11 Jul 2018 12:26:16 +0000 (13:26 +0100)]
Fix AArch32 semihosting SYS_EXIT call on semihosting v1.

The current SYS_EXIT has a bug that when making the call it always uses
the v2 calling convention.  This is undefined behavior according to the
semihosting specification:
https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit-0x18

This patch fixes it by making sure v1 passes the argument directly in the register instead
of in a block. And for v2 it does the same if the v2 extension isn't supported.

The sequence generated now is

   12424:       ebfffecd        bl      11f60 <_has_ext_exit_extended>
   12428:       e3500000        cmp     r0, #0
   1242c:       11a0500d        movne   r5, sp
   12430:       059d5000        ldreq   r5, [sp]
   12434:       e1a00004        mov     r0, r4
   12438:       e1a01005        mov     r1, r5
   1243c:       ef00f000        svc     0x0000f000

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
6 years agoRemove float compare option from sincosf
Szabolcs Nagy [Tue, 10 Jul 2018 16:14:32 +0000 (17:14 +0100)]
Remove float compare option from sincosf

PREFER_FLOAT_COMPARISON setting was not correct as it could raise
spurious exceptions.  Fixing it is easy: just use ISLESS(x, y) instead
of abstop12(x) < abstop12(y) with appropriate non-signaling definition
for ISLESS.  However it seems this setting is not very useful (there is
only minor performance difference on various architectures), so remove
this option for now.

6 years agoFix the documentation comments for log_inline in pow
Szabolcs Nagy [Tue, 10 Jul 2018 16:13:27 +0000 (17:13 +0100)]
Fix the documentation comments for log_inline in pow

There was a typo and the arguments were not explained clearly.

6 years agoCygwin: Don't print FAST_CWD warning in WOW64 on ARM64 systems
Corinna Vinschen [Tue, 10 Jul 2018 12:45:52 +0000 (14:45 +0200)]
Cygwin: Don't print FAST_CWD warning in WOW64 on ARM64 systems

No way to test this, yet.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix a race in the FAST_CWD fallback code
Corinna Vinschen [Tue, 10 Jul 2018 12:13:15 +0000 (14:13 +0200)]
Cygwin: fix a race in the FAST_CWD fallback code

Guard the entire operation with the FastPebLock critical section
used by RtlSetCurrentDirectory_U as well, thus eliminating the
race between concurrent chdir/fchdir/SetCurrentDirectory calls.

Streamline comment explaining the fallback method.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoUpdate config.guess and config.sub
Sebastian Huber [Fri, 6 Jul 2018 06:57:22 +0000 (08:57 +0200)]
Update config.guess and config.sub

Update to the latest versions of config.sub (2018-07-03) and
config.guess (2018-06-26).

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoFix a problem that connection to syslogd fails.
Takashi Yano [Thu, 5 Jul 2018 14:46:34 +0000 (23:46 +0900)]
Fix a problem that connection to syslogd fails.

* fhandler_socket_local.cc (get_inet_addr_local): Change type from
  'static int' to 'int' to be callable from syslog.cc.
* syslog.cc (connect_syslogd): Use get_inet_addr_local() instead of
  getsockname() to retrieve name information of the syslogd socket.

6 years agoFix namespace issues in sinf, cosf and sincosf
Szabolcs Nagy [Wed, 4 Jul 2018 16:52:36 +0000 (17:52 +0100)]
Fix namespace issues in sinf, cosf and sincosf

Use const sincos_t for clarity instead of making the typedef const.
Use __inv_pi4 and __sincosf_table to avoid namespace issues with
static linking.

6 years agoFix large ulp error in pow without fma very near 1.0
Szabolcs Nagy [Tue, 3 Jul 2018 12:05:31 +0000 (13:05 +0100)]
Fix large ulp error in pow without fma very near 1.0

The !HAVE_FAST_FMA code path split r = z/c - 1 into r = rhi + rlo such
that when z = 1-tiny and c = 1 then rlo and rhi could have much larger
magnitude than r which later caused large rounding errors.

So do a nearest rounding instead of truncation at the split.

In newlib with default settings this was observable on some arm targets
that enable the new math code but has no fma.

6 years agoChange the return type of converttoint and document the semantics
Szabolcs Nagy [Wed, 4 Jul 2018 10:09:39 +0000 (11:09 +0100)]
Change the return type of converttoint and document the semantics

The roundtoint and converttoint internal functions are only called with small
values, so 32 bit result is enough for converttoint and it is a signed int
conversion so the natural return type is int32_t.

The original idea was to help the compiler keeping the result in uint64_t,
then it's clear that no sign extension is needed and there is no accidental
undefined or implementation defined signed int arithmetics.

But it turns out gcc does a good job with inlining so changing the type has
no overhead and the semantics of the conversion is less surprising this way.
Since we want to allow the asuint64 (x + 0x1.8p52) style conversion, the top
bits were never usable and the existing code ensures that only the bottom
32 bits of the conversion result are used.

In newlib with default settings only aarch64 is affected and there is no
significant code generation change with gcc after the patch.

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