summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
* Add nonnull annotation to posix_memalign.Peter Foley2016-03-211-1/+1
| | | | | | | | | | | | | | | | GCC 6.0+ asserts that the memptr argument to the builtin function posix_memalign is nonnull. Add the necessary annotation to the prototype and remove the now unnecessary check to fix a warning. newlib/Changelog newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as non-null. winsup/cygwin/ChangeLog malloc_wrapper.cc (posix_memalign): Remove always true nonnull check. Signed-off-by: Peter Foley <pefoley2@pefoley.com>
* Move arc4random Cygwin only code to CygwinSebastian Huber2016-03-211-15/+0
| | | | | | Keep the Newlib arc4random.c identical to the OpenBSD upstream version. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>.
* Allow machine-dependent arc4 lockingCorinna Vinschen2016-03-201-18/+5
| | | | | | | | | | | | newlib: * libc/stdlib/arc4random.h: Remove Cygwin-specific locking code. Conditionalize arc4 locking. Check for _ARC4_LOCK_INIT being undefined to fall back to default implementation. cygwin: * include/machine/_arc4random.h: New file. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Regenerate configure script.Jeff Johnston2016-03-191-8/+9281
|
* sparc64: move struct timeval to <sys/_timeval.h>Yaakov Selkowitz2016-03-181-1/+6
| | | | | | | | | | | commit bb0159489785d577ad0b8061a1ba7956ee0f89d0 moved the struct timeval declaration from <sys/time.h> to <sys/_timeval.h>, and commit 01885f533de81ff73e9da1519a4b5f2316b49f86 changed <sys/select.h> to include <sys/_timeval.h>. Therefore, sparc64's own struct timeval needs to be moved accordingly in order to avoid a conflict from the generic type. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Acked-by: Corinna Vinschen <vinschen@redhat.com>
* Feature test macros overhaul: sparc64Yaakov Selkowitz2016-03-182-15/+16
| | | | | | | | | | | | sparc64 has a number of its own headers which override the generic ones. These too need to use feature test macros properly. These changes correspond to the generic fcntl.h and sys/stat.h changes in commit d2df6d381b36f3f76420bc3bab965fbbdc3c3a8c and commit 069e400c913659432c5d1953c4fa9a696b06e340. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Acked-by: Corinna Vinschen <vinschen@redhat.com>
* Cleanup macros in chacha_private.h to be target-type independentHowland, Craig D2016-03-181-5/+2
| | | | | * libc/stdlib/chacha_private.h (U8C, U32C): Remove un-necessary macros. (U8V, U32V): Drop masking.
* Only export arc4random_stir and arc4random_addrandom on CygwinCorinna Vinschen2016-03-181-8/+5
| | | | | | | Export to maintain backward compatibility, but don't let them do anything useful. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Feature test macros overhaul: signal.h (part 2)Yaakov Selkowitz2016-03-181-16/+12
| | | | | | | | | | | Move the sig*set macros following the functions inside their feature test macro conditional. This fixes the build on bare-metal targets following commit 5c78499ae2ae6ac28854b43a1ad73d917b40c62d. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Acked-by: Corinna Vinschen <vinschen@redhat.com>
* arm: fix build with newlib supplied syscalls enabledYaakov Selkowitz2016-03-182-2/+2
| | | | | | | | | In file included from libc/sys/arm/crt0.S:2:0: libc/sys/arm/arm.h:32:25: fatal error: acle-compat.h: No such file or directory acle-compat.h is libc/machine/arm. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Arc4random locking: Check for threaded application on CygwinCorinna Vinschen2016-03-181-0/+19
| | | | | | | libc/stdlib/arc4random.h (_ARC4_LOCK): Special case Cygwin. (_ARC4_UNLOCK): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add arc4random_stir and arc4random_addrandom for OpenBSD compatibilityCorinna Vinschen2016-03-181-0/+18
| | | | | | | * libc/stdlib/arc4random.c (arc4random_stir): New function. (arc4random_addrandom): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add arc4random() etc. from OpenBSD 5.8Sebastian Huber2016-03-1810-7/+626
| | | | | | | | | | | | | | | | | | | | | | | | | | | According to the OpenBSD man page, "A Replacement Call for Random". It offers high quality random numbers derived from input data obtained by the OpenBSD specific getentropy() system call which is declared in <unistd.h> and must be implemented for each Newlib port externally. The arc4random() functions are used for example in LibreSSL and OpenSSH. Cygwin provides currently its own implementation of the arc4random family. Maybe it makes sense to use this getentropy() implementation: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/crypto/getentropy_win.c?rev=1.4&content-type=text/x-cvsweb-markup * libc/include/stdlib.h (arc4random): Declare if __BSD_VISIBLE. (arc4random_buf): Likewise. (arc4random_uniform): Likewise. * libc/include/sys/unistd.h (getentropy): Likewise. * libc/include/machine/_arc4random.h: New file. * libc/stdlib/arc4random.c: Likewise. * libc/stdlib/arc4random.h: Likewise. * libc/stdlib/arc4random_uniform.c: Likewise. * libc/stdlib/chacha_private.h: Likewise. * libc/sys/rtems/include/machine/_arc4random.h: Likewise. * libc/stdlib/Makefile.am (EXTENDED_SOURCES): Add arc4random.c and arc4random_uniform.c. * libc/stdlib/Makefile.in: Regenerate.
* Add timingsafe_memcmp()Sebastian Huber2016-03-184-18/+74
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (timingsafe_memcmp): Declare. * libc/string/timingsafe_memcmp.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Add timingsafe_bcmp()Sebastian Huber2016-03-184-21/+59
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (timingsafe_bcmp): Declare. * libc/string/timingsafe_bcmp.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Add explicit_bzero()Sebastian Huber2016-03-184-46/+75
| | | | | | | | | | This function is used by LibreSSL and OpenSSH and is provided by the OpenBSD libc. * libc/include/string.h (explicit_bzero): Declare. * libc/string/explicit_bzero.c: New file. * libc/string/Makefile.am: Add new file. * libc/string/Makefile.in: Regenerate.
* Guard ssize_t definition by _SSIZE_T_DECLAREDSebastian Huber2016-03-181-0/+4
| | | | | | | | This guard is used by FreeBSD <sys/socket.h> for example. The FreeBSD network stack is used in RTEMS. * newlib/libc/include/sys/types.h (ssize_t): Guard by _SSIZE_T_DECLARED.
* Feature test macros overhaul: sys/types.hYaakov Selkowitz2016-03-171-4/+7
| | | | | | | The u_int/u_char/etc. BSD types are needed by Cygwin's netinet/*.h headers, so they always need to be available. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Revert "Remove inclusion of sys/select.h in sys/types.h for backward compat"Yaakov Selkowitz2016-03-171-0/+2
| | | | | | This BSDism is still in use (e.g. putty). This reverts commit 088f7a723962dd18dcae09e8e8fa168bbea6ed0b.
* Feature test macros overhaul: sys/time.hYaakov Selkowitz2016-03-171-5/+8
| | | | | | | The inclusion of <sys/select.h> is required also by POSIX.1-2001. setitimer is XSI, and futimesat is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: sys/stat.hYaakov Selkowitz2016-03-171-10/+6
| | | | | | | Replace all !_POSIX_SOURCE with BSD. All *at functions depend on ATFILE; futimens is POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: sys/select.hYaakov Selkowitz2016-03-171-4/+5
| | | | | | Remove !_POSIX_SOURCE conditional; pselect is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: wchar.hYaakov Selkowitz2016-03-171-0/+2
| | | | | | open_wmemstream is POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: unistd.hYaakov Selkowitz2016-03-171-35/+41
| | | | | | | Throughout, use proper internal macros for functions, including those marked as target-specific. Use ATFILE for all *at functions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: time.hYaakov Selkowitz2016-03-171-2/+13
| | | | | | Throughout, replace __STRICT_ANSI__ with the proper internal macros. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: strings.hYaakov Selkowitz2016-03-171-3/+3
| | | | | | Replace __STRICT_ANSI__ with the proper internal macros for bcmp etc. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: string.hYaakov Selkowitz2016-03-171-23/+15
| | | | | | | | | | | | | | Throughout, remove __STRICT_ANSI__ and use the proper internal macros. bcmp, bcopy, bzero, index, and rindex were in POSIX prior to 2008. memrchr is GNU. strdup and strndup are POSIX.1-2008. The int-returning form of strerror_r is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: stdlib.hYaakov Selkowitz2016-03-173-46/+55
| | | | | | | | | | | | | | | | | | | | Throughout, simplify the C99/C11 conditionals, and replace __STRICT_ANSI__ with the proper internal POSIX macros. The _*_r reentrant functions need not be guarded (and most haven't been) because such names in the global scope are reserved to the implementation. atoff is unique to newlib. dtoa is not actually exported (_dtoa_r is used internally), is nonstandard, and the declaration conflicts with the code included in MySQL, NSPR, and SpiderMonkey. mktemp was removed in POSIX.1-2001. The qsort_r declarations are reordered so that the GNU version retains precedence. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: stdio.hYaakov Selkowitz2016-03-172-33/+46
| | | | | | | | | | | | | | Throughout, remove references to __STRICT_ANSI__ and use the proper internal macros and versions for C99, POSIX, ATFILE for the various *at functions, or LARGEFILE for fseeko and ftello. [v]asprintf are GNU extensions, but the *iprintf, *iscanf, and *asnprintf functions are unique to newlib. getw and putw were removed from POSIX.1-2001. funopen is BSD, and fopencookie is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: signal.hYaakov Selkowitz2016-03-172-15/+11
| | | | | | | | | | | | Use proper internal macros for BSD sig_t and GNU sighandler_t. sigaltstack and friends are XSI even in SUSv4 but in glibc are nonetheless handled as POSIX.1-2008 (not 2001). The requirement for the ucontext_t typedef in signal.h was XSI prior to POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: pwd.hYaakov Selkowitz2016-03-171-2/+2
| | | | | | getpw*_r dates back to POSIX.1c, and *pwent to XPG4v2. Both are also BSD. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: pthread.hYaakov Selkowitz2016-03-171-2/+2
| | | | | | Use internal macros for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: math.hYaakov Selkowitz2016-03-171-20/+23
| | | | | | | | | Simplify the C99 conditionals. Mark the drem and gamma functions as BSD|SVID, the Bessel double functions also XSI and the floats also SUSv3. signgam is BSD|SVID|XSI, and matherr is SVID. Finally, use the internal macros to control the symbolic constants. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: limits.hYaakov Selkowitz2016-03-171-3/+3
| | | | | | Simplify the C99 conditional, and use the internal macro for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: grp.hYaakov Selkowitz2016-03-171-3/+5
| | | | | | | _PATH_GROUP is a BSDism. getgr*_r are BSD|SVID|POSIX, and the *grent functions are BSD|SVID|XPG4v2. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: fnmatch.hYaakov Selkowitz2016-03-171-3/+3
| | | | | | Use the proper internal macro for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: fcntl.hYaakov Selkowitz2016-03-171-14/+14
| | | | | | | | | | Most of the !_POSIX_SOURCE code is BSD, although ironically some were added to POSIX.1-2001. Use the ATFILE conditional for most of the *at functions, except futimesat which is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: dirent.hYaakov Selkowitz2016-03-171-1/+2
| | | | | | | | | | MAXNAMLEN is a BSDism. Use the proper internal macros instead of !_POSIX_SOURCE. telldir and seekdir are XSI, scandir and alphasort are POSIX.1-2008, and scandirat is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: ctype.hYaakov Selkowitz2016-03-171-6/+7
| | | | | | Simplify C99 test for isblank. isascii and toascii are BSD|SVID|XSI. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: sys/features.hYaakov Selkowitz2016-03-173-148/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the complete rework of the feature tests macros for better compatibility with GNU libc, primarily based on the Linux man pages documentation: http://man7.org/linux/man-pages/man7/feature_test_macros.7.html The previous implementation was flawed in its approach that macros were often used to hide symbols if defined (e.g. !defined __STRICT_ANSI__ or !defined _POSIX_SOURCE), whereas the approach of glibc is that these macros make symbols available when defined (e.g. defined _BSD_SOURCE, or as used internally, #if __BSD_VISIBLE). As much open-source software is written with glibc in mind, this necessitated patching numerous packages just to compile. In particular, __STRICT_ANSI__ (which is defined by gcc -ansi or -std=c*) was given too much importance. This implementation limits the influence of __STRICT_ANSI__ to controlling the default when no other feature test macros are defined, and to the inclusion of <alloca.h> in <stdlib.h> as documented. These are the only places where __STRICT_ANSI__ should be tested. The following macros are now accepted: _ATFILE_SOURCE, _BSD_SOURCE, _DEFAULT_SOURCE, _ISOC99_SOURCE, _ISOC11_SOURCE, _LARGEFILE_SOURCE, _SVID_SOURCE, _XOPEN_SOURCE_EXTENDED. The existing __*_VISIBLE internal macros have been kept mostly compatible with the original BSD implementation, with some changes to the criteria which controls them. Several more macros in this style have been added where needed for concision or accuracy. Enabling C++11 or newer in the compiler also enables C99 and C11 functions. Doing so should help move away from the need to define _GNU_SOURCE in g++ for _GLIBCXX_USE_C99 support as on Linux: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749 Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* setvbuf: Drop setting reent->__cleanupCorinna Vinschen2016-03-131-1/+0
| | | | | | | | The __sinit call added with 1eb6db6 already sets reent->__cleanup. * libc/stdio/setvbuf.c (setvbuf): Drop setting reent->__cleanup. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Update setvbuf to latest OpenBSD implementationCorinna Vinschen2016-03-121-42/+75
| | | | | | | | | | | | | | | | | | Newlib's setvbuf function is very old and has two bugs: - It sets the SRD/SWR flags incorrectly in case of files opened for reading and writing. See https://cygwin.com/ml/cygwin/2016-03/msg00180.html for a desription of the effect. - It always sets the buffer size to BUFSIZ if it's not provided by the application, independent of the optimal blocksize for the underlying IO device. Update setvbuf to latest code from OpenBSD to fix both problems. * libc/stdio/setvbuf.c (setvbuf): Import latest OpenBSD implementation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add __swhatbuf function from OpenBSDCorinna Vinschen2016-03-122-49/+60
| | | | | | | | | | | To fix a long-standing setvbuf bug, import __swhatbuf function from OpenBSD and only slightly rearrange for newlib. * libc/stdio/local.h (__swhatbuf_r): Declare. * libc/stdio/makebuf (__smakebuf_r): New function. (__smakebuf_r): Drop file handling code and call __smakebuf_r. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use __sputc_r inline code when building with gccCorinna Vinschen2016-03-121-3/+5
| | | | | | | | | | | | Per the preceeding comment this inline code is disabled since 1993(!) because of a bug in GCC at the time. This is long gone and the equivalent inline code is used in the BSDs for quite some time. Enable this code for newlib as well. * libc/include/stdio.h (__sputc_r): Enable GCC inline code. Add handling for targets defining __SCLE. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Enable HW interrupt setup on x86/x86_64 systems by defaultnewlib-snapshot-20160226Corinna Vinschen2016-02-265-7/+5
| | | | | | | | | | | | | * configure.host: Define _I386MACH_DISABLE_HW_INTERRUPTS on rdos. Remove setting _I386MACH_ALLOW_HW_INTERRUPTS anywhere else. * libc/machine/i386/i386mach.h: Replace test for _I386MACH_ALLOW_HW_INTERRUPTS with test for !_I386MACH_DISABLE_HW_INTERRUPTS. * libc/machine/x86_64/x86_64mach.h: Ditto. * libc/sys/linux/machine/i386/i386mach.h: Ditto. * libm/machine/i386/i386mach.h: Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* newlib/configure.host: Turn off sti/cli for i386 setjmp for i386-rtems*Joel Sherrill2016-02-251-0/+2
|
* Fix _newlib_version.h logic to support building gcc with newlib.Jeff Johnston2016-02-254-4/+11
|
* libm/complex: add clog10, clog10fYaakov Selkowitz2016-02-226-24/+105
| | | | | | | | | | | | | | newlib/ * libc/include/complex.h (clog10, clog10f): Declare. * libm/complex/Makefile.am (src): Add clog10.c. (fsrc): Add clog10f.c. (CHEWOUT_FILES): Add clog10.def. * libm/complex/Makefile.in: Regenerate. * libm/complex/clog10.c: New file. * libm/complex/clog10f.c: New file. * libm/complex/complex.tex: Add references to clog10 docs. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* pthread.h, sys/types.h Add missing pthread methodsJoel Sherrill2016-02-222-8/+24
| | | | | | | | | * pthread.h: Add prototypes for pthread_condattr_getclock(), pthread_condattr_setclock(), pthread_setschedpri(), pthread_getcpuclockid(), pthread_getconcurrency(), and pthread_setconcurrency(). Also cleaned up file header to remove CVS Id string. * sys/types.h: Add clock ID to pthread_condattr_t.
* sys/features.h: Update Cygwin POSIX option macrosCorinna Vinschen2016-02-181-34/+34
| | | | | | | | * libc/include/sys/features.h: Set POSIX option macros from 200112L to 200809L for Cygwin. (_POSIX_SPAWN): Set to 200809L for Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>