forked from espressif/arduino-esp32
initial import
This commit is contained in:
committed by
Ivan Grokhotkov
parent
668acc2c08
commit
5f3a205955
213
tools/sdk/include/newlib/sys/_default_fcntl.h
Normal file
213
tools/sdk/include/newlib/sys/_default_fcntl.h
Normal file
@ -0,0 +1,213 @@
|
||||
|
||||
#ifndef _SYS__DEFAULT_FCNTL_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define _SYS__DEFAULT_FCNTL_H_
|
||||
#include <_ansi.h>
|
||||
#include <sys/cdefs.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
|
||||
/* For machines which care - */
|
||||
#if defined (__CYGWIN__)
|
||||
#define _FBINARY 0x10000
|
||||
#define _FTEXT 0x20000
|
||||
#define _FNOINHERIT 0x40000
|
||||
#define _FDIRECT 0x80000
|
||||
#define _FNOFOLLOW 0x100000
|
||||
#define _FDIRECTORY 0x200000
|
||||
#define _FEXECSRCH 0x400000
|
||||
|
||||
#define O_BINARY _FBINARY
|
||||
#define O_TEXT _FTEXT
|
||||
#define O_CLOEXEC _FNOINHERIT
|
||||
#define O_DIRECT _FDIRECT
|
||||
#define O_NOFOLLOW _FNOFOLLOW
|
||||
#define O_DSYNC _FSYNC
|
||||
#define O_RSYNC _FSYNC
|
||||
#define O_DIRECTORY _FDIRECTORY
|
||||
#define O_EXEC _FEXECSRCH
|
||||
#define O_SEARCH _FEXECSRCH
|
||||
#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 */
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || defined(__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
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
/* lock operations for flock(2) */
|
||||
#define LOCK_SH 0x01 /* shared file lock */
|
||||
#define LOCK_EX 0x02 /* exclusive file lock */
|
||||
#define LOCK_NB 0x04 /* don't block when locking */
|
||||
#define LOCK_UN 0x08 /* unlock file */
|
||||
#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, ...));
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || defined(__CYGWIN__)
|
||||
extern int openat _PARAMS ((int, const char *, int, ...));
|
||||
#endif
|
||||
extern int creat _PARAMS ((const char *, mode_t));
|
||||
extern int fcntl _PARAMS ((int, int, ...));
|
||||
#if __BSD_VISIBLE
|
||||
extern int flock _PARAMS ((int, int));
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <sys/time.h>
|
||||
extern int futimesat _PARAMS ((int, const char *, const struct timeval *));
|
||||
#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_ */
|
20
tools/sdk/include/newlib/sys/_intsup.h
Normal file
20
tools/sdk/include/newlib/sys/_intsup.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2005 by
|
||||
* Ralf Corsepius, Ulm/Germany. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*
|
||||
* Modified for xtensa arch & non-long int32_t, removes automatic setting of __have_long32.
|
||||
*/
|
||||
|
||||
#ifndef _SYS__INTSUP_H
|
||||
#define _SYS__INTSUP_H
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#define __STDINT_EXP(x) __##x##__
|
||||
|
||||
#define __have_longlong64 1
|
||||
|
||||
#endif /* _SYS__INTSUP_H */
|
91
tools/sdk/include/newlib/sys/_types.h
Normal file
91
tools/sdk/include/newlib/sys/_types.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* 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
|
||||
|
||||
#ifndef __dev_t_defined
|
||||
typedef short __dev_t;
|
||||
#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
|
||||
#ifdef __SIZE_TYPE__
|
||||
/* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t.
|
||||
We simply change "unsigned" to "signed" for this single definition
|
||||
to make sure ssize_t and size_t only differ by their signedness. */
|
||||
#define unsigned signed
|
||||
typedef __SIZE_TYPE__ _ssize_t;
|
||||
#undef unsigned
|
||||
#else
|
||||
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
|
||||
typedef int _ssize_t;
|
||||
#else
|
||||
typedef long _ssize_t;
|
||||
#endif
|
||||
#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 */
|
710
tools/sdk/include/newlib/sys/cdefs.h
Normal file
710
tools/sdk/include/newlib/sys/cdefs.h
Normal file
@ -0,0 +1,710 @@
|
||||
/* 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.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CDEFS_H_
|
||||
#define _SYS_CDEFS_H_
|
||||
|
||||
#include <machine/_default_types.h>
|
||||
#include <sys/features.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define __PMT(args) args
|
||||
#define __DOTS , ...
|
||||
#define __THROW
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
|
||||
#endif
|
||||
|
||||
#define __ptr_t void *
|
||||
#define __long_double_t long double
|
||||
|
||||
#define __attribute_malloc__
|
||||
#define __attribute_pure__
|
||||
#define __attribute_format_strfmon__(a,b)
|
||||
#define __flexarr [0]
|
||||
|
||||
#ifndef __BOUNDED_POINTERS__
|
||||
# define __bounded /* nothing */
|
||||
# define __unbounded /* nothing */
|
||||
# define __ptrvalue /* nothing */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Testing against Clang-specific extensions.
|
||||
*/
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension __has_feature
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
#ifndef __has_include
|
||||
#define __has_include(x) 0
|
||||
#endif
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This code has been put in place to help reduce the addition of
|
||||
* compiler specific defines in FreeBSD code. It helps to aid in
|
||||
* having a compiler-agnostic source tree.
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||
|
||||
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
|
||||
#define __GNUCLIKE_ASM 3
|
||||
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
|
||||
#else
|
||||
#define __GNUCLIKE_ASM 2
|
||||
#endif
|
||||
#define __GNUCLIKE___TYPEOF 1
|
||||
#define __GNUCLIKE___OFFSETOF 1
|
||||
#define __GNUCLIKE___SECTION 1
|
||||
|
||||
#ifndef __INTEL_COMPILER
|
||||
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
|
||||
#endif
|
||||
|
||||
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
|
||||
# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
|
||||
&& __INTEL_COMPILER < 800
|
||||
# undef __GNUCLIKE_BUILTIN_CONSTANT_P
|
||||
# endif
|
||||
|
||||
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
|
||||
# define __GNUCLIKE_BUILTIN_VARARGS 1
|
||||
# define __GNUCLIKE_BUILTIN_STDARG 1
|
||||
# define __GNUCLIKE_BUILTIN_VAALIST 1
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define __GNUC_VA_LIST_COMPATIBILITY 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compiler memory barriers, specific to gcc and clang.
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
#define __compiler_membar() __asm __volatile(" " : : : "memory")
|
||||
#endif
|
||||
|
||||
#ifndef __INTEL_COMPILER
|
||||
# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
|
||||
# define __GNUCLIKE_MATH_BUILTIN_RELOPS
|
||||
#endif
|
||||
|
||||
#define __GNUCLIKE_BUILTIN_MEMCPY 1
|
||||
|
||||
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
|
||||
#define __CC_SUPPORTS_INLINE 1
|
||||
#define __CC_SUPPORTS___INLINE 1
|
||||
#define __CC_SUPPORTS___INLINE__ 1
|
||||
|
||||
#define __CC_SUPPORTS___FUNC__ 1
|
||||
#define __CC_SUPPORTS_WARNING 1
|
||||
|
||||
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
|
||||
|
||||
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
|
||||
|
||||
#endif /* __GNUC__ || __INTEL_COMPILER */
|
||||
|
||||
/*
|
||||
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
||||
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
||||
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
|
||||
* 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.
|
||||
*/
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define __P(protos) protos /* full-blown ANSI C */
|
||||
#define __CONCAT1(x,y) x ## y
|
||||
#define __CONCAT(x,y) __CONCAT1(x,y)
|
||||
#define __STRING(x) #x /* stringify without expanding x */
|
||||
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
|
||||
|
||||
#define __const const /* define reserved names to standard */
|
||||
#define __signed signed
|
||||
#define __volatile volatile
|
||||
#if defined(__cplusplus)
|
||||
#define __inline inline /* convert to C++ keyword */
|
||||
#else
|
||||
#if !(defined(__CC_SUPPORTS___INLINE))
|
||||
#define __inline /* delete GCC keyword */
|
||||
#endif /* ! __CC_SUPPORTS___INLINE */
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#else /* !(__STDC__ || __cplusplus) */
|
||||
#define __P(protos) () /* traditional C preprocessor */
|
||||
#define __CONCAT(x,y) x/**/y
|
||||
#define __STRING(x) "x"
|
||||
|
||||
#if !defined(__CC_SUPPORTS___INLINE)
|
||||
#define __const /* delete pseudo-ANSI C keywords */
|
||||
#define __inline
|
||||
#define __signed
|
||||
#define __volatile
|
||||
/*
|
||||
* In non-ANSI C environments, new programs will want ANSI-only C keywords
|
||||
* deleted from the program and old programs will want them left alone.
|
||||
* When using a compiler other than gcc, programs using the ANSI C keywords
|
||||
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
|
||||
* When using "gcc -traditional", we assume that this is the intent; if
|
||||
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
|
||||
*/
|
||||
#ifndef NO_ANSI_KEYWORDS
|
||||
#define const /* delete ANSI C keywords */
|
||||
#define inline
|
||||
#define signed
|
||||
#define volatile
|
||||
#endif /* !NO_ANSI_KEYWORDS */
|
||||
#endif /* !__CC_SUPPORTS___INLINE */
|
||||
#endif /* !(__STDC__ || __cplusplus) */
|
||||
|
||||
/*
|
||||
* Compiler-dependent macros to help declare dead (non-returning) and
|
||||
* pure (no side effects) functions, and unused variables. They are
|
||||
* null except for versions of gcc that are known to support the features
|
||||
* properly (old versions of gcc-2 supported the dead and pure features
|
||||
* in a different (wrong) way). If we do not provide an implementation
|
||||
* for a given compiler, let the compile fail if it is told to use
|
||||
* a feature that we cannot live without.
|
||||
*/
|
||||
#ifdef lint
|
||||
#define __dead2
|
||||
#define __pure2
|
||||
#define __unused
|
||||
#define __packed
|
||||
#define __aligned(x)
|
||||
#define __section(x)
|
||||
#else
|
||||
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
|
||||
#define __dead2
|
||||
#define __pure2
|
||||
#define __unused
|
||||
#endif
|
||||
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
|
||||
#define __dead2 __attribute__((__noreturn__))
|
||||
#define __pure2 __attribute__((__const__))
|
||||
#define __unused
|
||||
/* XXX Find out what to do for __packed, __aligned and __section */
|
||||
#endif
|
||||
#if __GNUC_PREREQ__(2, 7)
|
||||
#define __dead2 __attribute__((__noreturn__))
|
||||
#define __pure2 __attribute__((__const__))
|
||||
#define __unused __attribute__((__unused__))
|
||||
#define __used __attribute__((__used__))
|
||||
#define __packed __attribute__((__packed__))
|
||||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
#define __section(x) __attribute__((__section__(x)))
|
||||
#endif
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define __dead2 __attribute__((__noreturn__))
|
||||
#define __pure2 __attribute__((__const__))
|
||||
#define __unused __attribute__((__unused__))
|
||||
#define __used __attribute__((__used__))
|
||||
#define __packed __attribute__((__packed__))
|
||||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
#define __section(x) __attribute__((__section__(x)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__GNUC_PREREQ__(2, 95)
|
||||
#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Keywords added in C11.
|
||||
*/
|
||||
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
|
||||
|
||||
#if !__has_extension(c_alignas)
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||
__has_extension(cxx_alignas)
|
||||
#define _Alignas(x) alignas(x)
|
||||
#else
|
||||
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
|
||||
#define _Alignas(x) __aligned(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Alignof(x) alignof(x)
|
||||
#else
|
||||
#define _Alignof(x) __alignof(x)
|
||||
#endif
|
||||
|
||||
#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
|
||||
/*
|
||||
* No native support for _Atomic(). Place object in structure to prevent
|
||||
* most forms of direct non-atomic access.
|
||||
*/
|
||||
#define _Atomic(T) struct { T volatile __val; }
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Noreturn [[noreturn]]
|
||||
#else
|
||||
#define _Noreturn __dead2
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus)
|
||||
/* Do nothing: _Static_assert() works as per C11 */
|
||||
#elif !__has_extension(c_static_assert)
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||
__has_extension(cxx_static_assert)
|
||||
#define _Static_assert(x, y) static_assert(x, y)
|
||||
#elif defined(__COUNTER__)
|
||||
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
|
||||
#define __Static_assert(x, y) ___Static_assert(x, y)
|
||||
#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1]
|
||||
#else
|
||||
#define _Static_assert(x, y) struct __hack
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__has_extension(c_thread_local)
|
||||
/* XXX: Change this to test against C++11 when clang in base supports it. */
|
||||
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
|
||||
__has_extension(cxx_thread_local)
|
||||
#define _Thread_local thread_local
|
||||
#else
|
||||
#define _Thread_local __thread
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
|
||||
|
||||
/*
|
||||
* Emulation of C11 _Generic(). Unlike the previously defined C11
|
||||
* keywords, it is not possible to implement this using exactly the same
|
||||
* syntax. Therefore implement something similar under the name
|
||||
* __generic(). Unlike _Generic(), this macro can only distinguish
|
||||
* between a single type, so it requires nested invocations to
|
||||
* distinguish multiple cases.
|
||||
*/
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
#define __generic(expr, t, yes, no) \
|
||||
_Generic(expr, t: yes, default: no)
|
||||
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
|
||||
#define __generic(expr, t, yes, no) \
|
||||
__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(__typeof(expr), t), yes, no)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define __malloc_like __attribute__((__malloc__))
|
||||
#define __pure __attribute__((__pure__))
|
||||
#else
|
||||
#define __malloc_like
|
||||
#define __pure
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
|
||||
#define __always_inline __attribute__((__always_inline__))
|
||||
#else
|
||||
#define __always_inline
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 1)
|
||||
#define __noinline __attribute__ ((__noinline__))
|
||||
#else
|
||||
#define __noinline
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 3)
|
||||
#define __nonnull(x) __attribute__((__nonnull__(x)))
|
||||
#else
|
||||
#define __nonnull(x)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 4)
|
||||
#define __fastcall __attribute__((__fastcall__))
|
||||
#else
|
||||
#define __fastcall
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 1)
|
||||
#define __returns_twice __attribute__((__returns_twice__))
|
||||
#else
|
||||
#define __returns_twice
|
||||
#endif
|
||||
|
||||
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
|
||||
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
|
||||
#define __func__ NULL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GCC 2.95 provides `__restrict' as an extension to C90 to support the
|
||||
* C99-specific `restrict' type qualifier. We happen to use `__restrict' as
|
||||
* a way to define the `restrict' type qualifier without disturbing older
|
||||
* software that is unaware of C99 keywords.
|
||||
*/
|
||||
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
|
||||
#define __restrict
|
||||
#else
|
||||
#define __restrict restrict
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GNU C version 2.96 adds explicit branch prediction so that
|
||||
* the CPU back-end can hint the processor and also so that
|
||||
* code blocks can be reordered such that the predicted path
|
||||
* sees a more linear flow, thus improving cache behavior, etc.
|
||||
*
|
||||
* The following two macros provide us with a way to utilize this
|
||||
* compiler feature. Use __predict_true() if you expect the expression
|
||||
* to evaluate to true, and __predict_false() if you expect the
|
||||
* expression to evaluate to false.
|
||||
*
|
||||
* A few notes about usage:
|
||||
*
|
||||
* * Generally, __predict_false() error condition checks (unless
|
||||
* you have some _strong_ reason to do otherwise, in which case
|
||||
* document it), and/or __predict_true() `no-error' condition
|
||||
* checks, assuming you want to optimize for the no-error case.
|
||||
*
|
||||
* * Other than that, if you don't know the likelihood of a test
|
||||
* succeeding from empirical or other `hard' evidence, don't
|
||||
* make predictions.
|
||||
*
|
||||
* * These are meant to be used in places that are run `a lot'.
|
||||
* It is wasteful to make predictions in code that is run
|
||||
* seldomly (e.g. at subsystem initialization time) as the
|
||||
* basic block reordering that this affects can often generate
|
||||
* larger code.
|
||||
*/
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define __predict_true(exp) __builtin_expect((exp), 1)
|
||||
#define __predict_false(exp) __builtin_expect((exp), 0)
|
||||
#else
|
||||
#define __predict_true(exp) (exp)
|
||||
#define __predict_false(exp) (exp)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 2)
|
||||
#define __hidden __attribute__((__visibility__("hidden")))
|
||||
#define __exported __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define __hidden
|
||||
#define __exported
|
||||
#endif
|
||||
|
||||
#define __offsetof(type, field) offsetof(type, field)
|
||||
#define __rangeof(type, start, end) \
|
||||
(__offsetof(type, end) - __offsetof(type, start))
|
||||
|
||||
/*
|
||||
* Given the pointer x to the member m of the struct s, return
|
||||
* a pointer to the containing structure. When using GCC, we first
|
||||
* assign pointer x to a local variable, to check that its type is
|
||||
* compatible with member m.
|
||||
*/
|
||||
#if __GNUC_PREREQ__(3, 1)
|
||||
#define __containerof(x, s, m) ({ \
|
||||
const volatile __typeof__(((s *)0)->m) *__x = (x); \
|
||||
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
|
||||
})
|
||||
#else
|
||||
#define __containerof(x, s, m) \
|
||||
__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compiler-dependent macros to declare that functions take printf-like
|
||||
* or scanf-like arguments. They are null except for versions of gcc
|
||||
* that are known to support the features properly (old versions of gcc-2
|
||||
* didn't permit keeping the keywords out of the application namespace).
|
||||
*/
|
||||
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
|
||||
#define __printflike(fmtarg, firstvararg)
|
||||
#define __scanflike(fmtarg, firstvararg)
|
||||
#define __format_arg(fmtarg)
|
||||
#define __strfmonlike(fmtarg, firstvararg)
|
||||
#define __strftimelike(fmtarg, firstvararg)
|
||||
#else
|
||||
#define __printflike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
|
||||
#define __scanflike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
|
||||
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
|
||||
#define __strfmonlike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
|
||||
#define __strftimelike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
|
||||
#endif
|
||||
|
||||
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
|
||||
#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
|
||||
defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
#define __printf0like(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
|
||||
#else
|
||||
#define __printf0like(fmtarg, firstvararg)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||
#ifndef __INTEL_COMPILER
|
||||
#define __strong_reference(sym,aliassym) \
|
||||
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
|
||||
#endif
|
||||
#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")
|
||||
#define __sym_compat(sym,impl,verid) \
|
||||
__asm__(".symver " #impl ", " #sym "@" #verid)
|
||||
#define __sym_default(sym,impl,verid) \
|
||||
__asm__(".symver " #impl ", " #sym "@@" #verid)
|
||||
#else
|
||||
#define __weak_reference(sym,alias) \
|
||||
__asm__(".weak alias"); \
|
||||
__asm__(".equ alias, sym")
|
||||
#define __warn_references(sym,msg) \
|
||||
__asm__(".section .gnu.warning.sym"); \
|
||||
__asm__(".asciz \"msg\""); \
|
||||
__asm__(".previous")
|
||||
#define __sym_compat(sym,impl,verid) \
|
||||
__asm__(".symver impl, sym@verid")
|
||||
#define __sym_default(impl,sym,verid) \
|
||||
__asm__(".symver impl, sym@@verid")
|
||||
#endif /* __STDC__ */
|
||||
#else /* !__ELF__ */
|
||||
#ifdef __STDC__
|
||||
#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__ || __INTEL_COMPILER */
|
||||
|
||||
#ifndef __FBSDID
|
||||
#define __FBSDID(s) struct __hack
|
||||
#endif
|
||||
|
||||
#ifndef __RCSID
|
||||
#define __RCSID(s) struct __hack
|
||||
#endif
|
||||
|
||||
#ifndef __RCSID_SOURCE
|
||||
#define __RCSID_SOURCE(s) struct __hack
|
||||
#endif
|
||||
|
||||
#ifndef __SCCSID
|
||||
#define __SCCSID(s) struct __hack
|
||||
#endif
|
||||
|
||||
#ifndef __COPYRIGHT
|
||||
#define __COPYRIGHT(s) struct __hack
|
||||
#endif
|
||||
|
||||
#ifndef __DECONST
|
||||
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
|
||||
#endif
|
||||
|
||||
#ifndef __DEVOLATILE
|
||||
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
|
||||
#endif
|
||||
|
||||
#ifndef __DEQUALIFY
|
||||
#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* The following definitions are an extension of the behavior originally
|
||||
* implemented in <sys/_posix.h>, but with a different level of granularity.
|
||||
* POSIX.1 requires that the macros we test be defined before any standard
|
||||
* header file is included.
|
||||
*
|
||||
* Here's a quick run-down of the versions:
|
||||
* defined(_POSIX_SOURCE) 1003.1-1988
|
||||
* _POSIX_C_SOURCE == 1 1003.1-1990
|
||||
* _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
|
||||
* _POSIX_C_SOURCE == 199309 1003.1b-1993
|
||||
* _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
|
||||
* and the omnibus ISO/IEC 9945-1: 1996
|
||||
* _POSIX_C_SOURCE == 200112 1003.1-2001
|
||||
* _POSIX_C_SOURCE == 200809 1003.1-2008
|
||||
*
|
||||
* In addition, the X/Open Portability Guide, which is now the Single UNIX
|
||||
* Specification, defines a feature-test macro which indicates the version of
|
||||
* that specification, and which subsumes _POSIX_C_SOURCE.
|
||||
*
|
||||
* Our macros begin with two underscores to avoid namespace screwage.
|
||||
*/
|
||||
|
||||
/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
|
||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
|
||||
#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
|
||||
#define _POSIX_C_SOURCE 199009
|
||||
#endif
|
||||
|
||||
/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
|
||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 199209
|
||||
#endif
|
||||
|
||||
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
|
||||
#ifdef _XOPEN_SOURCE
|
||||
#if _XOPEN_SOURCE - 0 >= 700
|
||||
#define __XSI_VISIBLE 700
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200809
|
||||
#elif _XOPEN_SOURCE - 0 >= 600
|
||||
#define __XSI_VISIBLE 600
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200112
|
||||
#elif _XOPEN_SOURCE - 0 >= 500
|
||||
#define __XSI_VISIBLE 500
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 199506
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Deal with all versions of POSIX. The ordering relative to the tests above is
|
||||
* important.
|
||||
*/
|
||||
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
|
||||
#define _POSIX_C_SOURCE 198808
|
||||
#endif
|
||||
#ifdef _POSIX_C_SOURCE
|
||||
#if _POSIX_C_SOURCE >= 200809
|
||||
#define __POSIX_VISIBLE 200809
|
||||
#define __ISO_C_VISIBLE 1999
|
||||
#elif _POSIX_C_SOURCE >= 200112
|
||||
#define __POSIX_VISIBLE 200112
|
||||
#define __ISO_C_VISIBLE 1999
|
||||
#elif _POSIX_C_SOURCE >= 199506
|
||||
#define __POSIX_VISIBLE 199506
|
||||
#define __ISO_C_VISIBLE 1990
|
||||
#elif _POSIX_C_SOURCE >= 199309
|
||||
#define __POSIX_VISIBLE 199309
|
||||
#define __ISO_C_VISIBLE 1990
|
||||
#elif _POSIX_C_SOURCE >= 199209
|
||||
#define __POSIX_VISIBLE 199209
|
||||
#define __ISO_C_VISIBLE 1990
|
||||
#elif _POSIX_C_SOURCE >= 199009
|
||||
#define __POSIX_VISIBLE 199009
|
||||
#define __ISO_C_VISIBLE 1990
|
||||
#else
|
||||
#define __POSIX_VISIBLE 198808
|
||||
#define __ISO_C_VISIBLE 0
|
||||
#endif /* _POSIX_C_SOURCE */
|
||||
#else
|
||||
/*-
|
||||
* Deal with _ANSI_SOURCE:
|
||||
* If it is defined, and no other compilation environment is explicitly
|
||||
* requested, then define our internal feature-test macros to zero. This
|
||||
* makes no difference to the preprocessor (undefined symbols in preprocessing
|
||||
* expressions are defined to have value zero), but makes it more convenient for
|
||||
* a test program to print out the values.
|
||||
*
|
||||
* If a program mistakenly defines _ANSI_SOURCE and some other macro such as
|
||||
* _POSIX_C_SOURCE, we will assume that it wants the broader compilation
|
||||
* environment (and in fact we will never get here).
|
||||
*/
|
||||
#if defined(_ANSI_SOURCE) /* Hide almost everything. */
|
||||
#define __POSIX_VISIBLE 0
|
||||
#define __XSI_VISIBLE 0
|
||||
#define __BSD_VISIBLE 0
|
||||
#define __ISO_C_VISIBLE 1990
|
||||
#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
|
||||
#define __POSIX_VISIBLE 0
|
||||
#define __XSI_VISIBLE 0
|
||||
#define __BSD_VISIBLE 0
|
||||
#define __ISO_C_VISIBLE 1999
|
||||
#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
|
||||
#define __POSIX_VISIBLE 0
|
||||
#define __XSI_VISIBLE 0
|
||||
#define __BSD_VISIBLE 0
|
||||
#define __ISO_C_VISIBLE 2011
|
||||
#elif defined(_GNU_SOURCE) /* Everything and the kitchen sink. */
|
||||
#define __POSIX_VISIBLE 200809
|
||||
#define __XSI_VISIBLE 700
|
||||
#define __BSD_VISIBLE 1
|
||||
#define __ISO_C_VISIBLE 2011
|
||||
#define __GNU_VISIBLE 1
|
||||
#else /* Default: everything except __GNU_VISIBLE. */
|
||||
#define __POSIX_VISIBLE 200809
|
||||
#define __XSI_VISIBLE 700
|
||||
#define __BSD_VISIBLE 1
|
||||
#define __ISO_C_VISIBLE 2011
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_CDEFS_H_ */
|
300
tools/sdk/include/newlib/sys/config.h
Normal file
300
tools/sdk/include/newlib/sys/config.h
Normal file
@ -0,0 +1,300 @@
|
||||
#ifndef __SYS_CONFIG_H__
|
||||
#define __SYS_CONFIG_H__
|
||||
|
||||
#include <machine/ieeefp.h> /* floating point macros */
|
||||
#include <sys/features.h> /* POSIX defs */
|
||||
|
||||
#ifdef __aarch64__
|
||||
#define MALLOC_ALIGNMENT 16
|
||||
#endif
|
||||
|
||||
/* exceptions first */
|
||||
#if defined(__H8500__) || defined(__W65__)
|
||||
#define __SMALL_BITFIELDS
|
||||
/* ??? 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
|
||||
|
||||
#if defined(__m68k__) || defined(__mc68000__)
|
||||
#define _READ_WRITE_RETURN_TYPE _ssize_t
|
||||
#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
|
||||
|
||||
#if defined __MSP430__
|
||||
#ifndef _REENT_SMALL
|
||||
#define _REENT_SMALL
|
||||
#endif
|
||||
|
||||
#define __SMALL_BITFIELDS
|
||||
|
||||
#ifdef __MSP430X_LARGE__
|
||||
#define _POINTER_INT long
|
||||
#else
|
||||
#define _POINTER_INT int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __m32c__
|
||||
#define __SMALL_BITFIELDS
|
||||
#undef INT_MAX
|
||||
#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
|
||||
|
||||
#ifdef __XTENSA__
|
||||
#include <xtensa/config/core-isa.h>
|
||||
#define MALLOC_ALIGNMENT ((XCHAL_DATA_WIDTH) < 16 ? 16 : (XCHAL_DATA_WIDTH))
|
||||
/* esp8266-specific: shrink the default fd buffer size */
|
||||
#define __BUFSIZ__ 128
|
||||
#ifndef __DYNAMIC_REENT__
|
||||
#define __DYNAMIC_REENT__
|
||||
#endif
|
||||
#ifndef _REENT_SMALL
|
||||
#define _REENT_SMALL
|
||||
#endif
|
||||
#define HAVE_GETOPT
|
||||
#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
|
||||
#define __DYNAMIC_REENT__
|
||||
#define _REENT_GLOBAL_ATEXIT
|
||||
#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
|
||||
/* Define `count' parameter of read/write routines. In POSIX, the `count'
|
||||
parameter is "size_t" but legacy newlib code has been using "int" for some
|
||||
time. If not specified, "int" is defaulted. */
|
||||
#ifndef _READ_WRITE_BUFSIZE_TYPE
|
||||
#define _READ_WRITE_BUFSIZE_TYPE int
|
||||
#endif
|
||||
|
||||
#ifndef __WCHAR_MAX__
|
||||
#if __INT_MAX__ == 32767 || defined (_WIN32)
|
||||
#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__ */
|
2
tools/sdk/include/newlib/sys/custom_file.h
Normal file
2
tools/sdk/include/newlib/sys/custom_file.h
Normal file
@ -0,0 +1,2 @@
|
||||
#error System-specific custom_file.h is missing.
|
||||
|
10
tools/sdk/include/newlib/sys/dir.h
Normal file
10
tools/sdk/include/newlib/sys/dir.h
Normal file
@ -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_*/
|
13
tools/sdk/include/newlib/sys/dirent.h
Normal file
13
tools/sdk/include/newlib/sys/dirent.h
Normal file
@ -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
|
192
tools/sdk/include/newlib/sys/errno.h
Normal file
192
tools/sdk/include/newlib/sys/errno.h
Normal file
@ -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 owner */
|
||||
#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 space */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#endif
|
||||
#define EBUSY 16 /* Device or resource 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 /* File descriptor value too large */
|
||||
#define ENOTTY 25 /* Not a character device */
|
||||
#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 /* Mathematics argument out of domain of function */
|
||||
#define ERANGE 34 /* Result too large */
|
||||
#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 */
|
||||
#define ENOLCK 46 /* No lock */
|
||||
#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 /* Not a stream */
|
||||
#define ENODATA 61 /* No data (for no delay io) */
|
||||
#define ETIME 62 /* Stream ioctl timeout */
|
||||
#define ENOSR 63 /* No stream 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 /* Virtual circuit is gone */
|
||||
#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 /* Bad 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 socket */
|
||||
#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 /* Software caused connection abort */
|
||||
#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 /* Connection aborted by network */
|
||||
#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 /* Illegal byte sequence */
|
||||
#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 */
|
4
tools/sdk/include/newlib/sys/fcntl.h
Normal file
4
tools/sdk/include/newlib/sys/fcntl.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef _SYS_FCNTL_H_
|
||||
#define _SYS_FCNTL_H_
|
||||
#include <sys/_default_fcntl.h>
|
||||
#endif
|
235
tools/sdk/include/newlib/sys/features.h
Normal file
235
tools/sdk/include/newlib/sys/features.h
Normal file
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FEATURES_H
|
||||
#define _SYS_FEATURES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Macros to determine that newlib is being used. Put in this header to
|
||||
* be similar to where glibc stores its version of these macros.
|
||||
*/
|
||||
#define __NEWLIB__ 2
|
||||
#define __NEWLIB_MINOR__ 1
|
||||
|
||||
/* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif /* __GNUC_PREREQ */
|
||||
/* Version with trailing underscores for BSD compatibility. */
|
||||
#define __GNUC_PREREQ__(ma, mi) __GNUC_PREREQ(ma, mi)
|
||||
|
||||
/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
|
||||
|
||||
#ifdef __rtems__
|
||||
#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
|
||||
#ifdef __LP64__
|
||||
#define _POSIX_V6_ILP32_OFFBIG -1
|
||||
#define _POSIX_V6_LP64_OFF64 1
|
||||
#define _POSIX_V6_LPBIG_OFFBIG 1
|
||||
#else
|
||||
#define _POSIX_V6_ILP32_OFFBIG 1
|
||||
#define _POSIX_V6_LP64_OFF64 -1
|
||||
#define _POSIX_V6_LPBIG_OFFBIG -1
|
||||
#endif
|
||||
#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32
|
||||
#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG
|
||||
#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64
|
||||
#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 */
|
33
tools/sdk/include/newlib/sys/file.h
Normal file
33
tools/sdk/include/newlib/sys/file.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* Copyright (c) 2005-2006 Tensilica Inc. 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.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 TENSILICA
|
||||
INCORPORATED 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. */
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
/* Alternate names for values for the WHENCE argument to `lseek'.
|
||||
These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */
|
||||
#ifndef L_SET
|
||||
#define L_SET 0 /* Seek from beginning of file. */
|
||||
#define L_INCR 1 /* Seek from current position. */
|
||||
#define L_XTND 2 /* Seek from end of file. */
|
||||
#endif
|
77
tools/sdk/include/newlib/sys/iconvnls.h
Normal file
77
tools/sdk/include/newlib/sys/iconvnls.h
Normal file
@ -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__ */
|
||||
|
50
tools/sdk/include/newlib/sys/lock.h
Normal file
50
tools/sdk/include/newlib/sys/lock.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef _XTENSA_LOCK_H__
|
||||
#define _XTENSA_LOCK_H__
|
||||
|
||||
/* generic lock implementation.
|
||||
|
||||
Weak linked stub _lock functions in lock.c, can be
|
||||
replaced with a lock implementation at link time.
|
||||
|
||||
*/
|
||||
|
||||
typedef int _lock_t;
|
||||
typedef _lock_t _LOCK_RECURSIVE_T;
|
||||
typedef _lock_t _LOCK_T;
|
||||
|
||||
#include <_ansi.h>
|
||||
|
||||
/* NOTE: some parts of newlib statically initialise locks via
|
||||
__LOCK_INIT, some initialise at runtime via __lock_init. So need to
|
||||
support possibility that a _lock_t is null during first call to
|
||||
_lock_acquire or _lock_try_acquire.
|
||||
|
||||
Lock functions all take a pointer to the _lock_t entry, so the
|
||||
value stored there can be manipulated.
|
||||
*/
|
||||
#define __LOCK_INIT(CLASS,NAME) CLASS _lock_t NAME = 0;
|
||||
#define __LOCK_INIT_RECURSIVE(CLASS,NAME) CLASS _lock_t NAME = 0;
|
||||
|
||||
void _lock_init(_lock_t *lock);
|
||||
void _lock_init_recursive(_lock_t *lock);
|
||||
void _lock_close(_lock_t *lock);
|
||||
void _lock_close_recursive(_lock_t *lock);
|
||||
void _lock_acquire(_lock_t *lock);
|
||||
void _lock_acquire_recursive(_lock_t *lock);
|
||||
int _lock_try_acquire(_lock_t *lock);
|
||||
int _lock_try_acquire_recursive(_lock_t *lock);
|
||||
void _lock_release(_lock_t *lock);
|
||||
void _lock_release_recursive(_lock_t *lock);
|
||||
|
||||
#define __lock_init(lock) _lock_init(&(lock))
|
||||
#define __lock_init_recursive(lock) _lock_init_recursive(&(lock))
|
||||
#define __lock_close(lock) _lock_close(&(lock))
|
||||
#define __lock_close_recursive(lock) _lock_close_recursive(&(lock))
|
||||
#define __lock_acquire(lock) _lock_acquire(&(lock))
|
||||
#define __lock_acquire_recursive(lock) _lock_acquire_recursive(&(lock))
|
||||
#define __lock_try_acquire(lock) _lock_try_acquire(&(lock))
|
||||
#define __lock_try_acquire_recursive(lock) _lock_try_acquire_recursive(&(lock))
|
||||
#define __lock_release(lock) _lock_release(&(lock))
|
||||
#define __lock_release_recursive(lock) _lock_release_recursive(&(lock))
|
||||
|
||||
#endif /* _XTENSA_LOCK_H__ */
|
28
tools/sdk/include/newlib/sys/param.h
Normal file
28
tools/sdk/include/newlib/sys/param.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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 <sys/syslimits.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 MAXPATHLEN PATH_MAX
|
||||
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#endif
|
691
tools/sdk/include/newlib/sys/queue.h
Normal file
691
tools/sdk/include/newlib/sys/queue.h
Normal file
@ -0,0 +1,691 @@
|
||||
/*-
|
||||
* 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.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* 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 be traversed in either direction.
|
||||
*
|
||||
* A tail queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* 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_SAFE + + + +
|
||||
* _FOREACH_REVERSE - - - +
|
||||
* _FOREACH_REVERSE_SAFE - - - +
|
||||
* _INSERT_HEAD + + + +
|
||||
* _INSERT_BEFORE - + - +
|
||||
* _INSERT_AFTER + + + +
|
||||
* _INSERT_TAIL - - + +
|
||||
* _CONCAT - - + +
|
||||
* _REMOVE_AFTER + - + -
|
||||
* _REMOVE_HEAD + - + -
|
||||
* _REMOVE + + + +
|
||||
* _SWAP + + + +
|
||||
*
|
||||
*/
|
||||
#ifdef QUEUE_MACRO_DEBUG
|
||||
/* Store the last 2 places the queue element or head was altered */
|
||||
struct qm_trace {
|
||||
unsigned long lastline;
|
||||
unsigned long prevline;
|
||||
const char *lastfile;
|
||||
const char *prevfile;
|
||||
};
|
||||
|
||||
#define TRACEBUF struct qm_trace trace;
|
||||
#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } ,
|
||||
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
|
||||
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
|
||||
|
||||
#define QMD_TRACE_HEAD(head) do { \
|
||||
(head)->trace.prevline = (head)->trace.lastline; \
|
||||
(head)->trace.prevfile = (head)->trace.lastfile; \
|
||||
(head)->trace.lastline = __LINE__; \
|
||||
(head)->trace.lastfile = __FILE__; \
|
||||
} while (0)
|
||||
|
||||
#define QMD_TRACE_ELEM(elem) do { \
|
||||
(elem)->trace.prevline = (elem)->trace.lastline; \
|
||||
(elem)->trace.prevfile = (elem)->trace.lastfile; \
|
||||
(elem)->trace.lastline = __LINE__; \
|
||||
(elem)->trace.lastfile = __FILE__; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define QMD_TRACE_ELEM(elem)
|
||||
#define QMD_TRACE_HEAD(head)
|
||||
#define QMD_SAVELINK(name, link)
|
||||
#define TRACEBUF
|
||||
#define TRACEBUF_INITIALIZER
|
||||
#define TRASHIT(x)
|
||||
#endif /* QUEUE_MACRO_DEBUG */
|
||||
|
||||
/*
|
||||
* Singly-linked List declarations.
|
||||
*/
|
||||
#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_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != NULL; \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
#define SLIST_INIT(head) do { \
|
||||
SLIST_FIRST((head)) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#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 { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
|
||||
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_REMOVE_AFTER(curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_AFTER(elm, field) do { \
|
||||
SLIST_NEXT(elm, field) = \
|
||||
SLIST_NEXT(SLIST_NEXT(elm, field), field); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_SWAP(head1, head2, type) do { \
|
||||
struct type *swap_first = SLIST_FIRST(head1); \
|
||||
SLIST_FIRST(head1) = SLIST_FIRST(head2); \
|
||||
SLIST_FIRST(head2) = swap_first; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
#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_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = STAILQ_FIRST((head)); \
|
||||
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define STAILQ_INIT(head) do { \
|
||||
STAILQ_FIRST((head)) = NULL; \
|
||||
(head)->stqh_last = &STAILQ_FIRST((head)); \
|
||||
} 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 : \
|
||||
__containerof((head)->stqh_last, struct type, field.stqe_next))
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
#define STAILQ_REMOVE(head, elm, type, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
|
||||
if (STAILQ_FIRST((head)) == (elm)) { \
|
||||
STAILQ_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = STAILQ_FIRST((head)); \
|
||||
while (STAILQ_NEXT(curelm, field) != (elm)) \
|
||||
curelm = STAILQ_NEXT(curelm, field); \
|
||||
STAILQ_REMOVE_AFTER(head, curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
|
||||
if ((STAILQ_NEXT(elm, field) = \
|
||||
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_HEAD(head, field) do { \
|
||||
if ((STAILQ_FIRST((head)) = \
|
||||
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
|
||||
(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)
|
||||
|
||||
#define STAILQ_SWAP(head1, head2, type) do { \
|
||||
struct type *swap_first = STAILQ_FIRST(head1); \
|
||||
struct type **swap_last = (head1)->stqh_last; \
|
||||
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_FIRST(head2) = swap_first; \
|
||||
(head2)->stqh_last = swap_last; \
|
||||
if (STAILQ_EMPTY(head1)) \
|
||||
(head1)->stqh_last = &STAILQ_FIRST(head1); \
|
||||
if (STAILQ_EMPTY(head2)) \
|
||||
(head2)->stqh_last = &STAILQ_FIRST(head2); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* List declarations.
|
||||
*/
|
||||
#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.
|
||||
*/
|
||||
|
||||
#if (defined(_KERNEL) && defined(INVARIANTS))
|
||||
#define QMD_LIST_CHECK_HEAD(head, field) do { \
|
||||
if (LIST_FIRST((head)) != NULL && \
|
||||
LIST_FIRST((head))->field.le_prev != \
|
||||
&LIST_FIRST((head))) \
|
||||
panic("Bad list head %p first->prev != head", (head)); \
|
||||
} while (0)
|
||||
|
||||
#define QMD_LIST_CHECK_NEXT(elm, field) do { \
|
||||
if (LIST_NEXT((elm), field) != NULL && \
|
||||
LIST_NEXT((elm), field)->field.le_prev != \
|
||||
&((elm)->field.le_next)) \
|
||||
panic("Bad link elm %p next->prev != elm", (elm)); \
|
||||
} while (0)
|
||||
|
||||
#define QMD_LIST_CHECK_PREV(elm, field) do { \
|
||||
if (*(elm)->field.le_prev != (elm)) \
|
||||
panic("Bad link elm %p prev->next != elm", (elm)); \
|
||||
} while (0)
|
||||
#else
|
||||
#define QMD_LIST_CHECK_HEAD(head, field)
|
||||
#define QMD_LIST_CHECK_NEXT(elm, field)
|
||||
#define QMD_LIST_CHECK_PREV(elm, field)
|
||||
#endif /* (_KERNEL && INVARIANTS) */
|
||||
|
||||
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
|
||||
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for ((var) = LIST_FIRST((head)); \
|
||||
(var); \
|
||||
(var) = LIST_NEXT((var), field))
|
||||
|
||||
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = LIST_FIRST((head)); \
|
||||
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define LIST_INIT(head) do { \
|
||||
LIST_FIRST((head)) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
QMD_LIST_CHECK_NEXT(listelm, field); \
|
||||
if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
|
||||
LIST_NEXT((listelm), field)->field.le_prev = \
|
||||
&LIST_NEXT((elm), field); \
|
||||
LIST_NEXT((listelm), field) = (elm); \
|
||||
(elm)->field.le_prev = &LIST_NEXT((listelm), field); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QMD_LIST_CHECK_PREV(listelm, field); \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
LIST_NEXT((elm), field) = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &LIST_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
QMD_LIST_CHECK_HEAD((head), field); \
|
||||
if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
|
||||
LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
|
||||
LIST_FIRST((head)) = (elm); \
|
||||
(elm)->field.le_prev = &LIST_FIRST((head)); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
#define LIST_PREV(elm, head, type, field) \
|
||||
((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
|
||||
__containerof((elm)->field.le_prev, struct type, field.le_next))
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.le_next); \
|
||||
QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
|
||||
QMD_LIST_CHECK_NEXT(elm, field); \
|
||||
QMD_LIST_CHECK_PREV(elm, field); \
|
||||
if (LIST_NEXT((elm), field) != NULL) \
|
||||
LIST_NEXT((elm), field)->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = LIST_NEXT((elm), field); \
|
||||
TRASHIT(*oldnext); \
|
||||
TRASHIT(*oldprev); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_SWAP(head1, head2, type, field) do { \
|
||||
struct type *swap_tmp = LIST_FIRST((head1)); \
|
||||
LIST_FIRST((head1)) = LIST_FIRST((head2)); \
|
||||
LIST_FIRST((head2)) = swap_tmp; \
|
||||
if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
|
||||
swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
|
||||
if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
|
||||
swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Tail queue declarations.
|
||||
*/
|
||||
#define TAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *tqh_first; /* first element */ \
|
||||
struct type **tqh_last; /* addr of last next element */ \
|
||||
TRACEBUF \
|
||||
}
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
|
||||
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *tqe_next; /* next element */ \
|
||||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
TRACEBUF \
|
||||
}
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#if (defined(_KERNEL) && defined(INVARIANTS))
|
||||
#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
|
||||
if (!TAILQ_EMPTY(head) && \
|
||||
TAILQ_FIRST((head))->field.tqe_prev != \
|
||||
&TAILQ_FIRST((head))) \
|
||||
panic("Bad tailq head %p first->prev != head", (head)); \
|
||||
} while (0)
|
||||
|
||||
#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
|
||||
if (*(head)->tqh_last != NULL) \
|
||||
panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
|
||||
} while (0)
|
||||
|
||||
#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
|
||||
if (TAILQ_NEXT((elm), field) != NULL && \
|
||||
TAILQ_NEXT((elm), field)->field.tqe_prev != \
|
||||
&((elm)->field.tqe_next)) \
|
||||
panic("Bad link elm %p next->prev != elm", (elm)); \
|
||||
} while (0)
|
||||
|
||||
#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
|
||||
if (*(elm)->field.tqe_prev != (elm)) \
|
||||
panic("Bad link elm %p prev->next != elm", (elm)); \
|
||||
} while (0)
|
||||
#else
|
||||
#define QMD_TAILQ_CHECK_HEAD(head, field)
|
||||
#define QMD_TAILQ_CHECK_TAIL(head, headname)
|
||||
#define QMD_TAILQ_CHECK_NEXT(elm, field)
|
||||
#define QMD_TAILQ_CHECK_PREV(elm, field)
|
||||
#endif /* (_KERNEL && INVARIANTS) */
|
||||
|
||||
#define TAILQ_CONCAT(head1, head2, field) do { \
|
||||
if (!TAILQ_EMPTY(head2)) { \
|
||||
*(head1)->tqh_last = (head2)->tqh_first; \
|
||||
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
|
||||
(head1)->tqh_last = (head2)->tqh_last; \
|
||||
TAILQ_INIT((head2)); \
|
||||
QMD_TRACE_HEAD(head1); \
|
||||
QMD_TRACE_HEAD(head2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#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_SAFE(var, head, field, tvar) \
|
||||
for ((var) = TAILQ_FIRST((head)); \
|
||||
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = TAILQ_LAST((head), headname); \
|
||||
(var); \
|
||||
(var) = TAILQ_PREV((var), headname, field))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
|
||||
for ((var) = TAILQ_LAST((head), headname); \
|
||||
(var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define TAILQ_INIT(head) do { \
|
||||
TAILQ_FIRST((head)) = NULL; \
|
||||
(head)->tqh_last = &TAILQ_FIRST((head)); \
|
||||
QMD_TRACE_HEAD(head); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
QMD_TAILQ_CHECK_NEXT(listelm, field); \
|
||||
if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
|
||||
TAILQ_NEXT((elm), field)->field.tqe_prev = \
|
||||
&TAILQ_NEXT((elm), field); \
|
||||
else { \
|
||||
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
|
||||
QMD_TRACE_HEAD(head); \
|
||||
} \
|
||||
TAILQ_NEXT((listelm), field) = (elm); \
|
||||
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
|
||||
QMD_TRACE_ELEM(&(elm)->field); \
|
||||
QMD_TRACE_ELEM(&listelm->field); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QMD_TAILQ_CHECK_PREV(listelm, field); \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
TAILQ_NEXT((elm), field) = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
|
||||
QMD_TRACE_ELEM(&(elm)->field); \
|
||||
QMD_TRACE_ELEM(&listelm->field); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
QMD_TAILQ_CHECK_HEAD(head, field); \
|
||||
if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
|
||||
TAILQ_FIRST((head))->field.tqe_prev = \
|
||||
&TAILQ_NEXT((elm), field); \
|
||||
else \
|
||||
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
|
||||
TAILQ_FIRST((head)) = (elm); \
|
||||
(elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
|
||||
QMD_TRACE_HEAD(head); \
|
||||
QMD_TRACE_ELEM(&(elm)->field); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
QMD_TAILQ_CHECK_TAIL(head, field); \
|
||||
TAILQ_NEXT((elm), field) = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
|
||||
QMD_TRACE_HEAD(head); \
|
||||
QMD_TRACE_ELEM(&(elm)->field); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((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 { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
|
||||
QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
|
||||
QMD_TAILQ_CHECK_NEXT(elm, field); \
|
||||
QMD_TAILQ_CHECK_PREV(elm, field); \
|
||||
if ((TAILQ_NEXT((elm), field)) != NULL) \
|
||||
TAILQ_NEXT((elm), field)->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else { \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
QMD_TRACE_HEAD(head); \
|
||||
} \
|
||||
*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
|
||||
TRASHIT(*oldnext); \
|
||||
TRASHIT(*oldprev); \
|
||||
QMD_TRACE_ELEM(&(elm)->field); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_SWAP(head1, head2, type, field) do { \
|
||||
struct type *swap_first = (head1)->tqh_first; \
|
||||
struct type **swap_last = (head1)->tqh_last; \
|
||||
(head1)->tqh_first = (head2)->tqh_first; \
|
||||
(head1)->tqh_last = (head2)->tqh_last; \
|
||||
(head2)->tqh_first = swap_first; \
|
||||
(head2)->tqh_last = swap_last; \
|
||||
if ((swap_first = (head1)->tqh_first) != NULL) \
|
||||
swap_first->field.tqe_prev = &(head1)->tqh_first; \
|
||||
else \
|
||||
(head1)->tqh_last = &(head1)->tqh_first; \
|
||||
if ((swap_first = (head2)->tqh_first) != NULL) \
|
||||
swap_first->field.tqe_prev = &(head2)->tqh_first; \
|
||||
else \
|
||||
(head2)->tqh_last = &(head2)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
/*
|
||||
* 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_ */
|
793
tools/sdk/include/newlib/sys/reent.h
Normal file
793
tools/sdk/include/newlib/sys/reent.h
Normal file
@ -0,0 +1,793 @@
|
||||
/* 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 <stddef.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;
|
||||
};
|
||||
# define _ATEXIT_INIT {_NULL, 0, {_NULL}, _NULL}
|
||||
#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;
|
||||
};
|
||||
# define _ATEXIT_INIT {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}
|
||||
#endif
|
||||
|
||||
#ifdef _REENT_GLOBAL_ATEXIT
|
||||
# define _REENT_INIT_ATEXIT
|
||||
#else
|
||||
# define _REENT_INIT_ATEXIT \
|
||||
_NULL, _ATEXIT_INIT,
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Stdio buffers.
|
||||
*
|
||||
* 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 *, _READ_WRITE_BUFSIZE_TYPE));
|
||||
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
|
||||
const char *,
|
||||
_READ_WRITE_BUFSIZE_TYPE));
|
||||
_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) */
|
||||
_off_t _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 *, _READ_WRITE_BUFSIZE_TYPE));
|
||||
_READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
|
||||
const char *,
|
||||
_READ_WRITE_BUFSIZE_TYPE));
|
||||
_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 laid out 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);
|
||||
|
||||
# ifndef _REENT_GLOBAL_ATEXIT
|
||||
/* atexit stuff */
|
||||
struct _atexit *_atexit;
|
||||
struct _atexit _atexit0;
|
||||
# endif
|
||||
|
||||
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, \
|
||||
_REENT_INIT_ATEXIT \
|
||||
{_NULL, 0, _NULL}, \
|
||||
_NULL, \
|
||||
_NULL, \
|
||||
_NULL \
|
||||
}
|
||||
|
||||
#define _REENT_INIT_PTR(var) \
|
||||
{ memset((var), 0, sizeof(*(var))); \
|
||||
(var)->_stdin = (__FILE *)&__sf_fake_stdin; \
|
||||
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
|
||||
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
|
||||
(var)->_current_locale = "C"; \
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
# ifndef _REENT_GLOBAL_ATEXIT
|
||||
/* atexit stuff */
|
||||
struct _atexit *_atexit; /* points to head of LIFO stack */
|
||||
struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
|
||||
# endif
|
||||
|
||||
/* signal info */
|
||||
void (**(_sig_func))(int);
|
||||
|
||||
/* 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}} \
|
||||
} \
|
||||
}, \
|
||||
_REENT_INIT_ATEXIT \
|
||||
_NULL, \
|
||||
{_NULL, 0, _NULL} \
|
||||
}
|
||||
|
||||
#define _REENT_INIT_PTR(var) \
|
||||
{ memset((var), 0, sizeof(*(var))); \
|
||||
(var)->_stdin = &(var)->__sf[0]; \
|
||||
(var)->_stdout = &(var)->__sf[1]; \
|
||||
(var)->_stderr = &(var)->__sf[2]; \
|
||||
(var)->_current_locale = "C"; \
|
||||
(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; \
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
#if !defined(__DYNAMIC_REENT__) || defined(__SINGLE_THREAD__)
|
||||
extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
|
||||
#endif
|
||||
|
||||
extern struct _reent *_global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
|
||||
|
||||
void _reclaim_reent _PARAMS ((struct _reent *));
|
||||
|
||||
/* #define _REENT_ONLY define this to get only reentrant routines */
|
||||
|
||||
#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
|
||||
#ifndef __getreent
|
||||
struct _reent * _EXFUN(__getreent, (void));
|
||||
#endif
|
||||
# define _REENT (__getreent())
|
||||
#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
|
||||
# define _REENT _impure_ptr
|
||||
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
|
||||
|
||||
#define _GLOBAL_REENT _global_impure_ptr
|
||||
|
||||
#ifdef _REENT_GLOBAL_ATEXIT
|
||||
extern struct _atexit *_global_atexit; /* points to head of LIFO stack */
|
||||
# define _GLOBAL_ATEXIT _global_atexit
|
||||
#else
|
||||
# define _GLOBAL_ATEXIT (_GLOBAL_REENT->_atexit)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SYS_REENT_H_ */
|
17
tools/sdk/include/newlib/sys/resource.h
Normal file
17
tools/sdk/include/newlib/sys/resource.h
Normal file
@ -0,0 +1,17 @@
|
||||
#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 */
|
||||
};
|
||||
|
||||
int _EXFUN(getrusage, (int, struct rusage*));
|
||||
|
||||
#endif
|
||||
|
67
tools/sdk/include/newlib/sys/sched.h
Normal file
67
tools/sdk/include/newlib/sys/sched.h
Normal file
@ -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$
|
||||
*/
|
||||
|
||||
|
||||
#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 */
|
||||
|
357
tools/sdk/include/newlib/sys/signal.h
Normal file
357
tools/sdk/include/newlib/sys/signal.h
Normal file
@ -0,0 +1,357 @@
|
||||
/* 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__*/
|
||||
|
||||
/* Cygwin defines it's own sigset_t in include/cygwin/signal.h */
|
||||
#ifndef __CYGWIN__
|
||||
typedef unsigned long sigset_t;
|
||||
#endif
|
||||
|
||||
#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 0x1 /* Do not generate SIGCHLD when children stop */
|
||||
#define SA_SIGINFO 0x2 /* Invoke the signal catching function with */
|
||||
/* three arguments instead of one. */
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
#define SA_ONSTACK 0x4 /* Signal delivery will be on a separate stack. */
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
/*
|
||||
* Minimum and default signal stack constants. Allow for target overrides
|
||||
* from <sys/features.h>.
|
||||
*/
|
||||
#ifndef MINSIGSTKSZ
|
||||
#define MINSIGSTKSZ 2048
|
||||
#endif
|
||||
#ifndef SIGSTKSZ
|
||||
#define SIGSTKSZ 8192
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Possible values for ss_flags in stack_t below.
|
||||
*/
|
||||
#define SS_ONSTACK 0x1
|
||||
#define SS_DISABLE 0x2
|
||||
|
||||
/*
|
||||
* Structure used in sigaltstack call.
|
||||
*/
|
||||
typedef struct sigaltstack {
|
||||
void *ss_sp; /* Stack base or pointer. */
|
||||
int ss_flags; /* Flags. */
|
||||
size_t ss_size; /* Stack size. */
|
||||
} stack_t;
|
||||
#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
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
#undef sigaddset
|
||||
#undef sigdelset
|
||||
#undef sigemptyset
|
||||
#undef sigfillset
|
||||
#undef sigismember
|
||||
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_kill, (pid_t, int));
|
||||
#endif /* _COMPILING_NEWLIB */
|
||||
#endif /* __CYGWIN__ || __rtems__ */
|
||||
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__SPU__)
|
||||
int _EXFUN(kill, (pid_t, int));
|
||||
#endif /* __CYGWIN__ || __rtems__ || __SPU__ */
|
||||
#if defined(__CYGWIN__) || defined(__rtems__)
|
||||
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));
|
||||
|
||||
#ifdef __rtems__
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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<OSTOP) */
|
||||
#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<OSTOP) */
|
||||
#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<OSTOP) */
|
||||
#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 */
|
192
tools/sdk/include/newlib/sys/stat.h
Normal file
192
tools/sdk/include/newlib/sys/stat.h
Normal file
@ -0,0 +1,192 @@
|
||||
#ifndef _SYS_STAT_H
|
||||
#define _SYS_STAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <time.h>
|
||||
#include <sys/cdefs.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 stat
|
||||
#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 *__restrict __path, struct stat *__restrict __sbuf ));
|
||||
mode_t _EXFUN(umask,( mode_t __mask ));
|
||||
|
||||
#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(lstat,( const char *__restrict __path, struct stat *__restrict __buf ));
|
||||
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
|
||||
#endif
|
||||
|
||||
#if (__POSIX_VISIBLE >= 200809 || defined (__CYGWIN__)) && !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(fchmodat, (int, const char *, mode_t, int));
|
||||
#endif
|
||||
#if (__BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || defined (__CYGWIN__)) && !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(fstatat, (int, const char *__restrict , struct stat *__restrict, int));
|
||||
int _EXFUN(mkdirat, (int, const char *, mode_t));
|
||||
int _EXFUN(mkfifoat, (int, const char *, mode_t));
|
||||
#endif
|
||||
#if (__BSD_VISIBLE || __XSI_VISIBLE >= 700 || defined (__CYGWIN__)) && !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
|
||||
#endif
|
||||
#if (__BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || defined (__CYGWIN__)) && !defined(__INSIDE_CYGWIN__)
|
||||
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 *__restrict __path, struct stat *__restrict __sbuf ));
|
||||
int _EXFUN(_mkdir,( const char *_path, mode_t __mode ));
|
||||
#ifdef __LARGE64_FILES
|
||||
struct stat64;
|
||||
int _EXFUN(_stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf ));
|
||||
int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !_STAT_H_ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SYS_STAT_H */
|
27
tools/sdk/include/newlib/sys/stdio.h
Normal file
27
tools/sdk/include/newlib/sys/stdio.h
Normal file
@ -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 */
|
2
tools/sdk/include/newlib/sys/string.h
Normal file
2
tools/sdk/include/newlib/sys/string.h
Normal file
@ -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. */
|
65
tools/sdk/include/newlib/sys/syslimits.h
Normal file
65
tools/sdk/include/newlib/sys/syslimits.h
Normal file
@ -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
|
91
tools/sdk/include/newlib/sys/time.h
Normal file
91
tools/sdk/include/newlib/sys/time.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* 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 _TIMEVAL_DEFINED
|
||||
#define _TIMEVAL_DEFINED
|
||||
struct timeval {
|
||||
time_t tv_sec;
|
||||
suseconds_t tv_usec;
|
||||
};
|
||||
|
||||
/* 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__) */
|
||||
#endif /* !_TIMEVAL_DEFINED */
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <cygwin/sys_time.h>
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#define ITIMER_REAL 0
|
||||
#define ITIMER_VIRTUAL 1
|
||||
#define ITIMER_PROF 2
|
||||
|
||||
struct itimerval {
|
||||
struct timeval it_interval;
|
||||
struct timeval it_value;
|
||||
};
|
||||
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz));
|
||||
#endif
|
||||
|
||||
int _EXFUN(gettimeofday, (struct timeval *__restrict __p,
|
||||
void *__restrict __tz));
|
||||
#if __BSD_VISIBLE
|
||||
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
|
||||
int _EXFUN(adjtime, (const struct timeval *, struct timeval *));
|
||||
#endif
|
||||
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 *__restrict __value,
|
||||
struct itimerval *__restrict __ovalue));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SYS_TIME_H_ */
|
39
tools/sdk/include/newlib/sys/timeb.h
Normal file
39
tools/sdk/include/newlib/sys/timeb.h
Normal file
@ -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) */
|
31
tools/sdk/include/newlib/sys/times.h
Normal file
31
tools/sdk/include/newlib/sys/times.h
Normal file
@ -0,0 +1,31 @@
|
||||
#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 _COMPILING_NEWLIB
|
||||
clock_t _EXFUN(_times,(struct tms *));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !_SYS_TIMES_H */
|
521
tools/sdk/include/newlib/sys/types.h
Normal file
521
tools/sdk/include/newlib/sys/types.h
Normal file
@ -0,0 +1,521 @@
|
||||
/* 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 */
|
||||
#ifndef __u_char_defined
|
||||
typedef unsigned char u_char;
|
||||
#define __u_char_defined
|
||||
#endif
|
||||
#ifndef __u_short_defined
|
||||
typedef unsigned short u_short;
|
||||
#define __u_short_defined
|
||||
#endif
|
||||
#ifndef __u_int_defined
|
||||
typedef unsigned int u_int;
|
||||
#define __u_int_defined
|
||||
#endif
|
||||
#ifndef __u_long_defined
|
||||
typedef unsigned long u_long;
|
||||
#define __u_long_defined
|
||||
#endif
|
||||
#define _BSDTYPES_DEFINED
|
||||
#endif
|
||||
|
||||
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
|
||||
#endif
|
||||
|
||||
#ifndef __timespec_defined
|
||||
#define __timespec_defined
|
||||
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct itimerspec {
|
||||
struct timespec it_interval; /* Timer period */
|
||||
struct timespec it_value; /* Timer expiration */
|
||||
};
|
||||
|
||||
#ifndef __daddr_t_defined
|
||||
typedef long daddr_t;
|
||||
#define __daddr_t_defined
|
||||
#endif
|
||||
#ifndef __caddr_t_defined
|
||||
typedef char * caddr_t;
|
||||
#define __caddr_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#if defined(__MS_types__) || defined(__rtems__) || \
|
||||
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 (_WINSOCKAPI_) || 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 (_WINSOCKAPI_) || 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(__rtems__)
|
||||
#include <sys/cpuset.h>
|
||||
#endif
|
||||
|
||||
#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;
|
||||
#if defined(__rtems__)
|
||||
size_t affinitysetsize;
|
||||
cpu_set_t *affinityset;
|
||||
cpu_set_t affinitysetpreallocated;
|
||||
#endif
|
||||
} 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 */
|
||||
|
||||
/* The following defines are part of the X/Open System Interface (XSI). */
|
||||
|
||||
/*
|
||||
* This type of mutex does not detect deadlock. A thread attempting to
|
||||
* relock this mutex without first unlocking it shall deadlock. Attempting
|
||||
* to unlock a mutex locked by a different thread results in undefined
|
||||
* behavior. Attempting to unlock an unlocked mutex results in undefined
|
||||
* behavior.
|
||||
*/
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
|
||||
/*
|
||||
* A thread attempting to relock this mutex without first unlocking
|
||||
* it shall succeed in locking the mutex. The relocking deadlock which
|
||||
* can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with
|
||||
* this type of mutex. Multiple locks of this mutex shall require the
|
||||
* same number of unlocks to release the mutex before another thread can
|
||||
* acquire the mutex. A thread attempting to unlock a mutex which another
|
||||
* thread has locked shall return with an error. A thread attempting to
|
||||
* unlock an unlocked mutex shall return with an error.
|
||||
*/
|
||||
#define PTHREAD_MUTEX_RECURSIVE 1
|
||||
|
||||
/*
|
||||
* This type of mutex provides error checking. A thread attempting
|
||||
* to relock this mutex without first unlocking it shall return with an
|
||||
* error. A thread attempting to unlock a mutex which another thread has
|
||||
* locked shall return with an error. A thread attempting to unlock an
|
||||
* unlocked mutex shall return with an error.
|
||||
*/
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 2
|
||||
|
||||
/*
|
||||
* Attempting to recursively lock a mutex of this type results
|
||||
* in undefined behavior. Attempting to unlock a mutex of this type
|
||||
* which was not locked by the calling thread results in undefined
|
||||
* behavior. Attempting to unlock a mutex of this type which is not locked
|
||||
* results in undefined behavior. An implementation may map this mutex to
|
||||
* one of the other mutex types.
|
||||
*/
|
||||
#define PTHREAD_MUTEX_DEFAULT 3
|
||||
|
||||
#endif /* !defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) */
|
||||
|
||||
#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 (__CYGWIN__)
|
||||
#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(_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 */
|
516
tools/sdk/include/newlib/sys/unistd.h
Normal file
516
tools/sdk/include/newlib/sys/unistd.h
Normal file
@ -0,0 +1,516 @@
|
||||
#ifndef _SYS_UNISTD_H
|
||||
#define _SYS_UNISTD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <_ansi.h>
|
||||
#define __need_size_t
|
||||
#define __need_ptrdiff_t
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/_types.h>
|
||||
#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[] ));
|
||||
#endif
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
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 __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
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));
|
||||
#if defined(__CYGWIN__)
|
||||
char * _EXFUN(get_current_dir_name, (void));
|
||||
#endif
|
||||
char * _EXFUN(getcwd, (char *__buf, size_t __size ));
|
||||
#if defined(__CYGWIN__)
|
||||
int _EXFUN(getdomainname ,(char *__name, size_t __len));
|
||||
#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 __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || 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
|
||||
#if __BSD_VISIBLE || (defined(_XOPEN_SOURCE) && __XSI_VISIBLE < 500)
|
||||
int _EXFUN(sethostname, (const char *, size_t));
|
||||
#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 *__restrict, void *__restrict, ssize_t));
|
||||
long _EXFUN(sysconf, (int __name ));
|
||||
pid_t _EXFUN(tcgetpgrp, (int __fildes ));
|
||||
int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
|
||||
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(__aarch64__) || defined (__arm__) || defined(__sh__) || defined(__SPU__)
|
||||
#if !defined(__INSIDE_CYGWIN__)
|
||||
int _EXFUN(ftruncate, (int __fd, off_t __length));
|
||||
int _EXFUN(truncate, (const char *, off_t __length));
|
||||
#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 (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
|
||||
/* winsock[2].h defines as __stdcall, and with int as 2nd arg */
|
||||
int _EXFUN(gethostname, (char *__name, size_t __len));
|
||||
#endif
|
||||
char * _EXFUN(mktemp, (char *));
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__SPU__) || defined(__rtems__)
|
||||
void _EXFUN(sync, (void));
|
||||
#endif
|
||||
|
||||
ssize_t _EXFUN(readlink, (const char *__restrict __path,
|
||||
char *__restrict __buf, size_t __buflen));
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || defined(__CYGWIN__)
|
||||
ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__restrict __path,
|
||||
char *__restrict __buf, size_t __buflen));
|
||||
#endif
|
||||
int _EXFUN(symlink, (const char *__name1, const char *__name2));
|
||||
#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE || 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SYS_UNISTD_H */
|
22
tools/sdk/include/newlib/sys/utime.h
Normal file
22
tools/sdk/include/newlib/sys/utime.h
Normal file
@ -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 */
|
44
tools/sdk/include/newlib/sys/wait.h
Normal file
44
tools/sdk/include/newlib/sys/wait.h
Normal file
@ -0,0 +1,44 @@
|
||||
#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);
|
||||
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
pid_t _wait (int *);
|
||||
#endif
|
||||
|
||||
/* Provide prototypes for most of the _<systemcall> names that are
|
||||
provided in newlib for some compilers. */
|
||||
pid_t _wait (int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user