summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include
Commit message (Collapse)AuthorAgeFilesLines
* sys/time.h: Change visibility of gettimeofday.Corinna Vinschen2016-06-201-1/+2
| | | | | | | gettimeofday is currently guarded with __MISC_VISIBLE || __XSI_VISIBLE. However, gettimeofday should be always visible, as in GLibc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Declare crypt, encrypt, and setkey per PosixKen Brown2016-06-092-0/+9
|
* math.h: Replace usage of INT_MAX with __INT_MAX__Corinna Vinschen2016-05-311-2/+2
| | | | | | | Using INT_MAX requires to include limits.h on most targets. Math.h must not rely on that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Feature test macros: ctermid, cuseridYaakov Selkowitz2016-05-232-3/+13
| | | | | | | | | | The proper location for these functions has always been <stdio.h>, however XPG4 and SUSv2 did mandate a duplicate declaration in <unistd.h>. cuserid was dropped in SUSv3 (it was marked legacy since XPG4) and the ctermid declaration in <unistd.h> was made optional and obsolete in SUSv4. Fixes: https://cygwin.com/ml/cygwin/2016-05/msg00002.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Make sure to have full configuration info in sys/_types.h.Corinna Vinschen2016-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The following testcase: $ cat > test.c <<EOF #include <sys/select.h> #include <sys/time.h> EOF $ gcc -c test.c emits the following error: /usr/include/sys/reent.h:276:3: error: expected specifier-qualifier-list befor e ‘_fpos64_t’ _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int)); ^ The reason is that the load order from sys/select.h includes sys/_types.h before sys/config.h has been included from anywhere else. sys/_types.h defines _fpos64_t only if __LARGE64_FILES is defined, but it never is in this scenario. So sys/_types.h has to make sure to get the configuration info by itself. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Always provide register_t via <sys/types.h>Sebastian Huber2016-04-211-4/+2
| | | | | | | | Always provide register_t via <sys/types.h> for glibc and BSD compatibility. Define __BIT_TYPES_DEFINED__ to 1 like glibc for legacy header files. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Simplify guard against defining pthread types on CygwinCorinna Vinschen2016-04-211-9/+9
| | | | | | | * libc/include/sys/types.h: Fix a comment about Cygwin. Simplify guarding pthread types against inclusion on Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Resurrect <machine/types.h> for <sys/types.h>Sebastian Huber2016-04-213-20/+9
| | | | | | | | | | | Resurrect <machine/_user_types.h> for use in <sys/types.h>. Newlib targets may provide an own version of <machine/types.h> in their machine directory to add custom user types for <sys/types.h>. Check the _SYS_TYPES_H header guard to prevent a direct include of <machine/types.h>, since the <machine/types.h> file is a Newlib speciality. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Remove duplicate int*_t definitionsSebastian Huber2016-04-201-4/+0
| | | | | | | Types are already available via <sys/_stdint.h> included some lines above. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Remove duplicate u_int*_t definitionsSebastian Huber2016-04-201-4/+0
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add __ssize_t to <sys/_types.h>Sebastian Huber2016-04-191-0/+2
| | | | | | Add __ssize_t to <sys/_types.h> for BSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide in_port_t via <sys/types.h>Sebastian Huber2016-04-191-0/+5
| | | | | | | Provide in_port_t via <sys/types.h> if __BSD_VISIBLE for BSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide in_addr_t via <sys/types.h>Sebastian Huber2016-04-191-0/+5
| | | | | | | Provide in_addr_t via <sys/types.h> if __BSD_VISIBLE for BSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Introduce __sa_family_t for BSD compatibiliySebastian Huber2016-04-191-0/+4
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Introduce __socklen_t for BSD compatibilitySebastian Huber2016-04-191-0/+4
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* BSD compatibility for <machine/endian.h>Sebastian Huber2016-04-192-10/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce <machine/_endian.h> to let target based customization of <machine/endian.h> via * _LITTLE_ENDIAN, * _BIG_ENDIAN, * _PDP_ENDIAN, and * _BYTE_ORDER. defines. Add definitions expected by FreeBSD to <machine/endian.h> like * _QUAD_HIGHWORD, * _QUAD_LOWWORD, * __bswap16(), * __bswap32(), * __bswap64(), * __htonl(), * __htons(), * __ntohl(), and * __ntohs(). Also, if __BSD_VISIBLE * LITTLE_ENDIAN, * BIG_ENDIAN, * PDP_ENDIAN, and * BYTE_ORDER. Targets that define __machine_host_to_from_network_defined in <machine/_endian.h> must provide their own implementation of * __htonl(), * __htons(), * __ntohl(), and * __ntohs(), otherwise a default implementation is provided by <machine/endian.h>. In case of GCC defines to builtins are used. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix definition of __size_tSebastian Huber2016-04-181-2/+2
| | | | | | Fix definition of __size_t in case __SIZE_TYPE__ is not defined. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide FNONBLOCK for BSD compatiblitySebastian Huber2016-04-151-0/+4
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide __size_t via <sys/_types.h>Sebastian Huber2016-04-152-2/+17
| | | | | | | | | | | | | | | | | | | | | Various FreeBSD source and header files need a typedef __size_t via <sys/_types.h>. Unfortunately the GCC provided <stddef.h> uses #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 and therefore defines __size_t on Newlib targets which would trash a __size_t typedef. Include <stddef.h> before <sys/_types.h> in <sys/types.h> and undefine __size_t in <sys/_types.h> as a workaround. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Include <machine/endian.h> in <sys/types.h>Sebastian Huber2016-04-151-0/+1
| | | | | | | Include <machine/endian.h> in <sys/types.h> if __BSD_VISIBLE for BSD compatibility. This is in line with glibc <sys/types.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add __va_list to <sys/_types.h>Sebastian Huber2016-04-151-0/+6
| | | | | | | | Add __va_list to <sys/_types.h> for BSD compatibility. In FreeBSD this typedef is provided by the various architecture-specific <machine/_types.h> in a copy and paste manner. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guards for fixed-size integer typesChristian Mauderer2016-04-151-4/+35
| | | | Signed-off-by: Christian Mauderer <christian.mauderer@embedded-brains.de>
* Add BSD guard for useconds_tSebastian Huber2016-04-152-1/+5
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for nlink_tSebastian Huber2016-04-152-1/+5
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide POSIX defined fsblkcnt_t and fsfilcnt_tSebastian Huber2016-04-152-0/+14
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide POSIX defined blksize_t in <sys/types.h>Sebastian Huber2016-04-153-1/+10
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide POSIX defined blkcnt_t in <sys/types.h>Sebastian Huber2016-04-153-1/+10
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for timer_tSebastian Huber2016-04-152-4/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for clockid_tSebastian Huber2016-04-152-4/+7
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for time_tSebastian Huber2016-04-155-9/+15
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for clock_tSebastian Huber2016-04-153-7/+11
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Define mode_t via __mode_tSebastian Huber2016-04-152-44/+22
| | | | | | Use __uint32_t to avoid the use of GCC-specific _ST_INT32. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add BSD guard for ino_t in <sys/types.h>Sebastian Huber2016-04-152-7/+12
| | | | | | Introduce internal type __ino_t. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide POSIX defined id_t in <sys/types.h>Sebastian Huber2016-04-152-0/+9
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Use __machine_*_t_defined for internal typesSebastian Huber2016-04-151-14/+24
| | | | | | | | | | | | | | | | | | | | | | Newlib defines defaults for internal types via <sys/_types.h> and uses <machine/_types.h> to let targets define their own type if necessary. Previously for example #ifndef __dev_t_defined typedef short __dev_t; #endif However, the __*_t_defined pattern conflicts with the glibc type guard pattern for user types, e.g. dev_t in this example. Introduce a __machine_*_t_defined pattern for internal types (defined by <machine/_types.h>, used by <sys/_types.h>). For example #ifndef __machine_dev_t_defined typedef short __dev_t; #endif Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Feature test macros overhaul: string.h and strings.h overlapsYaakov Selkowitz2016-04-132-7/+12
| | | | | | | | | | | strings.h is the header mandated for these functions in POSIX.1 prior to 2008 (when most of these were removed). The declarations in string.h are only for BSD compatibility. But when both headers are included, avoid duplicate declarations. Also, mark stpcpy and stpncpy as POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Get rid of some special cases for Cygwin in sys/types.hCorinna Vinschen2016-04-132-4/+7
| | | | | | | | | Remove off_t typedef from cygwin/types.h thus relying on sys/types.h. Introduce winsup/cygwin/machine/_types.h and move some types shared with newlib into it. Get rid of their definition in cygwin/types.h. Add same handling for __key_t/key_t as for the other types. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add BSD guards for off_t, dev_t, uid_t, and gid_tSebastian Huber2016-04-131-4/+16
| | | | | | | Copy definitions of off_t, dev_t, uid_t, and gid_t verbatim from latest FreeBSD <sys/types.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Eliminate use of Newlib-specific <machine/types.h>Sebastian Huber2016-04-139-35/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change solves a glibc/BSD compatibility problem. glibc and BSD use double underscore types for internal types. The Linux port of Newlib uses some glibc provided internal type definitions which are not protected by guard defines, e.g. __off_t. To avoid a conflict Newlib uses single underscore types for some internal types, e.g. _off_t. However, for BSD compatibility we have to define the internal types with double underscore names in <sys/_types.h>. The header file <machine/types.h> is Newlib-specific. It was used instead of <sys/_types.h> to provide the internal type definitions _CLOCK_T, _TIME_T_, _CLOCKID_T_, _TIMER_T_, and __suseconds_t. Move these definitions to <sys/_types.h> (there exist two instances of this file, one for Linux and one for all other targets). This makes the _HAVE_SYSTYPES configuration define obsolete (could possibly break the __RDOS__ target). Use the standard <sys/_types.h> include throughout. Move __loff_t defintion to default (non-Linux) <sys/_types.h>. Define it via _off64_t to avoid a dependency on the compiler. Provide the __off_t definition via default (non-Linux) <sys/_types.h> based on _off_t for all systems except Cygwin. For Cygwin use _off64_t. Define off_t via __off_t. Provide the __pid_t definition via default (non-Linux) <sys/_types.h>. This prevents a potential __pid_t and pid_t incompatibility. Add BSD guard defines for pid_t. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Move kernel dependent parts of <sys/time.h>cygwin-2_5_0-releaseSebastian Huber2016-04-082-149/+5
| | | | | | | | Move the kernel dependent parts of <sys/time.h> to new system-specific header file <machine/_time.h>. Provide an empty default implementation. Add a specialized implementation for RTEMS. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* math: update isinf/isnan function comments after move to math.hYaakov Selkowitz2016-04-051-1/+1
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* math: guard BSD finite/isinf/isnan functions properly in math.hYaakov Selkowitz2016-04-042-19/+19
| | | | | | | | | | | | | | | | | | | | | | | Now that we have properly functioning feature test macros, the BSD floating-point classification functions can go into math.h instead of the non-standard ieeefp.h, and not under the C99 guard: http://man7.org/linux/man-pages/man3/finite.3.html The isnan function was in earlier versions of SUS but removed starting with POSIX.1-2001, compare: http://pubs.opengroup.org/onlinepubs/007908799/xsh/math.h.html http://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html Note that the isinf and isnan functions (but not the variants) conflict with functions by the same name in C++11, hence they (and only they) need to be hidden: https://sourceware.org/git/?p=glibc.git;a=commit;h=d9b965fa56350d6eea9f7f438a0714c7ffbb183f https://sourceware.org/git/?p=glibc.git;a=commit;h=3c47c83a9730c20e602694505b9278c25637b0d0 Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: tar.hYaakov Selkowitz2016-04-041-0/+4
| | | | | | | | | | TSVTX was marked XSI beginning with SUSv3, compare: http://pubs.opengroup.org/onlinepubs/007908799/xsh/tar.h.html http://pubs.opengroup.org/onlinepubs/009695399/basedefs/tar.h.html http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tar.h.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Add cpio.hYaakov Selkowitz2016-04-041-0/+30
| | | | | | | | This header dates back to XPG3: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* cygwin: make POSIX/XSI version macros dependent on feature test macrosYaakov Selkowitz2016-04-041-10/+37
| | | | | | | | | | | | | Each version of SUS specifies a different value for _POSIX_VERSION, _POSIX2_VERSION, and _XOPEN_VERSION. glibc also changes the value of the other _POSIX2_ variables but not the _POSIX_* variables. _POSIX_TIMERS should be set to a version number, not just 1. The _POSIX_V7_* macros were missing, which was not noticed because the V6 values were aliased in sysconf (<unistd.h>). Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Add Intel MCU targetIgor Venevtsev2016-04-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Intel MCU System V ABI are incompartible with i386 System V ABI: o Minimum instruction set is Intel Pentium ISA minus x87 instructions o No x87 or vector registers o First three args are passed in %eax, %edx and %ecx o Full specification available here: https://github.com/hjl-tools/x86-psABI/wiki/iamcu-psABI-0.7.pdf newlib/ * configure.host: Add new ix86-*-elfiamcu target newlib/libc/include/ * setjmp.h: Change _JBLEN for Intel MCU target newlib/libc/machine/i386/ * memchr.S: (memchr) Target-specific size-optimized version * memcmp.S: (memcmp) Likewise * memcpy.S: (memcpy) Likewise * memmove.S: (memmove) Likewise * memset.S: (memset) Likewise * setjmp.S: (setjmp) Likewise * strchr.S: (strchr) Likewise * strlen.S: (strlen) Likewise newlib/libc/stdlib/ * srtold.c: (__flt_rounds) Disable for Intel MCU
* Add missing long double functions to CygwinCorinna Vinschen2016-03-293-9/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the long double functions missing in newlib to Cygwin. Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l}, isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib. Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin. Cygwin: * math: New subdir with math functions. * Makefile.in (VPATH): Add math subdir. (MATH_OFILES): List of object files collected from building files in math subdir. (DLL_OFILES): Add $(MATH_OFILES). ${CURDIR}/libm.a: Add $(MATH_OFILES) to build. * common.din: Add new functions from math subdir. * i686.din: Align to new math subdir. Remove functions now commonly available. * x86_64.din: Ditto. * math.h: math.h wrapper to define mingw structs used in some files in math subdir. * include/cygwin/version.h: Bump API minor version. newlib: * libc/include/complex.h: Add prototypes for complex long double functions. Only define for Cygwin. * libc/include/math.h: Additionally enable prototypes of long double functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl, exp10l and pow10l. Explain why we don't add them to newlib. * libc/include/tgmath.h: Enable long double handling on Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add simple versions of random() and srandom()Joel Sherrill2016-03-281-0/+6
| | | | | | | | | | | | | Prototypes also added for initstate() and setstate() but they were not implemented in the shared newlib code. * newlib/libc/include/cygwin/stdlib.h: Prototypes added. * winsup/cygwin/include/cygwin/stdlib.h: Prototypes removed. * newlib/libc/stdlib/random.c: New file. * newlib/libc/machine/epiphany/machine/stdlib.h: Removed * newlib/libc/stdlib/Makefile.am: Added random.c. * newlib/libc/stdlib/stdlib.tex: Added random.def. * newlib/libc/stdlib/Makefile.in: Regenerated.
* math.h: Use GCC builtins for C99 macros where availableCorinna Vinschen2016-03-261-19/+55
| | | | | | | | | | | | | | | | GCCs builtin functions are mostly type agnostic and architecture indepedent. Prefer to use them if available. * libc/include/math.h (fpclassify, isfinite, isinf, isnan, isnormal): Use matching GCC builtin functions if built with GCC 4.4 or later. (signbit): Use matching GCC builtin functions if built with GCC 4.0 or later. (isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered): Use matching GCC builtin functions if built with GCC 2.97 or later. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Drop usage of old-age BSD types in generically used Cygwin headersCorinna Vinschen2016-03-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | u_char, u_short, u_int, u_long are BSD-only types. Remove them from Cygwin headers which are supposed to be used in a non-BSD scenario. Drop special Cygwin handling of those types in sys/types.h. newlib: * libc/include/sys/types.h (u_char,u_short,u_int,u_long): Drop Cygwin exception. cygwin: * fhandler_socket.cc (fhandler_socket::ioctl): Accommodate change in include/asm/socket.h. Continue using u_long since that's the MS type here. * include/asm/socket.h: Since the type given in _IOR/_IOW macros is only used for its sizeof, replace u_long with equivalent long. * netdb.h (getnetbyaddr): Fix prototype. * netinet/ip.h: Replace old BSD-only types with generically defined old BSD types (u_char -> u_int8_t, etc). * netinet/tcp.h: Ditto. * netinet/udp.h: Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>