Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4920 → Rev 4921

/contrib/sdk/sources/newlib/libc/include/sys/_default_fcntl.h
42,15 → 42,6
/* O_NDELAY _FNBIO set in include/fcntl.h */
#define O_NONBLOCK _FNONBLOCK
#define O_NOCTTY _FNOCTTY
 
#define _FBINARY 0x10000
#define _FTEXT 0x20000
#define _FNOINHERIT 0x40000
 
#define O_BINARY _FBINARY
#define O_TEXT _FTEXT
#define O_NOINHERIT _FNOINHERIT
 
/* For machines which care - */
#if defined (_WIN32) || defined (__CYGWIN__)
#define _FBINARY 0x10000
/contrib/sdk/sources/newlib/libc/include/sys/_types.h
16,14 → 16,9
typedef long _off_t;
#endif
 
#if defined(__rtems__)
/* device numbers are 32-bit major and and 32-bit minor */
typedef unsigned long long __dev_t;
#else
#ifndef __dev_t_defined
typedef short __dev_t;
#endif
#endif
 
#ifndef __uid_t_defined
typedef unsigned short __uid_t;
52,6 → 47,14
#endif
 
#ifndef __ssize_t_defined
#ifdef __SIZE_TYPE__
/* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t.
We simply change "unsigned" to "signed" for this single definition
to make sure ssize_t and size_t only differ by their signedness. */
#define unsigned signed
typedef __SIZE_TYPE__ _ssize_t;
#undef unsigned
#else
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
#else
58,6 → 61,7
typedef long _ssize_t;
#endif
#endif
#endif
 
#define __need_wint_t
#include <stddef.h>
/contrib/sdk/sources/newlib/libc/include/sys/cdefs.h
2,7 → 2,7
 
/* Written 2000 by Werner Almesberger */
 
/*
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
17,10 → 17,6
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
38,27 → 34,130
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
* $FreeBSD: src/sys/sys/cdefs.h,v 1.54 2002/05/11 03:58:24 alfred Exp $
* $FreeBSD$
*/
 
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
 
#define __FBSDID(x) /* nothing */
/*
* Note: the goal here is not compatibility to K&R C. Since we know that we
* have GCC which understands ANSI C perfectly well, we make use of this.
*/
#include <machine/_default_types.h>
#include <sys/features.h>
#include <stddef.h>
 
#define __P(args) args
#define __PMT(args) args
#define __const const
#define __signed signed
#define __volatile volatile
#define __DOTS , ...
#define __THROW
 
#ifdef __GNUC__
# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
#endif
 
#define __ptr_t void *
#define __long_double_t long double
 
#define __attribute_malloc__
#define __attribute_pure__
#define __attribute_format_strfmon__(a,b)
#define __flexarr [0]
 
#ifndef __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
#endif
 
/*
* Testing against Clang-specific extensions.
*/
 
#ifndef __has_extension
#define __has_extension __has_feature
#endif
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef __has_include
#define __has_include(x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
 
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
 
/*
* This code has been put in place to help reduce the addition of
* compiler specific defines in FreeBSD code. It helps to aid in
* having a compiler-agnostic source tree.
*/
 
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
 
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
#define __GNUCLIKE_ASM 3
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
#else
#define __GNUCLIKE_ASM 2
#endif
#define __GNUCLIKE___TYPEOF 1
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1
 
#ifndef __INTEL_COMPILER
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif
 
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
&& __INTEL_COMPILER < 800
# undef __GNUCLIKE_BUILTIN_CONSTANT_P
# endif
 
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
# define __GNUCLIKE_BUILTIN_VARARGS 1
# define __GNUCLIKE_BUILTIN_STDARG 1
# define __GNUCLIKE_BUILTIN_VAALIST 1
#endif
 
#if defined(__GNUC__)
# define __GNUC_VA_LIST_COMPATIBILITY 1
#endif
 
/*
* Compiler memory barriers, specific to gcc and clang.
*/
#if defined(__GNUC__)
#define __compiler_membar() __asm __volatile(" " : : : "memory")
#endif
 
#ifndef __INTEL_COMPILER
# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
# define __GNUCLIKE_MATH_BUILTIN_RELOPS
#endif
 
#define __GNUCLIKE_BUILTIN_MEMCPY 1
 
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
#define __CC_SUPPORTS_INLINE 1
#define __CC_SUPPORTS___INLINE 1
#define __CC_SUPPORTS___INLINE__ 1
 
#define __CC_SUPPORTS___FUNC__ 1
#define __CC_SUPPORTS_WARNING 1
 
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
 
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
 
#endif /* __GNUC__ || __INTEL_COMPILER */
 
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
70,40 → 169,343
* __XSTRING is like __STRING, but it expands any macros in its argument
* first. It is only available with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT1(x,y) x ## y
#define __CONCAT(x,y) __CONCAT1(x,y)
#define __STRING(x) #x /* stringify without expanding x */
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
 
#ifdef __GNUC__
# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#if !(defined(__CC_SUPPORTS___INLINE))
#define __inline /* delete GCC keyword */
#endif /* ! __CC_SUPPORTS___INLINE */
#endif /* !__cplusplus */
 
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
 
#if !defined(__CC_SUPPORTS___INLINE)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#ifndef NO_ANSI_KEYWORDS
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !__CC_SUPPORTS___INLINE */
#endif /* !(__STDC__ || __cplusplus) */
 
/*
* Compiler-dependent macros to help declare dead (non-returning) and
* pure (no side effects) functions, and unused variables. They are
* null except for versions of gcc that are known to support the features
* properly (old versions of gcc-2 supported the dead and pure features
* in a different (wrong) way). If we do not provide an implementation
* for a given compiler, let the compile fail if it is told to use
* a feature that we cannot live without.
*/
#ifdef lint
#define __dead2
#define __pure2
#define __unused
#define __packed
#define __aligned(x)
#define __section(x)
#else
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
#define __dead2
#define __pure2
#define __unused
#endif
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused
/* XXX Find out what to do for __packed, __aligned and __section */
#endif
#if __GNUC_PREREQ__(2, 7)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
#if defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
#endif
 
#define __ptr_t void *
#define __long_double_t long double
#if !__GNUC_PREREQ__(2, 95)
#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
#endif
 
#define __attribute_malloc__
#define __attribute_pure__
#define __attribute_format_strfmon__(a,b)
#define __flexarr [0]
/*
* Keywords added in C11.
*/
 
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
 
#if !__has_extension(c_alignas)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_alignas)
#define _Alignas(x) alignas(x)
#else
# define __BEGIN_DECLS
# define __END_DECLS
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
#define _Alignas(x) __aligned(x)
#endif
#endif
 
#ifndef __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Alignof(x) alignof(x)
#else
#define _Alignof(x) __alignof(x)
#endif
 
#ifdef __GNUC__
#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
/*
* No native support for _Atomic(). Place object in structure to prevent
* most forms of direct non-atomic access.
*/
#define _Atomic(T) struct { T volatile __val; }
#endif
 
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Noreturn [[noreturn]]
#else
#define _Noreturn __dead2
#endif
 
#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus)
/* Do nothing: _Static_assert() works as per C11 */
#elif !__has_extension(c_static_assert)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
#define _Static_assert(x, y) static_assert(x, y)
#elif defined(__COUNTER__)
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
#define __Static_assert(x, y) ___Static_assert(x, y)
#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1]
#else
#define _Static_assert(x, y) struct __hack
#endif
#endif
 
#if !__has_extension(c_thread_local)
/* XXX: Change this to test against C++11 when clang in base supports it. */
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
__has_extension(cxx_thread_local)
#define _Thread_local thread_local
#else
#define _Thread_local __thread
#endif
#endif
 
#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
 
/*
* Emulation of C11 _Generic(). Unlike the previously defined C11
* keywords, it is not possible to implement this using exactly the same
* syntax. Therefore implement something similar under the name
* __generic(). Unlike _Generic(), this macro can only distinguish
* between a single type, so it requires nested invocations to
* distinguish multiple cases.
*/
 
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define __generic(expr, t, yes, no) \
_Generic(expr, t: yes, default: no)
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
#define __generic(expr, t, yes, no) \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(expr), t), yes, no)
#endif
 
#if __GNUC_PREREQ__(2, 96)
#define __malloc_like __attribute__((__malloc__))
#define __pure __attribute__((__pure__))
#else
#define __malloc_like
#define __pure
#endif
 
#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __always_inline __attribute__((__always_inline__))
#else
#define __always_inline
#endif
 
#if __GNUC_PREREQ__(3, 1)
#define __noinline __attribute__ ((__noinline__))
#else
#define __noinline
#endif
 
#if __GNUC_PREREQ__(3, 3)
#define __nonnull(x) __attribute__((__nonnull__(x)))
#else
#define __nonnull(x)
#endif
 
#if __GNUC_PREREQ__(3, 4)
#define __fastcall __attribute__((__fastcall__))
#else
#define __fastcall
#endif
 
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((__returns_twice__))
#else
#define __returns_twice
#endif
 
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL
#endif
 
/*
* GCC 2.95 provides `__restrict' as an extension to C90 to support the
* C99-specific `restrict' type qualifier. We happen to use `__restrict' as
* a way to define the `restrict' type qualifier without disturbing older
* software that is unaware of C99 keywords.
*/
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
#define __restrict
#else
#define __restrict restrict
#endif
#endif
 
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that
* code blocks can be reordered such that the predicted path
* sees a more linear flow, thus improving cache behavior, etc.
*
* The following two macros provide us with a way to utilize this
* compiler feature. Use __predict_true() if you expect the expression
* to evaluate to true, and __predict_false() if you expect the
* expression to evaluate to false.
*
* A few notes about usage:
*
* * Generally, __predict_false() error condition checks (unless
* you have some _strong_ reason to do otherwise, in which case
* document it), and/or __predict_true() `no-error' condition
* checks, assuming you want to optimize for the no-error case.
*
* * Other than that, if you don't know the likelihood of a test
* succeeding from empirical or other `hard' evidence, don't
* make predictions.
*
* * These are meant to be used in places that are run `a lot'.
* It is wasteful to make predictions in code that is run
* seldomly (e.g. at subsystem initialization time) as the
* basic block reordering that this affects can often generate
* larger code.
*/
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp) __builtin_expect((exp), 1)
#define __predict_false(exp) __builtin_expect((exp), 0)
#else
#define __predict_true(exp) (exp)
#define __predict_false(exp) (exp)
#endif
 
#if __GNUC_PREREQ__(4, 2)
#define __hidden __attribute__((__visibility__("hidden")))
#define __exported __attribute__((__visibility__("default")))
#else
#define __hidden
#define __exported
#endif
 
#define __offsetof(type, field) offsetof(type, field)
#define __rangeof(type, start, end) \
(__offsetof(type, end) - __offsetof(type, start))
 
/*
* Given the pointer x to the member m of the struct s, return
* a pointer to the containing structure. When using GCC, we first
* assign pointer x to a local variable, to check that its type is
* compatible with member m.
*/
#if __GNUC_PREREQ__(3, 1)
#define __containerof(x, s, m) ({ \
const volatile __typeof__(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
})
#else
#define __containerof(x, s, m) \
__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
#endif
 
/*
* Compiler-dependent macros to declare that functions take printf-like
* or scanf-like arguments. They are null except for versions of gcc
* that are known to support the features properly (old versions of gcc-2
* didn't permit keeping the keywords out of the application namespace).
*/
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __printflike(fmtarg, firstvararg)
#define __scanflike(fmtarg, firstvararg)
#define __format_arg(fmtarg)
#define __strfmonlike(fmtarg, firstvararg)
#define __strftimelike(fmtarg, firstvararg)
#else
#define __printflike(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#define __scanflike(fmtarg, firstvararg) \
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
#define __strfmonlike(fmtarg, firstvararg) \
__attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
#define __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
#endif
 
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
#else
#define __printf0like(fmtarg, firstvararg)
#endif
 
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef __INTEL_COMPILER
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
#ifdef __ELF__
#ifdef __STDC__
#define __weak_reference(sym,alias) \
113,6 → 515,10
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@" #verid)
#define __sym_default(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@@" #verid)
#else
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
121,6 → 527,10
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver impl, sym@verid")
#define __sym_default(impl,sym,verid) \
__asm__(".symver impl, sym@@verid")
#endif /* __STDC__ */
#else /* !__ELF__ */
#ifdef __STDC__
139,6 → 549,162
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#endif /* __STDC__ */
#endif /* __ELF__ */
#endif /* __GNUC__ */
#endif /* __GNUC__ || __INTEL_COMPILER */
 
#endif /* _SYS_CDEFS_H */
#ifndef __FBSDID
#define __FBSDID(s) struct __hack
#endif
 
#ifndef __RCSID
#define __RCSID(s) struct __hack
#endif
 
#ifndef __RCSID_SOURCE
#define __RCSID_SOURCE(s) struct __hack
#endif
 
#ifndef __SCCSID
#define __SCCSID(s) struct __hack
#endif
 
#ifndef __COPYRIGHT
#define __COPYRIGHT(s) struct __hack
#endif
 
#ifndef __DECONST
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#endif
 
#ifndef __DEVOLATILE
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
#endif
 
#ifndef __DEQUALIFY
#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
#endif
 
/*-
* The following definitions are an extension of the behavior originally
* implemented in <sys/_posix.h>, but with a different level of granularity.
* POSIX.1 requires that the macros we test be defined before any standard
* header file is included.
*
* Here's a quick run-down of the versions:
* defined(_POSIX_SOURCE) 1003.1-1988
* _POSIX_C_SOURCE == 1 1003.1-1990
* _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
* _POSIX_C_SOURCE == 199309 1003.1b-1993
* _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
* and the omnibus ISO/IEC 9945-1: 1996
* _POSIX_C_SOURCE == 200112 1003.1-2001
* _POSIX_C_SOURCE == 200809 1003.1-2008
*
* In addition, the X/Open Portability Guide, which is now the Single UNIX
* Specification, defines a feature-test macro which indicates the version of
* that specification, and which subsumes _POSIX_C_SOURCE.
*
* Our macros begin with two underscores to avoid namespace screwage.
*/
 
/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
#define _POSIX_C_SOURCE 199009
#endif
 
/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199209
#endif
 
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
#ifdef _XOPEN_SOURCE
#if _XOPEN_SOURCE - 0 >= 700
#define __XSI_VISIBLE 700
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809
#elif _XOPEN_SOURCE - 0 >= 600
#define __XSI_VISIBLE 600
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112
#elif _XOPEN_SOURCE - 0 >= 500
#define __XSI_VISIBLE 500
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199506
#endif
#endif
 
/*
* Deal with all versions of POSIX. The ordering relative to the tests above is
* important.
*/
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 198808
#endif
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 200809
#define __POSIX_VISIBLE 200809
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 200112
#define __POSIX_VISIBLE 200112
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 199506
#define __POSIX_VISIBLE 199506
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199309
#define __POSIX_VISIBLE 199309
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199209
#define __POSIX_VISIBLE 199209
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199009
#define __POSIX_VISIBLE 199009
#define __ISO_C_VISIBLE 1990
#else
#define __POSIX_VISIBLE 198808
#define __ISO_C_VISIBLE 0
#endif /* _POSIX_C_SOURCE */
#else
/*-
* Deal with _ANSI_SOURCE:
* If it is defined, and no other compilation environment is explicitly
* requested, then define our internal feature-test macros to zero. This
* makes no difference to the preprocessor (undefined symbols in preprocessing
* expressions are defined to have value zero), but makes it more convenient for
* a test program to print out the values.
*
* If a program mistakenly defines _ANSI_SOURCE and some other macro such as
* _POSIX_C_SOURCE, we will assume that it wants the broader compilation
* environment (and in fact we will never get here).
*/
#if defined(_ANSI_SOURCE) /* Hide almost everything. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1990
#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1999
#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
#elif defined(_GNU_SOURCE) /* Everything and the kitchen sink. */
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
#define __ISO_C_VISIBLE 2011
#define __GNU_VISIBLE 1
#else /* Default: everything except __GNU_VISIBLE. */
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
#define __ISO_C_VISIBLE 2011
#endif
#endif
 
#endif /* !_SYS_CDEFS_H_ */
/contrib/sdk/sources/newlib/libc/include/sys/config.h
4,6 → 4,10
#include <machine/ieeefp.h> /* floating point macros */
#include <sys/features.h> /* POSIX defs */
 
#ifdef __aarch64__
#define MALLOC_ALIGNMENT 16
#endif
 
/* exceptions first */
#if defined(__H8500__) || defined(__W65__)
#define __SMALL_BITFIELDS
141,6 → 145,21
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif
 
#if defined __MSP430__
#ifndef _REENT_SMALL
#define _REENT_SMALL
#endif
 
#define __SMALL_BITFIELDS
 
#ifdef __MSP430X_LARGE__
#define _POINTER_INT long
#else
#define _POINTER_INT int
#endif
#endif
 
#ifdef __m32c__
#define __SMALL_BITFIELDS
#undef INT_MAX
213,6 → 232,8
#if defined(__rtems__)
#define __FILENAME_MAX__ 255
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define __DYNAMIC_REENT__
#define _REENT_GLOBAL_ATEXIT
#endif
 
#ifndef __EXPORT
229,6 → 250,12
#ifndef _READ_WRITE_RETURN_TYPE
#define _READ_WRITE_RETURN_TYPE int
#endif
/* Define `count' parameter of read/write routines. In POSIX, the `count'
parameter is "size_t" but legacy newlib code has been using "int" for some
time. If not specified, "int" is defaulted. */
#ifndef _READ_WRITE_BUFSIZE_TYPE
#define _READ_WRITE_BUFSIZE_TYPE int
#endif
 
#ifndef __WCHAR_MAX__
#if __INT_MAX__ == 32767 || defined (_WIN32)
/contrib/sdk/sources/newlib/libc/include/sys/features.h
15,7 → 15,7
* OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
* SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
* $Id: features.h,v 1.27 2011/07/20 19:41:15 yselkowitz Exp $
* $Id: features.h,v 1.30 2013/04/23 09:42:25 corinna Exp $
*/
 
#ifndef _SYS_FEATURES_H
25,6 → 25,18
extern "C" {
#endif
 
/* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */
#ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
#endif /* __GNUC_PREREQ */
/* Version with trailing underscores for BSD compatibility. */
#define __GNUC_PREREQ__(ma, mi) __GNUC_PREREQ(ma, mi)
 
/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
 
#ifdef __rtems__
161,12 → 173,18
#define _POSIX2_SW_DEV 200112L
#define _POSIX2_UPE 200112L
#define _POSIX_V6_ILP32_OFF32 -1
#ifdef __LP64__
#define _POSIX_V6_ILP32_OFFBIG -1
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V6_LPBIG_OFFBIG 1
#else
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V6_LP64_OFF64 -1
#define _POSIX_V6_LPBIG_OFFBIG -1
#endif
#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32
#define _POSIX_V6_ILP32_OFFBIG 1
#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG
#define _POSIX_V6_LP64_OFF64 -1
#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64
#define _POSIX_V6_LPBIG_OFFBIG -1
#define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG
#define _XOPEN_CRYPT 1
#define _XOPEN_ENH_I18N 1
/contrib/sdk/sources/newlib/libc/include/sys/param.h
6,6 → 6,7
# define _SYS_PARAM_H
 
#include <sys/config.h>
#include <sys/syslimits.h>
#include <machine/endian.h>
#include <machine/param.h>
 
19,6 → 20,8
# define PATHSIZE (1024)
#endif
 
#define MAXPATHLEN PATH_MAX
 
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
 
/contrib/sdk/sources/newlib/libc/include/sys/queue.h
1,4 → 1,4
/*
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
10,10 → 10,6
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
31,13 → 27,13
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
* $FreeBSD: src/sys/sys/queue.h,v 1.48 2002/04/17 14:00:37 tmm Exp $
* $FreeBSD$
*/
 
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
 
#include <machine/ansi.h> /* for __offsetof */
#include <sys/cdefs.h>
 
/*
* This file defines four types of data structures: singly-linked lists,
69,7 → 65,7
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
* may be traversed in either direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
89,20 → 85,60
* _EMPTY + + + +
* _FIRST + + + +
* _NEXT + + + +
* _PREV - - - +
* _PREV - + - +
* _LAST - - + +
* _FOREACH + + + +
* _FOREACH_SAFE + + + +
* _FOREACH_REVERSE - - - +
* _FOREACH_REVERSE_SAFE - - - +
* _INSERT_HEAD + + + +
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
* _CONCAT - - + +
* _REMOVE_AFTER + - + -
* _REMOVE_HEAD + - + -
* _REMOVE + + + +
* _SWAP + + + +
*
*/
#ifdef QUEUE_MACRO_DEBUG
/* Store the last 2 places the queue element or head was altered */
struct qm_trace {
unsigned long lastline;
unsigned long prevline;
const char *lastfile;
const char *prevfile;
};
 
#define TRACEBUF struct qm_trace trace;
#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } ,
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
 
#define QMD_TRACE_HEAD(head) do { \
(head)->trace.prevline = (head)->trace.lastline; \
(head)->trace.prevfile = (head)->trace.lastfile; \
(head)->trace.lastline = __LINE__; \
(head)->trace.lastfile = __FILE__; \
} while (0)
 
#define QMD_TRACE_ELEM(elem) do { \
(elem)->trace.prevline = (elem)->trace.lastline; \
(elem)->trace.prevfile = (elem)->trace.lastfile; \
(elem)->trace.lastline = __LINE__; \
(elem)->trace.lastfile = __FILE__; \
} while (0)
 
#else
#define QMD_TRACE_ELEM(elem)
#define QMD_TRACE_HEAD(head)
#define QMD_SAVELINK(name, link)
#define TRACEBUF
#define TRACEBUF_INITIALIZER
#define TRASHIT(x)
#endif /* QUEUE_MACRO_DEBUG */
 
/*
* Singly-linked List declarations.
*/
131,6 → 167,16
(var); \
(var) = SLIST_NEXT((var), field))
 
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
 
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
for ((varp) = &SLIST_FIRST((head)); \
((var) = *(varp)) != NULL; \
(varp) = &SLIST_NEXT((var), field))
 
#define SLIST_INIT(head) do { \
SLIST_FIRST((head)) = NULL; \
} while (0)
148,6 → 194,7
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
 
#define SLIST_REMOVE(head, elm, type, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
if (SLIST_FIRST((head)) == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
155,15 → 202,26
struct type *curelm = SLIST_FIRST((head)); \
while (SLIST_NEXT(curelm, field) != (elm)) \
curelm = SLIST_NEXT(curelm, field); \
SLIST_NEXT(curelm, field) = \
SLIST_NEXT(SLIST_NEXT(curelm, field), field); \
SLIST_REMOVE_AFTER(curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
 
#define SLIST_REMOVE_AFTER(elm, field) do { \
SLIST_NEXT(elm, field) = \
SLIST_NEXT(SLIST_NEXT(elm, field), field); \
} while (0)
 
#define SLIST_REMOVE_HEAD(head, field) do { \
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
} while (0)
 
#define SLIST_SWAP(head1, head2, type) do { \
struct type *swap_first = SLIST_FIRST(head1); \
SLIST_FIRST(head1) = SLIST_FIRST(head2); \
SLIST_FIRST(head2) = swap_first; \
} while (0)
 
/*
* Singly-linked Tail queue declarations.
*/
201,6 → 259,12
(var); \
(var) = STAILQ_NEXT((var), field))
 
 
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
 
#define STAILQ_INIT(head) do { \
STAILQ_FIRST((head)) = NULL; \
(head)->stqh_last = &STAILQ_FIRST((head)); \
225,14 → 289,13
} while (0)
 
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *) \
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
(STAILQ_EMPTY((head)) ? NULL : \
__containerof((head)->stqh_last, struct type, field.stqe_next))
 
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
 
#define STAILQ_REMOVE(head, elm, type, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
if (STAILQ_FIRST((head)) == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} \
240,12 → 303,17
struct type *curelm = STAILQ_FIRST((head)); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
if ((STAILQ_NEXT(curelm, field) = \
STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
(head)->stqh_last = &STAILQ_NEXT((curelm), field);\
STAILQ_REMOVE_AFTER(head, curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
 
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
if ((STAILQ_NEXT(elm, field) = \
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
 
#define STAILQ_REMOVE_HEAD(head, field) do { \
if ((STAILQ_FIRST((head)) = \
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
257,6 → 325,20
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
 
#define STAILQ_SWAP(head1, head2, type) do { \
struct type *swap_first = STAILQ_FIRST(head1); \
struct type **swap_last = (head1)->stqh_last; \
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_FIRST(head2) = swap_first; \
(head2)->stqh_last = swap_last; \
if (STAILQ_EMPTY(head1)) \
(head1)->stqh_last = &STAILQ_FIRST(head1); \
if (STAILQ_EMPTY(head2)) \
(head2)->stqh_last = &STAILQ_FIRST(head2); \
} while (0)
 
 
/*
* List declarations.
*/
278,6 → 360,31
* List functions.
*/
 
#if (defined(_KERNEL) && defined(INVARIANTS))
#define QMD_LIST_CHECK_HEAD(head, field) do { \
if (LIST_FIRST((head)) != NULL && \
LIST_FIRST((head))->field.le_prev != \
&LIST_FIRST((head))) \
panic("Bad list head %p first->prev != head", (head)); \
} while (0)
 
#define QMD_LIST_CHECK_NEXT(elm, field) do { \
if (LIST_NEXT((elm), field) != NULL && \
LIST_NEXT((elm), field)->field.le_prev != \
&((elm)->field.le_next)) \
panic("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
 
#define QMD_LIST_CHECK_PREV(elm, field) do { \
if (*(elm)->field.le_prev != (elm)) \
panic("Bad link elm %p prev->next != elm", (elm)); \
} while (0)
#else
#define QMD_LIST_CHECK_HEAD(head, field)
#define QMD_LIST_CHECK_NEXT(elm, field)
#define QMD_LIST_CHECK_PREV(elm, field)
#endif /* (_KERNEL && INVARIANTS) */
 
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
 
#define LIST_FIRST(head) ((head)->lh_first)
287,11 → 394,17
(var); \
(var) = LIST_NEXT((var), field))
 
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
 
#define LIST_INIT(head) do { \
LIST_FIRST((head)) = NULL; \
} while (0)
 
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
QMD_LIST_CHECK_NEXT(listelm, field); \
if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
LIST_NEXT((listelm), field)->field.le_prev = \
&LIST_NEXT((elm), field); \
300,6 → 413,7
} while (0)
 
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
QMD_LIST_CHECK_PREV(listelm, field); \
(elm)->field.le_prev = (listelm)->field.le_prev; \
LIST_NEXT((elm), field) = (listelm); \
*(listelm)->field.le_prev = (elm); \
307,6 → 421,7
} while (0)
 
#define LIST_INSERT_HEAD(head, elm, field) do { \
QMD_LIST_CHECK_HEAD((head), field); \
if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
LIST_FIRST((head)) = (elm); \
315,13 → 430,33
 
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
 
#define LIST_PREV(elm, head, type, field) \
((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
__containerof((elm)->field.le_prev, struct type, field.le_next))
 
#define LIST_REMOVE(elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.le_next); \
QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
QMD_LIST_CHECK_NEXT(elm, field); \
QMD_LIST_CHECK_PREV(elm, field); \
if (LIST_NEXT((elm), field) != NULL) \
LIST_NEXT((elm), field)->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = LIST_NEXT((elm), field); \
TRASHIT(*oldnext); \
TRASHIT(*oldprev); \
} while (0)
 
#define LIST_SWAP(head1, head2, type, field) do { \
struct type *swap_tmp = LIST_FIRST((head1)); \
LIST_FIRST((head1)) = LIST_FIRST((head2)); \
LIST_FIRST((head2)) = swap_tmp; \
if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
} while (0)
 
/*
* Tail queue declarations.
*/
329,20 → 464,53
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
TRACEBUF \
}
 
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
 
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
TRACEBUF \
}
 
/*
* Tail queue functions.
*/
#if (defined(_KERNEL) && defined(INVARIANTS))
#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
if (!TAILQ_EMPTY(head) && \
TAILQ_FIRST((head))->field.tqe_prev != \
&TAILQ_FIRST((head))) \
panic("Bad tailq head %p first->prev != head", (head)); \
} while (0)
 
#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
if (*(head)->tqh_last != NULL) \
panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
} while (0)
 
#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
if (TAILQ_NEXT((elm), field) != NULL && \
TAILQ_NEXT((elm), field)->field.tqe_prev != \
&((elm)->field.tqe_next)) \
panic("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
 
#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
if (*(elm)->field.tqe_prev != (elm)) \
panic("Bad link elm %p prev->next != elm", (elm)); \
} while (0)
#else
#define QMD_TAILQ_CHECK_HEAD(head, field)
#define QMD_TAILQ_CHECK_TAIL(head, headname)
#define QMD_TAILQ_CHECK_NEXT(elm, field)
#define QMD_TAILQ_CHECK_PREV(elm, field)
#endif /* (_KERNEL && INVARIANTS) */
 
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
349,6 → 517,8
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
QMD_TRACE_HEAD(head1); \
QMD_TRACE_HEAD(head2); \
} \
} while (0)
 
361,34 → 531,54
(var); \
(var) = TAILQ_NEXT((var), field))
 
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
 
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var); \
(var) = TAILQ_PREV((var), headname, field))
 
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
for ((var) = TAILQ_LAST((head), headname); \
(var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
(var) = (tvar))
 
#define TAILQ_INIT(head) do { \
TAILQ_FIRST((head)) = NULL; \
(head)->tqh_last = &TAILQ_FIRST((head)); \
QMD_TRACE_HEAD(head); \
} while (0)
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
QMD_TAILQ_CHECK_NEXT(listelm, field); \
if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
TAILQ_NEXT((elm), field)->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
else { \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
} \
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
QMD_TAILQ_CHECK_PREV(listelm, field); \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
TAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
 
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
QMD_TAILQ_CHECK_HEAD(head, field); \
if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
TAILQ_FIRST((head))->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
396,13 → 586,18
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_FIRST((head)) = (elm); \
(elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
 
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
QMD_TAILQ_CHECK_TAIL(head, field); \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
 
#define TAILQ_LAST(head, headname) \
414,14 → 609,39
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 
#define TAILQ_REMOVE(head, elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
QMD_TAILQ_CHECK_NEXT(elm, field); \
QMD_TAILQ_CHECK_PREV(elm, field); \
if ((TAILQ_NEXT((elm), field)) != NULL) \
TAILQ_NEXT((elm), field)->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
else { \
(head)->tqh_last = (elm)->field.tqe_prev; \
QMD_TRACE_HEAD(head); \
} \
*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
TRASHIT(*oldnext); \
TRASHIT(*oldprev); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
 
#define TAILQ_SWAP(head1, head2, type, field) do { \
struct type *swap_first = (head1)->tqh_first; \
struct type **swap_last = (head1)->tqh_last; \
(head1)->tqh_first = (head2)->tqh_first; \
(head1)->tqh_last = (head2)->tqh_last; \
(head2)->tqh_first = swap_first; \
(head2)->tqh_last = swap_last; \
if ((swap_first = (head1)->tqh_first) != NULL) \
swap_first->field.tqe_prev = &(head1)->tqh_first; \
else \
(head1)->tqh_last = &(head1)->tqh_first; \
if ((swap_first = (head2)->tqh_first) != NULL) \
swap_first->field.tqe_prev = &(head2)->tqh_first; \
else \
(head2)->tqh_last = &(head2)->tqh_first; \
} while (0)
 
#ifdef _KERNEL
 
/contrib/sdk/sources/newlib/libc/include/sys/reent.h
11,6 → 11,7
#define _SYS_REENT_H_
 
#include <_ansi.h>
#include <stddef.h>
#include <sys/_types.h>
 
#define _NULL 0
85,6 → 86,7
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args * _on_exit_args_ptr;
};
# define _ATEXIT_INIT {_NULL, 0, {_NULL}, _NULL}
#else
struct _atexit {
struct _atexit *_next; /* next in list */
93,8 → 95,16
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args _on_exit_args;
};
# define _ATEXIT_INIT {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}
#endif
 
#ifdef _REENT_GLOBAL_ATEXIT
# define _REENT_INIT_ATEXIT
#else
# define _REENT_INIT_ATEXIT \
_NULL, _ATEXIT_INIT,
#endif
 
/*
* Stdio buffers.
*
183,9 → 193,10
_PTR _cookie; /* cookie passed to io functions */
 
_READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
char *, int));
char *, _READ_WRITE_BUFSIZE_TYPE));
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
const char *, int));
const char *,
_READ_WRITE_BUFSIZE_TYPE));
_fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
int _EXFNPTR(_close, (struct _reent *, _PTR));
 
203,7 → 214,7
 
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _offset; /* current lseek offset */
_off_t _offset; /* current lseek offset */
 
#ifndef _REENT_SMALL
struct _reent *_data; /* Here for binary compatibility? Remove? */
238,9 → 249,10
_PTR _cookie; /* cookie passed to io functions */
 
_READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
char *, int));
char *, _READ_WRITE_BUFSIZE_TYPE));
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
const char *, int));
const char *,
_READ_WRITE_BUFSIZE_TYPE));
_fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
int _EXFNPTR(_close, (struct _reent *, _PTR));
 
353,7 → 365,7
_mbstate_t _wcsrtombs_state;
};
 
/* This version of _reent is layed our with "int"s in pairs, to help
/* This version of _reent is laid out with "int"s in pairs, to help
* ports with 16-bit int's but 32-bit pointers, align nicely. */
struct _reent
{
392,9 → 404,11
/* signal info */
void (**(_sig_func))(int);
 
# ifndef _REENT_GLOBAL_ATEXIT
/* atexit stuff */
struct _atexit *_atexit;
struct _atexit _atexit0;
# endif
 
struct _glue __sglue; /* root of glue chain */
__FILE *__sf; /* file descriptors */
425,8 → 439,7
_NULL, \
_NULL, \
_NULL, \
_NULL, \
{_NULL, 0, {_NULL}, _NULL}, \
_REENT_INIT_ATEXIT \
{_NULL, 0, _NULL}, \
_NULL, \
_NULL, \
434,35 → 447,11
}
 
#define _REENT_INIT_PTR(var) \
{ (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
{ memset((var), 0, sizeof(*(var))); \
(var)->_stdin = (__FILE *)&__sf_fake_stdin; \
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
(var)->_errno = 0; \
(var)->_inc = 0; \
(var)->_emergency = _NULL; \
(var)->__sdidinit = 0; \
(var)->_current_category = 0; \
(var)->_current_locale = "C"; \
(var)->_mp = _NULL; \
(var)->__cleanup = _NULL; \
(var)->_gamma_signgam = 0; \
(var)->_cvtlen = 0; \
(var)->_cvtbuf = _NULL; \
(var)->_r48 = _NULL; \
(var)->_localtime_buf = _NULL; \
(var)->_asctime_buf = _NULL; \
(var)->_sig_func = _NULL; \
(var)->_atexit = _NULL; \
(var)->_atexit0._next = _NULL; \
(var)->_atexit0._ind = 0; \
(var)->_atexit0._fns[0] = _NULL; \
(var)->_atexit0._on_exit_args_ptr = _NULL; \
(var)->__sglue._next = _NULL; \
(var)->__sglue._niobs = 0; \
(var)->__sglue._iobs = _NULL; \
(var)->__sf = 0; \
(var)->_misc = _NULL; \
(var)->_signal_buf = _NULL; \
}
 
/* Only built the assert() calls if we are built with debugging. */
641,9 → 630,11
} _unused;
} _new;
 
# ifndef _REENT_GLOBAL_ATEXIT
/* atexit stuff */
struct _atexit *_atexit; /* points to head of LIFO stack */
struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
# endif
 
/* signal info */
void (**(_sig_func))(int);
698,34 → 689,17
{0, {0}} \
} \
}, \
_REENT_INIT_ATEXIT \
_NULL, \
{_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \
_NULL, \
{_NULL, 0, _NULL} \
}
 
#define _REENT_INIT_PTR(var) \
{ (var)->_errno = 0; \
{ memset((var), 0, sizeof(*(var))); \
(var)->_stdin = &(var)->__sf[0]; \
(var)->_stdout = &(var)->__sf[1]; \
(var)->_stderr = &(var)->__sf[2]; \
(var)->_inc = 0; \
memset(&(var)->_emergency, 0, sizeof((var)->_emergency)); \
(var)->_current_category = 0; \
(var)->_current_locale = "C"; \
(var)->__sdidinit = 0; \
(var)->__cleanup = _NULL; \
(var)->_result = _NULL; \
(var)->_result_k = 0; \
(var)->_p5s = _NULL; \
(var)->_freelist = _NULL; \
(var)->_cvtlen = 0; \
(var)->_cvtbuf = _NULL; \
(var)->_new._reent._unused_rand = 0; \
(var)->_new._reent._strtok_last = _NULL; \
(var)->_new._reent._asctime_buf[0] = 0; \
memset(&(var)->_new._reent._localtime_buf, 0, sizeof((var)->_new._reent._localtime_buf)); \
(var)->_new._reent._gamma_signgam = 0; \
(var)->_new._reent._rand_next = 1; \
(var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
(var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
734,36 → 708,6
(var)->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
(var)->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
(var)->_new._reent._r48._add = _RAND48_ADD; \
(var)->_new._reent._mblen_state.__count = 0; \
(var)->_new._reent._mblen_state.__value.__wch = 0; \
(var)->_new._reent._mbtowc_state.__count = 0; \
(var)->_new._reent._mbtowc_state.__value.__wch = 0; \
(var)->_new._reent._wctomb_state.__count = 0; \
(var)->_new._reent._wctomb_state.__value.__wch = 0; \
(var)->_new._reent._mbrlen_state.__count = 0; \
(var)->_new._reent._mbrlen_state.__value.__wch = 0; \
(var)->_new._reent._mbrtowc_state.__count = 0; \
(var)->_new._reent._mbrtowc_state.__value.__wch = 0; \
(var)->_new._reent._mbsrtowcs_state.__count = 0; \
(var)->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
(var)->_new._reent._wcrtomb_state.__count = 0; \
(var)->_new._reent._wcrtomb_state.__value.__wch = 0; \
(var)->_new._reent._wcsrtombs_state.__count = 0; \
(var)->_new._reent._wcsrtombs_state.__value.__wch = 0; \
(var)->_new._reent._l64a_buf[0] = '\0'; \
(var)->_new._reent._signal_buf[0] = '\0'; \
(var)->_new._reent._getdate_err = 0; \
(var)->_atexit = _NULL; \
(var)->_atexit0._next = _NULL; \
(var)->_atexit0._ind = 0; \
(var)->_atexit0._fns[0] = _NULL; \
(var)->_atexit0._on_exit_args._fntypes = 0; \
(var)->_atexit0._on_exit_args._fnargs[0] = _NULL; \
(var)->_sig_func = _NULL; \
(var)->__sglue._next = _NULL; \
(var)->__sglue._niobs = 0; \
(var)->__sglue._iobs = _NULL; \
memset(&(var)->__sf, 0, sizeof((var)->__sf)); \
}
 
#define _REENT_CHECK_RAND48(ptr) /* nothing */
822,7 → 766,8
 
/* #define _REENT_ONLY define this to get only reentrant routines */
 
 
#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
#ifndef __getreent
static inline struct _reent *__getreent(void)
{
struct _reent *ent;
831,10 → 776,21
:"=r"(ent));
return ent;
};
#endif
# define _REENT (__getreent())
#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
# define _REENT _impure_ptr
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
 
# define _REENT (__getreent())
#define _GLOBAL_REENT _global_impure_ptr
 
#ifdef _REENT_GLOBAL_ATEXIT
extern struct _atexit *_global_atexit; /* points to head of LIFO stack */
# define _GLOBAL_ATEXIT _global_atexit
#else
# define _GLOBAL_ATEXIT (_GLOBAL_REENT->_atexit)
#endif
 
#ifdef __cplusplus
}
#endif
/contrib/sdk/sources/newlib/libc/include/sys/signal.h
12,7 → 12,10
 
/* #ifndef __STRICT_ANSI__*/
 
/* Cygwin defines it's own sigset_t in include/cygwin/signal.h */
#ifndef __CYGWIN__
typedef unsigned long sigset_t;
#endif
 
#if defined(__rtems__)
 
143,6 → 146,9
#undef sigfillset
#undef sigismember
 
#ifdef _COMPILING_NEWLIB
int _EXFUN(_kill, (pid_t, int));
#endif
int _EXFUN(kill, (pid_t, int));
int _EXFUN(killpg, (pid_t, int));
int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
/contrib/sdk/sources/newlib/libc/include/sys/stat.h
19,7 → 19,7
#ifdef __CYGWIN__
#include <cygwin/stat.h>
#ifdef _COMPILING_NEWLIB
#define stat64 __stat64
#define stat64 stat
#endif
#else
struct stat
147,17 → 147,17
int _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
int _EXFUN(mkdir,( const char *_path, mode_t __mode ));
int _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
int _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
int _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
mode_t _EXFUN(umask,( mode_t __mask ));
 
#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
int _EXFUN(lstat,( const char *__restrict __path, struct stat *__restrict __buf ));
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
#endif
 
#if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
int _EXFUN(fchmodat, (int, const char *, mode_t, int));
int _EXFUN(fstatat, (int, const char *, struct stat *, int));
int _EXFUN(fstatat, (int, const char *__restrict , struct stat *__restrict, int));
int _EXFUN(mkdirat, (int, const char *, mode_t));
int _EXFUN(mkfifoat, (int, const char *, mode_t));
int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
169,9 → 169,11
provided in newlib for some compilers. */
#ifdef _COMPILING_NEWLIB
int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
int _EXFUN(_stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
int _EXFUN(_mkdir,( const char *_path, mode_t __mode ));
#ifdef __LARGE64_FILES
struct stat64;
int _EXFUN(_stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf ));
int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
#endif
#endif
/contrib/sdk/sources/newlib/libc/include/sys/time.h
12,7 → 12,7
extern "C" {
#endif
 
#ifndef _WINSOCK_H
#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
struct timeval {
time_t tv_sec;
19,26 → 19,6
suseconds_t tv_usec;
};
 
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
 
#ifdef __CYGWIN__
#include <cygwin/sys_time.h>
#endif /* __CYGWIN__ */
 
#endif /* _WINSOCK_H */
 
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
 
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
 
/* BSD time macros used by RTEMS code */
#if defined (__rtems__) || defined (__CYGWIN__)
 
70,13 → 50,37
} \
} while (0)
#endif /* defined (__rtems__) || defined (__CYGWIN__) */
#endif /* !_TIMEVAL_DEFINED */
 
int _EXFUN(gettimeofday, (struct timeval *__p, void *__tz));
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
 
#ifdef __CYGWIN__
#include <cygwin/sys_time.h>
#endif /* __CYGWIN__ */
 
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
 
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
 
#ifdef _COMPILING_NEWLIB
int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz));
#endif
 
int _EXFUN(gettimeofday, (struct timeval *__restrict __p,
void *__restrict __tz));
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp));
int _EXFUN(getitimer, (int __which, struct itimerval *__value));
int _EXFUN(setitimer, (int __which, const struct itimerval *__value,
struct itimerval *__ovalue));
int _EXFUN(setitimer, (int __which, const struct itimerval *__restrict __value,
struct itimerval *__restrict __ovalue));
 
#ifdef __cplusplus
}
/contrib/sdk/sources/newlib/libc/include/sys/times.h
21,6 → 21,9
};
 
clock_t _EXFUN(times,(struct tms *));
#ifdef _COMPILING_NEWLIB
clock_t _EXFUN(_times,(struct tms *));
#endif
 
#ifdef __cplusplus
}
/contrib/sdk/sources/newlib/libc/include/sys/types.h
89,10 → 89,22
 
#ifndef _BSDTYPES_DEFINED
/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
#ifndef __u_char_defined
typedef unsigned char u_char;
#define __u_char_defined
#endif
#ifndef __u_short_defined
typedef unsigned short u_short;
#define __u_short_defined
#endif
#ifndef __u_int_defined
typedef unsigned int u_int;
#define __u_int_defined
#endif
#ifndef __u_long_defined
typedef unsigned long u_long;
#define __u_long_defined
#endif
#define _BSDTYPES_DEFINED
#endif
 
109,7 → 121,10
#ifndef __time_t_defined
typedef _TIME_T_ time_t;
#define __time_t_defined
#endif
 
#ifndef __timespec_defined
#define __timespec_defined
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
 
struct timespec {
116,15 → 131,21
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
#endif
 
struct itimerspec {
struct timespec it_interval; /* Timer period */
struct timespec it_value; /* Timer expiration */
};
#endif
 
#ifndef __daddr_t_defined
typedef long daddr_t;
#define __daddr_t_defined
#endif
#ifndef __caddr_t_defined
typedef char * caddr_t;
#define __caddr_t_defined
#endif
 
#ifndef __CYGWIN__
#if defined(__MS_types__) || defined(__rtems__) || \
207,7 → 228,7
includes the W32api winsock[2].h header must know what it is doing;
it must not call the cygwin32 select function.
*/
# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
# define _SYS_TYPES_FD_SET
# define NBBY 8 /* number of bits in a byte */
/*
244,7 → 265,7
*__tmp++ = 0; \
}))
 
# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */
# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) */
 
#undef __MS_types__
#undef _ST_INT32
301,39 → 322,10
#define PTHREAD_CREATE_DETACHED 0
#define PTHREAD_CREATE_JOINABLE 1
 
#if defined(__XMK__) || defined(__rtems__)
/* The following defines are part of the X/Open System Interface (XSI). */
#if defined(__rtems__)
#include <sys/cpuset.h>
#endif
 
/* This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking
* it shall deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behavior.
* Attempting to unlock an unlocked mutex results in undefined behavior.
*/
#define PTHREAD_MUTEX_NORMAL 1
 
/*
* This type of mutex provides error checking. A thread attempting to relock this mutex without first unlocking
* it shall return with an error. A thread attempting to unlock a mutex which another thread has locked shall return
* with an error. A thread attempting to unlock an unlocked mutex shall return with an error.
*/
#define PTHREAD_MUTEX_ERRORCHECK 2
 
/* A thread attempting to relock this mutex without first unlocking it shall succeed in locking the mutex.
* The relocking deadlock which can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex.
* Multiple locks of this mutex shall require the same number of unlocks to release the mutex before another thread can
* acquire the mutex. A thread attempting to unlock a mutex which another thread has locked shall return with an error.
* A thread attempting to unlock an unlocked mutex shall return with an error.
*/
#define PTHREAD_MUTEX_RECURSIVE 3
 
/* Attempting to recursively lock a mutex of this type results in undefined behavior. Attempting to unlock a
* mutex of this type which was not locked by the calling thread results in undefined behavior. Attempting to
* unlock a mutex of this type which is not locked results in undefined behavior. An implementation may map this
* mutex to one of the other mutex types.
*/
#define PTHREAD_MUTEX_DEFAULT 4
 
#endif /* defined(__XMK__) || defined(__rtems__) */
 
#if defined(__XMK__)
typedef struct pthread_attr_s {
int contentionscope;
363,7 → 355,11
int cputime_clock_allowed; /* see time.h */
#endif
int detachstate;
 
#if defined(__rtems__)
size_t affinitysetsize;
cpu_set_t *affinityset;
cpu_set_t affinitysetpreallocated;
#endif
} pthread_attr_t;
 
#endif /* !defined(__XMK__) */
391,12 → 387,49
 
/* Values for mutex type */
 
/* The following defines are part of the X/Open System Interface (XSI). */
 
/*
* This type of mutex does not detect deadlock. A thread attempting to
* relock this mutex without first unlocking it shall deadlock. Attempting
* to unlock a mutex locked by a different thread results in undefined
* behavior. Attempting to unlock an unlocked mutex results in undefined
* behavior.
*/
#define PTHREAD_MUTEX_NORMAL 0
 
/*
* A thread attempting to relock this mutex without first unlocking
* it shall succeed in locking the mutex. The relocking deadlock which
* can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with
* this type of mutex. Multiple locks of this mutex shall require the
* same number of unlocks to release the mutex before another thread can
* acquire the mutex. A thread attempting to unlock a mutex which another
* thread has locked shall return with an error. A thread attempting to
* unlock an unlocked mutex shall return with an error.
*/
#define PTHREAD_MUTEX_RECURSIVE 1
 
/*
* This type of mutex provides error checking. A thread attempting
* to relock this mutex without first unlocking it shall return with an
* error. A thread attempting to unlock a mutex which another thread has
* locked shall return with an error. A thread attempting to unlock an
* unlocked mutex shall return with an error.
*/
#define PTHREAD_MUTEX_ERRORCHECK 2
 
/*
* Attempting to recursively lock a mutex of this type results
* in undefined behavior. Attempting to unlock a mutex of this type
* which was not locked by the calling thread results in undefined
* behavior. Attempting to unlock a mutex of this type which is not locked
* results in undefined behavior. An implementation may map this mutex to
* one of the other mutex types.
*/
#define PTHREAD_MUTEX_DEFAULT 3
 
#endif
#endif /* !defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) */
 
#if defined(__XMK__)
typedef unsigned int pthread_mutex_t; /* identify a mutex */
463,6 → 496,7
 
/* POSIX Spin Lock Types */
 
#if !defined (__CYGWIN__)
#if defined(_POSIX_SPIN_LOCKS)
typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */
#endif /* defined(_POSIX_SPIN_LOCKS) */
469,7 → 503,6
 
/* POSIX Reader/Writer Lock Types */
 
#if !defined (__CYGWIN__)
#if defined(_POSIX_READER_WRITER_LOCKS)
typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */
typedef struct {
/contrib/sdk/sources/newlib/libc/include/sys/unistd.h
71,6 → 71,9
long _EXFUN(fpathconf, (int __fd, int __name ));
int _EXFUN(fsync, (int __fd));
int _EXFUN(fdatasync, (int __fd));
#if defined(__CYGWIN__)
char * _EXFUN(get_current_dir_name, (void));
#endif
char * _EXFUN(getcwd, (char *__buf, size_t __size ));
#if defined(__CYGWIN__)
int _EXFUN(getdomainname ,(char *__name, size_t __len));
172,7 → 175,7
void _EXFUN(setusershell, (void));
#endif
unsigned _EXFUN(sleep, (unsigned int __seconds ));
void _EXFUN(swab, (const void *, void *, ssize_t));
void _EXFUN(swab, (const void *__restrict, void *__restrict, ssize_t));
long _EXFUN(sysconf, (int __name ));
pid_t _EXFUN(tcgetpgrp, (int __fildes ));
int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
219,7 → 222,7
int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
#endif
 
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__) || defined(__SPU__)
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__aarch64__) || defined (__arm__) || defined(__sh__) || defined(__SPU__)
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(ftruncate, (int __fd, off_t __length));
int _EXFUN(truncate, (const char *, off_t __length));
230,7 → 233,7
int _EXFUN(getdtablesize, (void));
int _EXFUN(setdtablesize, (int));
useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
#if !(defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
/* winsock[2].h defines as __stdcall, and with int as 2nd arg */
int _EXFUN(gethostname, (char *__name, size_t __len));
#endif
241,9 → 244,11
void _EXFUN(sync, (void));
#endif
 
ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen));
ssize_t _EXFUN(readlink, (const char *__restrict __path,
char *__restrict __buf, size_t __buflen));
#if defined(__CYGWIN__)
ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__path, char *__buf, size_t __buflen));
ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__restrict __path,
char *__restrict __buf, size_t __buflen));
#endif
int _EXFUN(symlink, (const char *__name1, const char *__name2));
#if defined(__CYGWIN__)
497,10 → 502,6
#define _CS_V6_ENV _CS_V7_ENV
#endif
 
#ifndef __CYGWIN__
# define MAXPATHLEN 1024
#endif
 
#ifdef __cplusplus
}
#endif
/contrib/sdk/sources/newlib/libc/include/sys/wait.h
29,6 → 29,10
pid_t wait (int *);
pid_t waitpid (pid_t, int *, int);
 
#ifdef _COMPILING_NEWLIB
pid_t _wait (int *);
#endif
 
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
pid_t _wait (int *);