Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4348 → Rev 4349

/contrib/sdk/sources/newlib/include/sys/_default_fcntl.h
0,0 → 1,213
 
#ifndef _SYS__DEFAULT_FCNTL_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS__DEFAULT_FCNTL_H_
#include <_ansi.h>
#define _FOPEN (-1) /* from sys/file.h, kernel use only */
#define _FREAD 0x0001 /* read enabled */
#define _FWRITE 0x0002 /* write enabled */
#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
#define _FMARK 0x0010 /* internal; mark during gc() */
#define _FDEFER 0x0020 /* internal; defer for next gc pass */
#define _FASYNC 0x0040 /* signal pgrp when data ready */
#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
#define _FCREAT 0x0200 /* open with file create */
#define _FTRUNC 0x0400 /* open with truncation */
#define _FEXCL 0x0800 /* error on open if file exists */
#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
#define _FSYNC 0x2000 /* do all writes synchronously */
#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
 
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
 
/*
* Flag values for open(2) and fcntl(2)
* The kernel adds 1 to the open modes to turn it into some
* combination of FREAD and FWRITE.
*/
#define O_RDONLY 0 /* +1 == FREAD */
#define O_WRONLY 1 /* +1 == FWRITE */
#define O_RDWR 2 /* +1 == FREAD|FWRITE */
#define O_APPEND _FAPPEND
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
#define O_SYNC _FSYNC
/* O_NDELAY _FNDELAY set in include/fcntl.h */
/* 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
#define _FTEXT 0x20000
#define _FNOINHERIT 0x40000
 
#define O_BINARY _FBINARY
#define O_TEXT _FTEXT
#define O_NOINHERIT _FNOINHERIT
/* O_CLOEXEC is the Linux equivalent to O_NOINHERIT */
#define O_CLOEXEC _FNOINHERIT
 
/* The windows header files define versions with a leading underscore. */
#define _O_RDONLY O_RDONLY
#define _O_WRONLY O_WRONLY
#define _O_RDWR O_RDWR
#define _O_APPEND O_APPEND
#define _O_CREAT O_CREAT
#define _O_TRUNC O_TRUNC
#define _O_EXCL O_EXCL
#define _O_TEXT O_TEXT
#define _O_BINARY O_BINARY
#define _O_RAW O_BINARY
#define _O_NOINHERIT O_NOINHERIT
#endif
 
#ifndef _POSIX_SOURCE
 
/*
* Flags that work for fcntl(fd, F_SETFL, FXXXX)
*/
#define FAPPEND _FAPPEND
#define FSYNC _FSYNC
#define FASYNC _FASYNC
#define FNBIO _FNBIO
#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */
#define FNDELAY _FNDELAY
 
/*
* Flags that are disallowed for fcntl's (FCNTLCANT);
* used for opens, internal state, or locking.
*/
#define FREAD _FREAD
#define FWRITE _FWRITE
#define FMARK _FMARK
#define FDEFER _FDEFER
#define FSHLOCK _FSHLOCK
#define FEXLOCK _FEXLOCK
 
/*
* The rest of the flags, used only for opens
*/
#define FOPEN _FOPEN
#define FCREAT _FCREAT
#define FTRUNC _FTRUNC
#define FEXCL _FEXCL
#define FNOCTTY _FNOCTTY
 
#endif /* !_POSIX_SOURCE */
 
/* XXX close on exec request; must match UF_EXCLOSE in user.h */
#define FD_CLOEXEC 1 /* posix */
 
/* fcntl(2) requests */
#define F_DUPFD 0 /* Duplicate fildes */
#define F_GETFD 1 /* Get fildes flags (close on exec) */
#define F_SETFD 2 /* Set fildes flags (close on exec) */
#define F_GETFL 3 /* Get file flags */
#define F_SETFL 4 /* Set file flags */
#ifndef _POSIX_SOURCE
#define F_GETOWN 5 /* Get owner - for ASYNC */
#define F_SETOWN 6 /* Set owner - for ASYNC */
#endif /* !_POSIX_SOURCE */
#define F_GETLK 7 /* Get record-locking information */
#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */
#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */
#ifndef _POSIX_SOURCE
#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */
#define F_RSETLK 11 /* Set or unlock a remote lock */
#define F_CNVT 12 /* Convert a fhandle to an open fd */
#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */
#endif /* !_POSIX_SOURCE */
#ifdef __CYGWIN__
#define F_DUPFD_CLOEXEC 14 /* As F_DUPFD, but set close-on-exec flag */
#endif
 
/* fcntl(2) flags (l_type field of flock structure) */
#define F_RDLCK 1 /* read lock */
#define F_WRLCK 2 /* write lock */
#define F_UNLCK 3 /* remove lock(s) */
#ifndef _POSIX_SOURCE
#define F_UNLKSYS 4 /* remove remote locks for a given system */
#endif /* !_POSIX_SOURCE */
 
#ifdef __CYGWIN__
/* Special descriptor value to denote the cwd in calls to openat(2) etc. */
#define AT_FDCWD -2
 
/* Flag values for faccessat2) et al. */
#define AT_EACCESS 1
#define AT_SYMLINK_NOFOLLOW 2
#define AT_SYMLINK_FOLLOW 4
#define AT_REMOVEDIR 8
#endif
 
/*#include <sys/stdtypes.h>*/
 
#ifndef __CYGWIN__
/* file segment locking set data type - information passed to system by user */
struct flock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
};
#endif /* __CYGWIN__ */
 
#ifndef _POSIX_SOURCE
/* extended file segment locking set data type */
struct eflock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
long l_rpid; /* Remote process id wanting this lock */
long l_rsys; /* Remote system id wanting this lock */
};
#endif /* !_POSIX_SOURCE */
 
 
#include <sys/types.h>
#include <sys/stat.h> /* sigh. for the mode bits for open/creat */
 
extern int open _PARAMS ((const char *, int, ...));
extern int creat _PARAMS ((const char *, mode_t));
extern int fcntl _PARAMS ((int, int, ...));
#ifdef __CYGWIN__
#include <sys/time.h>
extern int futimesat _PARAMS ((int, const char *, const struct timeval *));
extern int openat _PARAMS ((int, const char *, int, ...));
#endif
 
/* Provide _<systemcall> prototypes for functions provided by some versions
of newlib. */
#ifdef _COMPILING_NEWLIB
extern int _open _PARAMS ((const char *, int, ...));
extern int _fcntl _PARAMS ((int, int, ...));
#ifdef __LARGE64_FILES
extern int _open64 _PARAMS ((const char *, int, ...));
#endif
#endif
 
#ifdef __cplusplus
}
#endif
#endif /* !_SYS__DEFAULT_FCNTL_H_ */
/contrib/sdk/sources/newlib/include/sys/_types.h
0,0 → 1,87
/* ANSI C namespace clean utility typedefs */
 
/* This file defines various typedefs needed by the system calls that support
the C library. Basically, they're just the POSIX versions with an '_'
prepended. This file lives in the `sys' directory so targets can provide
their own if desired (or they can put target dependant conditionals here).
*/
 
#ifndef _SYS__TYPES_H
#define _SYS__TYPES_H
 
#include <machine/_types.h>
#include <sys/lock.h>
 
#ifndef __off_t_defined
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;
#endif
#ifndef __gid_t_defined
typedef unsigned short __gid_t;
#endif
 
#ifndef __off64_t_defined
__extension__ typedef long long _off64_t;
#endif
 
/*
* We need fpos_t for the following, but it doesn't have a leading "_",
* so we use _fpos_t instead.
*/
#ifndef __fpos_t_defined
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
/* (and must be `long' for now) */
#endif
 
#ifdef __LARGE64_FILES
#ifndef __fpos64_t_defined
typedef _off64_t _fpos64_t;
#endif
#endif
 
#ifndef __ssize_t_defined
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
#else
typedef long _ssize_t;
#endif
#endif
 
#define __need_wint_t
#include <stddef.h>
 
#ifndef __mbstate_t_defined
/* Conversion state information. */
typedef struct
{
int __count;
union
{
wint_t __wch;
unsigned char __wchb[4];
} __value; /* Value so far. */
} _mbstate_t;
#endif
 
#ifndef __flock_t_defined
typedef _LOCK_RECURSIVE_T _flock_t;
#endif
 
#ifndef __iconv_t_defined
/* Iconv descriptor type */
typedef void *_iconv_t;
#endif
 
#endif /* _SYS__TYPES_H */
/contrib/sdk/sources/newlib/include/sys/cdefs.h
0,0 → 1,144
/* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */
 
/* Written 2000 by Werner Almesberger */
 
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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 $
*/
 
#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.
*/
 
#define __P(args) args
#define __PMT(args) args
#define __const const
#define __signed signed
#define __volatile volatile
#define __DOTS , ...
#define __THROW
 
/*
* 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
* mode -- there must be no spaces between its arguments, and for nested
* __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
* concatenate double-quoted strings produced by the __STRING macro, but
* this only works with ANSI C.
*
* __XSTRING is like __STRING, but it expands any macros in its argument
* first. It is only available with 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
#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]
 
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS
# define __END_DECLS
#endif
 
#ifndef __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
#endif
 
#ifdef __GNUC__
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
#ifdef __ELF__
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#else
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
__asm__(".equ alias, sym")
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#endif /* __STDC__ */
#else /* !__ELF__ */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs \"" msg "\",30,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#else
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs msg,30,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#endif /* __STDC__ */
#endif /* __ELF__ */
#endif /* __GNUC__ */
 
#endif /* _SYS_CDEFS_H */
/contrib/sdk/sources/newlib/include/sys/config.h
0,0 → 1,255
#ifndef __SYS_CONFIG_H__
#define __SYS_CONFIG_H__
 
#include <machine/ieeefp.h> /* floating point macros */
#include <sys/features.h> /* POSIX defs */
 
/* exceptions first */
#if defined(__H8500__) || defined(__W65__)
#define __SMALL_BITFIELDS
/* ??? This conditional is true for the h8500 and the w65, defining H8300
in those cases probably isn't the right thing to do. */
#define H8300 1
#endif
 
/* 16 bit integer machines */
#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8500__) || defined(__W65__) || defined (__mn10200__) || defined (__AVR__)
 
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX 32767
#define UINT_MAX 65535
#endif
 
#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) || defined (__H8300SX__)
#define __SMALL_BITFIELDS
#define H8300 1
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#endif
 
#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
#ifndef __INT32__
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX 32767
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#else /* INT32 */
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX 2147483647
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#endif /* INT32 */
 
#endif /* CR16C */
 
#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
#define __SMALL_BITFIELDS
#endif
 
#ifdef __W65__
#define __SMALL_BITFIELDS
#endif
 
#if defined(__D10V__)
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define _POINTER_INT short
#endif
 
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define _POINTER_INT short
#endif
 
#ifdef ___AM29K__
#define _FLOAT_RET double
#endif
 
#ifdef __i386__
#ifndef __unix__
/* in other words, go32 */
#define _FLOAT_RET double
#endif
#if defined(__linux__) || defined(__RDOS__)
/* we want the reentrancy structure to be returned by a function */
#define __DYNAMIC_REENT__
#define HAVE_GETDATE
#define _HAVE_SYSTYPES
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define __LARGE64_FILES 1
/* we use some glibc header files so turn on glibc large file feature */
#define _LARGEFILE64_SOURCE 1
#endif
#endif
 
#ifdef __mn10200__
#define __SMALL_BITFIELDS
#endif
 
#ifdef __AVR__
#define __SMALL_BITFIELDS
#define _POINTER_INT short
#endif
 
#ifdef __v850
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))
#endif
 
/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
#if defined(__PPC__)
#if defined(_CALL_SYSV)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
#ifdef __SPE__
#define _LONG_DOUBLE double
#endif
#endif
 
/* Configure small REENT structure for Xilinx MicroBlaze platforms */
#if defined (__MICROBLAZE__)
#ifndef _REENT_SMALL
#define _REENT_SMALL
#endif
/* Xilinx XMK uses Unix98 mutex */
#ifdef __XMK__
#define _UNIX98_THREAD_MUTEX_ATTRIBUTES
#endif
#endif
 
#if defined(__mips__) && !defined(__rtems__)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
 
#ifdef __xstormy16__
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define MALLOC_ALIGNMENT 8
#define _POINTER_INT short
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif
#ifdef __m32c__
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define MALLOC_ALIGNMENT 8
#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
#define _POINTER_INT short
#else
#define _POINTER_INT long
#endif
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif /* __m32c__ */
 
#ifdef __SPU__
#define MALLOC_ALIGNMENT 16
#define __CUSTOM_FILE_IO__
#endif
 
/* This block should be kept in sync with GCC's limits.h. The point
of having these definitions here is to not include limits.h, which
would pollute the user namespace, while still using types of the
the correct widths when deciding how to define __int32_t and
__int64_t. */
#ifndef __INT_MAX__
# ifdef INT_MAX
# define __INT_MAX__ INT_MAX
# else
# define __INT_MAX__ 2147483647
# endif
#endif
 
#ifndef __LONG_MAX__
# ifdef LONG_MAX
# define __LONG_MAX__ LONG_MAX
# else
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
|| defined (__sparcv9)
# define __LONG_MAX__ 9223372036854775807L
# else
# define __LONG_MAX__ 2147483647L
# endif /* __alpha__ || sparc64 */
# endif
#endif
/* End of block that should be kept in sync with GCC's limits.h. */
 
#ifndef _POINTER_INT
#define _POINTER_INT long
#endif
 
#ifdef __frv__
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
#undef __RAND_MAX
#if __INT_MAX__ == 32767
#define __RAND_MAX 32767
#else
#define __RAND_MAX 0x7fffffff
#endif
 
#if defined(__CYGWIN__)
#include <cygwin/config.h>
#if !defined (__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
#define __USE_XOPEN2K 1
#endif
#endif
 
#if defined(__rtems__)
#define __FILENAME_MAX__ 255
#define _READ_WRITE_RETURN_TYPE _ssize_t
#endif
 
#ifndef __EXPORT
#define __EXPORT
#endif
 
#ifndef __IMPORT
#define __IMPORT
#endif
 
/* Define return type of read/write routines. In POSIX, the return type
for read()/write() is "ssize_t" but legacy newlib code has been using
"int" for some time. If not specified, "int" is defaulted. */
#ifndef _READ_WRITE_RETURN_TYPE
#define _READ_WRITE_RETURN_TYPE int
#endif
 
#ifndef __WCHAR_MAX__
#if __INT_MAX__ == 32767 || defined (_WIN32)
#define __WCHAR_MAX__ 0xffffu
#endif
#endif
 
/* See if small reent asked for at configuration time and
is not chosen by the platform by default. */
#ifdef _WANT_REENT_SMALL
#ifndef _REENT_SMALL
#define _REENT_SMALL
#endif
#endif
 
/* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
charsets. The extended charsets add a few functions and a couple
of tables of a few K each. */
#ifdef _MB_EXTENDED_CHARSETS_ALL
#define _MB_EXTENDED_CHARSETS_ISO 1
#define _MB_EXTENDED_CHARSETS_WINDOWS 1
#endif
 
#endif /* __SYS_CONFIG_H__ */
/contrib/sdk/sources/newlib/include/sys/custom_file.h
0,0 → 1,2
#error System-specific custom_file.h is missing.
 
/contrib/sdk/sources/newlib/include/sys/dir.h
0,0 → 1,10
/* BSD predecessor of POSIX.1 <dirent.h> and struct dirent */
 
#ifndef _SYS_DIR_H_
#define _SYS_DIR_H_
 
#include <dirent.h>
 
#define direct dirent
 
#endif /*_SYS_DIR_H_*/
/contrib/sdk/sources/newlib/include/sys/dirent.h
0,0 → 1,13
/* <dirent.h> includes <sys/dirent.h>, which is this file. On a
system which supports <dirent.h>, this file is overridden by
dirent.h in the libc/sys/.../sys directory. On a system which does
not support <dirent.h>, we will get this file which uses #error to force
an error. */
 
#ifdef __cplusplus
extern "C" {
#endif
#error "<dirent.h> not supported"
#ifdef __cplusplus
}
#endif
/contrib/sdk/sources/newlib/include/sys/errno.h
0,0 → 1,192
/* errno is not a global variable, because that would make using it
non-reentrant. Instead, its address is returned by the function
__errno. */
 
#ifndef _SYS_ERRNO_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_ERRNO_H_
 
#include <sys/reent.h>
 
#ifndef _REENT_ONLY
#define errno (*__errno())
extern int *__errno _PARAMS ((void));
#endif
 
/* Please don't use these variables directly.
Use strerror instead. */
extern __IMPORT _CONST char * _CONST _sys_errlist[];
extern __IMPORT int _sys_nerr;
#ifdef __CYGWIN__
extern __IMPORT const char * const sys_errlist[];
extern __IMPORT int sys_nerr;
extern __IMPORT char *program_invocation_name;
extern __IMPORT char *program_invocation_short_name;
#endif
 
#define __errno_r(ptr) ((ptr)->_errno)
 
#define EPERM 1 /* Not super-user */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTBLK 15 /* Block device required */
#endif
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* Too many open files in system */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math arg out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#endif
#define EDEADLK 45 /* Deadlock condition */
#define ENOLCK 46 /* No record locks available */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EBADE 50 /* Invalid exchange */
#define EBADR 51 /* Invalid request descriptor */
#define EXFULL 52 /* Exchange full */
#define ENOANO 53 /* No anode */
#define EBADRQC 54 /* Invalid request code */
#define EBADSLT 55 /* Invalid slot */
#define EDEADLOCK 56 /* File locking deadlock error */
#define EBFONT 57 /* Bad font file fmt */
#endif
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data (for no delay io) */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* The object is remote */
#endif
#define ENOLINK 67 /* The link has been severed */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#endif
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 74 /* Multihop attempted */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ELBIN 75 /* Inode is remote (not really error) */
#define EDOTDOT 76 /* Cross mount point (not really error) */
#endif
#define EBADMSG 77 /* Trying to read unreadable message */
#define EFTYPE 79 /* Inappropriate file type or format */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTUNIQ 80 /* Given log. name not unique */
#define EBADFD 81 /* f.d. invalid for this operation */
#define EREMCHG 82 /* Remote address changed */
#define ELIBACC 83 /* Can't access a needed shared lib */
#define ELIBBAD 84 /* Accessing a corrupted shared lib */
#define ELIBSCN 85 /* .lib section in a.out corrupted */
#define ELIBMAX 86 /* Attempting to link in too many libs */
#define ELIBEXEC 87 /* Attempting to exec a shared library */
#endif
#define ENOSYS 88 /* Function not implemented */
#ifdef __CYGWIN__
#define ENMFILE 89 /* No more files */
#endif
#define ENOTEMPTY 90 /* Directory not empty */
#define ENAMETOOLONG 91 /* File or path name too long */
#define ELOOP 92 /* Too many symbolic links */
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
#define EPROTOTYPE 107 /* Protocol wrong type for socket */
#define ENOTSOCK 108 /* Socket operation on non-socket */
#define ENOPROTOOPT 109 /* Protocol not available */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESHUTDOWN 110 /* Can't send after socket shutdown */
#endif
#define ECONNREFUSED 111 /* Connection refused */
#define EADDRINUSE 112 /* Address already in use */
#define ECONNABORTED 113 /* Connection aborted */
#define ENETUNREACH 114 /* Network is unreachable */
#define ENETDOWN 115 /* Network interface is not configured */
#define ETIMEDOUT 116 /* Connection timed out */
#define EHOSTDOWN 117 /* Host is down */
#define EHOSTUNREACH 118 /* Host is unreachable */
#define EINPROGRESS 119 /* Connection already in progress */
#define EALREADY 120 /* Socket already connected */
#define EDESTADDRREQ 121 /* Destination address required */
#define EMSGSIZE 122 /* Message too long */
#define EPROTONOSUPPORT 123 /* Unknown protocol */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
#endif
#define EADDRNOTAVAIL 125 /* Address not available */
#define ENETRESET 126
#define EISCONN 127 /* Socket is already connected */
#define ENOTCONN 128 /* Socket is not connected */
#define ETOOMANYREFS 129
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EPROCLIM 130
#define EUSERS 131
#endif
#define EDQUOT 132
#define ESTALE 133
#define ENOTSUP 134 /* Not supported */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOMEDIUM 135 /* No medium (in tape drive) */
#endif
#ifdef __CYGWIN__
#define ENOSHARE 136 /* No such host or network path */
#define ECASECLASH 137 /* Filename exists with different case */
#endif
#define EILSEQ 138
#define EOVERFLOW 139 /* Value too large for defined data type */
#define ECANCELED 140 /* Operation canceled */
#define ENOTRECOVERABLE 141 /* State not recoverable */
#define EOWNERDEAD 142 /* Previous owner died */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESTRPIPE 143 /* Streams pipe error */
#endif
#define EWOULDBLOCK EAGAIN /* Operation would block */
 
#define __ELASTERROR 2000 /* Users can add values starting here */
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ERRNO_H */
/contrib/sdk/sources/newlib/include/sys/fcntl.h
0,0 → 1,4
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
#include <sys/_default_fcntl.h>
#endif
/contrib/sdk/sources/newlib/include/sys/features.h
0,0 → 1,211
/*
* Written by Joel Sherrill <joel@OARcorp.com>.
*
* COPYRIGHT (c) 1989-2000.
*
* On-Line Applications Research Corporation (OAR).
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
* 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 $
*/
 
#ifndef _SYS_FEATURES_H
#define _SYS_FEATURES_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
 
#ifdef __rtems__
#define _POSIX_JOB_CONTROL 1
#define _POSIX_SAVED_IDS 1
#define _POSIX_VERSION 199309L
#define _POSIX_ASYNCHRONOUS_IO 1
#define _POSIX_FSYNC 1
#define _POSIX_MAPPED_FILES 1
#define _POSIX_MEMLOCK 1
#define _POSIX_MEMLOCK_RANGE 1
#define _POSIX_MEMORY_PROTECTION 1
#define _POSIX_MESSAGE_PASSING 1
#define _POSIX_MONOTONIC_CLOCK 200112L
#define _POSIX_PRIORITIZED_IO 1
#define _POSIX_PRIORITY_SCHEDULING 1
#define _POSIX_REALTIME_SIGNALS 1
#define _POSIX_SEMAPHORES 1
/* #define _POSIX_SHARED_MEMORY_OBJECTS 1 */
#define _POSIX_SYNCHRONIZED_IO 1
#define _POSIX_TIMERS 1
#define _POSIX_BARRIERS 200112L
#define _POSIX_READER_WRITER_LOCKS 200112L
#define _POSIX_SPIN_LOCKS 200112L
 
 
/* In P1003.1b but defined by drafts at least as early as P1003.1c/D10 */
#define _POSIX_THREADS 1
#define _POSIX_THREAD_ATTR_STACKADDR 1
#define _POSIX_THREAD_ATTR_STACKSIZE 1
#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
#define _POSIX_THREAD_PRIO_INHERIT 1
#define _POSIX_THREAD_PRIO_PROTECT 1
#define _POSIX_THREAD_PROCESS_SHARED 1
#define _POSIX_THREAD_SAFE_FUNCTIONS 1
 
/* P1003.4b/D8 defines the constants below this comment. */
#define _POSIX_SPAWN 1
#define _POSIX_TIMEOUTS 1
#define _POSIX_CPUTIME 1
#define _POSIX_THREAD_CPUTIME 1
#define _POSIX_SPORADIC_SERVER 1
#define _POSIX_THREAD_SPORADIC_SERVER 1
#define _POSIX_DEVICE_CONTROL 1
#define _POSIX_DEVCTL_DIRECTION 1
#define _POSIX_INTERRUPT_CONTROL 1
#define _POSIX_ADVISORY_INFO 1
 
/* UNIX98 added some new pthread mutex attributes */
#define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
 
#endif
 
/* XMK loosely adheres to POSIX -- 1003.1 */
#ifdef __XMK__
#define _POSIX_THREADS 1
#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
#endif
 
 
#ifdef __svr4__
# define _POSIX_JOB_CONTROL 1
# define _POSIX_SAVED_IDS 1
# define _POSIX_VERSION 199009L
#endif
 
#ifdef __CYGWIN__
 
#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
#define _POSIX_VERSION 200112L
#define _POSIX2_VERSION 200112L
#define _XOPEN_VERSION 600
 
#define _POSIX_ADVISORY_INFO 200112L
/* #define _POSIX_ASYNCHRONOUS_IO -1 */
/* #define _POSIX_BARRIERS -1 */
#define _POSIX_CHOWN_RESTRICTED 1
#define _POSIX_CLOCK_SELECTION 200112L
#define _POSIX_CPUTIME 200112L
#define _POSIX_FSYNC 200112L
#define _POSIX_IPV6 200112L
#define _POSIX_JOB_CONTROL 1
#define _POSIX_MAPPED_FILES 200112L
/* #define _POSIX_MEMLOCK -1 */
#define _POSIX_MEMLOCK_RANGE 200112L
#define _POSIX_MEMORY_PROTECTION 200112L
#define _POSIX_MESSAGE_PASSING 200112L
#define _POSIX_MONOTONIC_CLOCK 200112L
#define _POSIX_NO_TRUNC 1
/* #define _POSIX_PRIORITIZED_IO -1 */
#define _POSIX_PRIORITY_SCHEDULING 200112L
#define _POSIX_RAW_SOCKETS 200112L
#define _POSIX_READER_WRITER_LOCKS 200112L
#define _POSIX_REALTIME_SIGNALS 200112L
#define _POSIX_REGEXP 1
#define _POSIX_SAVED_IDS 1
#define _POSIX_SEMAPHORES 200112L
#define _POSIX_SHARED_MEMORY_OBJECTS 200112L
#define _POSIX_SHELL 1
/* #define _POSIX_SPAWN -1 */
#define _POSIX_SPIN_LOCKS 200112L
/* #define _POSIX_SPORADIC_SERVER -1 */
#define _POSIX_SYNCHRONIZED_IO 200112L
#define _POSIX_THREAD_ATTR_STACKADDR 200112L
#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
#define _POSIX_THREAD_CPUTIME 200112L
/* #define _POSIX_THREAD_PRIO_INHERIT -1 */
/* #define _POSIX_THREAD_PRIO_PROTECT -1 */
#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
#define _POSIX_THREAD_PROCESS_SHARED 200112L
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */
#define _POSIX_THREADS 200112L
/* #define _POSIX_TIMEOUTS -1 */
#define _POSIX_TIMERS 1
/* #define _POSIX_TRACE -1 */
/* #define _POSIX_TRACE_EVENT_FILTER -1 */
/* #define _POSIX_TRACE_INHERIT -1 */
/* #define _POSIX_TRACE_LOG -1 */
/* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */
#define _POSIX_VDISABLE '\0'
#define _POSIX2_C_BIND 200112L
#define _POSIX2_C_DEV 200112L
#define _POSIX2_CHAR_TERM 200112L
/* #define _POSIX2_FORT_DEV -1 */
/* #define _POSIX2_FORT_RUN -1 */
/* #define _POSIX2_LOCALEDEF -1 */
/* #define _POSIX2_PBS -1 */
/* #define _POSIX2_PBS_ACCOUNTING -1 */
/* #define _POSIX2_PBS_CHECKPOINT -1 */
/* #define _POSIX2_PBS_LOCATE -1 */
/* #define _POSIX2_PBS_MESSAGE -1 */
/* #define _POSIX2_PBS_TRACK -1 */
#define _POSIX2_SW_DEV 200112L
#define _POSIX2_UPE 200112L
#define _POSIX_V6_ILP32_OFF32 -1
#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
/* #define _XOPEN_LEGACY -1 */
/* #define _XOPEN_REALTIME -1 */
/* #define _XOPEN_REALTIME_THREADS -1 */
#define _XOPEN_SHM 1
/* #define _XOPEN_STREAMS -1 */
/* #define _XOPEN_UNIX -1 */
 
#endif /* !__STRICT_ANSI__ || __cplusplus || __STDC_VERSION__ >= 199901L */
 
/* The value corresponds to UNICODE version 4.0, which is the version
supported by XP. Newlib supports 5.2 (2011) but so far Cygwin needs
the MS conversions for double-byte charsets. */
#define __STDC_ISO_10646__ 200305L
 
#endif /* __CYGWIN__ */
 
/* Per the permission given in POSIX.1-2008 section 2.2.1, define
* _POSIX_C_SOURCE if _XOPEN_SOURCE is defined and _POSIX_C_SOURCE is not.
* (_XOPEN_SOURCE indicates that XSI extensions are desired by an application.)
* This permission is first granted in 2008, but use it for older ones, also.
* Allow for _XOPEN_SOURCE to be empty (from the earliest form of it, before it
* was required to have specific values).
*/
#if !defined(_POSIX_C_SOURCE) && defined(_XOPEN_SOURCE)
#if (_XOPEN_SOURCE - 0) == 700 /* POSIX.1-2008 */
#define _POSIX_C_SOURCE 200809L
#elif (_XOPEN_SOURCE - 0) == 600 /* POSIX.1-2001 or 2004 */
#define _POSIX_C_SOURCE 200112L
#elif (_XOPEN_SOURCE - 0) == 500 /* POSIX.1-1995 */
#define _POSIX_C_SOURCE 199506L
#elif (_XOPEN_SOURCE - 0) < 500 /* really old */
#define _POSIX_C_SOURCE 2
#endif
#endif
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FEATURES_H */
/contrib/sdk/sources/newlib/include/sys/file.h
0,0 → 1,2
 
#include <sys/fcntl.h>
/contrib/sdk/sources/newlib/include/sys/iconvnls.h
0,0 → 1,77
/*
* Copyright (c) 2003-2004, Artem B. Bityuckiy.
* Rights transferred to Franklin Electronic Publishers.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Funtions, macros, etc implimented in iconv library but used by other
* NLS-related subsystems too.
*/
#ifndef __SYS_ICONVNLS_H__
#define __SYS_ICONVNLS_H__
 
#include <_ansi.h>
#include <reent.h>
#include <wchar.h>
#include <iconv.h>
 
/* Iconv data path environment variable name */
#define NLS_ENVVAR_NAME "NLSPATH"
/* Default NLSPATH value */
#define ICONV_DEFAULT_NLSPATH "/usr/locale"
/* Direction markers */
#define ICONV_NLS_FROM 0
#define ICONV_NLS_TO 1
 
_VOID
_EXFUN(_iconv_nls_get_state, (iconv_t cd, mbstate_t *ps, int direction));
 
int
_EXFUN(_iconv_nls_set_state, (iconv_t cd, mbstate_t *ps, int direction));
 
int
_EXFUN(_iconv_nls_is_stateful, (iconv_t cd, int direction));
 
int
_EXFUN(_iconv_nls_get_mb_cur_max, (iconv_t cd, int direction));
 
size_t
_EXFUN(_iconv_nls_conv, (struct _reent *rptr, iconv_t cd,
_CONST char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft));
 
_CONST char *
_EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, _CONST char *file,
_CONST char *dir, _CONST char *ext));
 
 
int
_EXFUN(_iconv_nls_open, (struct _reent *rptr, _CONST char *encoding,
iconv_t *towc, iconv_t *fromwc, int flag));
 
char *
_EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, _CONST char *ca));
 
#endif /* __SYS_ICONVNLS_H__ */
 
/contrib/sdk/sources/newlib/include/sys/kos_io.h
0,0 → 1,88
 
#ifndef __KOS_IO_H__
#define __KOS_IO_H__
 
#pragma pack(push, 1)
typedef struct
{
char sec;
char min;
char hour;
char rsv;
}detime_t;
 
typedef struct
{
char day;
char month;
short year;
}dedate_t;
 
typedef struct
{
unsigned attr;
unsigned flags;
union
{
detime_t ctime;
unsigned cr_time;
};
union
{
dedate_t cdate;
unsigned cr_date;
};
union
{
detime_t atime;
unsigned acc_time;
};
union
{
dedate_t adate;
unsigned acc_date;
};
union
{
detime_t mtime;
unsigned mod_time;
};
union
{
dedate_t mdate;
unsigned mod_date;
};
unsigned size;
unsigned size_high;
} fileinfo_t;
 
#pragma pack(pop)
 
int create_file(const char *path);
int get_fileinfo(const char *path, fileinfo_t *info);
int read_file(const char *path, void *buff,
size_t offset, size_t count, size_t *reads);
int write_file(const char *path,const void *buff,
size_t offset, size_t count, size_t *writes);
int set_file_size(const char *path, unsigned size);
void *load_file(const char *path, size_t *len);
void __stdcall unpack(void* packed_data, void* unpacked_data);
 
static inline int user_free(void *mem)
{
int val;
__asm__ __volatile__(
"int $0x40"
:"=a"(val)
:"a"(68),"b"(12),"c"(mem));
return val;
}
 
static inline void set_cwd(const char* cwd)
{
__asm__ __volatile__(
"int $0x40"
::"a"(30),"b"(1),"c"(cwd));
};
 
#endif
/contrib/sdk/sources/newlib/include/sys/lock.h
0,0 → 1,69
#ifndef __SYS_LOCK_H__
#define __SYS_LOCK_H__
 
#define _LIBC 1
#define NOT_IN_libc 1
 
#ifndef __USE_GNU
#define __USE_GNU 1
#endif
 
void __mutex_lock(volatile int *val);
 
typedef volatile int __libc_lock_t;
typedef struct { volatile int mutex; } __libc_lock_recursive_t;
 
#define __libc_lock_define(CLASS,NAME) \
CLASS __libc_lock_t NAME;
#define __libc_rwlock_define(CLASS,NAME) \
CLASS __libc_rwlock_t NAME;
#define __libc_lock_define_recursive(CLASS,NAME) \
CLASS __libc_lock_recursive_t NAME;
#define __rtld_lock_define_recursive(CLASS,NAME) \
CLASS __rtld_lock_recursive_t NAME;
 
typedef __libc_lock_t _LOCK_T;
typedef __libc_lock_recursive_t _LOCK_RECURSIVE_T;
 
#define __LOCK_INIT(class,lock) \
__libc_lock_define_initialized(class, lock)
 
#define __LOCK_INIT_RECURSIVE(class, lock) \
__libc_lock_define_initialized_recursive(class, lock)
 
#define __libc_lock_define_initialized(CLASS,NAME) \
CLASS __libc_lock_t NAME;
 
#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
 
#define _LIBC_LOCK_RECURSIVE_INITIALIZER {0}
 
#define __lock_init(__lock) __libc_lock_init(__lock)
#define __lock_init_recursive(__lock) __libc_lock_init_recursive(__lock)
#define __lock_acquire(__lock) __libc_lock_lock(__lock)
#define __lock_acquire_recursive(__lock) __libc_lock_lock_recursive(__lock)
#define __lock_release(__lock) __libc_lock_unlock(__lock)
#define __lock_release_recursive(__lock) __libc_lock_unlock_recursive(__lock)
#define __lock_try_acquire(__lock) __libc_lock_trylock(__lock)
#define __lock_try_acquire_recursive(__lock) \
__libc_lock_trylock_recursive(__lock)
#define __lock_close(__lock) __libc_lock_fini(__lock)
#define __lock_close_recursive(__lock) __libc_lock_fini_recursive(__lock)
 
 
#define __libc_lock_init_recursive(NAME) ((NAME).mutex=0)
#define __libc_lock_fini(NAME)
 
#define __libc_lock_fini_recursive(NAME) __libc_lock_fini ((NAME).mutex)
 
 
#define __libc_lock_lock(NAME) __mutex_lock (&(NAME))
 
/* Lock the recursive named lock variable. */
#define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex)
 
#define __libc_lock_unlock(NAME) ((NAME)=0)
#define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex)
 
#endif /* __SYS_LOCK_H__ */
/contrib/sdk/sources/newlib/include/sys/param.h
0,0 → 1,25
/* This is a dummy <sys/param.h> file, not customized for any
particular system. If there is a param.h in libc/sys/SYSDIR/sys,
it will override this one. */
 
#ifndef _SYS_PARAM_H
# define _SYS_PARAM_H
 
#include <sys/config.h>
#include <machine/endian.h>
#include <machine/param.h>
 
#ifndef HZ
# define HZ (60)
#endif
#ifndef NOFILE
# define NOFILE (60)
#endif
#ifndef PATHSIZE
# define PATHSIZE (1024)
#endif
 
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
 
#endif
/contrib/sdk/sources/newlib/include/sys/queue.h
0,0 → 1,471
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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 $
*/
 
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
 
#include <machine/ansi.h> /* for __offsetof */
 
/*
* This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues.
*
* A singly-linked list is headed by a single forward pointer. The elements
* are singly linked for minimum space and pointer manipulation overhead at
* the expense of O(n) removal for arbitrary elements. New elements can be
* added to the list after an existing element or at the head of the list.
* Elements being removed from the head of the list should use the explicit
* macro for this purpose for optimum efficiency. A singly-linked list may
* only be traversed in the forward direction. Singly-linked lists are ideal
* for applications with large datasets and few or no removals or for
* implementing a LIFO queue.
*
* A singly-linked 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
* singly linked for minimum space and pointer manipulation overhead at the
* expense of O(n) removal for arbitrary elements. New elements can be added
* to the list after an existing element, at the head of the list, or at the
* end of the list. Elements being removed from the head of the tail queue
* should use the explicit macro for this purpose for optimum efficiency.
* A singly-linked tail queue may only be traversed in the forward direction.
* Singly-linked tail queues are ideal for applications with large datasets
* and few or no removals or for implementing a FIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* 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.
*
* 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
* linked 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, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* For details on the use of these macros, see the queue(3) manual page.
*
*
* SLIST LIST STAILQ TAILQ
* _HEAD + + + +
* _HEAD_INITIALIZER + + + +
* _ENTRY + + + +
* _INIT + + + +
* _EMPTY + + + +
* _FIRST + + + +
* _NEXT + + + +
* _PREV - - - +
* _LAST - - + +
* _FOREACH + + + +
* _FOREACH_REVERSE - - - +
* _INSERT_HEAD + + + +
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
* _CONCAT - - + +
* _REMOVE_HEAD + - + -
* _REMOVE + + + +
*
*/
 
/*
* Singly-linked List declarations.
*/
#define SLIST_HEAD(name, type) \
struct name { \
struct type *slh_first; /* first element */ \
}
 
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List functions.
*/
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
 
#define SLIST_FIRST(head) ((head)->slh_first)
 
#define SLIST_FOREACH(var, head, field) \
for ((var) = SLIST_FIRST((head)); \
(var); \
(var) = SLIST_NEXT((var), field))
 
#define SLIST_INIT(head) do { \
SLIST_FIRST((head)) = NULL; \
} while (0)
 
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
SLIST_NEXT((slistelm), field) = (elm); \
} while (0)
 
#define SLIST_INSERT_HEAD(head, elm, field) do { \
SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
SLIST_FIRST((head)) = (elm); \
} while (0)
 
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
 
#define SLIST_REMOVE(head, elm, type, field) do { \
if (SLIST_FIRST((head)) == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
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); \
} \
} while (0)
 
#define SLIST_REMOVE_HEAD(head, field) do { \
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
} while (0)
 
/*
* Singly-linked Tail queue declarations.
*/
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first;/* first element */ \
struct type **stqh_last;/* addr of last next element */ \
}
 
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
 
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
 
/*
* Singly-linked Tail queue functions.
*/
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
*(head1)->stqh_last = (head2)->stqh_first; \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_INIT((head2)); \
} \
} while (0)
 
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
 
#define STAILQ_FIRST(head) ((head)->stqh_first)
 
#define STAILQ_FOREACH(var, head, field) \
for((var) = STAILQ_FIRST((head)); \
(var); \
(var) = STAILQ_NEXT((var), field))
 
#define STAILQ_INIT(head) do { \
STAILQ_FIRST((head)) = NULL; \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
 
#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
STAILQ_NEXT((tqelm), field) = (elm); \
} while (0)
 
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
STAILQ_FIRST((head)) = (elm); \
} while (0)
 
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
STAILQ_NEXT((elm), field) = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
 
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *) \
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
 
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
 
#define STAILQ_REMOVE(head, elm, type, field) do { \
if (STAILQ_FIRST((head)) == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
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);\
} \
} while (0)
 
#define STAILQ_REMOVE_HEAD(head, field) do { \
if ((STAILQ_FIRST((head)) = \
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
 
#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
 
/*
* List declarations.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
 
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
 
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
 
/*
* List functions.
*/
 
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
 
#define LIST_FIRST(head) ((head)->lh_first)
 
#define LIST_FOREACH(var, head, field) \
for ((var) = LIST_FIRST((head)); \
(var); \
(var) = LIST_NEXT((var), field))
 
#define LIST_INIT(head) do { \
LIST_FIRST((head)) = NULL; \
} while (0)
 
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
LIST_NEXT((listelm), field)->field.le_prev = \
&LIST_NEXT((elm), field); \
LIST_NEXT((listelm), field) = (elm); \
(elm)->field.le_prev = &LIST_NEXT((listelm), field); \
} while (0)
 
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
LIST_NEXT((elm), field) = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &LIST_NEXT((elm), field); \
} while (0)
 
#define LIST_INSERT_HEAD(head, elm, field) do { \
if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
LIST_FIRST((head)) = (elm); \
(elm)->field.le_prev = &LIST_FIRST((head)); \
} while (0)
 
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
 
#define LIST_REMOVE(elm, field) do { \
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); \
} while (0)
 
/*
* Tail queue declarations.
*/
#define TAILQ_HEAD(name, type) \
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}
 
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
 
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}
 
/*
* Tail queue functions.
*/
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (0)
 
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
 
#define TAILQ_FIRST(head) ((head)->tqh_first)
 
#define TAILQ_FOREACH(var, head, field) \
for ((var) = TAILQ_FIRST((head)); \
(var); \
(var) = TAILQ_NEXT((var), field))
 
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var); \
(var) = TAILQ_PREV((var), headname, field))
 
#define TAILQ_INIT(head) do { \
TAILQ_FIRST((head)) = NULL; \
(head)->tqh_last = &TAILQ_FIRST((head)); \
} while (0)
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
TAILQ_NEXT((elm), field)->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
} while (0)
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
(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); \
} while (0)
 
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
TAILQ_FIRST((head))->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_FIRST((head)) = (elm); \
(elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
} while (0)
 
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
} while (0)
 
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
 
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
 
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 
#define TAILQ_REMOVE(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field)) != NULL) \
TAILQ_NEXT((elm), field)->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
} while (0)
 
 
#ifdef _KERNEL
 
/*
* XXX insque() and remque() are an old way of handling certain queues.
* They bogusly assumes that all queue heads look alike.
*/
 
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
 
#ifdef __GNUC__
 
static __inline void
insque(void *a, void *b)
{
struct quehead *element = (struct quehead *)a,
*head = (struct quehead *)b;
 
element->qh_link = head->qh_link;
element->qh_rlink = head;
head->qh_link = element;
element->qh_link->qh_rlink = element;
}
 
static __inline void
remque(void *a)
{
struct quehead *element = (struct quehead *)a;
 
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;
element->qh_rlink = 0;
}
 
#else /* !__GNUC__ */
 
void insque(void *a, void *b);
void remque(void *a);
 
#endif /* __GNUC__ */
 
#endif /* _KERNEL */
 
#endif /* !_SYS_QUEUE_H_ */
/contrib/sdk/sources/newlib/include/sys/reent.h
0,0 → 1,841
/* This header file provides the reentrancy. */
 
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
in the namespace allotted to us. */
 
#ifndef _SYS_REENT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_REENT_H_
 
#include <_ansi.h>
#include <sys/_types.h>
 
#define _NULL 0
 
#ifndef __Long
#if __LONG_MAX__ == 2147483647L
#define __Long long
typedef unsigned __Long __ULong;
#elif __INT_MAX__ == 2147483647
#define __Long int
typedef unsigned __Long __ULong;
#endif
#endif
 
#if !defined( __Long)
#include <sys/types.h>
#endif
 
#ifndef __Long
#define __Long __int32_t
typedef __uint32_t __ULong;
#endif
 
struct _reent;
 
/*
* If _REENT_SMALL is defined, we make struct _reent as small as possible,
* by having nearly everything possible allocated at first use.
*/
 
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
 
/* needed by reentrant structure */
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
 
/*
* atexit() support.
*/
 
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
 
struct _on_exit_args {
void * _fnargs[_ATEXIT_SIZE]; /* user fn args */
void * _dso_handle[_ATEXIT_SIZE];
/* Bitmask is set if user function takes arguments. */
__ULong _fntypes; /* type of exit routine -
Must have at least _ATEXIT_SIZE bits */
/* Bitmask is set if function was registered via __cxa_atexit. */
__ULong _is_cxa;
};
 
#ifdef _REENT_SMALL
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args * _on_exit_args_ptr;
};
#else
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
/* Some entries may already have been called, and will be NULL. */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args _on_exit_args;
};
#endif
 
/*
* Stdio buffers.
*
* This and __FILE are defined here because we need them for struct _reent,
* but we don't want stdio.h included when stdlib.h is.
*/
 
struct __sbuf {
unsigned char *_base;
int _size;
};
 
/*
* Stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*/
 
#ifdef _REENT_SMALL
/*
* struct __sFILE_fake is the start of a struct __sFILE, with only the
* minimal fields allocated. In __sinit() we really allocate the 3
* standard streams, etc., and point away from this fake.
*/
struct __sFILE_fake {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
 
struct _reent *_data;
};
 
/* Following is needed both in libc/stdio and libc/stdlib so we put it
* here instead of libc/stdio/local.h where it was previously. */
 
extern _VOID _EXFUN(__sinit,(struct _reent *));
 
# define _REENT_SMALL_CHECK_INIT(ptr) \
do \
{ \
if ((ptr) && !(ptr)->__sdidinit) \
__sinit (ptr); \
} \
while (0)
#else
# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
#endif
 
struct __sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
 
#ifdef _REENT_SMALL
struct _reent *_data;
#endif
 
/* operations */
_PTR _cookie; /* cookie passed to io functions */
 
_READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
char *, int));
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
const char *, int));
_fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
int _EXFNPTR(_close, (struct _reent *, _PTR));
 
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
 
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
 
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
 
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _offset; /* current lseek offset */
 
#ifndef _REENT_SMALL
struct _reent *_data; /* Here for binary compatibility? Remove? */
#endif
 
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
_mbstate_t _mbstate; /* for wide char stdio functions. */
int _flags2; /* for future use */
};
 
#ifdef __CUSTOM_FILE_IO__
 
/* Get custom _FILE definition. */
#include <sys/custom_file.h>
 
#else /* !__CUSTOM_FILE_IO__ */
#ifdef __LARGE64_FILES
struct __sFILE64 {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
 
struct _reent *_data;
 
/* operations */
_PTR _cookie; /* cookie passed to io functions */
 
_READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
char *, int));
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
const char *, int));
_fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
int _EXFNPTR(_close, (struct _reent *, _PTR));
 
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
 
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
 
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
 
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _flags2; /* for future use */
 
_off64_t _offset; /* current lseek offset */
_fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int));
 
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
_mbstate_t _mbstate; /* for wide char stdio functions. */
};
typedef struct __sFILE64 __FILE;
#else
typedef struct __sFILE __FILE;
#endif /* __LARGE64_FILES */
#endif /* !__CUSTOM_FILE_IO__ */
 
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
 
/*
* rand48 family support
*
* Copyright (c) 1993 Martin Birgmeier
* All rights reserved.
*
* You may redistribute unmodified or modified versions of this source
* code provided that the above copyright notice and this and the
* following conditions are retained.
*
* This software is provided ``as is'', and comes with no warranties
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
*/
#define _RAND48_SEED_0 (0x330e)
#define _RAND48_SEED_1 (0xabcd)
#define _RAND48_SEED_2 (0x1234)
#define _RAND48_MULT_0 (0xe66d)
#define _RAND48_MULT_1 (0xdeec)
#define _RAND48_MULT_2 (0x0005)
#define _RAND48_ADD (0x000b)
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
#ifdef _REENT_SMALL
/* Put this in here as well, for good luck. */
__extension__ unsigned long long _rand_next;
#endif
};
 
/* How big the some arrays are. */
#define _REENT_EMERGENCY_SIZE 25
#define _REENT_ASCTIME_SIZE 26
#define _REENT_SIGNAL_SIZE 24
 
/*
* struct _reent
*
* This structure contains *all* globals needed by the library.
* It's raison d'etre is to facilitate threads by making all library routines
* reentrant. IE: All state information is contained here.
*/
 
#ifdef _REENT_SMALL
 
struct _mprec
{
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
};
 
 
struct _misc_reent
{
/* miscellaneous reentrant data */
char *_strtok_last;
_mbstate_t _mblen_state;
_mbstate_t _wctomb_state;
_mbstate_t _mbtowc_state;
char _l64a_buf[8];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
};
 
/* This version of _reent is layed our with "int"s in pairs, to help
* ports with 16-bit int's but 32-bit pointers, align nicely. */
struct _reent
{
/* As an exception to the above put _errno first for binary
compatibility with non _REENT_SMALL targets. */
int _errno; /* local copy of errno */
 
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr; /* XXX */
 
int _inc; /* used by tmpnam */
 
char *_emergency;
 
int __sdidinit; /* 1 means stdio has been init'd */
 
int _current_category; /* unused */
_CONST char *_current_locale; /* unused */
 
struct _mprec *_mp;
 
void _EXFNPTR(__cleanup, (struct _reent *));
 
int _gamma_signgam;
 
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
 
struct _rand48 *_r48;
struct __tm *_localtime_buf;
char *_asctime_buf;
 
/* signal info */
void (**(_sig_func))(int);
 
/* atexit stuff */
struct _atexit *_atexit;
struct _atexit _atexit0;
 
struct _glue __sglue; /* root of glue chain */
__FILE *__sf; /* file descriptors */
struct _misc_reent *_misc; /* strtok, multibyte states */
char *_signal_buf; /* strsignal */
};
 
extern const struct __sFILE_fake __sf_fake_stdin;
extern const struct __sFILE_fake __sf_fake_stdout;
extern const struct __sFILE_fake __sf_fake_stderr;
 
# define _REENT_INIT(var) \
{ 0, \
(__FILE *)&__sf_fake_stdin, \
(__FILE *)&__sf_fake_stdout, \
(__FILE *)&__sf_fake_stderr, \
0, \
_NULL, \
0, \
0, \
"C", \
_NULL, \
_NULL, \
0, \
0, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
{_NULL, 0, {_NULL}, _NULL}, \
{_NULL, 0, _NULL}, \
_NULL, \
_NULL, \
_NULL \
}
 
#define _REENT_INIT_PTR(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. */
#if DEBUG
#include <assert.h>
#define __reent_assert(x) assert(x)
#else
#define __reent_assert(x) ((void)0)
#endif
 
#ifdef __CUSTOM_FILE_IO__
#error Custom FILE I/O and _REENT_SMALL not currently supported.
#endif
 
/* Generic _REENT check macro. */
#define _REENT_CHECK(var, what, type, size, init) do { \
struct _reent *_r = (var); \
if (_r->what == NULL) { \
_r->what = (type)malloc(size); \
__reent_assert(_r->what); \
init; \
} \
} while (0)
 
#define _REENT_CHECK_TM(var) \
_REENT_CHECK(var, _localtime_buf, struct __tm *, sizeof *((var)->_localtime_buf), \
/* nothing */)
 
#define _REENT_CHECK_ASCTIME_BUF(var) \
_REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \
memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE))
 
/* Handle the dynamically allocated rand48 structure. */
#define _REENT_INIT_RAND48(var) do { \
struct _reent *_r = (var); \
_r->_r48->_seed[0] = _RAND48_SEED_0; \
_r->_r48->_seed[1] = _RAND48_SEED_1; \
_r->_r48->_seed[2] = _RAND48_SEED_2; \
_r->_r48->_mult[0] = _RAND48_MULT_0; \
_r->_r48->_mult[1] = _RAND48_MULT_1; \
_r->_r48->_mult[2] = _RAND48_MULT_2; \
_r->_r48->_add = _RAND48_ADD; \
_r->_r48->_rand_next = 1; \
} while (0)
#define _REENT_CHECK_RAND48(var) \
_REENT_CHECK(var, _r48, struct _rand48 *, sizeof *((var)->_r48), _REENT_INIT_RAND48((var)))
 
#define _REENT_INIT_MP(var) do { \
struct _reent *_r = (var); \
_r->_mp->_result_k = 0; \
_r->_mp->_result = _r->_mp->_p5s = _NULL; \
_r->_mp->_freelist = _NULL; \
} while (0)
#define _REENT_CHECK_MP(var) \
_REENT_CHECK(var, _mp, struct _mprec *, sizeof *((var)->_mp), _REENT_INIT_MP(var))
 
#define _REENT_CHECK_EMERGENCY(var) \
_REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
 
#define _REENT_INIT_MISC(var) do { \
struct _reent *_r = (var); \
_r->_misc->_strtok_last = _NULL; \
_r->_misc->_mblen_state.__count = 0; \
_r->_misc->_mblen_state.__value.__wch = 0; \
_r->_misc->_wctomb_state.__count = 0; \
_r->_misc->_wctomb_state.__value.__wch = 0; \
_r->_misc->_mbtowc_state.__count = 0; \
_r->_misc->_mbtowc_state.__value.__wch = 0; \
_r->_misc->_mbrlen_state.__count = 0; \
_r->_misc->_mbrlen_state.__value.__wch = 0; \
_r->_misc->_mbrtowc_state.__count = 0; \
_r->_misc->_mbrtowc_state.__value.__wch = 0; \
_r->_misc->_mbsrtowcs_state.__count = 0; \
_r->_misc->_mbsrtowcs_state.__value.__wch = 0; \
_r->_misc->_wcrtomb_state.__count = 0; \
_r->_misc->_wcrtomb_state.__value.__wch = 0; \
_r->_misc->_wcsrtombs_state.__count = 0; \
_r->_misc->_wcsrtombs_state.__value.__wch = 0; \
_r->_misc->_l64a_buf[0] = '\0'; \
_r->_misc->_getdate_err = 0; \
} while (0)
#define _REENT_CHECK_MISC(var) \
_REENT_CHECK(var, _misc, struct _misc_reent *, sizeof *((var)->_misc), _REENT_INIT_MISC(var))
 
#define _REENT_CHECK_SIGNAL_BUF(var) \
_REENT_CHECK(var, _signal_buf, char *, _REENT_SIGNAL_SIZE, /* nothing */)
 
#define _REENT_SIGNGAM(ptr) ((ptr)->_gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_r48->_rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_r48->_seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_r48->_mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_r48->_add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_mp->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_mp->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_mp->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_mp->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_asctime_buf)
#define _REENT_TM(ptr) ((ptr)->_localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_misc->_strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_misc->_mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_misc->_mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_misc->_wctomb_state)
#define _REENT_MBRLEN_STATE(ptr) ((ptr)->_misc->_mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr) ((ptr)->_misc->_mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr) ((ptr)->_misc->_mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr) ((ptr)->_misc->_wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr) ((ptr)->_misc->_wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_misc->_l64a_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_misc->_getdate_err))
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_signal_buf)
 
#else /* !_REENT_SMALL */
 
struct _reent
{
int _errno; /* local copy of errno */
 
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr;
 
int _inc; /* used by tmpnam */
char _emergency[_REENT_EMERGENCY_SIZE];
 
int _current_category; /* used by setlocale */
_CONST char *_current_locale;
 
int __sdidinit; /* 1 means stdio has been init'd */
 
void _EXFNPTR(__cleanup, (struct _reent *));
 
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
 
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
 
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[_REENT_ASCTIME_SIZE];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[_REENT_SIGNAL_SIZE];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
int _h_errno;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
allow addition of new reent fields and keep binary compatibility. */
struct
{
#define _N_LISTS 30
unsigned char * _nextf[_N_LISTS];
unsigned int _nmalloc[_N_LISTS];
} _unused;
} _new;
 
/* atexit stuff */
struct _atexit *_atexit; /* points to head of LIFO stack */
struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
 
/* signal info */
void (**(_sig_func))(int);
 
/* These are here last so that __FILE can grow without changing the offsets
of the above members (on the off chance that future binary compatibility
would be broken otherwise). */
struct _glue __sglue; /* root of glue chain */
__FILE __sf[3]; /* first three file descriptors */
};
 
#define _REENT_INIT(var) \
{ 0, \
&(var).__sf[0], \
&(var).__sf[1], \
&(var).__sf[2], \
0, \
"", \
0, \
"C", \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
{ \
{ \
0, \
_NULL, \
"", \
{0, 0, 0, 0, 0, 0, 0, 0, 0}, \
0, \
1, \
{ \
{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
{_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, \
_RAND48_ADD \
}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
"", \
"", \
0, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}} \
} \
}, \
_NULL, \
{_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \
_NULL, \
{_NULL, 0, _NULL} \
}
 
#define _REENT_INIT_PTR(var) \
{ (var)->_errno = 0; \
(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; \
(var)->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
(var)->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
(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 */
#define _REENT_CHECK_MP(ptr) /* nothing */
#define _REENT_CHECK_TM(ptr) /* nothing */
#define _REENT_CHECK_ASCTIME_BUF(ptr) /* nothing */
#define _REENT_CHECK_EMERGENCY(ptr) /* nothing */
#define _REENT_CHECK_MISC(ptr) /* nothing */
#define _REENT_CHECK_SIGNAL_BUF(ptr) /* nothing */
 
#define _REENT_SIGNGAM(ptr) ((ptr)->_new._reent._gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_new._reent._rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_new._reent._r48._seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_new._reent._r48._mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_new._reent._r48._add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_new._reent._asctime_buf)
#define _REENT_TM(ptr) (&(ptr)->_new._reent._localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_new._reent._strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_new._reent._mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_new._reent._mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_new._reent._wctomb_state)
#define _REENT_MBRLEN_STATE(ptr)((ptr)->_new._reent._mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr)((ptr)->_new._reent._mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr)((ptr)->_new._reent._mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr)((ptr)->_new._reent._wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr)((ptr)->_new._reent._wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_new._reent._l64a_buf)
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_new._reent._signal_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_new._reent._getdate_err))
 
#endif /* !_REENT_SMALL */
 
/* This value is used in stdlib/misc.c. reent/reent.c has to know it
as well to make sure the freelist is correctly free'd. Therefore
we define it here, rather than in stdlib/misc.c, as before. */
#define _Kmax (sizeof (size_t) << 3)
 
/*
* All references to struct _reent are via this pointer.
* Internally, newlib routines that need to reference it should use _REENT.
*/
 
#ifndef __ATTRIBUTE_IMPURE_PTR__
#define __ATTRIBUTE_IMPURE_PTR__
#endif
 
extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
extern struct _reent *_CONST _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
 
void _reclaim_reent _PARAMS ((struct _reent *));
 
/* #define _REENT_ONLY define this to get only reentrant routines */
 
 
static inline struct _reent *__getreent(void)
{
struct _reent *ent;
__asm__ __volatile__(
"movl %%fs:16, %0"
:"=r"(ent));
return ent;
};
 
# define _REENT (__getreent())
#define _GLOBAL_REENT _global_impure_ptr
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_REENT_H_ */
/contrib/sdk/sources/newlib/include/sys/resource.h
0,0 → 1,15
#ifndef _SYS_RESOURCE_H_
#define _SYS_RESOURCE_H_
 
#include <sys/time.h>
 
#define RUSAGE_SELF 0 /* calling process */
#define RUSAGE_CHILDREN -1 /* terminated child processes */
 
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
};
 
#endif
 
/contrib/sdk/sources/newlib/include/sys/sched.h
0,0 → 1,67
/*
* Written by Joel Sherrill <joel@OARcorp.com>.
*
* COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
* OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
* SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
* $Id: sched.h,v 1.3 2010/04/01 18:33:37 jjohnstn Exp $
*/
 
 
#ifndef _SYS_SCHED_H_
#define _SYS_SCHED_H_
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* Scheduling Policies */
/* Open Group Specifications Issue 6 */
#if defined(__CYGWIN__)
#define SCHED_OTHER 3
#else
#define SCHED_OTHER 0
#endif
 
#define SCHED_FIFO 1
#define SCHED_RR 2
 
#if defined(_POSIX_SPORADIC_SERVER)
#define SCHED_SPORADIC 4
#endif
 
/* Scheduling Parameters */
/* Open Group Specifications Issue 6 */
 
struct sched_param {
int sched_priority; /* Process execution scheduling priority */
 
#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER)
int sched_ss_low_priority; /* Low scheduling priority for sporadic */
/* server */
struct timespec sched_ss_repl_period;
/* Replenishment period for sporadic server */
struct timespec sched_ss_init_budget;
/* Initial budget for sporadic server */
int sched_ss_max_repl; /* Maximum pending replenishments for */
/* sporadic server */
#endif
};
 
#ifdef __cplusplus
}
#endif
 
#endif
/* end of include file */
 
/contrib/sdk/sources/newlib/include/sys/signal.h
0,0 → 1,311
/* sys/signal.h */
 
#ifndef _SYS_SIGNAL_H
#define _SYS_SIGNAL_H
#ifdef __cplusplus
extern "C" {
#endif
 
#include "_ansi.h"
#include <sys/features.h>
#include <sys/types.h>
 
/* #ifndef __STRICT_ANSI__*/
 
typedef unsigned long sigset_t;
 
#if defined(__rtems__)
 
#if defined(_POSIX_REALTIME_SIGNALS)
 
/* sigev_notify values
NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
 
#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */
/* when the event of interest occurs. */
#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */
/* value, shall be delivered when the event of */
/* interest occurs. */
#define SIGEV_THREAD 3 /* A notification function shall be called to */
/* perform notification. */
 
/* Signal Generation and Delivery, P1003.1b-1993, p. 63
NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
sigev_notify_attributes to the sigevent structure. */
 
union sigval {
int sival_int; /* Integer signal value */
void *sival_ptr; /* Pointer signal value */
};
 
struct sigevent {
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Signal value */
 
#if defined(_POSIX_THREADS)
void (*sigev_notify_function)( union sigval );
/* Notification function */
pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */
#endif
};
 
/* Signal Actions, P1003.1b-1993, p. 64 */
/* si_code values, p. 66 */
 
#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
#define SI_QUEUE 2 /* Sent by sigqueue() */
#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
 
typedef struct {
int si_signo; /* Signal number */
int si_code; /* Cause of the signal */
union sigval si_value; /* Signal value */
} siginfo_t;
#endif
 
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
 
#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */
#define SA_SIGINFO 2 /* Invoke the signal catching function with */
/* three arguments instead of one. */
 
/* struct sigaction notes from POSIX:
*
* (1) Routines stored in sa_handler should take a single int as
* their argument although the POSIX standard does not require this.
* This is not longer true since at least POSIX.1-2008
* (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
* application should not use both simultaneously.
*/
 
typedef void (*_sig_func_ptr)(int);
 
struct sigaction {
int sa_flags; /* Special flags to affect behavior of signal */
sigset_t sa_mask; /* Additional set of signals to be blocked */
/* during execution of signal-catching */
/* function. */
union {
_sig_func_ptr _handler; /* SIG_DFL, SIG_IGN, or pointer to a function */
#if defined(_POSIX_REALTIME_SIGNALS)
void (*_sigaction)( int, siginfo_t *, void * );
#endif
} _signal_handlers;
};
 
#define sa_handler _signal_handlers._handler
#if defined(_POSIX_REALTIME_SIGNALS)
#define sa_sigaction _signal_handlers._sigaction
#endif
 
#elif defined(__CYGWIN__)
#include <cygwin/signal.h>
#else
#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
 
typedef void (*_sig_func_ptr)(int);
 
struct sigaction
{
_sig_func_ptr sa_handler;
sigset_t sa_mask;
int sa_flags;
};
#endif /* defined(__rtems__) */
 
#define SIG_SETMASK 0 /* set mask with sigprocmask() */
#define SIG_BLOCK 1 /* set of signals to block */
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
 
/* These depend upon the type of sigset_t, which right now
is always a long.. They're in the POSIX namespace, but
are not ANSI. */
#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
#define sigemptyset(what) (*(what) = 0, 0)
#define sigfillset(what) (*(what) = ~(0), 0)
#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
 
int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
 
#if defined(_POSIX_THREADS)
int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
#endif
 
/* protos for functions found in winsup sources for CYGWIN */
#if defined(__CYGWIN__) || defined(__rtems__)
#undef sigaddset
#undef sigdelset
#undef sigemptyset
#undef sigfillset
#undef sigismember
 
int _EXFUN(kill, (pid_t, int));
int _EXFUN(killpg, (pid_t, int));
int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
int _EXFUN(sigaddset, (sigset_t *, const int));
int _EXFUN(sigdelset, (sigset_t *, const int));
int _EXFUN(sigismember, (const sigset_t *, int));
int _EXFUN(sigfillset, (sigset_t *));
int _EXFUN(sigemptyset, (sigset_t *));
int _EXFUN(sigpending, (sigset_t *));
int _EXFUN(sigsuspend, (const sigset_t *));
int _EXFUN(sigpause, (int));
 
#if defined(_POSIX_THREADS)
#ifdef __CYGWIN__
# ifndef _CYGWIN_TYPES_H
# error You need the winsup sources or a cygwin installation to compile the cygwin version of newlib.
# endif
#endif
int _EXFUN(pthread_kill, (pthread_t thread, int sig));
#endif
 
#if defined(_POSIX_REALTIME_SIGNALS)
 
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
 
int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
int _EXFUN(sigtimedwait,
(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
);
int _EXFUN(sigwait, (const sigset_t *set, int *sig));
 
/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
 
#endif /* defined(_POSIX_REALTIME_SIGNALS) */
 
#endif /* defined(__CYGWIN__) || defined(__rtems__) */
 
/* #endif __STRICT_ANSI__ */
 
#if defined(___AM29K__)
/* These all need to be defined for ANSI C, but I don't think they are
meaningful. */
#define SIGABRT 1
#define SIGFPE 1
#define SIGILL 1
#define SIGINT 1
#define SIGSEGV 1
#define SIGTERM 1
/* These need to be defined for POSIX, and some others do too. */
#define SIGHUP 1
#define SIGQUIT 1
#define NSIG 2
#elif defined(__GO32__)
#define SIGINT 1
#define SIGKILL 2
#define SIGPIPE 3
#define SIGFPE 4
#define SIGHUP 5
#define SIGTERM 6
#define SIGSEGV 7
#define SIGTSTP 8
#define SIGQUIT 9
#define SIGTRAP 10
#define SIGILL 11
#define SIGEMT 12
#define SIGALRM 13
#define SIGBUS 14
#define SIGLOST 15
#define SIGSTOP 16
#define SIGABRT 17
#define SIGUSR1 18
#define SIGUSR2 19
#define NSIG 20
#elif !defined(SIGTRAP)
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
 
#if defined(__rtems__)
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGCLD 20 /* System V name for SIGCHLD */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGIO 23 /* input/output possible signal */
#define SIGPOLL SIGIO /* System V name for SIGIO */
#define SIGWINCH 24 /* window changed */
#define SIGUSR1 25 /* user defined signal 1 */
#define SIGUSR2 26 /* user defined signal 2 */
 
/* Real-Time Signals Range, P1003.1b-1993, p. 61
NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX
(which is a minimum of 8) signals.
*/
#define SIGRTMIN 27
#define SIGRTMAX 31
#define __SIGFIRSTNOTRT SIGHUP
#define __SIGLASTNOTRT SIGUSR2
 
#define NSIG 32 /* signal 0 implied */
 
#elif defined(__svr4__)
/* svr4 specifics. different signals above 15, and sigaction. */
#define SIGUSR1 16
#define SIGUSR2 17
#define SIGCLD 18
#define SIGPWR 19
#define SIGWINCH 20
#define SIGPOLL 22 /* 20 for x.out binaries!!!! */
#define SIGSTOP 23 /* sendable stop signal not from tty */
#define SIGTSTP 24 /* stop signal from tty */
#define SIGCONT 25 /* continue a stopped process */
#define SIGTTIN 26 /* to readers pgrp upon background tty read */
#define SIGTTOU 27 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define NSIG 28
#else
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGCLD 20 /* System V name for SIGCHLD */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGIO 23 /* input/output possible signal */
#define SIGPOLL SIGIO /* System V name for SIGIO */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window changed */
#define SIGLOST 29 /* resource lost (eg, record-lock lost) */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define NSIG 32 /* signal 0 implied */
#endif
#endif
 
#ifdef __cplusplus
}
#endif
 
#ifndef _SIGNAL_H_
/* Some applications take advantage of the fact that <sys/signal.h>
* and <signal.h> are equivalent in glibc. Allow for that here. */
#include <signal.h>
#endif
#endif /* _SYS_SIGNAL_H */
/contrib/sdk/sources/newlib/include/sys/stat.h
0,0 → 1,183
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <_ansi.h>
#include <time.h>
#include <sys/types.h>
 
/* dj's stat defines _STAT_H_ */
#ifndef _STAT_H_
 
/* It is intended that the layout of this structure not change when the
sizes of any of the basic types change (short, int, long) [via a compile
time option]. */
 
#ifdef __CYGWIN__
#include <cygwin/stat.h>
#ifdef _COMPILING_NEWLIB
#define stat64 __stat64
#endif
#else
struct stat
{
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
#if defined(__rtems__)
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
blksize_t st_blksize;
blkcnt_t st_blocks;
#else
/* SysV/sco doesn't have the rest... But Solaris, eabi does. */
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
#else
time_t st_atime;
long st_spare1;
time_t st_mtime;
long st_spare2;
time_t st_ctime;
long st_spare3;
long st_blksize;
long st_blocks;
long st_spare4[2];
#endif
#endif
};
 
#if defined(__rtems__)
#define st_atime st_atim.tv_sec
#define st_ctime st_ctim.tv_sec
#define st_mtime st_mtim.tv_sec
#endif
 
#endif
 
#define _IFMT 0170000 /* type of file */
#define _IFDIR 0040000 /* directory */
#define _IFCHR 0020000 /* character special */
#define _IFBLK 0060000 /* block special */
#define _IFREG 0100000 /* regular */
#define _IFLNK 0120000 /* symbolic link */
#define _IFSOCK 0140000 /* socket */
#define _IFIFO 0010000 /* fifo */
 
#define S_BLKSIZE 1024 /* size of a block */
 
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
#define S_ISVTX 0001000 /* save swapped text even after use */
#ifndef _POSIX_SOURCE
#define S_IREAD 0000400 /* read permission, owner */
#define S_IWRITE 0000200 /* write permission, owner */
#define S_IEXEC 0000100 /* execute/search permission, owner */
#define S_ENFMT 0002000 /* enforcement-mode locking */
#endif /* !_POSIX_SOURCE */
 
#define S_IFMT _IFMT
#define S_IFDIR _IFDIR
#define S_IFCHR _IFCHR
#define S_IFBLK _IFBLK
#define S_IFREG _IFREG
#define S_IFLNK _IFLNK
#define S_IFSOCK _IFSOCK
#define S_IFIFO _IFIFO
 
#ifdef _WIN32
/* The Windows header files define _S_ forms of these, so we do too
for easier portability. */
#define _S_IFMT _IFMT
#define _S_IFDIR _IFDIR
#define _S_IFCHR _IFCHR
#define _S_IFIFO _IFIFO
#define _S_IFREG _IFREG
#define _S_IREAD 0000400
#define _S_IWRITE 0000200
#define _S_IEXEC 0000100
#endif
 
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#define S_IRUSR 0000400 /* read permission, owner */
#define S_IWUSR 0000200 /* write permission, owner */
#define S_IXUSR 0000100/* execute/search permission, owner */
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#define S_IRGRP 0000040 /* read permission, group */
#define S_IWGRP 0000020 /* write permission, grougroup */
#define S_IXGRP 0000010/* execute/search permission, group */
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#define S_IROTH 0000004 /* read permission, other */
#define S_IWOTH 0000002 /* write permission, other */
#define S_IXOTH 0000001/* execute/search permission, other */
 
#ifndef _POSIX_SOURCE
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
#define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */
#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */
#endif
 
#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
 
#if defined(__CYGWIN__)
/* Special tv_nsec values for futimens(2) and utimensat(2). */
#define UTIME_NOW -2L
#define UTIME_OMIT -1L
#endif
 
int _EXFUN(chmod,( const char *__path, mode_t __mode ));
int _EXFUN(fchmod,(int __fd, mode_t __mode));
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 ));
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(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(mkdirat, (int, const char *, mode_t));
int _EXFUN(mkfifoat, (int, const char *, mode_t));
int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
int _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
int _EXFUN(futimens, (int, const struct timespec *));
#endif
 
/* Provide prototypes for most of the _<systemcall> names that are
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 ));
#ifdef __LARGE64_FILES
struct stat64;
int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
#endif
#endif
 
#endif /* !_STAT_H_ */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_STAT_H */
/contrib/sdk/sources/newlib/include/sys/stdio.h
0,0 → 1,27
#ifndef _NEWLIB_STDIO_H
#define _NEWLIB_STDIO_H
 
#include <sys/lock.h>
#include <sys/reent.h>
 
/* Internal locking macros, used to protect stdio functions. In the
general case, expand to nothing. Use __SSTR flag in FILE _flags to
detect if FILE is private to sprintf/sscanf class of functions; if
set then do nothing as lock is not initialised. */
#if !defined(_flockfile)
//#ifndef __SINGLE_THREAD__
//# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
//#else
# define _flockfile(fp) (_CAST_VOID 0)
//#endif
#endif
 
#if !defined(_funlockfile)
#ifndef __SINGLE_THREAD__
# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
#else
# define _funlockfile(fp) (_CAST_VOID 0)
#endif
#endif
 
#endif /* _NEWLIB_STDIO_H */
/contrib/sdk/sources/newlib/include/sys/string.h
0,0 → 1,2
/* This is a dummy <sys/string.h> used as a placeholder for
systems that need to have a special header file. */
/contrib/sdk/sources/newlib/include/sys/syslimits.h
0,0 → 1,65
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)syslimits.h 8.1 (Berkeley) 6/2/93
* $FreeBSD: src/sys/sys/syslimits.h,v 1.10 2001/06/18 20:24:54 wollman Exp $
*/
 
#ifndef _SYS_SYSLIMITS_H_
#define _SYS_SYSLIMITS_H_
 
#define ARG_MAX 65536 /* max bytes for an exec function */
#ifndef CHILD_MAX
#define CHILD_MAX 40 /* max simultaneous processes */
#endif
#define LINK_MAX 32767 /* max file link count */
#define MAX_CANON 255 /* max bytes in term canon input line */
#define MAX_INPUT 255 /* max bytes in terminal input */
#define NAME_MAX 255 /* max bytes in a file name */
#define NGROUPS_MAX 16 /* max supplemental group id's */
#ifndef OPEN_MAX
#define OPEN_MAX 64 /* max open files per process */
#endif
#define PATH_MAX 1024 /* max bytes in pathname */
#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
#define IOV_MAX 1024 /* max elements in i/o vector */
 
#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
#define BC_SCALE_MAX 99 /* max scale value in bc(1) */
#define BC_STRING_MAX 1000 /* max const string length in bc(1) */
#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */
#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
#define LINE_MAX 2048 /* max bytes in an input line */
#define RE_DUP_MAX 255 /* max RE's in interval notation */
 
#endif
/contrib/sdk/sources/newlib/include/sys/time.h
0,0 → 1,84
/* time.h -- An implementation of the standard Unix <sys/time.h> file.
Written by Geoffrey Noer <noer@cygnus.com>
Public domain; no rights reserved. */
 
#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
 
#include <_ansi.h>
#include <sys/types.h>
 
#ifdef __cplusplus
extern "C" {
#endif
 
#ifndef _WINSOCK_H
#define _TIMEVAL_DEFINED
struct timeval {
time_t tv_sec;
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__)
 
/* Convenience macros for operations on timevals.
NOTE: `timercmp' does not work for >= or <=. */
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define timercmp(a, b, CMP) \
(((a)->tv_sec == (b)->tv_sec) ? \
((a)->tv_usec CMP (b)->tv_usec) : \
((a)->tv_sec CMP (b)->tv_sec))
#define timeradd(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
if ((result)->tv_usec >= 1000000) \
{ \
++(result)->tv_sec; \
(result)->tv_usec -= 1000000; \
} \
} while (0)
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif /* defined (__rtems__) || defined (__CYGWIN__) */
 
int _EXFUN(gettimeofday, (struct timeval *__p, void *__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));
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_TIME_H_ */
/contrib/sdk/sources/newlib/include/sys/timeb.h
0,0 → 1,39
/* timeb.h -- An implementation of the standard Unix <sys/timeb.h> file.
Written by Ian Lance Taylor <ian@cygnus.com>
Public domain; no rights reserved.
 
<sys/timeb.h> declares the structure used by the ftime function, as
well as the ftime function itself. Newlib does not provide an
implementation of ftime. */
 
#ifndef _SYS_TIMEB_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
#define _SYS_TIMEB_H
 
#include <_ansi.h>
#include <machine/types.h>
 
#ifndef __time_t_defined
typedef _TIME_T_ time_t;
#define __time_t_defined
#endif
 
struct timeb
{
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
 
extern int ftime _PARAMS ((struct timeb *));
 
#ifdef __cplusplus
}
#endif
 
#endif /* ! defined (_SYS_TIMEB_H) */
/contrib/sdk/sources/newlib/include/sys/times.h
0,0 → 1,28
#ifndef _SYS_TIMES_H
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_TIMES_H
 
#include <_ansi.h>
#include <machine/types.h>
 
#ifndef __clock_t_defined
typedef _CLOCK_T_ clock_t;
#define __clock_t_defined
#endif
 
/* Get Process Times, P1003.1b-1993, p. 92 */
struct tms {
clock_t tms_utime; /* user time */
clock_t tms_stime; /* system time */
clock_t tms_cutime; /* user time, children */
clock_t tms_cstime; /* system time, children */
};
 
clock_t _EXFUN(times,(struct tms *));
 
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_TIMES_H */
/contrib/sdk/sources/newlib/include/sys/types.h
0,0 → 1,488
/* unified sys/types.h:
start with sef's sysvi386 version.
merge go32 version -- a few ifdefs.
h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
 
typedef int gid_t;
typedef int uid_t;
typedef int dev_t;
typedef int ino_t;
typedef int mode_t;
typedef int caddr_t;
 
however, these aren't "reasonable" values, the sysvi386 ones make far
more sense, and should work sufficiently well (in particular, h8300
doesn't have a stat, and the necv70 doesn't matter.) -- eichin
*/
 
#ifndef _SYS_TYPES_H
 
#include <_ansi.h>
 
#ifndef __INTTYPES_DEFINED__
#define __INTTYPES_DEFINED__
 
#include <machine/_types.h>
 
#if defined(__rtems__) || defined(__XMK__)
/*
* The following section is RTEMS specific and is needed to more
* closely match the types defined in the BSD sys/types.h.
* This is needed to let the RTEMS/BSD TCP/IP stack compile.
*/
 
/* deprecated */
#if ___int8_t_defined
typedef __uint8_t u_int8_t;
#endif
#if ___int16_t_defined
typedef __uint16_t u_int16_t;
#endif
#if ___int32_t_defined
typedef __uint32_t u_int32_t;
#endif
 
#if ___int64_t_defined
typedef __uint64_t u_int64_t;
 
/* deprecated */
typedef __uint64_t u_quad_t;
typedef __int64_t quad_t;
typedef quad_t * qaddr_t;
#endif
 
#endif
 
#endif /* ! __INTTYPES_DEFINED */
 
#ifndef __need_inttypes
 
#define _SYS_TYPES_H
#include <sys/_types.h>
 
#ifdef __i386__
#if defined (GO32) || defined (__MSDOS__)
#define __MS_types__
#endif
#endif
 
# include <stddef.h>
# include <machine/types.h>
 
/* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
changes, we assume sizeof short and long never change and have all types
used to define struct stat use them and not int where possible.
Where not possible, _ST_INTxx are used. It would be preferable to not have
such assumptions, but until the extra fluff is necessary, it's avoided.
No 64 bit targets use stat yet. What to do about them is postponed
until necessary. */
#ifdef __GNUC__
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
#else
#define _ST_INT32
#endif
 
# ifndef _POSIX_SOURCE
 
# define physadr physadr_t
# define quad quad_t
 
#ifndef _BSDTYPES_DEFINED
/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#define _BSDTYPES_DEFINED
#endif
 
typedef unsigned short ushort; /* System V compatibility */
typedef unsigned int uint; /* System V compatibility */
typedef unsigned long ulong; /* System V compatibility */
# endif /*!_POSIX_SOURCE */
 
#ifndef __clock_t_defined
typedef _CLOCK_T_ clock_t;
#define __clock_t_defined
#endif
 
#ifndef __time_t_defined
typedef _TIME_T_ time_t;
#define __time_t_defined
 
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
 
struct timespec {
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
 
struct itimerspec {
struct timespec it_interval; /* Timer period */
struct timespec it_value; /* Timer expiration */
};
#endif
 
typedef long daddr_t;
typedef char * caddr_t;
 
#ifndef __CYGWIN__
#if defined(__MS_types__) || defined(__rtems__) || \
defined(__sparc__) || defined(__SPU__)
typedef unsigned long ino_t;
#else
typedef unsigned short ino_t;
#endif
#endif /*__CYGWIN__*/
 
#ifdef __MS_types__
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
 
#define __BIT_TYPES_DEFINED__
 
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
typedef int32_t register_t;
#endif /* __MS_types__ */
 
/*
* All these should be machine specific - right now they are all broken.
* However, for all of Cygnus' embedded targets, we want them to all be
* the same. Otherwise things like sizeof (struct stat) might depend on
* how the file was compiled (e.g. -mint16 vs -mint32, etc.).
*/
 
#ifndef __CYGWIN__ /* which defines these types in it's own types.h. */
typedef _off_t off_t;
typedef __dev_t dev_t;
typedef __uid_t uid_t;
typedef __gid_t gid_t;
#endif
 
#if defined(__XMK__)
typedef signed char pid_t;
#else
typedef int pid_t;
#endif
 
#if defined(__rtems__)
typedef _mode_t mode_t;
#endif
 
#ifndef __CYGWIN__
typedef long key_t;
#endif
typedef _ssize_t ssize_t;
 
#if !defined(__CYGWIN__) && !defined(__rtems__)
#ifdef __MS_types__
typedef char * addr_t;
typedef int mode_t;
#else
#if defined (__sparc__) && !defined (__sparc_v9__)
#ifdef __svr4__
typedef unsigned long mode_t;
#else
typedef unsigned short mode_t;
#endif
#else
typedef unsigned int mode_t _ST_INT32;
#endif
#endif /* ! __MS_types__ */
#endif /*__CYGWIN__*/
 
typedef unsigned short nlink_t;
 
/* We don't define fd_set and friends if we are compiling POSIX
source, or if we have included (or may include as indicated
by __USE_W32_SOCKETS) the W32api winsock[2].h header which
defines Windows versions of them. Note that a program which
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))
# define _SYS_TYPES_FD_SET
# define NBBY 8 /* number of bits in a byte */
/*
* Select uses bit masks of file descriptors in longs.
* These macros manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here
* should be >= NOFILE (param.h).
*/
# ifndef FD_SETSIZE
# define FD_SETSIZE 64
# endif
 
typedef long fd_mask;
# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
# ifndef howmany
# define howmany(x,y) (((x)+((y)-1))/(y))
# endif
 
/* We use a macro for fd_set so that including Sockets.h afterwards
can work. */
typedef struct _types_fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} _types_fd_set;
 
#define fd_set _types_fd_set
 
# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
# define FD_ZERO(p) (__extension__ (void)({ \
size_t __i; \
char *__tmp = (char *)p; \
for (__i = 0; __i < sizeof (*(p)); ++__i) \
*__tmp++ = 0; \
}))
 
# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */
 
#undef __MS_types__
#undef _ST_INT32
 
 
#ifndef __clockid_t_defined
typedef _CLOCKID_T_ clockid_t;
#define __clockid_t_defined
#endif
 
#ifndef __timer_t_defined
typedef _TIMER_T_ timer_t;
#define __timer_t_defined
#endif
 
typedef unsigned long useconds_t;
typedef long suseconds_t;
 
#include <sys/features.h>
 
 
/* Cygwin will probably never have full posix compliance due to little things
* like an inability to set the stackaddress. Cygwin is also using void *
* pointers rather than structs to ensure maximum binary compatability with
* previous releases.
* This means that we don't use the types defined here, but rather in
* <cygwin/types.h>
*/
#if defined(_POSIX_THREADS) && !defined(__CYGWIN__)
 
#include <sys/sched.h>
 
/*
* 2.5 Primitive System Data Types, P1003.1c/D10, p. 19.
*/
 
#if defined(__XMK__)
typedef unsigned int pthread_t; /* identify a thread */
#else
typedef __uint32_t pthread_t; /* identify a thread */
#endif
 
/* P1003.1c/D10, p. 118-119 */
#define PTHREAD_SCOPE_PROCESS 0
#define PTHREAD_SCOPE_SYSTEM 1
 
/* P1003.1c/D10, p. 111 */
#define PTHREAD_INHERIT_SCHED 1 /* scheduling policy and associated */
/* attributes are inherited from */
/* the calling thread. */
#define PTHREAD_EXPLICIT_SCHED 2 /* set from provided attribute object */
 
/* P1003.1c/D10, p. 141 */
#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). */
 
/* 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;
struct sched_param schedparam;
int detachstate;
void *stackaddr;
size_t stacksize;
} pthread_attr_t;
 
#define PTHREAD_STACK_MIN 200
 
#else /* !defined(__XMK__) */
typedef struct {
int is_initialized;
void *stackaddr;
int stacksize;
int contentionscope;
int inheritsched;
int schedpolicy;
struct sched_param schedparam;
#if defined(__rtems__)
size_t guardsize;
#endif
 
/* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute. */
#if defined(_POSIX_THREAD_CPUTIME)
int cputime_clock_allowed; /* see time.h */
#endif
int detachstate;
 
} pthread_attr_t;
 
#endif /* !defined(__XMK__) */
 
#if defined(_POSIX_THREAD_PROCESS_SHARED)
/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */
 
#define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
#define PTHREAD_PROCESS_SHARED 1 /* visible too all processes with access to */
/* the memory where the resource is */
/* located */
#endif
 
#if defined(_POSIX_THREAD_PRIO_PROTECT)
/* Mutexes */
 
/* Values for blocking protocol. */
 
#define PTHREAD_PRIO_NONE 0
#define PTHREAD_PRIO_INHERIT 1
#define PTHREAD_PRIO_PROTECT 2
#endif
 
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
 
/* Values for mutex type */
 
#define PTHREAD_MUTEX_NORMAL 0
#define PTHREAD_MUTEX_RECURSIVE 1
#define PTHREAD_MUTEX_ERRORCHECK 2
#define PTHREAD_MUTEX_DEFAULT 3
 
#endif
 
#if defined(__XMK__)
typedef unsigned int pthread_mutex_t; /* identify a mutex */
 
typedef struct {
int type;
} pthread_mutexattr_t;
 
#else /* !defined(__XMK__) */
typedef __uint32_t pthread_mutex_t; /* identify a mutex */
 
typedef struct {
int is_initialized;
#if defined(_POSIX_THREAD_PROCESS_SHARED)
int process_shared; /* allow mutex to be shared amongst processes */
#endif
#if defined(_POSIX_THREAD_PRIO_PROTECT)
int prio_ceiling;
int protocol;
#endif
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
int type;
#endif
int recursive;
} pthread_mutexattr_t;
#endif /* !defined(__XMK__) */
 
/* Condition Variables */
 
typedef __uint32_t pthread_cond_t; /* identify a condition variable */
 
typedef struct {
int is_initialized;
#if defined(_POSIX_THREAD_PROCESS_SHARED)
int process_shared; /* allow this to be shared amongst processes */
#endif
} pthread_condattr_t; /* a condition attribute object */
 
/* Keys */
 
typedef __uint32_t pthread_key_t; /* thread-specific data keys */
 
typedef struct {
int is_initialized; /* is this structure initialized? */
int init_executed; /* has the initialization routine been run? */
} pthread_once_t; /* dynamic package initialization */
#else
#if defined (__CYGWIN__)
#include <cygwin/types.h>
#endif
#endif /* defined(_POSIX_THREADS) */
 
/* POSIX Barrier Types */
 
#if defined(_POSIX_BARRIERS)
typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */
typedef struct {
int is_initialized; /* is this structure initialized? */
#if defined(_POSIX_THREAD_PROCESS_SHARED)
int process_shared; /* allow this to be shared amongst processes */
#endif
} pthread_barrierattr_t;
#endif /* defined(_POSIX_BARRIERS) */
 
/* POSIX Spin Lock Types */
 
#if defined(_POSIX_SPIN_LOCKS)
typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */
#endif /* defined(_POSIX_SPIN_LOCKS) */
 
/* 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 {
int is_initialized; /* is this structure initialized? */
#if defined(_POSIX_THREAD_PROCESS_SHARED)
int process_shared; /* allow this to be shared amongst processes */
#endif
} pthread_rwlockattr_t;
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
#endif /* __CYGWIN__ */
 
#endif /* !__need_inttypes */
 
#undef __need_inttypes
 
#endif /* _SYS_TYPES_H */
/contrib/sdk/sources/newlib/include/sys/unistd.h
0,0 → 1,507
#ifndef _SYS_UNISTD_H
#define _SYS_UNISTD_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <_ansi.h>
#include <sys/types.h>
#include <sys/_types.h>
#define __need_size_t
#define __need_ptrdiff_t
#include <stddef.h>
 
extern char **environ;
 
void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn)));
 
int _EXFUN(access,(const char *__path, int __amode ));
unsigned _EXFUN(alarm, (unsigned __secs ));
int _EXFUN(chdir, (const char *__path ));
int _EXFUN(chmod, (const char *__path, mode_t __mode ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group ));
#endif
#if defined(__CYGWIN__) || defined(__rtems__)
int _EXFUN(chroot, (const char *__path ));
#endif
int _EXFUN(close, (int __fildes ));
#if defined(__CYGWIN__)
size_t _EXFUN(confstr, (int __name, char *__buf, size_t __len));
#endif
char * _EXFUN(ctermid, (char *__s ));
char * _EXFUN(cuserid, (char *__s ));
#if defined(__CYGWIN__)
int _EXFUN(daemon, (int nochdir, int noclose));
#endif
int _EXFUN(dup, (int __fildes ));
int _EXFUN(dup2, (int __fildes, int __fildes2 ));
#if defined(__CYGWIN__)
int _EXFUN(dup3, (int __fildes, int __fildes2, int flags));
int _EXFUN(eaccess, (const char *__path, int __mode));
void _EXFUN(endusershell, (void));
int _EXFUN(euidaccess, (const char *__path, int __mode));
#endif
int _EXFUN(execl, (const char *__path, const char *, ... ));
int _EXFUN(execle, (const char *__path, const char *, ... ));
int _EXFUN(execlp, (const char *__file, const char *, ... ));
#if defined(__CYGWIN__)
int _EXFUN(execlpe, (const char *__file, const char *, ... ));
#endif
int _EXFUN(execv, (const char *__path, char * const __argv[] ));
int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
int _EXFUN(execvp, (const char *__file, char * const __argv[] ));
#if defined(__CYGWIN__)
int _EXFUN(execvpe, (const char *__file, char * const __argv[], char * const __envp[] ));
int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
#endif
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__SPU__)
int _EXFUN(fchdir, (int __fildes));
#endif
int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
#endif
#if defined(__CYGWIN__)
int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
int _EXFUN(fexecve, (int __fd, char * const __argv[], char * const __envp[] ));
#endif
pid_t _EXFUN(fork, (void ));
long _EXFUN(fpathconf, (int __fd, int __name ));
int _EXFUN(fsync, (int __fd));
int _EXFUN(fdatasync, (int __fd));
char * _EXFUN(getcwd, (char *__buf, size_t __size ));
#if defined(__CYGWIN__)
int _EXFUN(getdomainname ,(char *__name, size_t __len));
#endif
#if !defined(__INSIDE_CYGWIN__)
gid_t _EXFUN(getegid, (void ));
uid_t _EXFUN(geteuid, (void ));
gid_t _EXFUN(getgid, (void ));
#endif
int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
#if defined(__CYGWIN__)
long _EXFUN(gethostid, (void));
#endif
char * _EXFUN(getlogin, (void ));
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
int _EXFUN(getlogin_r, (char *name, size_t namesize) );
#endif
char * _EXFUN(getpass, (const char *__prompt));
int _EXFUN(getpagesize, (void));
#if defined(__CYGWIN__)
int _EXFUN(getpeereid, (int, uid_t *, gid_t *));
#endif
pid_t _EXFUN(getpgid, (pid_t));
pid_t _EXFUN(getpgrp, (void ));
pid_t _EXFUN(getpid, (void ));
pid_t _EXFUN(getppid, (void ));
#if defined(__CYGWIN__) || defined(__rtems__)
pid_t _EXFUN(getsid, (pid_t));
#endif
#if !defined(__INSIDE_CYGWIN__)
uid_t _EXFUN(getuid, (void ));
#endif
#ifdef __CYGWIN__
char * _EXFUN(getusershell, (void));
char * _EXFUN(getwd, (char *__buf ));
int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser));
#endif
int _EXFUN(isatty, (int __fildes ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
#endif
int _EXFUN(link, (const char *__path1, const char *__path2 ));
#if defined(__CYGWIN__)
int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
#endif
int _EXFUN(nice, (int __nice_value ));
#if !defined(__INSIDE_CYGWIN__)
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
#endif
#if defined(__SPU__) || defined(__CYGWIN__)
#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
#define F_TEST 3
int _EXFUN(lockf, (int __fd, int __cmd, off_t __len));
#endif
long _EXFUN(pathconf, (const char *__path, int __name ));
int _EXFUN(pause, (void ));
#ifdef __CYGWIN__
int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void)));
#endif
int _EXFUN(pipe, (int __fildes[2] ));
#ifdef __CYGWIN__
int _EXFUN(pipe2, (int __fildes[2], int flags));
#endif
ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset));
ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset));
_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));
#if defined(__CYGWIN__)
int _EXFUN(rresvport, (int *__alport));
int _EXFUN(revoke, (char *__path));
#endif
int _EXFUN(rmdir, (const char *__path ));
#if defined(__CYGWIN__)
int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser));
#endif
void * _EXFUN(sbrk, (ptrdiff_t __incr));
#if !defined(__INSIDE_CYGWIN__)
#if defined(__CYGWIN__) || defined(__rtems__)
int _EXFUN(setegid, (gid_t __gid ));
int _EXFUN(seteuid, (uid_t __uid ));
#endif
int _EXFUN(setgid, (gid_t __gid ));
#endif
#if defined(__CYGWIN__)
int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist ));
#endif
int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
int _EXFUN(setpgrp, (void ));
#if defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
int _EXFUN(setregid, (gid_t __rgid, gid_t __egid));
int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid));
#endif
pid_t _EXFUN(setsid, (void ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(setuid, (uid_t __uid ));
#endif
#if defined(__CYGWIN__)
void _EXFUN(setusershell, (void));
#endif
unsigned _EXFUN(sleep, (unsigned int __seconds ));
void _EXFUN(swab, (const void *, void *, ssize_t));
long _EXFUN(sysconf, (int __name ));
pid_t _EXFUN(tcgetpgrp, (int __fildes ));
int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
char * _EXFUN(ttyname, (int __fildes ));
#if defined(__CYGWIN__) || defined(__rtems__)
int _EXFUN(ttyname_r, (int, char *, size_t));
#endif
int _EXFUN(unlink, (const char *__path ));
int _EXFUN(usleep, (useconds_t __useconds));
int _EXFUN(vhangup, (void ));
_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte ));
 
#ifdef __CYGWIN__
# define __UNISTD_GETOPT__
# include <getopt.h>
# undef __UNISTD_GETOPT__
#else
extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
int getopt(int, char * const [], const char *);
extern int optreset; /* getopt(3) external variable */
#endif
 
#ifndef _POSIX_SOURCE
pid_t _EXFUN(vfork, (void ));
#endif /* _POSIX_SOURCE */
 
#ifdef _COMPILING_NEWLIB
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
int _EXFUN(_close, (int __fildes ));
pid_t _EXFUN(_fork, (void ));
pid_t _EXFUN(_getpid, (void ));
int _EXFUN(_isatty, (int __fildes ));
int _EXFUN(_link, (const char *__path1, const char *__path2 ));
_off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence ));
#ifdef __LARGE64_FILES
_off64_t _EXFUN(_lseek64, (int __filedes, _off64_t __offset, int __whence ));
#endif
_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte ));
void * _EXFUN(_sbrk, (ptrdiff_t __incr));
int _EXFUN(_unlink, (const char *__path ));
_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte ));
int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
#endif
 
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__) || defined(__SPU__)
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(ftruncate, (int __fd, off_t __length));
int _EXFUN(truncate, (const char *, off_t __length));
#endif
#endif
 
#if defined(__CYGWIN__) || defined(__rtems__)
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))
/* winsock[2].h defines as __stdcall, and with int as 2nd arg */
int _EXFUN(gethostname, (char *__name, size_t __len));
#endif
char * _EXFUN(mktemp, (char *));
#endif
 
#if defined(__CYGWIN__) || defined(__SPU__) || defined(__rtems__)
void _EXFUN(sync, (void));
#endif
 
ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen));
#if defined(__CYGWIN__)
ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__path, char *__buf, size_t __buflen));
#endif
int _EXFUN(symlink, (const char *__name1, const char *__name2));
#if defined(__CYGWIN__)
int _EXFUN(symlinkat, (const char *, int, const char *));
int _EXFUN(unlinkat, (int, const char *, int));
#endif
 
#define F_OK 0
#define R_OK 4
#define W_OK 2
#define X_OK 1
 
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
 
#include <sys/features.h>
 
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
 
/*
* sysconf values per IEEE Std 1003.1, 2008 Edition
*/
 
#define _SC_ARG_MAX 0
#define _SC_CHILD_MAX 1
#define _SC_CLK_TCK 2
#define _SC_NGROUPS_MAX 3
#define _SC_OPEN_MAX 4
#define _SC_JOB_CONTROL 5
#define _SC_SAVED_IDS 6
#define _SC_VERSION 7
#define _SC_PAGESIZE 8
#define _SC_PAGE_SIZE _SC_PAGESIZE
/* These are non-POSIX values we accidentally introduced in 2000 without
guarding them. Keeping them unguarded for backward compatibility. */
#define _SC_NPROCESSORS_CONF 9
#define _SC_NPROCESSORS_ONLN 10
#define _SC_PHYS_PAGES 11
#define _SC_AVPHYS_PAGES 12
/* End of non-POSIX values. */
#define _SC_MQ_OPEN_MAX 13
#define _SC_MQ_PRIO_MAX 14
#define _SC_RTSIG_MAX 15
#define _SC_SEM_NSEMS_MAX 16
#define _SC_SEM_VALUE_MAX 17
#define _SC_SIGQUEUE_MAX 18
#define _SC_TIMER_MAX 19
#define _SC_TZNAME_MAX 20
#define _SC_ASYNCHRONOUS_IO 21
#define _SC_FSYNC 22
#define _SC_MAPPED_FILES 23
#define _SC_MEMLOCK 24
#define _SC_MEMLOCK_RANGE 25
#define _SC_MEMORY_PROTECTION 26
#define _SC_MESSAGE_PASSING 27
#define _SC_PRIORITIZED_IO 28
#define _SC_REALTIME_SIGNALS 29
#define _SC_SEMAPHORES 30
#define _SC_SHARED_MEMORY_OBJECTS 31
#define _SC_SYNCHRONIZED_IO 32
#define _SC_TIMERS 33
#define _SC_AIO_LISTIO_MAX 34
#define _SC_AIO_MAX 35
#define _SC_AIO_PRIO_DELTA_MAX 36
#define _SC_DELAYTIMER_MAX 37
#define _SC_THREAD_KEYS_MAX 38
#define _SC_THREAD_STACK_MIN 39
#define _SC_THREAD_THREADS_MAX 40
#define _SC_TTY_NAME_MAX 41
#define _SC_THREADS 42
#define _SC_THREAD_ATTR_STACKADDR 43
#define _SC_THREAD_ATTR_STACKSIZE 44
#define _SC_THREAD_PRIORITY_SCHEDULING 45
#define _SC_THREAD_PRIO_INHERIT 46
/* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
#define _SC_THREAD_PRIO_PROTECT 47
#define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT
#define _SC_THREAD_PROCESS_SHARED 48
#define _SC_THREAD_SAFE_FUNCTIONS 49
#define _SC_GETGR_R_SIZE_MAX 50
#define _SC_GETPW_R_SIZE_MAX 51
#define _SC_LOGIN_NAME_MAX 52
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
#define _SC_ADVISORY_INFO 54
#define _SC_ATEXIT_MAX 55
#define _SC_BARRIERS 56
#define _SC_BC_BASE_MAX 57
#define _SC_BC_DIM_MAX 58
#define _SC_BC_SCALE_MAX 59
#define _SC_BC_STRING_MAX 60
#define _SC_CLOCK_SELECTION 61
#define _SC_COLL_WEIGHTS_MAX 62
#define _SC_CPUTIME 63
#define _SC_EXPR_NEST_MAX 64
#define _SC_HOST_NAME_MAX 65
#define _SC_IOV_MAX 66
#define _SC_IPV6 67
#define _SC_LINE_MAX 68
#define _SC_MONOTONIC_CLOCK 69
#define _SC_RAW_SOCKETS 70
#define _SC_READER_WRITER_LOCKS 71
#define _SC_REGEXP 72
#define _SC_RE_DUP_MAX 73
#define _SC_SHELL 74
#define _SC_SPAWN 75
#define _SC_SPIN_LOCKS 76
#define _SC_SPORADIC_SERVER 77
#define _SC_SS_REPL_MAX 78
#define _SC_SYMLOOP_MAX 79
#define _SC_THREAD_CPUTIME 80
#define _SC_THREAD_SPORADIC_SERVER 81
#define _SC_TIMEOUTS 82
#define _SC_TRACE 83
#define _SC_TRACE_EVENT_FILTER 84
#define _SC_TRACE_EVENT_NAME_MAX 85
#define _SC_TRACE_INHERIT 86
#define _SC_TRACE_LOG 87
#define _SC_TRACE_NAME_MAX 88
#define _SC_TRACE_SYS_MAX 89
#define _SC_TRACE_USER_EVENT_MAX 90
#define _SC_TYPED_MEMORY_OBJECTS 91
#define _SC_V7_ILP32_OFF32 92
#define _SC_V6_ILP32_OFF32 _SC_V7_ILP32_OFF32
#define _SC_XBS5_ILP32_OFF32 _SC_V7_ILP32_OFF32
#define _SC_V7_ILP32_OFFBIG 93
#define _SC_V6_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
#define _SC_XBS5_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
#define _SC_V7_LP64_OFF64 94
#define _SC_V6_LP64_OFF64 _SC_V7_LP64_OFF64
#define _SC_XBS5_LP64_OFF64 _SC_V7_LP64_OFF64
#define _SC_V7_LPBIG_OFFBIG 95
#define _SC_V6_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
#define _SC_XBS5_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
#define _SC_XOPEN_CRYPT 96
#define _SC_XOPEN_ENH_I18N 97
#define _SC_XOPEN_LEGACY 98
#define _SC_XOPEN_REALTIME 99
#define _SC_STREAM_MAX 100
#define _SC_PRIORITY_SCHEDULING 101
#define _SC_XOPEN_REALTIME_THREADS 102
#define _SC_XOPEN_SHM 103
#define _SC_XOPEN_STREAMS 104
#define _SC_XOPEN_UNIX 105
#define _SC_XOPEN_VERSION 106
#define _SC_2_CHAR_TERM 107
#define _SC_2_C_BIND 108
#define _SC_2_C_DEV 109
#define _SC_2_FORT_DEV 110
#define _SC_2_FORT_RUN 111
#define _SC_2_LOCALEDEF 112
#define _SC_2_PBS 113
#define _SC_2_PBS_ACCOUNTING 114
#define _SC_2_PBS_CHECKPOINT 115
#define _SC_2_PBS_LOCATE 116
#define _SC_2_PBS_MESSAGE 117
#define _SC_2_PBS_TRACK 118
#define _SC_2_SW_DEV 119
#define _SC_2_UPE 120
#define _SC_2_VERSION 121
#define _SC_THREAD_ROBUST_PRIO_INHERIT 122
#define _SC_THREAD_ROBUST_PRIO_PROTECT 123
#define _SC_XOPEN_UUCP 124
 
/*
* pathconf values per IEEE Std 1003.1, 2008 Edition
*/
 
#define _PC_LINK_MAX 0
#define _PC_MAX_CANON 1
#define _PC_MAX_INPUT 2
#define _PC_NAME_MAX 3
#define _PC_PATH_MAX 4
#define _PC_PIPE_BUF 5
#define _PC_CHOWN_RESTRICTED 6
#define _PC_NO_TRUNC 7
#define _PC_VDISABLE 8
#define _PC_ASYNC_IO 9
#define _PC_PRIO_IO 10
#define _PC_SYNC_IO 11
#define _PC_FILESIZEBITS 12
#define _PC_2_SYMLINKS 13
#define _PC_SYMLINK_MAX 14
#define _PC_ALLOC_SIZE_MIN 15
#define _PC_REC_INCR_XFER_SIZE 16
#define _PC_REC_MAX_XFER_SIZE 17
#define _PC_REC_MIN_XFER_SIZE 18
#define _PC_REC_XFER_ALIGN 19
#define _PC_TIMESTAMP_RESOLUTION 20
#ifdef __CYGWIN__
/* Ask for POSIX permission bits support. */
#define _PC_POSIX_PERMISSIONS 90
/* Ask for full POSIX permission support including uid/gid settings. */
#define _PC_POSIX_SECURITY 91
#endif
 
/*
* confstr values per IEEE Std 1003.1, 2004 Edition
*/
 
#ifdef __CYGWIN__ /* Only defined on Cygwin for now. */
#define _CS_PATH 0
#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1
#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 2
#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
#define _CS_POSIX_V7_ILP32_OFF32_LIBS 3
#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
#define _CS_XBS5_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 4
#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 5
#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 6
#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 7
#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 8
#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 9
#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 10
#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
#define _CS_POSIX_V7_LP64_OFF64_LIBS 11
#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
#define _CS_XBS5_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
#define _CS_XBS5_LP64_OFF64_LINTFLAGS 12
#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 13
#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 14
#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 15
#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 16
#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 17
#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
#define _CS_XBS5_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
#define _CS_POSIX_V7_THREADS_CFLAGS 18
#define _CS_POSIX_V7_THREADS_LDFLAGS 19
#define _CS_V7_ENV 20
#define _CS_V6_ENV _CS_V7_ENV
#endif
 
#ifndef __CYGWIN__
# define MAXPATHLEN 1024
#endif
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_UNISTD_H */
/contrib/sdk/sources/newlib/include/sys/utime.h
0,0 → 1,22
#ifndef _SYS_UTIME_H
#define _SYS_UTIME_H
 
/* This is a dummy <sys/utime.h> file, not customized for any
particular system. If there is a utime.h in libc/sys/SYSDIR/sys,
it will override this one. */
 
#ifdef __cplusplus
extern "C" {
#endif
 
struct utimbuf
{
time_t actime;
time_t modtime;
};
 
#ifdef __cplusplus
};
#endif
 
#endif /* _SYS_UTIME_H */
/contrib/sdk/sources/newlib/include/sys/wait.h
0,0 → 1,40
#ifndef _SYS_WAIT_H
#define _SYS_WAIT_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <sys/types.h>
 
#define WNOHANG 1
#define WUNTRACED 2
 
/* A status looks like:
<2 bytes info> <2 bytes code>
 
<code> == 0, child has exited, info is the exit value
<code> == 1..7e, child has exited, info is the signal number.
<code> == 7f, child has stopped, info was the signal number.
<code> == 80, there was a core dump.
*/
#define WIFEXITED(w) (((w) & 0xff) == 0)
#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
#define WEXITSTATUS(w) (((w) >> 8) & 0xff)
#define WTERMSIG(w) ((w) & 0x7f)
#define WSTOPSIG WEXITSTATUS
 
pid_t wait (int *);
pid_t waitpid (pid_t, int *, int);
 
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
pid_t _wait (int *);
 
#ifdef __cplusplus
};
#endif
 
#endif