Commit Graph

400 Commits

Author SHA1 Message Date
Sebastian Huber f18eebf797 Add BSD guard for clock_t
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Sebastian Huber eba91a5d0a Define mode_t via __mode_t
Use __uint32_t to avoid the use of GCC-specific _ST_INT32.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Sebastian Huber e77040b2bf Add BSD guard for ino_t in <sys/types.h>
Introduce internal type __ino_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Sebastian Huber eeded3c170 Provide POSIX defined id_t in <sys/types.h>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Sebastian Huber 8a5af1a184 Use __machine_*_t_defined for internal types
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>
2016-04-15 14:51:39 +02:00
Corinna Vinschen 7b39124400 Get rid of some special cases for Cygwin in sys/types.h
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>
2016-04-13 21:00:17 +02:00
Sebastian Huber de51829c17 Add BSD guards for off_t, dev_t, uid_t, and gid_t
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>
2016-04-13 13:54:39 +02:00
Sebastian Huber 477463a201 Eliminate use of Newlib-specific <machine/types.h>
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>
2016-04-13 13:30:27 +02:00
Sebastian Huber 3156cdcc80 Move kernel dependent parts of <sys/time.h>
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>
2016-04-08 11:34:42 +02:00
Yaakov Selkowitz d55d03a87d cygwin: make POSIX/XSI version macros dependent on feature test macros
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>
2016-04-04 10:25:25 -05:00
Corinna Vinschen b1b46d4580 Drop usage of old-age BSD types in generically used Cygwin headers
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>
2016-03-24 15:55:25 +01:00
Corinna Vinschen db5bfdbd8a Define BSD u_intN_t types indiscriminately
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>
2016-03-24 15:51:14 +01:00
Yaakov Selkowitz b9bbe1bccb Feature test macros overhaul: C++ TR1
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>
2016-03-23 16:14:00 -05:00
Corinna Vinschen 3f258ada43 Guard u_char,u_short,u_int,u_long with __MISC_VISIBLE
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>
2016-03-23 11:17:59 +01:00
Sebastian Huber 98b615106d Fix "/*" within comment warning
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-03-22 22:39:22 +01:00
Yaakov Selkowitz d3f203d091 Feature test macros overhaul: signal.h (part 2)
Move the sig*set macros following the functions inside their feature
test macro conditional.

This fixes the build on bare-metal targets following
commit 5c78499ae2.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Acked-by: Corinna Vinschen <vinschen@redhat.com>
2016-03-18 11:22:32 -05:00
Sebastian Huber f74cf1350e Add arc4random() etc. from OpenBSD 5.8
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.
2016-03-18 12:33:41 +01:00
Sebastian Huber a10dacbdac Guard ssize_t definition by _SSIZE_T_DECLARED
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.
2016-03-18 12:28:55 +01:00
Yaakov Selkowitz 396942b0b5 Feature test macros overhaul: sys/types.h
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>
2016-03-17 21:09:21 -05:00
Yaakov Selkowitz ee97c4b224 Revert "Remove inclusion of sys/select.h in sys/types.h for backward compat"
This BSDism is still in use (e.g. putty).

This reverts commit 088f7a7239.
2016-03-17 21:09:19 -05:00
Yaakov Selkowitz 04f288851a Feature test macros overhaul: sys/time.h
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>
2016-03-17 21:09:18 -05:00
Yaakov Selkowitz 069e400c91 Feature test macros overhaul: sys/stat.h
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>
2016-03-17 21:09:16 -05:00
Yaakov Selkowitz 03c4ef1c51 Feature test macros overhaul: sys/select.h
Remove !_POSIX_SOURCE conditional; pselect is POSIX.1-2001.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:15 -05:00
Yaakov Selkowitz be657151f1 Feature test macros overhaul: unistd.h
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>
2016-03-17 21:09:12 -05:00
Yaakov Selkowitz 5c78499ae2 Feature test macros overhaul: signal.h
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>
2016-03-17 21:09:03 -05:00
Yaakov Selkowitz d2df6d381b Feature test macros overhaul: fcntl.h
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>
2016-03-17 21:08:53 -05:00
Yaakov Selkowitz 6ba26630e0 Feature test macros overhaul: sys/features.h
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>
2016-03-17 21:06:40 -05:00
Joel Sherrill 4fa84f10ec pthread.h, sys/types.h Add missing pthread methods
* 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.
2016-02-22 10:05:17 -06:00
Corinna Vinschen c716affcef sys/features.h: Update Cygwin POSIX option macros
* 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>
2016-02-18 13:10:28 +01:00
Pieter du Preez 264b817b8e Define the newlib version macros in one place: _newlib_version.h.
Currently, the newlib version information needs to be updated in two places:
 - newlib/acinclude.m4
 - newlib/libc/include/sys/features.h

The goal of this patch is to:
 - supply a single location for defining the newlib version
   information: newlib/acinclude.m4
 - define __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__
   This is in line with what gcc does for its version macros. See:
   https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

This patch moves the definition of the _NEWLIB_VERSION, __NEWLIB__
and __NEWLIB_MINOR__ macros from newlib/libc/include/sys/features.h,
to the newly generated newlib/_newlib_version.h file. Additionally,
the __NEWLIB_PATCHLEVEL__ macro was created, for completeness.

In order to stay backwards compatible, newlib/_newlib_version.h gets
included by newlib/newlib.h and newlib/libc/include/sys/features.h.

Note: This patch does _not_ include the modifications to the following
files, as these should all be generated any way.
      *Makefile.in,
      *aclocal.m4,
      *configure
      stamp-* files

Signed-off-by: Pieter du Preez <pdupreez@gmail.com>
2016-02-17 16:04:09 -05:00
Václav Haisman 813da84442 POSIX barrier implementation, take 3
The attached patch should address all of the review comments.

Modifed change log:

Newlib:

	* libc/include/sys/features.h (_POSIX_BARRIERS): Define for Cygwin.
	* libc/include/sys/types.h (pthread_barrier_t)
	(pthread_barrierattr_t): Do not define for Cygwin.

Cygwin:

	* common.din (pthread_barrierattr_init)
	(pthread_barrierattr_setpshared, pthread_barrierattr_getpshared)
	(pthread_barrierattr_destroy, pthread_barrier_init)
	(pthread_barrier_destroy, pthread_barrier_wait): Export.
	* include/cygwin/types.h (pthread_barrierattr_t)
	(pthread_barrier_t): Declare.
	* include/pthread.h (PTHREAD_BARRIER_SERIAL_THREAD)
	(pthread_barrierattr_init, pthread_barrierattr_setpshared)
	(pthread_barrierattr_getpshared, pthread_barrierattr_destroy)
	(pthread_barrier_init, pthread_barrier_destroy)
	(pthread_barrier_wait): Declare.
	* thread.h (PTHREAD_BARRIER_MAGIC)
	(PTHREAD_BARRIERATTR_MAGIC): Define.
	(class pthread_barrierattr, class pthread_barrier): Declare.
	* thread.cc (delete_and_clear): New local helper function.
	(class pthread_barrierattr, class pthread_barrier): Implement.
	* miscfuncs.h (likely, unlikely): New macros.

--
VH
2016-02-13 16:03:15 +01:00
Corinna Vinschen 088f7a7239 Remove inclusion of sys/select.h in sys/types.h for backward compat
* libc/include/sys/types.h: Remove including <sys/select.h>.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-17 22:45:19 +01:00
Sebastian Huber f376e4f93b Add _REENT_INIT_PTR_ZEROED()
Provide a _REENT_INIT_PTR_ZEROED() macro to initialize an already
zero-initialized struct _reent.

	* libc/include/sys/reent.h (_REENT_INIT_PTR_ZEROED): New.
	(_REENT_INIT_PTR): Define only once and use _REENT_INIT_PTR_ZEROED().
2015-12-14 15:44:28 +01:00
Sebastian Huber 01885f533d FreeBSD compatibility for <sys/select.h>
* libc/include/sys/_sigset.h: New.
	* libc/include/sys/select.h: Do not include <sys/types.h> and
	<sys/time.h> to avoid cyclic header file dependencies.  Include
	specialized header files instead.
	(sigset_t): Conditionally define.
	* libc/include/sys/signal.h (sigset_t): Likewise.
	* libc/include/sys/time.h: Include <sys/select.h> if
	__BSD_VISIBLE.
	* libc/include/sys/types.h: Likewise.
2015-12-14 15:39:44 +01:00
Corinna Vinschen 08184b362e Move fd_stuff from sys/types.h to sys/select.h
* libc/include/sys/types.h: Move definitions of NBBY and howmany to
	sys/param.h.  Move definitions of select(2) macros to sys/select.h.
	* libc/include/sys/param.h: See above.
	* libc/include/sys/select.h: Move Cygwin's sys/select.h here.

	* include/sys/select.h: Move select(2) macros from newlib's sys/types.h
	here.  Rename howmany to _howmany to unclutter namespace. Move file to
	newlib.
	* libc/rexex.cc: Add declaration for cygwin_gethostname.
	* poll.cc: Include sys/param.h and locale select.h.
	* select.h (cygwin_select): Declare.
	* uname.cc: Declare cygwin_gethostname.
	* winsup.h: Drop declarations of cygwin_select and cygwin_gethostname.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-07 16:28:22 +01:00
Nick Clifton c3b6da1781 Extend _intsup.h to support 16-bit and 20-bit pointers.
* libc/include/sys/_intsup.h: Add support for 16-bit and 20-bit
	pointers.
2015-10-19 14:48:30 +01:00
Jeff Johnston ecee0b0607 Synchronize with FreeBSD.
* libc/include/sys/cdefs.h: Synchronize with latest FreeBSD
        version.
2015-10-13 17:50:30 -04:00
Jeff Johnston 443467d752 Add FreeBSD style changes to sys/cdefs.h
* libc/include/sys/cdefs.h: Add style changes of latest FreeBSD
        version.
2015-10-13 17:46:47 -04:00
Corinna Vinschen 38fd7ddb79 Allow sysconf to return CPU cache information
* include/sys/unistd.h (_SC_LEVEL*): Add cache-related variables as
        on Linux.

        * fhandler_proc.cc (format_proc_cpuinfo): Fetch cache information
        from new cache functions in sysconf.cc, get_cpu_cache_intel and
        get_cpu_cache_amd.
        * sysconf.cc (__nt_query_system): New local helper.
        (get_nproc_values): Utilize __nt_query_system on pre-Windows 7 systems.
        Use GetLogicalProcessorInformationEx otherwise to handle more than
        64 CPUs.  Only handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN.
        (get_phys_pages): New helper to handle _SC_PHYS_PAGES.
        (cpuid2_cache_descriptor): New array to map Intel CPUID 2 descriptor
        values to cache type, cache size, associativity and linesize.
        (cpuid2_cache_desc_compar): Comparision function for bsearch over
        cpuid2_cache_descriptor.
        (get_cpu_cache_intel_cpuid2): New function to fetch cache info from
        Intel CPUID 2.
        (get_cpu_cache_intel_cpuid4): Ditto from Intel CPUID 4.
        (get_cpu_cache_intel): New function as CPU-specific entry point.
        (assoc): New array to map associativity values from AMD CPUID
        0x80000006.
        (get_cpu_cache_amd): New function to fetch cache info from AMD CPUIDs
        0x80000005 and 0x80000006.
        (get_cpu_cache): New function to fetch cache info.
        (sca): Call get_phys_pages if _SC_PHYS_PAGES is requested.  Call
        get_cpu_cache for new _SC_* cache requests.
        (SC_MAX): Set to _SC_LEVEL4_CACHE_LINESIZE.
        (get_phys_pages(void)): Call get_phys_pages(int).
        * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

        * new-features.xml (ov-new2.3): Document sysconf cache addition.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-29 09:16:47 +02:00
Andre Simoes Dias Vieira 892cfcb7c2 Fix for pri and scn formats 2015-08-27 12:50:25 +02:00
James Greenhalgh 4eca8ea0cf Always declare "kill" in include/sys/signal.h
Hi,

As I mentioned recently [1], newlib is providing a "kill" symbol to link
against, without declaring "kill" in signal.h. This is confusing for the
libgfortran build, which tries to link against kill (which succeeds), then
tries to use it (which triggers -Werror=implicit-function-declaration).

This patch implements my suggestion in that thread - making the declaration
of 'kill' in libc/include/sys/signal.h unconditional.

I've tested this by building a modified libgfortran on AArch64/ARM to see
that the Werror goes away, and the libgfortran build succeeds.

Is something like this OK for newlib? If so, can someone please commit
it on my behalf, as I have no commit access here.

Otherwise, what is your preferred direction for me to take this patch?

Thanks,
James
2015-08-25 16:17:14 +02:00
Yaakov Selkowitz 9f3100c958 sys/signal.h: include sys/ucontext.h on Cygwin per POSIX.1-2008
* libc/include/sys/signal.h [__CYGWIN__]: include <sys/ucontext.h>
if compiling for POSIX.1-2008.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-08-18 11:05:41 +02:00
Corinna Vinschen f9b87aaf10 Fix sys/time.h build problem due to inconsistent macro usage
https://sourceware.org/ml/newlib/2015/msg00520.html describes
	how sys/time.h uses __BSD_VISIBLE while the types used in the
	affected inline functions are guarded with !_POSIX_SOURCE.
	Fix that by guarding the type with __BSD_VISIBLE as well.

        * libc/include/sys/time.h: Explicitely include sys/cdefs.h.
        * libc/include/sys/types.h: Ditto.  Guard BSD convenience base types
        with __BSD_VISIBLE rather than !_POSIX_SOURCE.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-06 14:08:30 +02:00
Corinna Vinschen 2b615b47d4 sys/signal.h requires sys/cdefs.h
* libc/include/sys/signal.h: Include forgotten sys/cdefs.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-22 10:49:29 +02:00
Corinna Vinschen 6442e914d9 Use MINSIGSTKSZ and SIGSTKSZ from newlib for Cygwin as well
* libc/include/sys/signal.h: Move altstack macros completely
	outside of rtems block.

	* include/cygwin/signal.h: Remove definitions of MINSIGSTKSZ
	and SIGSTKSZ here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 19:05:51 +02:00
Corinna Vinschen 22465796ed Preliminary infrastructure to implement alternate stack
* libc/include/sys/signal.h: Define SS_ONSTACK and SS_DISABLE
	unconditionally.
	(sigaltstack): Enable prototype on Cygwin.

	* common.din (sigaltstack): Export.
	* cygtls.cc (_cygtls::init_thread): Initialize altstack.
	* cygtls.h (__tlsstack_t): Rename from __stack_t to distinguish
	more clearly from stack_t.  Accommodate throughout.
	(_cygtls): Add altstack member.
	* exceptions.cc (exception::handle): Set SIGSEGV handler to SIG_DFL
	if we encounter a stack overflow, and no alternate stack has been
	defined.
	* include/cygwin/signal.h (MINSIGSTKSZ): Define
	(SIGSTKSZ): Define.
	(SA_ONSTACK): Define.
	* signal.cc (sigaltstack): New function.
	* tlsoffset.h: Regenerate.
	* tlsoffset64.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-19 16:12:45 +02:00
Corinna Vinschen 1aeda8a95f Fix comment in sys/wait.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-28 16:40:43 +02:00
Corinna Vinschen a7a784c774 Revert to exposing sys/select.h from sys/time.h on Cygwin
* libc/include/sys/time.h: Include sys/select.h on Cygwin.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-02 15:09:03 +02:00
Corinna Vinschen 6109eadff5 Improve check for int32_t being long or int
* libc/include/sys/config.h: Move evaluation of _UINTPTR_EQ_ULONG and
        _UINTPTR_EQ_ULONGLONG from here...
        * libc/include/sys/_intsup.h: ...to here.  Rename to _INTPTR_EQ_LONG
        and _INTPTR_EQ_LONGLONG to refer to signed base type.  Add test for
        base type of int32_t and set _INT32_EQ_LONG accordingly.
        * libc/include/stdint.h: Change checks for __have_long32 to checks
        for _INT32_EQ_LONG.
        * libc/include/inttypes.h: Ditto.  Accommodate aforementioned name
        change.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-29 13:07:17 +02:00
Sebastian Huber 897d3a3cc4 Add <sys/_stdint.h> for FreeBSD compatibility
* libc/include/sys/_stdint.h: New file.
        * libc/include/stdint.h (int8_t): Move to <sys/_stdint.h>.
        (uint8_t): Likewise.
        (int16_t): Likewise.
        (uint16_t): Likewise.
        (int32_t): Likewise.
        (uint32_t): Likewise.
        (int64_t): Likewise.
        (uint64_t): Likewise.
        (intptr_t): Likewise.
        (uintptr_t): Likewise.
        * libc/include/sys/types.h: Include <sys/_stdint.h>.
        * libc/sys/rtems/machine/_types.h: Remove <stdint.h> include.
        * libc/sys/time.h>: Replace __uint32_t with uint32_t and
        __uint64_t with uint64_t.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:10 +02:00