mirror of
https://github.com/bebbo/amiga-gcc.git
synced 2025-12-08 22:38:25 +00:00
add sys-include headers
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/* Provide support for both ANSI and non-ANSI environments. */
|
||||
|
||||
/* To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
|
||||
"comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
|
||||
files aren't affected). */
|
||||
|
||||
#ifndef _ANSIDECL_H_
|
||||
#define _ANSIDECL_H_
|
||||
|
||||
#include <newlib.h>
|
||||
#include <sys/config.h>
|
||||
|
||||
/* ISO C++. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
|
||||
#ifdef _HAVE_STD_CXX
|
||||
#define _BEGIN_STD_C namespace std { extern "C" {
|
||||
#define _END_STD_C } }
|
||||
#else
|
||||
#define _BEGIN_STD_C extern "C" {
|
||||
#define _END_STD_C }
|
||||
#endif
|
||||
#if __GNUC_PREREQ (3, 3)
|
||||
#define _NOTHROW __attribute__ ((__nothrow__))
|
||||
#else
|
||||
#define _NOTHROW throw()
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define _BEGIN_STD_C
|
||||
#define _END_STD_C
|
||||
#define _NOTHROW
|
||||
#endif
|
||||
|
||||
#ifndef _LONG_DOUBLE
|
||||
#define _LONG_DOUBLE long double
|
||||
#endif
|
||||
|
||||
/* Support gcc's __attribute__ facility. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _ATTRIBUTE(attrs) __attribute__ (attrs)
|
||||
#else
|
||||
#define _ATTRIBUTE(attrs)
|
||||
#endif
|
||||
|
||||
/* The traditional meaning of 'extern inline' for GCC is not
|
||||
to emit the function body unless the address is explicitly
|
||||
taken. However this behaviour is changing to match the C99
|
||||
standard, which uses 'extern inline' to indicate that the
|
||||
function body *must* be emitted. Likewise, a function declared
|
||||
without either 'extern' or 'static' defaults to extern linkage
|
||||
(C99 6.2.2p5), and the compiler may choose whether to use the
|
||||
inline version or call the extern linkage version (6.7.4p6).
|
||||
If we are using GCC, but do not have the new behaviour, we need
|
||||
to use extern inline; if we are using a new GCC with the
|
||||
C99-compatible behaviour, or a non-GCC compiler (which we will
|
||||
have to hope is C99, since there is no other way to achieve the
|
||||
effect of omitting the function if it isn't referenced) we use
|
||||
'static inline', which c99 defines to mean more-or-less the same
|
||||
as the Gnu C 'extern inline'. */
|
||||
#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
|
||||
/* We're using GCC, but without the new C99-compatible behaviour. */
|
||||
#define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
|
||||
#else
|
||||
/* We're using GCC in C99 mode, or an unknown compiler which
|
||||
we just have to hope obeys the C99 semantics of inline. */
|
||||
#define _ELIDABLE_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ (3, 1)
|
||||
#define _NOINLINE __attribute__ ((__noinline__))
|
||||
#define _NOINLINE_STATIC _NOINLINE static
|
||||
#else
|
||||
/* On non-GNU compilers and GCC prior to version 3.1 the compiler can't be
|
||||
trusted not to inline if it is static. */
|
||||
#define _NOINLINE
|
||||
#define _NOINLINE_STATIC
|
||||
#endif
|
||||
|
||||
#endif /* _ANSIDECL_H_ */
|
||||
@@ -0,0 +1,6 @@
|
||||
/* _newlib_version.h. libnix replacement. */
|
||||
#ifndef _NEWLIB_VERSION_H__
|
||||
#define _NEWLIB_VERSION_H__ 1
|
||||
|
||||
#endif /* !_NEWLIB_VERSION_H__ */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* internal use only -- mapping of "system calls" for libraries that lose
|
||||
and only provide C names, so that we end up in violation of ANSI */
|
||||
#ifndef __SYSLIST_H
|
||||
#define __SYSLIST_H
|
||||
|
||||
#ifdef MISSING_SYSCALL_NAMES
|
||||
#define _close close
|
||||
#define _execve execve
|
||||
#define _fcntl fcntl
|
||||
#define _fork fork
|
||||
#define _fstat fstat
|
||||
#define _getpid getpid
|
||||
#define _gettimeofday gettimeofday
|
||||
#define _isatty isatty
|
||||
#define _kill kill
|
||||
#define _link link
|
||||
#define _lseek lseek
|
||||
#define _mkdir mkdir
|
||||
#define _open open
|
||||
#define _read read
|
||||
#define _sbrk sbrk
|
||||
#define _stat stat
|
||||
#define _times times
|
||||
#define _unlink unlink
|
||||
#define _wait wait
|
||||
#define _write write
|
||||
#endif /* MISSING_SYSCALL_NAMES */
|
||||
|
||||
#if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR
|
||||
/* If the system call interface is missing opendir, readdir, and
|
||||
closedir, there is an implementation of these functions in
|
||||
libc/posix that is implemented using open, getdents, and close.
|
||||
Note, these functions are currently not in the libc/syscalls
|
||||
directory. */
|
||||
#define _opendir opendir
|
||||
#define _readdir readdir
|
||||
#define _closedir closedir
|
||||
#endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */
|
||||
|
||||
#endif /* !__SYSLIST_H_ */
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef _HEADERS_ALIGNMENT_H
|
||||
#define _HEADERS_ALIGNMENT_H
|
||||
|
||||
/* Address is neither aligned to a word or long word boundary. */
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
|
||||
/* Address is aligned to a word boundary, but not to a long
|
||||
word boundary. */
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
|
||||
/* Address is aligned to a long word boundary. For an 68030 and beyond the
|
||||
alignment does not matter. */
|
||||
#if defined(M68020) || defined(_M68020) || defined(mc68020) || defined(__mc68020)
|
||||
#define IS_LONG_ALIGNED(a) (1)
|
||||
#else
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 3) == 0)
|
||||
#endif /* M68020 */
|
||||
|
||||
#endif /* _HEADERS_ALIGNMENT_H */
|
||||
@@ -0,0 +1,21 @@
|
||||
/* libc/include/alloca.h - Allocate memory on stack */
|
||||
|
||||
/* Written 2000 by Werner Almesberger */
|
||||
/* Rearranged for general inclusion by stdlib.h.
|
||||
2001, Corinna Vinschen <vinschen@redhat.com> */
|
||||
|
||||
#ifndef _NEWLIB_ALLOCA_H
|
||||
#define _NEWLIB_ALLOCA_H
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <sys/reent.h>
|
||||
|
||||
#undef alloca
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define alloca(size) __builtin_alloca(size)
|
||||
#else
|
||||
__stdargs void * alloca (size_t);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Hugh Smith at The University of Guelph.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ar.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _AR_H_
|
||||
#define _AR_H_
|
||||
|
||||
/* Pre-4BSD archives had these magic numbers in them. */
|
||||
#define OARMAG1 0177555
|
||||
#define OARMAG2 0177545
|
||||
|
||||
#define ARMAG "!<arch>\n" /* ar "magic number" */
|
||||
#define SARMAG 8 /* strlen(ARMAG); */
|
||||
|
||||
#define AR_EFMT1 "#1/" /* extended format #1 */
|
||||
|
||||
struct ar_hdr {
|
||||
char ar_name[16]; /* name */
|
||||
char ar_date[12]; /* modification time */
|
||||
char ar_uid[6]; /* user id */
|
||||
char ar_gid[6]; /* group id */
|
||||
char ar_mode[8]; /* octal file permissions */
|
||||
char ar_size[10]; /* size in bytes */
|
||||
#define ARFMAG "`\n"
|
||||
char ar_fmag[2]; /* consistency check */
|
||||
};
|
||||
|
||||
#endif /* !_AR_H_ */
|
||||
@@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#ifndef _ARGZ_H_
|
||||
#define _ARGZ_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
|
||||
__stdargs error_t argz_create (char *const argv[], char **argz, size_t *argz_len);
|
||||
__stdargs error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len);
|
||||
__stdargs size_t argz_count (const char *argz, size_t argz_len);
|
||||
__stdargs void argz_extract (char *argz, size_t argz_len, char **argv);
|
||||
__stdargs void argz_stringify (char *argz, size_t argz_len, int sep);
|
||||
__stdargs error_t argz_add (char **argz, size_t *argz_len, const char *str);
|
||||
__stdargs error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep);
|
||||
__stdargs error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len);
|
||||
__stdargs error_t argz_delete (char **argz, size_t *argz_len, char *entry);
|
||||
__stdargs error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry);
|
||||
__stdargs char * argz_next (char *argz, size_t argz_len, const char *entry);
|
||||
__stdargs error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count);
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _ARGZ_H_ */
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
assert.h
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
#undef assert
|
||||
|
||||
#ifdef NDEBUG /* required by ANSI standard */
|
||||
# define assert(__e) ((void)0)
|
||||
#else
|
||||
# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
|
||||
__ASSERT_FUNC, #__e))
|
||||
|
||||
# ifndef __ASSERT_FUNC
|
||||
/* Use g++'s demangled names in C++. */
|
||||
# if defined __cplusplus && defined __GNUC__
|
||||
# define __ASSERT_FUNC __PRETTY_FUNCTION__
|
||||
|
||||
/* C99 requires the use of __func__. */
|
||||
# elif __STDC_VERSION__ >= 199901L
|
||||
# define __ASSERT_FUNC __func__
|
||||
|
||||
/* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
|
||||
# elif __GNUC__ >= 2
|
||||
# define __ASSERT_FUNC __FUNCTION__
|
||||
|
||||
/* failed to detect __func__ support. */
|
||||
# else
|
||||
# define __ASSERT_FUNC ((char *) 0)
|
||||
# endif
|
||||
# endif /* !__ASSERT_FUNC */
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
__stdargs void __assert (const char *, int, const char *)
|
||||
_ATTRIBUTE ((__noreturn__));
|
||||
__stdargs void __assert_func (const char *, int, const char *, const char *)
|
||||
_ATTRIBUTE ((__noreturn__));
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L && !defined __cplusplus
|
||||
# define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef _HEADERS_BASE_H
|
||||
#define _HEADERS_BASE_H
|
||||
|
||||
#if defined(__baserel32__)
|
||||
#define A4(x) "a4@(" #x ":L)"
|
||||
#elif defined (__baserel__)
|
||||
#define A4(x) "a4@(" #x ":W)"
|
||||
#else
|
||||
#define A4(x) #x
|
||||
#endif
|
||||
|
||||
#define GETAGBASE movel A4(_AmigaGuideBase),a6
|
||||
#define GETASLBASE movel A4(_AslBase),a6
|
||||
#define GETBULBASE movel A4(_BulletBase),a6
|
||||
#define GETDOSBASE movel A4(_DOSBase),a6
|
||||
#define GETDTBASE movel A4(_DataTypesBase),a6
|
||||
#define GETGADBASE movel A4(_GadToolsBase),a6
|
||||
#define GETGFXBASE movel A4(_GfxBase),a6
|
||||
#define GETINTBASE movel A4(_IntuitionBase),a6
|
||||
#define GETLOCBASE movel A4(_LocaleBase),a6
|
||||
#define GETLOWBASE movel A4(_LowLevelBase),a6
|
||||
#define GETRETBASE movel A4(_RealTimeBase),a6
|
||||
#define GETUTLBASE movel A4(_UtilityBase),a6
|
||||
#define GETWBBASE movel A4(_WorkbenchBase),a6
|
||||
|
||||
#endif /* _HEADERS_BASE_H */
|
||||
@@ -0,0 +1,153 @@
|
||||
/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Matthias Drochner.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#ifndef _COMPLEX_H
|
||||
#define _COMPLEX_H
|
||||
|
||||
#define complex _Complex
|
||||
#define _Complex_I 1.0fi
|
||||
#define I _Complex_I
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* 7.3.5 Trigonometric functions */
|
||||
/* 7.3.5.1 The cacos functions */
|
||||
__stdargs double complex cacos(double complex);
|
||||
__stdargs float complex cacosf(float complex);
|
||||
|
||||
/* 7.3.5.2 The casin functions */
|
||||
__stdargs double complex casin(double complex);
|
||||
__stdargs float complex casinf(float complex);
|
||||
__stdargs long double complex casinl(long double complex);
|
||||
|
||||
/* 7.3.5.1 The catan functions */
|
||||
__stdargs double complex catan(double complex);
|
||||
__stdargs float complex catanf(float complex);
|
||||
__stdargs long double complex catanl(long double complex);
|
||||
|
||||
/* 7.3.5.1 The ccos functions */
|
||||
__stdargs double complex ccos(double complex);
|
||||
__stdargs float complex ccosf(float complex);
|
||||
|
||||
/* 7.3.5.1 The csin functions */
|
||||
__stdargs double complex csin(double complex);
|
||||
__stdargs float complex csinf(float complex);
|
||||
|
||||
/* 7.3.5.1 The ctan functions */
|
||||
__stdargs double complex ctan(double complex);
|
||||
__stdargs float complex ctanf(float complex);
|
||||
|
||||
/* 7.3.6 Hyperbolic functions */
|
||||
/* 7.3.6.1 The cacosh functions */
|
||||
__stdargs double complex cacosh(double complex);
|
||||
__stdargs float complex cacoshf(float complex);
|
||||
|
||||
/* 7.3.6.2 The casinh functions */
|
||||
__stdargs double complex casinh(double complex);
|
||||
__stdargs float complex casinhf(float complex);
|
||||
|
||||
/* 7.3.6.3 The catanh functions */
|
||||
__stdargs double complex catanh(double complex);
|
||||
__stdargs float complex catanhf(float complex);
|
||||
|
||||
/* 7.3.6.4 The ccosh functions */
|
||||
__stdargs double complex ccosh(double complex);
|
||||
__stdargs float complex ccoshf(float complex);
|
||||
|
||||
/* 7.3.6.5 The csinh functions */
|
||||
__stdargs double complex csinh(double complex);
|
||||
__stdargs float complex csinhf(float complex);
|
||||
|
||||
/* 7.3.6.6 The ctanh functions */
|
||||
__stdargs double complex ctanh(double complex);
|
||||
__stdargs float complex ctanhf(float complex);
|
||||
|
||||
/* 7.3.7 Exponential and logarithmic functions */
|
||||
/* 7.3.7.1 The cexp functions */
|
||||
__stdargs double complex cexp(double complex);
|
||||
__stdargs float complex cexpf(float complex);
|
||||
|
||||
/* 7.3.7.2 The clog functions */
|
||||
__stdargs double complex clog(double complex);
|
||||
__stdargs float complex clogf(float complex);
|
||||
__stdargs long double complex clogl(long double complex);
|
||||
|
||||
/* 7.3.8 Power and absolute-value functions */
|
||||
/* 7.3.8.1 The cabs functions */
|
||||
/*#ifndef __LIBM0_SOURCE__ */
|
||||
/* avoid conflict with historical cabs(struct complex) */
|
||||
/* double cabs(double complex) __RENAME(__c99_cabs);
|
||||
__stdargs float cabsf(float complex) __RENAME(__c99_cabsf);
|
||||
#endif
|
||||
*/
|
||||
__stdargs long double cabsl(long double complex) ;
|
||||
__stdargs double cabs(double complex) ;
|
||||
__stdargs float cabsf(float complex) ;
|
||||
|
||||
/* 7.3.8.2 The cpow functions */
|
||||
__stdargs double complex cpow(double complex, double complex);
|
||||
__stdargs float complex cpowf(float complex, float complex);
|
||||
|
||||
/* 7.3.8.3 The csqrt functions */
|
||||
__stdargs double complex csqrt(double complex);
|
||||
__stdargs float complex csqrtf(float complex);
|
||||
__stdargs long double complex csqrtl(long double complex);
|
||||
|
||||
/* 7.3.9 Manipulation functions */
|
||||
/* 7.3.9.1 The carg functions */
|
||||
__stdargs double carg(double complex);
|
||||
__stdargs float cargf(float complex);
|
||||
__stdargs long double cargl(long double complex);
|
||||
|
||||
/* 7.3.9.2 The cimag functions */
|
||||
__stdargs double cimag(double complex);
|
||||
__stdargs float cimagf(float complex);
|
||||
__stdargs long double cimagl(long double complex);
|
||||
|
||||
/* 7.3.9.3 The conj functions */
|
||||
__stdargs double complex conj(double complex);
|
||||
__stdargs float complex conjf(float complex);
|
||||
|
||||
/* 7.3.9.4 The cproj functions */
|
||||
__stdargs double complex cproj(double complex);
|
||||
__stdargs float complex cprojf(float complex);
|
||||
|
||||
/* 7.3.9.5 The creal functions */
|
||||
__stdargs double creal(double complex);
|
||||
__stdargs float crealf(float complex);
|
||||
__stdargs long double creall(long double complex);
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
__stdargs double complex clog10(double complex);
|
||||
__stdargs float complex clog10f(float complex);
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
__stdargs long double complex cacosl(long double complex);
|
||||
__stdargs long double complex ccosl(long double complex);
|
||||
__stdargs long double complex csinl(long double complex);
|
||||
__stdargs long double complex ctanl(long double complex);
|
||||
__stdargs long double complex cacoshl(long double complex);
|
||||
__stdargs long double complex casinhl(long double complex);
|
||||
__stdargs long double complex catanhl(long double complex);
|
||||
__stdargs long double complex ccoshl(long double complex);
|
||||
__stdargs long double complex csinhl(long double complex);
|
||||
__stdargs long double complex ctanhl(long double complex);
|
||||
__stdargs long double complex cexpl(long double complex);
|
||||
__stdargs long double complex cpowl(long double complex, long double complex);
|
||||
__stdargs long double complex conjl(long double complex);
|
||||
__stdargs long double complex cprojl(long double complex);
|
||||
#if __GNU_VISIBLE
|
||||
__stdargs long double complex clog10l(long double complex);
|
||||
#endif
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ! _COMPLEX_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
/* POSIX.1 symbolic constants for c_mode field of cpio archive format */
|
||||
|
||||
#ifndef _CPIO_H
|
||||
#define _CPIO_H
|
||||
|
||||
#define C_IRUSR 0000400 /* Read by owner */
|
||||
#define C_IWUSR 0000200 /* Write by owner */
|
||||
#define C_IXUSR 0000100 /* Execute by owner */
|
||||
#define C_IRGRP 0000040 /* Read by group */
|
||||
#define C_IWGRP 0000020 /* Write by group */
|
||||
#define C_IXGRP 0000010 /* Execute by group */
|
||||
#define C_IROTH 0000004 /* Read by others */
|
||||
#define C_IWOTH 0000002 /* Write by others */
|
||||
#define C_IXOTH 0000001 /* Execute by others */
|
||||
#define C_ISUID 0004000 /* Set user ID */
|
||||
#define C_ISGID 0002000 /* Set group ID */
|
||||
#define C_ISVTX 0001000 /* On directories, restricted deletion flag */
|
||||
|
||||
#define C_ISDIR 0040000 /* Directory */
|
||||
#define C_ISFIFO 0010000 /* FIFO */
|
||||
#define C_ISREG 0100000 /* Regular file */
|
||||
#define C_ISBLK 0060000 /* Block special */
|
||||
#define C_ISCHR 0020000 /* Character special */
|
||||
#define C_ISCTG 0110000 /* Reserved */
|
||||
#define C_ISLNK 0120000 /* Symbolic link */
|
||||
#define C_ISSOCK 0140000 /* Socket */
|
||||
|
||||
#define MAGIC "070707"
|
||||
|
||||
#endif /* _CPIO_H */
|
||||
@@ -0,0 +1,184 @@
|
||||
#ifndef _CTYPE_H_
|
||||
#define _CTYPE_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_COMPILING_NEWLIB)
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
__stdargs int isalnum (int __c);
|
||||
__stdargs int isalpha (int __c);
|
||||
__stdargs int iscntrl (int __c);
|
||||
__stdargs int isdigit (int __c);
|
||||
__stdargs int isgraph (int __c);
|
||||
__stdargs int islower (int __c);
|
||||
__stdargs int isprint (int __c);
|
||||
__stdargs int ispunct (int __c);
|
||||
__stdargs int isspace (int __c);
|
||||
__stdargs int isupper (int __c);
|
||||
__stdargs int isxdigit (int __c);
|
||||
__stdargs int tolower (int __c);
|
||||
__stdargs int toupper (int __c);
|
||||
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs int isblank (int __c);
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||
__stdargs int isascii (int __c);
|
||||
__stdargs int toascii (int __c);
|
||||
#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
|
||||
#define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A')
|
||||
#endif
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
extern __stdargs int isalnum_l (int __c, locale_t __l);
|
||||
extern __stdargs int isalpha_l (int __c, locale_t __l);
|
||||
extern __stdargs int isblank_l (int __c, locale_t __l);
|
||||
extern __stdargs int iscntrl_l (int __c, locale_t __l);
|
||||
extern __stdargs int isdigit_l (int __c, locale_t __l);
|
||||
extern __stdargs int isgraph_l (int __c, locale_t __l);
|
||||
extern __stdargs int islower_l (int __c, locale_t __l);
|
||||
extern __stdargs int isprint_l (int __c, locale_t __l);
|
||||
extern __stdargs int ispunct_l (int __c, locale_t __l);
|
||||
extern __stdargs int isspace_l (int __c, locale_t __l);
|
||||
extern __stdargs int isupper_l (int __c, locale_t __l);
|
||||
extern __stdargs int isxdigit_l(int __c, locale_t __l);
|
||||
extern __stdargs int tolower_l (int __c, locale_t __l);
|
||||
extern __stdargs int toupper_l (int __c, locale_t __l);
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
extern __stdargs int isascii_l (int __c, locale_t __l);
|
||||
extern __stdargs int toascii_l (int __c, locale_t __l);
|
||||
#endif
|
||||
|
||||
#define _U 01
|
||||
#define _L 02
|
||||
#define _N 04
|
||||
#define _S 010
|
||||
#define _P 020
|
||||
#define _C 040
|
||||
#define _X 0100
|
||||
#define _B 0200
|
||||
|
||||
#ifdef __HAVE_LOCALE_INFO__
|
||||
__stdargs const char *__locale_ctype_ptr (void);
|
||||
#else
|
||||
#define __locale_ctype_ptr() _ctype_
|
||||
#endif
|
||||
|
||||
# define __CTYPE_PTR (__locale_ctype_ptr ())
|
||||
|
||||
#ifndef __cplusplus
|
||||
/* These macros are intentionally written in a manner that will trigger
|
||||
a gcc -Wall warning if the user mistakenly passes a 'char' instead
|
||||
of an int containing an 'unsigned char'. Note that the sizeof will
|
||||
always be 1, which is what we want for mapping EOF to __CTYPE_PTR[0];
|
||||
the use of a raw index inside the sizeof triggers the gcc warning if
|
||||
__c was of type char, and sizeof masks side effects of the extra __c.
|
||||
Meanwhile, the real index to __CTYPE_PTR+1 must be cast to int,
|
||||
since isalpha(0x100000001LL) must equal isalpha(1), rather than being
|
||||
an out-of-bounds reference on a 64-bit machine. */
|
||||
#define __ctype_lookup(__c) ((__CTYPE_PTR+sizeof(""[__c]))[(int)(__c)])
|
||||
|
||||
#define isalpha(__c) (__ctype_lookup(__c)&(_U|_L))
|
||||
#define isupper(__c) ((__ctype_lookup(__c)&(_U|_L))==_U)
|
||||
#define islower(__c) ((__ctype_lookup(__c)&(_U|_L))==_L)
|
||||
//#define isdigit(__c) (__ctype_lookup(__c)&_N)
|
||||
#define isdigit(x) ((unsigned)(x - '0') <= 9)
|
||||
|
||||
#define isxdigit(__c) (__ctype_lookup(__c)&(_X|_N))
|
||||
#define isspace(__c) (__ctype_lookup(__c)&_S)
|
||||
#define ispunct(__c) (__ctype_lookup(__c)&_P)
|
||||
#define isalnum(__c) (__ctype_lookup(__c)&(_U|_L|_N))
|
||||
#define isprint(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N|_B))
|
||||
#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N))
|
||||
#define iscntrl(__c) (__ctype_lookup(__c)&_C)
|
||||
|
||||
#if defined(__GNUC__) && __ISO_C_VISIBLE >= 1999
|
||||
#define isblank(__c) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
(__ctype_lookup(__x)&_B) || (int) (__x) == '\t';})
|
||||
#endif
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#ifdef __HAVE_LOCALE_INFO__
|
||||
__stdargs const char *__locale_ctype_ptr_l (locale_t);
|
||||
#else
|
||||
#define __locale_ctype_ptr_l(l) _ctype_
|
||||
#endif
|
||||
#define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)])
|
||||
|
||||
#define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L))
|
||||
#define isupper_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_U)
|
||||
#define islower_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_L)
|
||||
#define isdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&_N)
|
||||
#define isxdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_X|_N))
|
||||
#define isspace_l(__c,__l) (__ctype_lookup_l(__c,__l)&_S)
|
||||
#define ispunct_l(__c,__l) (__ctype_lookup_l(__c,__l)&_P)
|
||||
#define isalnum_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L|_N))
|
||||
#define isprint_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N|_B))
|
||||
#define isgraph_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N))
|
||||
#define iscntrl_l(__c,__l) (__ctype_lookup_l(__c,__l)&_C)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define isblank_l(__c, __l) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
(__ctype_lookup_l(__x,__l)&_B) || (int) (__x) == '\t';})
|
||||
#endif
|
||||
|
||||
#endif /* __POSIX_VISIBLE >= 200809 */
|
||||
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||
#define isascii(__c) ((unsigned)(__c)<=0177)
|
||||
#define toascii(__c) ((__c)&0177)
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
#define isascii_l(__c,__l) ((__l),(unsigned)(__c)<=0177)
|
||||
#define toascii_l(__c,__l) ((__l),(__c)&0177)
|
||||
#endif
|
||||
|
||||
/* Non-gcc versions will get the library versions, and will be
|
||||
slightly slower. These macros are not NLS-aware so they are
|
||||
disabled if the system supports the extended character sets. */
|
||||
# if defined(__GNUC__)
|
||||
# if !defined (_MB_EXTENDED_CHARSETS_ISO) && !defined (_MB_EXTENDED_CHARSETS_WINDOWS)
|
||||
# define toupper(__c) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
islower (__x) ? (int) __x - 'a' + 'A' : (int) __x;})
|
||||
# define tolower(__c) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
isupper (__x) ? (int) __x - 'A' + 'a' : (int) __x;})
|
||||
# else /* _MB_EXTENDED_CHARSETS* */
|
||||
/* Allow a gcc warning if the user passed 'char', but defer to the
|
||||
function. */
|
||||
# define toupper(__c) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
(void) __CTYPE_PTR[__x]; (toupper) (__x);})
|
||||
# define tolower(__c) \
|
||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||
(void) __CTYPE_PTR[__x]; (tolower) (__x);})
|
||||
# endif /* _MB_EXTENDED_CHARSETS* */
|
||||
# endif /* __GNUC__ */
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#endif /* __POSIX_VISIBLE >= 200809 */
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
/* For C++ backward-compatibility only. */
|
||||
extern const char *_ctype_;
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _CTYPE_H_ */
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef _DEBUGLIB_H
|
||||
#define _DEBUGLIB_H
|
||||
|
||||
#ifdef DEBUG_LIB
|
||||
extern __stdargs int KPrintF(const char *, ...);
|
||||
#define DB(x) x
|
||||
#define BUG KPrintF
|
||||
#define ASSERT(x) { if (!(x)) KPrintF("Assertion failed: " #x " at file " __FILE__ ", line %ld\n", __LINE__); }
|
||||
#else
|
||||
#define DB(x)
|
||||
#define BUG
|
||||
#define ASSERT(x)
|
||||
#endif /* DEBUG_LIB */
|
||||
|
||||
#endif /* _DEBUGLIB_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Joel Sherrill <joel@rtems.org>. 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 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.
|
||||
*/
|
||||
|
||||
#ifndef _POSIX_DEVCTL_h_
|
||||
#define _POSIX_DEVCTL_h_
|
||||
|
||||
/*
|
||||
* The posix_devctl() method is defined by POSIX 1003.26-2003. Aside
|
||||
* from the single method, it adds the following requirements:
|
||||
*
|
||||
* + define _POSIX_26_VERSION to 200312L
|
||||
* + add _SC_POSIX_26_VERSION in <unistd.h>. Return _POSIX_26_VERSION
|
||||
* + application must define _POSIX_26_C_SOURCE to use posix_devctl().
|
||||
* + posix_devctl() is prototyped in <devctl.h>
|
||||
*/
|
||||
|
||||
#ifdef _POSIX_26_C_SOURCE
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__stdargs int posix_devctl(
|
||||
int fd,
|
||||
int dcmd,
|
||||
void *__restrict dev_data_ptr,
|
||||
size_t nbyte,
|
||||
int *__restrict dev_info_ptr
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef _HEADERS_DIRENT_H
|
||||
#define _HEADERS_DIRENT_H
|
||||
|
||||
#include <dos/exall.h>
|
||||
#include <dos/dosextens.h>
|
||||
|
||||
struct dirent {
|
||||
ULONG d_fileno;
|
||||
USHORT d_reclen;
|
||||
UBYTE d_type;
|
||||
USHORT d_namlen;
|
||||
char d_name[256];
|
||||
};
|
||||
|
||||
typedef struct _dirdesc {
|
||||
int dd_fd;
|
||||
struct dirent dd_ent;
|
||||
BPTR d_lock;
|
||||
ULONG d_count;
|
||||
LONG d_more;
|
||||
struct ExAllControl *d_eac;
|
||||
struct ExAllData *current;
|
||||
union {
|
||||
char ead[2048];
|
||||
struct FileInfoBlock fib;
|
||||
} _dirun;
|
||||
} DIR;
|
||||
|
||||
#define d_ead _dirun.ead
|
||||
#define d_info _dirun.fib
|
||||
|
||||
/*
|
||||
* File types
|
||||
*/
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_FIFO 1
|
||||
#define DT_CHR 2
|
||||
#define DT_DIR 4
|
||||
#define DT_BLK 6
|
||||
#define DT_REG 8
|
||||
#define DT_LNK 10
|
||||
#define DT_SOCK 12
|
||||
#define DT_WHT 14
|
||||
|
||||
/*
|
||||
** prototypes
|
||||
*/
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
__stdargs DIR *opendir(const char *dirname);
|
||||
__stdargs struct dirent *readdir(DIR *dirp);
|
||||
__stdargs void rewinddir(DIR *dirp);
|
||||
__stdargs int closedir(DIR *dirp);
|
||||
|
||||
#endif /* _HEADERS_DIRENT_H */
|
||||
+3147
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
/* envlock.h -- header file for env routines. */
|
||||
|
||||
#ifndef _INCLUDE_ENVLOCK_H_
|
||||
#define _INCLUDE_ENVLOCK_H_
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/reent.h>
|
||||
|
||||
#define ENV_LOCK __env_lock(reent_ptr)
|
||||
#define ENV_UNLOCK __env_unlock(reent_ptr)
|
||||
|
||||
__stdargs void __env_lock (struct _reent *reent);
|
||||
__stdargs void __env_unlock (struct _reent *reent);
|
||||
|
||||
#endif /* _INCLUDE_ENVLOCK_H_ */
|
||||
@@ -0,0 +1,16 @@
|
||||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
|
||||
__stdargs char * envz_entry (const char *envz, size_t envz_len, const char *name);
|
||||
__stdargs char * envz_get (const char *envz, size_t envz_len, const char *name);
|
||||
__stdargs error_t envz_add (char **envz, size_t *envz_len, const char *name, const char *value);
|
||||
__stdargs error_t envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override);
|
||||
__stdargs void envz_remove(char **envz, size_t *envz_len, const char *name);
|
||||
__stdargs void envz_strip (char **envz, size_t *envz_len);
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __posix_threads__
|
||||
extern int __thread errno;
|
||||
#else
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _ERRNO_H */
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef _FASTMATH_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define _FASTMATH_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <machine/fastmath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FASTMATH_H_ */
|
||||
@@ -0,0 +1 @@
|
||||
#include <sys/fcntl.h>
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef _FNMATCH_H_
|
||||
#define _FNMATCH_H_
|
||||
|
||||
// The string does not match the specified pattern.
|
||||
#define FNM_NOMATCH 1
|
||||
|
||||
// Disable backslash escaping.
|
||||
#define FNM_NOESCAPE 1
|
||||
// <slash> in string only matches <slash> in pattern.
|
||||
#define FNM_PATHNAME 2
|
||||
// Leading <period> in string must be exactly matched by <period> in pattern.
|
||||
#define FNM_PERIOD 4
|
||||
|
||||
// ignore the case
|
||||
#define FNM_CASEFOLD 8
|
||||
|
||||
// The following shall be declared as a function and may also be defined as a macro. A function prototype shall be provided.
|
||||
__stdargs int fnmatch(const char *, const char *, int);
|
||||
|
||||
#endif // _FNMATCH_H_
|
||||
@@ -0,0 +1,184 @@
|
||||
/****************************************************************************
|
||||
|
||||
getopt.h - Read command line options
|
||||
|
||||
AUTHOR: Gregory Pietsch
|
||||
CREATED Thu Jan 09 22:37:00 1997
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
__stdargs The getopt() function parses the command line arguments. Its arguments argc
|
||||
and argv are the argument count and array as passed to the main() function
|
||||
on program invocation. The argument optstring is a list of available option
|
||||
characters. If such a character is followed by a colon (`:'), the option
|
||||
takes an argument, which is placed in optarg. If such a character is
|
||||
followed by two colons, the option takes an optional argument, which is
|
||||
placed in optarg. If the option does not take an argument, optarg is NULL.
|
||||
|
||||
The external variable optind is the index of the next array element of argv
|
||||
to be processed; it communicates from one call to the next which element to
|
||||
process.
|
||||
|
||||
__stdargs The getopt_long() function works like getopt() except that it also accepts
|
||||
long options started by two dashes `--'. If these take values, it is either
|
||||
in the form
|
||||
|
||||
--arg=value
|
||||
|
||||
or
|
||||
|
||||
--arg value
|
||||
|
||||
It takes the additional arguments longopts which is a pointer to the first
|
||||
element of an array of type GETOPT_LONG_OPTION_T, defined below. The last
|
||||
element of the array has to be filled with NULL for the name field.
|
||||
|
||||
The longind pointer points to the index of the current long option relative
|
||||
to longopts if it is non-NULL.
|
||||
|
||||
__stdargs The getopt() function returns the option character if the option was found
|
||||
successfully, `:' if there was a missing parameter for one of the options,
|
||||
`?' for an unknown option character, and EOF for the end of the option list.
|
||||
|
||||
__stdargs The getopt_long() function's return value is described below.
|
||||
|
||||
The function getopt_long_only() is identical to getopt_long(), except that a
|
||||
plus sign `+' can introduce long options as well as `--'.
|
||||
|
||||
Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything, the default is REQUIRE_ORDER if the
|
||||
environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options; stop option processing
|
||||
when the first non-option is seen. This is what Unix does. This mode of
|
||||
operation is selected by either setting the environment variable
|
||||
POSIXLY_CORRECT, or using `+' as the first character of the optstring
|
||||
parameter.
|
||||
|
||||
PERMUTE is the default. We permute the contents of ARGV as we scan, so that
|
||||
eventually all the non-options are at the end. This allows options to be
|
||||
given in any order, even with programs that were not written to expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were written to
|
||||
expect options and other ARGV-elements in any order and that care about the
|
||||
ordering of the two. We describe each non-option ARGV-element as if it were
|
||||
the argument of an option with character code 1. Using `-' as the first
|
||||
character of the optstring parameter selects this mode of operation.
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless of the
|
||||
value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause
|
||||
getopt() and friends to return EOF with optind != argc.
|
||||
|
||||
COPYRIGHT NOTICE AND DISCLAIMER:
|
||||
|
||||
Copyright (C) 1997 Gregory Pietsch
|
||||
|
||||
This file and the accompanying getopt.c implementation file are hereby
|
||||
placed in the public domain without restrictions. Just give the author
|
||||
credit, don't claim you wrote it or prevent anyone else from using it.
|
||||
|
||||
Gregory Pietsch's current e-mail address:
|
||||
gpietsch@comcast.net
|
||||
****************************************************************************/
|
||||
|
||||
/* This is a glibc-extension header file. */
|
||||
|
||||
#ifndef GETOPT_H
|
||||
#define GETOPT_H
|
||||
|
||||
#include <_ansi.h>
|
||||
|
||||
/* include files needed by this include file */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* types defined by this include file */
|
||||
struct option
|
||||
{
|
||||
const char *name; /* the name of the long option */
|
||||
int has_arg; /* one of the above macros */
|
||||
int *flag; /* determines if getopt_long() returns a
|
||||
* value for a long option; if it is
|
||||
* non-NULL, 0 is returned as a function
|
||||
* value and the value of val is stored in
|
||||
* the area pointed to by flag. Otherwise,
|
||||
* val is returned. */
|
||||
int val; /* determines the value to return if flag is
|
||||
* NULL. */
|
||||
|
||||
};
|
||||
|
||||
/* While getopt.h is a glibc extension, the following are newlib extensions.
|
||||
* They are optionally included via the __need_getopt_newlib flag. */
|
||||
|
||||
#ifdef __need_getopt_newlib
|
||||
|
||||
/* macros defined by this include file */
|
||||
#define NO_ARG no_argument
|
||||
#define REQUIRED_ARG required_argument
|
||||
#define OPTIONAL_ARG optional_argument
|
||||
|
||||
/* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically-
|
||||
allocated variable of type struct getopt_data. */
|
||||
#define GETOPT_DATA_INITIALIZER {0,0,0,0,0}
|
||||
|
||||
/* These #defines are to make accessing the reentrant functions easier. */
|
||||
#define getopt_r __getopt_r
|
||||
#define getopt_long_r __getopt_long_r
|
||||
#define getopt_long_only_r __getopt_long_only_r
|
||||
|
||||
/* The getopt_data structure is for reentrancy. Its members are similar to
|
||||
the externally-defined variables. */
|
||||
typedef struct getopt_data
|
||||
{
|
||||
char *optarg;
|
||||
int optind, opterr, optopt, optwhere;
|
||||
} getopt_data;
|
||||
|
||||
#endif /* __need_getopt_newlib */
|
||||
|
||||
/* externally-defined variables */
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int opterr;
|
||||
extern int optopt;
|
||||
|
||||
/* function prototypes */
|
||||
__stdargs int getopt (int __argc, char *const __argv[], const char *__optstring);
|
||||
|
||||
__stdargs int getopt_long (int __argc, char *const __argv[], const char *__shortopts,
|
||||
const struct option * __longopts, int *__longind);
|
||||
|
||||
__stdargs int getopt_long_only (int __argc, char *const __argv[], const char *__shortopts,
|
||||
const struct option * __longopts, int *__longind);
|
||||
|
||||
#ifdef __need_getopt_newlib
|
||||
__stdargs int __getopt_r (int __argc, char *const __argv[], const char *__optstring,
|
||||
struct getopt_data * __data);
|
||||
|
||||
__stdargs int __getopt_long_r (int __argc, char *const __argv[], const char *__shortopts,
|
||||
const struct option * __longopts, int *__longind,
|
||||
struct getopt_data * __data);
|
||||
|
||||
__stdargs int __getopt_long_only_r (int __argc, char *const __argv[], const char *__shortopts,
|
||||
const struct option * __longopts, int *__longind,
|
||||
struct getopt_data * __data);
|
||||
#endif /* __need_getopt_newlib */
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* GETOPT_H */
|
||||
|
||||
/* END OF FILE getopt.h */
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Guido van Rossum.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)glob.h 8.1 (Berkeley) 6/2/93
|
||||
* $FreeBSD: src/include/glob.h,v 1.6 2002/03/23 17:24:53 imp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _GLOB_H_
|
||||
#define _GLOB_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
struct stat;
|
||||
typedef struct {
|
||||
int gl_pathc; /* Count of total paths so far. */
|
||||
int gl_matchc; /* Count of paths matching pattern. */
|
||||
int gl_offs; /* Reserved at beginning of gl_pathv. */
|
||||
int gl_flags; /* Copy of flags parameter to glob. */
|
||||
char **gl_pathv; /* List of paths matching pattern. */
|
||||
/* Copy of errfunc parameter to glob. */
|
||||
__stdargs int (*gl_errfunc)(const char *, int);
|
||||
|
||||
/*
|
||||
* Alternate filesystem access methods for glob; replacement
|
||||
* versions of closedir(3), readdir(3), opendir(3), stat(2)
|
||||
* and lstat(2).
|
||||
*/
|
||||
__stdargs void (*gl_closedir)(void *);
|
||||
__stdargs struct dirent *(*gl_readdir)(void *);
|
||||
__stdargs void *(*gl_opendir)(const char *);
|
||||
__stdargs int (*gl_lstat)(const char *, struct stat *);
|
||||
__stdargs int (*gl_stat)(const char *, struct stat *);
|
||||
} glob_t;
|
||||
|
||||
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
|
||||
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
|
||||
#define GLOB_ERR 0x0004 /* Return on error. */
|
||||
#define GLOB_MARK 0x0008 /* Append / to matching directories. */
|
||||
#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
|
||||
#define GLOB_NOSORT 0x0020 /* Don't sort. */
|
||||
|
||||
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
|
||||
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
|
||||
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
|
||||
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
|
||||
#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
|
||||
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
|
||||
#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
|
||||
|
||||
/* backwards compatibility, this is the old name for this option */
|
||||
#define GLOB_MAXPATH GLOB_LIMIT
|
||||
|
||||
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
|
||||
#define GLOB_ABEND (-2) /* Unignored error. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs int glob(const char *__restrict, int, int (*)(const char *, int),
|
||||
glob_t *__restrict);
|
||||
__stdargs void globfree(glob_t *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_GLOB_H_ */
|
||||
@@ -0,0 +1,90 @@
|
||||
/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)grp.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _GRP_H_
|
||||
#define _GRP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __CYGWIN__
|
||||
#include <cygwin/grp.h>
|
||||
#endif
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#define _PATH_GROUP "/etc/group"
|
||||
#endif
|
||||
|
||||
struct group {
|
||||
char *gr_name; /* group name */
|
||||
char *gr_passwd; /* group password */
|
||||
gid_t gr_gid; /* group id */
|
||||
char **gr_mem; /* group members */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
__stdargs struct group *getgrgid (gid_t);
|
||||
__stdargs struct group *getgrnam (const char *);
|
||||
#if __MISC_VISIBLE || __POSIX_VISIBLE
|
||||
__stdargs int getgrnam_r (const char *, struct group *,
|
||||
char *, size_t, struct group **);
|
||||
__stdargs int getgrgid_r (gid_t, struct group *,
|
||||
char *, size_t, struct group **);
|
||||
#endif /* __MISC_VISIBLE || __POSIX_VISIBLE */
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE >= 4
|
||||
__stdargs struct group *getgrent (void);
|
||||
__stdargs void setgrent (void);
|
||||
__stdargs void endgrent (void);
|
||||
#endif /* __MISC_VISIBLE || __XSI_VISIBLE >= 4 */
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs int initgroups (const char *, gid_t);
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* !__INSIDE_CYGWIN__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_GRP_H_ */
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004, Artem B. Bityuckiy, SoftMine Corporation.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _ICONV_H_
|
||||
#define _ICONV_H_
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
/* iconv_t: charset conversion descriptor type */
|
||||
typedef _iconv_t iconv_t;
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
__stdargs iconv_t
|
||||
iconv_open (const char *, const char *);
|
||||
|
||||
__stdargs size_t
|
||||
iconv (iconv_t, char **__restrict, size_t *__restrict,
|
||||
char **__restrict, size_t *__restrict);
|
||||
|
||||
__stdargs int
|
||||
iconv_close (iconv_t);
|
||||
#endif
|
||||
|
||||
__stdargs iconv_t
|
||||
_iconv_open_r (struct _reent *, const char *, const char *);
|
||||
|
||||
__stdargs size_t
|
||||
_iconv_r (struct _reent *, iconv_t, const char **,
|
||||
size_t *, char **, size_t *);
|
||||
|
||||
__stdargs int
|
||||
_iconv_close_r (struct _reent *, iconv_t);
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* #ifndef _ICONV_H_ */
|
||||
@@ -0,0 +1,295 @@
|
||||
#ifndef _IEEE_FP_H_
|
||||
#define _IEEE_FP_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
#include <machine/ieeefp.h>
|
||||
#include <float.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
/* FIXME FIXME FIXME:
|
||||
Neither of __ieee_{float,double}_shape_type seem to be used anywhere
|
||||
except in libm/test. If that is the case, please delete these from here.
|
||||
If that is not the case, please insert documentation here describing why
|
||||
they're needed. */
|
||||
|
||||
#ifdef __IEEE_BIG_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
double value;
|
||||
struct
|
||||
{
|
||||
unsigned int sign : 1;
|
||||
unsigned int exponent: 11;
|
||||
unsigned int fraction0:4;
|
||||
unsigned int fraction1:16;
|
||||
unsigned int fraction2:16;
|
||||
unsigned int fraction3:16;
|
||||
|
||||
} number;
|
||||
struct
|
||||
{
|
||||
unsigned int sign : 1;
|
||||
unsigned int exponent: 11;
|
||||
unsigned int quiet:1;
|
||||
unsigned int function0:3;
|
||||
unsigned int function1:16;
|
||||
unsigned int function2:16;
|
||||
unsigned int function3:16;
|
||||
} nan;
|
||||
struct
|
||||
{
|
||||
unsigned long msw;
|
||||
unsigned long lsw;
|
||||
} parts;
|
||||
long aslong[2];
|
||||
} __ieee_double_shape_type;
|
||||
|
||||
#elif defined __IEEE_LITTLE_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
double value;
|
||||
struct
|
||||
{
|
||||
#ifdef __SMALL_BITFIELDS
|
||||
unsigned int fraction3:16;
|
||||
unsigned int fraction2:16;
|
||||
unsigned int fraction1:16;
|
||||
unsigned int fraction0: 4;
|
||||
#else
|
||||
unsigned int fraction1:32;
|
||||
unsigned int fraction0:20;
|
||||
#endif
|
||||
unsigned int exponent :11;
|
||||
unsigned int sign : 1;
|
||||
} number;
|
||||
struct
|
||||
{
|
||||
#ifdef __SMALL_BITFIELDS
|
||||
unsigned int function3:16;
|
||||
unsigned int function2:16;
|
||||
unsigned int function1:16;
|
||||
unsigned int function0:3;
|
||||
#else
|
||||
unsigned int function1:32;
|
||||
unsigned int function0:19;
|
||||
#endif
|
||||
unsigned int quiet:1;
|
||||
unsigned int exponent: 11;
|
||||
unsigned int sign : 1;
|
||||
} nan;
|
||||
struct
|
||||
{
|
||||
unsigned long lsw;
|
||||
unsigned long msw;
|
||||
} parts;
|
||||
|
||||
long aslong[2];
|
||||
|
||||
} __ieee_double_shape_type;
|
||||
|
||||
#endif /* __IEEE_LITTLE_ENDIAN */
|
||||
|
||||
#ifdef __IEEE_BIG_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
float value;
|
||||
struct
|
||||
{
|
||||
unsigned int sign : 1;
|
||||
unsigned int exponent: 8;
|
||||
unsigned int fraction0: 7;
|
||||
unsigned int fraction1: 16;
|
||||
} number;
|
||||
struct
|
||||
{
|
||||
unsigned int sign:1;
|
||||
unsigned int exponent:8;
|
||||
unsigned int quiet:1;
|
||||
unsigned int function0:6;
|
||||
unsigned int function1:16;
|
||||
} nan;
|
||||
long p1;
|
||||
|
||||
} __ieee_float_shape_type;
|
||||
|
||||
#elif defined __IEEE_LITTLE_ENDIAN
|
||||
|
||||
typedef union
|
||||
{
|
||||
float value;
|
||||
struct
|
||||
{
|
||||
unsigned int fraction0: 7;
|
||||
unsigned int fraction1: 16;
|
||||
unsigned int exponent: 8;
|
||||
unsigned int sign : 1;
|
||||
} number;
|
||||
struct
|
||||
{
|
||||
unsigned int function1:16;
|
||||
unsigned int function0:6;
|
||||
unsigned int quiet:1;
|
||||
unsigned int exponent:8;
|
||||
unsigned int sign:1;
|
||||
} nan;
|
||||
long p1;
|
||||
|
||||
} __ieee_float_shape_type;
|
||||
|
||||
#endif /* __IEEE_LITTLE_ENDIAN */
|
||||
|
||||
#ifndef _LDBL_EQ_DBL
|
||||
|
||||
#ifndef LDBL_MANT_DIG
|
||||
#error "LDBL_MANT_DIG not defined - should be found in float.h"
|
||||
|
||||
#elif LDBL_MANT_DIG == DBL_MANT_DIG
|
||||
#error "double and long double are the same size but LDBL_EQ_DBL is not defined"
|
||||
|
||||
#elif LDBL_MANT_DIG == 53
|
||||
/* This happens when doubles are 32-bits and long doubles are 64-bits. */
|
||||
#define EXT_EXPBITS 11
|
||||
#define EXT_FRACHBITS 20
|
||||
#define EXT_FRACLBITS 32
|
||||
#define __ieee_ext_field_type unsigned long
|
||||
|
||||
#elif LDBL_MANT_DIG == 64
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 32
|
||||
#define EXT_FRACLBITS 32
|
||||
#define __ieee_ext_field_type unsigned int
|
||||
|
||||
#elif LDBL_MANT_DIG == 65
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 32
|
||||
#define EXT_FRACLBITS 32
|
||||
#define __ieee_ext_field_type unsigned int
|
||||
|
||||
#elif LDBL_MANT_DIG == 112
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define __ieee_ext_field_type unsigned long long
|
||||
|
||||
#elif LDBL_MANT_DIG == 113
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define __ieee_ext_field_type unsigned long long
|
||||
|
||||
#else
|
||||
#error Unsupported value for LDBL_MANT_DIG
|
||||
#endif
|
||||
|
||||
#define EXT_EXP_INFNAN ((1 << EXT_EXPBITS) - 1) /* 32767 */
|
||||
#define EXT_EXP_BIAS ((1 << (EXT_EXPBITS - 1)) - 1) /* 16383 */
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
typedef struct ieee_ext
|
||||
{
|
||||
__ieee_ext_field_type ext_fracl : EXT_FRACLBITS;
|
||||
__ieee_ext_field_type ext_frach : EXT_FRACHBITS;
|
||||
__ieee_ext_field_type ext_exp : EXT_EXPBITS;
|
||||
__ieee_ext_field_type ext_sign : 1;
|
||||
} ieee_ext;
|
||||
|
||||
typedef union ieee_ext_u
|
||||
{
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
} ieee_ext_u;
|
||||
|
||||
#endif /* ! _LDBL_EQ_DBL */
|
||||
|
||||
|
||||
/* FLOATING ROUNDING */
|
||||
|
||||
typedef int fp_rnd;
|
||||
#define FP_RN 0 /* Round to nearest */
|
||||
#define FP_RM 1 /* Round down */
|
||||
#define FP_RP 2 /* Round up */
|
||||
#define FP_RZ 3 /* Round to zero (trunate) */
|
||||
|
||||
fp_rnd fpgetround (void);
|
||||
fp_rnd fpsetround (fp_rnd);
|
||||
|
||||
/* EXCEPTIONS */
|
||||
|
||||
typedef int fp_except;
|
||||
#define FP_X_INV 0x10 /* Invalid operation */
|
||||
#define FP_X_DX 0x80 /* Divide by zero */
|
||||
#define FP_X_OFL 0x04 /* Overflow exception */
|
||||
#define FP_X_UFL 0x02 /* Underflow exception */
|
||||
#define FP_X_IMP 0x01 /* imprecise exception */
|
||||
|
||||
fp_except fpgetmask (void);
|
||||
fp_except fpsetmask (fp_except);
|
||||
fp_except fpgetsticky (void);
|
||||
fp_except fpsetsticky (fp_except);
|
||||
|
||||
/* INTEGER ROUNDING */
|
||||
|
||||
typedef int fp_rdi;
|
||||
#define FP_RDI_TOZ 0 /* Round to Zero */
|
||||
#define FP_RDI_RD 1 /* Follow float mode */
|
||||
|
||||
fp_rdi fpgetroundtoi (void);
|
||||
fp_rdi fpsetroundtoi (fp_rdi);
|
||||
|
||||
#define __IEEE_DBL_EXPBIAS 1023
|
||||
#define __IEEE_FLT_EXPBIAS 127
|
||||
|
||||
#define __IEEE_DBL_EXPLEN 11
|
||||
#define __IEEE_FLT_EXPLEN 8
|
||||
|
||||
|
||||
#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1))
|
||||
#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1))
|
||||
|
||||
#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1))
|
||||
#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1))
|
||||
|
||||
#define __IEEE_DBL_NAN_EXP 0x7ff
|
||||
#define __IEEE_FLT_NAN_EXP 0xff
|
||||
|
||||
#ifdef __ieeefp_isnanf
|
||||
#define isnanf(x) __ieeefp_isnanf(x)
|
||||
#endif
|
||||
|
||||
#ifdef __ieeefp_isinff
|
||||
#define isinff(x) __ieeefp_isinff(x)
|
||||
#endif
|
||||
|
||||
#ifdef __ieeefp_finitef
|
||||
#define finitef(x) __ieeefp_finitef(x)
|
||||
#endif
|
||||
|
||||
#ifdef _DOUBLE_IS_32BITS
|
||||
#undef __IEEE_DBL_EXPBIAS
|
||||
#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS
|
||||
|
||||
#undef __IEEE_DBL_EXPLEN
|
||||
#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN
|
||||
|
||||
#undef __IEEE_DBL_FRACLEN
|
||||
#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN
|
||||
|
||||
#undef __IEEE_DBL_MAXPOWTWO
|
||||
#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO
|
||||
|
||||
#undef __IEEE_DBL_NAN_EXP
|
||||
#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP
|
||||
|
||||
#undef __ieee_double_shape_type
|
||||
#define __ieee_double_shape_type __ieee_float_shape_type
|
||||
|
||||
#endif /* _DOUBLE_IS_32BITS */
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _IEEE_FP_H_ */
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef INETD_H
|
||||
#define INETD_H \
|
||||
"$Id: inetd.h,v 4.1 1994/10/03 20:52:20 ppessi Exp $"
|
||||
/*
|
||||
* Internet daemon interface definitions
|
||||
*
|
||||
* Copyright © 1994 AmiTCP/IP Group,
|
||||
* Network Solutions Development, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The DaemonPort structure and its associated memory
|
||||
* must be allocated with AllocVec call
|
||||
*/
|
||||
struct DaemonPort {
|
||||
struct MsgPort dp_Port;
|
||||
__stdargs void (*dp_ExitCode)();
|
||||
};
|
||||
|
||||
#define DAEMONPORTNAME "inetd.ipc"
|
||||
|
||||
/*
|
||||
* A message associated with each launched process
|
||||
*/
|
||||
struct DaemonMessage {
|
||||
struct Message dm_Msg; /* Message name is FreeVec()'ed by inetd */
|
||||
struct Process*dm_Pid; /* set by the launcher */
|
||||
struct Segment*dm_Seg; /* used only if resident segment */
|
||||
LONG dm_Id; /* socket id */
|
||||
LONG dm_Retval; /* non-zero errorcode */
|
||||
UBYTE dm_Family; /* address/protocol family */
|
||||
UBYTE dm_Type;
|
||||
};
|
||||
|
||||
/* Daemon types, used as socket types */
|
||||
#define DMTYPE_UNKNOWN -1
|
||||
#define DMTYPE_INTERNAL 0 /* type is within builtin struct */
|
||||
#define DMTYPE_STREAM SOCK_STREAM /* stream socket */
|
||||
#define DMTYPE_DGRAM SOCK_DGRAM /* datagram socket */
|
||||
#define DMTYPE_RAW SOCK_RAW /* raw-protocol interface */
|
||||
#define DMTYPE_RDM SOCK_RDM /* reliably-delivered message */
|
||||
#define DMTYPE_SEQPACKET SOCK_SEQPACKET /* sequenced packet stream */
|
||||
|
||||
/* Return values from the startup code */
|
||||
#define DERR_LIB 0xA0
|
||||
#define DERR_OBTAIN 0xA1
|
||||
|
||||
#endif /* INETD_H */
|
||||
@@ -0,0 +1,201 @@
|
||||
#ifndef _INLINE_AMITCP_H
|
||||
#define _INLINE_AMITCP_H
|
||||
|
||||
#ifndef __INLINE_MACROS_H
|
||||
#include <inline/macros.h>
|
||||
#endif
|
||||
|
||||
#ifndef AMITCP_BASE_NAME
|
||||
#define AMITCP_BASE_NAME lss->lx_BsdSocketBase
|
||||
#endif
|
||||
|
||||
#define TCP_Accept(s, addr, addrlen) \
|
||||
LP3(0x30, LONG, TCP_Accept, LONG, s, d0, struct sockaddr *, addr, a0, int *, addrlen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Bind(s, name, namelen) \
|
||||
LP3(0x24, LONG, TCP_Bind, LONG, s, d0, const struct sockaddr *, name, a0, LONG, namelen, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_CloseSocket(d) \
|
||||
LP1(0x78, LONG, TCP_CloseSocket, LONG, d, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Connect(s, name, namelen) \
|
||||
LP3(0x36, LONG, TCP_Connect, LONG, s, d0, const struct sockaddr *, name, a0, LONG, namelen, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Dup2Socket(fd1, fd2) \
|
||||
LP2(0x108, LONG, TCP_Dup2Socket, LONG, fd1, d0, LONG, fd2, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Errno() \
|
||||
LP0(0xa2, LONG, TCP_Errno, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetDTableSize() \
|
||||
LP0(0x8a, LONG, TCP_GetDTableSize, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostByAddr(addr, len, type) \
|
||||
LP3(0xd8, struct hostent *, TCP_GetHostByAddr, const UBYTE *, addr, a0, LONG, len, d0, LONG, type, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostByName(name) \
|
||||
LP1(0xd2, struct hostent *, TCP_GetHostByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostId() \
|
||||
LP0(0x120, ULONG, TCP_GetHostId, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostName(hostname, size) \
|
||||
LP2(0x11a, LONG, TCP_GetHostName, STRPTR, hostname, a0, LONG, size, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetNetByAddr(net, type) \
|
||||
LP2(0xe4, struct netent *, TCP_GetNetByAddr, LONG, net, d0, LONG, type, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetNetByName(name) \
|
||||
LP1(0xde, struct netent *, TCP_GetNetByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetPeerName(s, hostname, namelen) \
|
||||
LP3(0x6c, LONG, TCP_GetPeerName, LONG, s, d0, struct sockaddr *, hostname, a0, int *, namelen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetProtoByName(name) \
|
||||
LP1(0xf6, struct protoent *, TCP_GetProtoByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetProtoByNumber(proto) \
|
||||
LP1(0xfc, struct protoent *, TCP_GetProtoByNumber, LONG, proto, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetServByName(name, proto) \
|
||||
LP2(0xea, struct servent *, TCP_GetServByName, const UBYTE *, name, a0, const UBYTE *, proto, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetServByPort(port, proto) \
|
||||
LP2(0xf0, struct servent *, TCP_GetServByPort, LONG, port, d0, const UBYTE *, proto, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSockName(s, hostname, namelen) \
|
||||
LP3(0x66, LONG, TCP_GetSockName, LONG, s, d0, struct sockaddr *, hostname, a0, int *, namelen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSockOpt(s, level, optname, optval, optlen) \
|
||||
LP5(0x60, LONG, TCP_GetSockOpt, LONG, s, d0, LONG, level, d1, LONG, optname, d2, void *, optval, a0, int *, optlen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSocketEvents(eventmaskp) \
|
||||
LP1(0x12c, LONG, TCP_GetSocketEvents, ULONG *, eventmaskp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_Addr(cp) \
|
||||
LP1(0xb4, ULONG, TCP_Inet_Addr, const UBYTE *, cp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_LnaOf(in) \
|
||||
LP1(0xba, ULONG, TCP_Inet_LnaOf, LONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_MakeAddr(net, host) \
|
||||
LP2(0xc6, ULONG, TCP_Inet_MakeAddr, ULONG, net, d0, ULONG, host, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_NetOf(in) \
|
||||
LP1(0xc0, ULONG, TCP_Inet_NetOf, LONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_Network(cp) \
|
||||
LP1(0xcc, ULONG, TCP_Inet_Network, const UBYTE *, cp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_NtoA(in) \
|
||||
LP1(0xae, char *, TCP_Inet_NtoA, ULONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_IoctlSocket(d, request, argp) \
|
||||
LP3(0x72, LONG, TCP_IoctlSocket, LONG, d, d0, ULONG, request, d1, char *, argp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Listen(s, backlog) \
|
||||
LP2(0x2a, LONG, TCP_Listen, LONG, s, d0, LONG, backlog, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ObtainSocket(id, domain, type, protocol) \
|
||||
LP4(0x90, LONG, TCP_ObtainSocket, LONG, id, d0, LONG, domain, d1, LONG, type, d2, LONG, protocol, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Recv(s, buf, len, flags) \
|
||||
LP4(0x4e, LONG, TCP_Recv, LONG, s, d0, UBYTE *, buf, a0, LONG, len, d1, LONG, flags, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_RecvFrom(s, buf, len, flags, from, fromlen) \
|
||||
LP6(0x48, LONG, TCP_RecvFrom, LONG, s, d0, UBYTE *, buf, a0, LONG, len, d1, LONG, flags, d2, struct sockaddr *, from, a1, int *, fromlen, a2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_RecvMsg(s, msg, flags) \
|
||||
LP3(0x114, LONG, TCP_RecvMsg, LONG, s, d0, struct msghdr *, msg, a0, LONG, flags, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ReleaseCopyOfSocket(fd, id) \
|
||||
LP2(0x9c, LONG, TCP_ReleaseCopyOfSocket, LONG, fd, d0, LONG, id, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ReleaseSocket(fd, id) \
|
||||
LP2(0x96, LONG, TCP_ReleaseSocket, LONG, fd, d0, LONG, id, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Send(s, msg, len, flags) \
|
||||
LP4(0x42, LONG, TCP_Send, LONG, s, d0, const UBYTE *, msg, a0, LONG, len, d1, LONG, flags, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SendMsg(s, msg, flags) \
|
||||
LP3(0x10e, LONG, TCP_SendMsg, LONG, s, d0, const struct msghdr *, msg, a0, LONG, flags, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SendTo(s, msg, len, flags, to, tolen) \
|
||||
LP6(0x3c, LONG, TCP_SendTo, LONG, s, d0, const UBYTE *, msg, a0, LONG, len, d1, LONG, flags, d2, const struct sockaddr *, to, a1, LONG, tolen, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetErrnoPtr(errno_p, size) \
|
||||
LP2(0xa8, LONG, TCP_SetErrnoPtr, void *, errno_p, a0, LONG, size, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetSockOpt(s, level, optname, optval, optlen) \
|
||||
LP5(0x5a, LONG, TCP_SetSockOpt, LONG, s, d0, LONG, level, d1, LONG, optname, d2, const void *, optval, a0, LONG, optlen, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetSocketSignals(SIGINTR, SIGIO, SIGURG) \
|
||||
LP3NR(0x84, TCP_SetSocketSignals, ULONG, SIGINTR, d0, ULONG, SIGIO, d1, ULONG, SIGURG, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ShutDown(s, how) \
|
||||
LP2(0x54, LONG, TCP_ShutDown, LONG, s, d0, LONG, how, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Socket(domain, type, protocol) \
|
||||
LP3(0x1e, LONG, TCP_Socket, LONG, domain, d0, LONG, type, d1, LONG, protocol, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SocketBaseTagList(taglist) \
|
||||
LP1(0x126, LONG, TCP_SocketBaseTagList, struct TagItem *, taglist, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#ifndef NO_INLINE_STDARG
|
||||
#define TCP_SocketBaseTags(tags...) \
|
||||
({ULONG _tags[] = { tags }; TCP_SocketBaseTagList((struct TagItem *)_tags);})
|
||||
#endif /* !NO_INLINE_STDARG */
|
||||
|
||||
#define TCP_SyslogA(level, format, ap) \
|
||||
LP3NR(0x102, TCP_SyslogA, ULONG, level, d0, const char *, format, a0, va_list, ap, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_WaitSelect(nfds, readfds, writefds, execptfds, timeout, maskp) \
|
||||
LP6(0x7e, LONG, TCP_WaitSelect, LONG, nfds, d0, fd_set *, readfds, a0, fd_set *, writefds, a1, fd_set *, execptfds, a2, struct timeval *, timeout, a3, ULONG *, maskp, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#endif /* _INLINE_AMITCP_H */
|
||||
@@ -0,0 +1,296 @@
|
||||
#ifndef _INLINE_AS225_H
|
||||
#define _INLINE_AS225_H
|
||||
|
||||
#ifndef __INLINE_MACROS_H
|
||||
#include <inline/macros.h>
|
||||
#endif
|
||||
|
||||
#ifndef AS225_BASE_NAME
|
||||
#define AS225_BASE_NAME lss->lx_SocketBase
|
||||
#endif
|
||||
|
||||
#define SOCK_accept(s, name, lenp) \
|
||||
LP3(0xba, int, SOCK_accept, int, s, d0, struct sockaddr *, name, a0, int *, lenp, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_bind(s, name, namelen) \
|
||||
LP3(0xc0, int, SOCK_bind, int, s, d0, const struct sockaddr *, name, a1, int, namelen, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_cleanup_sockets() \
|
||||
LP0NR(0x24, SOCK_cleanup_sockets, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_close(socket) \
|
||||
LP1(0x30, int, SOCK_close, int, socket, d0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_connect(s, name, namelen) \
|
||||
LP3(0xc6, int, SOCK_connect, int, s, d0, const struct sockaddr *, name, a1, int, namelen, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_dev_list(res, size) \
|
||||
LP2NR(0x1bc, SOCK_dev_list, u_long, res, d0, int, size, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_endhostent() \
|
||||
LP0NR(0x7e, SOCK_endhostent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_endnetent() \
|
||||
LP0NR(0x120, SOCK_endnetent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_endprotoent() \
|
||||
LP0NR(0x13e, SOCK_endprotoent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_endpwent() \
|
||||
LP0NR(0x18c, SOCK_endpwent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_endservent() \
|
||||
LP0NR(0x15c, SOCK_endservent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_get_tz() \
|
||||
LP0(0x5a, short, SOCK_get_tz, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getdomainname(name, namelen) \
|
||||
LP2(0x60, int, SOCK_getdomainname, char *, name, a1, int, namelen, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getgid() \
|
||||
LP0(0x48, gid_t, SOCK_getgid, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getgroups(num, gids) \
|
||||
LP2(0x4e, int, SOCK_getgroups, int, num, d0, int *, gids, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_gethostbyaddr(addr, len, type) \
|
||||
LP3(0x90, struct hostent *, SOCK_gethostbyaddr, const char *, addr, a0, int, len, d0, int, type, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_gethostbyname(name) \
|
||||
LP1(0x8a, struct hostent *, SOCK_gethostbyname, const char *, name, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_gethostent() \
|
||||
LP0(0x84, struct hostent *, SOCK_gethostent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_gethostname(name, length) \
|
||||
LP2(0x72, int, SOCK_gethostname, char *, name, a0, int, length, d0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getlogin() \
|
||||
LP0(0x54, char *, SOCK_getlogin, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getnetbyaddr(net, type) \
|
||||
LP2(0x12c, struct netent *, SOCK_getnetbyaddr, long, net, d0, int, type, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getnetbyname(name) \
|
||||
LP1(0x132, struct netent *, SOCK_getnetbyname, const char *, name, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getnetent() \
|
||||
LP0(0x126, struct netent *, SOCK_getnetent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getpeername(s, name, lenp) \
|
||||
LP3(0x198, int, SOCK_getpeername, int, s, d0, struct sockaddr *, name, a0, int *, lenp, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getprotobyname(name) \
|
||||
LP1(0x14a, struct protoent *, SOCK_getprotobyname, const char *, name, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getprotobynumber(proto) \
|
||||
LP1(0x150, struct protoent *, SOCK_getprotobynumber, int, proto, d0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getprotoent() \
|
||||
LP0(0x144, struct protoent *, SOCK_getprotoent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getpwent() \
|
||||
LP0(0x180, struct AS225_passwd *, SOCK_getpwent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getpwnam(name) \
|
||||
LP1(0x17a, struct AS225_passwd *, SOCK_getpwnam, char *, name, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getpwuid(uid) \
|
||||
LP1(0x174, struct AS225_passwd *, SOCK_getpwuid, uid_t, uid, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getservbyname(name, proto) \
|
||||
LP2(0x168, struct servent *, SOCK_getservbyname, const char *, name, a0, const char *, proto, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getservbyport(port, proto) \
|
||||
LP2(0x16e, struct servent *, SOCK_getservbyport, u_short, port, d0, const char *, proto, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getservent() \
|
||||
LP0(0x162, struct servent *, SOCK_getservent, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getsignal(type) \
|
||||
LP1(0x36, BYTE, SOCK_getsignal, UWORD, type, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getsockname(s, name, lenp) \
|
||||
LP3(0x19e, int, SOCK_getsockname, int, s, d0, struct sockaddr *, name, a0, int *, lenp, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getsockopt(s, level, optname, optval, optlenp) \
|
||||
LP5(0x114, int, SOCK_getsockopt, int, s, d0, int, level, d1, int, optname, d2, char *, optval, a0, int *, optlenp, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getuid() \
|
||||
LP0(0x42, uid_t, SOCK_getuid, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_getumask() \
|
||||
LP0(0x66, mode_t, SOCK_getumask, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_addr(cp) \
|
||||
LP1(0x96, u_long, SOCK_inet_addr, char *, cp, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_lnaof(in) \
|
||||
LP1(0xa2, int, SOCK_inet_lnaof, struct, in, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_makeaddr(net, lna) \
|
||||
LP2(0x9c, struct in_addr, SOCK_inet_makeaddr, int, net, d0, int, lna, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_netof(in) \
|
||||
LP1(0xa8, int, SOCK_inet_netof, struct, in, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_network(str) \
|
||||
LP1(0xae, int, SOCK_inet_network, char *, str, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inet_ntoa(in) \
|
||||
LP1(0xb4, char *, SOCK_inet_ntoa, struct, in, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_inherit(sp) \
|
||||
LP1(0x1b6, int, SOCK_inherit, void *, sp, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_ioctl(s, cmd, data) \
|
||||
LP3(0xcc, int, SOCK_ioctl, int, s, d0, int, cmd, d1, char *, data, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_listen(s, backlog) \
|
||||
LP2(0xd2, int, SOCK_listen, int, s, d0, int, backlog, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_rcmd(ahost, inport, luser, ruser, cmd, fd2p) \
|
||||
LP6(0x192, int, SOCK_rcmd, char **, ahost, d0, u_short, inport, d1, char *, luser, a0, char *, ruser, a1, char *, cmd, a2, int *, fd2p, d2, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_reconfig() \
|
||||
LP0(0x1aa, int, SOCK_reconfig, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_recv(s, buf, len, flags) \
|
||||
LP4(0xd8, int, SOCK_recv, int, s, d0, char *, buf, a0, int, len, d1, int, flags, d2, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_recvfrom(s, buf, len, flags, from, fromlen) \
|
||||
LP6(0xde, int, SOCK_recvfrom, int, s, d0, char *, buf, a0, int, len, d1, int, flags, d2, struct sockaddr *, from, a1, int *, fromlen, a2, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_recvmsg(s, msg, flags) \
|
||||
LP3(0xe4, int, SOCK_recvmsg, int, s, d0, struct msghdr *, msg, a0, int, flags, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_release(s) \
|
||||
LP1(0x1b0, void *,SOCK_release, int, s, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_select(numfds, rfds, wfds, efds, timeout) \
|
||||
LP5(0xea, int, SOCK_select, int, numfds, d0, fd_set *, rfds, a0, fd_set *, wfds, a1, fd_set *, efds, a2, struct timeval *, timeout, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_selectwait(numfds, rfds, wfds, efds, timeout, umask) \
|
||||
LP6(0xf0, int, SOCK_selectwait, int, numfds, d0, fd_set *, rfds, a0, fd_set *, wfds, a1, fd_set *, efds, a2, struct timeval *, timeout, d1, long *, umask, d2, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_send(s, buf, len, flags) \
|
||||
LP4(0xf6, int, SOCK_send, int, s, d0, const char *, buf, a0, int, len, d1, int, flags, a1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_sendmsg(s, msg, flags) \
|
||||
LP3(0x102, int, SOCK_sendmsg, int, s, d0, const struct msghdr *, msg, a0, int, flags, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_sendto(s, buf, len, flags, to, to_len) \
|
||||
LP6(0xfc, int, SOCK_sendto, int, s, d0, const char *, buf, a0, int, len, d1, int, flags, d2, const struct sockaddr *, to, a1, int, to_len, d3, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_sethostent(flag) \
|
||||
LP1NR(0x78, SOCK_sethostent, int, flag, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setnetent(flag) \
|
||||
LP1NR(0x11a, SOCK_setnetent, int, flag, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setprotoent(flag) \
|
||||
LP1NR(0x138, SOCK_setprotoent, int, flag, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setpwent(flag) \
|
||||
LP1NR(0x186, SOCK_setpwent, int, flag, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setservent(flag) \
|
||||
LP1NR(0x156, SOCK_setservent, int, flag, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setsockopt(s, level, optname, optval, optlen) \
|
||||
LP5(0x10e, int, SOCK_setsockopt, int, s, d0, int, level, d1, int, optname, d2, const char *, optval, a0, int, optlen, d3, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_setup_sockets(max_socks, errno_ptr) \
|
||||
LP2(0x1e, ULONG, SOCK_setup_sockets, UWORD, max_socks, d1, int *, errno_ptr, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_shutdown(s, how) \
|
||||
LP2(0x108, int, SOCK_shutdown, int, s, d0, int, how, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_socket(family, type, protocol) \
|
||||
LP3(0x2a, int, SOCK_socket, int, family, d0, int, type, d1, int, protocol, d2, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_strerror(num) \
|
||||
LP1(0x3c, char *, SOCK_strerror, int, num, d1, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_syslog(pri, msg) \
|
||||
LP2(0x1a4, int, SOCK_syslog, int, pri, d0, char *, msg, a0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_umask(cmask) \
|
||||
LP1(0x6c, mode_t, SOCK_umask, mode_t, cmask, d0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#define SOCK_dup(fd) \
|
||||
LP1(0x2b2, int, SOCK_dup, int, fd, d0, \
|
||||
, AS225_BASE_NAME)
|
||||
|
||||
#endif /* _INLINE_AS225_H */
|
||||
@@ -0,0 +1,173 @@
|
||||
#ifndef _INLINE_USERGROUP_H
|
||||
#define _INLINE_USERGROUP_H
|
||||
|
||||
#ifndef __INLINE_MACROS_H
|
||||
#include <inline/macros.h>
|
||||
#endif
|
||||
|
||||
#ifndef USERGROUP_BASE_NAME
|
||||
#define USERGROUP_BASE_NAME lss->lx_UserGroupBase
|
||||
#endif
|
||||
|
||||
#define UG_crypt(key, salt) \
|
||||
LP2(0xae, char *, UG_crypt, const char *, key, a0, const char *, salt, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_endgrent() \
|
||||
LP0NR(0xa8, UG_endgrent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_endpwent() \
|
||||
LP0NR(0x8a, UG_endpwent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_endutent() \
|
||||
LP0NR(0xf0, UG_endutent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getcredentials(task) \
|
||||
LP1(0x102, struct UserGroupCredentials *, UG_getcredentials, struct Task *, task, a0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getegid() \
|
||||
LP0(0x4e, gid_t, UG_getegid, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_geteuid() \
|
||||
LP0(0x36, uid_t, UG_geteuid, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getgid() \
|
||||
LP0(0x48, gid_t, UG_getgid, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getgrent() \
|
||||
LP0(0xa2, struct group *, UG_getgrent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getgrgid(gid) \
|
||||
LP1(0x96, struct group *, UG_getgrgid, gid_t, gid, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getgrnam(name) \
|
||||
LP1(0x90, struct group *, UG_getgrnam, const char *, name, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getgroups(ngroups, groups) \
|
||||
LP2(0x60, int, UG_getgroups, int, ngroups, d0, int *, groups, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getlastlog(uid) \
|
||||
LP1(0xf6, struct lastlog *, UG_getlastlog, uid_t, uid, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getlogin() \
|
||||
LP0(0xd8, char *, UG_getlogin, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getpass(prompt) \
|
||||
LP1(0xba, char *, UG_getpass, const char *, prompt, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getpgrp() \
|
||||
LP0(0xd2, pid_t, UG_getpgrp, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getpwent() \
|
||||
LP0(0x84, struct TCP_passwd *, UG_getpwent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getpwnam(name) \
|
||||
LP1(0x72, struct TCP_passwd *, UG_getpwnam, const char *, name, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getpwuid(uid) \
|
||||
LP1(0x78, struct TCP_passwd *, UG_getpwuid, uid_t, uid, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getuid() \
|
||||
LP0(0x30, uid_t, UG_getuid, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getumask() \
|
||||
LP0(0xc6, mode_t, UG_getumask, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_getutent() \
|
||||
LP0(0xea, struct utmp *, UG_getutent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_initgroups(name, basegroup) \
|
||||
LP2(0x6c, int, UG_initgroups, const char *, name, a1, gid_t, basegroup, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setgid(id) \
|
||||
LP1(0x5a, int, UG_setgid, gid_t, id, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setgrent() \
|
||||
LP0NR(0x9c, UG_setgrent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setgroups(ngroups, groups) \
|
||||
LP2(0x66, int, UG_setgroups, int, ngroups, d0, const int *, groups, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setlastlog(uid, name, host) \
|
||||
LP3(0xfc, int, UG_setlastlog, uid_t, uid, d0, char *, name, a0, char *, host, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setlogin(buffer) \
|
||||
LP1(0xde, int, UG_setlogin, const char *, buffer, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setpwent() \
|
||||
LP0NR(0x7e, UG_setpwent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setregid(real, eff) \
|
||||
LP2(0x54, int, UG_setregid, gid_t, real, d0, gid_t, eff, d1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setreuid(real, eff) \
|
||||
LP2(0x3c, int, UG_setreuid, uid_t, real, d0, uid_t, eff, d1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setsid() \
|
||||
LP0(0xcc, pid_t, UG_setsid, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setuid(id) \
|
||||
LP1(0x42, int, UG_setuid, uid_t, id, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_setutent() \
|
||||
LP0NR(0xe4, UG_setutent, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define UG_umask(mask) \
|
||||
LP1(0xc0, mode_t, UG_umask, mode_t, mask, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define ug_GetErr() \
|
||||
LP0(0x24, int, ug_GetErr, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define ug_GetSalt(user, buffer, size) \
|
||||
LP3(0xb4, char *, ug_GetSalt, const struct TCP_passwd *, user, a0, char *, buffer, a1, ULONG, size, d0, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#define ug_SetupContextTagList(pname, taglist) \
|
||||
LP2(0x1e, int, ug_SetupContextTagList, const UBYTE*, pname, a0, struct TagItem *, taglist, a1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#ifndef NO_INLINE_STDARG
|
||||
#define ug_SetupContextTags(a0, tags...) \
|
||||
({ULONG _tags[] = { tags }; ug_SetupContextTagList((a0), (struct TagItem *)_tags);})
|
||||
#endif /* !NO_INLINE_STDARG */
|
||||
|
||||
#define ug_StrError(code) \
|
||||
LP1(0x2a, const char *, ug_StrError, LONG, code, d1, \
|
||||
, USERGROUP_BASE_NAME)
|
||||
|
||||
#endif /* _INLINE_USERGROUP_H */
|
||||
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file inttypes.h
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_H
|
||||
#define _INTTYPES_H
|
||||
|
||||
#include <newlib.h>
|
||||
#include <sys/config.h>
|
||||
#include <sys/_intsup.h>
|
||||
#include "_ansi.h"
|
||||
#include <stdint.h>
|
||||
#define __need_wchar_t
|
||||
#include <stddef.h>
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#define __STRINGIFY(a) #a
|
||||
|
||||
/* 8-bit types */
|
||||
#define __PRI8(x) __INT8 __STRINGIFY(x)
|
||||
#define __PRI8LEAST(x) __LEAST8 __STRINGIFY(x)
|
||||
#define __PRI8FAST(x) __FAST8 __STRINGIFY(x)
|
||||
|
||||
/* NOTICE: scanning 8-bit types requires use of the hh specifier
|
||||
* which is only supported on newlib platforms that
|
||||
* are built with C99 I/O format support enabled. If the flag in
|
||||
* newlib.h hasn't been set during configuration to indicate this, the 8-bit
|
||||
* scanning format macros are disabled here as they result in undefined
|
||||
* behaviour which can include memory overwrite. Overriding the flag after the
|
||||
* library has been built is not recommended as it will expose the underlying
|
||||
* undefined behaviour.
|
||||
*/
|
||||
|
||||
#if defined(_WANT_IO_C99_FORMATS)
|
||||
#define __SCN8(x) __INT8 __STRINGIFY(x)
|
||||
#define __SCN8LEAST(x) __LEAST8 __STRINGIFY(x)
|
||||
#define __SCN8FAST(x) __FAST8 __STRINGIFY(x)
|
||||
#endif /* _WANT_IO_C99_FORMATS */
|
||||
|
||||
|
||||
#define PRId8 __PRI8(d)
|
||||
#define PRIi8 __PRI8(i)
|
||||
#define PRIo8 __PRI8(o)
|
||||
#define PRIu8 __PRI8(u)
|
||||
#define PRIx8 __PRI8(x)
|
||||
#define PRIX8 __PRI8(X)
|
||||
|
||||
/* Macros below are only enabled for a newlib built with C99 I/O format support. */
|
||||
#if defined(_WANT_IO_C99_FORMATS)
|
||||
|
||||
#define SCNd8 __SCN8(d)
|
||||
#define SCNi8 __SCN8(i)
|
||||
#define SCNo8 __SCN8(o)
|
||||
#define SCNu8 __SCN8(u)
|
||||
#define SCNx8 __SCN8(x)
|
||||
|
||||
#endif /* _WANT_IO_C99_FORMATS */
|
||||
|
||||
|
||||
#define PRIdLEAST8 __PRI8LEAST(d)
|
||||
#define PRIiLEAST8 __PRI8LEAST(i)
|
||||
#define PRIoLEAST8 __PRI8LEAST(o)
|
||||
#define PRIuLEAST8 __PRI8LEAST(u)
|
||||
#define PRIxLEAST8 __PRI8LEAST(x)
|
||||
#define PRIXLEAST8 __PRI8LEAST(X)
|
||||
|
||||
/* Macros below are only enabled for a newlib built with C99 I/O format support. */
|
||||
#if defined(_WANT_IO_C99_FORMATS)
|
||||
|
||||
#define SCNdLEAST8 __SCN8LEAST(d)
|
||||
#define SCNiLEAST8 __SCN8LEAST(i)
|
||||
#define SCNoLEAST8 __SCN8LEAST(o)
|
||||
#define SCNuLEAST8 __SCN8LEAST(u)
|
||||
#define SCNxLEAST8 __SCN8LEAST(x)
|
||||
|
||||
#endif /* _WANT_IO_C99_FORMATS */
|
||||
|
||||
#define PRIdFAST8 __PRI8FAST(d)
|
||||
#define PRIiFAST8 __PRI8FAST(i)
|
||||
#define PRIoFAST8 __PRI8FAST(o)
|
||||
#define PRIuFAST8 __PRI8FAST(u)
|
||||
#define PRIxFAST8 __PRI8FAST(x)
|
||||
#define PRIXFAST8 __PRI8FAST(X)
|
||||
|
||||
/* Macros below are only enabled for a newlib built with C99 I/O format support. */
|
||||
#if defined(_WANT_IO_C99_FORMATS)
|
||||
|
||||
#define SCNdFAST8 __SCN8FAST(d)
|
||||
#define SCNiFAST8 __SCN8FAST(i)
|
||||
#define SCNoFAST8 __SCN8FAST(o)
|
||||
#define SCNuFAST8 __SCN8FAST(u)
|
||||
#define SCNxFAST8 __SCN8FAST(x)
|
||||
|
||||
#endif /* _WANT_IO_C99_FORMATS */
|
||||
|
||||
/* 16-bit types */
|
||||
#define __PRI16(x) __INT16 __STRINGIFY(x)
|
||||
#define __PRI16LEAST(x) __LEAST16 __STRINGIFY(x)
|
||||
#define __PRI16FAST(x) __FAST16 __STRINGIFY(x)
|
||||
#define __SCN16(x) __INT16 __STRINGIFY(x)
|
||||
#define __SCN16LEAST(x) __LEAST16 __STRINGIFY(x)
|
||||
#define __SCN16FAST(x) __FAST16 __STRINGIFY(x)
|
||||
|
||||
|
||||
#define PRId16 __PRI16(d)
|
||||
#define PRIi16 __PRI16(i)
|
||||
#define PRIo16 __PRI16(o)
|
||||
#define PRIu16 __PRI16(u)
|
||||
#define PRIx16 __PRI16(x)
|
||||
#define PRIX16 __PRI16(X)
|
||||
|
||||
#define SCNd16 __SCN16(d)
|
||||
#define SCNi16 __SCN16(i)
|
||||
#define SCNo16 __SCN16(o)
|
||||
#define SCNu16 __SCN16(u)
|
||||
#define SCNx16 __SCN16(x)
|
||||
|
||||
|
||||
#define PRIdLEAST16 __PRI16LEAST(d)
|
||||
#define PRIiLEAST16 __PRI16LEAST(i)
|
||||
#define PRIoLEAST16 __PRI16LEAST(o)
|
||||
#define PRIuLEAST16 __PRI16LEAST(u)
|
||||
#define PRIxLEAST16 __PRI16LEAST(x)
|
||||
#define PRIXLEAST16 __PRI16LEAST(X)
|
||||
|
||||
#define SCNdLEAST16 __SCN16LEAST(d)
|
||||
#define SCNiLEAST16 __SCN16LEAST(i)
|
||||
#define SCNoLEAST16 __SCN16LEAST(o)
|
||||
#define SCNuLEAST16 __SCN16LEAST(u)
|
||||
#define SCNxLEAST16 __SCN16LEAST(x)
|
||||
|
||||
|
||||
#define PRIdFAST16 __PRI16FAST(d)
|
||||
#define PRIiFAST16 __PRI16FAST(i)
|
||||
#define PRIoFAST16 __PRI16FAST(o)
|
||||
#define PRIuFAST16 __PRI16FAST(u)
|
||||
#define PRIxFAST16 __PRI16FAST(x)
|
||||
#define PRIXFAST16 __PRI16FAST(X)
|
||||
|
||||
#define SCNdFAST16 __SCN16FAST(d)
|
||||
#define SCNiFAST16 __SCN16FAST(i)
|
||||
#define SCNoFAST16 __SCN16FAST(o)
|
||||
#define SCNuFAST16 __SCN16FAST(u)
|
||||
#define SCNxFAST16 __SCN16FAST(x)
|
||||
|
||||
/* 32-bit types */
|
||||
#define __PRI32(x) __INT32 __STRINGIFY(x)
|
||||
#define __SCN32(x) __INT32 __STRINGIFY(x)
|
||||
#define __PRI32LEAST(x) __LEAST32 __STRINGIFY(x)
|
||||
#define __SCN32LEAST(x) __LEAST32 __STRINGIFY(x)
|
||||
#define __PRI32FAST(x) __FAST32 __STRINGIFY(x)
|
||||
#define __SCN32FAST(x) __FAST32 __STRINGIFY(x)
|
||||
|
||||
#define PRId32 __PRI32(d)
|
||||
#define PRIi32 __PRI32(i)
|
||||
#define PRIo32 __PRI32(o)
|
||||
#define PRIu32 __PRI32(u)
|
||||
#define PRIx32 __PRI32(x)
|
||||
#define PRIX32 __PRI32(X)
|
||||
|
||||
#define SCNd32 __SCN32(d)
|
||||
#define SCNi32 __SCN32(i)
|
||||
#define SCNo32 __SCN32(o)
|
||||
#define SCNu32 __SCN32(u)
|
||||
#define SCNx32 __SCN32(x)
|
||||
|
||||
|
||||
#define PRIdLEAST32 __PRI32LEAST(d)
|
||||
#define PRIiLEAST32 __PRI32LEAST(i)
|
||||
#define PRIoLEAST32 __PRI32LEAST(o)
|
||||
#define PRIuLEAST32 __PRI32LEAST(u)
|
||||
#define PRIxLEAST32 __PRI32LEAST(x)
|
||||
#define PRIXLEAST32 __PRI32LEAST(X)
|
||||
|
||||
#define SCNdLEAST32 __SCN32LEAST(d)
|
||||
#define SCNiLEAST32 __SCN32LEAST(i)
|
||||
#define SCNoLEAST32 __SCN32LEAST(o)
|
||||
#define SCNuLEAST32 __SCN32LEAST(u)
|
||||
#define SCNxLEAST32 __SCN32LEAST(x)
|
||||
|
||||
|
||||
#define PRIdFAST32 __PRI32FAST(d)
|
||||
#define PRIiFAST32 __PRI32FAST(i)
|
||||
#define PRIoFAST32 __PRI32FAST(o)
|
||||
#define PRIuFAST32 __PRI32FAST(u)
|
||||
#define PRIxFAST32 __PRI32FAST(x)
|
||||
#define PRIXFAST32 __PRI32FAST(X)
|
||||
|
||||
#define SCNdFAST32 __SCN32FAST(d)
|
||||
#define SCNiFAST32 __SCN32FAST(i)
|
||||
#define SCNoFAST32 __SCN32FAST(o)
|
||||
#define SCNuFAST32 __SCN32FAST(u)
|
||||
#define SCNxFAST32 __SCN32FAST(x)
|
||||
|
||||
|
||||
/* 64-bit types */
|
||||
#define __PRI64(x) __INT64 __STRINGIFY(x)
|
||||
#define __SCN64(x) __INT64 __STRINGIFY(x)
|
||||
|
||||
#define __PRI64LEAST(x) __LEAST64 __STRINGIFY(x)
|
||||
#define __SCN64LEAST(x) __LEAST64 __STRINGIFY(x)
|
||||
#define __PRI64FAST(x) __FAST64 __STRINGIFY(x)
|
||||
#define __SCN64FAST(x) __FAST64 __STRINGIFY(x)
|
||||
|
||||
#if __int64_t_defined
|
||||
#define PRId64 __PRI64(d)
|
||||
#define PRIi64 __PRI64(i)
|
||||
#define PRIo64 __PRI64(o)
|
||||
#define PRIu64 __PRI64(u)
|
||||
#define PRIx64 __PRI64(x)
|
||||
#define PRIX64 __PRI64(X)
|
||||
|
||||
#define SCNd64 __SCN64(d)
|
||||
#define SCNi64 __SCN64(i)
|
||||
#define SCNo64 __SCN64(o)
|
||||
#define SCNu64 __SCN64(u)
|
||||
#define SCNx64 __SCN64(x)
|
||||
#endif
|
||||
|
||||
#if __int_least64_t_defined
|
||||
#define PRIdLEAST64 __PRI64LEAST(d)
|
||||
#define PRIiLEAST64 __PRI64LEAST(i)
|
||||
#define PRIoLEAST64 __PRI64LEAST(o)
|
||||
#define PRIuLEAST64 __PRI64LEAST(u)
|
||||
#define PRIxLEAST64 __PRI64LEAST(x)
|
||||
#define PRIXLEAST64 __PRI64LEAST(X)
|
||||
|
||||
#define SCNdLEAST64 __SCN64LEAST(d)
|
||||
#define SCNiLEAST64 __SCN64LEAST(i)
|
||||
#define SCNoLEAST64 __SCN64LEAST(o)
|
||||
#define SCNuLEAST64 __SCN64LEAST(u)
|
||||
#define SCNxLEAST64 __SCN64LEAST(x)
|
||||
#endif
|
||||
|
||||
#if __int_fast64_t_defined
|
||||
#define PRIdFAST64 __PRI64FAST(d)
|
||||
#define PRIiFAST64 __PRI64FAST(i)
|
||||
#define PRIoFAST64 __PRI64FAST(o)
|
||||
#define PRIuFAST64 __PRI64FAST(u)
|
||||
#define PRIxFAST64 __PRI64FAST(x)
|
||||
#define PRIXFAST64 __PRI64FAST(X)
|
||||
|
||||
#define SCNdFAST64 __SCN64FAST(d)
|
||||
#define SCNiFAST64 __SCN64FAST(i)
|
||||
#define SCNoFAST64 __SCN64FAST(o)
|
||||
#define SCNuFAST64 __SCN64FAST(u)
|
||||
#define SCNxFAST64 __SCN64FAST(x)
|
||||
#endif
|
||||
|
||||
/* max-bit types */
|
||||
#if __have_long64
|
||||
#define __PRIMAX(x) __STRINGIFY(l##x)
|
||||
#define __SCNMAX(x) __STRINGIFY(l##x)
|
||||
#elif __have_longlong64
|
||||
#define __PRIMAX(x) __STRINGIFY(ll##x)
|
||||
#define __SCNMAX(x) __STRINGIFY(ll##x)
|
||||
#else
|
||||
#define __PRIMAX(x) __STRINGIFY(x)
|
||||
#define __SCNMAX(x) __STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#define PRIdMAX __PRIMAX(d)
|
||||
#define PRIiMAX __PRIMAX(i)
|
||||
#define PRIoMAX __PRIMAX(o)
|
||||
#define PRIuMAX __PRIMAX(u)
|
||||
#define PRIxMAX __PRIMAX(x)
|
||||
#define PRIXMAX __PRIMAX(X)
|
||||
|
||||
#define SCNdMAX __SCNMAX(d)
|
||||
#define SCNiMAX __SCNMAX(i)
|
||||
#define SCNoMAX __SCNMAX(o)
|
||||
#define SCNuMAX __SCNMAX(u)
|
||||
#define SCNxMAX __SCNMAX(x)
|
||||
|
||||
/* ptr types */
|
||||
#if defined (_INTPTR_EQ_LONGLONG)
|
||||
# define __PRIPTR(x) __STRINGIFY(ll##x)
|
||||
# define __SCNPTR(x) __STRINGIFY(ll##x)
|
||||
#elif defined (_INTPTR_EQ_LONG)
|
||||
# define __PRIPTR(x) __STRINGIFY(l##x)
|
||||
# define __SCNPTR(x) __STRINGIFY(l##x)
|
||||
#else
|
||||
# define __PRIPTR(x) __STRINGIFY(x)
|
||||
# define __SCNPTR(x) __STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#define PRIdPTR __PRIPTR(d)
|
||||
#define PRIiPTR __PRIPTR(i)
|
||||
#define PRIoPTR __PRIPTR(o)
|
||||
#define PRIuPTR __PRIPTR(u)
|
||||
#define PRIxPTR __PRIPTR(x)
|
||||
#define PRIXPTR __PRIPTR(X)
|
||||
|
||||
#define SCNdPTR __SCNPTR(d)
|
||||
#define SCNiPTR __SCNPTR(i)
|
||||
#define SCNoPTR __SCNPTR(o)
|
||||
#define SCNuPTR __SCNPTR(u)
|
||||
#define SCNxPTR __SCNPTR(x)
|
||||
|
||||
|
||||
typedef struct {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
} imaxdiv_t;
|
||||
|
||||
struct _reent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern __stdargs intmax_t imaxabs(intmax_t j);
|
||||
extern __stdargs imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
|
||||
extern __stdargs intmax_t strtoimax(const char *__restrict, char **__restrict, int);
|
||||
extern __stdargs intmax_t _strtoimax_r(struct _reent *, const char *__restrict, char **__restrict, int);
|
||||
extern __stdargs uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
|
||||
extern __stdargs uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int);
|
||||
extern __stdargs intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
extern __stdargs intmax_t _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
extern __stdargs uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
extern __stdargs uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
extern __stdargs intmax_t strtoimax_l(const char *__restrict, char **_restrict, int, locale_t);
|
||||
extern __stdargs uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, locale_t);
|
||||
extern __stdargs intmax_t wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
|
||||
extern __stdargs uintmax_t wcstoumax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,333 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
|
||||
* 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 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.
|
||||
*
|
||||
* $FreeBSD: src/include/langinfo.h,v 1.5 2002/03/23 17:24:53 imp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LANGINFO_H_
|
||||
#define _LANGINFO_H_
|
||||
|
||||
#include <newlib.h>
|
||||
#include <sys/config.h>
|
||||
#include <sys/cdefs.h>
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#ifndef _NL_ITEM_DECLARED
|
||||
typedef int nl_item;
|
||||
#define _NL_ITEM_DECLARED
|
||||
#endif
|
||||
|
||||
enum __nl_item
|
||||
{
|
||||
/* POSIX and BSD defined items have to stick to the original values
|
||||
to maintain backward compatibility. */
|
||||
_NL_CTYPE_CODESET_NAME = 0, /* codeset name */
|
||||
#define CODESET _NL_CTYPE_CODESET_NAME
|
||||
D_T_FMT, /* string for formatting date and time */
|
||||
#define D_T_FMT D_T_FMT
|
||||
D_FMT, /* date format string */
|
||||
#define D_FMT D_FMT
|
||||
T_FMT, /* time format string */
|
||||
#define T_FMT T_FMT
|
||||
T_FMT_AMPM, /* a.m. or p.m. time formatting string */
|
||||
#define T_FMT_AMPM T_FMT_AMPM
|
||||
AM_STR, /* Ante Meridian affix */
|
||||
#define AM_STR AM_STR
|
||||
PM_STR, /* Post Meridian affix */
|
||||
#define PM_STR PM_STR
|
||||
|
||||
/* week day names */
|
||||
DAY_1,
|
||||
#define DAY_1 DAY_1
|
||||
DAY_2,
|
||||
#define DAY_2 DAY_2
|
||||
DAY_3,
|
||||
#define DAY_3 DAY_3
|
||||
DAY_4,
|
||||
#define DAY_4 DAY_4
|
||||
DAY_5,
|
||||
#define DAY_5 DAY_5
|
||||
DAY_6,
|
||||
#define DAY_6 DAY_6
|
||||
DAY_7,
|
||||
#define DAY_7 DAY_7
|
||||
|
||||
/* abbreviated week day names */
|
||||
ABDAY_1,
|
||||
#define ABDAY_1 ABDAY_1
|
||||
ABDAY_2,
|
||||
#define ABDAY_2 ABDAY_2
|
||||
ABDAY_3,
|
||||
#define ABDAY_3 ABDAY_3
|
||||
ABDAY_4,
|
||||
#define ABDAY_4 ABDAY_4
|
||||
ABDAY_5,
|
||||
#define ABDAY_5 ABDAY_5
|
||||
ABDAY_6,
|
||||
#define ABDAY_6 ABDAY_6
|
||||
ABDAY_7,
|
||||
#define ABDAY_7 ABDAY_7
|
||||
|
||||
/* month names */
|
||||
MON_1,
|
||||
#define MON_1 MON_1
|
||||
MON_2,
|
||||
#define MON_2 MON_2
|
||||
MON_3,
|
||||
#define MON_3 MON_3
|
||||
MON_4,
|
||||
#define MON_4 MON_4
|
||||
MON_5,
|
||||
#define MON_5 MON_5
|
||||
MON_6,
|
||||
#define MON_6 MON_6
|
||||
MON_7,
|
||||
#define MON_7 MON_7
|
||||
MON_8,
|
||||
#define MON_8 MON_8
|
||||
MON_9,
|
||||
#define MON_9 MON_9
|
||||
MON_10,
|
||||
#define MON_10 MON_10
|
||||
MON_11,
|
||||
#define MON_11 MON_11
|
||||
MON_12,
|
||||
#define MON_12 MON_12
|
||||
|
||||
/* abbreviated month names */
|
||||
ABMON_1,
|
||||
#define ABMON_1 ABMON_1
|
||||
ABMON_2,
|
||||
#define ABMON_2 ABMON_2
|
||||
ABMON_3,
|
||||
#define ABMON_3 ABMON_3
|
||||
ABMON_4,
|
||||
#define ABMON_4 ABMON_4
|
||||
ABMON_5,
|
||||
#define ABMON_5 ABMON_5
|
||||
ABMON_6,
|
||||
#define ABMON_6 ABMON_6
|
||||
ABMON_7,
|
||||
#define ABMON_7 ABMON_7
|
||||
ABMON_8,
|
||||
#define ABMON_8 ABMON_8
|
||||
ABMON_9,
|
||||
#define ABMON_9 ABMON_9
|
||||
ABMON_10,
|
||||
#define ABMON_10 ABMON_10
|
||||
ABMON_11,
|
||||
#define ABMON_11 ABMON_11
|
||||
ABMON_12,
|
||||
#define ABMON_12 ABMON_12
|
||||
|
||||
ERA, /* era description segments */
|
||||
#define ERA ERA
|
||||
ERA_D_FMT, /* era date format string */
|
||||
#define ERA_D_FMT ERA_D_FMT
|
||||
ERA_D_T_FMT, /* era date and time format string */
|
||||
#define ERA_D_T_FMT ERA_D_T_FMT
|
||||
ERA_T_FMT, /* era time format string */
|
||||
#define ERA_T_FMT ERA_T_FMT
|
||||
ALT_DIGITS, /* alternative symbols for digits */
|
||||
#define ALT_DIGITS ALT_DIGITS
|
||||
|
||||
RADIXCHAR, /* radix char */
|
||||
#define RADIXCHAR RADIXCHAR
|
||||
THOUSEP, /* separator for thousands */
|
||||
#define THOUSEP THOUSEP
|
||||
|
||||
YESEXPR, /* affirmative response expression */
|
||||
#define YESEXPR YESEXPR
|
||||
NOEXPR, /* negative response expression */
|
||||
#define NOEXPR NOEXPR
|
||||
YESSTR, /* affirmative response for yes/no queries */
|
||||
#define YESSTR YESSTR
|
||||
NOSTR, /* negative response for yes/no queries */
|
||||
#define NOSTR NOSTR
|
||||
|
||||
CRNCYSTR, /* currency symbol */
|
||||
#define CRNCYSTR CRNCYSTR
|
||||
|
||||
D_MD_ORDER, /* month/day order (BSD extension) */
|
||||
#define D_MD_ORDER D_MD_ORDER
|
||||
|
||||
_NL_TIME_DATE_FMT = 84, /* date fmt used by date(1) (GNU extension) */
|
||||
#define _DATE_FMT _NL_TIME_DATE_FMT
|
||||
|
||||
#ifdef __HAVE_LOCALE_INFO__
|
||||
_NL_CTYPE_MB_CUR_MAX,
|
||||
_NL_MESSAGES_CODESET,
|
||||
|
||||
#ifdef __HAVE_LOCALE_INFO_EXTENDED__
|
||||
|
||||
/* NOTE:
|
||||
|
||||
Always maintain the order and position of existing entries!
|
||||
Always append new entry to the list, prior to the definition
|
||||
of _NL_LOCALE_EXTENDED_LAST_ENTRY. */
|
||||
|
||||
_NL_LOCALE_EXTENDED_FIRST_ENTRY,
|
||||
|
||||
_NL_CTYPE_OUTDIGITS0_MB,
|
||||
_NL_CTYPE_OUTDIGITS1_MB,
|
||||
_NL_CTYPE_OUTDIGITS2_MB,
|
||||
_NL_CTYPE_OUTDIGITS3_MB,
|
||||
_NL_CTYPE_OUTDIGITS4_MB,
|
||||
_NL_CTYPE_OUTDIGITS5_MB,
|
||||
_NL_CTYPE_OUTDIGITS6_MB,
|
||||
_NL_CTYPE_OUTDIGITS7_MB,
|
||||
_NL_CTYPE_OUTDIGITS8_MB,
|
||||
_NL_CTYPE_OUTDIGITS9_MB,
|
||||
_NL_CTYPE_OUTDIGITS0_WC,
|
||||
_NL_CTYPE_OUTDIGITS1_WC,
|
||||
_NL_CTYPE_OUTDIGITS2_WC,
|
||||
_NL_CTYPE_OUTDIGITS3_WC,
|
||||
_NL_CTYPE_OUTDIGITS4_WC,
|
||||
_NL_CTYPE_OUTDIGITS5_WC,
|
||||
_NL_CTYPE_OUTDIGITS6_WC,
|
||||
_NL_CTYPE_OUTDIGITS7_WC,
|
||||
_NL_CTYPE_OUTDIGITS8_WC,
|
||||
_NL_CTYPE_OUTDIGITS9_WC,
|
||||
|
||||
_NL_TIME_CODESET,
|
||||
_NL_TIME_WMON_1,
|
||||
_NL_TIME_WMON_2,
|
||||
_NL_TIME_WMON_3,
|
||||
_NL_TIME_WMON_4,
|
||||
_NL_TIME_WMON_5,
|
||||
_NL_TIME_WMON_6,
|
||||
_NL_TIME_WMON_7,
|
||||
_NL_TIME_WMON_8,
|
||||
_NL_TIME_WMON_9,
|
||||
_NL_TIME_WMON_10,
|
||||
_NL_TIME_WMON_11,
|
||||
_NL_TIME_WMON_12,
|
||||
_NL_TIME_WMONTH_1,
|
||||
_NL_TIME_WMONTH_2,
|
||||
_NL_TIME_WMONTH_3,
|
||||
_NL_TIME_WMONTH_4,
|
||||
_NL_TIME_WMONTH_5,
|
||||
_NL_TIME_WMONTH_6,
|
||||
_NL_TIME_WMONTH_7,
|
||||
_NL_TIME_WMONTH_8,
|
||||
_NL_TIME_WMONTH_9,
|
||||
_NL_TIME_WMONTH_10,
|
||||
_NL_TIME_WMONTH_11,
|
||||
_NL_TIME_WMONTH_12,
|
||||
_NL_TIME_WWDAY_1,
|
||||
_NL_TIME_WWDAY_2,
|
||||
_NL_TIME_WWDAY_3,
|
||||
_NL_TIME_WWDAY_4,
|
||||
_NL_TIME_WWDAY_5,
|
||||
_NL_TIME_WWDAY_6,
|
||||
_NL_TIME_WWDAY_7,
|
||||
_NL_TIME_WWEEKDAY_1,
|
||||
_NL_TIME_WWEEKDAY_2,
|
||||
_NL_TIME_WWEEKDAY_3,
|
||||
_NL_TIME_WWEEKDAY_4,
|
||||
_NL_TIME_WWEEKDAY_5,
|
||||
_NL_TIME_WWEEKDAY_6,
|
||||
_NL_TIME_WWEEKDAY_7,
|
||||
_NL_TIME_WT_FMT,
|
||||
_NL_TIME_WD_FMT,
|
||||
_NL_TIME_WD_T_FMT,
|
||||
_NL_TIME_WAM_STR,
|
||||
_NL_TIME_WPM_STR,
|
||||
_NL_TIME_WDATE_FMT,
|
||||
_NL_TIME_WT_FMT_AMPM,
|
||||
_NL_TIME_WERA,
|
||||
_NL_TIME_WERA_D_FMT,
|
||||
_NL_TIME_WERA_D_T_FMT,
|
||||
_NL_TIME_WERA_T_FMT,
|
||||
_NL_TIME_WALT_DIGITS,
|
||||
|
||||
_NL_NUMERIC_CODESET,
|
||||
_NL_NUMERIC_GROUPING,
|
||||
_NL_NUMERIC_DECIMAL_POINT_WC,
|
||||
_NL_NUMERIC_THOUSANDS_SEP_WC,
|
||||
|
||||
_NL_MONETARY_INT_CURR_SYMBOL,
|
||||
_NL_MONETARY_CURRENCY_SYMBOL,
|
||||
_NL_MONETARY_MON_DECIMAL_POINT,
|
||||
_NL_MONETARY_MON_THOUSANDS_SEP,
|
||||
_NL_MONETARY_MON_GROUPING,
|
||||
_NL_MONETARY_POSITIVE_SIGN,
|
||||
_NL_MONETARY_NEGATIVE_SIGN,
|
||||
_NL_MONETARY_INT_FRAC_DIGITS,
|
||||
_NL_MONETARY_FRAC_DIGITS,
|
||||
_NL_MONETARY_P_CS_PRECEDES,
|
||||
_NL_MONETARY_P_SEP_BY_SPACE,
|
||||
_NL_MONETARY_N_CS_PRECEDES,
|
||||
_NL_MONETARY_N_SEP_BY_SPACE,
|
||||
_NL_MONETARY_P_SIGN_POSN,
|
||||
_NL_MONETARY_N_SIGN_POSN,
|
||||
_NL_MONETARY_INT_P_CS_PRECEDES,
|
||||
_NL_MONETARY_INT_P_SEP_BY_SPACE,
|
||||
_NL_MONETARY_INT_N_CS_PRECEDES,
|
||||
_NL_MONETARY_INT_N_SEP_BY_SPACE,
|
||||
_NL_MONETARY_INT_P_SIGN_POSN,
|
||||
_NL_MONETARY_INT_N_SIGN_POSN,
|
||||
_NL_MONETARY_CODESET,
|
||||
_NL_MONETARY_WINT_CURR_SYMBOL,
|
||||
_NL_MONETARY_WCURRENCY_SYMBOL,
|
||||
_NL_MONETARY_WMON_DECIMAL_POINT,
|
||||
_NL_MONETARY_WMON_THOUSANDS_SEP,
|
||||
_NL_MONETARY_WPOSITIVE_SIGN,
|
||||
_NL_MONETARY_WNEGATIVE_SIGN,
|
||||
|
||||
_NL_MESSAGES_WYESEXPR,
|
||||
_NL_MESSAGES_WNOEXPR,
|
||||
_NL_MESSAGES_WYESSTR,
|
||||
_NL_MESSAGES_WNOSTR,
|
||||
|
||||
_NL_COLLATE_CODESET,
|
||||
|
||||
/* This MUST be the last entry since it's used to check for an array
|
||||
index in nl_langinfo(). It also must not exceed _NL_LOCALE_NAME_BASE. */
|
||||
_NL_LOCALE_EXTENDED_LAST_ENTRY
|
||||
|
||||
#endif /* __HAVE_LOCALE_INFO_EXTENDED__ */
|
||||
#endif /* __HAVE_LOCALE_INFO__ */
|
||||
|
||||
};
|
||||
|
||||
/* As an extension, nl_langinfo can retrive the name of a locale
|
||||
category, with this mapping from setlocale() category (other than
|
||||
LC_ALL) to nl_item. */
|
||||
#define _NL_LOCALE_NAME_BASE 100000
|
||||
#if __GNU_VISIBLE
|
||||
#define NL_LOCALE_NAME(category) (_NL_LOCALE_NAME_BASE + (category))
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs char *nl_langinfo (nl_item);
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
__stdargs char *nl_langinfo_l (nl_item, locale_t);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_LANGINFO_H_ */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* libgen.h - defined by XPG4
|
||||
*/
|
||||
|
||||
#ifndef _LIBGEN_H_
|
||||
#define _LIBGEN_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/reent.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* There are two common basename variants. If you do NOT #include <libgen.h>
|
||||
and you do
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
|
||||
you get the GNU version. Otherwise you get the POSIX versionfor which you
|
||||
should #include <libgen.h>i for the function prototype. POSIX requires that
|
||||
#undef basename will still let you invoke the underlying function. However,
|
||||
this also implies that the POSIX version is used in this case. That's made
|
||||
sure here. */
|
||||
#undef basename
|
||||
#define basename __xpg_basename
|
||||
__stdargs char *basename (char *) __asm__(__ASMNAME("basename"));
|
||||
__stdargs char *dirname (char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LIBGEN_H_ */
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#ifndef _HEADERS_LIBINIT_H
|
||||
#define _HEADERS_LIBINIT_H
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* special define(s) */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
#if !defined(REG)
|
||||
#define REG(reg,arg) arg __asm(#reg)
|
||||
#endif
|
||||
|
||||
#include <exec/resident.h>
|
||||
#include <exec/libraries.h>
|
||||
#include <proto/exec.h>
|
||||
#include "stabs.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* structure definition for a *** PRIVATE *** library/device base */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct libBase {
|
||||
struct Library LibNode;
|
||||
UWORD Pad;
|
||||
LONG SegList;
|
||||
APTR DataSeg,
|
||||
SysBase;
|
||||
#ifdef EXTENDED
|
||||
ULONG DataSize;
|
||||
struct libBase *Parent;
|
||||
#endif
|
||||
} *__LIB, *__DEV;
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* prototypes for basic library functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
LONG LibExtFunc(VOID);
|
||||
LONG LibExpunge(REG(a6,__LIB));
|
||||
LONG LibClose(REG(a6,__LIB));
|
||||
APTR LibOpen(REG(a6,__LIB));
|
||||
APTR LibInit(REG(a0,LONG),REG(d0,__LIB),REG(a6,struct Library *));
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* prototypes for basic device functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
LONG DevExtFunc(VOID);
|
||||
LONG DevExpunge(REG(a6,__DEV));
|
||||
LONG DevClose(REG(a1,APTR),REG(a6,__DEV));
|
||||
VOID DevOpen(REG(d0,ULONG),REG(a1,APTR),REG(d1,ULONG),REG(a6,__DEV));
|
||||
APTR DevInit(REG(a0,LONG),REG(d0,__DEV),REG(a6,struct Library *));
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* imports */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
extern LONG __stdargs __UserLibInit(struct Library *,REG(a4,APTR));
|
||||
extern VOID __stdargs __UserLibCleanup(REG(a4,APTR));
|
||||
|
||||
extern const UWORD LibVersion;
|
||||
extern const UWORD LibRevision;
|
||||
extern const char LibIdString[];
|
||||
extern const char LibName[];
|
||||
|
||||
extern LONG __stdargs __UserDevInit(struct Library *,REG(a4,APTR));
|
||||
extern LONG __stdargs __UserDevOpen(struct IORequest *,ULONG,ULONG,REG(a4,APTR));
|
||||
extern VOID __stdargs __UserDevClose(struct IORequest *,REG(a4,APTR));
|
||||
extern VOID __stdargs __UserDevCleanup(REG(a4,APTR));
|
||||
|
||||
extern const UWORD DevVersion;
|
||||
extern const UWORD DevRevision;
|
||||
extern const char DevIdString[];
|
||||
extern const char DevName[];
|
||||
|
||||
extern APTR __LibTable__[];
|
||||
extern APTR __FuncTable__[];
|
||||
|
||||
extern LONG __datadata_relocs[];
|
||||
|
||||
#endif /* _HEADERS_LIBINIT_H */
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#endif // _LIBINTL_H
|
||||
@@ -0,0 +1,146 @@
|
||||
#ifndef _LIBC_LIMITS_H_
|
||||
# define _LIBC_LIMITS_H_ 1
|
||||
|
||||
#include <newlib.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
# ifdef _MB_LEN_MAX
|
||||
# define MB_LEN_MAX _MB_LEN_MAX
|
||||
# else
|
||||
# define MB_LEN_MAX 1
|
||||
# endif
|
||||
|
||||
/* Maximum number of positional arguments, if _WANT_IO_POS_ARGS. */
|
||||
# ifndef NL_ARGMAX
|
||||
# define NL_ARGMAX 32
|
||||
# endif
|
||||
|
||||
/* if do not have #include_next support, then we
|
||||
have to define the limits here. */
|
||||
# if !defined __GNUC__ || __GNUC__ < 2 || !defined(LONG_LONG_MIN)
|
||||
|
||||
# ifndef _LIMITS_H
|
||||
# define _LIMITS_H 1
|
||||
|
||||
# include <sys/config.h>
|
||||
|
||||
/* Number of bits in a `char'. */
|
||||
# undef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
# undef SCHAR_MIN
|
||||
# define SCHAR_MIN (-128)
|
||||
# undef SCHAR_MAX
|
||||
# define SCHAR_MAX 127
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
|
||||
# undef UCHAR_MAX
|
||||
# define UCHAR_MAX 255
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
# ifdef __CHAR_UNSIGNED__
|
||||
# undef CHAR_MIN
|
||||
# define CHAR_MIN 0
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX 255
|
||||
# else
|
||||
# undef CHAR_MIN
|
||||
# define CHAR_MIN (-128)
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX 127
|
||||
# endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
# undef SHRT_MIN
|
||||
/* For the sake of 16 bit hosts, we may not use -32768 */
|
||||
# define SHRT_MIN (-32767-1)
|
||||
# undef SHRT_MAX
|
||||
# define SHRT_MAX 32767
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
|
||||
# undef USHRT_MAX
|
||||
# define USHRT_MAX 65535
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
# ifndef __INT_MAX__
|
||||
# define __INT_MAX__ 2147483647
|
||||
# endif
|
||||
# undef INT_MIN
|
||||
# define INT_MIN (-INT_MAX-1)
|
||||
# undef INT_MAX
|
||||
# define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
|
||||
# undef UINT_MAX
|
||||
# define UINT_MAX (INT_MAX * 2U + 1)
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold.
|
||||
(Same as `int'). */
|
||||
# ifndef __LONG_MAX__
|
||||
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9)
|
||||
# define __LONG_MAX__ 9223372036854775807L
|
||||
# else
|
||||
# define __LONG_MAX__ 2147483647L
|
||||
# endif /* __alpha__ || sparc64 */
|
||||
# endif
|
||||
# undef LONG_MIN
|
||||
# define LONG_MIN (-LONG_MAX-1)
|
||||
# undef LONG_MAX
|
||||
# define LONG_MAX __LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
|
||||
# undef ULONG_MAX
|
||||
# define ULONG_MAX (LONG_MAX * 2UL + 1)
|
||||
|
||||
# ifndef __LONG_LONG_MAX__
|
||||
# define __LONG_LONG_MAX__ 9223372036854775807LL
|
||||
# endif
|
||||
|
||||
# if __ISO_C_VISIBLE >= 1999
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LLONG_MIN
|
||||
# define LLONG_MIN (-LLONG_MAX-1)
|
||||
# undef LLONG_MAX
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
|
||||
# endif
|
||||
|
||||
# if __GNU_VISIBLE
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
# undef LONG_LONG_MIN
|
||||
# define LONG_LONG_MIN (-LONG_LONG_MAX-1)
|
||||
# undef LONG_LONG_MAX
|
||||
# define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
# undef ULONG_LONG_MAX
|
||||
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
|
||||
# endif
|
||||
|
||||
# endif /* _LIMITS_H */
|
||||
# endif /* GCC 2. */
|
||||
|
||||
#endif /* !_LIBC_LIMITS_H_ */
|
||||
|
||||
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
|
||||
/* `_GCC_LIMITS_H_' is what GCC's file defines. */
|
||||
//# include_next <limits.h>
|
||||
#endif /* __GNUC__ && !_GCC_LIMITS_H_ */
|
||||
|
||||
#ifndef _POSIX2_RE_DUP_MAX
|
||||
/* The maximum number of repeated occurrences of a regular expression
|
||||
* permitted when using the interval notation `\{M,N\}'. */
|
||||
#define _POSIX2_RE_DUP_MAX 255
|
||||
#endif /* _POSIX2_RE_DUP_MAX */
|
||||
|
||||
#ifndef ARG_MAX
|
||||
#define ARG_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
locale.h
|
||||
Values appropriate for the formatting of monetary and other
|
||||
numberic quantities.
|
||||
*/
|
||||
|
||||
#ifndef _LOCALE_H_
|
||||
#define _LOCALE_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#define LC_ALL 0
|
||||
#define LC_COLLATE 1
|
||||
#define LC_CTYPE 2
|
||||
#define LC_MONETARY 3
|
||||
#define LC_NUMERIC 4
|
||||
#define LC_TIME 5
|
||||
#define LC_MESSAGES 6
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
|
||||
|
||||
#include <xlocale.h>
|
||||
|
||||
#define LC_ALL_MASK (1 << LC_ALL)
|
||||
#define LC_COLLATE_MASK (1 << LC_COLLATE)
|
||||
#define LC_CTYPE_MASK (1 << LC_CTYPE)
|
||||
#define LC_MONETARY_MASK (1 << LC_MONETARY)
|
||||
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
|
||||
#define LC_TIME_MASK (1 << LC_TIME)
|
||||
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
|
||||
|
||||
#define LC_GLOBAL_LOCALE ((struct __locale_t *) -1)
|
||||
|
||||
#endif /* __POSIX_VISIBLE >= 200809 */
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
struct lconv
|
||||
{
|
||||
char *decimal_point;
|
||||
char *thousands_sep;
|
||||
char *grouping;
|
||||
char *int_curr_symbol;
|
||||
char *currency_symbol;
|
||||
char *mon_decimal_point;
|
||||
char *mon_thousands_sep;
|
||||
char *mon_grouping;
|
||||
char *positive_sign;
|
||||
char *negative_sign;
|
||||
char int_frac_digits;
|
||||
char frac_digits;
|
||||
char p_cs_precedes;
|
||||
char p_sep_by_space;
|
||||
char n_cs_precedes;
|
||||
char n_sep_by_space;
|
||||
char p_sign_posn;
|
||||
char n_sign_posn;
|
||||
char int_n_cs_precedes;
|
||||
char int_n_sep_by_space;
|
||||
char int_n_sign_posn;
|
||||
char int_p_cs_precedes;
|
||||
char int_p_sep_by_space;
|
||||
char int_p_sign_posn;
|
||||
};
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
struct _reent;
|
||||
__stdargs char *_setlocale_r (struct _reent *, int, const char *);
|
||||
__stdargs struct lconv *_localeconv_r (struct _reent *);
|
||||
|
||||
__stdargs struct __locale_t *_newlocale_r (struct _reent *, int, const char *,
|
||||
struct __locale_t *);
|
||||
__stdargs void _freelocale_r (struct _reent *, struct __locale_t *);
|
||||
__stdargs struct __locale_t *_duplocale_r (struct _reent *, struct __locale_t *);
|
||||
__stdargs struct __locale_t *_uselocale_r (struct _reent *, struct __locale_t *);
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
__stdargs char *setlocale (int, const char *);
|
||||
__stdargs struct lconv *localeconv (void);
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
__stdargs locale_t newlocale (int, const char *, locale_t);
|
||||
__stdargs void freelocale (locale_t);
|
||||
__stdargs locale_t duplocale (locale_t);
|
||||
__stdargs locale_t uselocale (locale_t);
|
||||
#endif /* __POSIX_VISIBLE >= 200809 */
|
||||
|
||||
#endif /* _REENT_ONLY */
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _LOCALE_H_ */
|
||||
@@ -0,0 +1 @@
|
||||
/* Use default implementation, see arc4random.h */
|
||||
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE__DEFAULT_TYPES_H
|
||||
#define _MACHINE__DEFAULT_TYPES_H
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/features.h>
|
||||
|
||||
/*
|
||||
* Guess on types by examining *_MIN / *_MAX defines.
|
||||
*/
|
||||
#if __GNUC_PREREQ (3, 3)
|
||||
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
|
||||
#define __EXP(x) __##x##__
|
||||
#else
|
||||
/* Fall back to POSIX versions from <limits.h> */
|
||||
#define __EXP(x) x
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Check if "long long" is 64bit wide */
|
||||
/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
|
||||
#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
|
||||
|| ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
|
||||
#define __have_longlong64 1
|
||||
#endif
|
||||
|
||||
/* Check if "long" is 64bit or 32bit wide */
|
||||
#if __EXP(LONG_MAX) > 0x7fffffff
|
||||
#define __have_long64 1
|
||||
#elif __EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
|
||||
#define __have_long32 1
|
||||
#endif
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
#ifndef __INT8_TYPE__
|
||||
#define __INT8_TYPE__ char
|
||||
#endif
|
||||
|
||||
#ifndef __INT16_TYPE__
|
||||
#define __INT16_TYPE__ short
|
||||
#endif
|
||||
|
||||
#ifndef __INT32_TYPE__
|
||||
#define __INT32_TYPE__ long int
|
||||
#endif
|
||||
|
||||
#ifndef __INT64_TYPE__
|
||||
#define __INT64_TYPE__ long long int
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
typedef __INT8_TYPE__ __int8_t;
|
||||
#ifdef __UINT8_TYPE__
|
||||
typedef __UINT8_TYPE__ __uint8_t;
|
||||
#else
|
||||
typedef unsigned __INT8_TYPE__ __uint8_t;
|
||||
#endif
|
||||
#define ___int8_t_defined 1
|
||||
#elif __EXP(SCHAR_MAX) == 0x7f
|
||||
typedef char __int8_t ;
|
||||
typedef unsigned char __uint8_t ;
|
||||
#define ___int8_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
typedef __INT16_TYPE__ __int16_t;
|
||||
#ifdef __UINT16_TYPE__
|
||||
typedef __UINT16_TYPE__ __uint16_t;
|
||||
#else
|
||||
typedef unsigned __INT16_TYPE__ __uint16_t;
|
||||
#endif
|
||||
#define ___int16_t_defined 1
|
||||
#elif __EXP(INT_MAX) == 0x7fff
|
||||
typedef signed int __int16_t;
|
||||
typedef unsigned int __uint16_t;
|
||||
#define ___int16_t_defined 1
|
||||
#elif __EXP(SHRT_MAX) == 0x7fff
|
||||
typedef signed short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
#define ___int16_t_defined 1
|
||||
#elif __EXP(SCHAR_MAX) == 0x7fff
|
||||
typedef signed char __int16_t;
|
||||
typedef unsigned char __uint16_t;
|
||||
#define ___int16_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
typedef __INT32_TYPE__ __int32_t;
|
||||
#ifdef __UINT32_TYPE__
|
||||
typedef __UINT32_TYPE__ __uint32_t;
|
||||
#else
|
||||
typedef unsigned __INT32_TYPE__ __uint32_t;
|
||||
#endif
|
||||
#define ___int32_t_defined 1
|
||||
#elif __EXP(INT_MAX) == 0x7fffffffL
|
||||
typedef signed int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
#define ___int32_t_defined 1
|
||||
#elif __EXP(LONG_MAX) == 0x7fffffffL
|
||||
typedef signed long __int32_t;
|
||||
typedef unsigned long __uint32_t;
|
||||
#define ___int32_t_defined 1
|
||||
#elif __EXP(SHRT_MAX) == 0x7fffffffL
|
||||
typedef signed short __int32_t;
|
||||
typedef unsigned short __uint32_t;
|
||||
#define ___int32_t_defined 1
|
||||
#elif __EXP(SCHAR_MAX) == 0x7fffffffL
|
||||
typedef signed char __int32_t;
|
||||
typedef unsigned char __uint32_t;
|
||||
#define ___int32_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
typedef __INT64_TYPE__ __int64_t;
|
||||
#ifdef __UINT64_TYPE__
|
||||
typedef __UINT64_TYPE__ __uint64_t;
|
||||
#else
|
||||
typedef unsigned __INT64_TYPE__ __uint64_t;
|
||||
#endif
|
||||
#define ___int64_t_defined 1
|
||||
#elif __EXP(LONG_MAX) > 0x7fffffff
|
||||
typedef signed long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
#define ___int64_t_defined 1
|
||||
|
||||
/* GCC has __LONG_LONG_MAX__ */
|
||||
#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
|
||||
typedef signed long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
#define ___int64_t_defined 1
|
||||
|
||||
/* POSIX mandates LLONG_MAX in <limits.h> */
|
||||
#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
|
||||
typedef signed long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
#define ___int64_t_defined 1
|
||||
|
||||
#elif __EXP(INT_MAX) > 0x7fffffff
|
||||
typedef signed int __int64_t;
|
||||
typedef unsigned int __uint64_t;
|
||||
#define ___int64_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST8_TYPE__
|
||||
typedef __INT_LEAST8_TYPE__ __int_least8_t;
|
||||
#ifdef __UINT_LEAST8_TYPE__
|
||||
typedef __UINT_LEAST8_TYPE__ __uint_least8_t;
|
||||
#else
|
||||
typedef unsigned __INT_LEAST8_TYPE__ __uint_least8_t;
|
||||
#endif
|
||||
#define ___int_least8_t_defined 1
|
||||
#elif defined(___int8_t_defined)
|
||||
typedef __int8_t __int_least8_t;
|
||||
typedef __uint8_t __uint_least8_t;
|
||||
#define ___int_least8_t_defined 1
|
||||
#elif defined(___int16_t_defined)
|
||||
typedef __int16_t __int_least8_t;
|
||||
typedef __uint16_t __uint_least8_t;
|
||||
#define ___int_least8_t_defined 1
|
||||
#elif defined(___int32_t_defined)
|
||||
typedef __int32_t __int_least8_t;
|
||||
typedef __uint32_t __uint_least8_t;
|
||||
#define ___int_least8_t_defined 1
|
||||
#elif defined(___int64_t_defined)
|
||||
typedef __int64_t __int_least8_t;
|
||||
typedef __uint64_t __uint_least8_t;
|
||||
#define ___int_least8_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST16_TYPE__
|
||||
typedef __INT_LEAST16_TYPE__ __int_least16_t;
|
||||
#ifdef __UINT_LEAST16_TYPE__
|
||||
typedef __UINT_LEAST16_TYPE__ __uint_least16_t;
|
||||
#else
|
||||
typedef unsigned __INT_LEAST16_TYPE__ __uint_least16_t;
|
||||
#endif
|
||||
#define ___int_least16_t_defined 1
|
||||
#elif defined(___int16_t_defined)
|
||||
typedef __int16_t __int_least16_t;
|
||||
typedef __uint16_t __uint_least16_t;
|
||||
#define ___int_least16_t_defined 1
|
||||
#elif defined(___int32_t_defined)
|
||||
typedef __int32_t __int_least16_t;
|
||||
typedef __uint32_t __uint_least16_t;
|
||||
#define ___int_least16_t_defined 1
|
||||
#elif defined(___int64_t_defined)
|
||||
typedef __int64_t __int_least16_t;
|
||||
typedef __uint64_t __uint_least16_t;
|
||||
#define ___int_least16_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST32_TYPE__
|
||||
typedef __INT_LEAST32_TYPE__ __int_least32_t;
|
||||
#ifdef __UINT_LEAST32_TYPE__
|
||||
typedef __UINT_LEAST32_TYPE__ __uint_least32_t;
|
||||
#else
|
||||
typedef unsigned __INT_LEAST32_TYPE__ __uint_least32_t;
|
||||
#endif
|
||||
#define ___int_least32_t_defined 1
|
||||
#elif defined(___int32_t_defined)
|
||||
typedef __int32_t __int_least32_t;
|
||||
typedef __uint32_t __uint_least32_t;
|
||||
#define ___int_least32_t_defined 1
|
||||
#elif defined(___int64_t_defined)
|
||||
typedef __int64_t __int_least32_t;
|
||||
typedef __uint64_t __uint_least32_t;
|
||||
#define ___int_least32_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST64_TYPE__
|
||||
typedef __INT_LEAST64_TYPE__ __int_least64_t;
|
||||
#ifdef __UINT_LEAST64_TYPE__
|
||||
typedef __UINT_LEAST64_TYPE__ __uint_least64_t;
|
||||
#else
|
||||
typedef unsigned __INT_LEAST64_TYPE__ __uint_least64_t;
|
||||
#endif
|
||||
#define ___int_least64_t_defined 1
|
||||
#elif defined(___int64_t_defined)
|
||||
typedef __int64_t __int_least64_t;
|
||||
typedef __uint64_t __uint_least64_t;
|
||||
#define ___int_least64_t_defined 1
|
||||
#endif
|
||||
|
||||
#if defined(__INTMAX_TYPE__)
|
||||
typedef __INTMAX_TYPE__ __intmax_t;
|
||||
#elif __have_longlong64
|
||||
typedef signed long long __intmax_t;
|
||||
#else
|
||||
typedef signed long __intmax_t;
|
||||
#endif
|
||||
|
||||
#if defined(__UINTMAX_TYPE__)
|
||||
typedef __UINTMAX_TYPE__ __uintmax_t;
|
||||
#elif __have_longlong64
|
||||
typedef unsigned long long __uintmax_t;
|
||||
#else
|
||||
typedef unsigned long __uintmax_t;
|
||||
#endif
|
||||
|
||||
#ifdef __INTPTR_TYPE__
|
||||
typedef __INTPTR_TYPE__ __intptr_t;
|
||||
#ifdef __UINTPTR_TYPE__
|
||||
typedef __UINTPTR_TYPE__ __uintptr_t;
|
||||
#else
|
||||
typedef unsigned __INTPTR_TYPE__ __uintptr_t;
|
||||
#endif
|
||||
#elif defined(__PTRDIFF_TYPE__)
|
||||
typedef __PTRDIFF_TYPE__ __intptr_t;
|
||||
typedef unsigned __PTRDIFF_TYPE__ __uintptr_t;
|
||||
#else
|
||||
typedef long __intptr_t;
|
||||
typedef unsigned long __uintptr_t;
|
||||
#endif
|
||||
|
||||
#undef __EXP
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _MACHINE__DEFAULT_TYPES_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef __MACHINE_ENDIAN_H__
|
||||
#error "must be included via <machine/endian.h>"
|
||||
#endif /* !__MACHINE_ENDIAN_H__ */
|
||||
|
||||
#include <sys/config.h>
|
||||
|
||||
#ifdef __PPC__
|
||||
/* Get rid of GCC builtin defines on PowerPC */
|
||||
#ifdef _BIG_ENDIAN
|
||||
#undef _BIG_ENDIAN
|
||||
#endif
|
||||
#ifdef _LITTLE_ENDIAN
|
||||
#undef _LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif /* __PPC__ */
|
||||
|
||||
#ifndef _LITTLE_ENDIAN
|
||||
#define _LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
#ifndef _BIG_ENDIAN
|
||||
#define _BIG_ENDIAN 4321
|
||||
#endif
|
||||
|
||||
#ifndef _PDP_ENDIAN
|
||||
#define _PDP_ENDIAN 3412
|
||||
#endif
|
||||
|
||||
#ifndef _BYTE_ORDER
|
||||
#if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BYTES_LITTLE_ENDIAN)
|
||||
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||
#else
|
||||
#define _BYTE_ORDER _BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
#ifndef _SYS_TIME_H_
|
||||
#error "must be included via <sys/time.h>"
|
||||
#endif /* !_SYS_TIME_H_ */
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE__TYPES_H
|
||||
#define _MACHINE__TYPES_H
|
||||
#include <machine/_default_types.h>
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
/* dummy header file to support BSD compiler */
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef __MACHINE_ENDIAN_H__
|
||||
#define __MACHINE_ENDIAN_H__
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
#include <machine/_endian.h>
|
||||
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define _QUAD_HIGHWORD 1
|
||||
#define _QUAD_LOWWORD 0
|
||||
#else
|
||||
#define _QUAD_HIGHWORD 0
|
||||
#define _QUAD_LOWWORD 1
|
||||
#endif
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#define LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
#define BIG_ENDIAN _BIG_ENDIAN
|
||||
#define PDP_ENDIAN _PDP_ENDIAN
|
||||
#define BYTE_ORDER _BYTE_ORDER
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __bswap16(_x) __builtin_bswap16(_x)
|
||||
#define __bswap32(_x) __builtin_bswap32(_x)
|
||||
#define __bswap64(_x) __builtin_bswap64(_x)
|
||||
#else /* __GNUC__ */
|
||||
static __inline __uint16_t
|
||||
__bswap16(__uint16_t _x)
|
||||
{
|
||||
|
||||
return ((__uint16_t)((_x >> 8) | ((_x << 8) & 0xff00)));
|
||||
}
|
||||
|
||||
static __inline __uint32_t
|
||||
__bswap32(__uint32_t _x)
|
||||
{
|
||||
|
||||
return ((__uint32_t)((_x >> 24) | ((_x >> 8) & 0xff00) |
|
||||
((_x << 8) & 0xff0000) | ((_x << 24) & 0xff000000)));
|
||||
}
|
||||
|
||||
static __inline __uint64_t
|
||||
__bswap64(__uint64_t _x)
|
||||
{
|
||||
|
||||
return ((__uint64_t)((_x >> 56) | ((_x >> 40) & 0xff00) |
|
||||
((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) |
|
||||
((_x << 8) & ((__uint64_t)0xff << 32)) |
|
||||
((_x << 24) & ((__uint64_t)0xff << 40)) |
|
||||
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))));
|
||||
}
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
#ifndef __machine_host_to_from_network_defined
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define __htonl(_x) __bswap32(_x)
|
||||
#define __htons(_x) __bswap16(_x)
|
||||
#define __ntohl(_x) __bswap32(_x)
|
||||
#define __ntohs(_x) __bswap16(_x)
|
||||
#else
|
||||
#define __htonl(_x) ((__uint32_t)(_x))
|
||||
#define __htons(_x) ((__uint16_t)(_x))
|
||||
#define __ntohl(_x) ((__uint32_t)(_x))
|
||||
#define __ntohs(_x) ((__uint16_t)(_x))
|
||||
#endif
|
||||
#endif /* __machine_host_to_from_network_defined */
|
||||
|
||||
#endif /* __MACHINE_ENDIAN_H__ */
|
||||
@@ -0,0 +1,98 @@
|
||||
#ifdef __sysvnecv70_target
|
||||
__stdargs double EXFUN(fast_sin,(double));
|
||||
__stdargs double EXFUN(fast_cos,(double));
|
||||
__stdargs double EXFUN(fast_tan,(double));
|
||||
|
||||
__stdargs double EXFUN(fast_asin,(double));
|
||||
__stdargs double EXFUN(fast_acos,(double));
|
||||
__stdargs double EXFUN(fast_atan,(double));
|
||||
|
||||
__stdargs double EXFUN(fast_sinh,(double));
|
||||
__stdargs double EXFUN(fast_cosh,(double));
|
||||
__stdargs double EXFUN(fast_tanh,(double));
|
||||
|
||||
__stdargs double EXFUN(fast_asinh,(double));
|
||||
__stdargs double EXFUN(fast_acosh,(double));
|
||||
__stdargs double EXFUN(fast_atanh,(double));
|
||||
|
||||
__stdargs double EXFUN(fast_abs,(double));
|
||||
__stdargs double EXFUN(fast_sqrt,(double));
|
||||
__stdargs double EXFUN(fast_exp2,(double));
|
||||
__stdargs double EXFUN(fast_exp10,(double));
|
||||
__stdargs double EXFUN(fast_expe,(double));
|
||||
__stdargs double EXFUN(fast_log10,(double));
|
||||
__stdargs double EXFUN(fast_log2,(double));
|
||||
__stdargs double EXFUN(fast_loge,(double));
|
||||
|
||||
|
||||
#define sin(x) fast_sin(x)
|
||||
#define cos(x) fast_cos(x)
|
||||
#define tan(x) fast_tan(x)
|
||||
#define asin(x) fast_asin(x)
|
||||
#define acos(x) fast_acos(x)
|
||||
#define atan(x) fast_atan(x)
|
||||
#define sinh(x) fast_sinh(x)
|
||||
#define cosh(x) fast_cosh(x)
|
||||
#define tanh(x) fast_tanh(x)
|
||||
#define asinh(x) fast_asinh(x)
|
||||
#define acosh(x) fast_acosh(x)
|
||||
#define atanh(x) fast_atanh(x)
|
||||
#define abs(x) fast_abs(x)
|
||||
#define sqrt(x) fast_sqrt(x)
|
||||
#define exp2(x) fast_exp2(x)
|
||||
#define exp10(x) fast_exp10(x)
|
||||
#define expe(x) fast_expe(x)
|
||||
#define log10(x) fast_log10(x)
|
||||
#define log2(x) fast_log2(x)
|
||||
#define loge(x) fast_loge(x)
|
||||
|
||||
/* These functions are in assembler, they really do take floats. This
|
||||
can only be used with a real ANSI compiler */
|
||||
|
||||
__stdargs float EXFUN(fast_sinf,(float));
|
||||
__stdargs float EXFUN(fast_cosf,(float));
|
||||
__stdargs float EXFUN(fast_tanf,(float));
|
||||
|
||||
__stdargs float EXFUN(fast_asinf,(float));
|
||||
__stdargs float EXFUN(fast_acosf,(float));
|
||||
__stdargs float EXFUN(fast_atanf,(float));
|
||||
|
||||
__stdargs float EXFUN(fast_sinhf,(float));
|
||||
__stdargs float EXFUN(fast_coshf,(float));
|
||||
__stdargs float EXFUN(fast_tanhf,(float));
|
||||
|
||||
__stdargs float EXFUN(fast_asinhf,(float));
|
||||
__stdargs float EXFUN(fast_acoshf,(float));
|
||||
__stdargs float EXFUN(fast_atanhf,(float));
|
||||
|
||||
__stdargs float EXFUN(fast_absf,(float));
|
||||
__stdargs float EXFUN(fast_sqrtf,(float));
|
||||
__stdargs float EXFUN(fast_exp2f,(float));
|
||||
__stdargs float EXFUN(fast_exp10f,(float));
|
||||
__stdargs float EXFUN(fast_expef,(float));
|
||||
__stdargs float EXFUN(fast_log10f,(float));
|
||||
__stdargs float EXFUN(fast_log2f,(float));
|
||||
__stdargs float EXFUN(fast_logef,(float));
|
||||
#define sinf(x) fast_sinf(x)
|
||||
#define cosf(x) fast_cosf(x)
|
||||
#define tanf(x) fast_tanf(x)
|
||||
#define asinf(x) fast_asinf(x)
|
||||
#define acosf(x) fast_acosf(x)
|
||||
#define atanf(x) fast_atanf(x)
|
||||
#define sinhf(x) fast_sinhf(x)
|
||||
#define coshf(x) fast_coshf(x)
|
||||
#define tanhf(x) fast_tanhf(x)
|
||||
#define asinhf(x) fast_asinhf(x)
|
||||
#define acoshf(x) fast_acoshf(x)
|
||||
#define atanhf(x) fast_atanhf(x)
|
||||
#define absf(x) fast_absf(x)
|
||||
#define sqrtf(x) fast_sqrtf(x)
|
||||
#define exp2f(x) fast_exp2f(x)
|
||||
#define exp10f(x) fast_exp10f(x)
|
||||
#define expef(x) fast_expef(x)
|
||||
#define log10f(x) fast_log10f(x)
|
||||
#define log2f(x) fast_log2f(x)
|
||||
#define logef(x) fast_logef(x)
|
||||
/* Override the functions defined in math.h */
|
||||
#endif /* __sysvnecv70_target */
|
||||
|
||||
@@ -0,0 +1,471 @@
|
||||
#ifndef __IEEE_BIG_ENDIAN
|
||||
#ifndef __IEEE_LITTLE_ENDIAN
|
||||
|
||||
/* This file can define macros to choose variations of the IEEE float
|
||||
format:
|
||||
|
||||
_FLT_LARGEST_EXPONENT_IS_NORMAL
|
||||
|
||||
Defined if the float format uses the largest exponent for finite
|
||||
numbers rather than NaN and infinity representations. Such a
|
||||
format cannot represent NaNs or infinities at all, but it's FLT_MAX
|
||||
is twice the IEEE value.
|
||||
|
||||
_FLT_NO_DENORMALS
|
||||
|
||||
Defined if the float format does not support IEEE denormals. Every
|
||||
float with a zero exponent is taken to be a zero representation.
|
||||
|
||||
??? At the moment, there are no equivalent macros above for doubles and
|
||||
the macros are not fully supported by --enable-newlib-hw-fp.
|
||||
|
||||
__IEEE_BIG_ENDIAN
|
||||
|
||||
Defined if the float format is big endian. This is mutually exclusive
|
||||
with __IEEE_LITTLE_ENDIAN.
|
||||
|
||||
__IEEE_LITTLE_ENDIAN
|
||||
|
||||
Defined if the float format is little endian. This is mutually exclusive
|
||||
with __IEEE_BIG_ENDIAN.
|
||||
|
||||
Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
|
||||
platform or error will occur.
|
||||
|
||||
__IEEE_BYTES_LITTLE_ENDIAN
|
||||
|
||||
This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
|
||||
whereby multiple words of an IEEE floating point are in big endian order, but the
|
||||
words themselves are little endian with respect to the bytes.
|
||||
|
||||
_DOUBLE_IS_32BITS
|
||||
|
||||
This is used on platforms that support double by using the 32-bit IEEE
|
||||
float type.
|
||||
|
||||
_FLOAT_ARG
|
||||
|
||||
This represents what type a float arg is passed as. It is used when the type is
|
||||
not promoted to double.
|
||||
|
||||
|
||||
__OBSOLETE_MATH_DEFAULT
|
||||
|
||||
Default value for __OBSOLETE_MATH if that's not set by the user.
|
||||
It should be set here based on predefined feature macros.
|
||||
|
||||
__OBSOLETE_MATH
|
||||
|
||||
If set to 1 then some new math code will be disabled and older libm
|
||||
code will be used instead. This is necessary because the new math
|
||||
code does not support all targets, it assumes that the toolchain has
|
||||
ISO C99 support (hexfloat literals, standard fenv semantics), the
|
||||
target has IEEE-754 conforming binary32 float and binary64 double
|
||||
(not mixed endian) representation, standard SNaN representation,
|
||||
double and single precision arithmetics has similar latency and it
|
||||
has no legacy SVID matherr support, only POSIX errno and fenv
|
||||
exception based error handling.
|
||||
*/
|
||||
|
||||
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
|
||||
/* ARM traditionally used big-endian words; and within those words the
|
||||
byte ordering was big or little endian depending upon the target.
|
||||
Modern floating-point formats are naturally ordered; in this case
|
||||
__VFP_FP__ will be defined, even if soft-float. */
|
||||
#ifdef __VFP_FP__
|
||||
# ifdef __ARMEL__
|
||||
# define __IEEE_LITTLE_ENDIAN
|
||||
# else
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
# endif
|
||||
# if __ARM_FP & 0x8
|
||||
# define __OBSOLETE_MATH_DEFAULT 0
|
||||
# endif
|
||||
#else
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
# ifdef __ARMEL__
|
||||
# define __IEEE_BYTES_LITTLE_ENDIAN
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__aarch64__)
|
||||
#if defined (__AARCH64EL__)
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#else
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
#define __OBSOLETE_MATH_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#ifdef __epiphany__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define Sudden_Underflow 1
|
||||
#endif
|
||||
|
||||
#ifdef __hppa__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __nds32__
|
||||
#ifdef __big_endian__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __SPU__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
|
||||
#define isfinite(__y) \
|
||||
(__extension__ ({int __cy; \
|
||||
(sizeof (__y) == sizeof (float)) ? (1) : \
|
||||
(__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
|
||||
|
||||
#define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
|
||||
#define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
|
||||
|
||||
/*
|
||||
* Macros for use in ieeefp.h. We can't just define the real ones here
|
||||
* (like those above) as we have name space issues when this is *not*
|
||||
* included via generic the ieeefp.h.
|
||||
*/
|
||||
#define __ieeefp_isnanf(x) 0
|
||||
#define __ieeefp_isinff(x) 0
|
||||
#define __ieeefp_finitef(x) 1
|
||||
#endif
|
||||
|
||||
#ifdef __sparc__
|
||||
#ifdef __LITTLE_ENDIAN_DATA__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#else
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__m68k__) || defined(__mc68000__)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#ifdef __HAVE_SHORT_DOUBLE__
|
||||
# define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#define _FLOAT_ARG float
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define _FLOAT_ARG float
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __sh__
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#else
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _AM29K
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __riscv
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __i960__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __lm32__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __M32R__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __nvptx__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(_C4x) || defined(_C3x)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#ifdef __TMS320C6X__
|
||||
#ifdef _BIG_ENDIAN
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __TIC80__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __MIPSEL__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#ifdef __MIPSEB__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __MMIX__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __D30V__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
/* necv70 was __IEEE_LITTLE_ENDIAN. */
|
||||
|
||||
#ifdef __W65__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#if defined(__Z8001__) || defined(__Z8002__)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __m88k__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __mn10300__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __mn10200__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#ifdef __v800
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __v850
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __D10V__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#if __DOUBLE__ == 32
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __PPC__
|
||||
#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __xstormy16__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __arc__
|
||||
#ifdef __big_endian__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __CRX__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __fr30__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __FT32__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __mcore__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __mt__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __frv__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __moxie__
|
||||
#ifdef __MOXIE_BIG_ENDIAN__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __ia64__
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __AVR__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __IP2K__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#define __SMALL_BITFIELDS
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#ifdef __iq2000__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __MAVERICK__
|
||||
#ifdef __ARMEL__
|
||||
# define __IEEE_LITTLE_ENDIAN
|
||||
#else /* must be __ARMEB__ */
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
#endif /* __ARMEL__ */
|
||||
#endif /* __MAVERICK__ */
|
||||
|
||||
#ifdef __m32c__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define __SMALL_BITFIELDS
|
||||
#endif
|
||||
|
||||
#ifdef __CRIS__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __BFIN__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __mep__
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#else
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __MICROBLAZE__
|
||||
#ifndef __MICROBLAZEEL__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __MSP430__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
||||
#endif
|
||||
|
||||
#ifdef __RL78__
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
||||
#ifndef __RL78_64BIT_DOUBLES__
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __RX__
|
||||
|
||||
#ifdef __RX_BIG_ENDIAN__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#else
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifndef __RX_64BIT_DOUBLES__
|
||||
#define _DOUBLE_IS_32BITS
|
||||
#endif
|
||||
|
||||
#ifdef __RX_16BIT_INTS__
|
||||
#define __SMALL_BITFIELDS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
|
||||
#define __IEEE_LITTLE_ENDIAN
|
||||
#define __SMALL_BITFIELDS /* 16 Bit INT */
|
||||
#endif
|
||||
|
||||
#ifdef __NIOS2__
|
||||
# ifdef __nios2_big_endian__
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
# else
|
||||
# define __IEEE_LITTLE_ENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __VISIUM__
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifndef __OBSOLETE_MATH_DEFAULT
|
||||
/* Use old math code by default. */
|
||||
#define __OBSOLETE_MATH_DEFAULT 1
|
||||
#endif
|
||||
#ifndef __OBSOLETE_MATH
|
||||
#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
|
||||
#endif
|
||||
|
||||
#ifndef __IEEE_BIG_ENDIAN
|
||||
#ifndef __IEEE_LITTLE_ENDIAN
|
||||
#error Endianess not declared!!
|
||||
#endif /* not __IEEE_LITTLE_ENDIAN */
|
||||
#endif /* not __IEEE_BIG_ENDIAN */
|
||||
|
||||
#endif /* not __IEEE_LITTLE_ENDIAN */
|
||||
#endif /* not __IEEE_BIG_ENDIAN */
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/* $NetBSD: limits.h,v 1.9 1994/10/26 07:50:48 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 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.
|
||||
*
|
||||
* @(#)limits.h 7.2 (Berkeley) 6/28/90
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_LIMITS_H_
|
||||
#define _MACHINE_LIMITS_H_
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
#undef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1 /* no multibyte characters */
|
||||
|
||||
#undef SCHAR_MIN
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
|
||||
#define SCHAR_MAX 0x7f /* min value for a signed char */
|
||||
|
||||
#undef UCHAR_MAX
|
||||
#undef CHAR_MAX
|
||||
#undef CHAR_MIN
|
||||
#define UCHAR_MAX 0xff /* max value for an unsigned char */
|
||||
#define CHAR_MAX 0x7f /* max value for a char */
|
||||
#define CHAR_MIN (-0x7f-1) /* min value for a char */
|
||||
|
||||
#undef USHRT_MAX
|
||||
#undef SHRT_MAX
|
||||
#undef SHRT_MIN
|
||||
#define USHRT_MAX 0xffff /* max value for an unsigned short */
|
||||
#define SHRT_MAX 0x7fff /* max value for a short */
|
||||
#define SHRT_MIN (-0x7fff-1) /* min value for a short */
|
||||
|
||||
#undef UINT_MAX
|
||||
#undef INT_MAX
|
||||
#undef INT_MIN
|
||||
#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
|
||||
#define INT_MAX 0x7fffffff /* max value for an int */
|
||||
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
|
||||
|
||||
#undef ULONG_MAX
|
||||
#undef LONG_MAX
|
||||
#undef LONG_MIN
|
||||
#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
|
||||
#define LONG_MAX 0x7fffffffL /* max value for a long */
|
||||
#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
|
||||
|
||||
#if !defined(_ANSI_SOURCE)
|
||||
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
|
||||
|
||||
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
|
||||
|
||||
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
|
||||
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
|
||||
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
|
||||
|
||||
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
|
||||
#define LONG_BIT 32
|
||||
#define WORD_BIT 32
|
||||
|
||||
#define DBL_DIG 15
|
||||
#ifndef DBL_MAX
|
||||
#define DBL_MAX 1.7976931348623157E+308
|
||||
#define DBL_MIN 2.2250738585072014E-308
|
||||
#endif
|
||||
|
||||
#define FLT_DIG 6
|
||||
#ifndef FLT_MAX
|
||||
#define FLT_MAX 3.40282347E+38F
|
||||
#define FLT_MIN 1.17549435E-38F
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _MACHINE_LIMITS_H_ */
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _MACHMALLOC_H_
|
||||
#define _MACHMALLOC_H_
|
||||
|
||||
/* place holder so platforms may add malloc.h extensions */
|
||||
|
||||
#endif /* _MACHMALLOC_H_ */
|
||||
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/* $NetBSD: param.h,v 1.25 1995/08/18 15:28:25 chopps Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* from: Utah $Hdr: machparam.h 1.11 89/08/14$
|
||||
*
|
||||
* @(#)param.h 7.8 (Berkeley) 6/28/91
|
||||
*/
|
||||
#ifndef _MACHINE_PARAM_H_
|
||||
#define _MACHINE_PARAM_H_
|
||||
|
||||
/*
|
||||
* Machine dependent constants for amiga
|
||||
*/
|
||||
#define MACHINE "amiga"
|
||||
#define MACHINE_ARCH "m68k"
|
||||
#define MID_MACHINE MID_M68K
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value
|
||||
* for all data types (int, long, ...). The result is u_int and
|
||||
* must be cast to any desired pointer type.
|
||||
*/
|
||||
#define ALIGNBYTES (sizeof(int) - 1)
|
||||
#define ALIGN(p) (((u_int)(p) + (sizeof(int) - 1)) &~ (sizeof(int) - 1))
|
||||
|
||||
#define NBPG 8192 /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define PGSHIFT 13 /* LOG2(NBPG) */
|
||||
#define NPTEPG (NBPG/(sizeof(u_int)))
|
||||
|
||||
#define NBSEG ((mmutype == MMU_68040) ? 32*NBPG : 2048*NBPG) /* bytes/segment */
|
||||
#define SEGOFSET (NBSEG-1) /* byte offset into segment */
|
||||
#define SEGSHIFT 24 /* LOG2(NBSEG) [68030 value] */
|
||||
|
||||
#define KERNBASE 0x0 /* start of kernel virtual */
|
||||
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
|
||||
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define CLSIZE 1
|
||||
#define CLSIZELOG2 0
|
||||
|
||||
/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
|
||||
#define SSIZE 1 /* initial stack size/NBPG */
|
||||
#define SINCR 1 /* increment of stack/NBPG */
|
||||
|
||||
#define UPAGES 2 /* pages of u-area */
|
||||
#define USPACE (UPAGES * NBPG)
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZE 128 /* size of an mbuf */
|
||||
#define MCLBYTES 1024
|
||||
#define MCLSHIFT 10
|
||||
#define MCLOFSET (MCLBYTES - 1)
|
||||
#ifndef NMBCLUSTERS
|
||||
#ifdef GATEWAY
|
||||
#define NMBCLUSTERS 512 /* map size, max cluster allocation */
|
||||
#else
|
||||
#define NMBCLUSTERS 256 /* map size, max cluster allocation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Size of kernel malloc arena in CLBYTES-sized logical pages
|
||||
*/
|
||||
#ifndef NKMEMCLUSTERS
|
||||
#define NKMEMCLUSTERS (3072*1024/CLBYTES)
|
||||
#endif
|
||||
|
||||
#define MAXPARTITIONS 16
|
||||
|
||||
/* pages ("clicks") to disk blocks */
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
|
||||
/* pages to bytes */
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/* bytes to disk blocks */
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and should use the bsize
|
||||
* field from the disk label.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Mach derived conversion macros
|
||||
*/
|
||||
#define amiga_round_seg(x) ((((unsigned)(x)) + NBSEG - 1) & ~(NBSEG-1))
|
||||
#define amiga_trunc_seg(x) ((unsigned)(x) & ~(NBSEG-1))
|
||||
#define amiga_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
|
||||
#define amiga_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
|
||||
#define amiga_btop(x) ((unsigned)(x) >> PGSHIFT)
|
||||
#define amiga_ptob(x) ((unsigned)(x) << PGSHIFT)
|
||||
|
||||
/*
|
||||
* spl functions; all are normally done in-line
|
||||
*/
|
||||
#include <machine/psl.h>
|
||||
|
||||
/*
|
||||
* point to the custom.intenar and custom.intenaw respectively.
|
||||
*/
|
||||
extern volatile unsigned short *amiga_intena_read, *amiga_intena_write;
|
||||
|
||||
#if 0
|
||||
#define _debug_spl(s) \
|
||||
({ \
|
||||
register int _spl_r; \
|
||||
\
|
||||
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
|
||||
"&=d" (_spl_r) : "di" (s)); \
|
||||
if ((_spl_r&PSL_IPL) > ((s)&PSL_IPL)&&((s)&PSL_IPL)!=PSL_IPL1) \
|
||||
printf ("%s:%d:spl(%d) ==> spl(%d)!!\n",__FILE__,__LINE__, \
|
||||
((PSL_IPL&_spl_r)>>8), ((PSL_IPL&(s))>>8)); \
|
||||
_spl_r; \
|
||||
})
|
||||
#else
|
||||
/*
|
||||
* Don't lower IPL below current IPL (unless new IPL is 6)
|
||||
*/
|
||||
#define _debug_spl(s) \
|
||||
({ \
|
||||
register int _spl_r; \
|
||||
\
|
||||
__asm __volatile ("clrl %0; movew sr,%0" : \
|
||||
"&=d" (_spl_r)); \
|
||||
if ((((s)&PSL_IPL) >= PSL_IPL6) || (_spl_r&PSL_IPL) < ((s)&PSL_IPL) || ((s)&PSL_IPL) <= PSL_IPL1) \
|
||||
__asm __volatile ("movew %0,sr" : : "di" (s)); \
|
||||
_spl_r; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define _spl_no_check(s) \
|
||||
({ \
|
||||
register int _spl_r; \
|
||||
\
|
||||
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
|
||||
"&=d" (_spl_r) : "di" (s)); \
|
||||
_spl_r; \
|
||||
})
|
||||
#if defined (DEBUGXX) /* No workee */
|
||||
#define _spl _debug_spl
|
||||
#else
|
||||
#define _spl _spl_no_check
|
||||
#endif
|
||||
|
||||
#define spl0() _spl(PSL_S|PSL_IPL0)
|
||||
#define spl1() _spl(PSL_S|PSL_IPL1)
|
||||
#define spl2() _spl(PSL_S|PSL_IPL2)
|
||||
#define spl3() _spl(PSL_S|PSL_IPL3)
|
||||
#define spl4() _spl(PSL_S|PSL_IPL4)
|
||||
#define spl5() _spl(PSL_S|PSL_IPL5)
|
||||
#define spl6() _spl(PSL_S|PSL_IPL6)
|
||||
#define spl7() _spl(PSL_S|PSL_IPL7)
|
||||
|
||||
#define splnone() spl0()
|
||||
#define splsoftclock() spl1()
|
||||
#define splsoftnet() spl1()
|
||||
#define splbio() spl3()
|
||||
#define splnet() spl3()
|
||||
#define spltty() spl4()
|
||||
#define splimp() spl4()
|
||||
#ifndef LEV6_DEFER
|
||||
#define splclock() spl6()
|
||||
#define splstatclock() spl6()
|
||||
#define splvm() spl6()
|
||||
#define splhigh() spl7()
|
||||
#define splsched() spl7()
|
||||
#else
|
||||
#define splclock() spl4()
|
||||
#define splstatclock() spl4()
|
||||
#define splvm() spl4()
|
||||
#define splhigh() spl4()
|
||||
#define splsched() spl4()
|
||||
#endif
|
||||
|
||||
#define splx(s) _spl_no_check(s)
|
||||
|
||||
#ifdef _KERNEL
|
||||
void delay __P((int));
|
||||
void DELAY __P((int));
|
||||
#endif
|
||||
|
||||
#endif /* !_MACHINE_PARAM_H_ */
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986 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.
|
||||
*
|
||||
* @(#)psl.h 7.2 (Berkeley) 5/4/91
|
||||
*/
|
||||
|
||||
#ifndef PSL_C
|
||||
/*
|
||||
* MC68000 program status word
|
||||
*/
|
||||
|
||||
#define PSL_C 0x0001 /* carry bit */
|
||||
#define PSL_V 0x0002 /* overflow bit */
|
||||
#define PSL_Z 0x0004 /* zero bit */
|
||||
#define PSL_N 0x0008 /* negative bit */
|
||||
#define PSL_X 0x0010 /* extend bit */
|
||||
#define PSL_ALLCC 0x001F /* all cc bits - unlikely */
|
||||
#define PSL_IPL0 0x0000 /* interrupt priority level 0 */
|
||||
#define PSL_IPL1 0x0100 /* interrupt priority level 1 */
|
||||
#define PSL_IPL2 0x0200 /* interrupt priority level 2 */
|
||||
#define PSL_IPL3 0x0300 /* interrupt priority level 3 */
|
||||
#define PSL_IPL4 0x0400 /* interrupt priority level 4 */
|
||||
#define PSL_IPL5 0x0500 /* interrupt priority level 5 */
|
||||
#define PSL_IPL6 0x0600 /* interrupt priority level 6 */
|
||||
#define PSL_IPL7 0x0700 /* interrupt priority level 7 */
|
||||
#define PSL_S 0x2000 /* supervisor enable bit */
|
||||
#define PSL_T 0x8000 /* trace enable bit */
|
||||
|
||||
#define PSL_LOWIPL (PSL_S)
|
||||
#define PSL_HIGHIPL (PSL_S | PSL_IPL7)
|
||||
#define PSL_IPL (PSL_IPL7)
|
||||
#define PSL_USER (0)
|
||||
|
||||
#define PSL_MBZ 0x58E0 /* must be zero bits */
|
||||
|
||||
#define PSL_USERSET (0)
|
||||
#define PSL_USERCLR (PSL_S | PSL_IPL7 | PSL_MBZ)
|
||||
|
||||
/*
|
||||
* Macros to decode processor status word.
|
||||
*/
|
||||
#define USERMODE(ps) (((ps) & PSL_S) == 0)
|
||||
#define BASEPRI(ps) (((ps) & PSL_IPL7) == 0)
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 1991 DJ Delorie
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution, modification, and use in source and binary forms is permitted
|
||||
* provided that the above copyright notice and following paragraph are
|
||||
* duplicated in all such forms.
|
||||
*
|
||||
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid
|
||||
conflicting with setjmp.h. Ian Taylor, Cygnus support, April,
|
||||
1993. */
|
||||
|
||||
#ifndef _SETJMP_DJ_H_
|
||||
#define _SETJMP_DJ_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned long eax;
|
||||
unsigned long ebx;
|
||||
unsigned long ecx;
|
||||
unsigned long edx;
|
||||
unsigned long esi;
|
||||
unsigned long edi;
|
||||
unsigned long ebp;
|
||||
unsigned long esp;
|
||||
unsigned long eip;
|
||||
} jmp_buf[1];
|
||||
|
||||
extern __stdargs int setjmp(jmp_buf);
|
||||
extern __stdargs void longjmp(jmp_buf, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,464 @@
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
#if defined(__or1k__) || defined(__or1knd__)
|
||||
#define _JBLEN 31 /* 32 GPRs - r0 */
|
||||
#define _JBTYPE unsigned long
|
||||
#endif
|
||||
|
||||
#if defined(__arm__) || defined(__thumb__)
|
||||
/*
|
||||
* All callee preserved registers:
|
||||
* v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
|
||||
*/
|
||||
#define _JBLEN 23
|
||||
#endif
|
||||
|
||||
#if defined(__aarch64__)
|
||||
#define _JBLEN 22
|
||||
#define _JBTYPE long long
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
#define _JBLEN 24
|
||||
#endif
|
||||
|
||||
#ifdef __sparc__
|
||||
/*
|
||||
* onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
|
||||
* All else recovered by under/over(flow) handling.
|
||||
*/
|
||||
#define _JBLEN 13
|
||||
#endif
|
||||
|
||||
#ifdef __BFIN__
|
||||
#define _JBLEN 40
|
||||
#endif
|
||||
|
||||
#ifdef __epiphany__
|
||||
/* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */
|
||||
#define _JBTYPE long long
|
||||
#define _JBLEN 10
|
||||
#endif
|
||||
|
||||
/* necv70 was 9 as well. */
|
||||
|
||||
#if defined(__m68k__) || defined(__mc68000__)
|
||||
/*
|
||||
* onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
|
||||
* fp2-fp7 for 68881.
|
||||
* All else recovered by under/over(flow) handling.
|
||||
*/
|
||||
#define _JBLEN 34
|
||||
#endif
|
||||
|
||||
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
|
||||
/*
|
||||
* D, X, Y are not saved.
|
||||
* Only take into account the pseudo soft registers (max 32).
|
||||
*/
|
||||
#define _JBLEN 32
|
||||
#endif
|
||||
|
||||
#ifdef __nds32__
|
||||
/* 17 words for GPRs,
|
||||
1 word for $fpcfg.freg and 30 words for FPUs
|
||||
Reserved 2 words for aligement-adjustment. When storeing double-precision
|
||||
floating-point register into memory, the address has to be
|
||||
double-word-aligned.
|
||||
Check libc/machine/nds32/setjmp.S for more information. */
|
||||
#if __NDS32_EXT_FPU_SP__ || __NDS32_EXT_FPU_DP__
|
||||
#define _JBLEN 50
|
||||
#else
|
||||
#define _JBLEN 18
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__Z8001__) || defined(__Z8002__)
|
||||
/* 16 regs + pc */
|
||||
#define _JBLEN 20
|
||||
#endif
|
||||
|
||||
#ifdef _AM29K
|
||||
/*
|
||||
* onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
|
||||
* All else recovered by under/over(flow) handling.
|
||||
*/
|
||||
#define _JBLEN 9
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
# if defined(__CYGWIN__) && !defined (_JBLEN)
|
||||
# define _JBLEN (13 * 4)
|
||||
# elif defined(__unix__) || defined(__rtems__)
|
||||
# define _JBLEN 9
|
||||
# elif defined(__iamcu__)
|
||||
/* Intel MCU jmp_buf only covers callee-saved registers. */
|
||||
# define _JBLEN 6
|
||||
# else
|
||||
# include "setjmp-dj.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
# ifdef __CYGWIN__
|
||||
# define _JBTYPE long
|
||||
# define _JBLEN 32
|
||||
# else
|
||||
# define _JBTYPE long long
|
||||
# define _JBLEN 8
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __i960__
|
||||
#define _JBLEN 35
|
||||
#endif
|
||||
|
||||
#ifdef __M32R__
|
||||
/* Only 8 words are currently needed. 10 gives us some slop if we need
|
||||
to expand. */
|
||||
#define _JBLEN 10
|
||||
#endif
|
||||
|
||||
#ifdef __mips__
|
||||
# if defined(__mips64)
|
||||
# define _JBTYPE long long
|
||||
# endif
|
||||
# ifdef __mips_soft_float
|
||||
# define _JBLEN 11
|
||||
# else
|
||||
# define _JBLEN 23
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __m88000__
|
||||
#define _JBLEN 21
|
||||
#endif
|
||||
|
||||
#ifdef __H8300__
|
||||
#define _JBLEN 5
|
||||
#define _JBTYPE int
|
||||
#endif
|
||||
|
||||
#ifdef __H8300H__
|
||||
/* same as H8/300 but registers are twice as big */
|
||||
#define _JBLEN 5
|
||||
#define _JBTYPE long
|
||||
#endif
|
||||
|
||||
#if defined (__H8300S__) || defined (__H8300SX__)
|
||||
/* same as H8/300 but registers are twice as big */
|
||||
#define _JBLEN 5
|
||||
#define _JBTYPE long
|
||||
#endif
|
||||
|
||||
#ifdef __H8500__
|
||||
#define _JBLEN 4
|
||||
#endif
|
||||
|
||||
#ifdef __sh__
|
||||
#if __SH5__
|
||||
#define _JBLEN 50
|
||||
#define _JBTYPE long long
|
||||
#else
|
||||
#define _JBLEN 20
|
||||
#endif /* __SH5__ */
|
||||
#endif
|
||||
|
||||
#ifdef __v800
|
||||
#define _JBLEN 28
|
||||
#endif
|
||||
|
||||
#ifdef __PPC__
|
||||
#ifdef __ALTIVEC__
|
||||
#define _JBLEN 64
|
||||
#else
|
||||
#define _JBLEN 32
|
||||
#endif
|
||||
#define _JBTYPE double
|
||||
#endif
|
||||
|
||||
#ifdef __MICROBLAZE__
|
||||
#define _JBLEN 20
|
||||
#define _JBTYPE unsigned int
|
||||
#endif
|
||||
|
||||
#ifdef __hppa__
|
||||
/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
|
||||
Note space exists for the FP registers, but they are not
|
||||
saved. */
|
||||
#define _JBLEN 28
|
||||
#endif
|
||||
|
||||
#if defined(__mn10300__) || defined(__mn10200__)
|
||||
#ifdef __AM33_2__
|
||||
#define _JBLEN 26
|
||||
#else
|
||||
/* A guess */
|
||||
#define _JBLEN 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __v850
|
||||
/* I think our setjmp is saving 15 regs at the moment. Gives us one word
|
||||
slop if we need to expand. */
|
||||
#define _JBLEN 16
|
||||
#endif
|
||||
|
||||
#if defined(_C4x)
|
||||
#define _JBLEN 10
|
||||
#endif
|
||||
#if defined(_C3x)
|
||||
#define _JBLEN 9
|
||||
#endif
|
||||
|
||||
#ifdef __TMS320C6X__
|
||||
#define _JBLEN 13
|
||||
#endif
|
||||
|
||||
#ifdef __TIC80__
|
||||
#define _JBLEN 13
|
||||
#endif
|
||||
|
||||
#ifdef __D10V__
|
||||
#define _JBLEN 8
|
||||
#endif
|
||||
|
||||
#ifdef __D30V__
|
||||
#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
|
||||
#define _JBTYPE double
|
||||
#endif
|
||||
|
||||
#ifdef __frv__
|
||||
#define _JBLEN (68/2) /* room for 68 32-bit regs */
|
||||
#define _JBTYPE double
|
||||
#endif
|
||||
|
||||
#ifdef __moxie__
|
||||
#define _JBLEN 16
|
||||
#endif
|
||||
|
||||
#ifdef __CRX__
|
||||
#define _JBLEN 9
|
||||
#endif
|
||||
|
||||
#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
|
||||
/* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H),
|
||||
* r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */
|
||||
#define _JBLEN 14
|
||||
#define _JBTYPE unsigned short
|
||||
#endif
|
||||
|
||||
#ifdef __fr30__
|
||||
#define _JBLEN 10
|
||||
#endif
|
||||
|
||||
#ifdef __FT32__
|
||||
#define _JBLEN 27
|
||||
#endif
|
||||
|
||||
#ifdef __iq2000__
|
||||
#define _JBLEN 32
|
||||
#endif
|
||||
|
||||
#ifdef __mcore__
|
||||
#define _JBLEN 16
|
||||
#endif
|
||||
|
||||
#ifdef __arc__
|
||||
#define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,mlo,mhi,status32 */
|
||||
#endif
|
||||
|
||||
#ifdef __MMIX__
|
||||
/* Using a layout compatible with GCC's built-in. */
|
||||
#define _JBLEN 5
|
||||
#define _JBTYPE unsigned long
|
||||
#endif
|
||||
|
||||
#ifdef __mt__
|
||||
#define _JBLEN 16
|
||||
#endif
|
||||
|
||||
#ifdef __SPU__
|
||||
#define _JBLEN 50
|
||||
#define _JBTYPE __vector signed int
|
||||
#endif
|
||||
|
||||
#ifdef __xstormy16__
|
||||
/* 4 GPRs plus SP plus PC. */
|
||||
#define _JBLEN 8
|
||||
#endif
|
||||
|
||||
#ifdef __mep__
|
||||
/* 16 GPRs, pc, hi, lo */
|
||||
#define _JBLEN 19
|
||||
#endif
|
||||
|
||||
#ifdef __CRIS__
|
||||
#define _JBLEN 18
|
||||
#endif
|
||||
|
||||
#ifdef __ia64
|
||||
#define _JBLEN 64
|
||||
#endif
|
||||
|
||||
#ifdef __lm32__
|
||||
#define _JBLEN 19
|
||||
#endif
|
||||
|
||||
#ifdef __m32c__
|
||||
#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
|
||||
#define _JBLEN (22/2)
|
||||
#else
|
||||
#define _JBLEN (34/2)
|
||||
#endif
|
||||
#define _JBTYPE unsigned short
|
||||
#endif /* __m32c__ */
|
||||
|
||||
#ifdef __MSP430__
|
||||
#define _JBLEN 9
|
||||
|
||||
#ifdef __MSP430X_LARGE__
|
||||
#define _JBTYPE unsigned long
|
||||
#else
|
||||
#define _JBTYPE unsigned short
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __RL78__
|
||||
/* Three banks of registers, SP, CS, ES, PC */
|
||||
#define _JBLEN (8*3+8)
|
||||
#define _JBTYPE unsigned char
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There are two versions of setjmp()/longjmp():
|
||||
* 1) Compiler (gcc) built-in versions.
|
||||
* 2) Function-call versions.
|
||||
*
|
||||
* The built-in versions are used most of the time. When used, gcc replaces
|
||||
* calls to setjmp()/longjmp() with inline assembly code. The built-in
|
||||
* versions save/restore a variable number of registers.
|
||||
|
||||
* _JBLEN is set to 40 to be ultra-safe with the built-in versions.
|
||||
* It only needs to be 12 for the function-call versions
|
||||
* but this data structure is used by both versions.
|
||||
*/
|
||||
#ifdef __NIOS2__
|
||||
#define _JBLEN 40
|
||||
#define _JBTYPE unsigned long
|
||||
#endif
|
||||
|
||||
#ifdef __RX__
|
||||
#define _JBLEN 0x44
|
||||
#endif
|
||||
|
||||
#ifdef __VISIUM__
|
||||
/* All call-saved GP registers: r11-r19,r21,r22,r23. */
|
||||
#define _JBLEN 12
|
||||
#endif
|
||||
|
||||
#ifdef __riscv
|
||||
/* _JBTYPE using long long to make sure the alignment is align to 8 byte,
|
||||
otherwise in rv32imafd, store/restore FPR may mis-align. */
|
||||
#define _JBTYPE long long
|
||||
#ifdef __riscv_32e
|
||||
#define _JBLEN ((4*sizeof(long))/sizeof(long))
|
||||
#else
|
||||
#define _JBLEN ((14*sizeof(long) + 12*sizeof(double))/sizeof(long))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _JBLEN
|
||||
#ifdef _JBTYPE
|
||||
typedef _JBTYPE jmp_buf[_JBLEN];
|
||||
#else
|
||||
typedef int jmp_buf[_JBLEN];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__rtems__)) && __POSIX_VISIBLE
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* POSIX sigsetjmp/siglongjmp macros */
|
||||
#ifdef _JBTYPE
|
||||
typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1)
|
||||
/sizeof (_JBTYPE))];
|
||||
#else
|
||||
typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
|
||||
#endif
|
||||
|
||||
#define _SAVEMASK _JBLEN
|
||||
#define _SIGMASK (_JBLEN+1)
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# define _CYGWIN_WORKING_SIGSETJMP
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_THREADS
|
||||
#define __SIGMASK_FUNC pthread_sigmask
|
||||
#else
|
||||
#define __SIGMASK_FUNC sigprocmask
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
/* Per POSIX, siglongjmp has to be implemented as function. Cygwin
|
||||
provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
|
||||
extern __stdargs void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__));
|
||||
extern __stdargs int sigsetjmp (sigjmp_buf, int);
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#define sigsetjmp(env, savemask) \
|
||||
__extension__ \
|
||||
({ \
|
||||
sigjmp_buf *_sjbuf = &(env); \
|
||||
((*_sjbuf)[_SAVEMASK] = savemask,\
|
||||
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
|
||||
setjmp (*_sjbuf)); \
|
||||
})
|
||||
|
||||
#define siglongjmp(env, val) \
|
||||
__extension__ \
|
||||
({ \
|
||||
sigjmp_buf *_sjbuf = &(env); \
|
||||
((((*_sjbuf)[_SAVEMASK]) ? \
|
||||
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
|
||||
: 0), \
|
||||
longjmp (*_sjbuf, val)); \
|
||||
})
|
||||
|
||||
#else /* !__GNUC__ */
|
||||
|
||||
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
|
||||
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
|
||||
setjmp (env))
|
||||
|
||||
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
|
||||
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
|
||||
longjmp (env, val))
|
||||
|
||||
#endif
|
||||
|
||||
/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
|
||||
are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
|
||||
New applications should use sigsetjmp/siglongjmp instead. */
|
||||
#ifdef __CYGWIN__
|
||||
extern __stdargs void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__));
|
||||
extern __stdargs int _setjmp (jmp_buf);
|
||||
#else
|
||||
#define _setjmp(env) sigsetjmp ((env), 0)
|
||||
#define _longjmp(env, val) siglongjmp ((env), (val))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* (__CYGWIN__ or __rtems__) and __POSIX_VISIBLE */
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _MACHSTDLIB_H_
|
||||
#define _MACHSTDLIB_H_
|
||||
|
||||
/* place holder so platforms may add stdlib.h extensions */
|
||||
|
||||
#endif /* _MACHSTDLIB_H_ */
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#define __MAX_BAUD B4000000
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef _MACHTIME_H_
|
||||
#define _MACHTIME_H_
|
||||
|
||||
#if defined(__rtems__) || defined(__VISIUM__) || defined(__riscv)
|
||||
#define _CLOCKS_PER_SEC_ 1000000
|
||||
#elif defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
|
||||
#define _CLOCKS_PER_SEC_ 100
|
||||
#endif
|
||||
|
||||
#ifdef __SPU__
|
||||
#include <sys/_timespec.h>
|
||||
__stdargs int nanosleep (const struct timespec *, struct timespec *);
|
||||
#endif
|
||||
|
||||
#endif /* _MACHTIME_H_ */
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Newlib targets may provide an own version of this file in their machine
|
||||
* directory to add custom user types for <sys/types.h>.
|
||||
*/
|
||||
#ifndef _SYS_TYPES_H
|
||||
#error "must be included via <sys/types.h>"
|
||||
#endif /* !_SYS_TYPES_H */
|
||||
@@ -0,0 +1,173 @@
|
||||
/* malloc.h -- header file for memory routines. */
|
||||
|
||||
#ifndef _INCLUDE_MALLOC_H_
|
||||
#define _INCLUDE_MALLOC_H_
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/reent.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* include any machine-specific extensions */
|
||||
#include <machine/malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This version of struct mallinfo must match the one in
|
||||
libc/stdlib/mallocr.c. */
|
||||
|
||||
struct mallinfo {
|
||||
size_t arena; /* total space allocated from system */
|
||||
size_t ordblks; /* number of non-inuse chunks */
|
||||
size_t smblks; /* unused -- always zero */
|
||||
size_t hblks; /* number of mmapped regions */
|
||||
size_t hblkhd; /* total space in mmapped regions */
|
||||
size_t usmblks; /* unused -- always zero */
|
||||
size_t fsmblks; /* unused -- always zero */
|
||||
size_t uordblks; /* total allocated space */
|
||||
size_t fordblks; /* total non-inuse space */
|
||||
size_t keepcost; /* top-most, releasable (via malloc_trim) space */
|
||||
};
|
||||
|
||||
/* The routines. */
|
||||
|
||||
extern __stdargs void *malloc (size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _malloc_r
|
||||
#define _malloc_r(r, s) malloc (s)
|
||||
#else
|
||||
extern __stdargs void *_malloc_r (struct _reent *, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs void free (void *);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _free_r
|
||||
#define _free_r(r, p) free (p)
|
||||
#else
|
||||
extern __stdargs void _free_r (struct _reent *, void *);
|
||||
#endif
|
||||
|
||||
extern __stdargs void *realloc (void *, size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _realloc_r
|
||||
#define _realloc_r(r, p, s) realloc (p, s)
|
||||
#else
|
||||
extern __stdargs void *_realloc_r (struct _reent *, void *, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs void *calloc (size_t, size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _calloc_r
|
||||
#define _calloc_r(r, s1, s2) calloc (s1, s2);
|
||||
#else
|
||||
extern __stdargs void *_calloc_r (struct _reent *, size_t, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs void *memalign (size_t, size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _memalign_r
|
||||
#define _memalign_r(r, s1, s2) memalign (s1, s2);
|
||||
#else
|
||||
extern __stdargs void *_memalign_r (struct _reent *, size_t, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs struct mallinfo mallinfo (void);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _mallinfo_r
|
||||
#define _mallinfo_r(r) mallinfo ()
|
||||
#else
|
||||
extern __stdargs struct mallinfo _mallinfo_r (struct _reent *);
|
||||
#endif
|
||||
|
||||
extern __stdargs void malloc_stats (void);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _malloc_stats_r
|
||||
#define _malloc_stats_r(r) malloc_stats ()
|
||||
#else
|
||||
extern __stdargs void _malloc_stats_r (struct _reent *);
|
||||
#endif
|
||||
|
||||
extern __stdargs int mallopt (int, int);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _mallopt_r
|
||||
#define _mallopt_r(i1, i2) mallopt (i1, i2)
|
||||
#else
|
||||
extern __stdargs int _mallopt_r (struct _reent *, int, int);
|
||||
#endif
|
||||
|
||||
extern __stdargs size_t malloc_usable_size (void *);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _malloc_usable_size_r
|
||||
#define _malloc_usable_size_r(r, p) malloc_usable_size (p)
|
||||
#else
|
||||
extern __stdargs size_t _malloc_usable_size_r (struct _reent *, void *);
|
||||
#endif
|
||||
|
||||
/* These aren't too useful on an embedded system, but we define them
|
||||
anyhow. */
|
||||
|
||||
extern __stdargs void *valloc (size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _valloc_r
|
||||
#define _valloc_r(r, s) valloc (s)
|
||||
#else
|
||||
extern __stdargs void *_valloc_r (struct _reent *, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs void *pvalloc (size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _pvalloc_r
|
||||
#define _pvalloc_r(r, s) pvalloc (s)
|
||||
#else
|
||||
extern __stdargs void *_pvalloc_r (struct _reent *, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs int malloc_trim (size_t);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _malloc_trim_r
|
||||
#define _malloc_trim_r(r, s) malloc_trim (s)
|
||||
#else
|
||||
extern __stdargs int _malloc_trim_r (struct _reent *, size_t);
|
||||
#endif
|
||||
|
||||
extern __stdargs void __malloc_lock(struct _reent *);
|
||||
|
||||
extern __stdargs void __malloc_unlock(struct _reent *);
|
||||
|
||||
/* A compatibility routine for an earlier version of the allocator. */
|
||||
|
||||
extern __stdargs void mstats (char *);
|
||||
#ifdef __CYGWIN__
|
||||
#undef _mstats_r
|
||||
#define _mstats_r(r, p) mstats (p)
|
||||
#else
|
||||
extern __stdargs void _mstats_r (struct _reent *, char *);
|
||||
#endif
|
||||
|
||||
/* SVID2/XPG mallopt options */
|
||||
|
||||
#define M_MXFAST 1 /* UNUSED in this malloc */
|
||||
#define M_NLBLKS 2 /* UNUSED in this malloc */
|
||||
#define M_GRAIN 3 /* UNUSED in this malloc */
|
||||
#define M_KEEP 4 /* UNUSED in this malloc */
|
||||
|
||||
/* mallopt options that actually do something */
|
||||
|
||||
#define M_TRIM_THRESHOLD -1
|
||||
#define M_TOP_PAD -2
|
||||
#define M_MMAP_THRESHOLD -3
|
||||
#define M_MMAP_MAX -4
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
/* Some systems provide this, so do too for compatibility. */
|
||||
extern __stdargs void cfree (void *);
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_MALLOC_H_ */
|
||||
@@ -0,0 +1,672 @@
|
||||
#ifndef _MATH_H_
|
||||
|
||||
#define _MATH_H_
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine/ieeefp.h>
|
||||
#include "_ansi.h"
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
/* Natural log of 2 */
|
||||
#define _M_LN2 0.693147180559945309417
|
||||
|
||||
#if __GNUC_PREREQ (3, 3)
|
||||
/* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
|
||||
|
||||
# ifndef HUGE_VAL
|
||||
# define HUGE_VAL (__builtin_huge_val())
|
||||
# endif
|
||||
|
||||
# ifndef HUGE_VALF
|
||||
# define HUGE_VALF (__builtin_huge_valf())
|
||||
# endif
|
||||
|
||||
# ifndef HUGE_VALL
|
||||
# define HUGE_VALL (__builtin_huge_vall())
|
||||
# endif
|
||||
|
||||
# ifndef INFINITY
|
||||
# define INFINITY (__builtin_inff())
|
||||
# endif
|
||||
|
||||
# ifndef NAN
|
||||
# define NAN (__builtin_nanf(""))
|
||||
# endif
|
||||
|
||||
#else /* !gcc >= 3.3 */
|
||||
|
||||
/* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY
|
||||
* and NAN macros are required to be constant expressions. Using a variable--
|
||||
* even a static const--does not meet this requirement, as it cannot be
|
||||
* evaluated at translation time.)
|
||||
* The infinities are done using numbers that are far in excess of
|
||||
* something that would be expected to be encountered in a floating-point
|
||||
* implementation. (A more certain way uses values from float.h, but that is
|
||||
* avoided because system includes are not supposed to include each other.)
|
||||
* This method might produce warnings from some compilers. (It does in
|
||||
* newer GCCs, but not for ones that would hit this #else.) If this happens,
|
||||
* please report details to the Newlib mailing list. */
|
||||
|
||||
#ifndef HUGE_VAL
|
||||
#define HUGE_VAL (1.0e999999999)
|
||||
#endif
|
||||
|
||||
#ifndef HUGE_VALF
|
||||
#define HUGE_VALF (1.0e999999999F)
|
||||
#endif
|
||||
|
||||
#if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE)
|
||||
#define HUGE_VALL (1.0e999999999L)
|
||||
#endif
|
||||
|
||||
#if !defined(INFINITY)
|
||||
#define INFINITY (HUGE_VALF)
|
||||
#endif
|
||||
|
||||
#if !defined(NAN)
|
||||
#if defined(__GNUC__) && defined(__cplusplus)
|
||||
/* Exception: older g++ versions warn about the divide by 0 used in the
|
||||
* normal case (even though older gccs do not). This trick suppresses the
|
||||
* warning, but causes errors for plain gcc, so is only used in the one
|
||||
* special case. */
|
||||
static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000};
|
||||
#define NAN (__Nanf.__d)
|
||||
#else
|
||||
#define NAN (0.0F/0.0F)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !gcc >= 3.3 */
|
||||
|
||||
/* Reentrant ANSI C functions. */
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
#ifndef __math_68881
|
||||
extern __stdargs double atan (double);
|
||||
extern __stdargs double cos (double);
|
||||
extern __stdargs double sin (double);
|
||||
extern __stdargs double tan (double);
|
||||
extern __stdargs double tanh (double);
|
||||
extern __stdargs double frexp (double, int *);
|
||||
extern __stdargs double modf (double, double *);
|
||||
extern __stdargs double ceil (double);
|
||||
extern __stdargs double fabs (double);
|
||||
extern __stdargs double floor (double);
|
||||
#endif /* ! defined (__math_68881) */
|
||||
|
||||
/* Non reentrant ANSI C functions. */
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
#ifndef __math_68881
|
||||
extern __stdargs double acos (double);
|
||||
extern __stdargs double asin (double);
|
||||
extern __stdargs double atan2 (double, double);
|
||||
extern __stdargs double cosh (double);
|
||||
extern __stdargs double sinh (double);
|
||||
extern __stdargs double exp (double);
|
||||
extern __stdargs double ldexp (double, int);
|
||||
extern __stdargs double log (double);
|
||||
extern __stdargs double log10 (double);
|
||||
extern __stdargs double pow (double, double);
|
||||
extern __stdargs double sqrt (double);
|
||||
extern __stdargs double fmod (double, double);
|
||||
#endif /* ! defined (__math_68881) */
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
extern __stdargs int finite (double);
|
||||
extern __stdargs int finitef (float);
|
||||
extern __stdargs int finitel (long double);
|
||||
extern __stdargs int isinff (float);
|
||||
extern __stdargs int isnanf (float);
|
||||
#ifdef __CYGWIN__ /* not implemented in newlib yet */
|
||||
extern __stdargs int isinfl (long double);
|
||||
extern __stdargs int isnanl (long double);
|
||||
#endif
|
||||
#if !defined(__cplusplus) || __cplusplus < 201103L
|
||||
extern __stdargs int isinf (double);
|
||||
#endif
|
||||
#endif /* __MISC_VISIBLE */
|
||||
#if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \
|
||||
&& (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
extern __stdargs int isnan (double);
|
||||
#endif
|
||||
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
/* ISO C99 types and macros. */
|
||||
|
||||
/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard,
|
||||
* considering that the standard says the includes it defines should not
|
||||
* include other includes that it defines) and that value used. (This can be
|
||||
* solved, but autoconf has a bug which makes the solution more difficult, so
|
||||
* it has been skipped for now.) */
|
||||
#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#define __TMP_FLT_EVAL_METHOD
|
||||
#endif /* FLT_EVAL_METHOD */
|
||||
#if defined FLT_EVAL_METHOD
|
||||
#if FLT_EVAL_METHOD == 0
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
#elif FLT_EVAL_METHOD == 1
|
||||
typedef double float_t;
|
||||
typedef double double_t;
|
||||
#elif FLT_EVAL_METHOD == 2
|
||||
typedef long double float_t;
|
||||
typedef long double double_t;
|
||||
#else
|
||||
/* Implementation-defined. Assume float_t and double_t have been
|
||||
* defined previously for this configuration (e.g. config.h). */
|
||||
#endif
|
||||
#else
|
||||
/* Assume basic definitions. */
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
#endif
|
||||
#if defined(__TMP_FLT_EVAL_METHOD)
|
||||
#undef FLT_EVAL_METHOD
|
||||
#endif
|
||||
|
||||
#define FP_NAN 0
|
||||
#define FP_INFINITE 1
|
||||
#define FP_ZERO 2
|
||||
#define FP_SUBNORMAL 3
|
||||
#define FP_NORMAL 4
|
||||
|
||||
#ifndef FP_ILOGB0
|
||||
# define FP_ILOGB0 (-__INT_MAX__)
|
||||
#endif
|
||||
#ifndef FP_ILOGBNAN
|
||||
# define FP_ILOGBNAN __INT_MAX__
|
||||
#endif
|
||||
|
||||
#ifndef MATH_ERRNO
|
||||
# define MATH_ERRNO 1
|
||||
#endif
|
||||
#ifndef MATH_ERREXCEPT
|
||||
# define MATH_ERREXCEPT 2
|
||||
#endif
|
||||
#ifndef math_errhandling
|
||||
# define math_errhandling MATH_ERRNO
|
||||
#endif
|
||||
|
||||
extern __stdargs int __isinff (float x);
|
||||
extern __stdargs int __isinfd (double x);
|
||||
extern __stdargs int __isnanf (float x);
|
||||
extern __stdargs int __isnand (double x);
|
||||
extern __stdargs int __fpclassifyf (float x);
|
||||
extern __stdargs int __fpclassifyd (double x);
|
||||
extern __stdargs int __signbitf (float x);
|
||||
extern __stdargs int __signbitd (double x);
|
||||
|
||||
/* Note: isinf and isnan were once functions in newlib that took double
|
||||
* arguments. C99 specifies that these names are reserved for macros
|
||||
* supporting multiple floating point types. Thus, they are
|
||||
* now defined as macros. Implementations of the old functions
|
||||
* taking double arguments still exist for compatibility purposes
|
||||
* (prototypes for them are earlier in this header). */
|
||||
|
||||
#if __GNUC_PREREQ (4, 4)
|
||||
#define fpclassify(__x) (__builtin_fpclassify (FP_NAN, FP_INFINITE, \
|
||||
FP_NORMAL, FP_SUBNORMAL, \
|
||||
FP_ZERO, __x))
|
||||
#ifndef isfinite
|
||||
#define isfinite(__x) (__builtin_isfinite (__x))
|
||||
#endif
|
||||
#ifndef isinf
|
||||
#define isinf(__x) (__builtin_isinf_sign (__x))
|
||||
#endif
|
||||
#ifndef isnan
|
||||
#define isnan(__x) (__builtin_isnan (__x))
|
||||
#endif
|
||||
#define isnormal(__x) (__builtin_isnormal (__x))
|
||||
#else
|
||||
#define fpclassify(__x) \
|
||||
((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
|
||||
__fpclassifyd(__x))
|
||||
#ifndef isfinite
|
||||
#define isfinite(__y) \
|
||||
(__extension__ ({int __cy = fpclassify(__y); \
|
||||
__cy != FP_INFINITE && __cy != FP_NAN;}))
|
||||
#endif
|
||||
#ifndef isinf
|
||||
#define isinf(__x) (fpclassify(__x) == FP_INFINITE)
|
||||
#endif
|
||||
#ifndef isnan
|
||||
#define isnan(__x) (fpclassify(__x) == FP_NAN)
|
||||
#endif
|
||||
#define isnormal(__x) (fpclassify(__x) == FP_NORMAL)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ (4, 0)
|
||||
#if defined(_HAVE_LONG_DOUBLE)
|
||||
#define signbit(__x) \
|
||||
((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
|
||||
(sizeof(__x) == sizeof(double)) ? __builtin_signbit (__x) : \
|
||||
__builtin_signbitl(__x))
|
||||
#else
|
||||
#define signbit(__x) \
|
||||
((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
|
||||
__builtin_signbit (__x))
|
||||
#endif
|
||||
#else
|
||||
#define signbit(__x) \
|
||||
((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
|
||||
__signbitd(__x))
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ (2, 97)
|
||||
#define isgreater(__x,__y) (__builtin_isgreater (__x, __y))
|
||||
#define isgreaterequal(__x,__y) (__builtin_isgreaterequal (__x, __y))
|
||||
#define isless(__x,__y) (__builtin_isless (__x, __y))
|
||||
#define islessequal(__x,__y) (__builtin_islessequal (__x, __y))
|
||||
#define islessgreater(__x,__y) (__builtin_islessgreater (__x, __y))
|
||||
#define isunordered(__x,__y) (__builtin_isunordered (__x, __y))
|
||||
#else
|
||||
#define isgreater(x,y) \
|
||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||
!isunordered(__x,__y) && (__x > __y);}))
|
||||
#define isgreaterequal(x,y) \
|
||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||
!isunordered(__x,__y) && (__x >= __y);}))
|
||||
#define isless(x,y) \
|
||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||
!isunordered(__x,__y) && (__x < __y);}))
|
||||
#define islessequal(x,y) \
|
||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||
!isunordered(__x,__y) && (__x <= __y);}))
|
||||
#define islessgreater(x,y) \
|
||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||
!isunordered(__x,__y) && (__x < __y || __x > __y);}))
|
||||
|
||||
#define isunordered(a,b) \
|
||||
(__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
|
||||
fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
|
||||
#endif
|
||||
|
||||
/* Non ANSI double precision functions. */
|
||||
|
||||
extern __stdargs double infinity (void);
|
||||
extern __stdargs double nan (const char *);
|
||||
extern __stdargs double copysign (double, double);
|
||||
extern __stdargs double logb (double);
|
||||
extern __stdargs int ilogb (double);
|
||||
|
||||
extern __stdargs double asinh (double);
|
||||
extern __stdargs double cbrt (double);
|
||||
extern __stdargs double nextafter (double, double);
|
||||
extern __stdargs double rint (double);
|
||||
extern __stdargs double scalbn (double, int);
|
||||
|
||||
extern __stdargs double exp2 (double);
|
||||
extern __stdargs double scalbln (double, long int);
|
||||
extern __stdargs double tgamma (double);
|
||||
extern __stdargs double nearbyint (double);
|
||||
extern __stdargs long int lrint (double);
|
||||
extern __stdargs long long int llrint (double);
|
||||
extern __stdargs double round (double);
|
||||
extern __stdargs long int lround (double);
|
||||
extern __stdargs long long int llround (double);
|
||||
extern __stdargs double trunc (double);
|
||||
extern __stdargs double remquo (double, double, int *);
|
||||
extern __stdargs double fdim (double, double);
|
||||
extern __stdargs double fmax (double, double);
|
||||
extern __stdargs double fmin (double, double);
|
||||
extern __stdargs double fma (double, double, double);
|
||||
|
||||
#ifndef __math_68881
|
||||
extern __stdargs double log1p (double);
|
||||
extern __stdargs double expm1 (double);
|
||||
#endif /* ! defined (__math_68881) */
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
extern __stdargs double acosh (double);
|
||||
extern __stdargs double atanh (double);
|
||||
extern __stdargs double remainder (double, double);
|
||||
extern __stdargs double gamma (double);
|
||||
extern __stdargs double lgamma (double);
|
||||
extern __stdargs double erf (double);
|
||||
extern __stdargs double erfc (double);
|
||||
extern __stdargs double log2 (double);
|
||||
#if !defined(__cplusplus)
|
||||
#define log2(x) (log (x) / _M_LN2)
|
||||
#endif
|
||||
|
||||
#ifndef __math_68881
|
||||
extern __stdargs double hypot (double, double);
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
|
||||
/* Single precision versions of ANSI functions. */
|
||||
|
||||
extern __stdargs float atanf (float);
|
||||
extern __stdargs float cosf (float);
|
||||
extern __stdargs float sinf (float);
|
||||
extern __stdargs float tanf (float);
|
||||
extern __stdargs float tanhf (float);
|
||||
extern __stdargs float frexpf (float, int *);
|
||||
extern __stdargs float modff (float, float *);
|
||||
extern __stdargs float ceilf (float);
|
||||
extern __stdargs float fabsf (float);
|
||||
extern __stdargs float floorf (float);
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
extern __stdargs float acosf (float);
|
||||
extern __stdargs float asinf (float);
|
||||
extern __stdargs float atan2f (float, float);
|
||||
extern __stdargs float coshf (float);
|
||||
extern __stdargs float sinhf (float);
|
||||
extern __stdargs float expf (float);
|
||||
extern __stdargs float ldexpf (float, int);
|
||||
extern __stdargs float logf (float);
|
||||
extern __stdargs float log10f (float);
|
||||
extern __stdargs float powf (float, float);
|
||||
extern __stdargs float sqrtf (float);
|
||||
extern __stdargs float fmodf (float, float);
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
|
||||
/* Other single precision functions. */
|
||||
|
||||
extern __stdargs float exp2f (float);
|
||||
extern __stdargs float scalblnf (float, long int);
|
||||
extern __stdargs float tgammaf (float);
|
||||
extern __stdargs float nearbyintf (float);
|
||||
extern __stdargs long int lrintf (float);
|
||||
extern __stdargs long long int llrintf (float);
|
||||
extern __stdargs float roundf (float);
|
||||
extern __stdargs long int lroundf (float);
|
||||
extern __stdargs long long int llroundf (float);
|
||||
extern __stdargs float truncf (float);
|
||||
extern __stdargs float remquof (float, float, int *);
|
||||
extern __stdargs float fdimf (float, float);
|
||||
extern __stdargs float fmaxf (float, float);
|
||||
extern __stdargs float fminf (float, float);
|
||||
extern __stdargs float fmaf (float, float, float);
|
||||
|
||||
extern __stdargs float infinityf (void);
|
||||
extern __stdargs float nanf (const char *);
|
||||
extern __stdargs float copysignf (float, float);
|
||||
extern __stdargs float logbf (float);
|
||||
extern __stdargs int ilogbf (float);
|
||||
|
||||
extern __stdargs float asinhf (float);
|
||||
extern __stdargs float cbrtf (float);
|
||||
extern __stdargs float nextafterf (float, float);
|
||||
extern __stdargs float rintf (float);
|
||||
extern __stdargs float scalbnf (float, int);
|
||||
extern __stdargs float log1pf (float);
|
||||
extern __stdargs float expm1f (float);
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
extern __stdargs float acoshf (float);
|
||||
extern __stdargs float atanhf (float);
|
||||
extern __stdargs float remainderf (float, float);
|
||||
extern __stdargs float gammaf (float);
|
||||
extern __stdargs float lgammaf (float);
|
||||
extern __stdargs float erff (float);
|
||||
extern __stdargs float erfcf (float);
|
||||
extern __stdargs float log2f (float);
|
||||
extern __stdargs float hypotf (float, float);
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
|
||||
/* Newlib doesn't fully support long double math functions so far.
|
||||
On platforms where long double equals double the long double functions
|
||||
simply call the double functions. On Cygwin the long double functions
|
||||
are implemented independently from newlib to be able to use optimized
|
||||
assembler functions despite using the Microsoft x86_64 ABI. */
|
||||
#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
|
||||
/* Reentrant ANSI C functions. */
|
||||
#ifndef __math_68881
|
||||
extern __stdargs long double atanl (long double);
|
||||
extern __stdargs long double cosl (long double);
|
||||
extern __stdargs long double sinl (long double);
|
||||
extern __stdargs long double tanl (long double);
|
||||
extern __stdargs long double tanhl (long double);
|
||||
extern __stdargs long double frexpl (long double, int *);
|
||||
extern __stdargs long double modfl (long double, long double *);
|
||||
extern __stdargs long double ceill (long double);
|
||||
extern __stdargs long double fabsl (long double);
|
||||
extern __stdargs long double floorl (long double);
|
||||
extern __stdargs long double log1pl (long double);
|
||||
extern __stdargs long double expm1l (long double);
|
||||
#endif /* ! defined (__math_68881) */
|
||||
/* Non reentrant ANSI C functions. */
|
||||
#ifndef _REENT_ONLY
|
||||
#ifndef __math_68881
|
||||
extern __stdargs long double acosl (long double);
|
||||
extern __stdargs long double asinl (long double);
|
||||
extern __stdargs long double atan2l (long double, long double);
|
||||
extern __stdargs long double coshl (long double);
|
||||
extern __stdargs long double sinhl (long double);
|
||||
extern __stdargs long double expl (long double);
|
||||
extern __stdargs long double ldexpl (long double, int);
|
||||
extern __stdargs long double logl (long double);
|
||||
extern __stdargs long double log10l (long double);
|
||||
extern __stdargs long double powl (long double, long double);
|
||||
extern __stdargs long double sqrtl (long double);
|
||||
extern __stdargs long double fmodl (long double, long double);
|
||||
extern __stdargs long double hypotl (long double, long double);
|
||||
#endif /* ! defined (__math_68881) */
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
extern __stdargs long double copysignl (long double, long double);
|
||||
extern __stdargs long double nanl (const char *);
|
||||
extern __stdargs int ilogbl (long double);
|
||||
extern __stdargs long double asinhl (long double);
|
||||
extern __stdargs long double cbrtl (long double);
|
||||
extern __stdargs long double nextafterl (long double, long double);
|
||||
extern __stdargs float nexttowardf (float, long double);
|
||||
extern __stdargs double nexttoward (double, long double);
|
||||
extern __stdargs long double nexttowardl (long double, long double);
|
||||
extern __stdargs long double logbl (long double);
|
||||
extern __stdargs long double log2l (long double);
|
||||
extern __stdargs long double rintl (long double);
|
||||
extern __stdargs long double scalbnl (long double, int);
|
||||
extern __stdargs long double exp2l (long double);
|
||||
extern __stdargs long double scalblnl (long double, long);
|
||||
extern __stdargs long double tgammal (long double);
|
||||
extern __stdargs long double nearbyintl (long double);
|
||||
extern __stdargs long int lrintl (long double);
|
||||
extern __stdargs long long int llrintl (long double);
|
||||
extern __stdargs long double roundl (long double);
|
||||
extern __stdargs long lroundl (long double);
|
||||
extern __stdargs long long int llroundl (long double);
|
||||
extern __stdargs long double truncl (long double);
|
||||
extern __stdargs long double remquol (long double, long double, int *);
|
||||
extern __stdargs long double fdiml (long double, long double);
|
||||
extern __stdargs long double fmaxl (long double, long double);
|
||||
extern __stdargs long double fminl (long double, long double);
|
||||
extern __stdargs long double fmal (long double, long double, long double);
|
||||
#ifndef _REENT_ONLY
|
||||
extern __stdargs long double acoshl (long double);
|
||||
extern __stdargs long double atanhl (long double);
|
||||
extern __stdargs long double remainderl (long double, long double);
|
||||
extern __stdargs long double lgammal (long double);
|
||||
extern __stdargs long double erfl (long double);
|
||||
extern __stdargs long double erfcl (long double);
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
|
||||
extern __stdargs long double hypotl (long double, long double);
|
||||
extern __stdargs long double sqrtl (long double);
|
||||
#ifdef __i386__
|
||||
/* Other long double precision functions. */
|
||||
extern __stdargs _LONG_DOUBLE rintl (_LONG_DOUBLE);
|
||||
extern __stdargs long int lrintl (_LONG_DOUBLE);
|
||||
extern __stdargs long long int llrintl (_LONG_DOUBLE);
|
||||
#endif /* __i386__ */
|
||||
#endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
|
||||
|
||||
#endif /* __ISO_C_VISIBLE >= 1999 */
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
extern __stdargs double drem (double, double);
|
||||
extern __stdargs float dremf (float, float);
|
||||
#ifdef __CYGWIN__
|
||||
extern __stdargs float dreml (long double, long double);
|
||||
#endif /* __CYGWIN__ */
|
||||
extern __stdargs double gamma_r (double, int *);
|
||||
extern __stdargs double lgamma_r (double, int *);
|
||||
extern __stdargs float gammaf_r (float, int *);
|
||||
extern __stdargs float lgammaf_r (float, int *);
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||
extern __stdargs double y0 (double);
|
||||
extern __stdargs double y1 (double);
|
||||
extern __stdargs double yn (int, double);
|
||||
extern __stdargs double j0 (double);
|
||||
extern __stdargs double j1 (double);
|
||||
extern __stdargs double jn (int, double);
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE >= 600
|
||||
extern __stdargs float y0f (float);
|
||||
extern __stdargs float y1f (float);
|
||||
extern __stdargs float ynf (int, float);
|
||||
extern __stdargs float j0f (float);
|
||||
extern __stdargs float j1f (float);
|
||||
extern __stdargs float jnf (int, float);
|
||||
#endif
|
||||
|
||||
/* GNU extensions */
|
||||
#if __GNU_VISIBLE
|
||||
extern __stdargs void sincos (double, double *, double *);
|
||||
extern __stdargs void sincosf (float, float *, float *);
|
||||
#ifdef __CYGWIN__
|
||||
extern __stdargs void sincosl (long double, long double *, long double *);
|
||||
#endif /* __CYGWIN__ */
|
||||
# ifndef exp10
|
||||
extern __stdargs double exp10 (double);
|
||||
# endif
|
||||
# ifndef pow10
|
||||
extern __stdargs double pow10 (double);
|
||||
# endif
|
||||
# ifndef exp10f
|
||||
extern __stdargs float exp10f (float);
|
||||
# endif
|
||||
# ifndef pow10f
|
||||
extern __stdargs float pow10f (float);
|
||||
# endif
|
||||
#ifdef __CYGWIN__
|
||||
# ifndef exp10l
|
||||
extern __stdargs float exp10l (float);
|
||||
# endif
|
||||
# ifndef pow10l
|
||||
extern __stdargs float pow10l (float);
|
||||
# endif
|
||||
#endif /* __CYGWIN__ */
|
||||
#endif /* __GNU_VISIBLE */
|
||||
|
||||
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||
/* The gamma functions use a global variable, signgam. */
|
||||
#ifndef _REENT_ONLY
|
||||
#define signgam (*__signgam())
|
||||
extern __stdargs int *__signgam (void);
|
||||
#endif /* ! defined (_REENT_ONLY) */
|
||||
|
||||
#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
|
||||
#endif /* __MISC_VISIBLE || __XSI_VISIBLE */
|
||||
|
||||
#if __SVID_VISIBLE
|
||||
/* The exception structure passed to the matherr routine. */
|
||||
/* We have a problem when using C++ since `exception' is a reserved
|
||||
name in C++. */
|
||||
#ifdef __cplusplus
|
||||
struct __exception
|
||||
#else
|
||||
struct exception
|
||||
#endif
|
||||
{
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
int err;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern __stdargs int matherr (struct __exception *e);
|
||||
#else
|
||||
extern __stdargs int matherr (struct exception *e);
|
||||
#endif
|
||||
|
||||
/* Values for the type field of struct exception. */
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
#endif /* __SVID_VISIBLE */
|
||||
|
||||
/* Useful constants. */
|
||||
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE
|
||||
|
||||
#define MAXFLOAT 3.40282347e+38F
|
||||
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#define M_LN2 _M_LN2
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
|
||||
#endif
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
|
||||
#define M_TWOPI (M_PI * 2.0)
|
||||
#define M_3PI_4 2.3561944901923448370E0
|
||||
#define M_SQRTPI 1.77245385090551602792981
|
||||
#define M_LN2LO 1.9082149292705877000E-10
|
||||
#define M_LN2HI 6.9314718036912381649E-1
|
||||
#define M_SQRT3 1.73205080756887719000
|
||||
#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
|
||||
#define M_LOG2_E _M_LN2
|
||||
#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
|
||||
|
||||
/* Global control over fdlibm error handling. */
|
||||
|
||||
enum __fdlibm_version
|
||||
{
|
||||
__fdlibm_ieee = -1,
|
||||
__fdlibm_svid,
|
||||
__fdlibm_xopen,
|
||||
__fdlibm_posix
|
||||
};
|
||||
|
||||
#define _LIB_VERSION_TYPE enum __fdlibm_version
|
||||
#define _LIB_VERSION __fdlib_version
|
||||
|
||||
extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#define _IEEE_ __fdlibm_ieee
|
||||
#define _SVID_ __fdlibm_svid
|
||||
#define _XOPEN_ __fdlibm_xopen
|
||||
#define _POSIX_ __fdlibm_posix
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#ifdef __FAST_MATH__
|
||||
#include <machine/fastmath.h>
|
||||
#endif
|
||||
|
||||
#endif /* _MATH_H_ */
|
||||
@@ -0,0 +1,48 @@
|
||||
/* mconf.h */
|
||||
|
||||
#ifndef _MCONF_H
|
||||
#define _MCONF_H
|
||||
|
||||
/* Constant definitions for math error conditions
|
||||
*/
|
||||
|
||||
#define DOMAIN 1 /* argument domain error */
|
||||
#define SING 2 /* argument singularity */
|
||||
#define OVERFLOW 3 /* overflow range error */
|
||||
#define UNDERFLOW 4 /* underflow range error */
|
||||
#define TLOSS 5 /* total loss of precision */
|
||||
#define PLOSS 6 /* partial loss of precision */
|
||||
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
|
||||
#define MIEEE 1
|
||||
#define ANSIC 1
|
||||
|
||||
#define mtherr(a,b) errno=(b),perror(a)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "umath.h"
|
||||
#include "stabs.h"
|
||||
|
||||
extern int errno;
|
||||
|
||||
|
||||
#define MAXLOGF (88.02969187150841f)
|
||||
#define MINLOGF (-103.278929903431851103f) /* log(2^-149) */
|
||||
#define MAXNUMF (1.7014117331926442990585209174225846272e38f)
|
||||
#define LOG2EF (1.44269504088896341f)
|
||||
#define LOGE2F (0.693147180559945309f)
|
||||
#define SQRTHF (0.707106781186547524f)
|
||||
#define PIF (3.141592653589793238f)
|
||||
#define PIO2F (1.5707963267948966192f)
|
||||
#define PIO4F (0.7853981633974483096f)
|
||||
#define MACHEPF (5.9604644775390625E-8f)
|
||||
|
||||
#define MFALIAS(_t,_f) \
|
||||
ALIAS(_f##f,_f); \
|
||||
ALIAS(_f##l,_f); \
|
||||
_t _f
|
||||
|
||||
#endif /* _MCONF_H */
|
||||
@@ -0,0 +1,4 @@
|
||||
#ifndef _MEMORY_H
|
||||
#define _MEMORY_H
|
||||
#include <string.h>
|
||||
#endif /* !_MEMORY_H */
|
||||
@@ -0,0 +1,206 @@
|
||||
/* newlib.h. Generated from newlib.hin by configure. */
|
||||
/* newlib.hin. Manually edited from the output of autoheader to
|
||||
remove all PACKAGE_ macros which will collide with any user
|
||||
package using newlib header files and having its own package name,
|
||||
version, etc... */
|
||||
#ifndef __NEWLIB_H__
|
||||
|
||||
#define __NEWLIB_H__ 1
|
||||
|
||||
/* EL/IX level */
|
||||
/* #undef _ELIX_LEVEL */
|
||||
|
||||
/* Newlib version */
|
||||
#include <_newlib_version.h>
|
||||
|
||||
/* C99 formats support (such as %a, %zu, ...) in IO functions like
|
||||
* printf/scanf enabled */
|
||||
#define _WANT_IO_C99_FORMATS 1
|
||||
|
||||
/* long long type support in IO functions like printf/scanf enabled */
|
||||
#define _WANT_IO_LONG_LONG 1
|
||||
|
||||
/* Register application finalization function using atexit. */
|
||||
/* #undef _WANT_REGISTER_FINI */
|
||||
|
||||
/* long double type support in IO functions like printf/scanf enabled */
|
||||
/* #undef _WANT_IO_LONG_DOUBLE */
|
||||
|
||||
/* Positional argument support in printf functions enabled. */
|
||||
/* #undef _WANT_IO_POS_ARGS */
|
||||
|
||||
/* Optional reentrant struct support. Used mostly on platforms with
|
||||
very restricted storage. */
|
||||
#define _WANT_REENT_SMALL 1
|
||||
|
||||
/* Multibyte supported */
|
||||
#define _MB_CAPABLE 1
|
||||
|
||||
/* MB_LEN_MAX */
|
||||
#define _MB_LEN_MAX 8
|
||||
|
||||
/* ICONV enabled */
|
||||
/* #undef _ICONV_ENABLED */
|
||||
|
||||
/* Enable ICONV external CCS files loading capabilities */
|
||||
/* #undef _ICONV_ENABLE_EXTERNAL_CCS */
|
||||
|
||||
/* Define if the linker supports .preinit_array/.init_array/.fini_array
|
||||
* sections. */
|
||||
/* #undef HAVE_INITFINI_ARRAY */
|
||||
|
||||
/* True if atexit() may dynamically allocate space for cleanup
|
||||
functions. */
|
||||
#define _ATEXIT_DYNAMIC_ALLOC 1
|
||||
|
||||
/* True if long double supported. */
|
||||
#define _HAVE_LONG_DOUBLE 1
|
||||
|
||||
/* Define if compiler supports -fno-tree-loop-distribute-patterns. */
|
||||
#define _HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1
|
||||
|
||||
/* True if long double supported and it is equal to double. */
|
||||
/* #undef _LDBL_EQ_DBL */
|
||||
|
||||
/* Define if ivo supported in streamio. */
|
||||
#define _FVWRITE_IN_STREAMIO 1
|
||||
|
||||
/* Define if fseek functions support seek optimization. */
|
||||
#define _FSEEK_OPTIMIZATION 1
|
||||
|
||||
/* Define if wide char orientation is supported. */
|
||||
#define _WIDE_ORIENT 1
|
||||
|
||||
/* Define if unbuffered stream file optimization is supported. */
|
||||
#define _UNBUF_STREAM_OPT 1
|
||||
|
||||
/* Define if lite version of exit supported. */
|
||||
/* #undef _LITE_EXIT */
|
||||
|
||||
/* Define if declare atexit data as global. */
|
||||
/* #undef _REENT_GLOBAL_ATEXIT */
|
||||
|
||||
/* Define to move the stdio stream FILE objects out of struct _reent and make
|
||||
them global. The stdio stream pointers of struct _reent are initialized to
|
||||
point to the global stdio FILE stream objects. */
|
||||
/* #undef _WANT_REENT_GLOBAL_STDIO_STREAMS */
|
||||
|
||||
/* Define if small footprint nano-formatted-IO implementation used. */
|
||||
/* #undef _NANO_FORMATTED_IO */
|
||||
|
||||
/* Define if using retargetable functions for default lock routines. */
|
||||
/* #undef _RETARGETABLE_LOCKING */
|
||||
|
||||
/* Define to use type long for time_t. */
|
||||
#define _WANT_USE_LONG_TIME_T 1
|
||||
|
||||
/*
|
||||
* Iconv encodings enabled ("to" direction)
|
||||
*/
|
||||
/* #undef _ICONV_TO_ENCODING_BIG5 */
|
||||
/* #undef _ICONV_TO_ENCODING_CP775 */
|
||||
/* #undef _ICONV_TO_ENCODING_CP850 */
|
||||
/* #undef _ICONV_TO_ENCODING_CP852 */
|
||||
/* #undef _ICONV_TO_ENCODING_CP855 */
|
||||
/* #undef _ICONV_TO_ENCODING_CP866 */
|
||||
/* #undef _ICONV_TO_ENCODING_EUC_JP */
|
||||
/* #undef _ICONV_TO_ENCODING_EUC_TW */
|
||||
/* #undef _ICONV_TO_ENCODING_EUC_KR */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_1 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_10 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_11 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_13 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_14 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_15 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_2 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_3 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_4 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_5 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_6 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_7 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_8 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_8859_9 */
|
||||
/* #undef _ICONV_TO_ENCODING_ISO_IR_111 */
|
||||
/* #undef _ICONV_TO_ENCODING_KOI8_R */
|
||||
/* #undef _ICONV_TO_ENCODING_KOI8_RU */
|
||||
/* #undef _ICONV_TO_ENCODING_KOI8_U */
|
||||
/* #undef _ICONV_TO_ENCODING_KOI8_UNI */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_2 */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_2_INTERNAL */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_2BE */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_2LE */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_4 */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_4_INTERNAL */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_4BE */
|
||||
/* #undef _ICONV_TO_ENCODING_UCS_4LE */
|
||||
/* #undef _ICONV_TO_ENCODING_US_ASCII */
|
||||
/* #undef _ICONV_TO_ENCODING_UTF_16 */
|
||||
/* #undef _ICONV_TO_ENCODING_UTF_16BE */
|
||||
/* #undef _ICONV_TO_ENCODING_UTF_16LE */
|
||||
/* #undef _ICONV_TO_ENCODING_UTF_8 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1250 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1251 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1252 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1253 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1254 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1255 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1256 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1257 */
|
||||
/* #undef _ICONV_TO_ENCODING_WIN_1258 */
|
||||
|
||||
/*
|
||||
* Iconv encodings enabled ("from" direction)
|
||||
*/
|
||||
/* #undef _ICONV_FROM_ENCODING_BIG5 */
|
||||
/* #undef _ICONV_FROM_ENCODING_CP775 */
|
||||
/* #undef _ICONV_FROM_ENCODING_CP850 */
|
||||
/* #undef _ICONV_FROM_ENCODING_CP852 */
|
||||
/* #undef _ICONV_FROM_ENCODING_CP855 */
|
||||
/* #undef _ICONV_FROM_ENCODING_CP866 */
|
||||
/* #undef _ICONV_FROM_ENCODING_EUC_JP */
|
||||
/* #undef _ICONV_FROM_ENCODING_EUC_TW */
|
||||
/* #undef _ICONV_FROM_ENCODING_EUC_KR */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_1 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_10 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_11 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_13 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_14 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_15 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_2 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_3 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_4 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_5 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_6 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_7 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_8 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_8859_9 */
|
||||
/* #undef _ICONV_FROM_ENCODING_ISO_IR_111 */
|
||||
/* #undef _ICONV_FROM_ENCODING_KOI8_R */
|
||||
/* #undef _ICONV_FROM_ENCODING_KOI8_RU */
|
||||
/* #undef _ICONV_FROM_ENCODING_KOI8_U */
|
||||
/* #undef _ICONV_FROM_ENCODING_KOI8_UNI */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_2 */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_2_INTERNAL */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_2BE */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_2LE */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_4 */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_4_INTERNAL */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_4BE */
|
||||
/* #undef _ICONV_FROM_ENCODING_UCS_4LE */
|
||||
/* #undef _ICONV_FROM_ENCODING_US_ASCII */
|
||||
/* #undef _ICONV_FROM_ENCODING_UTF_16 */
|
||||
/* #undef _ICONV_FROM_ENCODING_UTF_16BE */
|
||||
/* #undef _ICONV_FROM_ENCODING_UTF_16LE */
|
||||
/* #undef _ICONV_FROM_ENCODING_UTF_8 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1250 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1251 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1252 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1253 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1254 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1255 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1256 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1257 */
|
||||
/* #undef _ICONV_FROM_ENCODING_WIN_1258 */
|
||||
|
||||
#endif /* !__NEWLIB_H__ */
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef _PATHS_H_
|
||||
#define _PATHS_H_
|
||||
|
||||
#define _PATH_DEV "/dev/"
|
||||
#define _PATH_DEVNULL "/dev/null"
|
||||
#define _PATH_DEVZERO "/dev/zero"
|
||||
#define _PATH_BSHELL "/bin/sh"
|
||||
|
||||
#endif /* _PATHS_H_ */
|
||||
@@ -0,0 +1,88 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
$Id$
|
||||
NAME
|
||||
poll - select(2)-based poll() emulation function for BSD systems.
|
||||
SYNOPSIS
|
||||
#include "poll.h"
|
||||
struct pollfd
|
||||
{
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
}
|
||||
int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)
|
||||
DESCRIPTION
|
||||
This file, and the accompanying "poll.c", implement the System V
|
||||
poll(2) system call for BSD systems (which typically do not provide
|
||||
poll()). Poll() provides a method for multiplexing input and output
|
||||
on multiple open file descriptors; in traditional BSD systems, that
|
||||
capability is provided by select(). While the semantics of select()
|
||||
differ from those of poll(), poll() can be readily emulated in terms
|
||||
of select() -- which is how this function is implemented.
|
||||
REFERENCES
|
||||
Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990.
|
||||
NOTES
|
||||
1. This software requires an ANSI C compiler.
|
||||
LICENSE
|
||||
This software is released under the following BSD license, adapted from
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 1995-2011, Brian M. Clapper
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* Neither the name of the clapper.org 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 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 THE COPYRIGHT HOLDER 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.
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _POLL_EMUL_H_
|
||||
#define _POLL_EMUL_H_
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLPRI 0x02
|
||||
#define POLLOUT 0x04
|
||||
#define POLLERR 0x08
|
||||
#define POLLHUP 0x10
|
||||
#define POLLNVAL 0x20
|
||||
|
||||
struct pollfd
|
||||
{
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
typedef unsigned long nfds_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if (__STDC__ > 0) || defined(__cplusplus)
|
||||
extern int poll (struct pollfd *pArray, nfds_t n_fds, int timeout);
|
||||
#else
|
||||
extern int poll();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _POLL_EMUL_H_ */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef _HEADERS_POOL_H
|
||||
#define _HEADERS_POOL_H
|
||||
|
||||
#include <exec/types.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define ASM
|
||||
#define REG(reg,arg) arg __asm(#reg)
|
||||
#else
|
||||
#define ASM __asm
|
||||
#define REG(reg,arg) register __##reg arg
|
||||
#endif
|
||||
|
||||
#include <exec/lists.h>
|
||||
#include <exec/memory.h>
|
||||
#include <proto/exec.h>
|
||||
|
||||
/*
|
||||
** our PRIVATE! memory pool structure
|
||||
** (_NOT_ compatible with original amiga.lib!)
|
||||
*/
|
||||
|
||||
typedef struct Pool {
|
||||
struct MinList PuddleList;
|
||||
ULONG MemoryFlags;
|
||||
ULONG PuddleSize;
|
||||
ULONG ThreshSize;
|
||||
} POOL;
|
||||
|
||||
/*
|
||||
** required prototypes
|
||||
*/
|
||||
|
||||
APTR ASM AsmCreatePool(REG(d0,ULONG),REG(d1,ULONG),REG(d2,ULONG),REG(a6,APTR));
|
||||
APTR ASM AsmAllocPooled(REG(a0,POOL *),REG(d0,ULONG),REG(a6,APTR));
|
||||
VOID ASM AsmFreePooled(REG(a0,POOL *),REG(a1,APTR),REG(d0,ULONG),REG(a6,APTR));
|
||||
VOID ASM AsmDeletePool(REG(a0,POOL *),REG(a6,APTR));
|
||||
|
||||
#endif /* _HEADERS_POOL_H */
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _HEADERS_RAND48_H
|
||||
#define _HEADERS_RAND48_H
|
||||
|
||||
__stdargs void srand48(long);
|
||||
__stdargs unsigned short *seed48(unsigned short *);
|
||||
__stdargs void lcong48(unsigned short *);
|
||||
__stdargs long lrand48(void);
|
||||
__stdargs long nrand48(unsigned short *);
|
||||
__stdargs long mrand48(void);
|
||||
__stdargs long jrand48(unsigned short *);
|
||||
__stdargs double drand48(void);
|
||||
__stdargs double erand48(unsigned short *seed);
|
||||
|
||||
#endif /* _HEADERS_RAND48_H */
|
||||
@@ -0,0 +1,188 @@
|
||||
/* This header file provides the reentrancy. */
|
||||
|
||||
/* The reentrant system calls here serve two purposes:
|
||||
|
||||
1) Provide reentrant versions of the system calls the ANSI C library
|
||||
requires.
|
||||
2) Provide these system calls in a namespace clean way.
|
||||
|
||||
It is intended that *all* system calls that the ANSI C library needs
|
||||
be declared here. It documents them all in one place. All library access
|
||||
to the system is via some form of these functions.
|
||||
|
||||
The target may provide the needed syscalls by any of the following:
|
||||
|
||||
1) Define the reentrant versions of the syscalls directly.
|
||||
(eg: _open_r, _close_r, etc.). Please keep the namespace clean.
|
||||
When you do this, set "syscall_dir" to "syscalls" and add
|
||||
-DREENTRANT_SYSCALLS_PROVIDED to newlib_cflags in configure.host.
|
||||
|
||||
2) Define namespace clean versions of the system calls by prefixing
|
||||
them with '_' (eg: _open, _close, etc.). Technically, there won't be
|
||||
true reentrancy at the syscall level, but the library will be namespace
|
||||
clean.
|
||||
When you do this, set "syscall_dir" to "syscalls" in configure.host.
|
||||
|
||||
3) Define or otherwise provide the regular versions of the syscalls
|
||||
(eg: open, close, etc.). The library won't be reentrant nor namespace
|
||||
clean, but at least it will work.
|
||||
When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
|
||||
configure.host.
|
||||
|
||||
4) Define or otherwise provide the regular versions of the syscalls,
|
||||
and do not supply functional interfaces for any of the reentrant
|
||||
calls. With this method, the reentrant syscalls are redefined to
|
||||
directly call the regular system call without the reentrancy argument.
|
||||
When you do this, specify both -DREENTRANT_SYSCALLS_PROVIDED and
|
||||
-DMISSING_SYSCALL_NAMES via newlib_cflags in configure.host and do
|
||||
not specify "syscall_dir".
|
||||
|
||||
Stubs of the reentrant versions of the syscalls exist in the libc/reent
|
||||
source directory and are provided if REENTRANT_SYSCALLS_PROVIDED isn't
|
||||
defined. These stubs call the native system calls: _open, _close, etc.
|
||||
if MISSING_SYSCALL_NAMES is *not* defined, otherwise they call the
|
||||
non-underscored versions: open, close, etc. when MISSING_SYSCALL_NAMES
|
||||
*is* defined.
|
||||
|
||||
By default, newlib functions call the reentrant syscalls internally,
|
||||
passing a reentrancy structure as an argument. This reentrancy structure
|
||||
contains data that is thread-specific. For example, the errno value is
|
||||
kept in the reentrancy structure. If multiple threads exist, each will
|
||||
keep a separate errno value which is intuitive since the application flow
|
||||
cannot check for failure reliably otherwise.
|
||||
|
||||
The reentrant syscalls are either provided by the platform, by the
|
||||
libc/reent stubs, or in the case of both MISSING_SYSCALL_NAMES and
|
||||
REENTRANT_SYSCALLS_PROVIDED being defined, the calls are redefined to
|
||||
simply call the regular syscalls with no reentrancy struct argument.
|
||||
|
||||
A single-threaded application does not need to worry about the reentrancy
|
||||
structure. It is used internally.
|
||||
|
||||
A multi-threaded application needs either to manually manage reentrancy
|
||||
structures or use dynamic reentrancy.
|
||||
|
||||
Manually managing reentrancy structures entails calling special reentrant
|
||||
versions of newlib functions that have an additional reentrancy argument.
|
||||
For example, _printf_r. By convention, the first argument is the
|
||||
reentrancy structure. By default, the normal version of the function
|
||||
uses the default reentrancy structure: _REENT. The reentrancy structure
|
||||
is passed internally, eventually to the reentrant syscalls themselves.
|
||||
How the structures are stored and accessed in this model is up to the
|
||||
application.
|
||||
|
||||
Dynamic reentrancy is specified by the __DYNAMIC_REENT__ flag. This
|
||||
flag denotes setting up a macro to replace _REENT with a function call
|
||||
to __getreent(). This function needs to be implemented by the platform
|
||||
and it is meant to return the reentrancy structure for the current
|
||||
thread. When the regular C functions (e.g. printf) go to call internal
|
||||
routines with the default _REENT structure, they end up calling with
|
||||
the reentrancy structure for the thread. Thus, application code does not
|
||||
need to call the _r routines nor worry about reentrancy structures. */
|
||||
|
||||
/* 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 _REENT_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define _REENT_H_
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_ptrdiff_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* FIXME: not namespace clean */
|
||||
struct stat;
|
||||
struct tms;
|
||||
struct timeval;
|
||||
struct timezone;
|
||||
|
||||
#if defined(REENTRANT_SYSCALLS_PROVIDED) && defined(MISSING_SYSCALL_NAMES)
|
||||
|
||||
#define _close_r(__reent, __fd) close(__fd)
|
||||
#define _execve_r(__reent, __f, __arg, __env) execve(__f, __arg, __env)
|
||||
#define _fcntl_r(__reent, __fd, __cmd, __arg) fcntl(__fd, __cmd, __arg)
|
||||
#define _fork_r(__reent) fork()
|
||||
#define _fstat_r(__reent, __fdes, __stat) fstat(__fdes, __stat)
|
||||
#define _getpid_r(__reent) getpid()
|
||||
#define _isatty_r(__reent, __desc) isatty(__desc)
|
||||
#define _kill_r(__reent, __pid, __signal) kill(__pid, __signal)
|
||||
#define _link_r(__reent, __oldpath, __newpath) link(__oldpath, __newpath)
|
||||
#define _lseek_r(__reent, __fdes, __off, __w) lseek(__fdes, __off, __w)
|
||||
#define _mkdir_r(__reent, __path, __m) mkdir(__path, __m)
|
||||
#define _open_r(__reent, __path, __flag, __m) open(__path, __flag, __m)
|
||||
#define _read_r(__reent, __fd, __buff, __cnt) read(__fd, __buff, __cnt)
|
||||
#define _rename_r(__reent, __old, __new) rename(__old, __new)
|
||||
#define _sbrk_r(__reent, __incr) sbrk(__incr)
|
||||
#define _stat_r(__reent, __path, __buff) stat(__path, __buff)
|
||||
#define _times_r(__reent, __time) times(__time)
|
||||
#define _unlink_r(__reent, __path) unlink(__path)
|
||||
#define _wait_r(__reent, __status) wait(__status)
|
||||
#define _write_r(__reent, __fd, __buff, __cnt) write(__fd, __buff, __cnt)
|
||||
#define _gettimeofday_r(__reent, __tp, __tzp) gettimeofday(__tp, __tzp)
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
#define _lseek64_r(__reent, __fd, __off, __w) lseek64(__fd, __off, __w)
|
||||
#define _fstat64_r(__reent, __fd, __buff) fstat64(__fd, __buff)
|
||||
#define _open64_r(__reent, __path, __flag, __m) open64(__path, __flag, __m)
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* Reentrant versions of system calls. */
|
||||
|
||||
extern __stdargs int _close_r (struct _reent *, int);
|
||||
extern __stdargs int _execve_r (struct _reent *, const char *, char *const *, char *const *);
|
||||
extern __stdargs int _fcntl_r (struct _reent *, int, int, int);
|
||||
extern __stdargs int _fork_r (struct _reent *);
|
||||
extern __stdargs int _fstat_r (struct _reent *, int, struct stat *);
|
||||
extern __stdargs int _getpid_r (struct _reent *);
|
||||
extern __stdargs int _isatty_r (struct _reent *, int);
|
||||
extern __stdargs int _kill_r (struct _reent *, int, int);
|
||||
extern __stdargs int _link_r (struct _reent *, const char *, const char *);
|
||||
extern __stdargs _off_t _lseek_r (struct _reent *, int, _off_t, int);
|
||||
extern __stdargs int _mkdir_r (struct _reent *, const char *, int);
|
||||
extern __stdargs int _open_r (struct _reent *, const char *, int, int);
|
||||
extern __stdargs _ssize_t _read_r (struct _reent *, int, void *, size_t);
|
||||
extern __stdargs int _rename_r (struct _reent *, const char *, const char *);
|
||||
extern __stdargs void *_sbrk_r (struct _reent *, ptrdiff_t);
|
||||
extern __stdargs int _stat_r (struct _reent *, const char *, struct stat *);
|
||||
extern __stdargs _CLOCK_T_ _times_r (struct _reent *, struct tms *);
|
||||
extern __stdargs int _unlink_r (struct _reent *, const char *);
|
||||
extern __stdargs int _wait_r (struct _reent *, int *);
|
||||
extern __stdargs _ssize_t _write_r (struct _reent *, int, const void *, size_t);
|
||||
|
||||
/* This one is not guaranteed to be available on all targets. */
|
||||
extern __stdargs int _gettimeofday_r (struct _reent *, struct timeval *__tp, void *__tzp);
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#define stat64 stat
|
||||
#endif
|
||||
struct stat64;
|
||||
|
||||
extern __stdargs _off64_t _lseek64_r (struct _reent *, int, _off64_t, int);
|
||||
extern __stdargs int _fstat64_r (struct _reent *, int, struct stat64 *);
|
||||
extern __stdargs int _open64_r (struct _reent *, const char *, int, int);
|
||||
extern __stdargs int _stat64_r (struct _reent *, const char *, struct stat64 *);
|
||||
|
||||
/* Don't pollute namespace if not building newlib. */
|
||||
#if defined (__CYGWIN__) && !defined (_COMPILING_NEWLIB)
|
||||
#undef stat64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _REENT_H_ */
|
||||
@@ -0,0 +1,7 @@
|
||||
/* regdef.h -- define register names. */
|
||||
|
||||
/* This is a standard include file for MIPS targets. Other target
|
||||
probably don't define it, and attempts to include this file will
|
||||
fail. */
|
||||
|
||||
#include <machine/regdef.h>
|
||||
@@ -0,0 +1,103 @@
|
||||
/*-
|
||||
* Copyright (c) 1992 Henry Spencer.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Henry Spencer of the University of Toronto.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)regex.h 8.2 (Berkeley) 1/3/94
|
||||
* $FreeBSD: src/include/regex.h,v 1.4 2002/03/23 17:24:53 imp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _REGEX_H_
|
||||
#define _REGEX_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/* types */
|
||||
typedef off_t regoff_t;
|
||||
|
||||
typedef struct {
|
||||
int re_magic;
|
||||
size_t re_nsub; /* number of parenthesized subexpressions */
|
||||
__const char *re_endp; /* end pointer for REG_PEND */
|
||||
struct re_guts *re_g; /* none of your business :-) */
|
||||
} regex_t;
|
||||
|
||||
typedef struct {
|
||||
regoff_t rm_so; /* start of match */
|
||||
regoff_t rm_eo; /* end of match */
|
||||
} regmatch_t;
|
||||
|
||||
/* regcomp() flags */
|
||||
#define REG_BASIC 0000
|
||||
#define REG_EXTENDED 0001
|
||||
#define REG_ICASE 0002
|
||||
#define REG_NOSUB 0004
|
||||
#define REG_NEWLINE 0010
|
||||
#define REG_NOSPEC 0020
|
||||
#define REG_PEND 0040
|
||||
#define REG_DUMP 0200
|
||||
|
||||
/* regerror() flags */
|
||||
#define REG_NOMATCH 1
|
||||
#define REG_BADPAT 2
|
||||
#define REG_ECOLLATE 3
|
||||
#define REG_ECTYPE 4
|
||||
#define REG_EESCAPE 5
|
||||
#define REG_ESUBREG 6
|
||||
#define REG_EBRACK 7
|
||||
#define REG_EPAREN 8
|
||||
#define REG_EBRACE 9
|
||||
#define REG_BADBR 10
|
||||
#define REG_ERANGE 11
|
||||
#define REG_ESPACE 12
|
||||
#define REG_BADRPT 13
|
||||
#define REG_EMPTY 14
|
||||
#define REG_ASSERT 15
|
||||
#define REG_INVARG 16
|
||||
#define REG_ATOI 255 /* convert name to number (!) */
|
||||
#define REG_ITOA 0400 /* convert number to name (!) */
|
||||
|
||||
/* regexec() flags */
|
||||
#define REG_NOTBOL 00001
|
||||
#define REG_NOTEOL 00002
|
||||
#define REG_STARTEND 00004
|
||||
#define REG_TRACE 00400 /* tracing of execution */
|
||||
#define REG_LARGE 01000 /* force large representation */
|
||||
#define REG_BACKR 02000 /* force use of backref code */
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs int regcomp(regex_t *__restrict, const char *__restrict, int);
|
||||
__stdargs size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
|
||||
__stdargs int regexec(const regex_t *__restrict, const char *__restrict,
|
||||
size_t, regmatch_t [__restrict], int);
|
||||
__stdargs void regfree(regex_t *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_REGEX_H_ */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef _HEADERS_REGPARM_H
|
||||
#define _HEADERS_REGPARM_H
|
||||
|
||||
#define ___PUSH(a) "movel\t" #a ",sp@-\n"
|
||||
#define ___POP(a) "movel\tsp@+," #a "\n"
|
||||
|
||||
#ifndef SMALL_DATA
|
||||
|
||||
#define __REGP(functype,funcname,pushlist,popval) \
|
||||
asm(".even\n" ".globl _" #funcname "\n" "_" #funcname ":\n" \
|
||||
pushlist "jbsr\t___" #funcname "\n" "addqw\t#" #popval ",sp\n" \
|
||||
"rts\n"); functype __##funcname
|
||||
|
||||
#else
|
||||
|
||||
#define __REGP(functype,funcname,pushlist,popval) \
|
||||
asm(".even\n" ".globl _" #funcname "\n" "_" #funcname ":\n" ___PUSH(a4) \
|
||||
pushlist "jbsr\t_geta4\n" "jbsr\t___" #funcname "\n" "addqw\t#" #popval ",sp\n" \
|
||||
___POP(a4) "rts\n"); functype __##funcname
|
||||
|
||||
#endif
|
||||
|
||||
#define REGPARM1(functype,funcname,a1,r1) \
|
||||
__REGP(functype,funcname,___PUSH(r1),4) (a1)
|
||||
|
||||
#define REGPARM2(functype,funcname,a1,r1,a2,r2) \
|
||||
__REGP(functype,funcname,___PUSH(r2)___PUSH(r1),8) (a1,a2)
|
||||
|
||||
#define REGPARM3(functype,funcname,a1,r1,a2,r2,a3,r3) \
|
||||
__REGP(functype,funcname,___PUSH(r3)___PUSH(r2)___PUSH(r1),12) (a1,a2,a3)
|
||||
|
||||
#define REGPARM4(functype,funcname,a1,r1,a2,r2,a3,r3,a4,r4) \
|
||||
__REGP(functype,funcname,___PUSH(r4)___PUSH(r3)___PUSH(r2)___PUSH(r1),16) (a1,a2,a3,a4)
|
||||
|
||||
#endif /* _HEADERS_REGPARM_H */
|
||||
@@ -0,0 +1,166 @@
|
||||
/* $NetBSD: resolv.h,v 1.8 1994/10/26 00:56:16 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1987, 1989 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.
|
||||
*
|
||||
* @(#)resolv.h 5.15 (Berkeley) 4/3/91
|
||||
*/
|
||||
|
||||
#ifndef _RESOLV_H_
|
||||
#define _RESOLV_H_
|
||||
|
||||
/*
|
||||
* revision information. this is the release date in YYYYMMDD format.
|
||||
* it can change every day so the right thing to do with it is use it
|
||||
* in preprocessor commands such as "#if (__RES > 19931104)". do not
|
||||
* compare for equality; rather, use it to determine whether your resolver
|
||||
* is new enough to contain a certain feature.
|
||||
*/
|
||||
|
||||
#define __RES 19931104
|
||||
|
||||
/*
|
||||
* Resolver configuration file.
|
||||
* Normally not present, but may contain the address of the
|
||||
* inital name server(s) to query and the domain search list.
|
||||
*/
|
||||
|
||||
#ifndef _PATH_RESCONF
|
||||
#define _PATH_RESCONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global defines and variables for resolver stub.
|
||||
*/
|
||||
#define MAXNS 3 /* max # name servers we'll track */
|
||||
#define MAXDFLSRCH 3 /* # default domain levels to try */
|
||||
#define MAXDNSRCH 6 /* max # domains in search path */
|
||||
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
|
||||
#define MAXDNSLUS 4 /* max # of host lookup types */
|
||||
|
||||
#define RES_TIMEOUT 5 /* min. seconds between retries */
|
||||
#define MAXRESOLVSORT 10 /* number of net to sort on */
|
||||
#define RES_MAXNDOTS 15 /* should reflect bit field size */
|
||||
|
||||
struct __res_state {
|
||||
int retrans; /* retransmition time interval */
|
||||
int retry; /* number of times to retransmit */
|
||||
long options; /* option flags - see below. */
|
||||
int nscount; /* number of name servers */
|
||||
struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
|
||||
#define nsaddr nsaddr_list[0] /* for backward compatibility */
|
||||
u_short id; /* current packet id */
|
||||
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
||||
char defdname[MAXDNAME]; /* default domain */
|
||||
long pfcode; /* RES_PRF_ flags - see below. */
|
||||
u_char ndots:4; /* threshold for initial abs. query */
|
||||
u_char nsort:4; /* number of elements in sort_list[] */
|
||||
char unused[3];
|
||||
struct {
|
||||
struct in_addr addr;
|
||||
u_int32_t mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
char lookups[MAXDNSLUS];
|
||||
};
|
||||
|
||||
/*
|
||||
* Resolver options
|
||||
*/
|
||||
#define RES_INIT 0x0001 /* address initialized */
|
||||
#define RES_DEBUG 0x0002 /* print debug messages */
|
||||
#define RES_AAONLY 0x0004 /* authoritative answers only */
|
||||
#define RES_USEVC 0x0008 /* use virtual circuit */
|
||||
#define RES_PRIMARY 0x0010 /* query primary server only */
|
||||
#define RES_IGNTC 0x0020 /* ignore trucation errors */
|
||||
#define RES_RECURSE 0x0040 /* recursion desired */
|
||||
#define RES_DEFNAMES 0x0080 /* use default domain name */
|
||||
#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
|
||||
#define RES_DNSRCH 0x0200 /* search up local domain tree */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
|
||||
|
||||
/*
|
||||
* Resolver "pfcode" values. Used by dig.
|
||||
*/
|
||||
#define RES_PRF_STATS 0x0001
|
||||
/* 0x0002 */
|
||||
#define RES_PRF_CLASS 0x0004
|
||||
#define RES_PRF_CMD 0x0008
|
||||
#define RES_PRF_QUES 0x0010
|
||||
#define RES_PRF_ANS 0x0020
|
||||
#define RES_PRF_AUTH 0x0040
|
||||
#define RES_PRF_ADD 0x0080
|
||||
#define RES_PRF_HEAD1 0x0100
|
||||
#define RES_PRF_HEAD2 0x0200
|
||||
#define RES_PRF_TTLID 0x0400
|
||||
#define RES_PRF_HEADX 0x0800
|
||||
#define RES_PRF_QUERY 0x1000
|
||||
#define RES_PRF_REPLY 0x2000
|
||||
#define RES_PRF_INIT 0x4000
|
||||
/* 0x8000 */
|
||||
|
||||
extern struct __res_state _res;
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Private routines shared between libc/net, named, nslookup and others. */
|
||||
#define dn_skipname __dn_skipname
|
||||
#define fp_query __fp_query
|
||||
#define hostalias __hostalias
|
||||
#define putlong __putlong
|
||||
#define putshort __putshort
|
||||
#define p_class __p_class
|
||||
#define p_time __p_time
|
||||
#define p_type __p_type
|
||||
__BEGIN_DECLS
|
||||
__stdargs int __dn_skipname __P((const u_char *, const u_char *));
|
||||
__stdargs void __fp_query __P((char *, FILE *));
|
||||
__stdargs char *__hostalias __P((const char *));
|
||||
__stdargs void __putlong __P((u_int32_t, u_char *));
|
||||
__stdargs void __putshort __P((u_int16_t, u_char *));
|
||||
__stdargs char *__p_class __P((int));
|
||||
__stdargs char *__p_time __P((u_int32_t));
|
||||
__stdargs char *__p_type __P((int));
|
||||
|
||||
__stdargs int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
|
||||
__stdargs int dn_expand __P((const u_char *, const u_char *, const u_char *,
|
||||
u_char *, int));
|
||||
__stdargs int res_init __P((void));
|
||||
__stdargs int res_query __P((char *, int, int, u_char *, int));
|
||||
__stdargs int res_search __P((const char *, int, int, u_char *, int));
|
||||
__stdargs int res_mkquery __P((int, const char *, int, int, const char *, int,
|
||||
const char *, char *, int));
|
||||
__stdargs int res_send __P((const char *, int, char *, int));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RESOLV_H_ */
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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 _SCHED_H_
|
||||
#define _SCHED_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sched.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
/*
|
||||
* XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803
|
||||
*/
|
||||
__stdargs int sched_setparam(
|
||||
pid_t __pid,
|
||||
const struct sched_param *__param
|
||||
);
|
||||
|
||||
/*
|
||||
* XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800
|
||||
*/
|
||||
__stdargs int sched_getparam(
|
||||
pid_t __pid,
|
||||
struct sched_param *__param
|
||||
);
|
||||
|
||||
/*
|
||||
* XBD 13 - Set Scheduling Policy and Scheduling Parameters,
|
||||
* P1003.1b-2008, p. 1805
|
||||
*/
|
||||
__stdargs int sched_setscheduler(
|
||||
pid_t __pid,
|
||||
int __policy,
|
||||
const struct sched_param *__param
|
||||
);
|
||||
|
||||
/*
|
||||
* XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801
|
||||
*/
|
||||
__stdargs int sched_getscheduler(
|
||||
pid_t __pid
|
||||
);
|
||||
|
||||
/*
|
||||
* XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799
|
||||
*/
|
||||
__stdargs int sched_get_priority_max(
|
||||
int __policy
|
||||
);
|
||||
|
||||
__stdargs int sched_get_priority_min(
|
||||
int __policy
|
||||
);
|
||||
|
||||
/*
|
||||
* XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802
|
||||
*/
|
||||
__stdargs int sched_rr_get_interval(
|
||||
pid_t __pid,
|
||||
struct timespec *__interval
|
||||
);
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* XBD 13 - Yield Processor, P1003.1b-2008, p. 1807
|
||||
*/
|
||||
__stdargs int sched_yield( void );
|
||||
|
||||
#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCHED_H_ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
|
||||
/* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#ifndef _SEARCH_H_
|
||||
#define _SEARCH_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct entry {
|
||||
char *key;
|
||||
void *data;
|
||||
} ENTRY;
|
||||
|
||||
typedef enum {
|
||||
FIND, ENTER
|
||||
} ACTION;
|
||||
|
||||
typedef enum {
|
||||
preorder,
|
||||
postorder,
|
||||
endorder,
|
||||
leaf
|
||||
} VISIT;
|
||||
|
||||
#ifdef _SEARCH_PRIVATE
|
||||
typedef struct node {
|
||||
char *key;
|
||||
struct node *llink, *rlink;
|
||||
} node_t;
|
||||
#endif
|
||||
|
||||
struct hsearch_data
|
||||
{
|
||||
struct internal_head *htable;
|
||||
size_t htablesize;
|
||||
};
|
||||
|
||||
#ifndef __compar_fn_t_defined
|
||||
#define __compar_fn_t_defined
|
||||
typedef int (*__compar_fn_t) (const void *, const void *);
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs int hcreate(size_t);
|
||||
__stdargs void hdestroy(void);
|
||||
__stdargs ENTRY *hsearch(ENTRY, ACTION);
|
||||
__stdargs int hcreate_r(size_t, struct hsearch_data *);
|
||||
__stdargs void hdestroy_r(struct hsearch_data *);
|
||||
__stdargs int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
|
||||
__stdargs void *tdelete(const void *__restrict, void **__restrict, __compar_fn_t);
|
||||
__stdargs void tdestroy (void *, void (*)(void *));
|
||||
__stdargs void *tfind(const void *, void **, __compar_fn_t);
|
||||
__stdargs void *tsearch(const void *, void **, __compar_fn_t);
|
||||
__stdargs void twalk(const void *, void (*)(const void *, VISIT, int));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SEARCH_H_ */
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef _HEADERS_SELECT_H
|
||||
#define _HEADERS_SELECT_H
|
||||
|
||||
#define SELCMD_PREPARE 0
|
||||
#define SELCMD_CHECK 1
|
||||
#define SELCMD_POLL 2
|
||||
|
||||
#define SELMODE_IN 0
|
||||
#define SELMODE_OUT 1
|
||||
#define SELMODE_EXC 2
|
||||
|
||||
#define SELPKT_IN_USE(fp) ((fp)->lx_packet->sp_Pkt.dp_Port != NULL)
|
||||
|
||||
#define SelLastResult(fp) ((fp)->lx_packet->sp_Pkt.dp_Res1)
|
||||
#define SelLastError(fp) ((fp)->lx_packet->sp_Pkt.dp_Res2)
|
||||
|
||||
#define PutPacket(port,pack) PutMsg((port),(pack))
|
||||
#define GetPacket(port) ((struct StandardPacket *)GetMsg(port))
|
||||
#define SelSendPacket1(fp,port,act,arg1) \
|
||||
do { \
|
||||
struct StandardPacket *sp = (fp)->lx_packet; \
|
||||
sp->sp_Pkt.dp_Port = (port); \
|
||||
sp->sp_Pkt.dp_Type = (act); \
|
||||
sp->sp_Pkt.dp_Arg1 = (arg1); \
|
||||
PutPacket(((struct FileHandle *)BADDR((fp)->lx_fh))->fh_Type,&sp->sp_Msg); \
|
||||
} while(0)
|
||||
|
||||
#endif /* _HEADERS_SELECT_H */
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
setjmp.h
|
||||
stubs for future use.
|
||||
*/
|
||||
|
||||
#ifndef _SETJMP_H_
|
||||
#define _SETJMP_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
__stdargs void longjmp (jmp_buf __jmpb, int __retval)
|
||||
__attribute__ ((__noreturn__));
|
||||
#else
|
||||
__stdargs void longjmp (jmp_buf __jmpb, int __retval);
|
||||
#endif
|
||||
__stdargs int setjmp (jmp_buf __jmpb);
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _SETJMP_H_ */
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 1985 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.
|
||||
*
|
||||
* @(#)sgtty.h 5.2 (Berkeley) 6/26/91
|
||||
*/
|
||||
|
||||
#ifndef USE_OLD_TTY
|
||||
#define USE_OLD_TTY
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef _SIGNAL_H_
|
||||
#define _SIGNAL_H_
|
||||
|
||||
#include "_ansi.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
typedef int sig_atomic_t; /* Atomic entity type (ANSI) */
|
||||
#if __BSD_VISIBLE
|
||||
typedef _sig_func_ptr sig_t; /* BSD naming */
|
||||
#endif
|
||||
#if __GNU_VISIBLE
|
||||
typedef _sig_func_ptr sighandler_t; /* glibc naming */
|
||||
#endif
|
||||
|
||||
#define SIG_DFL ((_sig_func_ptr)0) /* Default action */
|
||||
#define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */
|
||||
#define SIG_ERR ((_sig_func_ptr)-1) /* Error return */
|
||||
|
||||
struct _reent;
|
||||
|
||||
__stdargs _sig_func_ptr _signal_r (struct _reent *, int, _sig_func_ptr);
|
||||
__stdargs int _raise_r (struct _reent *, int);
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
__stdargs _sig_func_ptr signal (int, _sig_func_ptr);
|
||||
__stdargs int raise (int);
|
||||
__stdargs void psignal (int, const char *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SA_FLAGS values:
|
||||
*
|
||||
* SA_ONSTACK indicates that a registered stack_t will be used.
|
||||
* SA_RESTART flag to get restarting signals (which were the default long ago)
|
||||
* SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
|
||||
* SA_RESETHAND clears the handler when the signal is delivered.
|
||||
* SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
|
||||
* SA_NODEFER prevents the current signal from being masked in the handler.
|
||||
*
|
||||
* SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
|
||||
* Unix names RESETHAND and NODEFER respectively.
|
||||
*/
|
||||
#define SA_NOCLDSTOP 0x00000001
|
||||
#define SA_NOCLDWAIT 0x00000002
|
||||
#define SA_SIGINFO 0x00000004
|
||||
#define SA_ONSTACK 0x08000000
|
||||
#define SA_RESTART 0x10000000
|
||||
#define SA_NODEFER 0x40000000
|
||||
#define SA_RESETHAND 0x80000000
|
||||
|
||||
#define SA_NOMASK SA_NODEFER
|
||||
#define SA_ONESHOT SA_RESETHAND
|
||||
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _SIGNAL_H_ */
|
||||
@@ -0,0 +1,108 @@
|
||||
#ifndef _HEADERS_SOCKET_H
|
||||
#define _HEADERS_SOCKET_H
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
#include <netdb.h>
|
||||
#include <amitcp/usergroup.h>
|
||||
#include <amitcp/socketbasetags.h>
|
||||
#include "inline/usergroup.h"
|
||||
#include <inline/amitcp.h>
|
||||
#include <inline/as225.h>
|
||||
#include "stdio.h"
|
||||
|
||||
#ifndef MAXLOGNAME
|
||||
#define MAXLOGNAME 12
|
||||
#endif
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
typedef enum {LX_NONE, LX_AMITCP, LX_AS225} LX_NETWORK_TYPE;
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
struct SocketSettings {
|
||||
LX_NETWORK_TYPE lx_network_type;
|
||||
union {
|
||||
struct {
|
||||
struct Library *BsdSocketBase;
|
||||
struct Library *UserGroupBase;
|
||||
} AMITCP;
|
||||
struct {
|
||||
struct Library *SocketBase;
|
||||
} AS225;
|
||||
} lx_stack;
|
||||
#define lx_BsdSocketBase lx_stack.AMITCP.BsdSocketBase
|
||||
#define lx_UserGroupBase lx_stack.AMITCP.UserGroupBase
|
||||
#define lx_SocketBase lx_stack.AS225.SocketBase
|
||||
|
||||
unsigned long lx_sigurg;
|
||||
unsigned long lx_sigio;
|
||||
int lx_sockid;
|
||||
int lx_isdaemon;
|
||||
|
||||
/* Support for net functions */
|
||||
FILE *lx_pwd_fp; /* File pointer to the passwd file */
|
||||
char *lx_pwd_line; /* buffer for reading a line from the passwd file */
|
||||
struct passwd lx_pwd; /* static buffer to hold the data */
|
||||
int lx_pwd_stayopen;/* TRUE if passwd file should stay open */
|
||||
|
||||
FILE *lx_grp_fp; /* File pointer to the groups file */
|
||||
char *lx_grp_line; /* buffer for reading a line from the group file */
|
||||
struct group lx_grp; /* static buffer to hold the data */
|
||||
char **lx_members; /* array of group members */
|
||||
int lx_grp_stayopen;/* TRUE if group file should stay open */
|
||||
|
||||
FILE *lx_net_fp; /* File pointer to protocol file */
|
||||
char *lx_net_line; /* buffer for reading a line from the protocol file */
|
||||
struct netent lx_net;
|
||||
char **lx_net_aliases;
|
||||
int lx_net_stayopen;
|
||||
|
||||
FILE *lx_serv_fp; /* File pointer to services file */
|
||||
char *lx_serv_line; /* buffer for reading a line from the services file */
|
||||
struct servent lx_serv;
|
||||
char **lx_serv_aliases;
|
||||
int lx_serv_stayopen;
|
||||
|
||||
FILE *lx_proto_fp; /* File pointer to protocol file */
|
||||
char *lx_proto_line; /* buffer for reading a line from the protocol file */
|
||||
struct protoent lx_proto;
|
||||
char **lx_proto_aliases;
|
||||
int lx_proto_stayopen;
|
||||
|
||||
/* resolv state structure */
|
||||
struct __res_state *lx_res;
|
||||
int *lx_res_socket;
|
||||
|
||||
/* XXX unused XXX */
|
||||
int lx_logname_valid;
|
||||
char lx_logname[MAXLOGNAME + 1];
|
||||
char lx_logname_buf[MAXLOGNAME + 1];
|
||||
|
||||
/* XXX unused XXX */
|
||||
char lx_ntoa_buf[18]; /* used by inet_ntoa */
|
||||
|
||||
/* logfile handling */
|
||||
int lx_LogFile; /* fd for log */
|
||||
int lx_LogStat; /* status bits, set by openlog() */
|
||||
char *lx_LogTag; /* string to tag the entry with */
|
||||
int lx_LogFacility; /* default facility code */
|
||||
int lx_LogMask; /* mask of priorities to be logged */
|
||||
int lx_setuid; /* used for setuid() - have to remember to log out */
|
||||
};
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
extern __stdargs struct SocketSettings *_lx_get_socket_settings(void);
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
extern __stdargs StdFileDes *_create_socket(int family, int type, int protocol);
|
||||
|
||||
#endif /* _HEADERS_SOCKET_H */
|
||||
@@ -0,0 +1,104 @@
|
||||
/*-
|
||||
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
#ifndef _SPAWN_H_
|
||||
#define _SPAWN_H_
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/_types.h>
|
||||
#define __need_sigset_t
|
||||
#include <signal.h>
|
||||
|
||||
struct sched_param;
|
||||
|
||||
typedef struct __posix_spawnattr *posix_spawnattr_t;
|
||||
typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t;
|
||||
|
||||
#define POSIX_SPAWN_RESETIDS 0x01
|
||||
#define POSIX_SPAWN_SETPGROUP 0x02
|
||||
#define POSIX_SPAWN_SETSCHEDPARAM 0x04
|
||||
#define POSIX_SPAWN_SETSCHEDULER 0x08
|
||||
#define POSIX_SPAWN_SETSIGDEF 0x10
|
||||
#define POSIX_SPAWN_SETSIGMASK 0x20
|
||||
|
||||
_BEGIN_STD_C
|
||||
/*
|
||||
* Spawn routines
|
||||
*
|
||||
* XXX both arrays should be __restrict, but this does not work when GCC
|
||||
* is invoked with -std=c99.
|
||||
*/
|
||||
__stdargs int posix_spawn (pid_t * __restrict, const char * __restrict,
|
||||
const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
|
||||
char * const [], char * const []);
|
||||
__stdargs int posix_spawnp (pid_t * __restrict, const char * __restrict,
|
||||
const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
|
||||
char * const [], char * const []);
|
||||
|
||||
/*
|
||||
* File descriptor actions
|
||||
*/
|
||||
__stdargs int posix_spawn_file_actions_init (posix_spawn_file_actions_t *);
|
||||
__stdargs int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *);
|
||||
|
||||
__stdargs int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict,
|
||||
int, const char * __restrict, int, mode_t);
|
||||
__stdargs int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *, int, int);
|
||||
__stdargs int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *, int);
|
||||
|
||||
/*
|
||||
* Spawn attributes
|
||||
*/
|
||||
__stdargs int posix_spawnattr_init (posix_spawnattr_t *);
|
||||
__stdargs int posix_spawnattr_destroy (posix_spawnattr_t *);
|
||||
|
||||
__stdargs int posix_spawnattr_getflags (const posix_spawnattr_t * __restrict,
|
||||
short * __restrict);
|
||||
__stdargs int posix_spawnattr_getpgroup (const posix_spawnattr_t * __restrict,
|
||||
pid_t * __restrict);
|
||||
__stdargs int posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict,
|
||||
struct sched_param * __restrict);
|
||||
__stdargs int posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict,
|
||||
int * __restrict);
|
||||
__stdargs int posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict,
|
||||
sigset_t * __restrict);
|
||||
__stdargs int posix_spawnattr_getsigmask (const posix_spawnattr_t * __restrict,
|
||||
sigset_t * __restrict);
|
||||
|
||||
__stdargs int posix_spawnattr_setflags (posix_spawnattr_t *, short);
|
||||
__stdargs int posix_spawnattr_setpgroup (posix_spawnattr_t *, pid_t);
|
||||
__stdargs int posix_spawnattr_setschedparam (posix_spawnattr_t * __restrict,
|
||||
const struct sched_param * __restrict);
|
||||
__stdargs int posix_spawnattr_setschedpolicy (posix_spawnattr_t *, int);
|
||||
__stdargs int posix_spawnattr_setsigdefault (posix_spawnattr_t * __restrict,
|
||||
const sigset_t * __restrict);
|
||||
__stdargs int posix_spawnattr_setsigmask (posix_spawnattr_t * __restrict,
|
||||
const sigset_t * __restrict);
|
||||
_END_STD_C
|
||||
|
||||
#endif /* !_SPAWN_H_ */
|
||||
@@ -0,0 +1,76 @@
|
||||
/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2011 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _SSP_SSP_H_
|
||||
#define _SSP_SSP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/* __ssp_real is used by the implementation in libc */
|
||||
#if __SSP_FORTIFY_LEVEL == 0
|
||||
#define __ssp_real_(fun) fun
|
||||
#else
|
||||
#define __ssp_real_(fun) __ssp_real_ ## fun
|
||||
#endif
|
||||
#define __ssp_real(fun) __ssp_real_(fun)
|
||||
|
||||
#define __ssp_inline extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
|
||||
|
||||
#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1)
|
||||
#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
|
||||
|
||||
#define __ssp_check(buf, len, bos) \
|
||||
if (bos(buf) != (size_t)-1 && len > bos(buf)) \
|
||||
__chk_fail()
|
||||
#define __ssp_decl(rtype, fun, args) \
|
||||
__stdargs rtype __ssp_real_(fun) args __asm__(__ASMNAME(#fun)); \
|
||||
__ssp_inline rtype fun args
|
||||
#define __ssp_redirect_raw(rtype, fun, args, call, cond, bos) \
|
||||
__ssp_decl(rtype, fun, args) \
|
||||
{ \
|
||||
if (cond) \
|
||||
__ssp_check(__buf, __len, bos); \
|
||||
__stdargs return __ssp_real_(fun) call; \
|
||||
}
|
||||
|
||||
#define __ssp_redirect(rtype, fun, args, call) \
|
||||
__ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos)
|
||||
#define __ssp_redirect0(rtype, fun, args, call) \
|
||||
__ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos0)
|
||||
|
||||
#define __ssp_overlap(a, b, l) \
|
||||
(((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l)))
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs void __stack_chk_fail(void) __dead2;
|
||||
__stdargs void __chk_fail(void) __dead2;
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SSP_SSP_H_ */
|
||||
@@ -0,0 +1,101 @@
|
||||
/* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _SSP_STDIO_H_
|
||||
#define _SSP_STDIO_H_
|
||||
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...)
|
||||
__printflike(4, 5);
|
||||
__stdargs int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict,
|
||||
__va_list)
|
||||
__printflike(4, 0);
|
||||
__stdargs int __snprintf_chk(char *__restrict, size_t, int, size_t,
|
||||
const char *__restrict, ...)
|
||||
__printflike(5, 6);
|
||||
__stdargs int __vsnprintf_chk(char *__restrict, size_t, int, size_t,
|
||||
const char *__restrict, __va_list)
|
||||
__printflike(5, 0);
|
||||
__stdargs char *__gets_chk(char *, size_t);
|
||||
__END_DECLS
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
|
||||
#define sprintf(str, ...) \
|
||||
__builtin___sprintf_chk(str, 0, __ssp_bos(str), __VA_ARGS__)
|
||||
|
||||
#define vsprintf(str, fmt, ap) \
|
||||
__builtin___vsprintf_chk(str, 0, __ssp_bos(str), fmt, ap)
|
||||
|
||||
#define snprintf(str, len, ...) \
|
||||
__builtin___snprintf_chk(str, len, 0, __ssp_bos(str), __VA_ARGS__)
|
||||
|
||||
#define vsnprintf(str, len, fmt, ap) \
|
||||
__builtin___vsnprintf_chk(str, len, 0, __ssp_bos(str), fmt, ap)
|
||||
|
||||
#define gets(str) \
|
||||
__gets_chk(str, __ssp_bos(str))
|
||||
|
||||
__ssp_decl(char *, fgets, (char *__restrict __buf, int __len, FILE *__fp))
|
||||
{
|
||||
if (__len > 0)
|
||||
__ssp_check(__buf, (size_t)__len, __ssp_bos);
|
||||
return __ssp_real_fgets(__buf, __len, __fp);
|
||||
}
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
__ssp_decl(char *, fgets_unlocked, (char *__restrict __buf, int __len, FILE *__fp))
|
||||
{
|
||||
if (__len > 0)
|
||||
__ssp_check(__buf, (size_t)__len, __ssp_bos);
|
||||
return __ssp_real_fgets_unlocked(__buf, __len, __fp);
|
||||
}
|
||||
#endif /* __GNU_VISIBLE */
|
||||
|
||||
__ssp_decl(size_t, fread, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp))
|
||||
{
|
||||
__ssp_check(__ptr, __size * __n, __ssp_bos0);
|
||||
return __ssp_real_fread(__ptr, __size, __n, __fp);
|
||||
}
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
__ssp_decl(size_t, fread_unlocked, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp))
|
||||
{
|
||||
__ssp_check(__ptr, __size * __n, __ssp_bos0);
|
||||
return __ssp_real_fread_unlocked(__ptr, __size, __n, __fp);
|
||||
}
|
||||
#endif /* __MISC_VISIBLE */
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
|
||||
#endif /* _SSP_STDIO_H_ */
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef _SSP_STDLIB_H_
|
||||
#define _SSP_STDLIB_H_
|
||||
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
__BEGIN_DECLS
|
||||
|
||||
__ssp_decl(size_t, mbstowcs, (wchar_t *__buf, const char *__src, size_t __n))
|
||||
{
|
||||
if (__buf != NULL)
|
||||
__ssp_check(__buf, __n * sizeof(wchar_t), __ssp_bos);
|
||||
return __ssp_real_mbstowcs (__buf, __src, __n);
|
||||
}
|
||||
|
||||
__ssp_redirect_raw(size_t, wcstombs, \
|
||||
(char *__buf, const wchar_t *__src, size_t __len), \
|
||||
(__buf, __src, __len), __buf != NULL, __ssp_bos);
|
||||
|
||||
__ssp_decl(int, wctomb, (char *__buf, wchar_t __wc))
|
||||
{
|
||||
if (__buf != NULL)
|
||||
__ssp_check(__buf, MB_CUR_MAX, __ssp_bos);
|
||||
return __ssp_real_wctomb (__buf, __wc);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_STDLIB_H_ */
|
||||
@@ -0,0 +1,115 @@
|
||||
/* $NetBSD: string.h,v 1.13 2014/11/29 13:23:48 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _SSP_STRING_H_
|
||||
#define _SSP_STRING_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
__stdargs void *__memcpy_chk(void *, const void *, size_t, size_t);
|
||||
__stdargs void *__memmove_chk(void *, void *, size_t, size_t);
|
||||
__stdargs void *__mempcpy_chk(void *, const void *, size_t, size_t);
|
||||
__stdargs void *__memset_chk(void *, int, size_t, size_t);
|
||||
__stdargs char *__stpcpy_chk(char *, const char *, size_t);
|
||||
__stdargs char *__strcat_chk(char *, const char *, size_t);
|
||||
__stdargs char *__strcpy_chk(char *, const char *, size_t);
|
||||
__stdargs char *__strncat_chk(char *, const char *, size_t, size_t);
|
||||
__stdargs char *__strncpy_chk(char *, const char *, size_t, size_t);
|
||||
__END_DECLS
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#define __ssp_bos_check3(fun, dst, src, len) \
|
||||
((__ssp_bos0(dst) != (size_t)-1) ? \
|
||||
__builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)) : \
|
||||
__ ## fun ## _ichk(dst, src, len))
|
||||
|
||||
#define __ssp_bos_check2(fun, dst, src) \
|
||||
((__ssp_bos0(dst) != (size_t)-1) ? \
|
||||
__builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)) : \
|
||||
__ ## fun ## _ichk(dst, src))
|
||||
|
||||
#define __ssp_bos_icheck3_restrict(fun, type1, type2) \
|
||||
__ssp_inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \
|
||||
__ssp_inline type1 \
|
||||
__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \
|
||||
return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
|
||||
}
|
||||
|
||||
#define __ssp_bos_icheck3(fun, type1, type2) \
|
||||
__ssp_inline type1 __ ## fun ## _ichk(type1, type2, size_t); \
|
||||
__ssp_inline type1 \
|
||||
__ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \
|
||||
return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
|
||||
}
|
||||
|
||||
#define __ssp_bos_icheck2_restrict(fun, type1, type2) \
|
||||
__ssp_inline type1 __ ## fun ## _ichk(type1, type2); \
|
||||
__ssp_inline type1 \
|
||||
__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \
|
||||
return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \
|
||||
}
|
||||
|
||||
__BEGIN_DECLS
|
||||
__ssp_bos_icheck3_restrict(memcpy, void *, const void *)
|
||||
__ssp_bos_icheck3(memmove, void *, const void *)
|
||||
__ssp_bos_icheck3_restrict(mempcpy, void *, const void *)
|
||||
__ssp_bos_icheck3(memset, void *, int)
|
||||
__ssp_bos_icheck2_restrict(stpcpy, char *, const char *)
|
||||
#if __GNUC_PREREQ__(4,8) || defined(__clang__)
|
||||
__ssp_bos_icheck3_restrict(stpncpy, char *, const char *)
|
||||
#endif
|
||||
__ssp_bos_icheck2_restrict(strcpy, char *, const char *)
|
||||
__ssp_bos_icheck2_restrict(strcat, char *, const char *)
|
||||
__ssp_bos_icheck3_restrict(strncpy, char *, const char *)
|
||||
__ssp_bos_icheck3_restrict(strncat, char *, const char *)
|
||||
__END_DECLS
|
||||
|
||||
#define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
|
||||
#define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len)
|
||||
#if __GNU_VISIBLE
|
||||
#define mempcpy(dst, src, len) __ssp_bos_check3(mempcpy, dst, src, len)
|
||||
#endif
|
||||
#define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len)
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src)
|
||||
#if __GNUC_PREREQ__(4,8) || defined(__clang__)
|
||||
#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len)
|
||||
#endif
|
||||
#endif
|
||||
#define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src)
|
||||
#define strcat(dst, src) __ssp_bos_check2(strcat, dst, src)
|
||||
#define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
|
||||
#define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len)
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_STRING_H_ */
|
||||
@@ -0,0 +1,55 @@
|
||||
/* $NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _SSP_STRINGS_H_
|
||||
#define _SSP_STRINGS_H_
|
||||
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
|
||||
#define bcopy(src, dst, len) \
|
||||
((__ssp_bos0(dst) != (size_t)-1) ? \
|
||||
__builtin___memmove_chk(dst, src, len, __ssp_bos0(dst)) : \
|
||||
__memmove_ichk(dst, src, len))
|
||||
#define bzero(dst, len) \
|
||||
((__ssp_bos0(dst) != (size_t)-1) ? \
|
||||
__builtin___memset_chk(dst, 0, len, __ssp_bos0(dst)) : \
|
||||
__memset_ichk(dst, 0, len))
|
||||
#endif
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
__ssp_redirect0(void, explicit_bzero, (void *__buf, size_t __len), \
|
||||
(__buf, __len));
|
||||
#endif
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_STRINGS_H_ */
|
||||
@@ -0,0 +1,93 @@
|
||||
/* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _SSP_UNISTD_H_
|
||||
#define _SSP_UNISTD_H_
|
||||
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __POSIX_VISIBLE >= 199209
|
||||
__ssp_redirect(size_t, confstr, (int __name, char *__buf, size_t __len), \
|
||||
(__name, __buf, __len));
|
||||
#endif
|
||||
|
||||
__ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len),
|
||||
(__buf, __len), __buf != 0, __ssp_bos);
|
||||
|
||||
#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
|
||||
__ssp_redirect(int, getdomainname, (char *__buf, size_t __len), \
|
||||
(__buf, __len));
|
||||
#endif
|
||||
|
||||
__ssp_decl(int, getgroups, (int __n, gid_t __buf[]))
|
||||
{
|
||||
__ssp_check(__buf, __n * sizeof(gid_t), __ssp_bos);
|
||||
return __ssp_real_getgroups (__n, __buf);
|
||||
}
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
|
||||
#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
|
||||
__ssp_redirect(int, gethostname, (char *__buf, size_t __len), \
|
||||
(__buf, __len));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), \
|
||||
(__buf, __len));
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
|
||||
__ssp_redirect0(ssize_t, pread, (int __fd, void *__buf, size_t __len, off_t __off), \
|
||||
(__fd, __buf, __len, __off));
|
||||
#endif
|
||||
|
||||
__ssp_redirect0(_READ_WRITE_RETURN_TYPE, read, \
|
||||
(int __fd, void *__buf, size_t __len), (__fd, __buf, __len));
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
|
||||
__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \
|
||||
char *__restrict __buf, size_t __len), (__path, __buf, __len));
|
||||
#endif
|
||||
|
||||
#if __ATFILE_VISIBLE
|
||||
__ssp_redirect(ssize_t, readlinkat, \
|
||||
(int __dirfd1, const char *__restrict __path, char *__restrict __buf, size_t __len), \
|
||||
(__dirfd1, __path, __buf, __len));
|
||||
#endif
|
||||
|
||||
__ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), \
|
||||
(__fd, __buf, __len));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_UNISTD_H_ */
|
||||
@@ -0,0 +1,97 @@
|
||||
#ifndef _SSP_WCHAR_H_
|
||||
#define _SSP_WCHAR_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <ssp/ssp.h>
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
/* wide character variant, __wlen is number of wchar_t */
|
||||
#define __ssp_redirect_wc(rtype, fun, args, call, cond, bos) \
|
||||
__ssp_decl(rtype, fun, args) \
|
||||
{ \
|
||||
if (cond) \
|
||||
__ssp_check(__buf, __wlen * sizeof(wchar_t), bos); \
|
||||
__stdargs return __ssp_real_(fun) call; \
|
||||
}
|
||||
|
||||
#define __ssp_bos_wicheck3(fun) \
|
||||
__ssp_redirect_wc(wchar_t *, fun, \
|
||||
(wchar_t *__buf, const wchar_t *__src, size_t __wlen), \
|
||||
(__buf, __src, __wlen), 1, __ssp_bos0)
|
||||
|
||||
#define __ssp_bos_wicheck3_restrict(fun) \
|
||||
__ssp_redirect_wc(wchar_t *, fun, \
|
||||
(wchar_t *__restrict __buf, const wchar_t *__restrict __src, size_t __wlen), \
|
||||
(__buf, __src, __wlen), 1, __ssp_bos0)
|
||||
|
||||
#define __ssp_bos_wicheck2_restrict(fun) \
|
||||
__ssp_decl(wchar_t *, fun, (wchar_t *__restrict __buf, const wchar_t *__restrict __src)) \
|
||||
{ \
|
||||
__ssp_check(__buf, (wcslen(__src) + 1) * sizeof(wchar_t), __ssp_bos0); \
|
||||
__stdargs return __ssp_real_(fun) (__buf, __src); \
|
||||
}
|
||||
|
||||
__BEGIN_DECLS
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
__ssp_bos_wicheck2_restrict(wcpcpy)
|
||||
__ssp_bos_wicheck3_restrict(wcpncpy)
|
||||
#endif
|
||||
__ssp_bos_wicheck2_restrict(wcscpy)
|
||||
__ssp_bos_wicheck2_restrict(wcscat)
|
||||
__ssp_bos_wicheck3_restrict(wcsncpy)
|
||||
__ssp_bos_wicheck3_restrict(wcsncat)
|
||||
__ssp_bos_wicheck3_restrict(wmemcpy)
|
||||
__ssp_bos_wicheck3(wmemmove)
|
||||
#if __GNU_VISIBLE
|
||||
__ssp_bos_wicheck3_restrict(wmempcpy)
|
||||
#endif
|
||||
__ssp_redirect_wc(wchar_t *, wmemset, \
|
||||
(wchar_t *__buf, wchar_t __src, size_t __wlen), \
|
||||
(__buf, __src, __wlen), 1, __ssp_bos0)
|
||||
|
||||
__ssp_decl(size_t, wcrtomb, (char *__buf, wchar_t __src, mbstate_t *__ps))
|
||||
{
|
||||
if (__buf != NULL && __src != L'\0')
|
||||
__ssp_check(__buf, sizeof(wchar_t), __ssp_bos);
|
||||
return __ssp_real_wcrtomb (__buf, __src, __ps);
|
||||
}
|
||||
|
||||
__ssp_redirect_wc(size_t, mbsrtowcs, \
|
||||
(wchar_t *__buf, const char **__src, size_t __wlen, mbstate_t *__ps), \
|
||||
(__buf, __src, __wlen, __ps), __buf != NULL, __ssp_bos)
|
||||
|
||||
__ssp_redirect_raw(size_t, wcsrtombs, \
|
||||
(char *__buf, const wchar_t **__src, size_t __len, mbstate_t *__ps), \
|
||||
(__buf, __src, __len, __ps), __buf != NULL, __ssp_bos)
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
__ssp_redirect_wc(size_t, mbsnrtowcs, \
|
||||
(wchar_t *__buf, const char **__src, size_t __nms, size_t __wlen, mbstate_t *__ps), \
|
||||
(__buf, __src, __nms, __wlen, __ps), __buf != NULL, __ssp_bos)
|
||||
|
||||
__ssp_redirect_raw(size_t, wcsnrtombs, \
|
||||
(char *__buf, const wchar_t **__src, size_t __nwc, size_t __len, mbstate_t *__ps), \
|
||||
(__buf, __src, __nwc, __len, __ps), __buf != NULL, __ssp_bos)
|
||||
#endif
|
||||
|
||||
__ssp_decl(wchar_t *, fgetws, (wchar_t *__restrict __buf, int __wlen, __FILE *__restrict __fp))
|
||||
{
|
||||
if (__wlen > 0)
|
||||
__ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos);
|
||||
__stdargs return __ssp_real_fgetws(__buf, __wlen, __fp);
|
||||
}
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
__ssp_decl(wchar_t *, fgetws_unlocked, (wchar_t *__buf, int __wlen, __FILE *__fp))
|
||||
{
|
||||
if (__wlen > 0)
|
||||
__ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos);
|
||||
__stdargs return __ssp_real_fgetws_unlocked(__buf, __wlen, __fp);
|
||||
}
|
||||
#endif /* __GNU_VISIBLE */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __SSP_FORTIFY_LEVEL > 0 */
|
||||
#endif /* _SSP_WCHAR_H_ */
|
||||
@@ -0,0 +1,123 @@
|
||||
#ifndef _HEADERS_STABS_H
|
||||
#define _HEADERS_STABS_H
|
||||
|
||||
#if defined(__m68k_elf__) || defined(__ELF__)
|
||||
|
||||
/* add symbol a to list b (c unused) */
|
||||
#define ADD2LIST(a,b,c) \
|
||||
asm(".section\t.list_" #b ",\"aw\""); \
|
||||
asm("\t.long _" #a);
|
||||
|
||||
#define ADD2LIST2(a,b,c) \
|
||||
asm(".section\t.list_" #b ",\"aw\""); \
|
||||
asm("\t.long " #a);
|
||||
|
||||
/* Install private constructors and destructors pri MUST be -127<=pri<=127 */
|
||||
#define ADD2INIT(a,pri) ADD2LIST(a,__INIT_LIST__,22); \
|
||||
ADD2LIST2(pri+128,__INIT_LIST__,22)
|
||||
#define ADD2EXIT(a,pri) ADD2LIST(a,__EXIT_LIST__,22); \
|
||||
ADD2LIST2(pri+128,__EXIT_LIST__,22)
|
||||
|
||||
#else
|
||||
/* add symbol a to list b (type c (22=text 24=data 26=bss)) */
|
||||
#define ADD2LIST(a,b,c) asm(".stabs \"_" #b "\"," #c ",0,0,_" #a )
|
||||
|
||||
/* Install private constructors and destructors pri MUST be -127<=pri<=127 */
|
||||
#define ADD2INIT(a,pri) ADD2LIST(a,__INIT_LIST__,22); \
|
||||
asm(".stabs \"___INIT_LIST__\",20,0,0," #pri "+128")
|
||||
#define ADD2EXIT(a,pri) ADD2LIST(a,__EXIT_LIST__,22); \
|
||||
asm(".stabs \"___EXIT_LIST__\",20,0,0," #pri "+128")
|
||||
|
||||
#endif
|
||||
|
||||
/* These are some macros for handling of symboltable information
|
||||
*/
|
||||
|
||||
/* linker can use symbol b for symbol a if a is not defined */
|
||||
#define ALIAS(a,b) asm(".stabs \"_" #a "\",11,0,0,0;.stabs \"_" #b "\",1,0,0,0")
|
||||
|
||||
|
||||
/* Add to library list */
|
||||
#define ADD2LIB(a) ADD2LIST(a,__LIB_LIST__,24)
|
||||
|
||||
/* This one does not really handle symbol tables
|
||||
* it's just pointless to write a header file for one macro
|
||||
*
|
||||
* define a as a label for an absolute address b
|
||||
*/
|
||||
#define ABSDEF(a,b) asm("_" #a "=" #b ";.globl _" #a )
|
||||
|
||||
/* Generate assembler stub for a shared library entry
|
||||
* and add it to the jump table
|
||||
* ADDTABL_X(name,...) means function with X arguments
|
||||
* ADDTABL_END() ends the list
|
||||
* Usage: ADDTABL_2(AddHead,a0,a1);
|
||||
* No more than 4 arguments supported, use structures!
|
||||
*/
|
||||
|
||||
#define _ADDTABL_START(name) \
|
||||
asm(".globl ___" #name); \
|
||||
asm("___" #name ":\tmovel a4,sp@-")
|
||||
|
||||
#define _ADDTABL_ARG(arg) \
|
||||
asm("\tmovel " #arg ",sp@-")
|
||||
|
||||
#define _ADDTABL_CALL(name) \
|
||||
asm("\tmovel a6@(40:W),a4"); \
|
||||
asm("\tbsr _" #name)
|
||||
|
||||
#define _ADDTABL_END0(name,numargs) \
|
||||
asm("\tmovel sp@+,a4"); \
|
||||
asm("\trts"); \
|
||||
ADD2LIST(__##name,__FuncTable__,22)
|
||||
|
||||
#define _ADDTABL_END2(name,numargs) \
|
||||
asm("\taddqw #4*" #numargs ",sp"); \
|
||||
asm("\tmovel sp@+,a4"); \
|
||||
asm("\trts"); \
|
||||
ADD2LIST(__##name,__FuncTable__,22)
|
||||
|
||||
#define _ADDTABL_ENDN(name,numargs) \
|
||||
asm("\taddaw #4*" #numargs ",sp"); \
|
||||
asm("\tmovel sp@+,a4"); \
|
||||
asm("\trts"); \
|
||||
ADD2LIST(__##name,__FuncTable__,22)
|
||||
|
||||
#define ADDTABL_0(name) \
|
||||
_ADDTABL_START(name); \
|
||||
_ADDTABL_CALL(name); \
|
||||
_ADDTABL_END0(name,0)
|
||||
|
||||
#define ADDTABL_1(name,arg1) \
|
||||
_ADDTABL_START(name); \
|
||||
_ADDTABL_ARG(arg1); \
|
||||
_ADDTABL_CALL(name); \
|
||||
_ADDTABL_END2(name,1)
|
||||
|
||||
#define ADDTABL_2(name,arg1,arg2) \
|
||||
_ADDTABL_START(name); \
|
||||
_ADDTABL_ARG(arg2); \
|
||||
_ADDTABL_ARG(arg1); \
|
||||
_ADDTABL_CALL(name); \
|
||||
_ADDTABL_END2(name,2)
|
||||
|
||||
#define ADDTABL_3(name,arg1,arg2,arg3) \
|
||||
_ADDTABL_START(name); \
|
||||
_ADDTABL_ARG(arg3); \
|
||||
_ADDTABL_ARG(arg2); \
|
||||
_ADDTABL_ARG(arg1); \
|
||||
_ADDTABL_CALL(name); \
|
||||
_ADDTABL_ENDN(name,3)
|
||||
|
||||
#define ADDTABL_4(name,arg1,arg2,arg3,arg4) \
|
||||
_ADDTABL_START(name); \
|
||||
_ADDTABL_ARG(arg4); \
|
||||
_ADDTABL_ARG(arg3); \
|
||||
_ADDTABL_ARG(arg2); \
|
||||
_ADDTABL_ARG(arg1); \
|
||||
_ADDTABL_CALL(name); \
|
||||
_ADDTABL_ENDN(name,4)
|
||||
|
||||
#define ADDTABL_END() asm(".stabs \"___FuncTable__\",20,0,0,-1")
|
||||
|
||||
#endif /* _HEADERS_STABS_H */
|
||||
@@ -0,0 +1,413 @@
|
||||
/*-
|
||||
* Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
|
||||
* David Chisnall <theraven@FreeBSD.org>
|
||||
* 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 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _STDATOMIC_H_
|
||||
#define _STDATOMIC_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
|
||||
#define __CLANG_ATOMICS
|
||||
#elif __GNUC_PREREQ__(4, 7)
|
||||
#define __GNUC_ATOMICS
|
||||
#elif defined(__GNUC__)
|
||||
#define __SYNC_ATOMICS
|
||||
#else
|
||||
#error "stdatomic.h does not support your compiler"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 7.17.1 Atomic lock-free macros.
|
||||
*/
|
||||
|
||||
#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#endif
|
||||
#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 7.17.2 Initialization.
|
||||
*/
|
||||
|
||||
#if defined(__CLANG_ATOMICS)
|
||||
#define ATOMIC_VAR_INIT(value) (value)
|
||||
#define atomic_init(obj, value) __c11_atomic_init(obj, value)
|
||||
#else
|
||||
#define ATOMIC_VAR_INIT(value) { .__val = (value) }
|
||||
#define atomic_init(obj, value) ((void)((obj)->__val = (value)))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clang and recent GCC both provide predefined macros for the memory
|
||||
* orderings. If we are using a compiler that doesn't define them, use the
|
||||
* clang values - these will be ignored in the fallback path.
|
||||
*/
|
||||
|
||||
#ifndef __ATOMIC_RELAXED
|
||||
#define __ATOMIC_RELAXED 0
|
||||
#endif
|
||||
#ifndef __ATOMIC_CONSUME
|
||||
#define __ATOMIC_CONSUME 1
|
||||
#endif
|
||||
#ifndef __ATOMIC_ACQUIRE
|
||||
#define __ATOMIC_ACQUIRE 2
|
||||
#endif
|
||||
#ifndef __ATOMIC_RELEASE
|
||||
#define __ATOMIC_RELEASE 3
|
||||
#endif
|
||||
#ifndef __ATOMIC_ACQ_REL
|
||||
#define __ATOMIC_ACQ_REL 4
|
||||
#endif
|
||||
#ifndef __ATOMIC_SEQ_CST
|
||||
#define __ATOMIC_SEQ_CST 5
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 7.17.3 Order and consistency.
|
||||
*
|
||||
* The memory_order_* constants that denote the barrier behaviour of the
|
||||
* atomic operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
memory_order_relaxed = __ATOMIC_RELAXED,
|
||||
memory_order_consume = __ATOMIC_CONSUME,
|
||||
memory_order_acquire = __ATOMIC_ACQUIRE,
|
||||
memory_order_release = __ATOMIC_RELEASE,
|
||||
memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
||||
memory_order_seq_cst = __ATOMIC_SEQ_CST
|
||||
} memory_order;
|
||||
|
||||
/*
|
||||
* 7.17.4 Fences.
|
||||
*/
|
||||
|
||||
static __inline void
|
||||
atomic_thread_fence(memory_order __order __unused)
|
||||
{
|
||||
|
||||
#ifdef __CLANG_ATOMICS
|
||||
__c11_atomic_thread_fence(__order);
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
__atomic_thread_fence(__order);
|
||||
#else
|
||||
__sync_synchronize();
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline void
|
||||
atomic_signal_fence(memory_order __order __unused)
|
||||
{
|
||||
|
||||
#ifdef __CLANG_ATOMICS
|
||||
__c11_atomic_signal_fence(__order);
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
__atomic_signal_fence(__order);
|
||||
#else
|
||||
__asm volatile ("" ::: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 7.17.5 Lock-free property.
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL)
|
||||
/* Atomics in kernelspace are always lock-free. */
|
||||
#define atomic_is_lock_free(obj) \
|
||||
((void)(obj), (_Bool)1)
|
||||
#elif defined(__CLANG_ATOMICS)
|
||||
#define atomic_is_lock_free(obj) \
|
||||
__atomic_is_lock_free(sizeof(*(obj)), obj)
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
#define atomic_is_lock_free(obj) \
|
||||
__atomic_is_lock_free(sizeof((obj)->__val), &(obj)->__val)
|
||||
#else
|
||||
#define atomic_is_lock_free(obj) \
|
||||
((void)(obj), sizeof((obj)->__val) <= sizeof(void *))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 7.17.6 Atomic integer types.
|
||||
*/
|
||||
|
||||
typedef _Atomic(_Bool) atomic_bool;
|
||||
typedef _Atomic(char) atomic_char;
|
||||
typedef _Atomic(signed char) atomic_schar;
|
||||
typedef _Atomic(unsigned char) atomic_uchar;
|
||||
typedef _Atomic(short) atomic_short;
|
||||
typedef _Atomic(unsigned short) atomic_ushort;
|
||||
typedef _Atomic(int) atomic_int;
|
||||
typedef _Atomic(unsigned int) atomic_uint;
|
||||
typedef _Atomic(long) atomic_long;
|
||||
typedef _Atomic(unsigned long) atomic_ulong;
|
||||
typedef _Atomic(long long) atomic_llong;
|
||||
typedef _Atomic(unsigned long long) atomic_ullong;
|
||||
#if 0
|
||||
_Atomic(__char16_t) atomic_char16_t;
|
||||
_Atomic(__char32_t) atomic_char32_t;
|
||||
#endif
|
||||
typedef _Atomic(wchar_t) atomic_wchar_t;
|
||||
typedef _Atomic(int_least8_t) atomic_int_least8_t;
|
||||
typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
|
||||
typedef _Atomic(int_least16_t) atomic_int_least16_t;
|
||||
typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
|
||||
typedef _Atomic(int_least32_t) atomic_int_least32_t;
|
||||
typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
|
||||
typedef _Atomic(int_least64_t) atomic_int_least64_t;
|
||||
typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
|
||||
typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
|
||||
typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
|
||||
typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
|
||||
typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
|
||||
typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
|
||||
typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
|
||||
typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
|
||||
typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
|
||||
typedef _Atomic(intptr_t) atomic_intptr_t;
|
||||
typedef _Atomic(uintptr_t) atomic_uintptr_t;
|
||||
typedef _Atomic(size_t) atomic_size_t;
|
||||
typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t;
|
||||
typedef _Atomic(intmax_t) atomic_intmax_t;
|
||||
typedef _Atomic(uintmax_t) atomic_uintmax_t;
|
||||
|
||||
/*
|
||||
* 7.17.7 Operations on atomic types.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compiler-specific operations.
|
||||
*/
|
||||
|
||||
#if defined(__CLANG_ATOMICS)
|
||||
#define atomic_compare_exchange_strong_explicit(object, expected, \
|
||||
desired, success, failure) \
|
||||
__c11_atomic_compare_exchange_strong(object, expected, desired, \
|
||||
success, failure)
|
||||
#define atomic_compare_exchange_weak_explicit(object, expected, \
|
||||
desired, success, failure) \
|
||||
__c11_atomic_compare_exchange_weak(object, expected, desired, \
|
||||
success, failure)
|
||||
#define atomic_exchange_explicit(object, desired, order) \
|
||||
__c11_atomic_exchange(object, desired, order)
|
||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
||||
__c11_atomic_fetch_add(object, operand, order)
|
||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
||||
__c11_atomic_fetch_and(object, operand, order)
|
||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
||||
__c11_atomic_fetch_or(object, operand, order)
|
||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
||||
__c11_atomic_fetch_sub(object, operand, order)
|
||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
||||
__c11_atomic_fetch_xor(object, operand, order)
|
||||
#define atomic_load_explicit(object, order) \
|
||||
__c11_atomic_load(object, order)
|
||||
#define atomic_store_explicit(object, desired, order) \
|
||||
__c11_atomic_store(object, desired, order)
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
#define atomic_compare_exchange_strong_explicit(object, expected, \
|
||||
desired, success, failure) \
|
||||
__atomic_compare_exchange_n(&(object)->__val, expected, \
|
||||
desired, 0, success, failure)
|
||||
#define atomic_compare_exchange_weak_explicit(object, expected, \
|
||||
desired, success, failure) \
|
||||
__atomic_compare_exchange_n(&(object)->__val, expected, \
|
||||
desired, 1, success, failure)
|
||||
#define atomic_exchange_explicit(object, desired, order) \
|
||||
__atomic_exchange_n(&(object)->__val, desired, order)
|
||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
||||
__atomic_fetch_add(&(object)->__val, operand, order)
|
||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
||||
__atomic_fetch_and(&(object)->__val, operand, order)
|
||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
||||
__atomic_fetch_or(&(object)->__val, operand, order)
|
||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
||||
__atomic_fetch_sub(&(object)->__val, operand, order)
|
||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
||||
__atomic_fetch_xor(&(object)->__val, operand, order)
|
||||
#define atomic_load_explicit(object, order) \
|
||||
__atomic_load_n(&(object)->__val, order)
|
||||
#define atomic_store_explicit(object, desired, order) \
|
||||
__atomic_store_n(&(object)->__val, desired, order)
|
||||
#else
|
||||
#define __atomic_apply_stride(object, operand) \
|
||||
(((__typeof__((object)->__val))0) + (operand))
|
||||
#define atomic_compare_exchange_strong_explicit(object, expected, \
|
||||
desired, success, failure) __extension__ ({ \
|
||||
__typeof__(expected) __ep = (expected); \
|
||||
__typeof__(*__ep) __e = *__ep; \
|
||||
(void)(success); (void)(failure); \
|
||||
(_Bool)((*__ep = __sync_val_compare_and_swap(&(object)->__val, \
|
||||
__e, desired)) == __e); \
|
||||
})
|
||||
#define atomic_compare_exchange_weak_explicit(object, expected, \
|
||||
desired, success, failure) \
|
||||
atomic_compare_exchange_strong_explicit(object, expected, \
|
||||
desired, success, failure)
|
||||
#if __has_builtin(__sync_swap)
|
||||
/* Clang provides a full-barrier atomic exchange - use it if available. */
|
||||
#define atomic_exchange_explicit(object, desired, order) \
|
||||
((void)(order), __sync_swap(&(object)->__val, desired))
|
||||
#else
|
||||
/*
|
||||
* __sync_lock_test_and_set() is only an acquire barrier in theory (although in
|
||||
* practice it is usually a full barrier) so we need an explicit barrier before
|
||||
* it.
|
||||
*/
|
||||
#define atomic_exchange_explicit(object, desired, order) \
|
||||
__extension__ ({ \
|
||||
__typeof__(object) __o = (object); \
|
||||
__typeof__(desired) __d = (desired); \
|
||||
(void)(order); \
|
||||
__sync_synchronize(); \
|
||||
__sync_lock_test_and_set(&(__o)->__val, __d); \
|
||||
})
|
||||
#endif
|
||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
||||
((void)(order), __sync_fetch_and_add(&(object)->__val, \
|
||||
__atomic_apply_stride(object, operand)))
|
||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
||||
((void)(order), __sync_fetch_and_and(&(object)->__val, operand))
|
||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
||||
((void)(order), __sync_fetch_and_or(&(object)->__val, operand))
|
||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
||||
((void)(order), __sync_fetch_and_sub(&(object)->__val, \
|
||||
__atomic_apply_stride(object, operand)))
|
||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
||||
((void)(order), __sync_fetch_and_xor(&(object)->__val, operand))
|
||||
#define atomic_load_explicit(object, order) \
|
||||
((void)(order), __sync_fetch_and_add(&(object)->__val, 0))
|
||||
#define atomic_store_explicit(object, desired, order) \
|
||||
((void)atomic_exchange_explicit(object, desired, order))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convenience functions.
|
||||
*
|
||||
* Don't provide these in kernel space. In kernel space, we should be
|
||||
* disciplined enough to always provide explicit barriers.
|
||||
*/
|
||||
|
||||
#ifndef _KERNEL
|
||||
#define atomic_compare_exchange_strong(object, expected, desired) \
|
||||
atomic_compare_exchange_strong_explicit(object, expected, \
|
||||
desired, memory_order_seq_cst, memory_order_seq_cst)
|
||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
||||
atomic_compare_exchange_weak_explicit(object, expected, \
|
||||
desired, memory_order_seq_cst, memory_order_seq_cst)
|
||||
#define atomic_exchange(object, desired) \
|
||||
atomic_exchange_explicit(object, desired, memory_order_seq_cst)
|
||||
#define atomic_fetch_add(object, operand) \
|
||||
atomic_fetch_add_explicit(object, operand, memory_order_seq_cst)
|
||||
#define atomic_fetch_and(object, operand) \
|
||||
atomic_fetch_and_explicit(object, operand, memory_order_seq_cst)
|
||||
#define atomic_fetch_or(object, operand) \
|
||||
atomic_fetch_or_explicit(object, operand, memory_order_seq_cst)
|
||||
#define atomic_fetch_sub(object, operand) \
|
||||
atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst)
|
||||
#define atomic_fetch_xor(object, operand) \
|
||||
atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst)
|
||||
#define atomic_load(object) \
|
||||
atomic_load_explicit(object, memory_order_seq_cst)
|
||||
#define atomic_store(object, desired) \
|
||||
atomic_store_explicit(object, desired, memory_order_seq_cst)
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
/*
|
||||
* 7.17.8 Atomic flag type and operations.
|
||||
*
|
||||
* XXX: Assume atomic_bool can be used as an atomic_flag. Is there some
|
||||
* kind of compiler built-in type we could use?
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
atomic_bool __flag;
|
||||
} atomic_flag;
|
||||
|
||||
#define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(0) }
|
||||
|
||||
static __inline _Bool
|
||||
atomic_flag_test_and_set_explicit(volatile atomic_flag *__object,
|
||||
memory_order __order)
|
||||
{
|
||||
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order)
|
||||
{
|
||||
|
||||
atomic_store_explicit(&__object->__flag, 0, __order);
|
||||
}
|
||||
|
||||
#ifndef _KERNEL
|
||||
static __inline _Bool
|
||||
atomic_flag_test_and_set(volatile atomic_flag *__object)
|
||||
{
|
||||
|
||||
return (atomic_flag_test_and_set_explicit(__object,
|
||||
memory_order_seq_cst));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
atomic_flag_clear(volatile atomic_flag *__object)
|
||||
{
|
||||
|
||||
atomic_flag_clear_explicit(__object, memory_order_seq_cst);
|
||||
}
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
#endif /* !_STDATOMIC_H_ */
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
#include <machine/_default_types.h>
|
||||
#include <sys/_intsup.h>
|
||||
#include <sys/_stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef ___int_least8_t_defined
|
||||
typedef __int_least8_t int_least8_t;
|
||||
typedef __uint_least8_t uint_least8_t;
|
||||
#define __int_least8_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef ___int_least16_t_defined
|
||||
typedef __int_least16_t int_least16_t;
|
||||
typedef __uint_least16_t uint_least16_t;
|
||||
#define __int_least16_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef ___int_least32_t_defined
|
||||
typedef __int_least32_t int_least32_t;
|
||||
typedef __uint_least32_t uint_least32_t;
|
||||
#define __int_least32_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef ___int_least64_t_defined
|
||||
typedef __int_least64_t int_least64_t;
|
||||
typedef __uint_least64_t uint_least64_t;
|
||||
#define __int_least64_t_defined 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fastest minimum-width integer types
|
||||
*
|
||||
* Assume int to be the fastest type for all types with a width
|
||||
* less than __INT_MAX__ rsp. INT_MAX
|
||||
*/
|
||||
#ifdef __INT_FAST8_TYPE__
|
||||
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
||||
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
||||
#define __int_fast8_t_defined 1
|
||||
#elif __STDINT_EXP(INT_MAX) >= 0x7f
|
||||
typedef signed int int_fast8_t;
|
||||
typedef unsigned int uint_fast8_t;
|
||||
#define __int_fast8_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST16_TYPE__
|
||||
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
||||
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
||||
#define __int_fast16_t_defined 1
|
||||
#elif __STDINT_EXP(INT_MAX) >= 0x7fff
|
||||
typedef signed int int_fast16_t;
|
||||
typedef unsigned int uint_fast16_t;
|
||||
#define __int_fast16_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST32_TYPE__
|
||||
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
||||
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
||||
#define __int_fast32_t_defined 1
|
||||
#elif __STDINT_EXP(INT_MAX) >= 0x7fffffff
|
||||
typedef signed int int_fast32_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
#define __int_fast32_t_defined 1
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST64_TYPE__
|
||||
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
||||
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
||||
#define __int_fast64_t_defined 1
|
||||
#elif __STDINT_EXP(INT_MAX) > 0x7fffffff
|
||||
typedef signed int int_fast64_t;
|
||||
typedef unsigned int uint_fast64_t;
|
||||
#define __int_fast64_t_defined 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fall back to [u]int_least<N>_t for [u]int_fast<N>_t types
|
||||
* not having been defined, yet.
|
||||
* Leave undefined, if [u]int_least<N>_t should not be available.
|
||||
*/
|
||||
#if !__int_fast8_t_defined
|
||||
#if __int_least8_t_defined
|
||||
typedef int_least8_t int_fast8_t;
|
||||
typedef uint_least8_t uint_fast8_t;
|
||||
#define __int_fast8_t_defined 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__int_fast16_t_defined
|
||||
#if __int_least16_t_defined
|
||||
typedef int_least16_t int_fast16_t;
|
||||
typedef uint_least16_t uint_fast16_t;
|
||||
#define __int_fast16_t_defined 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__int_fast32_t_defined
|
||||
#if __int_least32_t_defined
|
||||
typedef int_least32_t int_fast32_t;
|
||||
typedef uint_least32_t uint_fast32_t;
|
||||
#define __int_fast32_t_defined 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__int_fast64_t_defined
|
||||
#if __int_least64_t_defined
|
||||
typedef int_least64_t int_fast64_t;
|
||||
typedef uint_least64_t uint_fast64_t;
|
||||
#define __int_fast64_t_defined 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INTPTR_TYPE__
|
||||
#define INTPTR_MIN (-__INTPTR_MAX__ - 1)
|
||||
#define INTPTR_MAX (__INTPTR_MAX__)
|
||||
#define UINTPTR_MAX (__UINTPTR_MAX__)
|
||||
#elif defined(__PTRDIFF_TYPE__)
|
||||
#define INTPTR_MAX PTRDIFF_MAX
|
||||
#define INTPTR_MIN PTRDIFF_MIN
|
||||
#ifdef __UINTPTR_MAX__
|
||||
#define UINTPTR_MAX (__UINTPTR_MAX__)
|
||||
#else
|
||||
#define UINTPTR_MAX (2UL * PTRDIFF_MAX + 1)
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* Fallback to hardcoded values,
|
||||
* should be valid on cpu's with 32bit int/32bit void*
|
||||
*/
|
||||
#define INTPTR_MAX (__STDINT_EXP(LONG_MAX))
|
||||
#define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
|
||||
#define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
|
||||
#endif
|
||||
|
||||
/* Limits of Specified-Width Integer Types */
|
||||
|
||||
#ifdef __INT8_MAX__
|
||||
#define INT8_MIN (-__INT8_MAX__ - 1)
|
||||
#define INT8_MAX (__INT8_MAX__)
|
||||
#define UINT8_MAX (__UINT8_MAX__)
|
||||
#elif defined(__int8_t_defined)
|
||||
#define INT8_MIN (-128)
|
||||
#define INT8_MAX (127)
|
||||
#define UINT8_MAX (255)
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST8_MAX__
|
||||
#define INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)
|
||||
#define INT_LEAST8_MAX (__INT_LEAST8_MAX__)
|
||||
#define UINT_LEAST8_MAX (__UINT_LEAST8_MAX__)
|
||||
#elif defined(__int_least8_t_defined)
|
||||
#define INT_LEAST8_MIN (-128)
|
||||
#define INT_LEAST8_MAX (127)
|
||||
#define UINT_LEAST8_MAX (255)
|
||||
#else
|
||||
#error required type int_least8_t missing
|
||||
#endif
|
||||
|
||||
#ifdef __INT16_MAX__
|
||||
#define INT16_MIN (-__INT16_MAX__ - 1)
|
||||
#define INT16_MAX (__INT16_MAX__)
|
||||
#define UINT16_MAX (__UINT16_MAX__)
|
||||
#elif defined(__int16_t_defined)
|
||||
#define INT16_MIN (-32768)
|
||||
#define INT16_MAX (32767)
|
||||
#define UINT16_MAX (65535)
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST16_MAX__
|
||||
#define INT_LEAST16_MIN (-__INT_LEAST16_MAX__ - 1)
|
||||
#define INT_LEAST16_MAX (__INT_LEAST16_MAX__)
|
||||
#define UINT_LEAST16_MAX (__UINT_LEAST16_MAX__)
|
||||
#elif defined(__int_least16_t_defined)
|
||||
#define INT_LEAST16_MIN (-32768)
|
||||
#define INT_LEAST16_MAX (32767)
|
||||
#define UINT_LEAST16_MAX (65535)
|
||||
#else
|
||||
#error required type int_least16_t missing
|
||||
#endif
|
||||
|
||||
#ifdef __INT32_MAX__
|
||||
#define INT32_MIN (-__INT32_MAX__ - 1)
|
||||
#define INT32_MAX (__INT32_MAX__)
|
||||
#define UINT32_MAX (__UINT32_MAX__)
|
||||
#elif defined(__int32_t_defined)
|
||||
#if defined (_INT32_EQ_LONG)
|
||||
#define INT32_MIN (-2147483647L-1)
|
||||
#define INT32_MAX (2147483647L)
|
||||
#define UINT32_MAX (4294967295UL)
|
||||
#else
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#define INT32_MAX (2147483647)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST32_MAX__
|
||||
#define INT_LEAST32_MIN (-__INT_LEAST32_MAX__ - 1)
|
||||
#define INT_LEAST32_MAX (__INT_LEAST32_MAX__)
|
||||
#define UINT_LEAST32_MAX (__UINT_LEAST32_MAX__)
|
||||
#elif defined(__int_least32_t_defined)
|
||||
#if defined (_INT32_EQ_LONG)
|
||||
#define INT_LEAST32_MIN (-2147483647L-1)
|
||||
#define INT_LEAST32_MAX (2147483647L)
|
||||
#define UINT_LEAST32_MAX (4294967295UL)
|
||||
#else
|
||||
#define INT_LEAST32_MIN (-2147483647-1)
|
||||
#define INT_LEAST32_MAX (2147483647)
|
||||
#define UINT_LEAST32_MAX (4294967295U)
|
||||
#endif
|
||||
#else
|
||||
#error required type int_least32_t missing
|
||||
#endif
|
||||
|
||||
#ifdef __INT64_MAX__
|
||||
#define INT64_MIN (-__INT64_MAX__ - 1)
|
||||
#define INT64_MAX (__INT64_MAX__)
|
||||
#define UINT64_MAX (__UINT64_MAX__)
|
||||
#elif defined(__int64_t_defined)
|
||||
#if __have_long64
|
||||
#define INT64_MIN (-9223372036854775807L-1L)
|
||||
#define INT64_MAX (9223372036854775807L)
|
||||
#define UINT64_MAX (18446744073709551615U)
|
||||
#elif __have_longlong64
|
||||
#define INT64_MIN (-9223372036854775807LL-1LL)
|
||||
#define INT64_MAX (9223372036854775807LL)
|
||||
#define UINT64_MAX (18446744073709551615ULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST64_MAX__
|
||||
#define INT_LEAST64_MIN (-__INT_LEAST64_MAX__ - 1)
|
||||
#define INT_LEAST64_MAX (__INT_LEAST64_MAX__)
|
||||
#define UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)
|
||||
#elif defined(__int_least64_t_defined)
|
||||
#if __have_long64
|
||||
#define INT_LEAST64_MIN (-9223372036854775807L-1L)
|
||||
#define INT_LEAST64_MAX (9223372036854775807L)
|
||||
#define UINT_LEAST64_MAX (18446744073709551615U)
|
||||
#elif __have_longlong64
|
||||
#define INT_LEAST64_MIN (-9223372036854775807LL-1LL)
|
||||
#define INT_LEAST64_MAX (9223372036854775807LL)
|
||||
#define UINT_LEAST64_MAX (18446744073709551615ULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST8_MAX__
|
||||
#define INT_FAST8_MIN (-__INT_FAST8_MAX__ - 1)
|
||||
#define INT_FAST8_MAX (__INT_FAST8_MAX__)
|
||||
#define UINT_FAST8_MAX (__UINT_FAST8_MAX__)
|
||||
#elif defined(__int_fast8_t_defined)
|
||||
#if __STDINT_EXP(INT_MAX) >= 0x7f
|
||||
#define INT_FAST8_MIN (-__STDINT_EXP(INT_MAX)-1)
|
||||
#define INT_FAST8_MAX (__STDINT_EXP(INT_MAX))
|
||||
#define UINT_FAST8_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
|
||||
#else
|
||||
#define INT_FAST8_MIN INT_LEAST8_MIN
|
||||
#define INT_FAST8_MAX INT_LEAST8_MAX
|
||||
#define UINT_FAST8_MAX UINT_LEAST8_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST16_MAX__
|
||||
#define INT_FAST16_MIN (-__INT_FAST16_MAX__ - 1)
|
||||
#define INT_FAST16_MAX (__INT_FAST16_MAX__)
|
||||
#define UINT_FAST16_MAX (__UINT_FAST16_MAX__)
|
||||
#elif defined(__int_fast16_t_defined)
|
||||
#if __STDINT_EXP(INT_MAX) >= 0x7fff
|
||||
#define INT_FAST16_MIN (-__STDINT_EXP(INT_MAX)-1)
|
||||
#define INT_FAST16_MAX (__STDINT_EXP(INT_MAX))
|
||||
#define UINT_FAST16_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
|
||||
#else
|
||||
#define INT_FAST16_MIN INT_LEAST16_MIN
|
||||
#define INT_FAST16_MAX INT_LEAST16_MAX
|
||||
#define UINT_FAST16_MAX UINT_LEAST16_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST32_MAX__
|
||||
#define INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)
|
||||
#define INT_FAST32_MAX (__INT_FAST32_MAX__)
|
||||
#define UINT_FAST32_MAX (__UINT_FAST32_MAX__)
|
||||
#elif defined(__int_fast32_t_defined)
|
||||
#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
|
||||
#define INT_FAST32_MIN (-__STDINT_EXP(INT_MAX)-1)
|
||||
#define INT_FAST32_MAX (__STDINT_EXP(INT_MAX))
|
||||
#define UINT_FAST32_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
|
||||
#else
|
||||
#define INT_FAST32_MIN INT_LEAST32_MIN
|
||||
#define INT_FAST32_MAX INT_LEAST32_MAX
|
||||
#define UINT_FAST32_MAX UINT_LEAST32_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT_FAST64_MAX__
|
||||
#define INT_FAST64_MIN (-__INT_FAST64_MAX__ - 1)
|
||||
#define INT_FAST64_MAX (__INT_FAST64_MAX__)
|
||||
#define UINT_FAST64_MAX (__UINT_FAST64_MAX__)
|
||||
#elif defined(__int_fast64_t_defined)
|
||||
#if __STDINT_EXP(INT_MAX) > 0x7fffffff
|
||||
#define INT_FAST64_MIN (-__STDINT_EXP(INT_MAX)-1)
|
||||
#define INT_FAST64_MAX (__STDINT_EXP(INT_MAX))
|
||||
#define UINT_FAST64_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
|
||||
#else
|
||||
#define INT_FAST64_MIN INT_LEAST64_MIN
|
||||
#define INT_FAST64_MAX INT_LEAST64_MAX
|
||||
#define UINT_FAST64_MAX UINT_LEAST64_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INTMAX_MAX__
|
||||
#define INTMAX_MAX (__INTMAX_MAX__)
|
||||
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
||||
#elif defined(__INTMAX_TYPE__)
|
||||
/* All relevant GCC versions prefer long to long long for intmax_t. */
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#endif
|
||||
|
||||
#ifdef __UINTMAX_MAX__
|
||||
#define UINTMAX_MAX (__UINTMAX_MAX__)
|
||||
#elif defined(__UINTMAX_TYPE__)
|
||||
/* All relevant GCC versions prefer long to long long for intmax_t. */
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
#endif
|
||||
|
||||
/* This must match size_t in stddef.h, currently long unsigned int */
|
||||
#ifdef __SIZE_MAX__
|
||||
#define SIZE_MAX (__SIZE_MAX__)
|
||||
#else
|
||||
#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
|
||||
#endif
|
||||
|
||||
/* This must match sig_atomic_t in <signal.h> (currently int) */
|
||||
#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
|
||||
#define SIG_ATOMIC_MAX (__STDINT_EXP(INT_MAX))
|
||||
|
||||
/* This must match ptrdiff_t in <stddef.h> (currently long int) */
|
||||
#ifdef __PTRDIFF_MAX__
|
||||
#define PTRDIFF_MAX (__PTRDIFF_MAX__)
|
||||
#else
|
||||
#define PTRDIFF_MAX (__STDINT_EXP(LONG_MAX))
|
||||
#endif
|
||||
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
||||
|
||||
/* This must match definition in <wchar.h> */
|
||||
#ifndef WCHAR_MIN
|
||||
#ifdef __WCHAR_MIN__
|
||||
#define WCHAR_MIN (__WCHAR_MIN__)
|
||||
#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
|
||||
#define WCHAR_MIN (0 + L'\0')
|
||||
#else
|
||||
#define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This must match definition in <wchar.h> */
|
||||
#ifndef WCHAR_MAX
|
||||
#ifdef __WCHAR_MAX__
|
||||
#define WCHAR_MAX (__WCHAR_MAX__)
|
||||
#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
|
||||
#define WCHAR_MAX (0xffffffffu + L'\0')
|
||||
#else
|
||||
#define WCHAR_MAX (0x7fffffff + L'\0')
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* wint_t is unsigned int on almost all GCC targets. */
|
||||
#ifdef __WINT_MAX__
|
||||
#define WINT_MAX (__WINT_MAX__)
|
||||
#else
|
||||
#define WINT_MAX (__STDINT_EXP(INT_MAX) * 2U + 1U)
|
||||
#endif
|
||||
#ifdef __WINT_MIN__
|
||||
#define WINT_MIN (__WINT_MIN__)
|
||||
#else
|
||||
#define WINT_MIN (0U)
|
||||
#endif
|
||||
|
||||
/** Macros for minimum-width integer constant expressions */
|
||||
#ifdef __INT8_C
|
||||
#define INT8_C(x) __INT8_C(x)
|
||||
#define UINT8_C(x) __UINT8_C(x)
|
||||
#else
|
||||
#define INT8_C(x) x
|
||||
#if __STDINT_EXP(INT_MAX) > 0x7f
|
||||
#define UINT8_C(x) x
|
||||
#else
|
||||
#define UINT8_C(x) x##U
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT16_C
|
||||
#define INT16_C(x) __INT16_C(x)
|
||||
#define UINT16_C(x) __UINT16_C(x)
|
||||
#else
|
||||
#define INT16_C(x) x
|
||||
#if __STDINT_EXP(INT_MAX) > 0x7fff
|
||||
#define UINT16_C(x) x
|
||||
#else
|
||||
#define UINT16_C(x) x##U
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT32_C
|
||||
#define INT32_C(x) __INT32_C(x)
|
||||
#define UINT32_C(x) __UINT32_C(x)
|
||||
#else
|
||||
#if defined (_INT32_EQ_LONG)
|
||||
#define INT32_C(x) x##L
|
||||
#define UINT32_C(x) x##UL
|
||||
#else
|
||||
#define INT32_C(x) x
|
||||
#define UINT32_C(x) x##U
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __INT64_C
|
||||
#define INT64_C(x) __INT64_C(x)
|
||||
#define UINT64_C(x) __UINT64_C(x)
|
||||
#else
|
||||
#if __int64_t_defined
|
||||
#if __have_long64
|
||||
#define INT64_C(x) x##L
|
||||
#define UINT64_C(x) x##UL
|
||||
#else
|
||||
#define INT64_C(x) x##LL
|
||||
#define UINT64_C(x) x##ULL
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Macros for greatest-width integer constant expression */
|
||||
#ifdef __INTMAX_C
|
||||
#define INTMAX_C(x) __INTMAX_C(x)
|
||||
#define UINTMAX_C(x) __UINTMAX_C(x)
|
||||
#else
|
||||
#if __have_long64
|
||||
#define INTMAX_C(x) x##L
|
||||
#define UINTMAX_C(x) x##UL
|
||||
#else
|
||||
#define INTMAX_C(x) x##LL
|
||||
#define UINTMAX_C(x) x##ULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _GCC_MAX_ALIGN_T
|
||||
#define _GCC_MAX_ALIGN_T
|
||||
/* Type whose alignment is supported in every context and is at least
|
||||
as great as that of any standard type not using alignment
|
||||
specifiers. */
|
||||
typedef struct {
|
||||
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
|
||||
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
|
||||
} max_align_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _STDINT_H */
|
||||
@@ -0,0 +1,294 @@
|
||||
#ifndef _STDIO_H
|
||||
#define _STDIO_H
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Adjusted to be compatible with the bsd headers
|
||||
* (At least for normal ANSI stuff)
|
||||
* Member names are not the same, but they need not be :-)
|
||||
*/
|
||||
|
||||
typedef long fpos_t;
|
||||
|
||||
#ifndef __SFILE_DEFINED__
|
||||
#define __SFILE_DEFINED__
|
||||
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
struct __sFILE {
|
||||
unsigned char *_p; /* pointer to actual character */
|
||||
int _r; /* Bytes left in buffer for reading, writemode: 0 */
|
||||
int _w; /* Space left in buffer for writing + fp->linebufsize,
|
||||
* readmode: 0
|
||||
*/
|
||||
short _flags;
|
||||
#define __SLBF 0x0001 /* line buffered */
|
||||
#define __SNBF 0x0002 /* unbuffered */
|
||||
#define __SRD 0x0004 /* read mode */
|
||||
#define __SWR 0x0008 /* write mode */
|
||||
#define __SRW 0x0010 /* read and write allowed */
|
||||
#define __SEOF 0x0020 /* EOF read */
|
||||
#define __SERR 0x0040 /* error encountered */
|
||||
#define __SMBF 0x0080 /* buffer malloc'ed by library */
|
||||
#define __SSTR 0x0200 /* sprintf/sscanf buffer */
|
||||
#define __SWO 0x8000 /* write-only mode */
|
||||
|
||||
|
||||
#define __BPTRS 0x4000 /* tmpdir and name are BPTRS. */
|
||||
|
||||
short file; /* The filehandle */
|
||||
struct __sbuf _bf;
|
||||
// unsigned char *buffer; /* original buffer pointer */
|
||||
// int bufsize; /* size of the buffer */
|
||||
int linebufsize; /* 0 full buffered
|
||||
* -bufsize line buffered&write mode
|
||||
* readmode: undefined */
|
||||
/* from this point on not binary compatible to bsd headers */
|
||||
unsigned char unget[4]; /* ungetc buffer 4 bytes necessary (for -Na*)
|
||||
* ANSI requires 3 bytes (for -.*), so one more
|
||||
* doesn't matter
|
||||
*/
|
||||
unsigned char *tmpp; /* Stored p if ungetc pending, otherwise NULL */
|
||||
int tmpinc; /* Stored incount if ungetc pending, otherwise undefined */
|
||||
long tmpdir; /* lock to directory if temporary file */
|
||||
char *name; /* filename if temporary file */
|
||||
#ifdef __posix_threads__
|
||||
unsigned __spinlock[2];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __posix_threads__
|
||||
extern void __regargs __spinLock(unsigned * l);
|
||||
inline void __regargs __spinUnlock(unsigned * l) {
|
||||
if (--l[1] == 0)
|
||||
*l = 0;
|
||||
}
|
||||
#define __STDIO_LOCK(l) __spinLock(l->__spinlock)
|
||||
#define __STDIO_UNLOCK(l) __spinUnlock(l->__spinlock)
|
||||
#else
|
||||
#define __spinLock(a)
|
||||
#define __spinUnlock(a)
|
||||
#define __STDIO_LOCK(l)
|
||||
#define __STDIO_UNLOCK(l)
|
||||
#endif
|
||||
|
||||
#if !defined(__FILE_defined)
|
||||
typedef struct __sFILE __FILE;
|
||||
typedef __FILE FILE;
|
||||
# define __FILE_defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0l)
|
||||
#endif
|
||||
#define BUFSIZ 1024
|
||||
#define EOF (-1)
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#define _IOFBF 0
|
||||
#define _IOLBF 1
|
||||
#define _IONBF 2
|
||||
|
||||
extern __stdargs FILE *fopen(const char *filename, const char *mode);
|
||||
extern __stdargs FILE *freopen(const char *filename, const char *mode, FILE *stream);
|
||||
extern __stdargs FILE *fdopen(int filedes, const char *mode);
|
||||
extern __stdargs int fclose(FILE *stream);
|
||||
extern __stdargs int ungetc(int c, FILE *stream);
|
||||
extern __stdargs int vsprintf(char *s, const char *format, va_list args);
|
||||
extern __stdargs int vfprintf(FILE *stream, const char *format, va_list args);
|
||||
extern __stdargs int vsscanf(const char *s, const char *format, va_list args);
|
||||
extern __stdargs int vfscanf(FILE *stream, const char *format, va_list args);
|
||||
extern __stdargs int vsnprintf(char *s, size_t size, const char *format, va_list args);
|
||||
extern __stdargs int fseek(FILE *stream, long int offset, int whence);
|
||||
extern __stdargs char *fgets(char *s, int size, FILE *stream);
|
||||
extern __stdargs int fputs(const char *s, FILE *stream);
|
||||
extern __stdargs long ftell(FILE *stream);
|
||||
extern __stdargs int setvbuf(FILE *stream, char *buf, int mode, size_t size);
|
||||
extern __stdargs size_t fread(void *, size_t, size_t, FILE *);
|
||||
extern __stdargs size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||
extern __stdargs char *tmpnam(char *buf);
|
||||
extern __stdargs void perror(const char *string);
|
||||
extern __stdargs int puts(const char *s);
|
||||
extern __stdargs int remove(const char *filename);
|
||||
extern __stdargs int rename(const char *old, const char *neww);
|
||||
extern __stdargs FILE *tmpfile(void);
|
||||
|
||||
/* More bsd headers compatibility */
|
||||
|
||||
extern __stdargs int __swbuf(int c, FILE *stream);
|
||||
extern __stdargs int __srget(FILE *stream);
|
||||
extern FILE **__sF; /* Standard I/O streams */
|
||||
#define stdin (__sF[0]) /* Other streams are not in __sF */
|
||||
#define stdout (__sF[1])
|
||||
#define stderr (__sF[2])
|
||||
|
||||
extern __stdargs int fprintf(FILE *stream, const char *format, ...);
|
||||
extern __stdargs int fscanf(FILE *stream, const char *format, ...);
|
||||
extern __stdargs int printf(const char *format, ...);
|
||||
extern __stdargs int scanf(const char *format, ...);
|
||||
extern __stdargs int sscanf(const char *s, const char *format, ...);
|
||||
extern __stdargs int snprintf(char *s, size_t size, const char *format, ...);
|
||||
extern __stdargs int sprintf(char *s, const char *format, ...);
|
||||
|
||||
extern __stdargs int asprintf(char **__restrict strp, const char *__restrict fmt, ...);
|
||||
|
||||
extern __stdargs int getc(FILE *fp);
|
||||
extern __stdargs int putc(int c, FILE * fp);
|
||||
|
||||
extern __stdargs FILE *popen(const char *command, const char *type);
|
||||
extern __stdargs int pclose(FILE *stream);
|
||||
|
||||
/* Inline functions or protos. */
|
||||
#ifdef __NO_INLINE__
|
||||
extern __stdargs void clearerr(FILE *stream);
|
||||
extern __stdargs int feof(FILE * fp);
|
||||
extern __stdargs int ferror(FILE *fp);
|
||||
extern __stdargs int fgetc(FILE *stream);
|
||||
extern __stdargs int fgetpos(FILE *stream, fpos_t *pos);
|
||||
extern __stdargs int fileno(FILE *file);
|
||||
extern __stdargs int fputc(int c, FILE *stream);
|
||||
extern __stdargs int fsetpos(FILE *stream, fpos_t *pos);
|
||||
extern __stdargs int getchar();
|
||||
extern __stdargs char *gets(char *s);
|
||||
extern __stdargs int vprintf(const char *format, va_list args);
|
||||
extern __stdargs int putchar(int c);
|
||||
extern __stdargs int vscanf(const char *format, va_list args);
|
||||
extern __stdargs void rewind(FILE *stream);
|
||||
extern __stdargs int setbuf(FILE *stream, char *buf);
|
||||
#else
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
#define __MY_INLINE__ static inline
|
||||
#else
|
||||
#define __MY_INLINE__ extern inline
|
||||
#endif
|
||||
|
||||
__MY_INLINE__ __stdargs void clearerr(FILE *stream)
|
||||
{ stream->_flags&=~(__SERR|__SEOF);}
|
||||
|
||||
__MY_INLINE__ __stdargs int feof(FILE * fp)
|
||||
{ return ((fp)->_flags&__SEOF);}
|
||||
|
||||
__MY_INLINE__ __stdargs int ferror(FILE *fp)
|
||||
{ return ((fp)->_flags&__SERR);}
|
||||
|
||||
__MY_INLINE__ __stdargs int fgetc(FILE *stream)
|
||||
{ return getc(stream);}
|
||||
|
||||
__MY_INLINE__ __stdargs int fgetpos(FILE *stream,fpos_t *pos)
|
||||
{ *pos=ftell(stream); return 0;}
|
||||
|
||||
__MY_INLINE__ __stdargs int fileno(FILE *file)
|
||||
{ return file->file;}
|
||||
|
||||
__MY_INLINE__ __stdargs int fputc(int c,FILE *stream)
|
||||
{ return putc(c,stream);}
|
||||
|
||||
__MY_INLINE__ __stdargs int fsetpos(FILE *stream,fpos_t *pos)
|
||||
{ return fseek(stream,*pos,SEEK_SET);}
|
||||
|
||||
__MY_INLINE__ __stdargs int getchar()
|
||||
{ return getc(stdin);}
|
||||
|
||||
__MY_INLINE__ __stdargs char *gets(char *s)
|
||||
{ return fgets(s, 0, stdin);}
|
||||
|
||||
__MY_INLINE__ __stdargs int vprintf(const char *format,va_list args)
|
||||
{ return vfprintf(stdout,format,args);}
|
||||
|
||||
__MY_INLINE__ __stdargs int putchar(int c)
|
||||
{ return putc(c, stdout);}
|
||||
|
||||
__MY_INLINE__ __stdargs int vscanf(const char *format,va_list args)
|
||||
{ return vfscanf(stdin,format,args);}
|
||||
|
||||
__MY_INLINE__ __stdargs void rewind(FILE *stream)
|
||||
{ fseek(stream,0,SEEK_SET);}
|
||||
|
||||
__MY_INLINE__ __stdargs int setbuf(FILE *stream,char *buf)
|
||||
{ return setvbuf(stream,buf,buf?_IOFBF:_IONBF,BUFSIZ);}
|
||||
#endif
|
||||
|
||||
/* own stuff */
|
||||
extern struct MinList __filelist; /* List of all fopen'ed files */
|
||||
extern struct MinList __memorylist; /* List of memory puddles */
|
||||
|
||||
extern __stdargs int fflush(FILE *stream); /* fflush single file */
|
||||
extern __stdargs void __chkabort(void); /* check for SIGABRT */
|
||||
|
||||
/*
|
||||
** FILE/SOCKET abstraction layer
|
||||
*/
|
||||
|
||||
struct stat;
|
||||
struct StandardPacket;
|
||||
|
||||
#define LX_FILE 0x01
|
||||
#define LX_SOCKET 0x80
|
||||
#define LX_SYS 0x04
|
||||
#define LX_ATTY 0x02
|
||||
|
||||
struct _StdFileDes;
|
||||
struct _StdFileFx {
|
||||
ssize_t __stdargs (*lx_read)(struct _StdFileDes *, void *, size_t);
|
||||
ssize_t __stdargs (*lx_write)(struct _StdFileDes *, const void *, size_t);
|
||||
int __stdargs (*lx_close)(struct _StdFileDes *);
|
||||
int __stdargs (*lx_dup)(struct _StdFileDes *);
|
||||
int __stdargs (*lx_fstat)(struct _StdFileDes *, struct stat *);
|
||||
int __stdargs (*lx_select)(struct _StdFileDes *sfd, int select_cmd, int io_mode, struct fd_set *, unsigned long *);
|
||||
};
|
||||
|
||||
typedef struct _StdFileDes {
|
||||
unsigned short lx_pos; /* __stdfiledes[lx_pos]; */
|
||||
unsigned char lx_flags; /* LX_FILE, LX_SOCKET, LX_ATTY, LX_SYS*/
|
||||
unsigned char lx_inuse; /* use counter */
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
union {
|
||||
struct {
|
||||
int lx_fh;
|
||||
int lx_oflags;
|
||||
struct StandardPacket *lx_packet;
|
||||
};
|
||||
struct {
|
||||
int lx_sock;
|
||||
int lx_family;
|
||||
int lx_protocol;
|
||||
int lx_domain;
|
||||
};
|
||||
};
|
||||
#else
|
||||
int lx_fh;
|
||||
int lx_oflags;
|
||||
struct StandardPacket *lx_packet;
|
||||
int lx_domain;
|
||||
#define lx_sock lx_fh
|
||||
#define lx_family lx_oflags
|
||||
#define lx_protocol lx_packet
|
||||
#endif
|
||||
|
||||
struct _StdFileFx * lx_fx;
|
||||
} StdFileDes;
|
||||
|
||||
extern __stdargs StdFileDes *_lx_fhfromfd(int fd);
|
||||
|
||||
#define L_tmpnam 8
|
||||
|
||||
#ifdef __FILENAME_MAX__
|
||||
#define FILENAME_MAX __FILENAME_MAX__
|
||||
#else
|
||||
#define FILENAME_MAX 1024
|
||||
#endif
|
||||
|
||||
#endif /* _STDIO_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* stdio_ext.h
|
||||
*
|
||||
* Definitions for I/O internal operations, originally from Solaris.
|
||||
*/
|
||||
|
||||
#ifndef _STDIO_EXT_H_
|
||||
#define _STDIO_EXT_H_
|
||||
|
||||
#ifdef __rtems__
|
||||
#error "<stdio_ext.h> not supported"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define FSETLOCKING_QUERY 0
|
||||
#define FSETLOCKING_INTERNAL 1
|
||||
#define FSETLOCKING_BYCALLER 2
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
__stdargs void __fpurge (FILE *);
|
||||
__stdargs int __fsetlocking (FILE *, int);
|
||||
|
||||
/* TODO:
|
||||
|
||||
void _flushlbf (void);
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
_ELIDABLE_INLINE size_t
|
||||
__fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
|
||||
|
||||
_ELIDABLE_INLINE int
|
||||
__freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
|
||||
|
||||
_ELIDABLE_INLINE int
|
||||
__fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
|
||||
|
||||
_ELIDABLE_INLINE int
|
||||
__freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
|
||||
|
||||
_ELIDABLE_INLINE int
|
||||
__fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
|
||||
|
||||
_ELIDABLE_INLINE int
|
||||
__flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
|
||||
|
||||
_ELIDABLE_INLINE size_t
|
||||
__fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
|
||||
|
||||
#else
|
||||
|
||||
__stdargs size_t __fbufsize (FILE *);
|
||||
__stdargs int __freading (FILE *);
|
||||
__stdargs int __fwriting (FILE *);
|
||||
__stdargs int __freadable (FILE *);
|
||||
__stdargs int __fwritable (FILE *);
|
||||
__stdargs int __flbf (FILE *);
|
||||
__stdargs size_t __fpending (FILE *);
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define __fbufsize(__fp) ((size_t) (__fp)->_bf._size)
|
||||
#define __freading(__fp) (((__fp)->_flags & __SRD) != 0)
|
||||
#define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0)
|
||||
#define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0)
|
||||
#define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
|
||||
#define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
|
||||
#define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#endif /* _STDIO_EXT_H_ */
|
||||
@@ -0,0 +1,351 @@
|
||||
/*
|
||||
* stdlib.h
|
||||
*
|
||||
* Definitions for common types, variables, and functions.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_H_
|
||||
#define _STDLIB_H_
|
||||
|
||||
#include <machine/ieeefp.h>
|
||||
#include "_ansi.h"
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <sys/_types.h>
|
||||
#include <sys/reent.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine/stdlib.h>
|
||||
#ifndef __STRICT_ANSI__
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <cygwin/stdlib.h>
|
||||
#endif
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int quot; /* quotient */
|
||||
int rem; /* remainder */
|
||||
} div_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long quot; /* quotient */
|
||||
long rem; /* remainder */
|
||||
} ldiv_t;
|
||||
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
typedef struct
|
||||
{
|
||||
long long int quot; /* quotient */
|
||||
long long int rem; /* remainder */
|
||||
} lldiv_t;
|
||||
#endif
|
||||
|
||||
#ifndef __stdargs
|
||||
#define __stdargs
|
||||
#endif
|
||||
|
||||
#ifndef __compar_fn_t_defined
|
||||
#define __compar_fn_t_defined
|
||||
typedef __stdargs int (*__compar_fn_t) (const void *, const void *);
|
||||
#endif
|
||||
|
||||
struct _reent;
|
||||
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
|
||||
#define RAND_MAX __RAND_MAX
|
||||
|
||||
__stdargs int __locale_mb_cur_max (void);
|
||||
|
||||
#define MB_CUR_MAX __locale_mb_cur_max()
|
||||
|
||||
__stdargs void abort (void) _ATTRIBUTE ((__noreturn__));
|
||||
__stdargs int abs (int);
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs __uint32_t arc4random (void);
|
||||
__stdargs __uint32_t arc4random_uniform (__uint32_t);
|
||||
__stdargs void arc4random_buf (void *, size_t);
|
||||
#endif
|
||||
__stdargs int atexit (void (*__func)(void));
|
||||
__stdargs double atof (const char *__nptr);
|
||||
#if __MISC_VISIBLE
|
||||
__stdargs float atoff (const char *__nptr);
|
||||
#endif
|
||||
__stdargs int atoi (const char *__nptr);
|
||||
__stdargs int _atoi_r (struct _reent *, const char *__nptr);
|
||||
__stdargs long atol (const char *__nptr);
|
||||
__stdargs long _atol_r (struct _reent *, const char *__nptr);
|
||||
__stdargs void * bsearch (const void *__key,
|
||||
const void *__base,
|
||||
size_t __nmemb,
|
||||
size_t __size,
|
||||
__compar_fn_t _compar);
|
||||
__stdargs void * calloc (size_t __nmemb, size_t __size) _NOTHROW;
|
||||
__stdargs div_t div (int __numer, int __denom);
|
||||
__stdargs void exit (int __status) _ATTRIBUTE ((__noreturn__));
|
||||
__stdargs void free (void *) _NOTHROW;
|
||||
__stdargs char * getenv (const char *__string);
|
||||
__stdargs char * _getenv_r (struct _reent *, const char *__string);
|
||||
__stdargs char * _findenv (const char *, int *);
|
||||
__stdargs char * _findenv_r (struct _reent *, const char *, int *);
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
extern char *suboptarg; /* getsubopt(3) external variable */
|
||||
__stdargs int getsubopt (char **, char * const *, char **);
|
||||
#endif
|
||||
__stdargs long labs (long);
|
||||
__stdargs ldiv_t ldiv (long __numer, long __denom);
|
||||
__stdargs void * malloc (size_t __size) _NOTHROW;
|
||||
__stdargs int mblen (const char *, size_t);
|
||||
__stdargs int _mblen_r (struct _reent *, const char *, size_t, _mbstate_t *);
|
||||
__stdargs int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
|
||||
__stdargs int _mbtowc_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
|
||||
__stdargs int wctomb (char *, wchar_t);
|
||||
__stdargs int _wctomb_r (struct _reent *, char *, wchar_t, _mbstate_t *);
|
||||
__stdargs size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
|
||||
__stdargs size_t _mbstowcs_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
|
||||
__stdargs size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
|
||||
__stdargs size_t _wcstombs_r (struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *);
|
||||
#ifndef _REENT_ONLY
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
|
||||
__stdargs char * mkdtemp (char *);
|
||||
#endif
|
||||
#if __GNU_VISIBLE
|
||||
__stdargs int mkostemp (char *, int);
|
||||
__stdargs int mkostemps (char *, int, int);
|
||||
#endif
|
||||
#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
|
||||
__stdargs int mkstemp (char *);
|
||||
#endif
|
||||
#if __MISC_VISIBLE
|
||||
__stdargs int mkstemps (char *, int);
|
||||
#endif
|
||||
#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
|
||||
__stdargs char * mktemp (char *)
|
||||
// _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))
|
||||
;
|
||||
#endif
|
||||
#endif /* !_REENT_ONLY */
|
||||
__stdargs char * _mkdtemp_r (struct _reent *, char *);
|
||||
__stdargs int _mkostemp_r (struct _reent *, char *, int);
|
||||
__stdargs int _mkostemps_r (struct _reent *, char *, int, int);
|
||||
__stdargs int _mkstemp_r (struct _reent *, char *);
|
||||
__stdargs int _mkstemps_r (struct _reent *, char *, int);
|
||||
__stdargs char * _mktemp_r (struct _reent *, char *)
|
||||
// _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))
|
||||
;
|
||||
__stdargs void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
|
||||
__stdargs int rand (void);
|
||||
__stdargs void * realloc (void *__r, size_t __size) _NOTHROW;
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size((2,3));
|
||||
__stdargs void * reallocf (void *__r, size_t __size);
|
||||
#endif
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
|
||||
__stdargs char * realpath (const char *__restrict path, char *__restrict resolved_path);
|
||||
#endif
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs int rpmatch (const char *response);
|
||||
#endif
|
||||
#if __XSI_VISIBLE
|
||||
__stdargs void setkey (const char *__key);
|
||||
#endif
|
||||
__stdargs void srand (unsigned __seed);
|
||||
__stdargs double strtod (const char *__restrict __n, char **__restrict __end_PTR);
|
||||
__stdargs double _strtod_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR);
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs float strtof (const char *__restrict __n, char **__restrict __end_PTR);
|
||||
#endif
|
||||
#if __MISC_VISIBLE
|
||||
/* the following strtodf interface is deprecated...use strtof instead */
|
||||
# ifndef strtodf
|
||||
# define strtodf strtof
|
||||
# endif
|
||||
#endif
|
||||
__stdargs long strtol (const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
__stdargs long _strtol_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
__stdargs unsigned long strtoul (const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
__stdargs unsigned long _strtoul_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
__stdargs double strtod_l (const char *__restrict, char **__restrict, locale_t);
|
||||
__stdargs float strtof_l (const char *__restrict, char **__restrict, locale_t);
|
||||
#ifdef _HAVE_LONG_DOUBLE
|
||||
extern __stdargs long double strtold_l (const char *__restrict, char **__restrict,
|
||||
locale_t);
|
||||
#endif /* _HAVE_LONG_DOUBLE */
|
||||
__stdargs long strtol_l (const char *__restrict, char **__restrict, int, locale_t);
|
||||
__stdargs unsigned long strtoul_l (const char *__restrict, char **__restrict, int,
|
||||
locale_t __loc);
|
||||
__stdargs long long strtoll_l (const char *__restrict, char **__restrict, int, locale_t);
|
||||
__stdargs unsigned long long strtoull_l (const char *__restrict, char **__restrict, int,
|
||||
locale_t __loc);
|
||||
#endif
|
||||
|
||||
__stdargs int system (const char *__string);
|
||||
|
||||
#if __SVID_VISIBLE || __XSI_VISIBLE >= 4
|
||||
__stdargs long a64l (const char *__input);
|
||||
__stdargs char * l64a (long __input);
|
||||
__stdargs char * _l64a_r (struct _reent *,long __input);
|
||||
#endif
|
||||
#if __MISC_VISIBLE
|
||||
__stdargs int on_exit (void (*__func)(int, void *),void *__arg);
|
||||
#endif
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs void _Exit (int __status) _ATTRIBUTE ((__noreturn__));
|
||||
#endif
|
||||
#if __SVID_VISIBLE || __XSI_VISIBLE
|
||||
__stdargs int putenv (const char *__string);
|
||||
#endif
|
||||
__stdargs int _putenv_r (struct _reent *, char *__string);
|
||||
__stdargs void * _reallocf_r (struct _reent *, void *, size_t);
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
__stdargs int setenv (const char *__string, const char *__value, int __overwrite);
|
||||
#endif
|
||||
__stdargs int _setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite);
|
||||
|
||||
#if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112
|
||||
__stdargs char * gcvt (double,int,char *);
|
||||
__stdargs char * gcvtf (float,int,char *);
|
||||
__stdargs char * fcvt (double,int,int *,int *);
|
||||
__stdargs char * fcvtf (float,int,int *,int *);
|
||||
__stdargs char * ecvt (double,int,int *,int *);
|
||||
__stdargs char * ecvtbuf (double, int, int*, int*, char *);
|
||||
__stdargs char * fcvtbuf (double, int, int*, int*, char *);
|
||||
__stdargs char * ecvtf (float,int,int *,int *);
|
||||
#endif
|
||||
__stdargs char * __itoa (int, char *, int);
|
||||
__stdargs char * __utoa (unsigned, char *, int);
|
||||
#if __MISC_VISIBLE
|
||||
__stdargs char * itoa (int, char *, int);
|
||||
__stdargs char * utoa (unsigned, char *, int);
|
||||
#endif
|
||||
#if __POSIX_VISIBLE
|
||||
__stdargs int rand_r (unsigned *__seed);
|
||||
#endif
|
||||
|
||||
#if __SVID_VISIBLE || __XSI_VISIBLE
|
||||
__stdargs double drand48 (void);
|
||||
__stdargs double _drand48_r (struct _reent *);
|
||||
__stdargs double erand48 (unsigned short [3]);
|
||||
__stdargs double _erand48_r (struct _reent *, unsigned short [3]);
|
||||
__stdargs long jrand48 (unsigned short [3]);
|
||||
__stdargs long _jrand48_r (struct _reent *, unsigned short [3]);
|
||||
__stdargs void lcong48 (unsigned short [7]);
|
||||
__stdargs void _lcong48_r (struct _reent *, unsigned short [7]);
|
||||
__stdargs long lrand48 (void);
|
||||
__stdargs long _lrand48_r (struct _reent *);
|
||||
__stdargs long mrand48 (void);
|
||||
__stdargs long _mrand48_r (struct _reent *);
|
||||
__stdargs long nrand48 (unsigned short [3]);
|
||||
__stdargs long _nrand48_r (struct _reent *, unsigned short [3]);
|
||||
__stdargs unsigned short *
|
||||
seed48 (unsigned short [3]);
|
||||
__stdargs unsigned short *
|
||||
_seed48_r (struct _reent *, unsigned short [3]);
|
||||
__stdargs void srand48 (long);
|
||||
__stdargs void _srand48_r (struct _reent *, long);
|
||||
#endif /* __SVID_VISIBLE || __XSI_VISIBLE */
|
||||
#if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
|
||||
__stdargs char * initstate (unsigned, char *, size_t);
|
||||
__stdargs long random (void);
|
||||
__stdargs char * setstate (char *);
|
||||
__stdargs void srandom (unsigned);
|
||||
#endif
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs long long atoll (const char *__nptr);
|
||||
#endif
|
||||
__stdargs long long _atoll_r (struct _reent *, const char *__nptr);
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs long long llabs (long long);
|
||||
__stdargs lldiv_t lldiv (long long __numer, long long __denom);
|
||||
__stdargs long long strtoll (const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
#endif
|
||||
__stdargs long long _strtoll_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
__stdargs unsigned long long strtoull (const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
#endif
|
||||
unsigned long long _strtoull_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#if __MISC_VISIBLE
|
||||
__stdargs void cfree (void *);
|
||||
#endif
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
__stdargs int unsetenv (const char *__string);
|
||||
#endif
|
||||
__stdargs int _unsetenv_r (struct _reent *, const char *__string);
|
||||
#endif /* !__CYGWIN__ */
|
||||
|
||||
#if __POSIX_VISIBLE >= 200112
|
||||
__stdargs int __nonnull ((1)) posix_memalign (void **, size_t, size_t);
|
||||
#endif
|
||||
|
||||
__stdargs char * _dtoa_r (struct _reent *, double, int, int, int *, int*, char**);
|
||||
#ifndef __CYGWIN__
|
||||
__stdargs void * _malloc_r (struct _reent *, size_t) _NOTHROW;
|
||||
__stdargs void * _calloc_r (struct _reent *, size_t, size_t) _NOTHROW;
|
||||
__stdargs void _free_r (struct _reent *, void *) _NOTHROW;
|
||||
__stdargs void * _realloc_r (struct _reent *, void *, size_t) _NOTHROW;
|
||||
__stdargs void _mstats_r (struct _reent *, char *);
|
||||
#endif
|
||||
__stdargs int _system_r (struct _reent *, const char *);
|
||||
|
||||
__stdargs void __eprintf (const char *, const char *, unsigned int, const char *);
|
||||
|
||||
/* There are two common qsort_r variants. If you request
|
||||
_BSD_SOURCE, you get the BSD version; otherwise you get the GNU
|
||||
version. We want that #undef qsort_r will still let you
|
||||
invoke the underlying function, but that requires gcc support. */
|
||||
#if __GNU_VISIBLE
|
||||
__stdargs void qsort_r (void *__base, size_t __nmemb, size_t __size, __stdargs int (*_compar)(const void *, const void *, void *), void *__thunk);
|
||||
#elif __BSD_VISIBLE
|
||||
# ifdef __GNUC__
|
||||
__stdargs void qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, __stdargs int (*_compar)(void *, const void *, const void *))
|
||||
__asm__ (__ASMNAME ("__bsd_qsort_r"));
|
||||
# else
|
||||
__stdargs void __bsd_qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, __stdargs int (*_compar)(void *, const void *, const void *));
|
||||
# define qsort_r __bsd_qsort_r
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* On platforms where long double equals double. */
|
||||
#ifdef _HAVE_LONG_DOUBLE
|
||||
extern __stdargs long double _strtold_r (struct _reent *, const char *__restrict, char **__restrict);
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
extern __stdargs long double strtold (const char *__restrict, char **__restrict);
|
||||
#endif
|
||||
#endif /* _HAVE_LONG_DOUBLE */
|
||||
|
||||
/*
|
||||
* If we're in a mode greater than C99, expose C11 functions.
|
||||
*/
|
||||
#if __ISO_C_VISIBLE >= 2011
|
||||
__stdargs void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align((1))
|
||||
__alloc_size((2));
|
||||
__stdargs int at_quick_exit(void (*)(void));
|
||||
_Noreturn __stdargs void
|
||||
quick_exit(int);
|
||||
#endif /* __ISO_C_VISIBLE >= 2011 */
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
#include <ssp/stdlib.h>
|
||||
#endif
|
||||
|
||||
#endif /* _STDLIB_H_ */
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
|
||||
/*
|
||||
* string.h
|
||||
*
|
||||
* Definitions for memory and string functions.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
__stdargs void *memset(void *, int, size_t);
|
||||
__stdargs void *memcpy(void *, const void *, size_t);
|
||||
__stdargs char *strchr(const char *, int);
|
||||
__stdargs int strcoll(const char *, const char *);
|
||||
__stdargs size_t strcspn(const char *, const char *);
|
||||
__stdargs char *strerror(int);
|
||||
__stdargs char *strcat(char *, const char *);
|
||||
__stdargs char *strncat(char *, const char *, size_t);
|
||||
__stdargs int strcmp(const char *, const char *);
|
||||
__stdargs int strncmp(const char *, const char *, size_t);
|
||||
__stdargs char *strncpy(char *, const char *, size_t);
|
||||
__stdargs char *strpbrk(const char *, const char *);
|
||||
__stdargs char *strrchr(const char *, int);
|
||||
__stdargs size_t strspn(const char *, const char *);
|
||||
__stdargs char *strstr(const char *, const char *);
|
||||
__stdargs char *strtok(char *, const char *);
|
||||
__stdargs char* strtok_r(char *str, const char *delim, char **nextp);
|
||||
__stdargs size_t strxfrm(char *, const char *, size_t);
|
||||
__stdargs char *strupr(char *s);
|
||||
|
||||
/* Nonstandard routines */
|
||||
#ifndef _ANSI_SOURCE
|
||||
__stdargs int bcmp(const void *, const void *, size_t);
|
||||
__stdargs void bcopy(const void *, void *, size_t);
|
||||
__stdargs void bzero(void *, size_t);
|
||||
__stdargs int ffs(int);
|
||||
__stdargs char *index(const char *, int);
|
||||
__stdargs void *memccpy(void *, const void *, int, size_t);
|
||||
__stdargs char *rindex(const char *, int);
|
||||
__stdargs int strcasecmp(const char *, const char *);
|
||||
__stdargs char *strdup(const char *);
|
||||
__stdargs void strmode(int, char *);
|
||||
__stdargs int strncasecmp(const char *, const char *, size_t);
|
||||
__stdargs char *strsep(char **, const char *);
|
||||
__stdargs void swab(const void *, void *, ssize_t);
|
||||
__stdargs int stricmp(const char *, const char *);
|
||||
__stdargs int strnicmp(const char *, const char *, size_t);
|
||||
|
||||
__stdargs char *strerror_r(int errnum, char *buf, size_t buflen);
|
||||
#endif
|
||||
|
||||
#ifdef __NO_INLINE__
|
||||
__stdargs void *memmove(void *, const void *, size_t);
|
||||
__stdargs int memcmp(const void *, const void *, size_t);
|
||||
__stdargs void *memchr(const void *, int, size_t);
|
||||
__stdargs size_t strlen(const char *);
|
||||
__stdargs size_t strlen_plus_one(const char *string);
|
||||
__stdargs char *strcpy(char *, const char *);
|
||||
__stdargs char *strlwr(char *s);
|
||||
__stdargs char *stpcpy(char *dst, const char *src);
|
||||
__stdargs void *mempcpy(void *, const void *, size_t);
|
||||
#else
|
||||
#include "strsup.h"
|
||||
#endif
|
||||
|
||||
#endif // _STRING_H_
|
||||
@@ -0,0 +1,80 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
|
||||
* 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 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.
|
||||
*
|
||||
* $FreeBSD: head/include/strings.h 272673 2014-10-07 04:54:11Z delphij $
|
||||
*/
|
||||
|
||||
#ifndef _STRINGS_H_
|
||||
#define _STRINGS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#ifndef _SIZE_T_DECLARED
|
||||
typedef __size_t size_t;
|
||||
#define _SIZE_T_DECLARED
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
|
||||
__stdargs int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */
|
||||
__stdargs void bcopy(const void *, void *, size_t); /* LEGACY */
|
||||
__stdargs void bzero(void *, size_t); /* LEGACY */
|
||||
#endif
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs void explicit_bzero(void *, size_t);
|
||||
#endif
|
||||
#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
|
||||
__stdargs int ffs(int) __pure2;
|
||||
#endif
|
||||
#if __BSD_VISIBLE
|
||||
__stdargs int ffsl(long) __pure2;
|
||||
__stdargs int ffsll(long long) __pure2;
|
||||
__stdargs int fls(int) __pure2;
|
||||
__stdargs int flsl(long) __pure2;
|
||||
__stdargs int flsll(long long) __pure2;
|
||||
#endif
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
|
||||
__stdargs char *index(const char *, int) __pure; /* LEGACY */
|
||||
__stdargs char *rindex(const char *, int) __pure; /* LEGACY */
|
||||
#endif
|
||||
__stdargs int strcasecmp(const char *, const char *) __pure;
|
||||
__stdargs int strncasecmp(const char *, const char *, size_t) __pure;
|
||||
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
__stdargs int strcasecmp_l (const char *, const char *, locale_t);
|
||||
__stdargs int strncasecmp_l (const char *, const char *, size_t, locale_t);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
#include <ssp/strings.h>
|
||||
#endif
|
||||
|
||||
#endif /* _STRINGS_H_ */
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef _STRSUP_H
|
||||
#define _STRSUP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __NO_INLINE__
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__MY_INLINE__)
|
||||
#define __MY_INLINE__ static inline
|
||||
#else
|
||||
#define __MY_INLINE__ extern inline
|
||||
#endif
|
||||
|
||||
__MY_INLINE__ __stdargs void *memmove(void *s1,const void *s2,size_t n)
|
||||
{ extern __stdargs void bcopy(const void *, void *, size_t);
|
||||
|
||||
bcopy(s2,s1,n); return s1;
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs int memcmp(const void *s1,const void *s2,size_t n)
|
||||
{
|
||||
const unsigned char *p1, *p2;
|
||||
|
||||
p1 = (const unsigned char *) s1;
|
||||
p2 = (const unsigned char *) s2;
|
||||
while(n-- > 0) {
|
||||
unsigned char a, b;
|
||||
|
||||
if (*p1++ == *p2++)
|
||||
continue;
|
||||
|
||||
a = *--p1;
|
||||
b = *--p2;
|
||||
return (short)a - b;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs void *memchr(const void *s,int c,size_t n)
|
||||
{
|
||||
if (n) {
|
||||
unsigned char *p=(unsigned char *)s;
|
||||
do {
|
||||
if (*p++==(unsigned char)c)
|
||||
return --p;
|
||||
}while(--n);
|
||||
}
|
||||
return (void *)n;
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs size_t strlen(const char *string)
|
||||
{ const char *s=string;
|
||||
|
||||
while(*s++) {}return ~(string-s);
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs size_t strlen_plus_one(const char *string)
|
||||
{ const char *s=string;
|
||||
|
||||
while(*s++) {}return (s-string);
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs char *strcpy(char *s1,const char *s2)
|
||||
{ char *s=s1;
|
||||
while((*s1++=*s2++)) {}
|
||||
return s;
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs char *strlwr(char *s)
|
||||
{ unsigned char *s1=(unsigned char *)s;
|
||||
|
||||
while(*s1) {
|
||||
if ((*s1>('A'-1)) && (*s1<('Z'+1)))
|
||||
*s1+='a'-'A';
|
||||
s1++;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs char *stpcpy(char *dst,const char *src)
|
||||
{
|
||||
while((*dst++=*src++)){} return(--dst);
|
||||
}
|
||||
|
||||
__MY_INLINE__ __stdargs void *mempcpy(void *to, const void *from, size_t sz) {
|
||||
return sz + (char *)memcpy(to, from, sz);
|
||||
}
|
||||
|
||||
#endif /* __NO_inline__ */
|
||||
|
||||
#endif /* _STRSUP_H */
|
||||
@@ -0,0 +1,229 @@
|
||||
|
||||
#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 _FTMPFILE 0x800000
|
||||
#define _FNOATIME 0x1000000
|
||||
|
||||
#define O_BINARY _FBINARY
|
||||
#define O_TEXT _FTEXT
|
||||
#define O_DSYNC _FSYNC
|
||||
#define O_RSYNC _FSYNC
|
||||
#define O_EXEC _FEXECSRCH
|
||||
#define O_SEARCH _FEXECSRCH
|
||||
|
||||
/* POSIX-1.2008 specific flags */
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#define O_CLOEXEC _FNOINHERIT
|
||||
#define O_NOFOLLOW _FNOFOLLOW
|
||||
#define O_DIRECTORY _FDIRECTORY
|
||||
#endif
|
||||
|
||||
/* Linux-specific flags */
|
||||
#if __GNU_VISIBLE
|
||||
#define O_DIRECT _FDIRECT
|
||||
#define O_TMPFILE _FTMPFILE
|
||||
#define O_NOATIME _FNOATIME
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
|
||||
/*
|
||||
* 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 /* __MISC_VISIBLE */
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#define FNONBLOCK _FNONBLOCK
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/* 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 */
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
#define F_GETOWN 5 /* Get owner - for ASYNC */
|
||||
#define F_SETOWN 6 /* Set owner - for ASYNC */
|
||||
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 */
|
||||
#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) */
|
||||
#if __MISC_VISIBLE
|
||||
#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 /* __MISC_VISIBLE */
|
||||
#if __POSIX_VISIBLE >= 200809
|
||||
#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) */
|
||||
#if __MISC_VISIBLE
|
||||
#define F_UNLKSYS 4 /* remove remote locks for a given system */
|
||||
#endif /* __MISC_VISIBLE */
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
|
||||
/* 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__ */
|
||||
|
||||
#if __MISC_VISIBLE
|
||||
/* 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 /* __MISC_VISIBLE */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h> /* sigh. for the mode bits for open/creat */
|
||||
|
||||
extern __stdargs int open (const char *, int, ...);
|
||||
#if __ATFILE_VISIBLE
|
||||
extern __stdargs int openat (int, const char *, int, ...);
|
||||
#endif
|
||||
extern __stdargs int creat (const char *, mode_t);
|
||||
extern __stdargs int fcntl (int, int, ...);
|
||||
#if __BSD_VISIBLE
|
||||
extern __stdargs int flock (int, int);
|
||||
#endif
|
||||
#if __GNU_VISIBLE
|
||||
#include <sys/time.h>
|
||||
extern __stdargs int futimesat (int, const char *, const struct timeval *);
|
||||
#endif
|
||||
|
||||
/* Provide _<systemcall> prototypes for functions provided by some versions
|
||||
of newlib. */
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
extern __stdargs int _open (const char *, int, ...);
|
||||
extern __stdargs int _fcntl (int, int, ...);
|
||||
#ifdef __LARGE64_FILES
|
||||
extern __stdargs int _open64 (const char *, int, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !_SYS__DEFAULT_FCNTL_H_ */
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS__INTSUP_H
|
||||
#define _SYS__INTSUP_H
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#if __GNUC_PREREQ (3, 2)
|
||||
/* gcc > 3.2 implicitly defines the values we are interested */
|
||||
#define __STDINT_EXP(x) __##x##__
|
||||
#else
|
||||
#define __STDINT_EXP(x) x
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Determine how intptr_t and intN_t fastN_t and leastN_t are defined by gcc
|
||||
for this target. This is used to determine the correct printf() constant in
|
||||
inttypes.h and other constants in stdint.h.
|
||||
So we end up with
|
||||
?(signed|unsigned) char == 0
|
||||
?(signed|unsigned) short == 1
|
||||
?(signed|unsigned) int == 2
|
||||
?(signed|unsigned) short int == 3
|
||||
?(signed|unsigned) long == 4
|
||||
?(signed|unsigned) long int == 6
|
||||
?(signed|unsigned) long long == 8
|
||||
?(signed|unsigned) long long int == 10
|
||||
*/
|
||||
#pragma push_macro("signed")
|
||||
#pragma push_macro("unsigned")
|
||||
#pragma push_macro("char")
|
||||
#pragma push_macro("short")
|
||||
#pragma push_macro("__int20")
|
||||
#pragma push_macro("int")
|
||||
#pragma push_macro("long")
|
||||
#undef signed
|
||||
#undef unsigned
|
||||
#undef char
|
||||
#undef short
|
||||
#undef int
|
||||
#undef __int20
|
||||
#undef long
|
||||
#define signed +0
|
||||
#define unsigned +0
|
||||
#define char +0
|
||||
#define short +1
|
||||
#define __int20 +2
|
||||
#define int +2
|
||||
#define long +4
|
||||
#if (__INTPTR_TYPE__ == 8 || __INTPTR_TYPE__ == 10)
|
||||
#define _INTPTR_EQ_LONGLONG
|
||||
#elif (__INTPTR_TYPE__ == 4 || __INTPTR_TYPE__ == 6)
|
||||
#define _INTPTR_EQ_LONG
|
||||
/* Note - the tests for _INTPTR_EQ_INT and _INTPTR_EQ_SHORT are currently
|
||||
redundant as the values are not used. But one day they may be needed
|
||||
and so the tests remain. */
|
||||
#elif __INTPTR_TYPE__ == 2
|
||||
#define _INTPTR_EQ_INT
|
||||
#elif (__INTPTR_TYPE__ == 1 || __INTPTR_TYPE__ == 3)
|
||||
#define _INTPTR_EQ_SHORT
|
||||
#else
|
||||
#error "Unable to determine type definition of intptr_t"
|
||||
#endif
|
||||
#if (__INT32_TYPE__ == 4 || __INT32_TYPE__ == 6)
|
||||
#define _INT32_EQ_LONG
|
||||
#elif __INT32_TYPE__ == 2
|
||||
/* Nothing to define because int32_t is safe to print as an int. */
|
||||
#else
|
||||
#error "Unable to determine type definition of int32_t"
|
||||
#endif
|
||||
|
||||
#if (__INT8_TYPE__ == 0)
|
||||
#define __INT8 "hh"
|
||||
#elif (__INT8_TYPE__ == 1 || __INT8_TYPE__ == 3)
|
||||
#define __INT8 "h"
|
||||
#elif (__INT8_TYPE__ == 2)
|
||||
#define __INT8
|
||||
#elif (__INT8_TYPE__ == 4 || __INT8_TYPE__ == 6)
|
||||
#define __INT8 "l"
|
||||
#elif (__INT8_TYPE__ == 8 || __INT8_TYPE__ == 10)
|
||||
#define __INT8 "ll"
|
||||
#endif
|
||||
#if (__INT16_TYPE__ == 1 || __INT16_TYPE__ == 3)
|
||||
#define __INT16 "h"
|
||||
#elif (__INT16_TYPE__ == 2)
|
||||
#define __INT16
|
||||
#elif (__INT16_TYPE__ == 4 || __INT16_TYPE__ == 6)
|
||||
#define __INT16 "l"
|
||||
#elif (__INT16_TYPE__ == 8 || __INT16_TYPE__ == 10)
|
||||
#define __INT16 "ll"
|
||||
#endif
|
||||
#if (__INT32_TYPE__ == 2)
|
||||
#define __INT32
|
||||
#elif (__INT32_TYPE__ == 4 || __INT32_TYPE__ == 6)
|
||||
#define __INT32 "l"
|
||||
#elif (__INT32_TYPE__ == 8 || __INT32_TYPE__ == 10)
|
||||
#define __INT32 "ll"
|
||||
#endif
|
||||
#if (__INT64_TYPE__ == 2)
|
||||
#define __INT64
|
||||
#elif (__INT64_TYPE__ == 4 || __INT64_TYPE__ == 6)
|
||||
#define __INT64 "l"
|
||||
#elif (__INT64_TYPE__ == 8 || __INT64_TYPE__ == 10)
|
||||
#define __INT64 "ll"
|
||||
#endif
|
||||
#if (__INT_FAST8_TYPE__ == 0)
|
||||
#define __FAST8 "hh"
|
||||
#elif (__INT_FAST8_TYPE__ == 1 || __INT_FAST8_TYPE__ == 3)
|
||||
#define __FAST8 "h"
|
||||
#elif (__INT_FAST8_TYPE__ == 2)
|
||||
#define __FAST8
|
||||
#elif (__INT_FAST8_TYPE__ == 4 || __INT_FAST8_TYPE__ == 6)
|
||||
#define __FAST8 "l"
|
||||
#elif (__INT_FAST8_TYPE__ == 8 || __INT_FAST8_TYPE__ == 10)
|
||||
#define __FAST8 "ll"
|
||||
#endif
|
||||
#if (__INT_FAST16_TYPE__ == 1 || __INT_FAST16_TYPE__ == 3)
|
||||
#define __FAST16 "h"
|
||||
#elif (__INT_FAST16_TYPE__ == 2)
|
||||
#define __FAST16
|
||||
#elif (__INT_FAST16_TYPE__ == 4 || __INT_FAST16_TYPE__ == 6)
|
||||
#define __FAST16 "l"
|
||||
#elif (__INT_FAST16_TYPE__ == 8 || __INT_FAST16_TYPE__ == 10)
|
||||
#define __FAST16 "ll"
|
||||
#endif
|
||||
#if (__INT_FAST32_TYPE__ == 2)
|
||||
#define __FAST32
|
||||
#elif (__INT_FAST32_TYPE__ == 4 || __INT_FAST32_TYPE__ == 6)
|
||||
#define __FAST32 "l"
|
||||
#elif (__INT_FAST32_TYPE__ == 8 || __INT_FAST32_TYPE__ == 10)
|
||||
#define __FAST32 "ll"
|
||||
#endif
|
||||
#if (__INT_FAST64_TYPE__ == 2)
|
||||
#define __FAST64
|
||||
#elif (__INT_FAST64_TYPE__ == 4 || __INT_FAST64_TYPE__ == 6)
|
||||
#define __FAST64 "l"
|
||||
#elif (__INT_FAST64_TYPE__ == 8 || __INT_FAST64_TYPE__ == 10)
|
||||
#define __FAST64 "ll"
|
||||
#endif
|
||||
|
||||
#if (__INT_LEAST8_TYPE__ == 0)
|
||||
#define __LEAST8 "hh"
|
||||
#elif (__INT_LEAST8_TYPE__ == 1 || __INT_LEAST8_TYPE__ == 3)
|
||||
#define __LEAST8 "h"
|
||||
#elif (__INT_LEAST8_TYPE__ == 2)
|
||||
#define __LEAST8
|
||||
#elif (__INT_LEAST8_TYPE__ == 4 || __INT_LEAST8_TYPE__ == 6)
|
||||
#define __LEAST8 "l"
|
||||
#elif (__INT_LEAST8_TYPE__ == 8 || __INT_LEAST8_TYPE__ == 10)
|
||||
#define __LEAST8 "ll"
|
||||
#endif
|
||||
#if (__INT_LEAST16_TYPE__ == 1 || __INT_LEAST16_TYPE__ == 3)
|
||||
#define __LEAST16 "h"
|
||||
#elif (__INT_LEAST16_TYPE__ == 2)
|
||||
#define __LEAST16
|
||||
#elif (__INT_LEAST16_TYPE__ == 4 || __INT_LEAST16_TYPE__ == 6)
|
||||
#define __LEAST16 "l"
|
||||
#elif (__INT_LEAST16_TYPE__ == 8 || __INT_LEAST16_TYPE__ == 10)
|
||||
#define __LEAST16 "ll"
|
||||
#endif
|
||||
#if (__INT_LEAST32_TYPE__ == 2)
|
||||
#define __LEAST32
|
||||
#elif (__INT_LEAST32_TYPE__ == 4 || __INT_LEAST32_TYPE__ == 6)
|
||||
#define __LEAST32 "l"
|
||||
#elif (__INT_LEAST32_TYPE__ == 8 || __INT_LEAST32_TYPE__ == 10)
|
||||
#define __LEAST32 "ll"
|
||||
#endif
|
||||
#if (__INT_LEAST64_TYPE__ == 2)
|
||||
#define __LEAST64
|
||||
#elif (__INT_LEAST64_TYPE__ == 4 || __INT_LEAST64_TYPE__ == 6)
|
||||
#define __LEAST64 "l"
|
||||
#elif (__INT_LEAST64_TYPE__ == 8 || __INT_LEAST64_TYPE__ == 10)
|
||||
#define __LEAST64 "ll"
|
||||
#endif
|
||||
#undef signed
|
||||
#undef unsigned
|
||||
#undef char
|
||||
#undef short
|
||||
#undef int
|
||||
#undef long
|
||||
#pragma pop_macro("signed")
|
||||
#pragma pop_macro("unsigned")
|
||||
#pragma pop_macro("char")
|
||||
#pragma pop_macro("short")
|
||||
#pragma pop_macro("__int20")
|
||||
#pragma pop_macro("int")
|
||||
#pragma pop_macro("long")
|
||||
|
||||
#endif /* _SYS__INTSUP_H */
|
||||
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Written by Joel Sherrill <joel.sherrill@OARcorp.com>.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2013, 2015.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS__PTHREADTYPES_H_
|
||||
#define _SYS__PTHREADTYPES_H_
|
||||
|
||||
#if defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506
|
||||
|
||||
#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(__AMIGA__)
|
||||
struct pthread_attr;
|
||||
typedef struct pthread_attr pthread_attr_t;
|
||||
|
||||
#define PTHREAD_CANCELED ((void *)-1)
|
||||
|
||||
#elif 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;
|
||||
|
||||
/* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute. */
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
int cputime_clock_allowed; /* see time.h */
|
||||
#endif
|
||||
int detachstate;
|
||||
} pthread_attr_t;
|
||||
|
||||
#endif /* !defined(__XMK__) */
|
||||
|
||||
#if defined(_POSIX_THREAD_PROCESS_SHARED)
|
||||
/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */
|
||||
|
||||
#define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
|
||||
#define PTHREAD_PROCESS_SHARED 1 /* visible too all processes with access to */
|
||||
/* the memory where the resource is */
|
||||
/* located */
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
/* Mutexes */
|
||||
|
||||
/* Values for blocking protocol. */
|
||||
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
#endif
|
||||
|
||||
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
|
||||
|
||||
/* Values for mutex type */
|
||||
|
||||
/* 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(__AMIGA__)
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
#define PTHREAD_MUTEX_RECURSIVE 1
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 2
|
||||
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
|
||||
|
||||
struct pthread_mutexattr;
|
||||
|
||||
typedef struct pthread_mutexattr pthread_mutexattr_t;
|
||||
|
||||
struct pthread_mutex;
|
||||
|
||||
typedef struct pthread_mutex pthread_mutex_t;
|
||||
|
||||
#elif 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__) */
|
||||
|
||||
#define _PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/* Condition Variables */
|
||||
#if defined(__AMIGA__)
|
||||
|
||||
struct pthread_condattr;
|
||||
typedef struct pthread_condattr pthread_condattr_t;
|
||||
|
||||
struct pthread_cond;
|
||||
|
||||
typedef struct pthread_cond pthread_cond_t;
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER {0, NULL_SEMAPHORE, NULL_MINLIST}
|
||||
|
||||
#else
|
||||
typedef __uint32_t pthread_cond_t; /* identify a condition variable */
|
||||
|
||||
#define _PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF)
|
||||
|
||||
typedef struct {
|
||||
int is_initialized;
|
||||
clock_t clock; /* specifiy clock for timeouts */
|
||||
#if defined(_POSIX_THREAD_PROCESS_SHARED)
|
||||
int process_shared; /* allow this to be shared amongst processes */
|
||||
#endif
|
||||
} pthread_condattr_t; /* a condition attribute object */
|
||||
#endif
|
||||
/* Keys */
|
||||
|
||||
typedef __uint32_t pthread_key_t; /* thread-specific data keys */
|
||||
|
||||
#if defined(__AMIGA__)
|
||||
struct pthread_once;
|
||||
typedef struct pthread_once pthread_once_t;
|
||||
|
||||
#define PTHREAD_ONCE_INIT {0, 0}
|
||||
|
||||
#else
|
||||
typedef struct {
|
||||
int is_initialized; /* is this structure initialized? */
|
||||
int init_executed; /* has the initialization routine been run? */
|
||||
} pthread_once_t; /* dynamic package initialization */
|
||||
|
||||
#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
|
||||
#endif
|
||||
|
||||
#endif /* defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506 */
|
||||
|
||||
/* POSIX Barrier Types */
|
||||
|
||||
#if defined(_POSIX_BARRIERS)
|
||||
typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */
|
||||
typedef struct {
|
||||
int is_initialized; /* is this structure initialized? */
|
||||
#if defined(_POSIX_THREAD_PROCESS_SHARED)
|
||||
int process_shared; /* allow this to be shared amongst processes */
|
||||
#endif
|
||||
} pthread_barrierattr_t;
|
||||
#endif /* defined(_POSIX_BARRIERS) */
|
||||
|
||||
/* POSIX Spin Lock Types */
|
||||
|
||||
#if defined(_POSIX_SPIN_LOCKS)
|
||||
typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */
|
||||
#endif /* defined(_POSIX_SPIN_LOCKS) */
|
||||
|
||||
/* POSIX Reader/Writer Lock Types */
|
||||
|
||||
#if defined(_POSIX_READER_WRITER_LOCKS)
|
||||
typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */
|
||||
|
||||
#define _PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF)
|
||||
|
||||
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 /* ! _SYS__PTHREADTYPES_H_ */
|
||||
@@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, 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.
|
||||
*
|
||||
* @(#)signal.h 8.4 (Berkeley) 5/4/95
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _SYS__SIGSET_H_
|
||||
#define _SYS__SIGSET_H_
|
||||
|
||||
typedef unsigned long __sigset_t;
|
||||
|
||||
#endif /* !_SYS__SIGSET_H_ */
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS__STDINT_H
|
||||
#define _SYS__STDINT_H
|
||||
|
||||
#include <machine/_default_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef ___int8_t_defined
|
||||
#ifndef _INT8_T_DECLARED
|
||||
typedef __int8_t int8_t ;
|
||||
#define _INT8_T_DECLARED
|
||||
#endif
|
||||
#ifndef _UINT8_T_DECLARED
|
||||
typedef __uint8_t uint8_t ;
|
||||
#define _UINT8_T_DECLARED
|
||||
#endif
|
||||
#define __int8_t_defined 1
|
||||
#endif /* ___int8_t_defined */
|
||||
|
||||
#ifdef ___int16_t_defined
|
||||
#ifndef _INT16_T_DECLARED
|
||||
typedef __int16_t int16_t ;
|
||||
#define _INT16_T_DECLARED
|
||||
#endif
|
||||
#ifndef _UINT16_T_DECLARED
|
||||
typedef __uint16_t uint16_t ;
|
||||
#define _UINT16_T_DECLARED
|
||||
#endif
|
||||
#define __int16_t_defined 1
|
||||
#endif /* ___int16_t_defined */
|
||||
|
||||
#ifdef ___int32_t_defined
|
||||
#ifndef _INT32_T_DECLARED
|
||||
typedef __int32_t int32_t ;
|
||||
#define _INT32_T_DECLARED
|
||||
#endif
|
||||
#ifndef _UINT32_T_DECLARED
|
||||
typedef __uint32_t uint32_t ;
|
||||
#define _UINT32_T_DECLARED
|
||||
#endif
|
||||
#define __int32_t_defined 1
|
||||
#endif /* ___int32_t_defined */
|
||||
|
||||
#ifdef ___int64_t_defined
|
||||
#ifndef _INT64_T_DECLARED
|
||||
typedef __int64_t int64_t ;
|
||||
#define _INT64_T_DECLARED
|
||||
#endif
|
||||
#ifndef _UINT64_T_DECLARED
|
||||
typedef __uint64_t uint64_t ;
|
||||
#define _UINT64_T_DECLARED
|
||||
#endif
|
||||
#define __int64_t_defined 1
|
||||
#endif /* ___int64_t_defined */
|
||||
|
||||
#ifndef _INTMAX_T_DECLARED
|
||||
typedef __intmax_t intmax_t;
|
||||
#define _INTMAX_T_DECLARED
|
||||
#endif
|
||||
|
||||
#ifndef _UINTMAX_T_DECLARED
|
||||
typedef __uintmax_t uintmax_t;
|
||||
#define _UINTMAX_T_DECLARED
|
||||
#endif
|
||||
|
||||
#ifndef _INTPTR_T_DECLARED
|
||||
typedef __intptr_t intptr_t;
|
||||
#define _INTPTR_T_DECLARED
|
||||
#endif
|
||||
|
||||
#ifndef _UINTPTR_T_DECLARED
|
||||
typedef __uintptr_t uintptr_t;
|
||||
#define _UINTPTR_T_DECLARED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS__STDINT_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user