aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/include
AgeCommit message (Collapse)AuthorFilesLines
2020-02-20newlib/libc/include/devctl.h: Add extern "C" wrapperJoel Sherrill1-0/+8
Adding this was necessary to allow posix_devctl() from C++.
2020-01-29Use remove-advertising-clause script to edit BSD licensesKeith Packard6-26/+6
This edits licenses held by Berkeley and NetBSD, both of which have removed the advertising requirement from their licenses. Signed-off-by: Keith Packard <keithp@keithp.com>
2019-12-20Optimize setjmp/longjmp for moxie.Anthony Green1-1/+1
We don't need to save/restore every register -- just those we don't expect to be trashed by function calls.
2019-12-17Set __IEEE_LITTLE_ENDIAN for _XTENSA_EL__ (ESP32)Keith Packard1-0/+4
Signed-off-by: Keith Packard <keithp@keithp.com>
2019-12-13Fix setjmp/longjmp for the moxie port.Anthony Green1-1/+1
These functions needs to save and restore the stack frame, because that's where the return address is stored.
2019-11-26newlib/libc/include/sys/features.h: update __STDC_ISO_10646__Brian Inglis1-3/+7
newlib wide char conversion functions were updated to Unicode 11 on 2019-01-12 update standard symbol __STDC_ISO_10646__ to Unicode 11 release date 2018-06-05 for Cygwin
2019-11-04Move timeval macros to <sys/time.h>Sebastian Huber2-32/+31
In FreeBSD, NetBSD, and OpenBSD these macros are defined in <sys/time.h>.
2019-11-04Synchronize <sys/time.h> with FreeBSDSebastian Huber1-0/+27
This change is based on the FreeBSD commit: Author: asomers <asomers@FreeBSD.org> Date: Mon Jul 30 15:46:40 2018 +0000 Make timespecadd(3) and friends public The timespecadd(3) family of macros were imported from NetBSD back in r35029. However, they were initially guarded by #ifdef _KERNEL. In the meantime, we have grown at least 28 syscalls that use timespecs in some way, leading many programs both inside and outside of the base system to redefine those macros. It's better just to make the definitions public. Our kernel currently defines two-argument versions of timespecadd and timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define three-argument versions. Solaris also defines a three-argument version, but only in its kernel. This revision changes our definition to match the common three-argument version. Bump _FreeBSD_version due to the breaking KPI change. Discussed with: cem, jilles, ian, bde Differential Revision: https://reviews.freebsd.org/D14725
2019-11-04Synchronize <sys/_timespec.h> with FreeBSDSebastian Huber1-2/+4
2019-11-04Fix sbttons for values > 2simp1-2/+9
Add test against negative times. Add code to cope with larger values properly. Discussed with: bde@ (quite some time ago, for an earlier version)
2019-10-31Initial PRU port for libgloss and newlibDimitar Dimitrov2-0/+9
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2019-10-07Allow verifying _REENT_CHECK macros memory allocationJeff Johnston1-3/+3
- change sys/reent.h to replace _REENT_CHECK_DEBUG with _REENT_CHECK_VERIFY which when set asserts that any memory allocated is non-NULL and calls __assert_func directly - add new --enable-newlib-reent-check-verify configure option - add support for configure.host to specify default for newlib_reent_check_verify - add _REENT_CHECK_VERIFY macro support to acconfig.h and newlib.hin
2019-09-10libc/include/devctl.h: Add SOCKCLOSE per FACE Technical Standard, Edition 3.0Joel Sherrill1-5/+24
The FACE Technical Standard, Edition 3.0 and later require the definition of the subcommand SOCKCLOSE in <devctl.h>. Reference: https://www.opengroup.org/face
2019-08-19Revert previous change to sys/stat.h and fix cris libglossJeff Johnston1-9/+0
- revert previous fix which altered sys/stat.h - fix libgloss/cris/gensyscalls to undef st_atime, st_mtime, and st_ctime macros which cannot be used with new_stat structure
2019-08-19Fix regression in cris-elf caused by sys/stat.h changeJeff Johnston1-2/+11
2019-08-16stat.h: use POSIX-required timefields throughoutCorinna Vinschen1-16/+6
...except in certain SysV R4 cases for backward compat. This is probably not required anymore, but it doesn't hurt to keep it in.
2019-08-12sched.h: Declare affinity functions only on targets supporting themCorinna Vinschen1-0/+6
2019-08-09Add default implementation of fenv.h and all methodsJoel Sherrill2-0/+155
The default implementation of the fenv.h methods return -EOPNOTSUP. Some of these have implementations appropriate for soft-float. The intention of the new fenv.h is that it be portable and that architectures provide their own implementation of sys/fenv.h.
2019-07-25Port ndbm - Remove Declaration of dbm_forderVaibhav Gupta1-3/+0
2019-07-24Port ndbmVaibhav Gupta1-0/+93
2019-06-27sched: Move Cygwin cpuset definitions into Cygwin-specific headerCorinna Vinschen1-18/+0
This avoids build breakage on RTEMS. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-06-27or1k: Avoid write outside setjmp buf & shrink bufMartin Erik Werner1-1/+4
Update the offsets used to save registers into the stejmp jmp_buf structure in order to: * Avoid writing the supervision register outside the buffer and thus clobbering something on the stack. Previously the supervision register was written at offset 124 while the buffer was of length 124. * Shrink the jmp_buf down to the size actually needed, by avoiding holes at the locations of omitted registers.
2019-06-25Support calculation of pointer size for __int20__ type in _intsup.hJozef Lawrynowicz1-0/+4
GCC r272640 modifies the MSP430 target to use "__int20__" for PTRDIFF_TYPE (and therefore INTPTR_TYPE) instead of "__int20". To support the calculation of pointer size in newlib/libc/include/sys/_intsup.h, definitions for __int20__ need to be added.
2019-06-24Cygwin: Implement sched_[gs]etaffinity()Mark Geisert1-0/+23
This patch set implements the Linux syscalls sched_getaffinity, sched_setaffinity, pthread_getaffinity_np, and pthread_setaffinity_np. Linux has a straightforward view of the cpu sets used in affinity masks. They are simply long (1024-bit) bit masks. This code emulates that view while internally dealing with Windows' distribution of available CPUs among processor groups.
2019-06-14Rename <xlocale.h> back to <sys/_locale.h>Corinna Vinschen11-13/+13
libX11 provides <X11/Xlocale.h>. The build of libX11 itself adds include/X11 to the compiler's include path. This results in a name collision with /usr/include/xlocale.h on case-insensitive filesystems. Commit 90e35b1eb3df renamed sys/_locale.h to xlocale.h in March 2017 under the assumption that we should provide the locale_t type in the same file as on Linux, FreeBSD, and Darwin. A few weeks later (June 2017), glibc removed the xlocale.h file in favor of bits/types/locale_t.h, which shouldn't be included directly anyway. For reference and the reasoning, see https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336d Given the above, revert 90e35b1eb3df4070e68afc5e7060665214d586be and fix additional usage of xlocale.h.
2019-06-07Mark inline functions with __unused;trasz1-5/+5
prevents compiler warning when they end up being unused. Reviewed by: kib Obtained from: OpenBSD MFC after: 2 weeks Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D20185
2019-06-07sys/sys: further adoption of SPDX licensing ID tags.pfg1-0/+2
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.
2019-06-03Fix <sys/_types.h> issues with <stddef.h>Sebastian Huber2-5/+3
A commit from 2016 tried to address this GCC provided <stddef.h> issue #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__) /* __size_t is a typedef on FreeBSD 5, must not trash it. */ #elif defined (__VMS__) /* __size_t is also a typedef on VMS. */ #else #define __size_t #endif with an include of <stddef.h> before <sys/_types.h> in <sys/types.h>. Is is not robust enough. Do the include of <stddef.h> in <sys/_types.h> directly and request only the necessary types. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-06-03Avoid <sys/cdefs.h> dependency in <sys/_types.h>Sebastian Huber1-2/+7
Including <sys/cdefs.h> could result in cyclic header dependencies. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-06-03Avoid cyclic header dependenciesSebastian Huber2-5/+5
RTEMS uses a considerable part of FreeBSD kernel and user space sources. These sources are compiled with a __FreeBSD__ define. On 2018-06-26 Gerald Pfeifer changed the GCC provided <stddef.h> so that it includes <sys/_types.h> if __FreeBSD__ is defined. The Newlib <sys/_types.h> included <sys/lock.h> which includes <sys/cdefs.h> on RTEMS which includes <stddef.h>. To get rid of this cyclic dependency move the optional _flock_t definition to <sys/reent.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Cygwin: add secure_getenvYaakov Selkowitz1-0/+3
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2019-02-19Define u_register_t if __BSD_VISIBLESebastian Huber1-0/+2
Add u_register_t definition for FreeBSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Change register_t definitionSebastian Huber1-1/+1
On 64-bit targets, the register_t type must be a 64-bit integer. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Fix comment in <sys/types.h>Sebastian Huber1-1/+1
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Move RTEMS and XMK specific type definitionsSebastian Huber2-16/+6
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-01-23Remove matherr, and SVID and X/Open math library configurationsJozef Lawrynowicz1-39/+0
Default math library configuration is now IEEE
2019-01-22time.h: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen1-8/+12
Slightly reshuffle and add comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-15AMD GCN Port contributed by Andrew Stubbs <ams@codesourcery.com>Jeff Johnston2-0/+8
Add support for the AMD GCN GPU architecture. This is primarily intended for use with OpenMP and OpenACC offloading. It can also be used for stand-alone programs, but this is intended mostly for testing the compiler and is not expected to be useful in general. The GPU architecture is highly parallel, and therefore Newlib must be configured to use dynamic re-entrancy, and thread-safe malloc. The only I/O available is a via a shared-memory interface provided by libgomp and the gcn-run tool included with GCC. At this time this is limited to stdout, argc/argv, and the return code.
2019-01-07fcntl.h: expose AT_EMPTY_PATH with _GNU_SOURCE onlyCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: linkat: support Linux-specific AT_EMPTY_PATH flagCorinna Vinschen1-0/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: open: support Linux-specific O_PATH flagCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-12-04sys/time.h: Remove KASSERTSebastian Huber1-12/+0
The KASSERT is only used by the FreeBSD kernel. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-12-04Ensure that all values of ns, us and ms workimp1-7/+52
for {n,u,m}stosbt Integer overflows and wrong constants limited the accuracy of these functions and created situatiosn where sbttoXs(Xstosbt(Y)) != Y. This was especailly true in the ns case where we had millions of values that were wrong. Instead, used fixed constants because there's no way to say ceil(X) for integer math. Document what these crazy constants are. Also, use a shift one fewer left to avoid integer overflow causing incorrect results, and adjust the equasion accordingly. Document this. Allow times >= 1s to be well defined for these conversion functions (at least the Xstosbt). There's too many users in the tree that they work for >= 1s. This fixes a failure on boot to program firmware on the mlx4 NIC. There was a msleep(1000) in the code. Prior to my recent rounding changes, msleep(1000) worked, but msleep(1001) did not because the old code rounded to just below 2^64 and the new code rounds to just above it (overflowing, causing the msleep(1000) to really sleep 1ms). A test program to test all cases will be committed shortly. The test exaustively tries every value (thanks to bde for the test). Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D18051
2018-12-04When converting ns,us,ms to sbt, return the ceil()imp1-3/+7
of the result rather than the floor(). Returning the floor means that sbttoX(Xtosbt(y)) != y for almost all values of y. In practice, this results in a difference of at most 1 in the lsb of the sbintime_t. This difference is meaningless for all current users of these functions, but is important for the newly introduced sysctl conversion routines which implicitly rely on the transformation being idempotent. Sponsored by: Netflix, Inc
2018-12-04Correct a misplaced closing paren.ian1-3/+3
Does not affect the result, but does clarify (at least for me) that the multiplication happens before the shift.
2018-12-04sys: further adoption of SPDX licensing ID tags.pfg1-0/+2
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.
2018-12-04Add inline functions to convert between sbintime_tian1-7/+52
and decimal time units. Use them in some existing code that is vulnerable to roundoff errors. The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into writing code such as long_timeout_ns*SBT_1NS to generate the argument for a sleep call. The actual value of 1ns in sbt units is ~4.3, leading to a large roundoff error giving a shorter sleep than expected when multiplying by the trucated value of 4 in SBT_1NS. (The evil honeypot aspect becomes clear after you waste a whole day figuring out why your sleeps return early.)
2018-12-04Renumber copyright clause 4imp1-1/+1
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
2018-11-29stdio.h: Expose cuserid with __GNU_VISIBLECorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-11-29time.h: Introduce Linux-specific CLOCK id valuesCorinna Vinschen1-4/+18
- Add CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME - Guard new values with __GNU_VISIBLE - Add CLOCK_REALTIME_COARSE as (clockid_t) 0 for simplicity (It allows to have all values < 8 and so be used as array index into an array of clocks) - Fix macro bracketing Signed-off-by: Corinna Vinschen <corinna@vinschen.de>