summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/sys
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-091-0/+6
|
* Feature test macros: ctermid, cuseridYaakov Selkowitz2016-05-231-0/+4
| | | | | | | | | | 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-212-11/+4
| | | | | | | | | | | 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>
* 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>
* 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-137-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-081-149/+2
| | | | | | | | 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>
* 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>
* 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>
* Define BSD u_intN_t types indiscriminatelyCorinna Vinschen2016-03-241-17/+14
| | | | | | | | | | | | | | The u_intN_t types are BSD types but sanctioned by POSIX. They are always defined when using Glibc headers so we follow suit. newlib: * libc/include/sys/types.h: Drop outdated __INTTYPES_DEFINED__ macro. Always define u_intN_t types. cygwin: * include/cygwin/types.h: Remove definition of u_intN_t types. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Feature test macros overhaul: C++ TR1Yaakov Selkowitz2016-03-231-5/+5
| | | | | | | | | | | | While C++11 was the first version of the standard to use C99 functionality, TR1 (for C++03) also does, and G++ does not distinguish between C++98 and C++03, or when TR1 is in use. Therefore, while not strictly correct for "pure" C++98, enabling C99 for all C++ usage is the simplest solution (and much better than always using -D_GNU_SOURCE as on Linux). See thread starting: https://sourceware.org/ml/newlib/2016/msg00297.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Guard u_char,u_short,u_int,u_long with __MISC_VISIBLECorinna Vinschen2016-03-231-1/+1
| | | | | | | | | These types are available in SVID as well. * libc/include/sys/types.h (u_char,u_short,u_int,u_long): Replace __BSD_VISIBLE with __MISC_VISIBLE. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix "/*" within comment warningSebastian Huber2016-03-221-1/+1
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.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>
* Add arc4random() etc. from OpenBSD 5.8Sebastian Huber2016-03-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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>