1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Control Mon Oct 21 16:11:07 2019 +0200
1.3 @@ -0,0 +1,3 @@
1.4 +provides: libc_newlib_headers
1.5 +requires: libsystypes
1.6 +maintainer: paul@boddie.org.uk
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/Makefile Mon Oct 21 16:11:07 2019 +0200
2.3 @@ -0,0 +1,6 @@
2.4 +PKGDIR ?= .
2.5 +L4DIR ?= $(PKGDIR)/../..
2.6 +
2.7 +TARGET := include
2.8 +
2.9 +include $(L4DIR)/mk/subdir.mk
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/include/Makefile Mon Oct 21 16:11:07 2019 +0200
3.3 @@ -0,0 +1,7 @@
3.4 +PKGDIR ?= ..
3.5 +L4DIR ?= $(PKGDIR)/../..
3.6 +
3.7 +PKGNAME = libc_newlib
3.8 +CONTRIB_HEADERS = 1
3.9 +
3.10 +include $(L4DIR)/mk/include.mk
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/include/_ansi.h Mon Oct 21 16:11:07 2019 +0200
4.3 @@ -0,0 +1,82 @@
4.4 +/* Provide support for both ANSI and non-ANSI environments. */
4.5 +
4.6 +/* To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
4.7 + "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
4.8 + files aren't affected). */
4.9 +
4.10 +#ifndef _ANSIDECL_H_
4.11 +#define _ANSIDECL_H_
4.12 +
4.13 +#include <newlib.h>
4.14 +#include <sys/config.h>
4.15 +
4.16 +/* ISO C++. */
4.17 +
4.18 +#ifdef __cplusplus
4.19 +#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
4.20 +#ifdef _HAVE_STD_CXX
4.21 +#define _BEGIN_STD_C namespace std { extern "C" {
4.22 +#define _END_STD_C } }
4.23 +#else
4.24 +#define _BEGIN_STD_C extern "C" {
4.25 +#define _END_STD_C }
4.26 +#endif
4.27 +#if __GNUC_PREREQ (3, 3)
4.28 +#define _NOTHROW __attribute__ ((__nothrow__))
4.29 +#else
4.30 +#define _NOTHROW throw()
4.31 +#endif
4.32 +#endif
4.33 +#else
4.34 +#define _BEGIN_STD_C
4.35 +#define _END_STD_C
4.36 +#define _NOTHROW
4.37 +#endif
4.38 +
4.39 +#ifndef _LONG_DOUBLE
4.40 +#define _LONG_DOUBLE long double
4.41 +#endif
4.42 +
4.43 +/* Support gcc's __attribute__ facility. */
4.44 +
4.45 +#ifdef __GNUC__
4.46 +#define _ATTRIBUTE(attrs) __attribute__ (attrs)
4.47 +#else
4.48 +#define _ATTRIBUTE(attrs)
4.49 +#endif
4.50 +
4.51 +/* The traditional meaning of 'extern inline' for GCC is not
4.52 + to emit the function body unless the address is explicitly
4.53 + taken. However this behaviour is changing to match the C99
4.54 + standard, which uses 'extern inline' to indicate that the
4.55 + function body *must* be emitted. Likewise, a function declared
4.56 + without either 'extern' or 'static' defaults to extern linkage
4.57 + (C99 6.2.2p5), and the compiler may choose whether to use the
4.58 + inline version or call the extern linkage version (6.7.4p6).
4.59 + If we are using GCC, but do not have the new behaviour, we need
4.60 + to use extern inline; if we are using a new GCC with the
4.61 + C99-compatible behaviour, or a non-GCC compiler (which we will
4.62 + have to hope is C99, since there is no other way to achieve the
4.63 + effect of omitting the function if it isn't referenced) we use
4.64 + 'static inline', which c99 defines to mean more-or-less the same
4.65 + as the Gnu C 'extern inline'. */
4.66 +#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
4.67 +/* We're using GCC, but without the new C99-compatible behaviour. */
4.68 +#define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
4.69 +#else
4.70 +/* We're using GCC in C99 mode, or an unknown compiler which
4.71 + we just have to hope obeys the C99 semantics of inline. */
4.72 +#define _ELIDABLE_INLINE static __inline__
4.73 +#endif
4.74 +
4.75 +#if __GNUC_PREREQ (3, 1)
4.76 +#define _NOINLINE __attribute__ ((__noinline__))
4.77 +#define _NOINLINE_STATIC _NOINLINE static
4.78 +#else
4.79 +/* On non-GNU compilers and GCC prior to version 3.1 the compiler can't be
4.80 + trusted not to inline if it is static. */
4.81 +#define _NOINLINE
4.82 +#define _NOINLINE_STATIC
4.83 +#endif
4.84 +
4.85 +#endif /* _ANSIDECL_H_ */
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/include/_newlib_version.h Mon Oct 21 16:11:07 2019 +0200
5.3 @@ -0,0 +1,2 @@
5.4 +/* dummy file for external tools to use. Real file is created by
5.5 + newlib configuration. */
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/include/_syslist.h Mon Oct 21 16:11:07 2019 +0200
6.3 @@ -0,0 +1,40 @@
6.4 +/* internal use only -- mapping of "system calls" for libraries that lose
6.5 + and only provide C names, so that we end up in violation of ANSI */
6.6 +#ifndef __SYSLIST_H
6.7 +#define __SYSLIST_H
6.8 +
6.9 +#ifdef MISSING_SYSCALL_NAMES
6.10 +#define _close close
6.11 +#define _execve execve
6.12 +#define _fcntl fcntl
6.13 +#define _fork fork
6.14 +#define _fstat fstat
6.15 +#define _getpid getpid
6.16 +#define _gettimeofday gettimeofday
6.17 +#define _isatty isatty
6.18 +#define _kill kill
6.19 +#define _link link
6.20 +#define _lseek lseek
6.21 +#define _mkdir mkdir
6.22 +#define _open open
6.23 +#define _read read
6.24 +#define _sbrk sbrk
6.25 +#define _stat stat
6.26 +#define _times times
6.27 +#define _unlink unlink
6.28 +#define _wait wait
6.29 +#define _write write
6.30 +#endif /* MISSING_SYSCALL_NAMES */
6.31 +
6.32 +#if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR
6.33 +/* If the system call interface is missing opendir, readdir, and
6.34 + closedir, there is an implementation of these functions in
6.35 + libc/posix that is implemented using open, getdents, and close.
6.36 + Note, these functions are currently not in the libc/syscalls
6.37 + directory. */
6.38 +#define _opendir opendir
6.39 +#define _readdir readdir
6.40 +#define _closedir closedir
6.41 +#endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */
6.42 +
6.43 +#endif /* !__SYSLIST_H_ */
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/include/alloca.h Mon Oct 21 16:11:07 2019 +0200
7.3 @@ -0,0 +1,21 @@
7.4 +/* libc/include/alloca.h - Allocate memory on stack */
7.5 +
7.6 +/* Written 2000 by Werner Almesberger */
7.7 +/* Rearranged for general inclusion by stdlib.h.
7.8 + 2001, Corinna Vinschen <vinschen@redhat.com> */
7.9 +
7.10 +#ifndef _NEWLIB_ALLOCA_H
7.11 +#define _NEWLIB_ALLOCA_H
7.12 +
7.13 +#include "_ansi.h"
7.14 +#include <sys/reent.h>
7.15 +
7.16 +#undef alloca
7.17 +
7.18 +#ifdef __GNUC__
7.19 +#define alloca(size) __builtin_alloca(size)
7.20 +#else
7.21 +void * alloca (size_t);
7.22 +#endif
7.23 +
7.24 +#endif
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/include/ar.h Mon Oct 21 16:11:07 2019 +0200
8.3 @@ -0,0 +1,69 @@
8.4 +/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */
8.5 +
8.6 +/*-
8.7 + * Copyright (c) 1991, 1993
8.8 + * The Regents of the University of California. All rights reserved.
8.9 + * (c) UNIX System Laboratories, Inc.
8.10 + * All or some portions of this file are derived from material licensed
8.11 + * to the University of California by American Telephone and Telegraph
8.12 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8.13 + * the permission of UNIX System Laboratories, Inc.
8.14 + *
8.15 + * This code is derived from software contributed to Berkeley by
8.16 + * Hugh Smith at The University of Guelph.
8.17 + *
8.18 + * Redistribution and use in source and binary forms, with or without
8.19 + * modification, are permitted provided that the following conditions
8.20 + * are met:
8.21 + * 1. Redistributions of source code must retain the above copyright
8.22 + * notice, this list of conditions and the following disclaimer.
8.23 + * 2. Redistributions in binary form must reproduce the above copyright
8.24 + * notice, this list of conditions and the following disclaimer in the
8.25 + * documentation and/or other materials provided with the distribution.
8.26 + * 3. All advertising materials mentioning features or use of this software
8.27 + * must display the following acknowledgement:
8.28 + * This product includes software developed by the University of
8.29 + * California, Berkeley and its contributors.
8.30 + * 4. Neither the name of the University nor the names of its contributors
8.31 + * may be used to endorse or promote products derived from this software
8.32 + * without specific prior written permission.
8.33 + *
8.34 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
8.35 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8.36 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8.37 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
8.38 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8.39 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8.40 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8.41 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8.42 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8.43 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8.44 + * SUCH DAMAGE.
8.45 + *
8.46 + * @(#)ar.h 8.2 (Berkeley) 1/21/94
8.47 + */
8.48 +
8.49 +#ifndef _AR_H_
8.50 +#define _AR_H_
8.51 +
8.52 +/* Pre-4BSD archives had these magic numbers in them. */
8.53 +#define OARMAG1 0177555
8.54 +#define OARMAG2 0177545
8.55 +
8.56 +#define ARMAG "!<arch>\n" /* ar "magic number" */
8.57 +#define SARMAG 8 /* strlen(ARMAG); */
8.58 +
8.59 +#define AR_EFMT1 "#1/" /* extended format #1 */
8.60 +
8.61 +struct ar_hdr {
8.62 + char ar_name[16]; /* name */
8.63 + char ar_date[12]; /* modification time */
8.64 + char ar_uid[6]; /* user id */
8.65 + char ar_gid[6]; /* group id */
8.66 + char ar_mode[8]; /* octal file permissions */
8.67 + char ar_size[10]; /* size in bytes */
8.68 +#define ARFMAG "`\n"
8.69 + char ar_fmag[2]; /* consistency check */
8.70 +};
8.71 +
8.72 +#endif /* !_AR_H_ */
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/include/argz.h Mon Oct 21 16:11:07 2019 +0200
9.3 @@ -0,0 +1,33 @@
9.4 +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
9.5 + *
9.6 + * Permission to use, copy, modify, and distribute this software
9.7 + * is freely granted, provided that this notice is preserved.
9.8 + */
9.9 +
9.10 +#ifndef _ARGZ_H_
9.11 +#define _ARGZ_H_
9.12 +
9.13 +#include <errno.h>
9.14 +#include <sys/types.h>
9.15 +
9.16 +#include "_ansi.h"
9.17 +
9.18 +_BEGIN_STD_C
9.19 +
9.20 +/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
9.21 +error_t argz_create (char *const argv[], char **argz, size_t *argz_len);
9.22 +error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len);
9.23 +size_t argz_count (const char *argz, size_t argz_len);
9.24 +void argz_extract (char *argz, size_t argz_len, char **argv);
9.25 +void argz_stringify (char *argz, size_t argz_len, int sep);
9.26 +error_t argz_add (char **argz, size_t *argz_len, const char *str);
9.27 +error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep);
9.28 +error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len);
9.29 +error_t argz_delete (char **argz, size_t *argz_len, char *entry);
9.30 +error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry);
9.31 +char * argz_next (char *argz, size_t argz_len, const char *entry);
9.32 +error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count);
9.33 +
9.34 +_END_STD_C
9.35 +
9.36 +#endif /* _ARGZ_H_ */
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/include/assert.h Mon Oct 21 16:11:07 2019 +0200
10.3 @@ -0,0 +1,50 @@
10.4 +/*
10.5 + assert.h
10.6 +*/
10.7 +
10.8 +#ifdef __cplusplus
10.9 +extern "C" {
10.10 +#endif
10.11 +
10.12 +#include "_ansi.h"
10.13 +
10.14 +#undef assert
10.15 +
10.16 +#ifdef NDEBUG /* required by ANSI standard */
10.17 +# define assert(__e) ((void)0)
10.18 +#else
10.19 +# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
10.20 + __ASSERT_FUNC, #__e))
10.21 +
10.22 +# ifndef __ASSERT_FUNC
10.23 + /* Use g++'s demangled names in C++. */
10.24 +# if defined __cplusplus && defined __GNUC__
10.25 +# define __ASSERT_FUNC __PRETTY_FUNCTION__
10.26 +
10.27 + /* C99 requires the use of __func__. */
10.28 +# elif __STDC_VERSION__ >= 199901L
10.29 +# define __ASSERT_FUNC __func__
10.30 +
10.31 + /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
10.32 +# elif __GNUC__ >= 2
10.33 +# define __ASSERT_FUNC __FUNCTION__
10.34 +
10.35 + /* failed to detect __func__ support. */
10.36 +# else
10.37 +# define __ASSERT_FUNC ((char *) 0)
10.38 +# endif
10.39 +# endif /* !__ASSERT_FUNC */
10.40 +#endif /* !NDEBUG */
10.41 +
10.42 +void __assert (const char *, int, const char *)
10.43 + _ATTRIBUTE ((__noreturn__));
10.44 +void __assert_func (const char *, int, const char *, const char *)
10.45 + _ATTRIBUTE ((__noreturn__));
10.46 +
10.47 +#if __STDC_VERSION__ >= 201112L && !defined __cplusplus
10.48 +# define static_assert _Static_assert
10.49 +#endif
10.50 +
10.51 +#ifdef __cplusplus
10.52 +}
10.53 +#endif
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/include/complex.h Mon Oct 21 16:11:07 2019 +0200
11.3 @@ -0,0 +1,153 @@
11.4 +/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
11.5 +
11.6 +/*
11.7 + * Written by Matthias Drochner.
11.8 + * Public domain.
11.9 + */
11.10 +
11.11 +#ifndef _COMPLEX_H
11.12 +#define _COMPLEX_H
11.13 +
11.14 +#define complex _Complex
11.15 +#define _Complex_I 1.0fi
11.16 +#define I _Complex_I
11.17 +
11.18 +#include <sys/cdefs.h>
11.19 +
11.20 +__BEGIN_DECLS
11.21 +
11.22 +/* 7.3.5 Trigonometric functions */
11.23 +/* 7.3.5.1 The cacos functions */
11.24 +double complex cacos(double complex);
11.25 +float complex cacosf(float complex);
11.26 +
11.27 +/* 7.3.5.2 The casin functions */
11.28 +double complex casin(double complex);
11.29 +float complex casinf(float complex);
11.30 +long double complex casinl(long double complex);
11.31 +
11.32 +/* 7.3.5.1 The catan functions */
11.33 +double complex catan(double complex);
11.34 +float complex catanf(float complex);
11.35 +long double complex catanl(long double complex);
11.36 +
11.37 +/* 7.3.5.1 The ccos functions */
11.38 +double complex ccos(double complex);
11.39 +float complex ccosf(float complex);
11.40 +
11.41 +/* 7.3.5.1 The csin functions */
11.42 +double complex csin(double complex);
11.43 +float complex csinf(float complex);
11.44 +
11.45 +/* 7.3.5.1 The ctan functions */
11.46 +double complex ctan(double complex);
11.47 +float complex ctanf(float complex);
11.48 +
11.49 +/* 7.3.6 Hyperbolic functions */
11.50 +/* 7.3.6.1 The cacosh functions */
11.51 +double complex cacosh(double complex);
11.52 +float complex cacoshf(float complex);
11.53 +
11.54 +/* 7.3.6.2 The casinh functions */
11.55 +double complex casinh(double complex);
11.56 +float complex casinhf(float complex);
11.57 +
11.58 +/* 7.3.6.3 The catanh functions */
11.59 +double complex catanh(double complex);
11.60 +float complex catanhf(float complex);
11.61 +
11.62 +/* 7.3.6.4 The ccosh functions */
11.63 +double complex ccosh(double complex);
11.64 +float complex ccoshf(float complex);
11.65 +
11.66 +/* 7.3.6.5 The csinh functions */
11.67 +double complex csinh(double complex);
11.68 +float complex csinhf(float complex);
11.69 +
11.70 +/* 7.3.6.6 The ctanh functions */
11.71 +double complex ctanh(double complex);
11.72 +float complex ctanhf(float complex);
11.73 +
11.74 +/* 7.3.7 Exponential and logarithmic functions */
11.75 +/* 7.3.7.1 The cexp functions */
11.76 +double complex cexp(double complex);
11.77 +float complex cexpf(float complex);
11.78 +
11.79 +/* 7.3.7.2 The clog functions */
11.80 +double complex clog(double complex);
11.81 +float complex clogf(float complex);
11.82 +long double complex clogl(long double complex);
11.83 +
11.84 +/* 7.3.8 Power and absolute-value functions */
11.85 +/* 7.3.8.1 The cabs functions */
11.86 +/*#ifndef __LIBM0_SOURCE__ */
11.87 +/* avoid conflict with historical cabs(struct complex) */
11.88 +/* double cabs(double complex) __RENAME(__c99_cabs);
11.89 + float cabsf(float complex) __RENAME(__c99_cabsf);
11.90 + #endif
11.91 +*/
11.92 +long double cabsl(long double complex) ;
11.93 +double cabs(double complex) ;
11.94 +float cabsf(float complex) ;
11.95 +
11.96 +/* 7.3.8.2 The cpow functions */
11.97 +double complex cpow(double complex, double complex);
11.98 +float complex cpowf(float complex, float complex);
11.99 +
11.100 +/* 7.3.8.3 The csqrt functions */
11.101 +double complex csqrt(double complex);
11.102 +float complex csqrtf(float complex);
11.103 +long double complex csqrtl(long double complex);
11.104 +
11.105 +/* 7.3.9 Manipulation functions */
11.106 +/* 7.3.9.1 The carg functions */
11.107 +double carg(double complex);
11.108 +float cargf(float complex);
11.109 +long double cargl(long double complex);
11.110 +
11.111 +/* 7.3.9.2 The cimag functions */
11.112 +double cimag(double complex);
11.113 +float cimagf(float complex);
11.114 +long double cimagl(long double complex);
11.115 +
11.116 +/* 7.3.9.3 The conj functions */
11.117 +double complex conj(double complex);
11.118 +float complex conjf(float complex);
11.119 +
11.120 +/* 7.3.9.4 The cproj functions */
11.121 +double complex cproj(double complex);
11.122 +float complex cprojf(float complex);
11.123 +
11.124 +/* 7.3.9.5 The creal functions */
11.125 +double creal(double complex);
11.126 +float crealf(float complex);
11.127 +long double creall(long double complex);
11.128 +
11.129 +#if __GNU_VISIBLE
11.130 +double complex clog10(double complex);
11.131 +float complex clog10f(float complex);
11.132 +#endif
11.133 +
11.134 +#if defined(__CYGWIN__)
11.135 +long double complex cacosl(long double complex);
11.136 +long double complex ccosl(long double complex);
11.137 +long double complex csinl(long double complex);
11.138 +long double complex ctanl(long double complex);
11.139 +long double complex cacoshl(long double complex);
11.140 +long double complex casinhl(long double complex);
11.141 +long double complex catanhl(long double complex);
11.142 +long double complex ccoshl(long double complex);
11.143 +long double complex csinhl(long double complex);
11.144 +long double complex ctanhl(long double complex);
11.145 +long double complex cexpl(long double complex);
11.146 +long double complex cpowl(long double complex, long double complex);
11.147 +long double complex conjl(long double complex);
11.148 +long double complex cprojl(long double complex);
11.149 +#if __GNU_VISIBLE
11.150 +long double complex clog10l(long double complex);
11.151 +#endif
11.152 +#endif /* __CYGWIN__ */
11.153 +
11.154 +__END_DECLS
11.155 +
11.156 +#endif /* ! _COMPLEX_H */
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/include/cpio.h Mon Oct 21 16:11:07 2019 +0200
12.3 @@ -0,0 +1,30 @@
12.4 +/* POSIX.1 symbolic constants for c_mode field of cpio archive format */
12.5 +
12.6 +#ifndef _CPIO_H
12.7 +#define _CPIO_H
12.8 +
12.9 +#define C_IRUSR 0000400 /* Read by owner */
12.10 +#define C_IWUSR 0000200 /* Write by owner */
12.11 +#define C_IXUSR 0000100 /* Execute by owner */
12.12 +#define C_IRGRP 0000040 /* Read by group */
12.13 +#define C_IWGRP 0000020 /* Write by group */
12.14 +#define C_IXGRP 0000010 /* Execute by group */
12.15 +#define C_IROTH 0000004 /* Read by others */
12.16 +#define C_IWOTH 0000002 /* Write by others */
12.17 +#define C_IXOTH 0000001 /* Execute by others */
12.18 +#define C_ISUID 0004000 /* Set user ID */
12.19 +#define C_ISGID 0002000 /* Set group ID */
12.20 +#define C_ISVTX 0001000 /* On directories, restricted deletion flag */
12.21 +
12.22 +#define C_ISDIR 0040000 /* Directory */
12.23 +#define C_ISFIFO 0010000 /* FIFO */
12.24 +#define C_ISREG 0100000 /* Regular file */
12.25 +#define C_ISBLK 0060000 /* Block special */
12.26 +#define C_ISCHR 0020000 /* Character special */
12.27 +#define C_ISCTG 0110000 /* Reserved */
12.28 +#define C_ISLNK 0120000 /* Symbolic link */
12.29 +#define C_ISSOCK 0140000 /* Socket */
12.30 +
12.31 +#define MAGIC "070707"
12.32 +
12.33 +#endif /* _CPIO_H */
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/include/ctype.h Mon Oct 21 16:11:07 2019 +0200
13.3 @@ -0,0 +1,178 @@
13.4 +#ifndef _CTYPE_H_
13.5 +#define _CTYPE_H_
13.6 +
13.7 +#include "_ansi.h"
13.8 +#include <sys/cdefs.h>
13.9 +
13.10 +#if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_COMPILING_NEWLIB)
13.11 +#include <sys/_locale.h>
13.12 +#endif
13.13 +
13.14 +_BEGIN_STD_C
13.15 +
13.16 +int isalnum (int __c);
13.17 +int isalpha (int __c);
13.18 +int iscntrl (int __c);
13.19 +int isdigit (int __c);
13.20 +int isgraph (int __c);
13.21 +int islower (int __c);
13.22 +int isprint (int __c);
13.23 +int ispunct (int __c);
13.24 +int isspace (int __c);
13.25 +int isupper (int __c);
13.26 +int isxdigit (int __c);
13.27 +int tolower (int __c);
13.28 +int toupper (int __c);
13.29 +
13.30 +#if __ISO_C_VISIBLE >= 1999
13.31 +int isblank (int __c);
13.32 +#endif
13.33 +
13.34 +#if __MISC_VISIBLE || __XSI_VISIBLE
13.35 +int isascii (int __c);
13.36 +int toascii (int __c);
13.37 +#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
13.38 +#define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A')
13.39 +#endif
13.40 +
13.41 +#if __POSIX_VISIBLE >= 200809
13.42 +extern int isalnum_l (int __c, locale_t __l);
13.43 +extern int isalpha_l (int __c, locale_t __l);
13.44 +extern int isblank_l (int __c, locale_t __l);
13.45 +extern int iscntrl_l (int __c, locale_t __l);
13.46 +extern int isdigit_l (int __c, locale_t __l);
13.47 +extern int isgraph_l (int __c, locale_t __l);
13.48 +extern int islower_l (int __c, locale_t __l);
13.49 +extern int isprint_l (int __c, locale_t __l);
13.50 +extern int ispunct_l (int __c, locale_t __l);
13.51 +extern int isspace_l (int __c, locale_t __l);
13.52 +extern int isupper_l (int __c, locale_t __l);
13.53 +extern int isxdigit_l(int __c, locale_t __l);
13.54 +extern int tolower_l (int __c, locale_t __l);
13.55 +extern int toupper_l (int __c, locale_t __l);
13.56 +#endif
13.57 +
13.58 +#if __MISC_VISIBLE
13.59 +extern int isascii_l (int __c, locale_t __l);
13.60 +extern int toascii_l (int __c, locale_t __l);
13.61 +#endif
13.62 +
13.63 +#define _U 01
13.64 +#define _L 02
13.65 +#define _N 04
13.66 +#define _S 010
13.67 +#define _P 020
13.68 +#define _C 040
13.69 +#define _X 0100
13.70 +#define _B 0200
13.71 +
13.72 +#ifdef __HAVE_LOCALE_INFO__
13.73 +const char *__locale_ctype_ptr (void);
13.74 +#else
13.75 +#define __locale_ctype_ptr() _ctype_
13.76 +#endif
13.77 +
13.78 +# define __CTYPE_PTR (__locale_ctype_ptr ())
13.79 +
13.80 +#ifndef __cplusplus
13.81 +/* These macros are intentionally written in a manner that will trigger
13.82 + a gcc -Wall warning if the user mistakenly passes a 'char' instead
13.83 + of an int containing an 'unsigned char'. Note that the sizeof will
13.84 + always be 1, which is what we want for mapping EOF to __CTYPE_PTR[0];
13.85 + the use of a raw index inside the sizeof triggers the gcc warning if
13.86 + __c was of type char, and sizeof masks side effects of the extra __c.
13.87 + Meanwhile, the real index to __CTYPE_PTR+1 must be cast to int,
13.88 + since isalpha(0x100000001LL) must equal isalpha(1), rather than being
13.89 + an out-of-bounds reference on a 64-bit machine. */
13.90 +#define __ctype_lookup(__c) ((__CTYPE_PTR+sizeof(""[__c]))[(int)(__c)])
13.91 +
13.92 +#define isalpha(__c) (__ctype_lookup(__c)&(_U|_L))
13.93 +#define isupper(__c) ((__ctype_lookup(__c)&(_U|_L))==_U)
13.94 +#define islower(__c) ((__ctype_lookup(__c)&(_U|_L))==_L)
13.95 +#define isdigit(__c) (__ctype_lookup(__c)&_N)
13.96 +#define isxdigit(__c) (__ctype_lookup(__c)&(_X|_N))
13.97 +#define isspace(__c) (__ctype_lookup(__c)&_S)
13.98 +#define ispunct(__c) (__ctype_lookup(__c)&_P)
13.99 +#define isalnum(__c) (__ctype_lookup(__c)&(_U|_L|_N))
13.100 +#define isprint(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N|_B))
13.101 +#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N))
13.102 +#define iscntrl(__c) (__ctype_lookup(__c)&_C)
13.103 +
13.104 +#if defined(__GNUC__) && __ISO_C_VISIBLE >= 1999
13.105 +#define isblank(__c) \
13.106 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.107 + (__ctype_lookup(__x)&_B) || (int) (__x) == '\t';})
13.108 +#endif
13.109 +
13.110 +#if __POSIX_VISIBLE >= 200809
13.111 +#ifdef __HAVE_LOCALE_INFO__
13.112 +const char *__locale_ctype_ptr_l (locale_t);
13.113 +#else
13.114 +#define __locale_ctype_ptr_l(l) _ctype_
13.115 +#endif
13.116 +#define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)])
13.117 +
13.118 +#define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L))
13.119 +#define isupper_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_U)
13.120 +#define islower_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_L)
13.121 +#define isdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&_N)
13.122 +#define isxdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_X|_N))
13.123 +#define isspace_l(__c,__l) (__ctype_lookup_l(__c,__l)&_S)
13.124 +#define ispunct_l(__c,__l) (__ctype_lookup_l(__c,__l)&_P)
13.125 +#define isalnum_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L|_N))
13.126 +#define isprint_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N|_B))
13.127 +#define isgraph_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N))
13.128 +#define iscntrl_l(__c,__l) (__ctype_lookup_l(__c,__l)&_C)
13.129 +
13.130 +#if defined(__GNUC__)
13.131 +#define isblank_l(__c, __l) \
13.132 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.133 + (__ctype_lookup_l(__x,__l)&_B) || (int) (__x) == '\t';})
13.134 +#endif
13.135 +
13.136 +#endif /* __POSIX_VISIBLE >= 200809 */
13.137 +
13.138 +#if __MISC_VISIBLE || __XSI_VISIBLE
13.139 +#define isascii(__c) ((unsigned)(__c)<=0177)
13.140 +#define toascii(__c) ((__c)&0177)
13.141 +#endif
13.142 +
13.143 +#if __MISC_VISIBLE
13.144 +#define isascii_l(__c,__l) ((__l),(unsigned)(__c)<=0177)
13.145 +#define toascii_l(__c,__l) ((__l),(__c)&0177)
13.146 +#endif
13.147 +
13.148 +/* Non-gcc versions will get the library versions, and will be
13.149 + slightly slower. These macros are not NLS-aware so they are
13.150 + disabled if the system supports the extended character sets. */
13.151 +# if defined(__GNUC__)
13.152 +# if !defined (_MB_EXTENDED_CHARSETS_ISO) && !defined (_MB_EXTENDED_CHARSETS_WINDOWS)
13.153 +# define toupper(__c) \
13.154 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.155 + islower (__x) ? (int) __x - 'a' + 'A' : (int) __x;})
13.156 +# define tolower(__c) \
13.157 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.158 + isupper (__x) ? (int) __x - 'A' + 'a' : (int) __x;})
13.159 +# else /* _MB_EXTENDED_CHARSETS* */
13.160 +/* Allow a gcc warning if the user passed 'char', but defer to the
13.161 + function. */
13.162 +# define toupper(__c) \
13.163 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.164 + (void) __CTYPE_PTR[__x]; (toupper) (__x);})
13.165 +# define tolower(__c) \
13.166 + __extension__ ({ __typeof__ (__c) __x = (__c); \
13.167 + (void) __CTYPE_PTR[__x]; (tolower) (__x);})
13.168 +# endif /* _MB_EXTENDED_CHARSETS* */
13.169 +# endif /* __GNUC__ */
13.170 +
13.171 +#if __POSIX_VISIBLE >= 200809
13.172 +#endif /* __POSIX_VISIBLE >= 200809 */
13.173 +
13.174 +#endif /* !__cplusplus */
13.175 +
13.176 +/* For C++ backward-compatibility only. */
13.177 +extern __IMPORT const char _ctype_[];
13.178 +
13.179 +_END_STD_C
13.180 +
13.181 +#endif /* _CTYPE_H_ */
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/include/devctl.h Mon Oct 21 16:11:07 2019 +0200
14.3 @@ -0,0 +1,70 @@
14.4 +/*
14.5 + * Copyright (c) 2016,2019 Joel Sherrill <joel@rtems.org>.
14.6 + * All rights reserved.
14.7 + *
14.8 + * Redistribution and use in source and binary forms, with or without
14.9 + * modification, are permitted provided that the following conditions
14.10 + * are met:
14.11 + * 1. Redistributions of source code must retain the above copyright
14.12 + * notice, this list of conditions and the following disclaimer.
14.13 + * 2. Redistributions in binary form must reproduce the above copyright
14.14 + * notice, this list of conditions and the following disclaimer in the
14.15 + * documentation and/or other materials provided with the distribution.
14.16 + *
14.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
14.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
14.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
14.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
14.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
14.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
14.27 + * SUCH DAMAGE.
14.28 + */
14.29 +
14.30 +#ifndef _POSIX_DEVCTL_h_
14.31 +#define _POSIX_DEVCTL_h_
14.32 +
14.33 +/*
14.34 + * Nothing in this file should be visible unless _POSIX_26_C_SOURCE is
14.35 + * defined.
14.36 + */
14.37 +#ifdef _POSIX_26_C_SOURCE
14.38 +
14.39 +#include <sys/cdefs.h>
14.40 +
14.41 +#if defined(__rtems__)
14.42 +/*
14.43 + * The FACE Technical Standard, Edition 3.0 and later require the
14.44 + * definition of the subcommand SOCKCLOSE in <devctl.h>.
14.45 + *
14.46 + * Reference: https://www.opengroup.org/face
14.47 + *
14.48 + * Using 'D' should avoid the letters used by other users of <sys/ioccom.h>
14.49 + */
14.50 +#include <sys/ioccom.h>
14.51 +
14.52 +#define SOCKCLOSE _IO('D', 1) /* socket close */
14.53 +#endif
14.54 +
14.55 +/*
14.56 + * The posix_devctl() method is defined by POSIX 1003.26-2003. Aside
14.57 + * from the single method, it adds the following requirements:
14.58 + *
14.59 + * + define _POSIX_26_VERSION to 200312L
14.60 + * + add _SC_POSIX_26_VERSION in <unistd.h>. Return _POSIX_26_VERSION
14.61 + * + application must define _POSIX_26_C_SOURCE to use posix_devctl().
14.62 + * + posix_devctl() is prototyped in <devctl.h>
14.63 + */
14.64 +int posix_devctl(
14.65 + int fd,
14.66 + int dcmd,
14.67 + void *__restrict dev_data_ptr,
14.68 + size_t nbyte,
14.69 + int *__restrict dev_info_ptr
14.70 +);
14.71 +#endif
14.72 +
14.73 +#endif
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/include/dirent.h Mon Oct 21 16:11:07 2019 +0200
15.3 @@ -0,0 +1,85 @@
15.4 +/*-
15.5 + * SPDX-License-Identifier: BSD-3-Clause
15.6 + *
15.7 + * Copyright (c) 1989, 1993
15.8 + * The Regents of the University of California. All rights reserved.
15.9 + *
15.10 + * Redistribution and use in source and binary forms, with or without
15.11 + * modification, are permitted provided that the following conditions
15.12 + * are met:
15.13 + * 1. Redistributions of source code must retain the above copyright
15.14 + * notice, this list of conditions and the following disclaimer.
15.15 + * 2. Redistributions in binary form must reproduce the above copyright
15.16 + * notice, this list of conditions and the following disclaimer in the
15.17 + * documentation and/or other materials provided with the distribution.
15.18 + * 3. Neither the name of the University nor the names of its contributors
15.19 + * may be used to endorse or promote products derived from this software
15.20 + * without specific prior written permission.
15.21 + *
15.22 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
15.23 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.24 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.25 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
15.26 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
15.27 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
15.28 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
15.29 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
15.30 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
15.31 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
15.32 + * SUCH DAMAGE.
15.33 + *
15.34 + * @(#)dirent.h 8.3 (Berkeley) 8/10/94
15.35 + * $FreeBSD: head/include/dirent.h 326024 2017-11-20 19:45:28Z pfg $
15.36 + */
15.37 +
15.38 +#ifndef _DIRENT_H_
15.39 +#define _DIRENT_H_
15.40 +
15.41 +#include <sys/cdefs.h>
15.42 +#include <sys/dirent.h>
15.43 +
15.44 +#if !defined(MAXNAMLEN) && __BSD_VISIBLE
15.45 +#define MAXNAMLEN 1024
15.46 +#endif
15.47 +
15.48 +__BEGIN_DECLS
15.49 +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
15.50 +int alphasort(const struct dirent **, const struct dirent **);
15.51 +int dirfd(DIR *);
15.52 +#endif
15.53 +#if __BSD_VISIBLE
15.54 +int fdclosedir(DIR *);
15.55 +#endif
15.56 +DIR *opendir(const char *);
15.57 +DIR *fdopendir(int);
15.58 +struct dirent *
15.59 + readdir(DIR *);
15.60 +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
15.61 +int readdir_r(DIR *__restrict, struct dirent *__restrict,
15.62 + struct dirent **__restrict);
15.63 +#endif
15.64 +void rewinddir(DIR *);
15.65 +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
15.66 +int scandir(const char *, struct dirent ***,
15.67 + int (*)(const struct dirent *), int (*)(const struct dirent **,
15.68 + const struct dirent **));
15.69 +#endif
15.70 +#ifdef _COMPILING_NEWLIB
15.71 +void _seekdir(DIR *, long);
15.72 +#endif
15.73 +#if __MISC_VISIBLE || __XSI_VISIBLE
15.74 +#ifndef __INSIDE_CYGWIN__
15.75 +void seekdir(DIR *, long);
15.76 +long telldir(DIR *);
15.77 +#endif
15.78 +#endif
15.79 +int closedir(DIR *);
15.80 +#if __GNU_VISIBLE
15.81 +int scandirat(int, const char *, struct dirent ***,
15.82 + int (*) (const struct dirent *), int (*) (const struct dirent **,
15.83 + const struct dirent **));
15.84 +int versionsort(const struct dirent **, const struct dirent **);
15.85 +#endif
15.86 +__END_DECLS
15.87 +
15.88 +#endif /*_DIRENT_H_*/
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/include/elf.h Mon Oct 21 16:11:07 2019 +0200
16.3 @@ -0,0 +1,3147 @@
16.4 +/*
16.5 +From musl include/elf.h
16.6 +
16.7 +Copyright © 2005-2014 Rich Felker, et al.
16.8 +
16.9 +Permission is hereby granted, free of charge, to any person obtaining
16.10 +a copy of this software and associated documentation files (the
16.11 +"Software"), to deal in the Software without restriction, including
16.12 +without limitation the rights to use, copy, modify, merge, publish,
16.13 +distribute, sublicense, and/or sell copies of the Software, and to
16.14 +permit persons to whom the Software is furnished to do so, subject to
16.15 +the following conditions:
16.16 +
16.17 +The above copyright notice and this permission notice shall be
16.18 +included in all copies or substantial portions of the Software.
16.19 +
16.20 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16.21 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16.22 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16.23 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
16.24 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
16.25 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16.26 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16.27 +*/
16.28 +
16.29 +#ifndef _ELF_H
16.30 +#define _ELF_H
16.31 +
16.32 +#ifdef __cplusplus
16.33 +extern "C" {
16.34 +#endif
16.35 +
16.36 +#include <stdint.h>
16.37 +
16.38 +typedef uint16_t Elf32_Half;
16.39 +typedef uint16_t Elf64_Half;
16.40 +
16.41 +typedef uint32_t Elf32_Word;
16.42 +typedef int32_t Elf32_Sword;
16.43 +typedef uint32_t Elf64_Word;
16.44 +typedef int32_t Elf64_Sword;
16.45 +
16.46 +typedef uint64_t Elf32_Xword;
16.47 +typedef int64_t Elf32_Sxword;
16.48 +typedef uint64_t Elf64_Xword;
16.49 +typedef int64_t Elf64_Sxword;
16.50 +
16.51 +typedef uint32_t Elf32_Addr;
16.52 +typedef uint64_t Elf64_Addr;
16.53 +
16.54 +typedef uint32_t Elf32_Off;
16.55 +typedef uint64_t Elf64_Off;
16.56 +
16.57 +typedef uint16_t Elf32_Section;
16.58 +typedef uint16_t Elf64_Section;
16.59 +
16.60 +typedef Elf32_Half Elf32_Versym;
16.61 +typedef Elf64_Half Elf64_Versym;
16.62 +
16.63 +#define EI_NIDENT (16)
16.64 +
16.65 +typedef struct {
16.66 + unsigned char e_ident[EI_NIDENT];
16.67 + Elf32_Half e_type;
16.68 + Elf32_Half e_machine;
16.69 + Elf32_Word e_version;
16.70 + Elf32_Addr e_entry;
16.71 + Elf32_Off e_phoff;
16.72 + Elf32_Off e_shoff;
16.73 + Elf32_Word e_flags;
16.74 + Elf32_Half e_ehsize;
16.75 + Elf32_Half e_phentsize;
16.76 + Elf32_Half e_phnum;
16.77 + Elf32_Half e_shentsize;
16.78 + Elf32_Half e_shnum;
16.79 + Elf32_Half e_shstrndx;
16.80 +} Elf32_Ehdr;
16.81 +
16.82 +typedef struct {
16.83 + unsigned char e_ident[EI_NIDENT];
16.84 + Elf64_Half e_type;
16.85 + Elf64_Half e_machine;
16.86 + Elf64_Word e_version;
16.87 + Elf64_Addr e_entry;
16.88 + Elf64_Off e_phoff;
16.89 + Elf64_Off e_shoff;
16.90 + Elf64_Word e_flags;
16.91 + Elf64_Half e_ehsize;
16.92 + Elf64_Half e_phentsize;
16.93 + Elf64_Half e_phnum;
16.94 + Elf64_Half e_shentsize;
16.95 + Elf64_Half e_shnum;
16.96 + Elf64_Half e_shstrndx;
16.97 +} Elf64_Ehdr;
16.98 +
16.99 +#define EI_MAG0 0
16.100 +#define ELFMAG0 0x7f
16.101 +
16.102 +#define EI_MAG1 1
16.103 +#define ELFMAG1 'E'
16.104 +
16.105 +#define EI_MAG2 2
16.106 +#define ELFMAG2 'L'
16.107 +
16.108 +#define EI_MAG3 3
16.109 +#define ELFMAG3 'F'
16.110 +
16.111 +
16.112 +#define ELFMAG "\177ELF"
16.113 +#define SELFMAG 4
16.114 +
16.115 +#define EI_CLASS 4
16.116 +#define ELFCLASSNONE 0
16.117 +#define ELFCLASS32 1
16.118 +#define ELFCLASS64 2
16.119 +#define ELFCLASSNUM 3
16.120 +
16.121 +#define EI_DATA 5
16.122 +#define ELFDATANONE 0
16.123 +#define ELFDATA2LSB 1
16.124 +#define ELFDATA2MSB 2
16.125 +#define ELFDATANUM 3
16.126 +
16.127 +#define EI_VERSION 6
16.128 +
16.129 +
16.130 +#define EI_OSABI 7
16.131 +#define ELFOSABI_NONE 0
16.132 +#define ELFOSABI_SYSV 0
16.133 +#define ELFOSABI_HPUX 1
16.134 +#define ELFOSABI_NETBSD 2
16.135 +#define ELFOSABI_LINUX 3
16.136 +#define ELFOSABI_GNU 3
16.137 +#define ELFOSABI_SOLARIS 6
16.138 +#define ELFOSABI_AIX 7
16.139 +#define ELFOSABI_IRIX 8
16.140 +#define ELFOSABI_FREEBSD 9
16.141 +#define ELFOSABI_TRU64 10
16.142 +#define ELFOSABI_MODESTO 11
16.143 +#define ELFOSABI_OPENBSD 12
16.144 +#define ELFOSABI_ARM 97
16.145 +#define ELFOSABI_STANDALONE 255
16.146 +
16.147 +#define EI_ABIVERSION 8
16.148 +
16.149 +#define EI_PAD 9
16.150 +
16.151 +
16.152 +
16.153 +#define ET_NONE 0
16.154 +#define ET_REL 1
16.155 +#define ET_EXEC 2
16.156 +#define ET_DYN 3
16.157 +#define ET_CORE 4
16.158 +#define ET_NUM 5
16.159 +#define ET_LOOS 0xfe00
16.160 +#define ET_HIOS 0xfeff
16.161 +#define ET_LOPROC 0xff00
16.162 +#define ET_HIPROC 0xffff
16.163 +
16.164 +
16.165 +
16.166 +#define EM_NONE 0
16.167 +#define EM_M32 1
16.168 +#define EM_SPARC 2
16.169 +#define EM_386 3
16.170 +#define EM_68K 4
16.171 +#define EM_88K 5
16.172 +#define EM_860 7
16.173 +#define EM_MIPS 8
16.174 +#define EM_S370 9
16.175 +#define EM_MIPS_RS3_LE 10
16.176 +
16.177 +#define EM_PARISC 15
16.178 +#define EM_VPP500 17
16.179 +#define EM_SPARC32PLUS 18
16.180 +#define EM_960 19
16.181 +#define EM_PPC 20
16.182 +#define EM_PPC64 21
16.183 +#define EM_S390 22
16.184 +
16.185 +#define EM_V800 36
16.186 +#define EM_FR20 37
16.187 +#define EM_RH32 38
16.188 +#define EM_RCE 39
16.189 +#define EM_ARM 40
16.190 +#define EM_FAKE_ALPHA 41
16.191 +#define EM_SH 42
16.192 +#define EM_SPARCV9 43
16.193 +#define EM_TRICORE 44
16.194 +#define EM_ARC 45
16.195 +#define EM_H8_300 46
16.196 +#define EM_H8_300H 47
16.197 +#define EM_H8S 48
16.198 +#define EM_H8_500 49
16.199 +#define EM_IA_64 50
16.200 +#define EM_MIPS_X 51
16.201 +#define EM_COLDFIRE 52
16.202 +#define EM_68HC12 53
16.203 +#define EM_MMA 54
16.204 +#define EM_PCP 55
16.205 +#define EM_NCPU 56
16.206 +#define EM_NDR1 57
16.207 +#define EM_STARCORE 58
16.208 +#define EM_ME16 59
16.209 +#define EM_ST100 60
16.210 +#define EM_TINYJ 61
16.211 +#define EM_X86_64 62
16.212 +#define EM_PDSP 63
16.213 +
16.214 +#define EM_FX66 66
16.215 +#define EM_ST9PLUS 67
16.216 +#define EM_ST7 68
16.217 +#define EM_68HC16 69
16.218 +#define EM_68HC11 70
16.219 +#define EM_68HC08 71
16.220 +#define EM_68HC05 72
16.221 +#define EM_SVX 73
16.222 +#define EM_ST19 74
16.223 +#define EM_VAX 75
16.224 +#define EM_CRIS 76
16.225 +#define EM_JAVELIN 77
16.226 +#define EM_FIREPATH 78
16.227 +#define EM_ZSP 79
16.228 +#define EM_MMIX 80
16.229 +#define EM_HUANY 81
16.230 +#define EM_PRISM 82
16.231 +#define EM_AVR 83
16.232 +#define EM_FR30 84
16.233 +#define EM_D10V 85
16.234 +#define EM_D30V 86
16.235 +#define EM_V850 87
16.236 +#define EM_M32R 88
16.237 +#define EM_MN10300 89
16.238 +#define EM_MN10200 90
16.239 +#define EM_PJ 91
16.240 +#define EM_OR1K 92
16.241 +#define EM_OPENRISC 92
16.242 +#define EM_ARC_A5 93
16.243 +#define EM_ARC_COMPACT 93
16.244 +#define EM_XTENSA 94
16.245 +#define EM_VIDEOCORE 95
16.246 +#define EM_TMM_GPP 96
16.247 +#define EM_NS32K 97
16.248 +#define EM_TPC 98
16.249 +#define EM_SNP1K 99
16.250 +#define EM_ST200 100
16.251 +#define EM_IP2K 101
16.252 +#define EM_MAX 102
16.253 +#define EM_CR 103
16.254 +#define EM_F2MC16 104
16.255 +#define EM_MSP430 105
16.256 +#define EM_BLACKFIN 106
16.257 +#define EM_SE_C33 107
16.258 +#define EM_SEP 108
16.259 +#define EM_ARCA 109
16.260 +#define EM_UNICORE 110
16.261 +#define EM_EXCESS 111
16.262 +#define EM_DXP 112
16.263 +#define EM_ALTERA_NIOS2 113
16.264 +#define EM_CRX 114
16.265 +#define EM_XGATE 115
16.266 +#define EM_C166 116
16.267 +#define EM_M16C 117
16.268 +#define EM_DSPIC30F 118
16.269 +#define EM_CE 119
16.270 +#define EM_M32C 120
16.271 +#define EM_TSK3000 131
16.272 +#define EM_RS08 132
16.273 +#define EM_SHARC 133
16.274 +#define EM_ECOG2 134
16.275 +#define EM_SCORE7 135
16.276 +#define EM_DSP24 136
16.277 +#define EM_VIDEOCORE3 137
16.278 +#define EM_LATTICEMICO32 138
16.279 +#define EM_SE_C17 139
16.280 +#define EM_TI_C6000 140
16.281 +#define EM_TI_C2000 141
16.282 +#define EM_TI_C5500 142
16.283 +#define EM_TI_ARP32 143
16.284 +#define EM_TI_PRU 144
16.285 +#define EM_MMDSP_PLUS 160
16.286 +#define EM_CYPRESS_M8C 161
16.287 +#define EM_R32C 162
16.288 +#define EM_TRIMEDIA 163
16.289 +#define EM_QDSP6 164
16.290 +#define EM_8051 165
16.291 +#define EM_STXP7X 166
16.292 +#define EM_NDS32 167
16.293 +#define EM_ECOG1X 168
16.294 +#define EM_MAXQ30 169
16.295 +#define EM_XIMO16 170
16.296 +#define EM_MANIK 171
16.297 +#define EM_CRAYNV2 172
16.298 +#define EM_RX 173
16.299 +#define EM_METAG 174
16.300 +#define EM_MCST_ELBRUS 175
16.301 +#define EM_ECOG16 176
16.302 +#define EM_CR16 177
16.303 +#define EM_ETPU 178
16.304 +#define EM_SLE9X 179
16.305 +#define EM_L10M 180
16.306 +#define EM_K10M 181
16.307 +#define EM_AARCH64 183
16.308 +#define EM_AVR32 185
16.309 +#define EM_STM8 186
16.310 +#define EM_TILE64 187
16.311 +#define EM_TILEPRO 188
16.312 +#define EM_MICROBLAZE 189
16.313 +#define EM_CUDA 190
16.314 +#define EM_TILEGX 191
16.315 +#define EM_CLOUDSHIELD 192
16.316 +#define EM_COREA_1ST 193
16.317 +#define EM_COREA_2ND 194
16.318 +#define EM_ARC_COMPACT2 195
16.319 +#define EM_OPEN8 196
16.320 +#define EM_RL78 197
16.321 +#define EM_VIDEOCORE5 198
16.322 +#define EM_78KOR 199
16.323 +#define EM_56800EX 200
16.324 +#define EM_BA1 201
16.325 +#define EM_BA2 202
16.326 +#define EM_XCORE 203
16.327 +#define EM_MCHP_PIC 204
16.328 +#define EM_KM32 210
16.329 +#define EM_KMX32 211
16.330 +#define EM_EMX16 212
16.331 +#define EM_EMX8 213
16.332 +#define EM_KVARC 214
16.333 +#define EM_CDP 215
16.334 +#define EM_COGE 216
16.335 +#define EM_COOL 217
16.336 +#define EM_NORC 218
16.337 +#define EM_CSR_KALIMBA 219
16.338 +#define EM_Z80 220
16.339 +#define EM_VISIUM 221
16.340 +#define EM_FT32 222
16.341 +#define EM_MOXIE 223
16.342 +#define EM_AMDGPU 224
16.343 +#define EM_RISCV 243
16.344 +#define EM_BPF 247
16.345 +#define EM_NUM 248
16.346 +
16.347 +#define EM_ALPHA 0x9026
16.348 +
16.349 +#define EV_NONE 0
16.350 +#define EV_CURRENT 1
16.351 +#define EV_NUM 2
16.352 +
16.353 +typedef struct {
16.354 + Elf32_Word sh_name;
16.355 + Elf32_Word sh_type;
16.356 + Elf32_Word sh_flags;
16.357 + Elf32_Addr sh_addr;
16.358 + Elf32_Off sh_offset;
16.359 + Elf32_Word sh_size;
16.360 + Elf32_Word sh_link;
16.361 + Elf32_Word sh_info;
16.362 + Elf32_Word sh_addralign;
16.363 + Elf32_Word sh_entsize;
16.364 +} Elf32_Shdr;
16.365 +
16.366 +typedef struct {
16.367 + Elf64_Word sh_name;
16.368 + Elf64_Word sh_type;
16.369 + Elf64_Xword sh_flags;
16.370 + Elf64_Addr sh_addr;
16.371 + Elf64_Off sh_offset;
16.372 + Elf64_Xword sh_size;
16.373 + Elf64_Word sh_link;
16.374 + Elf64_Word sh_info;
16.375 + Elf64_Xword sh_addralign;
16.376 + Elf64_Xword sh_entsize;
16.377 +} Elf64_Shdr;
16.378 +
16.379 +
16.380 +
16.381 +#define SHN_UNDEF 0
16.382 +#define SHN_LORESERVE 0xff00
16.383 +#define SHN_LOPROC 0xff00
16.384 +#define SHN_BEFORE 0xff00
16.385 +
16.386 +#define SHN_AFTER 0xff01
16.387 +
16.388 +#define SHN_HIPROC 0xff1f
16.389 +#define SHN_LOOS 0xff20
16.390 +#define SHN_HIOS 0xff3f
16.391 +#define SHN_ABS 0xfff1
16.392 +#define SHN_COMMON 0xfff2
16.393 +#define SHN_XINDEX 0xffff
16.394 +#define SHN_HIRESERVE 0xffff
16.395 +
16.396 +
16.397 +
16.398 +#define SHT_NULL 0
16.399 +#define SHT_PROGBITS 1
16.400 +#define SHT_SYMTAB 2
16.401 +#define SHT_STRTAB 3
16.402 +#define SHT_RELA 4
16.403 +#define SHT_HASH 5
16.404 +#define SHT_DYNAMIC 6
16.405 +#define SHT_NOTE 7
16.406 +#define SHT_NOBITS 8
16.407 +#define SHT_REL 9
16.408 +#define SHT_SHLIB 10
16.409 +#define SHT_DYNSYM 11
16.410 +#define SHT_INIT_ARRAY 14
16.411 +#define SHT_FINI_ARRAY 15
16.412 +#define SHT_PREINIT_ARRAY 16
16.413 +#define SHT_GROUP 17
16.414 +#define SHT_SYMTAB_SHNDX 18
16.415 +#define SHT_NUM 19
16.416 +#define SHT_LOOS 0x60000000
16.417 +#define SHT_GNU_ATTRIBUTES 0x6ffffff5
16.418 +#define SHT_GNU_HASH 0x6ffffff6
16.419 +#define SHT_GNU_LIBLIST 0x6ffffff7
16.420 +#define SHT_CHECKSUM 0x6ffffff8
16.421 +#define SHT_LOSUNW 0x6ffffffa
16.422 +#define SHT_SUNW_move 0x6ffffffa
16.423 +#define SHT_SUNW_COMDAT 0x6ffffffb
16.424 +#define SHT_SUNW_syminfo 0x6ffffffc
16.425 +#define SHT_GNU_verdef 0x6ffffffd
16.426 +#define SHT_GNU_verneed 0x6ffffffe
16.427 +#define SHT_GNU_versym 0x6fffffff
16.428 +#define SHT_HISUNW 0x6fffffff
16.429 +#define SHT_HIOS 0x6fffffff
16.430 +#define SHT_LOPROC 0x70000000
16.431 +#define SHT_HIPROC 0x7fffffff
16.432 +#define SHT_LOUSER 0x80000000
16.433 +#define SHT_HIUSER 0x8fffffff
16.434 +
16.435 +#define SHF_WRITE (1 << 0)
16.436 +#define SHF_ALLOC (1 << 1)
16.437 +#define SHF_EXECINSTR (1 << 2)
16.438 +#define SHF_MERGE (1 << 4)
16.439 +#define SHF_STRINGS (1 << 5)
16.440 +#define SHF_INFO_LINK (1 << 6)
16.441 +#define SHF_LINK_ORDER (1 << 7)
16.442 +#define SHF_OS_NONCONFORMING (1 << 8)
16.443 +
16.444 +#define SHF_GROUP (1 << 9)
16.445 +#define SHF_TLS (1 << 10)
16.446 +#define SHF_COMPRESSED (1 << 11)
16.447 +#define SHF_MASKOS 0x0ff00000
16.448 +#define SHF_MASKPROC 0xf0000000
16.449 +#define SHF_ORDERED (1 << 30)
16.450 +#define SHF_EXCLUDE (1U << 31)
16.451 +
16.452 +typedef struct {
16.453 + Elf32_Word ch_type;
16.454 + Elf32_Word ch_size;
16.455 + Elf32_Word ch_addralign;
16.456 +} Elf32_Chdr;
16.457 +
16.458 +typedef struct {
16.459 + Elf64_Word ch_type;
16.460 + Elf64_Word ch_reserved;
16.461 + Elf64_Xword ch_size;
16.462 + Elf64_Xword ch_addralign;
16.463 +} Elf64_Chdr;
16.464 +
16.465 +#define ELFCOMPRESS_ZLIB 1
16.466 +#define ELFCOMPRESS_LOOS 0x60000000
16.467 +#define ELFCOMPRESS_HIOS 0x6fffffff
16.468 +#define ELFCOMPRESS_LOPROC 0x70000000
16.469 +#define ELFCOMPRESS_HIPROC 0x7fffffff
16.470 +
16.471 +
16.472 +#define GRP_COMDAT 0x1
16.473 +
16.474 +typedef struct {
16.475 + Elf32_Word st_name;
16.476 + Elf32_Addr st_value;
16.477 + Elf32_Word st_size;
16.478 + unsigned char st_info;
16.479 + unsigned char st_other;
16.480 + Elf32_Section st_shndx;
16.481 +} Elf32_Sym;
16.482 +
16.483 +typedef struct {
16.484 + Elf64_Word st_name;
16.485 + unsigned char st_info;
16.486 + unsigned char st_other;
16.487 + Elf64_Section st_shndx;
16.488 + Elf64_Addr st_value;
16.489 + Elf64_Xword st_size;
16.490 +} Elf64_Sym;
16.491 +
16.492 +typedef struct {
16.493 + Elf32_Half si_boundto;
16.494 + Elf32_Half si_flags;
16.495 +} Elf32_Syminfo;
16.496 +
16.497 +typedef struct {
16.498 + Elf64_Half si_boundto;
16.499 + Elf64_Half si_flags;
16.500 +} Elf64_Syminfo;
16.501 +
16.502 +#define SYMINFO_BT_SELF 0xffff
16.503 +#define SYMINFO_BT_PARENT 0xfffe
16.504 +#define SYMINFO_BT_LOWRESERVE 0xff00
16.505 +
16.506 +#define SYMINFO_FLG_DIRECT 0x0001
16.507 +#define SYMINFO_FLG_PASSTHRU 0x0002
16.508 +#define SYMINFO_FLG_COPY 0x0004
16.509 +#define SYMINFO_FLG_LAZYLOAD 0x0008
16.510 +
16.511 +#define SYMINFO_NONE 0
16.512 +#define SYMINFO_CURRENT 1
16.513 +#define SYMINFO_NUM 2
16.514 +
16.515 +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
16.516 +#define ELF32_ST_TYPE(val) ((val) & 0xf)
16.517 +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
16.518 +
16.519 +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
16.520 +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
16.521 +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
16.522 +
16.523 +#define STB_LOCAL 0
16.524 +#define STB_GLOBAL 1
16.525 +#define STB_WEAK 2
16.526 +#define STB_NUM 3
16.527 +#define STB_LOOS 10
16.528 +#define STB_GNU_UNIQUE 10
16.529 +#define STB_HIOS 12
16.530 +#define STB_LOPROC 13
16.531 +#define STB_HIPROC 15
16.532 +
16.533 +#define STT_NOTYPE 0
16.534 +#define STT_OBJECT 1
16.535 +#define STT_FUNC 2
16.536 +#define STT_SECTION 3
16.537 +#define STT_FILE 4
16.538 +#define STT_COMMON 5
16.539 +#define STT_TLS 6
16.540 +#define STT_NUM 7
16.541 +#define STT_LOOS 10
16.542 +#define STT_GNU_IFUNC 10
16.543 +#define STT_HIOS 12
16.544 +#define STT_LOPROC 13
16.545 +#define STT_HIPROC 15
16.546 +
16.547 +#define STN_UNDEF 0
16.548 +
16.549 +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
16.550 +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
16.551 +
16.552 +#define STV_DEFAULT 0
16.553 +#define STV_INTERNAL 1
16.554 +#define STV_HIDDEN 2
16.555 +#define STV_PROTECTED 3
16.556 +
16.557 +
16.558 +
16.559 +
16.560 +typedef struct {
16.561 + Elf32_Addr r_offset;
16.562 + Elf32_Word r_info;
16.563 +} Elf32_Rel;
16.564 +
16.565 +typedef struct {
16.566 + Elf64_Addr r_offset;
16.567 + Elf64_Xword r_info;
16.568 +} Elf64_Rel;
16.569 +
16.570 +
16.571 +
16.572 +typedef struct {
16.573 + Elf32_Addr r_offset;
16.574 + Elf32_Word r_info;
16.575 + Elf32_Sword r_addend;
16.576 +} Elf32_Rela;
16.577 +
16.578 +typedef struct {
16.579 + Elf64_Addr r_offset;
16.580 + Elf64_Xword r_info;
16.581 + Elf64_Sxword r_addend;
16.582 +} Elf64_Rela;
16.583 +
16.584 +
16.585 +
16.586 +#define ELF32_R_SYM(val) ((val) >> 8)
16.587 +#define ELF32_R_TYPE(val) ((val) & 0xff)
16.588 +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
16.589 +
16.590 +#define ELF64_R_SYM(i) ((i) >> 32)
16.591 +#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
16.592 +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
16.593 +
16.594 +
16.595 +
16.596 +typedef struct {
16.597 + Elf32_Word p_type;
16.598 + Elf32_Off p_offset;
16.599 + Elf32_Addr p_vaddr;
16.600 + Elf32_Addr p_paddr;
16.601 + Elf32_Word p_filesz;
16.602 + Elf32_Word p_memsz;
16.603 + Elf32_Word p_flags;
16.604 + Elf32_Word p_align;
16.605 +} Elf32_Phdr;
16.606 +
16.607 +typedef struct {
16.608 + Elf64_Word p_type;
16.609 + Elf64_Word p_flags;
16.610 + Elf64_Off p_offset;
16.611 + Elf64_Addr p_vaddr;
16.612 + Elf64_Addr p_paddr;
16.613 + Elf64_Xword p_filesz;
16.614 + Elf64_Xword p_memsz;
16.615 + Elf64_Xword p_align;
16.616 +} Elf64_Phdr;
16.617 +
16.618 +
16.619 +
16.620 +#define PT_NULL 0
16.621 +#define PT_LOAD 1
16.622 +#define PT_DYNAMIC 2
16.623 +#define PT_INTERP 3
16.624 +#define PT_NOTE 4
16.625 +#define PT_SHLIB 5
16.626 +#define PT_PHDR 6
16.627 +#define PT_TLS 7
16.628 +#define PT_NUM 8
16.629 +#define PT_LOOS 0x60000000
16.630 +#define PT_GNU_EH_FRAME 0x6474e550
16.631 +#define PT_GNU_STACK 0x6474e551
16.632 +#define PT_GNU_RELRO 0x6474e552
16.633 +#define PT_LOSUNW 0x6ffffffa
16.634 +#define PT_SUNWBSS 0x6ffffffa
16.635 +#define PT_SUNWSTACK 0x6ffffffb
16.636 +#define PT_HISUNW 0x6fffffff
16.637 +#define PT_HIOS 0x6fffffff
16.638 +#define PT_LOPROC 0x70000000
16.639 +#define PT_HIPROC 0x7fffffff
16.640 +
16.641 +
16.642 +#define PN_XNUM 0xffff
16.643 +
16.644 +
16.645 +#define PF_X (1 << 0)
16.646 +#define PF_W (1 << 1)
16.647 +#define PF_R (1 << 2)
16.648 +#define PF_MASKOS 0x0ff00000
16.649 +#define PF_MASKPROC 0xf0000000
16.650 +
16.651 +
16.652 +
16.653 +#define NT_PRSTATUS 1
16.654 +#define NT_FPREGSET 2
16.655 +#define NT_PRPSINFO 3
16.656 +#define NT_PRXREG 4
16.657 +#define NT_TASKSTRUCT 4
16.658 +#define NT_PLATFORM 5
16.659 +#define NT_AUXV 6
16.660 +#define NT_GWINDOWS 7
16.661 +#define NT_ASRS 8
16.662 +#define NT_PSTATUS 10
16.663 +#define NT_PSINFO 13
16.664 +#define NT_PRCRED 14
16.665 +#define NT_UTSNAME 15
16.666 +#define NT_LWPSTATUS 16
16.667 +#define NT_LWPSINFO 17
16.668 +#define NT_PRFPXREG 20
16.669 +#define NT_SIGINFO 0x53494749
16.670 +#define NT_FILE 0x46494c45
16.671 +#define NT_PRXFPREG 0x46e62b7f
16.672 +#define NT_PPC_VMX 0x100
16.673 +#define NT_PPC_SPE 0x101
16.674 +#define NT_PPC_VSX 0x102
16.675 +#define NT_386_TLS 0x200
16.676 +#define NT_386_IOPERM 0x201
16.677 +#define NT_X86_XSTATE 0x202
16.678 +#define NT_S390_HIGH_GPRS 0x300
16.679 +#define NT_S390_TIMER 0x301
16.680 +#define NT_S390_TODCMP 0x302
16.681 +#define NT_S390_TODPREG 0x303
16.682 +#define NT_S390_CTRS 0x304
16.683 +#define NT_S390_PREFIX 0x305
16.684 +#define NT_S390_LAST_BREAK 0x306
16.685 +#define NT_S390_SYSTEM_CALL 0x307
16.686 +#define NT_S390_TDB 0x308
16.687 +#define NT_ARM_VFP 0x400
16.688 +#define NT_ARM_TLS 0x401
16.689 +#define NT_ARM_HW_BREAK 0x402
16.690 +#define NT_ARM_HW_WATCH 0x403
16.691 +#define NT_ARM_SYSTEM_CALL 0x404
16.692 +#define NT_ARM_SVE 0x405
16.693 +#define NT_METAG_CBUF 0x500
16.694 +#define NT_METAG_RPIPE 0x501
16.695 +#define NT_METAG_TLS 0x502
16.696 +#define NT_VERSION 1
16.697 +
16.698 +
16.699 +
16.700 +
16.701 +typedef struct {
16.702 + Elf32_Sword d_tag;
16.703 + union {
16.704 + Elf32_Word d_val;
16.705 + Elf32_Addr d_ptr;
16.706 + } d_un;
16.707 +} Elf32_Dyn;
16.708 +
16.709 +typedef struct {
16.710 + Elf64_Sxword d_tag;
16.711 + union {
16.712 + Elf64_Xword d_val;
16.713 + Elf64_Addr d_ptr;
16.714 + } d_un;
16.715 +} Elf64_Dyn;
16.716 +
16.717 +
16.718 +
16.719 +#define DT_NULL 0
16.720 +#define DT_NEEDED 1
16.721 +#define DT_PLTRELSZ 2
16.722 +#define DT_PLTGOT 3
16.723 +#define DT_HASH 4
16.724 +#define DT_STRTAB 5
16.725 +#define DT_SYMTAB 6
16.726 +#define DT_RELA 7
16.727 +#define DT_RELASZ 8
16.728 +#define DT_RELAENT 9
16.729 +#define DT_STRSZ 10
16.730 +#define DT_SYMENT 11
16.731 +#define DT_INIT 12
16.732 +#define DT_FINI 13
16.733 +#define DT_SONAME 14
16.734 +#define DT_RPATH 15
16.735 +#define DT_SYMBOLIC 16
16.736 +#define DT_REL 17
16.737 +#define DT_RELSZ 18
16.738 +#define DT_RELENT 19
16.739 +#define DT_PLTREL 20
16.740 +#define DT_DEBUG 21
16.741 +#define DT_TEXTREL 22
16.742 +#define DT_JMPREL 23
16.743 +#define DT_BIND_NOW 24
16.744 +#define DT_INIT_ARRAY 25
16.745 +#define DT_FINI_ARRAY 26
16.746 +#define DT_INIT_ARRAYSZ 27
16.747 +#define DT_FINI_ARRAYSZ 28
16.748 +#define DT_RUNPATH 29
16.749 +#define DT_FLAGS 30
16.750 +#define DT_ENCODING 32
16.751 +#define DT_PREINIT_ARRAY 32
16.752 +#define DT_PREINIT_ARRAYSZ 33
16.753 +#define DT_NUM 34
16.754 +#define DT_LOOS 0x6000000d
16.755 +#define DT_HIOS 0x6ffff000
16.756 +#define DT_LOPROC 0x70000000
16.757 +#define DT_HIPROC 0x7fffffff
16.758 +#define DT_PROCNUM DT_MIPS_NUM
16.759 +
16.760 +#define DT_VALRNGLO 0x6ffffd00
16.761 +#define DT_GNU_PRELINKED 0x6ffffdf5
16.762 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6
16.763 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7
16.764 +#define DT_CHECKSUM 0x6ffffdf8
16.765 +#define DT_PLTPADSZ 0x6ffffdf9
16.766 +#define DT_MOVEENT 0x6ffffdfa
16.767 +#define DT_MOVESZ 0x6ffffdfb
16.768 +#define DT_FEATURE_1 0x6ffffdfc
16.769 +#define DT_POSFLAG_1 0x6ffffdfd
16.770 +
16.771 +#define DT_SYMINSZ 0x6ffffdfe
16.772 +#define DT_SYMINENT 0x6ffffdff
16.773 +#define DT_VALRNGHI 0x6ffffdff
16.774 +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag))
16.775 +#define DT_VALNUM 12
16.776 +
16.777 +#define DT_ADDRRNGLO 0x6ffffe00
16.778 +#define DT_GNU_HASH 0x6ffffef5
16.779 +#define DT_TLSDESC_PLT 0x6ffffef6
16.780 +#define DT_TLSDESC_GOT 0x6ffffef7
16.781 +#define DT_GNU_CONFLICT 0x6ffffef8
16.782 +#define DT_GNU_LIBLIST 0x6ffffef9
16.783 +#define DT_CONFIG 0x6ffffefa
16.784 +#define DT_DEPAUDIT 0x6ffffefb
16.785 +#define DT_AUDIT 0x6ffffefc
16.786 +#define DT_PLTPAD 0x6ffffefd
16.787 +#define DT_MOVETAB 0x6ffffefe
16.788 +#define DT_SYMINFO 0x6ffffeff
16.789 +#define DT_ADDRRNGHI 0x6ffffeff
16.790 +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag))
16.791 +#define DT_ADDRNUM 11
16.792 +
16.793 +
16.794 +
16.795 +#define DT_VERSYM 0x6ffffff0
16.796 +
16.797 +#define DT_RELACOUNT 0x6ffffff9
16.798 +#define DT_RELCOUNT 0x6ffffffa
16.799 +
16.800 +
16.801 +#define DT_FLAGS_1 0x6ffffffb
16.802 +#define DT_VERDEF 0x6ffffffc
16.803 +
16.804 +#define DT_VERDEFNUM 0x6ffffffd
16.805 +#define DT_VERNEED 0x6ffffffe
16.806 +
16.807 +#define DT_VERNEEDNUM 0x6fffffff
16.808 +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag))
16.809 +#define DT_VERSIONTAGNUM 16
16.810 +
16.811 +
16.812 +
16.813 +#define DT_AUXILIARY 0x7ffffffd
16.814 +#define DT_FILTER 0x7fffffff
16.815 +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
16.816 +#define DT_EXTRANUM 3
16.817 +
16.818 +
16.819 +#define DF_ORIGIN 0x00000001
16.820 +#define DF_SYMBOLIC 0x00000002
16.821 +#define DF_TEXTREL 0x00000004
16.822 +#define DF_BIND_NOW 0x00000008
16.823 +#define DF_STATIC_TLS 0x00000010
16.824 +
16.825 +
16.826 +
16.827 +#define DF_1_NOW 0x00000001
16.828 +#define DF_1_GLOBAL 0x00000002
16.829 +#define DF_1_GROUP 0x00000004
16.830 +#define DF_1_NODELETE 0x00000008
16.831 +#define DF_1_LOADFLTR 0x00000010
16.832 +#define DF_1_INITFIRST 0x00000020
16.833 +#define DF_1_NOOPEN 0x00000040
16.834 +#define DF_1_ORIGIN 0x00000080
16.835 +#define DF_1_DIRECT 0x00000100
16.836 +#define DF_1_TRANS 0x00000200
16.837 +#define DF_1_INTERPOSE 0x00000400
16.838 +#define DF_1_NODEFLIB 0x00000800
16.839 +#define DF_1_NODUMP 0x00001000
16.840 +#define DF_1_CONFALT 0x00002000
16.841 +#define DF_1_ENDFILTEE 0x00004000
16.842 +#define DF_1_DISPRELDNE 0x00008000
16.843 +#define DF_1_DISPRELPND 0x00010000
16.844 +#define DF_1_NODIRECT 0x00020000
16.845 +#define DF_1_IGNMULDEF 0x00040000
16.846 +#define DF_1_NOKSYMS 0x00080000
16.847 +#define DF_1_NOHDR 0x00100000
16.848 +#define DF_1_EDITED 0x00200000
16.849 +#define DF_1_NORELOC 0x00400000
16.850 +#define DF_1_SYMINTPOSE 0x00800000
16.851 +#define DF_1_GLOBAUDIT 0x01000000
16.852 +#define DF_1_SINGLETON 0x02000000
16.853 +
16.854 +#define DTF_1_PARINIT 0x00000001
16.855 +#define DTF_1_CONFEXP 0x00000002
16.856 +
16.857 +
16.858 +#define DF_P1_LAZYLOAD 0x00000001
16.859 +#define DF_P1_GROUPPERM 0x00000002
16.860 +
16.861 +
16.862 +
16.863 +
16.864 +typedef struct {
16.865 + Elf32_Half vd_version;
16.866 + Elf32_Half vd_flags;
16.867 + Elf32_Half vd_ndx;
16.868 + Elf32_Half vd_cnt;
16.869 + Elf32_Word vd_hash;
16.870 + Elf32_Word vd_aux;
16.871 + Elf32_Word vd_next;
16.872 +} Elf32_Verdef;
16.873 +
16.874 +typedef struct {
16.875 + Elf64_Half vd_version;
16.876 + Elf64_Half vd_flags;
16.877 + Elf64_Half vd_ndx;
16.878 + Elf64_Half vd_cnt;
16.879 + Elf64_Word vd_hash;
16.880 + Elf64_Word vd_aux;
16.881 + Elf64_Word vd_next;
16.882 +} Elf64_Verdef;
16.883 +
16.884 +
16.885 +
16.886 +#define VER_DEF_NONE 0
16.887 +#define VER_DEF_CURRENT 1
16.888 +#define VER_DEF_NUM 2
16.889 +
16.890 +
16.891 +#define VER_FLG_BASE 0x1
16.892 +#define VER_FLG_WEAK 0x2
16.893 +
16.894 +
16.895 +#define VER_NDX_LOCAL 0
16.896 +#define VER_NDX_GLOBAL 1
16.897 +#define VER_NDX_LORESERVE 0xff00
16.898 +#define VER_NDX_ELIMINATE 0xff01
16.899 +
16.900 +
16.901 +
16.902 +typedef struct {
16.903 + Elf32_Word vda_name;
16.904 + Elf32_Word vda_next;
16.905 +} Elf32_Verdaux;
16.906 +
16.907 +typedef struct {
16.908 + Elf64_Word vda_name;
16.909 + Elf64_Word vda_next;
16.910 +} Elf64_Verdaux;
16.911 +
16.912 +
16.913 +
16.914 +
16.915 +typedef struct {
16.916 + Elf32_Half vn_version;
16.917 + Elf32_Half vn_cnt;
16.918 + Elf32_Word vn_file;
16.919 + Elf32_Word vn_aux;
16.920 + Elf32_Word vn_next;
16.921 +} Elf32_Verneed;
16.922 +
16.923 +typedef struct {
16.924 + Elf64_Half vn_version;
16.925 + Elf64_Half vn_cnt;
16.926 + Elf64_Word vn_file;
16.927 + Elf64_Word vn_aux;
16.928 + Elf64_Word vn_next;
16.929 +} Elf64_Verneed;
16.930 +
16.931 +
16.932 +
16.933 +#define VER_NEED_NONE 0
16.934 +#define VER_NEED_CURRENT 1
16.935 +#define VER_NEED_NUM 2
16.936 +
16.937 +
16.938 +
16.939 +typedef struct {
16.940 + Elf32_Word vna_hash;
16.941 + Elf32_Half vna_flags;
16.942 + Elf32_Half vna_other;
16.943 + Elf32_Word vna_name;
16.944 + Elf32_Word vna_next;
16.945 +} Elf32_Vernaux;
16.946 +
16.947 +typedef struct {
16.948 + Elf64_Word vna_hash;
16.949 + Elf64_Half vna_flags;
16.950 + Elf64_Half vna_other;
16.951 + Elf64_Word vna_name;
16.952 + Elf64_Word vna_next;
16.953 +} Elf64_Vernaux;
16.954 +
16.955 +
16.956 +
16.957 +#define VER_FLG_WEAK 0x2
16.958 +
16.959 +
16.960 +
16.961 +typedef struct {
16.962 + uint32_t a_type;
16.963 + union {
16.964 + uint32_t a_val;
16.965 + } a_un;
16.966 +} Elf32_auxv_t;
16.967 +
16.968 +typedef struct {
16.969 + uint64_t a_type;
16.970 + union {
16.971 + uint64_t a_val;
16.972 + } a_un;
16.973 +} Elf64_auxv_t;
16.974 +
16.975 +
16.976 +
16.977 +#define AT_NULL 0
16.978 +#define AT_IGNORE 1
16.979 +#define AT_EXECFD 2
16.980 +#define AT_PHDR 3
16.981 +#define AT_PHENT 4
16.982 +#define AT_PHNUM 5
16.983 +#define AT_PAGESZ 6
16.984 +#define AT_BASE 7
16.985 +#define AT_FLAGS 8
16.986 +#define AT_ENTRY 9
16.987 +#define AT_NOTELF 10
16.988 +#define AT_UID 11
16.989 +#define AT_EUID 12
16.990 +#define AT_GID 13
16.991 +#define AT_EGID 14
16.992 +#define AT_CLKTCK 17
16.993 +
16.994 +
16.995 +#define AT_PLATFORM 15
16.996 +#define AT_HWCAP 16
16.997 +
16.998 +
16.999 +
16.1000 +
16.1001 +#define AT_FPUCW 18
16.1002 +
16.1003 +
16.1004 +#define AT_DCACHEBSIZE 19
16.1005 +#define AT_ICACHEBSIZE 20
16.1006 +#define AT_UCACHEBSIZE 21
16.1007 +
16.1008 +
16.1009 +
16.1010 +#define AT_IGNOREPPC 22
16.1011 +
16.1012 +#define AT_SECURE 23
16.1013 +
16.1014 +#define AT_BASE_PLATFORM 24
16.1015 +
16.1016 +#define AT_RANDOM 25
16.1017 +
16.1018 +#define AT_HWCAP2 26
16.1019 +
16.1020 +#define AT_EXECFN 31
16.1021 +
16.1022 +
16.1023 +
16.1024 +#define AT_SYSINFO 32
16.1025 +#define AT_SYSINFO_EHDR 33
16.1026 +
16.1027 +
16.1028 +
16.1029 +#define AT_L1I_CACHESHAPE 34
16.1030 +#define AT_L1D_CACHESHAPE 35
16.1031 +#define AT_L2_CACHESHAPE 36
16.1032 +#define AT_L3_CACHESHAPE 37
16.1033 +
16.1034 +
16.1035 +
16.1036 +
16.1037 +typedef struct {
16.1038 + Elf32_Word n_namesz;
16.1039 + Elf32_Word n_descsz;
16.1040 + Elf32_Word n_type;
16.1041 +} Elf32_Nhdr;
16.1042 +
16.1043 +typedef struct {
16.1044 + Elf64_Word n_namesz;
16.1045 + Elf64_Word n_descsz;
16.1046 + Elf64_Word n_type;
16.1047 +} Elf64_Nhdr;
16.1048 +
16.1049 +
16.1050 +
16.1051 +
16.1052 +#define ELF_NOTE_SOLARIS "SUNW Solaris"
16.1053 +
16.1054 +
16.1055 +#define ELF_NOTE_GNU "GNU"
16.1056 +
16.1057 +
16.1058 +
16.1059 +
16.1060 +
16.1061 +#define ELF_NOTE_PAGESIZE_HINT 1
16.1062 +
16.1063 +
16.1064 +#define NT_GNU_ABI_TAG 1
16.1065 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG
16.1066 +
16.1067 +
16.1068 +
16.1069 +#define ELF_NOTE_OS_LINUX 0
16.1070 +#define ELF_NOTE_OS_GNU 1
16.1071 +#define ELF_NOTE_OS_SOLARIS2 2
16.1072 +#define ELF_NOTE_OS_FREEBSD 3
16.1073 +
16.1074 +#define NT_GNU_BUILD_ID 3
16.1075 +#define NT_GNU_GOLD_VERSION 4
16.1076 +
16.1077 +
16.1078 +
16.1079 +typedef struct {
16.1080 + Elf32_Xword m_value;
16.1081 + Elf32_Word m_info;
16.1082 + Elf32_Word m_poffset;
16.1083 + Elf32_Half m_repeat;
16.1084 + Elf32_Half m_stride;
16.1085 +} Elf32_Move;
16.1086 +
16.1087 +typedef struct {
16.1088 + Elf64_Xword m_value;
16.1089 + Elf64_Xword m_info;
16.1090 + Elf64_Xword m_poffset;
16.1091 + Elf64_Half m_repeat;
16.1092 + Elf64_Half m_stride;
16.1093 +} Elf64_Move;
16.1094 +
16.1095 +
16.1096 +#define ELF32_M_SYM(info) ((info) >> 8)
16.1097 +#define ELF32_M_SIZE(info) ((unsigned char) (info))
16.1098 +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
16.1099 +
16.1100 +#define ELF64_M_SYM(info) ELF32_M_SYM (info)
16.1101 +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
16.1102 +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
16.1103 +
16.1104 +#define EF_CPU32 0x00810000
16.1105 +
16.1106 +#define R_68K_NONE 0
16.1107 +#define R_68K_32 1
16.1108 +#define R_68K_16 2
16.1109 +#define R_68K_8 3
16.1110 +#define R_68K_PC32 4
16.1111 +#define R_68K_PC16 5
16.1112 +#define R_68K_PC8 6
16.1113 +#define R_68K_GOT32 7
16.1114 +#define R_68K_GOT16 8
16.1115 +#define R_68K_GOT8 9
16.1116 +#define R_68K_GOT32O 10
16.1117 +#define R_68K_GOT16O 11
16.1118 +#define R_68K_GOT8O 12
16.1119 +#define R_68K_PLT32 13
16.1120 +#define R_68K_PLT16 14
16.1121 +#define R_68K_PLT8 15
16.1122 +#define R_68K_PLT32O 16
16.1123 +#define R_68K_PLT16O 17
16.1124 +#define R_68K_PLT8O 18
16.1125 +#define R_68K_COPY 19
16.1126 +#define R_68K_GLOB_DAT 20
16.1127 +#define R_68K_JMP_SLOT 21
16.1128 +#define R_68K_RELATIVE 22
16.1129 +#define R_68K_NUM 23
16.1130 +
16.1131 +#define R_386_NONE 0
16.1132 +#define R_386_32 1
16.1133 +#define R_386_PC32 2
16.1134 +#define R_386_GOT32 3
16.1135 +#define R_386_PLT32 4
16.1136 +#define R_386_COPY 5
16.1137 +#define R_386_GLOB_DAT 6
16.1138 +#define R_386_JMP_SLOT 7
16.1139 +#define R_386_RELATIVE 8
16.1140 +#define R_386_GOTOFF 9
16.1141 +#define R_386_GOTPC 10
16.1142 +#define R_386_32PLT 11
16.1143 +#define R_386_TLS_TPOFF 14
16.1144 +#define R_386_TLS_IE 15
16.1145 +#define R_386_TLS_GOTIE 16
16.1146 +#define R_386_TLS_LE 17
16.1147 +#define R_386_TLS_GD 18
16.1148 +#define R_386_TLS_LDM 19
16.1149 +#define R_386_16 20
16.1150 +#define R_386_PC16 21
16.1151 +#define R_386_8 22
16.1152 +#define R_386_PC8 23
16.1153 +#define R_386_TLS_GD_32 24
16.1154 +#define R_386_TLS_GD_PUSH 25
16.1155 +#define R_386_TLS_GD_CALL 26
16.1156 +#define R_386_TLS_GD_POP 27
16.1157 +#define R_386_TLS_LDM_32 28
16.1158 +#define R_386_TLS_LDM_PUSH 29
16.1159 +#define R_386_TLS_LDM_CALL 30
16.1160 +#define R_386_TLS_LDM_POP 31
16.1161 +#define R_386_TLS_LDO_32 32
16.1162 +#define R_386_TLS_IE_32 33
16.1163 +#define R_386_TLS_LE_32 34
16.1164 +#define R_386_TLS_DTPMOD32 35
16.1165 +#define R_386_TLS_DTPOFF32 36
16.1166 +#define R_386_TLS_TPOFF32 37
16.1167 +#define R_386_SIZE32 38
16.1168 +#define R_386_TLS_GOTDESC 39
16.1169 +#define R_386_TLS_DESC_CALL 40
16.1170 +#define R_386_TLS_DESC 41
16.1171 +#define R_386_IRELATIVE 42
16.1172 +#define R_386_GOT32X 43
16.1173 +#define R_386_NUM 44
16.1174 +
16.1175 +
16.1176 +
16.1177 +
16.1178 +
16.1179 +#define STT_SPARC_REGISTER 13
16.1180 +
16.1181 +
16.1182 +
16.1183 +#define EF_SPARCV9_MM 3
16.1184 +#define EF_SPARCV9_TSO 0
16.1185 +#define EF_SPARCV9_PSO 1
16.1186 +#define EF_SPARCV9_RMO 2
16.1187 +#define EF_SPARC_LEDATA 0x800000
16.1188 +#define EF_SPARC_EXT_MASK 0xFFFF00
16.1189 +#define EF_SPARC_32PLUS 0x000100
16.1190 +#define EF_SPARC_SUN_US1 0x000200
16.1191 +#define EF_SPARC_HAL_R1 0x000400
16.1192 +#define EF_SPARC_SUN_US3 0x000800
16.1193 +
16.1194 +
16.1195 +
16.1196 +#define R_SPARC_NONE 0
16.1197 +#define R_SPARC_8 1
16.1198 +#define R_SPARC_16 2
16.1199 +#define R_SPARC_32 3
16.1200 +#define R_SPARC_DISP8 4
16.1201 +#define R_SPARC_DISP16 5
16.1202 +#define R_SPARC_DISP32 6
16.1203 +#define R_SPARC_WDISP30 7
16.1204 +#define R_SPARC_WDISP22 8
16.1205 +#define R_SPARC_HI22 9
16.1206 +#define R_SPARC_22 10
16.1207 +#define R_SPARC_13 11
16.1208 +#define R_SPARC_LO10 12
16.1209 +#define R_SPARC_GOT10 13
16.1210 +#define R_SPARC_GOT13 14
16.1211 +#define R_SPARC_GOT22 15
16.1212 +#define R_SPARC_PC10 16
16.1213 +#define R_SPARC_PC22 17
16.1214 +#define R_SPARC_WPLT30 18
16.1215 +#define R_SPARC_COPY 19
16.1216 +#define R_SPARC_GLOB_DAT 20
16.1217 +#define R_SPARC_JMP_SLOT 21
16.1218 +#define R_SPARC_RELATIVE 22
16.1219 +#define R_SPARC_UA32 23
16.1220 +
16.1221 +
16.1222 +
16.1223 +#define R_SPARC_PLT32 24
16.1224 +#define R_SPARC_HIPLT22 25
16.1225 +#define R_SPARC_LOPLT10 26
16.1226 +#define R_SPARC_PCPLT32 27
16.1227 +#define R_SPARC_PCPLT22 28
16.1228 +#define R_SPARC_PCPLT10 29
16.1229 +#define R_SPARC_10 30
16.1230 +#define R_SPARC_11 31
16.1231 +#define R_SPARC_64 32
16.1232 +#define R_SPARC_OLO10 33
16.1233 +#define R_SPARC_HH22 34
16.1234 +#define R_SPARC_HM10 35
16.1235 +#define R_SPARC_LM22 36
16.1236 +#define R_SPARC_PC_HH22 37
16.1237 +#define R_SPARC_PC_HM10 38
16.1238 +#define R_SPARC_PC_LM22 39
16.1239 +#define R_SPARC_WDISP16 40
16.1240 +#define R_SPARC_WDISP19 41
16.1241 +#define R_SPARC_GLOB_JMP 42
16.1242 +#define R_SPARC_7 43
16.1243 +#define R_SPARC_5 44
16.1244 +#define R_SPARC_6 45
16.1245 +#define R_SPARC_DISP64 46
16.1246 +#define R_SPARC_PLT64 47
16.1247 +#define R_SPARC_HIX22 48
16.1248 +#define R_SPARC_LOX10 49
16.1249 +#define R_SPARC_H44 50
16.1250 +#define R_SPARC_M44 51
16.1251 +#define R_SPARC_L44 52
16.1252 +#define R_SPARC_REGISTER 53
16.1253 +#define R_SPARC_UA64 54
16.1254 +#define R_SPARC_UA16 55
16.1255 +#define R_SPARC_TLS_GD_HI22 56
16.1256 +#define R_SPARC_TLS_GD_LO10 57
16.1257 +#define R_SPARC_TLS_GD_ADD 58
16.1258 +#define R_SPARC_TLS_GD_CALL 59
16.1259 +#define R_SPARC_TLS_LDM_HI22 60
16.1260 +#define R_SPARC_TLS_LDM_LO10 61
16.1261 +#define R_SPARC_TLS_LDM_ADD 62
16.1262 +#define R_SPARC_TLS_LDM_CALL 63
16.1263 +#define R_SPARC_TLS_LDO_HIX22 64
16.1264 +#define R_SPARC_TLS_LDO_LOX10 65
16.1265 +#define R_SPARC_TLS_LDO_ADD 66
16.1266 +#define R_SPARC_TLS_IE_HI22 67
16.1267 +#define R_SPARC_TLS_IE_LO10 68
16.1268 +#define R_SPARC_TLS_IE_LD 69
16.1269 +#define R_SPARC_TLS_IE_LDX 70
16.1270 +#define R_SPARC_TLS_IE_ADD 71
16.1271 +#define R_SPARC_TLS_LE_HIX22 72
16.1272 +#define R_SPARC_TLS_LE_LOX10 73
16.1273 +#define R_SPARC_TLS_DTPMOD32 74
16.1274 +#define R_SPARC_TLS_DTPMOD64 75
16.1275 +#define R_SPARC_TLS_DTPOFF32 76
16.1276 +#define R_SPARC_TLS_DTPOFF64 77
16.1277 +#define R_SPARC_TLS_TPOFF32 78
16.1278 +#define R_SPARC_TLS_TPOFF64 79
16.1279 +#define R_SPARC_GOTDATA_HIX22 80
16.1280 +#define R_SPARC_GOTDATA_LOX10 81
16.1281 +#define R_SPARC_GOTDATA_OP_HIX22 82
16.1282 +#define R_SPARC_GOTDATA_OP_LOX10 83
16.1283 +#define R_SPARC_GOTDATA_OP 84
16.1284 +#define R_SPARC_H34 85
16.1285 +#define R_SPARC_SIZE32 86
16.1286 +#define R_SPARC_SIZE64 87
16.1287 +#define R_SPARC_GNU_VTINHERIT 250
16.1288 +#define R_SPARC_GNU_VTENTRY 251
16.1289 +#define R_SPARC_REV32 252
16.1290 +
16.1291 +#define R_SPARC_NUM 253
16.1292 +
16.1293 +
16.1294 +
16.1295 +#define DT_SPARC_REGISTER 0x70000001
16.1296 +#define DT_SPARC_NUM 2
16.1297 +
16.1298 +
16.1299 +#define EF_MIPS_NOREORDER 1
16.1300 +#define EF_MIPS_PIC 2
16.1301 +#define EF_MIPS_CPIC 4
16.1302 +#define EF_MIPS_XGOT 8
16.1303 +#define EF_MIPS_64BIT_WHIRL 16
16.1304 +#define EF_MIPS_ABI2 32
16.1305 +#define EF_MIPS_ABI_ON32 64
16.1306 +#define EF_MIPS_FP64 512
16.1307 +#define EF_MIPS_NAN2008 1024
16.1308 +#define EF_MIPS_ARCH 0xf0000000
16.1309 +
16.1310 +
16.1311 +
16.1312 +#define EF_MIPS_ARCH_1 0x00000000
16.1313 +#define EF_MIPS_ARCH_2 0x10000000
16.1314 +#define EF_MIPS_ARCH_3 0x20000000
16.1315 +#define EF_MIPS_ARCH_4 0x30000000
16.1316 +#define EF_MIPS_ARCH_5 0x40000000
16.1317 +#define EF_MIPS_ARCH_32 0x50000000
16.1318 +#define EF_MIPS_ARCH_64 0x60000000
16.1319 +#define EF_MIPS_ARCH_32R2 0x70000000
16.1320 +#define EF_MIPS_ARCH_64R2 0x80000000
16.1321 +
16.1322 +
16.1323 +#define E_MIPS_ARCH_1 0x00000000
16.1324 +#define E_MIPS_ARCH_2 0x10000000
16.1325 +#define E_MIPS_ARCH_3 0x20000000
16.1326 +#define E_MIPS_ARCH_4 0x30000000
16.1327 +#define E_MIPS_ARCH_5 0x40000000
16.1328 +#define E_MIPS_ARCH_32 0x50000000
16.1329 +#define E_MIPS_ARCH_64 0x60000000
16.1330 +
16.1331 +
16.1332 +
16.1333 +#define SHN_MIPS_ACOMMON 0xff00
16.1334 +#define SHN_MIPS_TEXT 0xff01
16.1335 +#define SHN_MIPS_DATA 0xff02
16.1336 +#define SHN_MIPS_SCOMMON 0xff03
16.1337 +#define SHN_MIPS_SUNDEFINED 0xff04
16.1338 +
16.1339 +
16.1340 +
16.1341 +#define SHT_MIPS_LIBLIST 0x70000000
16.1342 +#define SHT_MIPS_MSYM 0x70000001
16.1343 +#define SHT_MIPS_CONFLICT 0x70000002
16.1344 +#define SHT_MIPS_GPTAB 0x70000003
16.1345 +#define SHT_MIPS_UCODE 0x70000004
16.1346 +#define SHT_MIPS_DEBUG 0x70000005
16.1347 +#define SHT_MIPS_REGINFO 0x70000006
16.1348 +#define SHT_MIPS_PACKAGE 0x70000007
16.1349 +#define SHT_MIPS_PACKSYM 0x70000008
16.1350 +#define SHT_MIPS_RELD 0x70000009
16.1351 +#define SHT_MIPS_IFACE 0x7000000b
16.1352 +#define SHT_MIPS_CONTENT 0x7000000c
16.1353 +#define SHT_MIPS_OPTIONS 0x7000000d
16.1354 +#define SHT_MIPS_SHDR 0x70000010
16.1355 +#define SHT_MIPS_FDESC 0x70000011
16.1356 +#define SHT_MIPS_EXTSYM 0x70000012
16.1357 +#define SHT_MIPS_DENSE 0x70000013
16.1358 +#define SHT_MIPS_PDESC 0x70000014
16.1359 +#define SHT_MIPS_LOCSYM 0x70000015
16.1360 +#define SHT_MIPS_AUXSYM 0x70000016
16.1361 +#define SHT_MIPS_OPTSYM 0x70000017
16.1362 +#define SHT_MIPS_LOCSTR 0x70000018
16.1363 +#define SHT_MIPS_LINE 0x70000019
16.1364 +#define SHT_MIPS_RFDESC 0x7000001a
16.1365 +#define SHT_MIPS_DELTASYM 0x7000001b
16.1366 +#define SHT_MIPS_DELTAINST 0x7000001c
16.1367 +#define SHT_MIPS_DELTACLASS 0x7000001d
16.1368 +#define SHT_MIPS_DWARF 0x7000001e
16.1369 +#define SHT_MIPS_DELTADECL 0x7000001f
16.1370 +#define SHT_MIPS_SYMBOL_LIB 0x70000020
16.1371 +#define SHT_MIPS_EVENTS 0x70000021
16.1372 +#define SHT_MIPS_TRANSLATE 0x70000022
16.1373 +#define SHT_MIPS_PIXIE 0x70000023
16.1374 +#define SHT_MIPS_XLATE 0x70000024
16.1375 +#define SHT_MIPS_XLATE_DEBUG 0x70000025
16.1376 +#define SHT_MIPS_WHIRL 0x70000026
16.1377 +#define SHT_MIPS_EH_REGION 0x70000027
16.1378 +#define SHT_MIPS_XLATE_OLD 0x70000028
16.1379 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029
16.1380 +
16.1381 +
16.1382 +
16.1383 +#define SHF_MIPS_GPREL 0x10000000
16.1384 +#define SHF_MIPS_MERGE 0x20000000
16.1385 +#define SHF_MIPS_ADDR 0x40000000
16.1386 +#define SHF_MIPS_STRINGS 0x80000000
16.1387 +#define SHF_MIPS_NOSTRIP 0x08000000
16.1388 +#define SHF_MIPS_LOCAL 0x04000000
16.1389 +#define SHF_MIPS_NAMES 0x02000000
16.1390 +#define SHF_MIPS_NODUPE 0x01000000
16.1391 +
16.1392 +
16.1393 +
16.1394 +
16.1395 +
16.1396 +#define STO_MIPS_DEFAULT 0x0
16.1397 +#define STO_MIPS_INTERNAL 0x1
16.1398 +#define STO_MIPS_HIDDEN 0x2
16.1399 +#define STO_MIPS_PROTECTED 0x3
16.1400 +#define STO_MIPS_PLT 0x8
16.1401 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff
16.1402 +
16.1403 +
16.1404 +#define STB_MIPS_SPLIT_COMMON 13
16.1405 +
16.1406 +
16.1407 +
16.1408 +typedef union {
16.1409 + struct {
16.1410 + Elf32_Word gt_current_g_value;
16.1411 + Elf32_Word gt_unused;
16.1412 + } gt_header;
16.1413 + struct {
16.1414 + Elf32_Word gt_g_value;
16.1415 + Elf32_Word gt_bytes;
16.1416 + } gt_entry;
16.1417 +} Elf32_gptab;
16.1418 +
16.1419 +
16.1420 +
16.1421 +typedef struct {
16.1422 + Elf32_Word ri_gprmask;
16.1423 + Elf32_Word ri_cprmask[4];
16.1424 + Elf32_Sword ri_gp_value;
16.1425 +} Elf32_RegInfo;
16.1426 +
16.1427 +
16.1428 +
16.1429 +typedef struct {
16.1430 + unsigned char kind;
16.1431 +
16.1432 + unsigned char size;
16.1433 + Elf32_Section section;
16.1434 +
16.1435 + Elf32_Word info;
16.1436 +} Elf_Options;
16.1437 +
16.1438 +
16.1439 +
16.1440 +#define ODK_NULL 0
16.1441 +#define ODK_REGINFO 1
16.1442 +#define ODK_EXCEPTIONS 2
16.1443 +#define ODK_PAD 3
16.1444 +#define ODK_HWPATCH 4
16.1445 +#define ODK_FILL 5
16.1446 +#define ODK_TAGS 6
16.1447 +#define ODK_HWAND 7
16.1448 +#define ODK_HWOR 8
16.1449 +
16.1450 +
16.1451 +
16.1452 +#define OEX_FPU_MIN 0x1f
16.1453 +#define OEX_FPU_MAX 0x1f00
16.1454 +#define OEX_PAGE0 0x10000
16.1455 +#define OEX_SMM 0x20000
16.1456 +#define OEX_FPDBUG 0x40000
16.1457 +#define OEX_PRECISEFP OEX_FPDBUG
16.1458 +#define OEX_DISMISS 0x80000
16.1459 +
16.1460 +#define OEX_FPU_INVAL 0x10
16.1461 +#define OEX_FPU_DIV0 0x08
16.1462 +#define OEX_FPU_OFLO 0x04
16.1463 +#define OEX_FPU_UFLO 0x02
16.1464 +#define OEX_FPU_INEX 0x01
16.1465 +
16.1466 +
16.1467 +
16.1468 +#define OHW_R4KEOP 0x1
16.1469 +#define OHW_R8KPFETCH 0x2
16.1470 +#define OHW_R5KEOP 0x4
16.1471 +#define OHW_R5KCVTL 0x8
16.1472 +
16.1473 +#define OPAD_PREFIX 0x1
16.1474 +#define OPAD_POSTFIX 0x2
16.1475 +#define OPAD_SYMBOL 0x4
16.1476 +
16.1477 +
16.1478 +
16.1479 +typedef struct {
16.1480 + Elf32_Word hwp_flags1;
16.1481 + Elf32_Word hwp_flags2;
16.1482 +} Elf_Options_Hw;
16.1483 +
16.1484 +
16.1485 +
16.1486 +#define OHWA0_R4KEOP_CHECKED 0x00000001
16.1487 +#define OHWA1_R4KEOP_CLEAN 0x00000002
16.1488 +
16.1489 +
16.1490 +
16.1491 +#define R_MIPS_NONE 0
16.1492 +#define R_MIPS_16 1
16.1493 +#define R_MIPS_32 2
16.1494 +#define R_MIPS_REL32 3
16.1495 +#define R_MIPS_26 4
16.1496 +#define R_MIPS_HI16 5
16.1497 +#define R_MIPS_LO16 6
16.1498 +#define R_MIPS_GPREL16 7
16.1499 +#define R_MIPS_LITERAL 8
16.1500 +#define R_MIPS_GOT16 9
16.1501 +#define R_MIPS_PC16 10
16.1502 +#define R_MIPS_CALL16 11
16.1503 +#define R_MIPS_GPREL32 12
16.1504 +
16.1505 +#define R_MIPS_SHIFT5 16
16.1506 +#define R_MIPS_SHIFT6 17
16.1507 +#define R_MIPS_64 18
16.1508 +#define R_MIPS_GOT_DISP 19
16.1509 +#define R_MIPS_GOT_PAGE 20
16.1510 +#define R_MIPS_GOT_OFST 21
16.1511 +#define R_MIPS_GOT_HI16 22
16.1512 +#define R_MIPS_GOT_LO16 23
16.1513 +#define R_MIPS_SUB 24
16.1514 +#define R_MIPS_INSERT_A 25
16.1515 +#define R_MIPS_INSERT_B 26
16.1516 +#define R_MIPS_DELETE 27
16.1517 +#define R_MIPS_HIGHER 28
16.1518 +#define R_MIPS_HIGHEST 29
16.1519 +#define R_MIPS_CALL_HI16 30
16.1520 +#define R_MIPS_CALL_LO16 31
16.1521 +#define R_MIPS_SCN_DISP 32
16.1522 +#define R_MIPS_REL16 33
16.1523 +#define R_MIPS_ADD_IMMEDIATE 34
16.1524 +#define R_MIPS_PJUMP 35
16.1525 +#define R_MIPS_RELGOT 36
16.1526 +#define R_MIPS_JALR 37
16.1527 +#define R_MIPS_TLS_DTPMOD32 38
16.1528 +#define R_MIPS_TLS_DTPREL32 39
16.1529 +#define R_MIPS_TLS_DTPMOD64 40
16.1530 +#define R_MIPS_TLS_DTPREL64 41
16.1531 +#define R_MIPS_TLS_GD 42
16.1532 +#define R_MIPS_TLS_LDM 43
16.1533 +#define R_MIPS_TLS_DTPREL_HI16 44
16.1534 +#define R_MIPS_TLS_DTPREL_LO16 45
16.1535 +#define R_MIPS_TLS_GOTTPREL 46
16.1536 +#define R_MIPS_TLS_TPREL32 47
16.1537 +#define R_MIPS_TLS_TPREL64 48
16.1538 +#define R_MIPS_TLS_TPREL_HI16 49
16.1539 +#define R_MIPS_TLS_TPREL_LO16 50
16.1540 +#define R_MIPS_GLOB_DAT 51
16.1541 +#define R_MIPS_COPY 126
16.1542 +#define R_MIPS_JUMP_SLOT 127
16.1543 +
16.1544 +#define R_MIPS_NUM 128
16.1545 +
16.1546 +
16.1547 +
16.1548 +#define PT_MIPS_REGINFO 0x70000000
16.1549 +#define PT_MIPS_RTPROC 0x70000001
16.1550 +#define PT_MIPS_OPTIONS 0x70000002
16.1551 +#define PT_MIPS_ABIFLAGS 0x70000003
16.1552 +
16.1553 +
16.1554 +
16.1555 +#define PF_MIPS_LOCAL 0x10000000
16.1556 +
16.1557 +
16.1558 +
16.1559 +#define DT_MIPS_RLD_VERSION 0x70000001
16.1560 +#define DT_MIPS_TIME_STAMP 0x70000002
16.1561 +#define DT_MIPS_ICHECKSUM 0x70000003
16.1562 +#define DT_MIPS_IVERSION 0x70000004
16.1563 +#define DT_MIPS_FLAGS 0x70000005
16.1564 +#define DT_MIPS_BASE_ADDRESS 0x70000006
16.1565 +#define DT_MIPS_MSYM 0x70000007
16.1566 +#define DT_MIPS_CONFLICT 0x70000008
16.1567 +#define DT_MIPS_LIBLIST 0x70000009
16.1568 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a
16.1569 +#define DT_MIPS_CONFLICTNO 0x7000000b
16.1570 +#define DT_MIPS_LIBLISTNO 0x70000010
16.1571 +#define DT_MIPS_SYMTABNO 0x70000011
16.1572 +#define DT_MIPS_UNREFEXTNO 0x70000012
16.1573 +#define DT_MIPS_GOTSYM 0x70000013
16.1574 +#define DT_MIPS_HIPAGENO 0x70000014
16.1575 +#define DT_MIPS_RLD_MAP 0x70000016
16.1576 +#define DT_MIPS_DELTA_CLASS 0x70000017
16.1577 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018
16.1578 +
16.1579 +#define DT_MIPS_DELTA_INSTANCE 0x70000019
16.1580 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
16.1581 +
16.1582 +#define DT_MIPS_DELTA_RELOC 0x7000001b
16.1583 +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
16.1584 +
16.1585 +#define DT_MIPS_DELTA_SYM 0x7000001d
16.1586 +
16.1587 +#define DT_MIPS_DELTA_SYM_NO 0x7000001e
16.1588 +
16.1589 +#define DT_MIPS_DELTA_CLASSSYM 0x70000020
16.1590 +
16.1591 +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
16.1592 +
16.1593 +#define DT_MIPS_CXX_FLAGS 0x70000022
16.1594 +#define DT_MIPS_PIXIE_INIT 0x70000023
16.1595 +#define DT_MIPS_SYMBOL_LIB 0x70000024
16.1596 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
16.1597 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026
16.1598 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
16.1599 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
16.1600 +#define DT_MIPS_OPTIONS 0x70000029
16.1601 +#define DT_MIPS_INTERFACE 0x7000002a
16.1602 +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
16.1603 +#define DT_MIPS_INTERFACE_SIZE 0x7000002c
16.1604 +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
16.1605 +
16.1606 +#define DT_MIPS_PERF_SUFFIX 0x7000002e
16.1607 +
16.1608 +#define DT_MIPS_COMPACT_SIZE 0x7000002f
16.1609 +#define DT_MIPS_GP_VALUE 0x70000030
16.1610 +#define DT_MIPS_AUX_DYNAMIC 0x70000031
16.1611 +
16.1612 +#define DT_MIPS_PLTGOT 0x70000032
16.1613 +
16.1614 +#define DT_MIPS_RWPLT 0x70000034
16.1615 +#define DT_MIPS_RLD_MAP_REL 0x70000035
16.1616 +#define DT_MIPS_NUM 0x36
16.1617 +
16.1618 +
16.1619 +
16.1620 +#define RHF_NONE 0
16.1621 +#define RHF_QUICKSTART (1 << 0)
16.1622 +#define RHF_NOTPOT (1 << 1)
16.1623 +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
16.1624 +#define RHF_NO_MOVE (1 << 3)
16.1625 +#define RHF_SGI_ONLY (1 << 4)
16.1626 +#define RHF_GUARANTEE_INIT (1 << 5)
16.1627 +#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
16.1628 +#define RHF_GUARANTEE_START_INIT (1 << 7)
16.1629 +#define RHF_PIXIE (1 << 8)
16.1630 +#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
16.1631 +#define RHF_REQUICKSTART (1 << 10)
16.1632 +#define RHF_REQUICKSTARTED (1 << 11)
16.1633 +#define RHF_CORD (1 << 12)
16.1634 +#define RHF_NO_UNRES_UNDEF (1 << 13)
16.1635 +#define RHF_RLD_ORDER_SAFE (1 << 14)
16.1636 +
16.1637 +
16.1638 +
16.1639 +typedef struct {
16.1640 + Elf32_Word l_name;
16.1641 + Elf32_Word l_time_stamp;
16.1642 + Elf32_Word l_checksum;
16.1643 + Elf32_Word l_version;
16.1644 + Elf32_Word l_flags;
16.1645 +} Elf32_Lib;
16.1646 +
16.1647 +typedef struct {
16.1648 + Elf64_Word l_name;
16.1649 + Elf64_Word l_time_stamp;
16.1650 + Elf64_Word l_checksum;
16.1651 + Elf64_Word l_version;
16.1652 + Elf64_Word l_flags;
16.1653 +} Elf64_Lib;
16.1654 +
16.1655 +
16.1656 +
16.1657 +
16.1658 +#define LL_NONE 0
16.1659 +#define LL_EXACT_MATCH (1 << 0)
16.1660 +#define LL_IGNORE_INT_VER (1 << 1)
16.1661 +#define LL_REQUIRE_MINOR (1 << 2)
16.1662 +#define LL_EXPORTS (1 << 3)
16.1663 +#define LL_DELAY_LOAD (1 << 4)
16.1664 +#define LL_DELTA (1 << 5)
16.1665 +
16.1666 +
16.1667 +
16.1668 +typedef Elf32_Addr Elf32_Conflict;
16.1669 +
16.1670 +typedef struct {
16.1671 + Elf32_Half version;
16.1672 + unsigned char isa_level;
16.1673 + unsigned char isa_rev;
16.1674 + unsigned char gpr_size;
16.1675 + unsigned char cpr1_size;
16.1676 + unsigned char cpr2_size;
16.1677 + unsigned char fp_abi;
16.1678 + Elf32_Word isa_ext;
16.1679 + Elf32_Word ases;
16.1680 + Elf32_Word flags1;
16.1681 + Elf32_Word flags2;
16.1682 +} Elf_MIPS_ABIFlags_v0;
16.1683 +
16.1684 +#define MIPS_AFL_REG_NONE 0x00
16.1685 +#define MIPS_AFL_REG_32 0x01
16.1686 +#define MIPS_AFL_REG_64 0x02
16.1687 +#define MIPS_AFL_REG_128 0x03
16.1688 +
16.1689 +#define MIPS_AFL_ASE_DSP 0x00000001
16.1690 +#define MIPS_AFL_ASE_DSPR2 0x00000002
16.1691 +#define MIPS_AFL_ASE_EVA 0x00000004
16.1692 +#define MIPS_AFL_ASE_MCU 0x00000008
16.1693 +#define MIPS_AFL_ASE_MDMX 0x00000010
16.1694 +#define MIPS_AFL_ASE_MIPS3D 0x00000020
16.1695 +#define MIPS_AFL_ASE_MT 0x00000040
16.1696 +#define MIPS_AFL_ASE_SMARTMIPS 0x00000080
16.1697 +#define MIPS_AFL_ASE_VIRT 0x00000100
16.1698 +#define MIPS_AFL_ASE_MSA 0x00000200
16.1699 +#define MIPS_AFL_ASE_MIPS16 0x00000400
16.1700 +#define MIPS_AFL_ASE_MICROMIPS 0x00000800
16.1701 +#define MIPS_AFL_ASE_XPA 0x00001000
16.1702 +#define MIPS_AFL_ASE_MASK 0x00001fff
16.1703 +
16.1704 +#define MIPS_AFL_EXT_XLR 1
16.1705 +#define MIPS_AFL_EXT_OCTEON2 2
16.1706 +#define MIPS_AFL_EXT_OCTEONP 3
16.1707 +#define MIPS_AFL_EXT_LOONGSON_3A 4
16.1708 +#define MIPS_AFL_EXT_OCTEON 5
16.1709 +#define MIPS_AFL_EXT_5900 6
16.1710 +#define MIPS_AFL_EXT_4650 7
16.1711 +#define MIPS_AFL_EXT_4010 8
16.1712 +#define MIPS_AFL_EXT_4100 9
16.1713 +#define MIPS_AFL_EXT_3900 10
16.1714 +#define MIPS_AFL_EXT_10000 11
16.1715 +#define MIPS_AFL_EXT_SB1 12
16.1716 +#define MIPS_AFL_EXT_4111 13
16.1717 +#define MIPS_AFL_EXT_4120 14
16.1718 +#define MIPS_AFL_EXT_5400 15
16.1719 +#define MIPS_AFL_EXT_5500 16
16.1720 +#define MIPS_AFL_EXT_LOONGSON_2E 17
16.1721 +#define MIPS_AFL_EXT_LOONGSON_2F 18
16.1722 +
16.1723 +#define MIPS_AFL_FLAGS1_ODDSPREG 1
16.1724 +
16.1725 +enum
16.1726 +{
16.1727 + Val_GNU_MIPS_ABI_FP_ANY = 0,
16.1728 + Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
16.1729 + Val_GNU_MIPS_ABI_FP_SINGLE = 2,
16.1730 + Val_GNU_MIPS_ABI_FP_SOFT = 3,
16.1731 + Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
16.1732 + Val_GNU_MIPS_ABI_FP_XX = 5,
16.1733 + Val_GNU_MIPS_ABI_FP_64 = 6,
16.1734 + Val_GNU_MIPS_ABI_FP_64A = 7,
16.1735 + Val_GNU_MIPS_ABI_FP_MAX = 7
16.1736 +};
16.1737 +
16.1738 +
16.1739 +
16.1740 +
16.1741 +#define EF_PARISC_TRAPNIL 0x00010000
16.1742 +#define EF_PARISC_EXT 0x00020000
16.1743 +#define EF_PARISC_LSB 0x00040000
16.1744 +#define EF_PARISC_WIDE 0x00080000
16.1745 +#define EF_PARISC_NO_KABP 0x00100000
16.1746 +
16.1747 +#define EF_PARISC_LAZYSWAP 0x00400000
16.1748 +#define EF_PARISC_ARCH 0x0000ffff
16.1749 +
16.1750 +
16.1751 +
16.1752 +#define EFA_PARISC_1_0 0x020b
16.1753 +#define EFA_PARISC_1_1 0x0210
16.1754 +#define EFA_PARISC_2_0 0x0214
16.1755 +
16.1756 +
16.1757 +
16.1758 +#define SHN_PARISC_ANSI_COMMON 0xff00
16.1759 +
16.1760 +#define SHN_PARISC_HUGE_COMMON 0xff01
16.1761 +
16.1762 +
16.1763 +
16.1764 +#define SHT_PARISC_EXT 0x70000000
16.1765 +#define SHT_PARISC_UNWIND 0x70000001
16.1766 +#define SHT_PARISC_DOC 0x70000002
16.1767 +
16.1768 +
16.1769 +
16.1770 +#define SHF_PARISC_SHORT 0x20000000
16.1771 +#define SHF_PARISC_HUGE 0x40000000
16.1772 +#define SHF_PARISC_SBP 0x80000000
16.1773 +
16.1774 +
16.1775 +
16.1776 +#define STT_PARISC_MILLICODE 13
16.1777 +
16.1778 +#define STT_HP_OPAQUE (STT_LOOS + 0x1)
16.1779 +#define STT_HP_STUB (STT_LOOS + 0x2)
16.1780 +
16.1781 +
16.1782 +
16.1783 +#define R_PARISC_NONE 0
16.1784 +#define R_PARISC_DIR32 1
16.1785 +#define R_PARISC_DIR21L 2
16.1786 +#define R_PARISC_DIR17R 3
16.1787 +#define R_PARISC_DIR17F 4
16.1788 +#define R_PARISC_DIR14R 6
16.1789 +#define R_PARISC_PCREL32 9
16.1790 +#define R_PARISC_PCREL21L 10
16.1791 +#define R_PARISC_PCREL17R 11
16.1792 +#define R_PARISC_PCREL17F 12
16.1793 +#define R_PARISC_PCREL14R 14
16.1794 +#define R_PARISC_DPREL21L 18
16.1795 +#define R_PARISC_DPREL14R 22
16.1796 +#define R_PARISC_GPREL21L 26
16.1797 +#define R_PARISC_GPREL14R 30
16.1798 +#define R_PARISC_LTOFF21L 34
16.1799 +#define R_PARISC_LTOFF14R 38
16.1800 +#define R_PARISC_SECREL32 41
16.1801 +#define R_PARISC_SEGBASE 48
16.1802 +#define R_PARISC_SEGREL32 49
16.1803 +#define R_PARISC_PLTOFF21L 50
16.1804 +#define R_PARISC_PLTOFF14R 54
16.1805 +#define R_PARISC_LTOFF_FPTR32 57
16.1806 +#define R_PARISC_LTOFF_FPTR21L 58
16.1807 +#define R_PARISC_LTOFF_FPTR14R 62
16.1808 +#define R_PARISC_FPTR64 64
16.1809 +#define R_PARISC_PLABEL32 65
16.1810 +#define R_PARISC_PLABEL21L 66
16.1811 +#define R_PARISC_PLABEL14R 70
16.1812 +#define R_PARISC_PCREL64 72
16.1813 +#define R_PARISC_PCREL22F 74
16.1814 +#define R_PARISC_PCREL14WR 75
16.1815 +#define R_PARISC_PCREL14DR 76
16.1816 +#define R_PARISC_PCREL16F 77
16.1817 +#define R_PARISC_PCREL16WF 78
16.1818 +#define R_PARISC_PCREL16DF 79
16.1819 +#define R_PARISC_DIR64 80
16.1820 +#define R_PARISC_DIR14WR 83
16.1821 +#define R_PARISC_DIR14DR 84
16.1822 +#define R_PARISC_DIR16F 85
16.1823 +#define R_PARISC_DIR16WF 86
16.1824 +#define R_PARISC_DIR16DF 87
16.1825 +#define R_PARISC_GPREL64 88
16.1826 +#define R_PARISC_GPREL14WR 91
16.1827 +#define R_PARISC_GPREL14DR 92
16.1828 +#define R_PARISC_GPREL16F 93
16.1829 +#define R_PARISC_GPREL16WF 94
16.1830 +#define R_PARISC_GPREL16DF 95
16.1831 +#define R_PARISC_LTOFF64 96
16.1832 +#define R_PARISC_LTOFF14WR 99
16.1833 +#define R_PARISC_LTOFF14DR 100
16.1834 +#define R_PARISC_LTOFF16F 101
16.1835 +#define R_PARISC_LTOFF16WF 102
16.1836 +#define R_PARISC_LTOFF16DF 103
16.1837 +#define R_PARISC_SECREL64 104
16.1838 +#define R_PARISC_SEGREL64 112
16.1839 +#define R_PARISC_PLTOFF14WR 115
16.1840 +#define R_PARISC_PLTOFF14DR 116
16.1841 +#define R_PARISC_PLTOFF16F 117
16.1842 +#define R_PARISC_PLTOFF16WF 118
16.1843 +#define R_PARISC_PLTOFF16DF 119
16.1844 +#define R_PARISC_LTOFF_FPTR64 120
16.1845 +#define R_PARISC_LTOFF_FPTR14WR 123
16.1846 +#define R_PARISC_LTOFF_FPTR14DR 124
16.1847 +#define R_PARISC_LTOFF_FPTR16F 125
16.1848 +#define R_PARISC_LTOFF_FPTR16WF 126
16.1849 +#define R_PARISC_LTOFF_FPTR16DF 127
16.1850 +#define R_PARISC_LORESERVE 128
16.1851 +#define R_PARISC_COPY 128
16.1852 +#define R_PARISC_IPLT 129
16.1853 +#define R_PARISC_EPLT 130
16.1854 +#define R_PARISC_TPREL32 153
16.1855 +#define R_PARISC_TPREL21L 154
16.1856 +#define R_PARISC_TPREL14R 158
16.1857 +#define R_PARISC_LTOFF_TP21L 162
16.1858 +#define R_PARISC_LTOFF_TP14R 166
16.1859 +#define R_PARISC_LTOFF_TP14F 167
16.1860 +#define R_PARISC_TPREL64 216
16.1861 +#define R_PARISC_TPREL14WR 219
16.1862 +#define R_PARISC_TPREL14DR 220
16.1863 +#define R_PARISC_TPREL16F 221
16.1864 +#define R_PARISC_TPREL16WF 222
16.1865 +#define R_PARISC_TPREL16DF 223
16.1866 +#define R_PARISC_LTOFF_TP64 224
16.1867 +#define R_PARISC_LTOFF_TP14WR 227
16.1868 +#define R_PARISC_LTOFF_TP14DR 228
16.1869 +#define R_PARISC_LTOFF_TP16F 229
16.1870 +#define R_PARISC_LTOFF_TP16WF 230
16.1871 +#define R_PARISC_LTOFF_TP16DF 231
16.1872 +#define R_PARISC_GNU_VTENTRY 232
16.1873 +#define R_PARISC_GNU_VTINHERIT 233
16.1874 +#define R_PARISC_TLS_GD21L 234
16.1875 +#define R_PARISC_TLS_GD14R 235
16.1876 +#define R_PARISC_TLS_GDCALL 236
16.1877 +#define R_PARISC_TLS_LDM21L 237
16.1878 +#define R_PARISC_TLS_LDM14R 238
16.1879 +#define R_PARISC_TLS_LDMCALL 239
16.1880 +#define R_PARISC_TLS_LDO21L 240
16.1881 +#define R_PARISC_TLS_LDO14R 241
16.1882 +#define R_PARISC_TLS_DTPMOD32 242
16.1883 +#define R_PARISC_TLS_DTPMOD64 243
16.1884 +#define R_PARISC_TLS_DTPOFF32 244
16.1885 +#define R_PARISC_TLS_DTPOFF64 245
16.1886 +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L
16.1887 +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R
16.1888 +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L
16.1889 +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R
16.1890 +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32
16.1891 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64
16.1892 +#define R_PARISC_HIRESERVE 255
16.1893 +
16.1894 +
16.1895 +
16.1896 +#define PT_HP_TLS (PT_LOOS + 0x0)
16.1897 +#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
16.1898 +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
16.1899 +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
16.1900 +#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
16.1901 +#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
16.1902 +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
16.1903 +#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
16.1904 +#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
16.1905 +#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
16.1906 +#define PT_HP_PARALLEL (PT_LOOS + 0x10)
16.1907 +#define PT_HP_FASTBIND (PT_LOOS + 0x11)
16.1908 +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
16.1909 +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
16.1910 +#define PT_HP_STACK (PT_LOOS + 0x14)
16.1911 +
16.1912 +#define PT_PARISC_ARCHEXT 0x70000000
16.1913 +#define PT_PARISC_UNWIND 0x70000001
16.1914 +
16.1915 +
16.1916 +
16.1917 +#define PF_PARISC_SBP 0x08000000
16.1918 +
16.1919 +#define PF_HP_PAGE_SIZE 0x00100000
16.1920 +#define PF_HP_FAR_SHARED 0x00200000
16.1921 +#define PF_HP_NEAR_SHARED 0x00400000
16.1922 +#define PF_HP_CODE 0x01000000
16.1923 +#define PF_HP_MODIFY 0x02000000
16.1924 +#define PF_HP_LAZYSWAP 0x04000000
16.1925 +#define PF_HP_SBP 0x08000000
16.1926 +
16.1927 +
16.1928 +
16.1929 +
16.1930 +
16.1931 +
16.1932 +#define EF_ALPHA_32BIT 1
16.1933 +#define EF_ALPHA_CANRELAX 2
16.1934 +
16.1935 +
16.1936 +
16.1937 +
16.1938 +#define SHT_ALPHA_DEBUG 0x70000001
16.1939 +#define SHT_ALPHA_REGINFO 0x70000002
16.1940 +
16.1941 +
16.1942 +
16.1943 +#define SHF_ALPHA_GPREL 0x10000000
16.1944 +
16.1945 +
16.1946 +#define STO_ALPHA_NOPV 0x80
16.1947 +#define STO_ALPHA_STD_GPLOAD 0x88
16.1948 +
16.1949 +
16.1950 +
16.1951 +#define R_ALPHA_NONE 0
16.1952 +#define R_ALPHA_REFLONG 1
16.1953 +#define R_ALPHA_REFQUAD 2
16.1954 +#define R_ALPHA_GPREL32 3
16.1955 +#define R_ALPHA_LITERAL 4
16.1956 +#define R_ALPHA_LITUSE 5
16.1957 +#define R_ALPHA_GPDISP 6
16.1958 +#define R_ALPHA_BRADDR 7
16.1959 +#define R_ALPHA_HINT 8
16.1960 +#define R_ALPHA_SREL16 9
16.1961 +#define R_ALPHA_SREL32 10
16.1962 +#define R_ALPHA_SREL64 11
16.1963 +#define R_ALPHA_GPRELHIGH 17
16.1964 +#define R_ALPHA_GPRELLOW 18
16.1965 +#define R_ALPHA_GPREL16 19
16.1966 +#define R_ALPHA_COPY 24
16.1967 +#define R_ALPHA_GLOB_DAT 25
16.1968 +#define R_ALPHA_JMP_SLOT 26
16.1969 +#define R_ALPHA_RELATIVE 27
16.1970 +#define R_ALPHA_TLS_GD_HI 28
16.1971 +#define R_ALPHA_TLSGD 29
16.1972 +#define R_ALPHA_TLS_LDM 30
16.1973 +#define R_ALPHA_DTPMOD64 31
16.1974 +#define R_ALPHA_GOTDTPREL 32
16.1975 +#define R_ALPHA_DTPREL64 33
16.1976 +#define R_ALPHA_DTPRELHI 34
16.1977 +#define R_ALPHA_DTPRELLO 35
16.1978 +#define R_ALPHA_DTPREL16 36
16.1979 +#define R_ALPHA_GOTTPREL 37
16.1980 +#define R_ALPHA_TPREL64 38
16.1981 +#define R_ALPHA_TPRELHI 39
16.1982 +#define R_ALPHA_TPRELLO 40
16.1983 +#define R_ALPHA_TPREL16 41
16.1984 +
16.1985 +#define R_ALPHA_NUM 46
16.1986 +
16.1987 +
16.1988 +#define LITUSE_ALPHA_ADDR 0
16.1989 +#define LITUSE_ALPHA_BASE 1
16.1990 +#define LITUSE_ALPHA_BYTOFF 2
16.1991 +#define LITUSE_ALPHA_JSR 3
16.1992 +#define LITUSE_ALPHA_TLS_GD 4
16.1993 +#define LITUSE_ALPHA_TLS_LDM 5
16.1994 +
16.1995 +
16.1996 +#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
16.1997 +#define DT_ALPHA_NUM 1
16.1998 +
16.1999 +
16.2000 +
16.2001 +
16.2002 +#define EF_PPC_EMB 0x80000000
16.2003 +
16.2004 +
16.2005 +#define EF_PPC_RELOCATABLE 0x00010000
16.2006 +#define EF_PPC_RELOCATABLE_LIB 0x00008000
16.2007 +
16.2008 +
16.2009 +
16.2010 +#define R_PPC_NONE 0
16.2011 +#define R_PPC_ADDR32 1
16.2012 +#define R_PPC_ADDR24 2
16.2013 +#define R_PPC_ADDR16 3
16.2014 +#define R_PPC_ADDR16_LO 4
16.2015 +#define R_PPC_ADDR16_HI 5
16.2016 +#define R_PPC_ADDR16_HA 6
16.2017 +#define R_PPC_ADDR14 7
16.2018 +#define R_PPC_ADDR14_BRTAKEN 8
16.2019 +#define R_PPC_ADDR14_BRNTAKEN 9
16.2020 +#define R_PPC_REL24 10
16.2021 +#define R_PPC_REL14 11
16.2022 +#define R_PPC_REL14_BRTAKEN 12
16.2023 +#define R_PPC_REL14_BRNTAKEN 13
16.2024 +#define R_PPC_GOT16 14
16.2025 +#define R_PPC_GOT16_LO 15
16.2026 +#define R_PPC_GOT16_HI 16
16.2027 +#define R_PPC_GOT16_HA 17
16.2028 +#define R_PPC_PLTREL24 18
16.2029 +#define R_PPC_COPY 19
16.2030 +#define R_PPC_GLOB_DAT 20
16.2031 +#define R_PPC_JMP_SLOT 21
16.2032 +#define R_PPC_RELATIVE 22
16.2033 +#define R_PPC_LOCAL24PC 23
16.2034 +#define R_PPC_UADDR32 24
16.2035 +#define R_PPC_UADDR16 25
16.2036 +#define R_PPC_REL32 26
16.2037 +#define R_PPC_PLT32 27
16.2038 +#define R_PPC_PLTREL32 28
16.2039 +#define R_PPC_PLT16_LO 29
16.2040 +#define R_PPC_PLT16_HI 30
16.2041 +#define R_PPC_PLT16_HA 31
16.2042 +#define R_PPC_SDAREL16 32
16.2043 +#define R_PPC_SECTOFF 33
16.2044 +#define R_PPC_SECTOFF_LO 34
16.2045 +#define R_PPC_SECTOFF_HI 35
16.2046 +#define R_PPC_SECTOFF_HA 36
16.2047 +
16.2048 +
16.2049 +#define R_PPC_TLS 67
16.2050 +#define R_PPC_DTPMOD32 68
16.2051 +#define R_PPC_TPREL16 69
16.2052 +#define R_PPC_TPREL16_LO 70
16.2053 +#define R_PPC_TPREL16_HI 71
16.2054 +#define R_PPC_TPREL16_HA 72
16.2055 +#define R_PPC_TPREL32 73
16.2056 +#define R_PPC_DTPREL16 74
16.2057 +#define R_PPC_DTPREL16_LO 75
16.2058 +#define R_PPC_DTPREL16_HI 76
16.2059 +#define R_PPC_DTPREL16_HA 77
16.2060 +#define R_PPC_DTPREL32 78
16.2061 +#define R_PPC_GOT_TLSGD16 79
16.2062 +#define R_PPC_GOT_TLSGD16_LO 80
16.2063 +#define R_PPC_GOT_TLSGD16_HI 81
16.2064 +#define R_PPC_GOT_TLSGD16_HA 82
16.2065 +#define R_PPC_GOT_TLSLD16 83
16.2066 +#define R_PPC_GOT_TLSLD16_LO 84
16.2067 +#define R_PPC_GOT_TLSLD16_HI 85
16.2068 +#define R_PPC_GOT_TLSLD16_HA 86
16.2069 +#define R_PPC_GOT_TPREL16 87
16.2070 +#define R_PPC_GOT_TPREL16_LO 88
16.2071 +#define R_PPC_GOT_TPREL16_HI 89
16.2072 +#define R_PPC_GOT_TPREL16_HA 90
16.2073 +#define R_PPC_GOT_DTPREL16 91
16.2074 +#define R_PPC_GOT_DTPREL16_LO 92
16.2075 +#define R_PPC_GOT_DTPREL16_HI 93
16.2076 +#define R_PPC_GOT_DTPREL16_HA 94
16.2077 +#define R_PPC_TLSGD 95
16.2078 +#define R_PPC_TLSLD 96
16.2079 +
16.2080 +
16.2081 +#define R_PPC_EMB_NADDR32 101
16.2082 +#define R_PPC_EMB_NADDR16 102
16.2083 +#define R_PPC_EMB_NADDR16_LO 103
16.2084 +#define R_PPC_EMB_NADDR16_HI 104
16.2085 +#define R_PPC_EMB_NADDR16_HA 105
16.2086 +#define R_PPC_EMB_SDAI16 106
16.2087 +#define R_PPC_EMB_SDA2I16 107
16.2088 +#define R_PPC_EMB_SDA2REL 108
16.2089 +#define R_PPC_EMB_SDA21 109
16.2090 +#define R_PPC_EMB_MRKREF 110
16.2091 +#define R_PPC_EMB_RELSEC16 111
16.2092 +#define R_PPC_EMB_RELST_LO 112
16.2093 +#define R_PPC_EMB_RELST_HI 113
16.2094 +#define R_PPC_EMB_RELST_HA 114
16.2095 +#define R_PPC_EMB_BIT_FLD 115
16.2096 +#define R_PPC_EMB_RELSDA 116
16.2097 +
16.2098 +
16.2099 +#define R_PPC_DIAB_SDA21_LO 180
16.2100 +#define R_PPC_DIAB_SDA21_HI 181
16.2101 +#define R_PPC_DIAB_SDA21_HA 182
16.2102 +#define R_PPC_DIAB_RELSDA_LO 183
16.2103 +#define R_PPC_DIAB_RELSDA_HI 184
16.2104 +#define R_PPC_DIAB_RELSDA_HA 185
16.2105 +
16.2106 +
16.2107 +#define R_PPC_IRELATIVE 248
16.2108 +
16.2109 +
16.2110 +#define R_PPC_REL16 249
16.2111 +#define R_PPC_REL16_LO 250
16.2112 +#define R_PPC_REL16_HI 251
16.2113 +#define R_PPC_REL16_HA 252
16.2114 +
16.2115 +
16.2116 +
16.2117 +#define R_PPC_TOC16 255
16.2118 +
16.2119 +
16.2120 +#define DT_PPC_GOT (DT_LOPROC + 0)
16.2121 +#define DT_PPC_OPT (DT_LOPROC + 1)
16.2122 +#define DT_PPC_NUM 2
16.2123 +
16.2124 +#define PPC_OPT_TLS 1
16.2125 +
16.2126 +
16.2127 +#define R_PPC64_NONE R_PPC_NONE
16.2128 +#define R_PPC64_ADDR32 R_PPC_ADDR32
16.2129 +#define R_PPC64_ADDR24 R_PPC_ADDR24
16.2130 +#define R_PPC64_ADDR16 R_PPC_ADDR16
16.2131 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO
16.2132 +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI
16.2133 +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA
16.2134 +#define R_PPC64_ADDR14 R_PPC_ADDR14
16.2135 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
16.2136 +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
16.2137 +#define R_PPC64_REL24 R_PPC_REL24
16.2138 +#define R_PPC64_REL14 R_PPC_REL14
16.2139 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
16.2140 +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
16.2141 +#define R_PPC64_GOT16 R_PPC_GOT16
16.2142 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
16.2143 +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
16.2144 +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
16.2145 +
16.2146 +#define R_PPC64_COPY R_PPC_COPY
16.2147 +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
16.2148 +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
16.2149 +#define R_PPC64_RELATIVE R_PPC_RELATIVE
16.2150 +
16.2151 +#define R_PPC64_UADDR32 R_PPC_UADDR32
16.2152 +#define R_PPC64_UADDR16 R_PPC_UADDR16
16.2153 +#define R_PPC64_REL32 R_PPC_REL32
16.2154 +#define R_PPC64_PLT32 R_PPC_PLT32
16.2155 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32
16.2156 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
16.2157 +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
16.2158 +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
16.2159 +
16.2160 +#define R_PPC64_SECTOFF R_PPC_SECTOFF
16.2161 +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
16.2162 +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
16.2163 +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
16.2164 +#define R_PPC64_ADDR30 37
16.2165 +#define R_PPC64_ADDR64 38
16.2166 +#define R_PPC64_ADDR16_HIGHER 39
16.2167 +#define R_PPC64_ADDR16_HIGHERA 40
16.2168 +#define R_PPC64_ADDR16_HIGHEST 41
16.2169 +#define R_PPC64_ADDR16_HIGHESTA 42
16.2170 +#define R_PPC64_UADDR64 43
16.2171 +#define R_PPC64_REL64 44
16.2172 +#define R_PPC64_PLT64 45
16.2173 +#define R_PPC64_PLTREL64 46
16.2174 +#define R_PPC64_TOC16 47
16.2175 +#define R_PPC64_TOC16_LO 48
16.2176 +#define R_PPC64_TOC16_HI 49
16.2177 +#define R_PPC64_TOC16_HA 50
16.2178 +#define R_PPC64_TOC 51
16.2179 +#define R_PPC64_PLTGOT16 52
16.2180 +#define R_PPC64_PLTGOT16_LO 53
16.2181 +#define R_PPC64_PLTGOT16_HI 54
16.2182 +#define R_PPC64_PLTGOT16_HA 55
16.2183 +
16.2184 +#define R_PPC64_ADDR16_DS 56
16.2185 +#define R_PPC64_ADDR16_LO_DS 57
16.2186 +#define R_PPC64_GOT16_DS 58
16.2187 +#define R_PPC64_GOT16_LO_DS 59
16.2188 +#define R_PPC64_PLT16_LO_DS 60
16.2189 +#define R_PPC64_SECTOFF_DS 61
16.2190 +#define R_PPC64_SECTOFF_LO_DS 62
16.2191 +#define R_PPC64_TOC16_DS 63
16.2192 +#define R_PPC64_TOC16_LO_DS 64
16.2193 +#define R_PPC64_PLTGOT16_DS 65
16.2194 +#define R_PPC64_PLTGOT16_LO_DS 66
16.2195 +
16.2196 +
16.2197 +#define R_PPC64_TLS 67
16.2198 +#define R_PPC64_DTPMOD64 68
16.2199 +#define R_PPC64_TPREL16 69
16.2200 +#define R_PPC64_TPREL16_LO 70
16.2201 +#define R_PPC64_TPREL16_HI 71
16.2202 +#define R_PPC64_TPREL16_HA 72
16.2203 +#define R_PPC64_TPREL64 73
16.2204 +#define R_PPC64_DTPREL16 74
16.2205 +#define R_PPC64_DTPREL16_LO 75
16.2206 +#define R_PPC64_DTPREL16_HI 76
16.2207 +#define R_PPC64_DTPREL16_HA 77
16.2208 +#define R_PPC64_DTPREL64 78
16.2209 +#define R_PPC64_GOT_TLSGD16 79
16.2210 +#define R_PPC64_GOT_TLSGD16_LO 80
16.2211 +#define R_PPC64_GOT_TLSGD16_HI 81
16.2212 +#define R_PPC64_GOT_TLSGD16_HA 82
16.2213 +#define R_PPC64_GOT_TLSLD16 83
16.2214 +#define R_PPC64_GOT_TLSLD16_LO 84
16.2215 +#define R_PPC64_GOT_TLSLD16_HI 85
16.2216 +#define R_PPC64_GOT_TLSLD16_HA 86
16.2217 +#define R_PPC64_GOT_TPREL16_DS 87
16.2218 +#define R_PPC64_GOT_TPREL16_LO_DS 88
16.2219 +#define R_PPC64_GOT_TPREL16_HI 89
16.2220 +#define R_PPC64_GOT_TPREL16_HA 90
16.2221 +#define R_PPC64_GOT_DTPREL16_DS 91
16.2222 +#define R_PPC64_GOT_DTPREL16_LO_DS 92
16.2223 +#define R_PPC64_GOT_DTPREL16_HI 93
16.2224 +#define R_PPC64_GOT_DTPREL16_HA 94
16.2225 +#define R_PPC64_TPREL16_DS 95
16.2226 +#define R_PPC64_TPREL16_LO_DS 96
16.2227 +#define R_PPC64_TPREL16_HIGHER 97
16.2228 +#define R_PPC64_TPREL16_HIGHERA 98
16.2229 +#define R_PPC64_TPREL16_HIGHEST 99
16.2230 +#define R_PPC64_TPREL16_HIGHESTA 100
16.2231 +#define R_PPC64_DTPREL16_DS 101
16.2232 +#define R_PPC64_DTPREL16_LO_DS 102
16.2233 +#define R_PPC64_DTPREL16_HIGHER 103
16.2234 +#define R_PPC64_DTPREL16_HIGHERA 104
16.2235 +#define R_PPC64_DTPREL16_HIGHEST 105
16.2236 +#define R_PPC64_DTPREL16_HIGHESTA 106
16.2237 +#define R_PPC64_TLSGD 107
16.2238 +#define R_PPC64_TLSLD 108
16.2239 +#define R_PPC64_TOCSAVE 109
16.2240 +#define R_PPC64_ADDR16_HIGH 110
16.2241 +#define R_PPC64_ADDR16_HIGHA 111
16.2242 +#define R_PPC64_TPREL16_HIGH 112
16.2243 +#define R_PPC64_TPREL16_HIGHA 113
16.2244 +#define R_PPC64_DTPREL16_HIGH 114
16.2245 +#define R_PPC64_DTPREL16_HIGHA 115
16.2246 +
16.2247 +
16.2248 +#define R_PPC64_JMP_IREL 247
16.2249 +#define R_PPC64_IRELATIVE 248
16.2250 +#define R_PPC64_REL16 249
16.2251 +#define R_PPC64_REL16_LO 250
16.2252 +#define R_PPC64_REL16_HI 251
16.2253 +#define R_PPC64_REL16_HA 252
16.2254 +
16.2255 +#define EF_PPC64_ABI 3
16.2256 +
16.2257 +#define DT_PPC64_GLINK (DT_LOPROC + 0)
16.2258 +#define DT_PPC64_OPD (DT_LOPROC + 1)
16.2259 +#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
16.2260 +#define DT_PPC64_OPT (DT_LOPROC + 3)
16.2261 +#define DT_PPC64_NUM 4
16.2262 +
16.2263 +#define PPC64_OPT_TLS 1
16.2264 +#define PPC64_OPT_MULTI_TOC 2
16.2265 +
16.2266 +#define STO_PPC64_LOCAL_BIT 5
16.2267 +#define STO_PPC64_LOCAL_MASK 0xe0
16.2268 +#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
16.2269 +
16.2270 +
16.2271 +#define EF_ARM_RELEXEC 0x01
16.2272 +#define EF_ARM_HASENTRY 0x02
16.2273 +#define EF_ARM_INTERWORK 0x04
16.2274 +#define EF_ARM_APCS_26 0x08
16.2275 +#define EF_ARM_APCS_FLOAT 0x10
16.2276 +#define EF_ARM_PIC 0x20
16.2277 +#define EF_ARM_ALIGN8 0x40
16.2278 +#define EF_ARM_NEW_ABI 0x80
16.2279 +#define EF_ARM_OLD_ABI 0x100
16.2280 +#define EF_ARM_SOFT_FLOAT 0x200
16.2281 +#define EF_ARM_VFP_FLOAT 0x400
16.2282 +#define EF_ARM_MAVERICK_FLOAT 0x800
16.2283 +
16.2284 +#define EF_ARM_ABI_FLOAT_SOFT 0x200
16.2285 +#define EF_ARM_ABI_FLOAT_HARD 0x400
16.2286 +
16.2287 +
16.2288 +#define EF_ARM_SYMSARESORTED 0x04
16.2289 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08
16.2290 +#define EF_ARM_MAPSYMSFIRST 0x10
16.2291 +#define EF_ARM_EABIMASK 0XFF000000
16.2292 +
16.2293 +
16.2294 +#define EF_ARM_BE8 0x00800000
16.2295 +#define EF_ARM_LE8 0x00400000
16.2296 +
16.2297 +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
16.2298 +#define EF_ARM_EABI_UNKNOWN 0x00000000
16.2299 +#define EF_ARM_EABI_VER1 0x01000000
16.2300 +#define EF_ARM_EABI_VER2 0x02000000
16.2301 +#define EF_ARM_EABI_VER3 0x03000000
16.2302 +#define EF_ARM_EABI_VER4 0x04000000
16.2303 +#define EF_ARM_EABI_VER5 0x05000000
16.2304 +
16.2305 +
16.2306 +#define STT_ARM_TFUNC STT_LOPROC
16.2307 +#define STT_ARM_16BIT STT_HIPROC
16.2308 +
16.2309 +
16.2310 +#define SHF_ARM_ENTRYSECT 0x10000000
16.2311 +#define SHF_ARM_COMDEF 0x80000000
16.2312 +
16.2313 +
16.2314 +
16.2315 +#define PF_ARM_SB 0x10000000
16.2316 +
16.2317 +#define PF_ARM_PI 0x20000000
16.2318 +#define PF_ARM_ABS 0x40000000
16.2319 +
16.2320 +
16.2321 +#define PT_ARM_EXIDX (PT_LOPROC + 1)
16.2322 +
16.2323 +
16.2324 +#define SHT_ARM_EXIDX (SHT_LOPROC + 1)
16.2325 +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2)
16.2326 +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3)
16.2327 +
16.2328 +#define R_AARCH64_NONE 0
16.2329 +#define R_AARCH64_P32_ABS32 1
16.2330 +#define R_AARCH64_P32_COPY 180
16.2331 +#define R_AARCH64_P32_GLOB_DAT 181
16.2332 +#define R_AARCH64_P32_JUMP_SLOT 182
16.2333 +#define R_AARCH64_P32_RELATIVE 183
16.2334 +#define R_AARCH64_P32_TLS_DTPMOD 184
16.2335 +#define R_AARCH64_P32_TLS_DTPREL 185
16.2336 +#define R_AARCH64_P32_TLS_TPREL 186
16.2337 +#define R_AARCH64_P32_TLSDESC 187
16.2338 +#define R_AARCH64_P32_IRELATIVE 188
16.2339 +#define R_AARCH64_ABS64 257
16.2340 +#define R_AARCH64_ABS32 258
16.2341 +#define R_AARCH64_ABS16 259
16.2342 +#define R_AARCH64_PREL64 260
16.2343 +#define R_AARCH64_PREL32 261
16.2344 +#define R_AARCH64_PREL16 262
16.2345 +#define R_AARCH64_MOVW_UABS_G0 263
16.2346 +#define R_AARCH64_MOVW_UABS_G0_NC 264
16.2347 +#define R_AARCH64_MOVW_UABS_G1 265
16.2348 +#define R_AARCH64_MOVW_UABS_G1_NC 266
16.2349 +#define R_AARCH64_MOVW_UABS_G2 267
16.2350 +#define R_AARCH64_MOVW_UABS_G2_NC 268
16.2351 +#define R_AARCH64_MOVW_UABS_G3 269
16.2352 +#define R_AARCH64_MOVW_SABS_G0 270
16.2353 +#define R_AARCH64_MOVW_SABS_G1 271
16.2354 +#define R_AARCH64_MOVW_SABS_G2 272
16.2355 +#define R_AARCH64_LD_PREL_LO19 273
16.2356 +#define R_AARCH64_ADR_PREL_LO21 274
16.2357 +#define R_AARCH64_ADR_PREL_PG_HI21 275
16.2358 +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
16.2359 +#define R_AARCH64_ADD_ABS_LO12_NC 277
16.2360 +#define R_AARCH64_LDST8_ABS_LO12_NC 278
16.2361 +#define R_AARCH64_TSTBR14 279
16.2362 +#define R_AARCH64_CONDBR19 280
16.2363 +#define R_AARCH64_JUMP26 282
16.2364 +#define R_AARCH64_CALL26 283
16.2365 +#define R_AARCH64_LDST16_ABS_LO12_NC 284
16.2366 +#define R_AARCH64_LDST32_ABS_LO12_NC 285
16.2367 +#define R_AARCH64_LDST64_ABS_LO12_NC 286
16.2368 +#define R_AARCH64_MOVW_PREL_G0 287
16.2369 +#define R_AARCH64_MOVW_PREL_G0_NC 288
16.2370 +#define R_AARCH64_MOVW_PREL_G1 289
16.2371 +#define R_AARCH64_MOVW_PREL_G1_NC 290
16.2372 +#define R_AARCH64_MOVW_PREL_G2 291
16.2373 +#define R_AARCH64_MOVW_PREL_G2_NC 292
16.2374 +#define R_AARCH64_MOVW_PREL_G3 293
16.2375 +#define R_AARCH64_LDST128_ABS_LO12_NC 299
16.2376 +#define R_AARCH64_MOVW_GOTOFF_G0 300
16.2377 +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
16.2378 +#define R_AARCH64_MOVW_GOTOFF_G1 302
16.2379 +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
16.2380 +#define R_AARCH64_MOVW_GOTOFF_G2 304
16.2381 +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
16.2382 +#define R_AARCH64_MOVW_GOTOFF_G3 306
16.2383 +#define R_AARCH64_GOTREL64 307
16.2384 +#define R_AARCH64_GOTREL32 308
16.2385 +#define R_AARCH64_GOT_LD_PREL19 309
16.2386 +#define R_AARCH64_LD64_GOTOFF_LO15 310
16.2387 +#define R_AARCH64_ADR_GOT_PAGE 311
16.2388 +#define R_AARCH64_LD64_GOT_LO12_NC 312
16.2389 +#define R_AARCH64_LD64_GOTPAGE_LO15 313
16.2390 +#define R_AARCH64_TLSGD_ADR_PREL21 512
16.2391 +#define R_AARCH64_TLSGD_ADR_PAGE21 513
16.2392 +#define R_AARCH64_TLSGD_ADD_LO12_NC 514
16.2393 +#define R_AARCH64_TLSGD_MOVW_G1 515
16.2394 +#define R_AARCH64_TLSGD_MOVW_G0_NC 516
16.2395 +#define R_AARCH64_TLSLD_ADR_PREL21 517
16.2396 +#define R_AARCH64_TLSLD_ADR_PAGE21 518
16.2397 +#define R_AARCH64_TLSLD_ADD_LO12_NC 519
16.2398 +#define R_AARCH64_TLSLD_MOVW_G1 520
16.2399 +#define R_AARCH64_TLSLD_MOVW_G0_NC 521
16.2400 +#define R_AARCH64_TLSLD_LD_PREL19 522
16.2401 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
16.2402 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
16.2403 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
16.2404 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
16.2405 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
16.2406 +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
16.2407 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
16.2408 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
16.2409 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
16.2410 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
16.2411 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
16.2412 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
16.2413 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
16.2414 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
16.2415 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
16.2416 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
16.2417 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
16.2418 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
16.2419 +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
16.2420 +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
16.2421 +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
16.2422 +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
16.2423 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
16.2424 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
16.2425 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
16.2426 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
16.2427 +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
16.2428 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
16.2429 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
16.2430 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
16.2431 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
16.2432 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
16.2433 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
16.2434 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
16.2435 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
16.2436 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
16.2437 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
16.2438 +#define R_AARCH64_TLSDESC_LD_PREL19 560
16.2439 +#define R_AARCH64_TLSDESC_ADR_PREL21 561
16.2440 +#define R_AARCH64_TLSDESC_ADR_PAGE21 562
16.2441 +#define R_AARCH64_TLSDESC_LD64_LO12 563
16.2442 +#define R_AARCH64_TLSDESC_ADD_LO12 564
16.2443 +#define R_AARCH64_TLSDESC_OFF_G1 565
16.2444 +#define R_AARCH64_TLSDESC_OFF_G0_NC 566
16.2445 +#define R_AARCH64_TLSDESC_LDR 567
16.2446 +#define R_AARCH64_TLSDESC_ADD 568
16.2447 +#define R_AARCH64_TLSDESC_CALL 569
16.2448 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
16.2449 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
16.2450 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
16.2451 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
16.2452 +#define R_AARCH64_COPY 1024
16.2453 +#define R_AARCH64_GLOB_DAT 1025
16.2454 +#define R_AARCH64_JUMP_SLOT 1026
16.2455 +#define R_AARCH64_RELATIVE 1027
16.2456 +#define R_AARCH64_TLS_DTPMOD 1028
16.2457 +#define R_AARCH64_TLS_DTPMOD64 1028
16.2458 +#define R_AARCH64_TLS_DTPREL 1029
16.2459 +#define R_AARCH64_TLS_DTPREL64 1029
16.2460 +#define R_AARCH64_TLS_TPREL 1030
16.2461 +#define R_AARCH64_TLS_TPREL64 1030
16.2462 +#define R_AARCH64_TLSDESC 1031
16.2463 +
16.2464 +
16.2465 +#define R_ARM_NONE 0
16.2466 +#define R_ARM_PC24 1
16.2467 +#define R_ARM_ABS32 2
16.2468 +#define R_ARM_REL32 3
16.2469 +#define R_ARM_PC13 4
16.2470 +#define R_ARM_ABS16 5
16.2471 +#define R_ARM_ABS12 6
16.2472 +#define R_ARM_THM_ABS5 7
16.2473 +#define R_ARM_ABS8 8
16.2474 +#define R_ARM_SBREL32 9
16.2475 +#define R_ARM_THM_PC22 10
16.2476 +#define R_ARM_THM_PC8 11
16.2477 +#define R_ARM_AMP_VCALL9 12
16.2478 +#define R_ARM_TLS_DESC 13
16.2479 +#define R_ARM_THM_SWI8 14
16.2480 +#define R_ARM_XPC25 15
16.2481 +#define R_ARM_THM_XPC22 16
16.2482 +#define R_ARM_TLS_DTPMOD32 17
16.2483 +#define R_ARM_TLS_DTPOFF32 18
16.2484 +#define R_ARM_TLS_TPOFF32 19
16.2485 +#define R_ARM_COPY 20
16.2486 +#define R_ARM_GLOB_DAT 21
16.2487 +#define R_ARM_JUMP_SLOT 22
16.2488 +#define R_ARM_RELATIVE 23
16.2489 +#define R_ARM_GOTOFF 24
16.2490 +#define R_ARM_GOTPC 25
16.2491 +#define R_ARM_GOT32 26
16.2492 +#define R_ARM_PLT32 27
16.2493 +#define R_ARM_CALL 28
16.2494 +#define R_ARM_JUMP24 29
16.2495 +#define R_ARM_THM_JUMP24 30
16.2496 +#define R_ARM_BASE_ABS 31
16.2497 +#define R_ARM_ALU_PCREL_7_0 32
16.2498 +#define R_ARM_ALU_PCREL_15_8 33
16.2499 +#define R_ARM_ALU_PCREL_23_15 34
16.2500 +#define R_ARM_LDR_SBREL_11_0 35
16.2501 +#define R_ARM_ALU_SBREL_19_12 36
16.2502 +#define R_ARM_ALU_SBREL_27_20 37
16.2503 +#define R_ARM_TARGET1 38
16.2504 +#define R_ARM_SBREL31 39
16.2505 +#define R_ARM_V4BX 40
16.2506 +#define R_ARM_TARGET2 41
16.2507 +#define R_ARM_PREL31 42
16.2508 +#define R_ARM_MOVW_ABS_NC 43
16.2509 +#define R_ARM_MOVT_ABS 44
16.2510 +#define R_ARM_MOVW_PREL_NC 45
16.2511 +#define R_ARM_MOVT_PREL 46
16.2512 +#define R_ARM_THM_MOVW_ABS_NC 47
16.2513 +#define R_ARM_THM_MOVT_ABS 48
16.2514 +#define R_ARM_THM_MOVW_PREL_NC 49
16.2515 +#define R_ARM_THM_MOVT_PREL 50
16.2516 +#define R_ARM_THM_JUMP19 51
16.2517 +#define R_ARM_THM_JUMP6 52
16.2518 +#define R_ARM_THM_ALU_PREL_11_0 53
16.2519 +#define R_ARM_THM_PC12 54
16.2520 +#define R_ARM_ABS32_NOI 55
16.2521 +#define R_ARM_REL32_NOI 56
16.2522 +#define R_ARM_ALU_PC_G0_NC 57
16.2523 +#define R_ARM_ALU_PC_G0 58
16.2524 +#define R_ARM_ALU_PC_G1_NC 59
16.2525 +#define R_ARM_ALU_PC_G1 60
16.2526 +#define R_ARM_ALU_PC_G2 61
16.2527 +#define R_ARM_LDR_PC_G1 62
16.2528 +#define R_ARM_LDR_PC_G2 63
16.2529 +#define R_ARM_LDRS_PC_G0 64
16.2530 +#define R_ARM_LDRS_PC_G1 65
16.2531 +#define R_ARM_LDRS_PC_G2 66
16.2532 +#define R_ARM_LDC_PC_G0 67
16.2533 +#define R_ARM_LDC_PC_G1 68
16.2534 +#define R_ARM_LDC_PC_G2 69
16.2535 +#define R_ARM_ALU_SB_G0_NC 70
16.2536 +#define R_ARM_ALU_SB_G0 71
16.2537 +#define R_ARM_ALU_SB_G1_NC 72
16.2538 +#define R_ARM_ALU_SB_G1 73
16.2539 +#define R_ARM_ALU_SB_G2 74
16.2540 +#define R_ARM_LDR_SB_G0 75
16.2541 +#define R_ARM_LDR_SB_G1 76
16.2542 +#define R_ARM_LDR_SB_G2 77
16.2543 +#define R_ARM_LDRS_SB_G0 78
16.2544 +#define R_ARM_LDRS_SB_G1 79
16.2545 +#define R_ARM_LDRS_SB_G2 80
16.2546 +#define R_ARM_LDC_SB_G0 81
16.2547 +#define R_ARM_LDC_SB_G1 82
16.2548 +#define R_ARM_LDC_SB_G2 83
16.2549 +#define R_ARM_MOVW_BREL_NC 84
16.2550 +#define R_ARM_MOVT_BREL 85
16.2551 +#define R_ARM_MOVW_BREL 86
16.2552 +#define R_ARM_THM_MOVW_BREL_NC 87
16.2553 +#define R_ARM_THM_MOVT_BREL 88
16.2554 +#define R_ARM_THM_MOVW_BREL 89
16.2555 +#define R_ARM_TLS_GOTDESC 90
16.2556 +#define R_ARM_TLS_CALL 91
16.2557 +#define R_ARM_TLS_DESCSEQ 92
16.2558 +#define R_ARM_THM_TLS_CALL 93
16.2559 +#define R_ARM_PLT32_ABS 94
16.2560 +#define R_ARM_GOT_ABS 95
16.2561 +#define R_ARM_GOT_PREL 96
16.2562 +#define R_ARM_GOT_BREL12 97
16.2563 +#define R_ARM_GOTOFF12 98
16.2564 +#define R_ARM_GOTRELAX 99
16.2565 +#define R_ARM_GNU_VTENTRY 100
16.2566 +#define R_ARM_GNU_VTINHERIT 101
16.2567 +#define R_ARM_THM_PC11 102
16.2568 +#define R_ARM_THM_PC9 103
16.2569 +#define R_ARM_TLS_GD32 104
16.2570 +
16.2571 +#define R_ARM_TLS_LDM32 105
16.2572 +
16.2573 +#define R_ARM_TLS_LDO32 106
16.2574 +
16.2575 +#define R_ARM_TLS_IE32 107
16.2576 +
16.2577 +#define R_ARM_TLS_LE32 108
16.2578 +#define R_ARM_TLS_LDO12 109
16.2579 +#define R_ARM_TLS_LE12 110
16.2580 +#define R_ARM_TLS_IE12GP 111
16.2581 +#define R_ARM_ME_TOO 128
16.2582 +#define R_ARM_THM_TLS_DESCSEQ 129
16.2583 +#define R_ARM_THM_TLS_DESCSEQ16 129
16.2584 +#define R_ARM_THM_TLS_DESCSEQ32 130
16.2585 +#define R_ARM_THM_GOT_BREL12 131
16.2586 +#define R_ARM_IRELATIVE 160
16.2587 +#define R_ARM_RXPC25 249
16.2588 +#define R_ARM_RSBREL32 250
16.2589 +#define R_ARM_THM_RPC22 251
16.2590 +#define R_ARM_RREL32 252
16.2591 +#define R_ARM_RABS22 253
16.2592 +#define R_ARM_RPC24 254
16.2593 +#define R_ARM_RBASE 255
16.2594 +
16.2595 +#define R_ARM_NUM 256
16.2596 +
16.2597 +
16.2598 +
16.2599 +
16.2600 +#define EF_IA_64_MASKOS 0x0000000f
16.2601 +#define EF_IA_64_ABI64 0x00000010
16.2602 +#define EF_IA_64_ARCH 0xff000000
16.2603 +
16.2604 +
16.2605 +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0)
16.2606 +#define PT_IA_64_UNWIND (PT_LOPROC + 1)
16.2607 +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
16.2608 +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
16.2609 +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
16.2610 +
16.2611 +
16.2612 +#define PF_IA_64_NORECOV 0x80000000
16.2613 +
16.2614 +
16.2615 +#define SHT_IA_64_EXT (SHT_LOPROC + 0)
16.2616 +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1)
16.2617 +
16.2618 +
16.2619 +#define SHF_IA_64_SHORT 0x10000000
16.2620 +#define SHF_IA_64_NORECOV 0x20000000
16.2621 +
16.2622 +
16.2623 +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
16.2624 +#define DT_IA_64_NUM 1
16.2625 +
16.2626 +
16.2627 +#define R_IA64_NONE 0x00
16.2628 +#define R_IA64_IMM14 0x21
16.2629 +#define R_IA64_IMM22 0x22
16.2630 +#define R_IA64_IMM64 0x23
16.2631 +#define R_IA64_DIR32MSB 0x24
16.2632 +#define R_IA64_DIR32LSB 0x25
16.2633 +#define R_IA64_DIR64MSB 0x26
16.2634 +#define R_IA64_DIR64LSB 0x27
16.2635 +#define R_IA64_GPREL22 0x2a
16.2636 +#define R_IA64_GPREL64I 0x2b
16.2637 +#define R_IA64_GPREL32MSB 0x2c
16.2638 +#define R_IA64_GPREL32LSB 0x2d
16.2639 +#define R_IA64_GPREL64MSB 0x2e
16.2640 +#define R_IA64_GPREL64LSB 0x2f
16.2641 +#define R_IA64_LTOFF22 0x32
16.2642 +#define R_IA64_LTOFF64I 0x33
16.2643 +#define R_IA64_PLTOFF22 0x3a
16.2644 +#define R_IA64_PLTOFF64I 0x3b
16.2645 +#define R_IA64_PLTOFF64MSB 0x3e
16.2646 +#define R_IA64_PLTOFF64LSB 0x3f
16.2647 +#define R_IA64_FPTR64I 0x43
16.2648 +#define R_IA64_FPTR32MSB 0x44
16.2649 +#define R_IA64_FPTR32LSB 0x45
16.2650 +#define R_IA64_FPTR64MSB 0x46
16.2651 +#define R_IA64_FPTR64LSB 0x47
16.2652 +#define R_IA64_PCREL60B 0x48
16.2653 +#define R_IA64_PCREL21B 0x49
16.2654 +#define R_IA64_PCREL21M 0x4a
16.2655 +#define R_IA64_PCREL21F 0x4b
16.2656 +#define R_IA64_PCREL32MSB 0x4c
16.2657 +#define R_IA64_PCREL32LSB 0x4d
16.2658 +#define R_IA64_PCREL64MSB 0x4e
16.2659 +#define R_IA64_PCREL64LSB 0x4f
16.2660 +#define R_IA64_LTOFF_FPTR22 0x52
16.2661 +#define R_IA64_LTOFF_FPTR64I 0x53
16.2662 +#define R_IA64_LTOFF_FPTR32MSB 0x54
16.2663 +#define R_IA64_LTOFF_FPTR32LSB 0x55
16.2664 +#define R_IA64_LTOFF_FPTR64MSB 0x56
16.2665 +#define R_IA64_LTOFF_FPTR64LSB 0x57
16.2666 +#define R_IA64_SEGREL32MSB 0x5c
16.2667 +#define R_IA64_SEGREL32LSB 0x5d
16.2668 +#define R_IA64_SEGREL64MSB 0x5e
16.2669 +#define R_IA64_SEGREL64LSB 0x5f
16.2670 +#define R_IA64_SECREL32MSB 0x64
16.2671 +#define R_IA64_SECREL32LSB 0x65
16.2672 +#define R_IA64_SECREL64MSB 0x66
16.2673 +#define R_IA64_SECREL64LSB 0x67
16.2674 +#define R_IA64_REL32MSB 0x6c
16.2675 +#define R_IA64_REL32LSB 0x6d
16.2676 +#define R_IA64_REL64MSB 0x6e
16.2677 +#define R_IA64_REL64LSB 0x6f
16.2678 +#define R_IA64_LTV32MSB 0x74
16.2679 +#define R_IA64_LTV32LSB 0x75
16.2680 +#define R_IA64_LTV64MSB 0x76
16.2681 +#define R_IA64_LTV64LSB 0x77
16.2682 +#define R_IA64_PCREL21BI 0x79
16.2683 +#define R_IA64_PCREL22 0x7a
16.2684 +#define R_IA64_PCREL64I 0x7b
16.2685 +#define R_IA64_IPLTMSB 0x80
16.2686 +#define R_IA64_IPLTLSB 0x81
16.2687 +#define R_IA64_COPY 0x84
16.2688 +#define R_IA64_SUB 0x85
16.2689 +#define R_IA64_LTOFF22X 0x86
16.2690 +#define R_IA64_LDXMOV 0x87
16.2691 +#define R_IA64_TPREL14 0x91
16.2692 +#define R_IA64_TPREL22 0x92
16.2693 +#define R_IA64_TPREL64I 0x93
16.2694 +#define R_IA64_TPREL64MSB 0x96
16.2695 +#define R_IA64_TPREL64LSB 0x97
16.2696 +#define R_IA64_LTOFF_TPREL22 0x9a
16.2697 +#define R_IA64_DTPMOD64MSB 0xa6
16.2698 +#define R_IA64_DTPMOD64LSB 0xa7
16.2699 +#define R_IA64_LTOFF_DTPMOD22 0xaa
16.2700 +#define R_IA64_DTPREL14 0xb1
16.2701 +#define R_IA64_DTPREL22 0xb2
16.2702 +#define R_IA64_DTPREL64I 0xb3
16.2703 +#define R_IA64_DTPREL32MSB 0xb4
16.2704 +#define R_IA64_DTPREL32LSB 0xb5
16.2705 +#define R_IA64_DTPREL64MSB 0xb6
16.2706 +#define R_IA64_DTPREL64LSB 0xb7
16.2707 +#define R_IA64_LTOFF_DTPREL22 0xba
16.2708 +
16.2709 +
16.2710 +#define EF_SH_MACH_MASK 0x1f
16.2711 +#define EF_SH_UNKNOWN 0x0
16.2712 +#define EF_SH1 0x1
16.2713 +#define EF_SH2 0x2
16.2714 +#define EF_SH3 0x3
16.2715 +#define EF_SH_DSP 0x4
16.2716 +#define EF_SH3_DSP 0x5
16.2717 +#define EF_SH4AL_DSP 0x6
16.2718 +#define EF_SH3E 0x8
16.2719 +#define EF_SH4 0x9
16.2720 +#define EF_SH2E 0xb
16.2721 +#define EF_SH4A 0xc
16.2722 +#define EF_SH2A 0xd
16.2723 +#define EF_SH4_NOFPU 0x10
16.2724 +#define EF_SH4A_NOFPU 0x11
16.2725 +#define EF_SH4_NOMMU_NOFPU 0x12
16.2726 +#define EF_SH2A_NOFPU 0x13
16.2727 +#define EF_SH3_NOMMU 0x14
16.2728 +#define EF_SH2A_SH4_NOFPU 0x15
16.2729 +#define EF_SH2A_SH3_NOFPU 0x16
16.2730 +#define EF_SH2A_SH4 0x17
16.2731 +#define EF_SH2A_SH3E 0x18
16.2732 +
16.2733 +#define R_SH_NONE 0
16.2734 +#define R_SH_DIR32 1
16.2735 +#define R_SH_REL32 2
16.2736 +#define R_SH_DIR8WPN 3
16.2737 +#define R_SH_IND12W 4
16.2738 +#define R_SH_DIR8WPL 5
16.2739 +#define R_SH_DIR8WPZ 6
16.2740 +#define R_SH_DIR8BP 7
16.2741 +#define R_SH_DIR8W 8
16.2742 +#define R_SH_DIR8L 9
16.2743 +#define R_SH_SWITCH16 25
16.2744 +#define R_SH_SWITCH32 26
16.2745 +#define R_SH_USES 27
16.2746 +#define R_SH_COUNT 28
16.2747 +#define R_SH_ALIGN 29
16.2748 +#define R_SH_CODE 30
16.2749 +#define R_SH_DATA 31
16.2750 +#define R_SH_LABEL 32
16.2751 +#define R_SH_SWITCH8 33
16.2752 +#define R_SH_GNU_VTINHERIT 34
16.2753 +#define R_SH_GNU_VTENTRY 35
16.2754 +#define R_SH_TLS_GD_32 144
16.2755 +#define R_SH_TLS_LD_32 145
16.2756 +#define R_SH_TLS_LDO_32 146
16.2757 +#define R_SH_TLS_IE_32 147
16.2758 +#define R_SH_TLS_LE_32 148
16.2759 +#define R_SH_TLS_DTPMOD32 149
16.2760 +#define R_SH_TLS_DTPOFF32 150
16.2761 +#define R_SH_TLS_TPOFF32 151
16.2762 +#define R_SH_GOT32 160
16.2763 +#define R_SH_PLT32 161
16.2764 +#define R_SH_COPY 162
16.2765 +#define R_SH_GLOB_DAT 163
16.2766 +#define R_SH_JMP_SLOT 164
16.2767 +#define R_SH_RELATIVE 165
16.2768 +#define R_SH_GOTOFF 166
16.2769 +#define R_SH_GOTPC 167
16.2770 +#define R_SH_GOT20 201
16.2771 +#define R_SH_GOTOFF20 202
16.2772 +#define R_SH_GOTFUNCDESC 203
16.2773 +#define R_SH_GOTFUNCDEST20 204
16.2774 +#define R_SH_GOTOFFFUNCDESC 205
16.2775 +#define R_SH_GOTOFFFUNCDEST20 206
16.2776 +#define R_SH_FUNCDESC 207
16.2777 +#define R_SH_FUNCDESC_VALUE 208
16.2778 +
16.2779 +#define R_SH_NUM 256
16.2780 +
16.2781 +
16.2782 +
16.2783 +#define R_390_NONE 0
16.2784 +#define R_390_8 1
16.2785 +#define R_390_12 2
16.2786 +#define R_390_16 3
16.2787 +#define R_390_32 4
16.2788 +#define R_390_PC32 5
16.2789 +#define R_390_GOT12 6
16.2790 +#define R_390_GOT32 7
16.2791 +#define R_390_PLT32 8
16.2792 +#define R_390_COPY 9
16.2793 +#define R_390_GLOB_DAT 10
16.2794 +#define R_390_JMP_SLOT 11
16.2795 +#define R_390_RELATIVE 12
16.2796 +#define R_390_GOTOFF32 13
16.2797 +#define R_390_GOTPC 14
16.2798 +#define R_390_GOT16 15
16.2799 +#define R_390_PC16 16
16.2800 +#define R_390_PC16DBL 17
16.2801 +#define R_390_PLT16DBL 18
16.2802 +#define R_390_PC32DBL 19
16.2803 +#define R_390_PLT32DBL 20
16.2804 +#define R_390_GOTPCDBL 21
16.2805 +#define R_390_64 22
16.2806 +#define R_390_PC64 23
16.2807 +#define R_390_GOT64 24
16.2808 +#define R_390_PLT64 25
16.2809 +#define R_390_GOTENT 26
16.2810 +#define R_390_GOTOFF16 27
16.2811 +#define R_390_GOTOFF64 28
16.2812 +#define R_390_GOTPLT12 29
16.2813 +#define R_390_GOTPLT16 30
16.2814 +#define R_390_GOTPLT32 31
16.2815 +#define R_390_GOTPLT64 32
16.2816 +#define R_390_GOTPLTENT 33
16.2817 +#define R_390_PLTOFF16 34
16.2818 +#define R_390_PLTOFF32 35
16.2819 +#define R_390_PLTOFF64 36
16.2820 +#define R_390_TLS_LOAD 37
16.2821 +#define R_390_TLS_GDCALL 38
16.2822 +
16.2823 +#define R_390_TLS_LDCALL 39
16.2824 +
16.2825 +#define R_390_TLS_GD32 40
16.2826 +
16.2827 +#define R_390_TLS_GD64 41
16.2828 +
16.2829 +#define R_390_TLS_GOTIE12 42
16.2830 +
16.2831 +#define R_390_TLS_GOTIE32 43
16.2832 +
16.2833 +#define R_390_TLS_GOTIE64 44
16.2834 +
16.2835 +#define R_390_TLS_LDM32 45
16.2836 +
16.2837 +#define R_390_TLS_LDM64 46
16.2838 +
16.2839 +#define R_390_TLS_IE32 47
16.2840 +
16.2841 +#define R_390_TLS_IE64 48
16.2842 +
16.2843 +#define R_390_TLS_IEENT 49
16.2844 +
16.2845 +#define R_390_TLS_LE32 50
16.2846 +
16.2847 +#define R_390_TLS_LE64 51
16.2848 +
16.2849 +#define R_390_TLS_LDO32 52
16.2850 +
16.2851 +#define R_390_TLS_LDO64 53
16.2852 +
16.2853 +#define R_390_TLS_DTPMOD 54
16.2854 +#define R_390_TLS_DTPOFF 55
16.2855 +#define R_390_TLS_TPOFF 56
16.2856 +
16.2857 +#define R_390_20 57
16.2858 +#define R_390_GOT20 58
16.2859 +#define R_390_GOTPLT20 59
16.2860 +#define R_390_TLS_GOTIE20 60
16.2861 +
16.2862 +
16.2863 +#define R_390_NUM 61
16.2864 +
16.2865 +
16.2866 +
16.2867 +#define R_CRIS_NONE 0
16.2868 +#define R_CRIS_8 1
16.2869 +#define R_CRIS_16 2
16.2870 +#define R_CRIS_32 3
16.2871 +#define R_CRIS_8_PCREL 4
16.2872 +#define R_CRIS_16_PCREL 5
16.2873 +#define R_CRIS_32_PCREL 6
16.2874 +#define R_CRIS_GNU_VTINHERIT 7
16.2875 +#define R_CRIS_GNU_VTENTRY 8
16.2876 +#define R_CRIS_COPY 9
16.2877 +#define R_CRIS_GLOB_DAT 10
16.2878 +#define R_CRIS_JUMP_SLOT 11
16.2879 +#define R_CRIS_RELATIVE 12
16.2880 +#define R_CRIS_16_GOT 13
16.2881 +#define R_CRIS_32_GOT 14
16.2882 +#define R_CRIS_16_GOTPLT 15
16.2883 +#define R_CRIS_32_GOTPLT 16
16.2884 +#define R_CRIS_32_GOTREL 17
16.2885 +#define R_CRIS_32_PLT_GOTREL 18
16.2886 +#define R_CRIS_32_PLT_PCREL 19
16.2887 +
16.2888 +#define R_CRIS_NUM 20
16.2889 +
16.2890 +
16.2891 +
16.2892 +#define R_X86_64_NONE 0
16.2893 +#define R_X86_64_64 1
16.2894 +#define R_X86_64_PC32 2
16.2895 +#define R_X86_64_GOT32 3
16.2896 +#define R_X86_64_PLT32 4
16.2897 +#define R_X86_64_COPY 5
16.2898 +#define R_X86_64_GLOB_DAT 6
16.2899 +#define R_X86_64_JUMP_SLOT 7
16.2900 +#define R_X86_64_RELATIVE 8
16.2901 +#define R_X86_64_GOTPCREL 9
16.2902 +
16.2903 +#define R_X86_64_32 10
16.2904 +#define R_X86_64_32S 11
16.2905 +#define R_X86_64_16 12
16.2906 +#define R_X86_64_PC16 13
16.2907 +#define R_X86_64_8 14
16.2908 +#define R_X86_64_PC8 15
16.2909 +#define R_X86_64_DTPMOD64 16
16.2910 +#define R_X86_64_DTPOFF64 17
16.2911 +#define R_X86_64_TPOFF64 18
16.2912 +#define R_X86_64_TLSGD 19
16.2913 +
16.2914 +#define R_X86_64_TLSLD 20
16.2915 +
16.2916 +#define R_X86_64_DTPOFF32 21
16.2917 +#define R_X86_64_GOTTPOFF 22
16.2918 +
16.2919 +#define R_X86_64_TPOFF32 23
16.2920 +#define R_X86_64_PC64 24
16.2921 +#define R_X86_64_GOTOFF64 25
16.2922 +#define R_X86_64_GOTPC32 26
16.2923 +#define R_X86_64_GOT64 27
16.2924 +#define R_X86_64_GOTPCREL64 28
16.2925 +#define R_X86_64_GOTPC64 29
16.2926 +#define R_X86_64_GOTPLT64 30
16.2927 +#define R_X86_64_PLTOFF64 31
16.2928 +#define R_X86_64_SIZE32 32
16.2929 +#define R_X86_64_SIZE64 33
16.2930 +
16.2931 +#define R_X86_64_GOTPC32_TLSDESC 34
16.2932 +#define R_X86_64_TLSDESC_CALL 35
16.2933 +
16.2934 +#define R_X86_64_TLSDESC 36
16.2935 +#define R_X86_64_IRELATIVE 37
16.2936 +#define R_X86_64_RELATIVE64 38
16.2937 +#define R_X86_64_GOTPCRELX 41
16.2938 +#define R_X86_64_REX_GOTPCRELX 42
16.2939 +#define R_X86_64_NUM 43
16.2940 +
16.2941 +
16.2942 +
16.2943 +#define R_MN10300_NONE 0
16.2944 +#define R_MN10300_32 1
16.2945 +#define R_MN10300_16 2
16.2946 +#define R_MN10300_8 3
16.2947 +#define R_MN10300_PCREL32 4
16.2948 +#define R_MN10300_PCREL16 5
16.2949 +#define R_MN10300_PCREL8 6
16.2950 +#define R_MN10300_GNU_VTINHERIT 7
16.2951 +#define R_MN10300_GNU_VTENTRY 8
16.2952 +#define R_MN10300_24 9
16.2953 +#define R_MN10300_GOTPC32 10
16.2954 +#define R_MN10300_GOTPC16 11
16.2955 +#define R_MN10300_GOTOFF32 12
16.2956 +#define R_MN10300_GOTOFF24 13
16.2957 +#define R_MN10300_GOTOFF16 14
16.2958 +#define R_MN10300_PLT32 15
16.2959 +#define R_MN10300_PLT16 16
16.2960 +#define R_MN10300_GOT32 17
16.2961 +#define R_MN10300_GOT24 18
16.2962 +#define R_MN10300_GOT16 19
16.2963 +#define R_MN10300_COPY 20
16.2964 +#define R_MN10300_GLOB_DAT 21
16.2965 +#define R_MN10300_JMP_SLOT 22
16.2966 +#define R_MN10300_RELATIVE 23
16.2967 +
16.2968 +#define R_MN10300_NUM 24
16.2969 +
16.2970 +
16.2971 +
16.2972 +#define R_M32R_NONE 0
16.2973 +#define R_M32R_16 1
16.2974 +#define R_M32R_32 2
16.2975 +#define R_M32R_24 3
16.2976 +#define R_M32R_10_PCREL 4
16.2977 +#define R_M32R_18_PCREL 5
16.2978 +#define R_M32R_26_PCREL 6
16.2979 +#define R_M32R_HI16_ULO 7
16.2980 +#define R_M32R_HI16_SLO 8
16.2981 +#define R_M32R_LO16 9
16.2982 +#define R_M32R_SDA16 10
16.2983 +#define R_M32R_GNU_VTINHERIT 11
16.2984 +#define R_M32R_GNU_VTENTRY 12
16.2985 +
16.2986 +#define R_M32R_16_RELA 33
16.2987 +#define R_M32R_32_RELA 34
16.2988 +#define R_M32R_24_RELA 35
16.2989 +#define R_M32R_10_PCREL_RELA 36
16.2990 +#define R_M32R_18_PCREL_RELA 37
16.2991 +#define R_M32R_26_PCREL_RELA 38
16.2992 +#define R_M32R_HI16_ULO_RELA 39
16.2993 +#define R_M32R_HI16_SLO_RELA 40
16.2994 +#define R_M32R_LO16_RELA 41
16.2995 +#define R_M32R_SDA16_RELA 42
16.2996 +#define R_M32R_RELA_GNU_VTINHERIT 43
16.2997 +#define R_M32R_RELA_GNU_VTENTRY 44
16.2998 +#define R_M32R_REL32 45
16.2999 +
16.3000 +#define R_M32R_GOT24 48
16.3001 +#define R_M32R_26_PLTREL 49
16.3002 +#define R_M32R_COPY 50
16.3003 +#define R_M32R_GLOB_DAT 51
16.3004 +#define R_M32R_JMP_SLOT 52
16.3005 +#define R_M32R_RELATIVE 53
16.3006 +#define R_M32R_GOTOFF 54
16.3007 +#define R_M32R_GOTPC24 55
16.3008 +#define R_M32R_GOT16_HI_ULO 56
16.3009 +
16.3010 +#define R_M32R_GOT16_HI_SLO 57
16.3011 +
16.3012 +#define R_M32R_GOT16_LO 58
16.3013 +#define R_M32R_GOTPC_HI_ULO 59
16.3014 +
16.3015 +#define R_M32R_GOTPC_HI_SLO 60
16.3016 +
16.3017 +#define R_M32R_GOTPC_LO 61
16.3018 +
16.3019 +#define R_M32R_GOTOFF_HI_ULO 62
16.3020 +
16.3021 +#define R_M32R_GOTOFF_HI_SLO 63
16.3022 +
16.3023 +#define R_M32R_GOTOFF_LO 64
16.3024 +#define R_M32R_NUM 256
16.3025 +
16.3026 +#define R_MICROBLAZE_NONE 0
16.3027 +#define R_MICROBLAZE_32 1
16.3028 +#define R_MICROBLAZE_32_PCREL 2
16.3029 +#define R_MICROBLAZE_64_PCREL 3
16.3030 +#define R_MICROBLAZE_32_PCREL_LO 4
16.3031 +#define R_MICROBLAZE_64 5
16.3032 +#define R_MICROBLAZE_32_LO 6
16.3033 +#define R_MICROBLAZE_SRO32 7
16.3034 +#define R_MICROBLAZE_SRW32 8
16.3035 +#define R_MICROBLAZE_64_NONE 9
16.3036 +#define R_MICROBLAZE_32_SYM_OP_SYM 10
16.3037 +#define R_MICROBLAZE_GNU_VTINHERIT 11
16.3038 +#define R_MICROBLAZE_GNU_VTENTRY 12
16.3039 +#define R_MICROBLAZE_GOTPC_64 13
16.3040 +#define R_MICROBLAZE_GOT_64 14
16.3041 +#define R_MICROBLAZE_PLT_64 15
16.3042 +#define R_MICROBLAZE_REL 16
16.3043 +#define R_MICROBLAZE_JUMP_SLOT 17
16.3044 +#define R_MICROBLAZE_GLOB_DAT 18
16.3045 +#define R_MICROBLAZE_GOTOFF_64 19
16.3046 +#define R_MICROBLAZE_GOTOFF_32 20
16.3047 +#define R_MICROBLAZE_COPY 21
16.3048 +#define R_MICROBLAZE_TLS 22
16.3049 +#define R_MICROBLAZE_TLSGD 23
16.3050 +#define R_MICROBLAZE_TLSLD 24
16.3051 +#define R_MICROBLAZE_TLSDTPMOD32 25
16.3052 +#define R_MICROBLAZE_TLSDTPREL32 26
16.3053 +#define R_MICROBLAZE_TLSDTPREL64 27
16.3054 +#define R_MICROBLAZE_TLSGOTTPREL32 28
16.3055 +#define R_MICROBLAZE_TLSTPREL32 29
16.3056 +
16.3057 +#define DT_NIOS2_GP 0x70000002
16.3058 +
16.3059 +#define R_NIOS2_NONE 0
16.3060 +#define R_NIOS2_S16 1
16.3061 +#define R_NIOS2_U16 2
16.3062 +#define R_NIOS2_PCREL16 3
16.3063 +#define R_NIOS2_CALL26 4
16.3064 +#define R_NIOS2_IMM5 5
16.3065 +#define R_NIOS2_CACHE_OPX 6
16.3066 +#define R_NIOS2_IMM6 7
16.3067 +#define R_NIOS2_IMM8 8
16.3068 +#define R_NIOS2_HI16 9
16.3069 +#define R_NIOS2_LO16 10
16.3070 +#define R_NIOS2_HIADJ16 11
16.3071 +#define R_NIOS2_BFD_RELOC_32 12
16.3072 +#define R_NIOS2_BFD_RELOC_16 13
16.3073 +#define R_NIOS2_BFD_RELOC_8 14
16.3074 +#define R_NIOS2_GPREL 15
16.3075 +#define R_NIOS2_GNU_VTINHERIT 16
16.3076 +#define R_NIOS2_GNU_VTENTRY 17
16.3077 +#define R_NIOS2_UJMP 18
16.3078 +#define R_NIOS2_CJMP 19
16.3079 +#define R_NIOS2_CALLR 20
16.3080 +#define R_NIOS2_ALIGN 21
16.3081 +#define R_NIOS2_GOT16 22
16.3082 +#define R_NIOS2_CALL16 23
16.3083 +#define R_NIOS2_GOTOFF_LO 24
16.3084 +#define R_NIOS2_GOTOFF_HA 25
16.3085 +#define R_NIOS2_PCREL_LO 26
16.3086 +#define R_NIOS2_PCREL_HA 27
16.3087 +#define R_NIOS2_TLS_GD16 28
16.3088 +#define R_NIOS2_TLS_LDM16 29
16.3089 +#define R_NIOS2_TLS_LDO16 30
16.3090 +#define R_NIOS2_TLS_IE16 31
16.3091 +#define R_NIOS2_TLS_LE16 32
16.3092 +#define R_NIOS2_TLS_DTPMOD 33
16.3093 +#define R_NIOS2_TLS_DTPREL 34
16.3094 +#define R_NIOS2_TLS_TPREL 35
16.3095 +#define R_NIOS2_COPY 36
16.3096 +#define R_NIOS2_GLOB_DAT 37
16.3097 +#define R_NIOS2_JUMP_SLOT 38
16.3098 +#define R_NIOS2_RELATIVE 39
16.3099 +#define R_NIOS2_GOTOFF 40
16.3100 +#define R_NIOS2_CALL26_NOAT 41
16.3101 +#define R_NIOS2_GOT_LO 42
16.3102 +#define R_NIOS2_GOT_HA 43
16.3103 +#define R_NIOS2_CALL_LO 44
16.3104 +#define R_NIOS2_CALL_HA 45
16.3105 +
16.3106 +#define R_OR1K_NONE 0
16.3107 +#define R_OR1K_32 1
16.3108 +#define R_OR1K_16 2
16.3109 +#define R_OR1K_8 3
16.3110 +#define R_OR1K_LO_16_IN_INSN 4
16.3111 +#define R_OR1K_HI_16_IN_INSN 5
16.3112 +#define R_OR1K_INSN_REL_26 6
16.3113 +#define R_OR1K_GNU_VTENTRY 7
16.3114 +#define R_OR1K_GNU_VTINHERIT 8
16.3115 +#define R_OR1K_32_PCREL 9
16.3116 +#define R_OR1K_16_PCREL 10
16.3117 +#define R_OR1K_8_PCREL 11
16.3118 +#define R_OR1K_GOTPC_HI16 12
16.3119 +#define R_OR1K_GOTPC_LO16 13
16.3120 +#define R_OR1K_GOT16 14
16.3121 +#define R_OR1K_PLT26 15
16.3122 +#define R_OR1K_GOTOFF_HI16 16
16.3123 +#define R_OR1K_GOTOFF_LO16 17
16.3124 +#define R_OR1K_COPY 18
16.3125 +#define R_OR1K_GLOB_DAT 19
16.3126 +#define R_OR1K_JMP_SLOT 20
16.3127 +#define R_OR1K_RELATIVE 21
16.3128 +#define R_OR1K_TLS_GD_HI16 22
16.3129 +#define R_OR1K_TLS_GD_LO16 23
16.3130 +#define R_OR1K_TLS_LDM_HI16 24
16.3131 +#define R_OR1K_TLS_LDM_LO16 25
16.3132 +#define R_OR1K_TLS_LDO_HI16 26
16.3133 +#define R_OR1K_TLS_LDO_LO16 27
16.3134 +#define R_OR1K_TLS_IE_HI16 28
16.3135 +#define R_OR1K_TLS_IE_LO16 29
16.3136 +#define R_OR1K_TLS_LE_HI16 30
16.3137 +#define R_OR1K_TLS_LE_LO16 31
16.3138 +#define R_OR1K_TLS_TPOFF 32
16.3139 +#define R_OR1K_TLS_DTPOFF 33
16.3140 +#define R_OR1K_TLS_DTPMOD 34
16.3141 +
16.3142 +#define R_BPF_NONE 0
16.3143 +#define R_BPF_MAP_FD 1
16.3144 +
16.3145 +#ifdef __cplusplus
16.3146 +}
16.3147 +#endif
16.3148 +
16.3149 +
16.3150 +#endif
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/include/envlock.h Mon Oct 21 16:11:07 2019 +0200
17.3 @@ -0,0 +1,15 @@
17.4 +/* envlock.h -- header file for env routines. */
17.5 +
17.6 +#ifndef _INCLUDE_ENVLOCK_H_
17.7 +#define _INCLUDE_ENVLOCK_H_
17.8 +
17.9 +#include <_ansi.h>
17.10 +#include <sys/reent.h>
17.11 +
17.12 +#define ENV_LOCK __env_lock(reent_ptr)
17.13 +#define ENV_UNLOCK __env_unlock(reent_ptr)
17.14 +
17.15 +void __env_lock (struct _reent *reent);
17.16 +void __env_unlock (struct _reent *reent);
17.17 +
17.18 +#endif /* _INCLUDE_ENVLOCK_H_ */
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/include/envz.h Mon Oct 21 16:11:07 2019 +0200
18.3 @@ -0,0 +1,16 @@
18.4 +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
18.5 + *
18.6 + * Permission to use, copy, modify, and distribute this software
18.7 + * is freely granted, provided that this notice is preserved.
18.8 + */
18.9 +
18.10 +#include <errno.h>
18.11 +#include <sys/types.h>
18.12 +
18.13 +/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
18.14 +char * envz_entry (const char *envz, size_t envz_len, const char *name);
18.15 +char * envz_get (const char *envz, size_t envz_len, const char *name);
18.16 +error_t envz_add (char **envz, size_t *envz_len, const char *name, const char *value);
18.17 +error_t envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override);
18.18 +void envz_remove(char **envz, size_t *envz_len, const char *name);
18.19 +void envz_strip (char **envz, size_t *envz_len);
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/include/errno.h Mon Oct 21 16:11:07 2019 +0200
19.3 @@ -0,0 +1,11 @@
19.4 +#ifndef __ERRNO_H__
19.5 +#define __ERRNO_H__
19.6 +
19.7 +#ifndef __error_t_defined
19.8 +typedef int error_t;
19.9 +#define __error_t_defined 1
19.10 +#endif
19.11 +
19.12 +#include <sys/errno.h>
19.13 +
19.14 +#endif /* !__ERRNO_H__ */
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/include/fastmath.h Mon Oct 21 16:11:07 2019 +0200
20.3 @@ -0,0 +1,13 @@
20.4 +#ifndef _FASTMATH_H_
20.5 +#ifdef __cplusplus
20.6 +extern "C" {
20.7 +#endif
20.8 +#define _FASTMATH_H_
20.9 +
20.10 +#include <math.h>
20.11 +#include <machine/fastmath.h>
20.12 +
20.13 +#ifdef __cplusplus
20.14 +}
20.15 +#endif
20.16 +#endif /* _FASTMATH_H_ */
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/include/fcntl.h Mon Oct 21 16:11:07 2019 +0200
21.3 @@ -0,0 +1,1 @@
21.4 +#include <sys/fcntl.h>
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/include/fenv.h Mon Oct 21 16:11:07 2019 +0200
22.3 @@ -0,0 +1,42 @@
22.4 +/* Copyright (c) 2017 SiFive Inc. All rights reserved.
22.5 +
22.6 + This copyrighted material is made available to anyone wishing to use,
22.7 + modify, copy, or redistribute it subject to the terms and conditions
22.8 + of the FreeBSD License. This program is distributed in the hope that
22.9 + it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
22.10 + including the implied warranties of MERCHANTABILITY or FITNESS FOR
22.11 + A PARTICULAR PURPOSE. A copy of this license is available at
22.12 + http://www.opensource.org/licenses.
22.13 +*/
22.14 +
22.15 +#ifndef _FENV_H
22.16 +#define _FENV_H
22.17 +
22.18 +#include <sys/fenv.h>
22.19 +
22.20 +#ifdef __cplusplus
22.21 +extern "C" {
22.22 +#endif
22.23 +
22.24 +/* Exception */
22.25 +int feclearexcept(int excepts);
22.26 +int fegetexceptflag(fexcept_t *flagp, int excepts);
22.27 +int feraiseexcept(int excepts);
22.28 +int fesetexceptflag(const fexcept_t *flagp, int excepts);
22.29 +int fetestexcept(int excepts);
22.30 +
22.31 +/* Rounding mode */
22.32 +int fegetround(void);
22.33 +int fesetround(int rounding_mode);
22.34 +
22.35 +/* Float environment */
22.36 +int fegetenv(fenv_t *envp);
22.37 +int feholdexcept(fenv_t *envp);
22.38 +int fesetenv(const fenv_t *envp);
22.39 +int feupdateenv(const fenv_t *envp);
22.40 +
22.41 +#ifdef __cplusplus
22.42 +}
22.43 +#endif
22.44 +
22.45 +#endif
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/include/fnmatch.h Mon Oct 21 16:11:07 2019 +0200
23.3 @@ -0,0 +1,55 @@
23.4 +/*-
23.5 + * Copyright (c) 1992, 1993
23.6 + * The Regents of the University of California. All rights reserved.
23.7 + *
23.8 + * Redistribution and use in source and binary forms, with or without
23.9 + * modification, are permitted provided that the following conditions
23.10 + * are met:
23.11 + * 1. Redistributions of source code must retain the above copyright
23.12 + * notice, this list of conditions and the following disclaimer.
23.13 + * 2. Redistributions in binary form must reproduce the above copyright
23.14 + * notice, this list of conditions and the following disclaimer in the
23.15 + * documentation and/or other materials provided with the distribution.
23.16 + * 4. Neither the name of the University nor the names of its contributors
23.17 + * may be used to endorse or promote products derived from this software
23.18 + * without specific prior written permission.
23.19 + *
23.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.30 + * SUCH DAMAGE.
23.31 + *
23.32 + * $FreeBSD: src/include/fnmatch.h,v 1.10 2002/03/23 17:24:53 imp Exp $
23.33 + * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
23.34 + */
23.35 +
23.36 +#ifndef _FNMATCH_H_
23.37 +#define _FNMATCH_H_
23.38 +
23.39 +#include <sys/cdefs.h>
23.40 +
23.41 +#define FNM_NOMATCH 1 /* Match failed. */
23.42 +
23.43 +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
23.44 +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
23.45 +#define FNM_PERIOD 0x04 /* Period must be matched by period. */
23.46 +
23.47 +#if __GNU_VISIBLE
23.48 +#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
23.49 +#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
23.50 +#define FNM_IGNORECASE FNM_CASEFOLD
23.51 +#define FNM_FILE_NAME FNM_PATHNAME
23.52 +#endif
23.53 +
23.54 +__BEGIN_DECLS
23.55 +int fnmatch(const char *, const char *, int);
23.56 +__END_DECLS
23.57 +
23.58 +#endif /* !_FNMATCH_H_ */
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/include/getopt.h Mon Oct 21 16:11:07 2019 +0200
24.3 @@ -0,0 +1,185 @@
24.4 +/****************************************************************************
24.5 +
24.6 +getopt.h - Read command line options
24.7 +
24.8 +AUTHOR: Gregory Pietsch
24.9 +CREATED Thu Jan 09 22:37:00 1997
24.10 +
24.11 +DESCRIPTION:
24.12 +
24.13 +The getopt() function parses the command line arguments. Its arguments argc
24.14 +and argv are the argument count and array as passed to the main() function
24.15 +on program invocation. The argument optstring is a list of available option
24.16 +characters. If such a character is followed by a colon (`:'), the option
24.17 +takes an argument, which is placed in optarg. If such a character is
24.18 +followed by two colons, the option takes an optional argument, which is
24.19 +placed in optarg. If the option does not take an argument, optarg is NULL.
24.20 +
24.21 +The external variable optind is the index of the next array element of argv
24.22 +to be processed; it communicates from one call to the next which element to
24.23 +process.
24.24 +
24.25 +The getopt_long() function works like getopt() except that it also accepts
24.26 +long options started by two dashes `--'. If these take values, it is either
24.27 +in the form
24.28 +
24.29 +--arg=value
24.30 +
24.31 + or
24.32 +
24.33 +--arg value
24.34 +
24.35 +It takes the additional arguments longopts which is a pointer to the first
24.36 +element of an array of type GETOPT_LONG_OPTION_T, defined below. The last
24.37 +element of the array has to be filled with NULL for the name field.
24.38 +
24.39 +The longind pointer points to the index of the current long option relative
24.40 +to longopts if it is non-NULL.
24.41 +
24.42 +The getopt() function returns the option character if the option was found
24.43 +successfully, `:' if there was a missing parameter for one of the options,
24.44 +`?' for an unknown option character, and EOF for the end of the option list.
24.45 +
24.46 +The getopt_long() function's return value is described below.
24.47 +
24.48 +The function getopt_long_only() is identical to getopt_long(), except that a
24.49 +plus sign `+' can introduce long options as well as `--'.
24.50 +
24.51 +Describe how to deal with options that follow non-option ARGV-elements.
24.52 +
24.53 +If the caller did not specify anything, the default is REQUIRE_ORDER if the
24.54 +environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise.
24.55 +
24.56 +REQUIRE_ORDER means don't recognize them as options; stop option processing
24.57 +when the first non-option is seen. This is what Unix does. This mode of
24.58 +operation is selected by either setting the environment variable
24.59 +POSIXLY_CORRECT, or using `+' as the first character of the optstring
24.60 +parameter.
24.61 +
24.62 +PERMUTE is the default. We permute the contents of ARGV as we scan, so that
24.63 +eventually all the non-options are at the end. This allows options to be
24.64 +given in any order, even with programs that were not written to expect this.
24.65 +
24.66 +RETURN_IN_ORDER is an option available to programs that were written to
24.67 +expect options and other ARGV-elements in any order and that care about the
24.68 +ordering of the two. We describe each non-option ARGV-element as if it were
24.69 +the argument of an option with character code 1. Using `-' as the first
24.70 +character of the optstring parameter selects this mode of operation.
24.71 +
24.72 +The special argument `--' forces an end of option-scanning regardless of the
24.73 +value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause
24.74 +getopt() and friends to return EOF with optind != argc.
24.75 +
24.76 +COPYRIGHT NOTICE AND DISCLAIMER:
24.77 +
24.78 +Copyright (C) 1997 Gregory Pietsch
24.79 +
24.80 +This file and the accompanying getopt.c implementation file are hereby
24.81 +placed in the public domain without restrictions. Just give the author
24.82 +credit, don't claim you wrote it or prevent anyone else from using it.
24.83 +
24.84 +Gregory Pietsch's current e-mail address:
24.85 +gpietsch@comcast.net
24.86 +****************************************************************************/
24.87 +
24.88 +/* This is a glibc-extension header file. */
24.89 +
24.90 +#ifndef GETOPT_H
24.91 +#define GETOPT_H
24.92 +
24.93 +#include <_ansi.h>
24.94 +
24.95 +/* include files needed by this include file */
24.96 +
24.97 +#define no_argument 0
24.98 +#define required_argument 1
24.99 +#define optional_argument 2
24.100 +
24.101 +#ifdef __cplusplus
24.102 +extern "C"
24.103 +{
24.104 +
24.105 +#endif /* __cplusplus */
24.106 +
24.107 +/* types defined by this include file */
24.108 + struct option
24.109 + {
24.110 + const char *name; /* the name of the long option */
24.111 + int has_arg; /* one of the above macros */
24.112 + int *flag; /* determines if getopt_long() returns a
24.113 + * value for a long option; if it is
24.114 + * non-NULL, 0 is returned as a function
24.115 + * value and the value of val is stored in
24.116 + * the area pointed to by flag. Otherwise,
24.117 + * val is returned. */
24.118 + int val; /* determines the value to return if flag is
24.119 + * NULL. */
24.120 +
24.121 + };
24.122 +
24.123 +/* While getopt.h is a glibc extension, the following are newlib extensions.
24.124 + * They are optionally included via the __need_getopt_newlib flag. */
24.125 +
24.126 +#ifdef __need_getopt_newlib
24.127 +
24.128 + /* macros defined by this include file */
24.129 + #define NO_ARG no_argument
24.130 + #define REQUIRED_ARG required_argument
24.131 + #define OPTIONAL_ARG optional_argument
24.132 +
24.133 + /* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically-
24.134 + allocated variable of type struct getopt_data. */
24.135 + #define GETOPT_DATA_INITIALIZER {0,0,0,0,0,0,0}
24.136 +
24.137 + /* These #defines are to make accessing the reentrant functions easier. */
24.138 + #define getopt_r __getopt_r
24.139 + #define getopt_long_r __getopt_long_r
24.140 + #define getopt_long_only_r __getopt_long_only_r
24.141 +
24.142 + /* The getopt_data structure is for reentrancy. Its members are similar to
24.143 + the externally-defined variables. */
24.144 + typedef struct getopt_data
24.145 + {
24.146 + char *optarg;
24.147 + int optind, opterr, optopt, optwhere;
24.148 + int permute_from, num_nonopts;
24.149 + } getopt_data;
24.150 +
24.151 +#endif /* __need_getopt_newlib */
24.152 +
24.153 + /* externally-defined variables */
24.154 + extern char *optarg;
24.155 + extern int optind;
24.156 + extern int opterr;
24.157 + extern int optopt;
24.158 +
24.159 + /* function prototypes */
24.160 + int getopt (int __argc, char *const __argv[], const char *__optstring);
24.161 +
24.162 + int getopt_long (int __argc, char *const __argv[], const char *__shortopts,
24.163 + const struct option * __longopts, int *__longind);
24.164 +
24.165 + int getopt_long_only (int __argc, char *const __argv[], const char *__shortopts,
24.166 + const struct option * __longopts, int *__longind);
24.167 +
24.168 +#ifdef __need_getopt_newlib
24.169 + int __getopt_r (int __argc, char *const __argv[], const char *__optstring,
24.170 + struct getopt_data * __data);
24.171 +
24.172 + int __getopt_long_r (int __argc, char *const __argv[], const char *__shortopts,
24.173 + const struct option * __longopts, int *__longind,
24.174 + struct getopt_data * __data);
24.175 +
24.176 + int __getopt_long_only_r (int __argc, char *const __argv[], const char *__shortopts,
24.177 + const struct option * __longopts, int *__longind,
24.178 + struct getopt_data * __data);
24.179 +#endif /* __need_getopt_newlib */
24.180 +
24.181 +#ifdef __cplusplus
24.182 +};
24.183 +
24.184 +#endif /* __cplusplus */
24.185 +
24.186 +#endif /* GETOPT_H */
24.187 +
24.188 +/* END OF FILE getopt.h */
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/include/glob.h Mon Oct 21 16:11:07 2019 +0200
25.3 @@ -0,0 +1,90 @@
25.4 +/*
25.5 + * Copyright (c) 1989, 1993
25.6 + * The Regents of the University of California. All rights reserved.
25.7 + *
25.8 + * This code is derived from software contributed to Berkeley by
25.9 + * Guido van Rossum.
25.10 + *
25.11 + * Redistribution and use in source and binary forms, with or without
25.12 + * modification, are permitted provided that the following conditions
25.13 + * are met:
25.14 + * 1. Redistributions of source code must retain the above copyright
25.15 + * notice, this list of conditions and the following disclaimer.
25.16 + * 2. Redistributions in binary form must reproduce the above copyright
25.17 + * notice, this list of conditions and the following disclaimer in the
25.18 + * documentation and/or other materials provided with the distribution.
25.19 + * 4. Neither the name of the University nor the names of its contributors
25.20 + * may be used to endorse or promote products derived from this software
25.21 + * without specific prior written permission.
25.22 + *
25.23 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25.24 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.25 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.27 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.28 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.29 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.30 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.31 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.32 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.33 + * SUCH DAMAGE.
25.34 + *
25.35 + * @(#)glob.h 8.1 (Berkeley) 6/2/93
25.36 + * $FreeBSD: src/include/glob.h,v 1.6 2002/03/23 17:24:53 imp Exp $
25.37 + */
25.38 +
25.39 +#ifndef _GLOB_H_
25.40 +#define _GLOB_H_
25.41 +
25.42 +#include <sys/cdefs.h>
25.43 +
25.44 +struct stat;
25.45 +typedef struct {
25.46 + int gl_pathc; /* Count of total paths so far. */
25.47 + int gl_matchc; /* Count of paths matching pattern. */
25.48 + int gl_offs; /* Reserved at beginning of gl_pathv. */
25.49 + int gl_flags; /* Copy of flags parameter to glob. */
25.50 + char **gl_pathv; /* List of paths matching pattern. */
25.51 + /* Copy of errfunc parameter to glob. */
25.52 + int (*gl_errfunc)(const char *, int);
25.53 +
25.54 + /*
25.55 + * Alternate filesystem access methods for glob; replacement
25.56 + * versions of closedir(3), readdir(3), opendir(3), stat(2)
25.57 + * and lstat(2).
25.58 + */
25.59 + void (*gl_closedir)(void *);
25.60 + struct dirent *(*gl_readdir)(void *);
25.61 + void *(*gl_opendir)(const char *);
25.62 + int (*gl_lstat)(const char *, struct stat *);
25.63 + int (*gl_stat)(const char *, struct stat *);
25.64 +} glob_t;
25.65 +
25.66 +#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
25.67 +#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
25.68 +#define GLOB_ERR 0x0004 /* Return on error. */
25.69 +#define GLOB_MARK 0x0008 /* Append / to matching directories. */
25.70 +#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
25.71 +#define GLOB_NOSORT 0x0020 /* Don't sort. */
25.72 +
25.73 +#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
25.74 +#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
25.75 +#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
25.76 +#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
25.77 +#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
25.78 +#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
25.79 +#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
25.80 +
25.81 +/* backwards compatibility, this is the old name for this option */
25.82 +#define GLOB_MAXPATH GLOB_LIMIT
25.83 +
25.84 +#define GLOB_NOSPACE (-1) /* Malloc call failed. */
25.85 +#define GLOB_ABEND (-2) /* Unignored error. */
25.86 +
25.87 +__BEGIN_DECLS
25.88 +int glob(const char *__restrict, int, int (*)(const char *, int),
25.89 + glob_t *__restrict);
25.90 +void globfree(glob_t *);
25.91 +__END_DECLS
25.92 +
25.93 +#endif /* !_GLOB_H_ */
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/include/grp.h Mon Oct 21 16:11:07 2019 +0200
26.3 @@ -0,0 +1,90 @@
26.4 +/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */
26.5 +
26.6 +/*-
26.7 + * Copyright (c) 1989, 1993
26.8 + * The Regents of the University of California. All rights reserved.
26.9 + * (c) UNIX System Laboratories, Inc.
26.10 + * All or some portions of this file are derived from material licensed
26.11 + * to the University of California by American Telephone and Telegraph
26.12 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
26.13 + * the permission of UNIX System Laboratories, Inc.
26.14 + *
26.15 + * Redistribution and use in source and binary forms, with or without
26.16 + * modification, are permitted provided that the following conditions
26.17 + * are met:
26.18 + * 1. Redistributions of source code must retain the above copyright
26.19 + * notice, this list of conditions and the following disclaimer.
26.20 + * 2. Redistributions in binary form must reproduce the above copyright
26.21 + * notice, this list of conditions and the following disclaimer in the
26.22 + * documentation and/or other materials provided with the distribution.
26.23 + * 3. All advertising materials mentioning features or use of this software
26.24 + * must display the following acknowledgement:
26.25 + * This product includes software developed by the University of
26.26 + * California, Berkeley and its contributors.
26.27 + * 4. Neither the name of the University nor the names of its contributors
26.28 + * may be used to endorse or promote products derived from this software
26.29 + * without specific prior written permission.
26.30 + *
26.31 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.32 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26.33 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.34 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.35 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.36 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.37 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.38 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.39 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.40 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.41 + * SUCH DAMAGE.
26.42 + *
26.43 + * @(#)grp.h 8.2 (Berkeley) 1/21/94
26.44 + */
26.45 +
26.46 +#ifndef _GRP_H_
26.47 +#define _GRP_H_
26.48 +
26.49 +#include <sys/cdefs.h>
26.50 +#include <sys/types.h>
26.51 +#ifdef __CYGWIN__
26.52 +#include <cygwin/grp.h>
26.53 +#endif
26.54 +
26.55 +#if __BSD_VISIBLE
26.56 +#define _PATH_GROUP "/etc/group"
26.57 +#endif
26.58 +
26.59 +struct group {
26.60 + char *gr_name; /* group name */
26.61 + char *gr_passwd; /* group password */
26.62 + gid_t gr_gid; /* group id */
26.63 + char **gr_mem; /* group members */
26.64 +};
26.65 +
26.66 +#ifdef __cplusplus
26.67 +extern "C" {
26.68 +#endif
26.69 +
26.70 +#ifndef __INSIDE_CYGWIN__
26.71 +struct group *getgrgid (gid_t);
26.72 +struct group *getgrnam (const char *);
26.73 +#if __MISC_VISIBLE || __POSIX_VISIBLE
26.74 +int getgrnam_r (const char *, struct group *,
26.75 + char *, size_t, struct group **);
26.76 +int getgrgid_r (gid_t, struct group *,
26.77 + char *, size_t, struct group **);
26.78 +#endif /* __MISC_VISIBLE || __POSIX_VISIBLE */
26.79 +#if __MISC_VISIBLE || __XSI_VISIBLE >= 4
26.80 +struct group *getgrent (void);
26.81 +void setgrent (void);
26.82 +void endgrent (void);
26.83 +#endif /* __MISC_VISIBLE || __XSI_VISIBLE >= 4 */
26.84 +#if __BSD_VISIBLE
26.85 +int initgroups (const char *, gid_t);
26.86 +#endif /* __BSD_VISIBLE */
26.87 +#endif /* !__INSIDE_CYGWIN__ */
26.88 +
26.89 +#ifdef __cplusplus
26.90 +}
26.91 +#endif
26.92 +
26.93 +#endif /* !_GRP_H_ */
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/include/iconv.h Mon Oct 21 16:11:07 2019 +0200
27.3 @@ -0,0 +1,63 @@
27.4 +/*
27.5 + * Copyright (c) 2003-2004, Artem B. Bityuckiy, SoftMine Corporation.
27.6 + * Rights transferred to Franklin Electronic Publishers.
27.7 + *
27.8 + * Redistribution and use in source and binary forms, with or without
27.9 + * modification, are permitted provided that the following conditions
27.10 + * are met:
27.11 + * 1. Redistributions of source code must retain the above copyright
27.12 + * notice, this list of conditions and the following disclaimer.
27.13 + * 2. Redistributions in binary form must reproduce the above copyright
27.14 + * notice, this list of conditions and the following disclaimer in the
27.15 + * documentation and/or other materials provided with the distribution.
27.16 + *
27.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
27.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.27 + * SUCH DAMAGE.
27.28 + */
27.29 +#ifndef _ICONV_H_
27.30 +#define _ICONV_H_
27.31 +
27.32 +#include <_ansi.h>
27.33 +#include <reent.h>
27.34 +#include <sys/types.h>
27.35 +#include <sys/_types.h>
27.36 +
27.37 +/* iconv_t: charset conversion descriptor type */
27.38 +typedef _iconv_t iconv_t;
27.39 +
27.40 +_BEGIN_STD_C
27.41 +
27.42 +#ifndef _REENT_ONLY
27.43 +iconv_t
27.44 +iconv_open (const char *, const char *);
27.45 +
27.46 +size_t
27.47 +iconv (iconv_t, char **__restrict, size_t *__restrict,
27.48 + char **__restrict, size_t *__restrict);
27.49 +
27.50 +int
27.51 +iconv_close (iconv_t);
27.52 +#endif
27.53 +
27.54 +iconv_t
27.55 +_iconv_open_r (struct _reent *, const char *, const char *);
27.56 +
27.57 +size_t
27.58 +_iconv_r (struct _reent *, iconv_t, const char **,
27.59 + size_t *, char **, size_t *);
27.60 +
27.61 +int
27.62 +_iconv_close_r (struct _reent *, iconv_t);
27.63 +
27.64 +_END_STD_C
27.65 +
27.66 +#endif /* #ifndef _ICONV_H_ */
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/include/ieeefp.h Mon Oct 21 16:11:07 2019 +0200
28.3 @@ -0,0 +1,295 @@
28.4 +#ifndef _IEEE_FP_H_
28.5 +#define _IEEE_FP_H_
28.6 +
28.7 +#include "_ansi.h"
28.8 +
28.9 +#include <machine/ieeefp.h>
28.10 +#include <float.h>
28.11 +
28.12 +_BEGIN_STD_C
28.13 +
28.14 +/* FIXME FIXME FIXME:
28.15 + Neither of __ieee_{float,double}_shape_type seem to be used anywhere
28.16 + except in libm/test. If that is the case, please delete these from here.
28.17 + If that is not the case, please insert documentation here describing why
28.18 + they're needed. */
28.19 +
28.20 +#ifdef __IEEE_BIG_ENDIAN
28.21 +
28.22 +typedef union
28.23 +{
28.24 + double value;
28.25 + struct
28.26 + {
28.27 + unsigned int sign : 1;
28.28 + unsigned int exponent: 11;
28.29 + unsigned int fraction0:4;
28.30 + unsigned int fraction1:16;
28.31 + unsigned int fraction2:16;
28.32 + unsigned int fraction3:16;
28.33 +
28.34 + } number;
28.35 + struct
28.36 + {
28.37 + unsigned int sign : 1;
28.38 + unsigned int exponent: 11;
28.39 + unsigned int quiet:1;
28.40 + unsigned int function0:3;
28.41 + unsigned int function1:16;
28.42 + unsigned int function2:16;
28.43 + unsigned int function3:16;
28.44 + } nan;
28.45 + struct
28.46 + {
28.47 + unsigned long msw;
28.48 + unsigned long lsw;
28.49 + } parts;
28.50 + long aslong[2];
28.51 +} __ieee_double_shape_type;
28.52 +
28.53 +#elif defined __IEEE_LITTLE_ENDIAN
28.54 +
28.55 +typedef union
28.56 +{
28.57 + double value;
28.58 + struct
28.59 + {
28.60 +#ifdef __SMALL_BITFIELDS
28.61 + unsigned int fraction3:16;
28.62 + unsigned int fraction2:16;
28.63 + unsigned int fraction1:16;
28.64 + unsigned int fraction0: 4;
28.65 +#else
28.66 + unsigned int fraction1:32;
28.67 + unsigned int fraction0:20;
28.68 +#endif
28.69 + unsigned int exponent :11;
28.70 + unsigned int sign : 1;
28.71 + } number;
28.72 + struct
28.73 + {
28.74 +#ifdef __SMALL_BITFIELDS
28.75 + unsigned int function3:16;
28.76 + unsigned int function2:16;
28.77 + unsigned int function1:16;
28.78 + unsigned int function0:3;
28.79 +#else
28.80 + unsigned int function1:32;
28.81 + unsigned int function0:19;
28.82 +#endif
28.83 + unsigned int quiet:1;
28.84 + unsigned int exponent: 11;
28.85 + unsigned int sign : 1;
28.86 + } nan;
28.87 + struct
28.88 + {
28.89 + unsigned long lsw;
28.90 + unsigned long msw;
28.91 + } parts;
28.92 +
28.93 + long aslong[2];
28.94 +
28.95 +} __ieee_double_shape_type;
28.96 +
28.97 +#endif /* __IEEE_LITTLE_ENDIAN */
28.98 +
28.99 +#ifdef __IEEE_BIG_ENDIAN
28.100 +
28.101 +typedef union
28.102 +{
28.103 + float value;
28.104 + struct
28.105 + {
28.106 + unsigned int sign : 1;
28.107 + unsigned int exponent: 8;
28.108 + unsigned int fraction0: 7;
28.109 + unsigned int fraction1: 16;
28.110 + } number;
28.111 + struct
28.112 + {
28.113 + unsigned int sign:1;
28.114 + unsigned int exponent:8;
28.115 + unsigned int quiet:1;
28.116 + unsigned int function0:6;
28.117 + unsigned int function1:16;
28.118 + } nan;
28.119 + long p1;
28.120 +
28.121 +} __ieee_float_shape_type;
28.122 +
28.123 +#elif defined __IEEE_LITTLE_ENDIAN
28.124 +
28.125 +typedef union
28.126 +{
28.127 + float value;
28.128 + struct
28.129 + {
28.130 + unsigned int fraction0: 7;
28.131 + unsigned int fraction1: 16;
28.132 + unsigned int exponent: 8;
28.133 + unsigned int sign : 1;
28.134 + } number;
28.135 + struct
28.136 + {
28.137 + unsigned int function1:16;
28.138 + unsigned int function0:6;
28.139 + unsigned int quiet:1;
28.140 + unsigned int exponent:8;
28.141 + unsigned int sign:1;
28.142 + } nan;
28.143 + long p1;
28.144 +
28.145 +} __ieee_float_shape_type;
28.146 +
28.147 +#endif /* __IEEE_LITTLE_ENDIAN */
28.148 +
28.149 +#ifndef _LDBL_EQ_DBL
28.150 +
28.151 +#ifndef LDBL_MANT_DIG
28.152 +#error "LDBL_MANT_DIG not defined - should be found in float.h"
28.153 +
28.154 +#elif LDBL_MANT_DIG == DBL_MANT_DIG
28.155 +#error "double and long double are the same size but LDBL_EQ_DBL is not defined"
28.156 +
28.157 +#elif LDBL_MANT_DIG == 53
28.158 +/* This happens when doubles are 32-bits and long doubles are 64-bits. */
28.159 +#define EXT_EXPBITS 11
28.160 +#define EXT_FRACHBITS 20
28.161 +#define EXT_FRACLBITS 32
28.162 +#define __ieee_ext_field_type unsigned long
28.163 +
28.164 +#elif LDBL_MANT_DIG == 64
28.165 +#define EXT_EXPBITS 15
28.166 +#define EXT_FRACHBITS 32
28.167 +#define EXT_FRACLBITS 32
28.168 +#define __ieee_ext_field_type unsigned int
28.169 +
28.170 +#elif LDBL_MANT_DIG == 65
28.171 +#define EXT_EXPBITS 15
28.172 +#define EXT_FRACHBITS 32
28.173 +#define EXT_FRACLBITS 32
28.174 +#define __ieee_ext_field_type unsigned int
28.175 +
28.176 +#elif LDBL_MANT_DIG == 112
28.177 +#define EXT_EXPBITS 15
28.178 +#define EXT_FRACHBITS 48
28.179 +#define EXT_FRACLBITS 64
28.180 +#define __ieee_ext_field_type unsigned long long
28.181 +
28.182 +#elif LDBL_MANT_DIG == 113
28.183 +#define EXT_EXPBITS 15
28.184 +#define EXT_FRACHBITS 48
28.185 +#define EXT_FRACLBITS 64
28.186 +#define __ieee_ext_field_type unsigned long long
28.187 +
28.188 +#else
28.189 +#error Unsupported value for LDBL_MANT_DIG
28.190 +#endif
28.191 +
28.192 +#define EXT_EXP_INFNAN ((1 << EXT_EXPBITS) - 1) /* 32767 */
28.193 +#define EXT_EXP_BIAS ((1 << (EXT_EXPBITS - 1)) - 1) /* 16383 */
28.194 +#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
28.195 +
28.196 +typedef struct ieee_ext
28.197 +{
28.198 + __ieee_ext_field_type ext_fracl : EXT_FRACLBITS;
28.199 + __ieee_ext_field_type ext_frach : EXT_FRACHBITS;
28.200 + __ieee_ext_field_type ext_exp : EXT_EXPBITS;
28.201 + __ieee_ext_field_type ext_sign : 1;
28.202 +} ieee_ext;
28.203 +
28.204 +typedef union ieee_ext_u
28.205 +{
28.206 + long double extu_ld;
28.207 + struct ieee_ext extu_ext;
28.208 +} ieee_ext_u;
28.209 +
28.210 +#endif /* ! _LDBL_EQ_DBL */
28.211 +
28.212 +
28.213 +/* FLOATING ROUNDING */
28.214 +
28.215 +typedef int fp_rnd;
28.216 +#define FP_RN 0 /* Round to nearest */
28.217 +#define FP_RM 1 /* Round down */
28.218 +#define FP_RP 2 /* Round up */
28.219 +#define FP_RZ 3 /* Round to zero (trunate) */
28.220 +
28.221 +fp_rnd fpgetround (void);
28.222 +fp_rnd fpsetround (fp_rnd);
28.223 +
28.224 +/* EXCEPTIONS */
28.225 +
28.226 +typedef int fp_except;
28.227 +#define FP_X_INV 0x10 /* Invalid operation */
28.228 +#define FP_X_DX 0x80 /* Divide by zero */
28.229 +#define FP_X_OFL 0x04 /* Overflow exception */
28.230 +#define FP_X_UFL 0x02 /* Underflow exception */
28.231 +#define FP_X_IMP 0x01 /* imprecise exception */
28.232 +
28.233 +fp_except fpgetmask (void);
28.234 +fp_except fpsetmask (fp_except);
28.235 +fp_except fpgetsticky (void);
28.236 +fp_except fpsetsticky (fp_except);
28.237 +
28.238 +/* INTEGER ROUNDING */
28.239 +
28.240 +typedef int fp_rdi;
28.241 +#define FP_RDI_TOZ 0 /* Round to Zero */
28.242 +#define FP_RDI_RD 1 /* Follow float mode */
28.243 +
28.244 +fp_rdi fpgetroundtoi (void);
28.245 +fp_rdi fpsetroundtoi (fp_rdi);
28.246 +
28.247 +#define __IEEE_DBL_EXPBIAS 1023
28.248 +#define __IEEE_FLT_EXPBIAS 127
28.249 +
28.250 +#define __IEEE_DBL_EXPLEN 11
28.251 +#define __IEEE_FLT_EXPLEN 8
28.252 +
28.253 +
28.254 +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1))
28.255 +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1))
28.256 +
28.257 +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1))
28.258 +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1))
28.259 +
28.260 +#define __IEEE_DBL_NAN_EXP 0x7ff
28.261 +#define __IEEE_FLT_NAN_EXP 0xff
28.262 +
28.263 +#ifdef __ieeefp_isnanf
28.264 +#define isnanf(x) __ieeefp_isnanf(x)
28.265 +#endif
28.266 +
28.267 +#ifdef __ieeefp_isinff
28.268 +#define isinff(x) __ieeefp_isinff(x)
28.269 +#endif
28.270 +
28.271 +#ifdef __ieeefp_finitef
28.272 +#define finitef(x) __ieeefp_finitef(x)
28.273 +#endif
28.274 +
28.275 +#ifdef _DOUBLE_IS_32BITS
28.276 +#undef __IEEE_DBL_EXPBIAS
28.277 +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS
28.278 +
28.279 +#undef __IEEE_DBL_EXPLEN
28.280 +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN
28.281 +
28.282 +#undef __IEEE_DBL_FRACLEN
28.283 +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN
28.284 +
28.285 +#undef __IEEE_DBL_MAXPOWTWO
28.286 +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO
28.287 +
28.288 +#undef __IEEE_DBL_NAN_EXP
28.289 +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP
28.290 +
28.291 +#undef __ieee_double_shape_type
28.292 +#define __ieee_double_shape_type __ieee_float_shape_type
28.293 +
28.294 +#endif /* _DOUBLE_IS_32BITS */
28.295 +
28.296 +_END_STD_C
28.297 +
28.298 +#endif /* _IEEE_FP_H_ */
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/include/inttypes.h Mon Oct 21 16:11:07 2019 +0200
29.3 @@ -0,0 +1,345 @@
29.4 +/*
29.5 + * Copyright (c) 2004, 2005 by
29.6 + * Ralf Corsepius, Ulm/Germany. All rights reserved.
29.7 + *
29.8 + * Permission to use, copy, modify, and distribute this software
29.9 + * is freely granted, provided that this notice is preserved.
29.10 + */
29.11 +
29.12 +/**
29.13 + * @file inttypes.h
29.14 + */
29.15 +
29.16 +#ifndef _INTTYPES_H
29.17 +#define _INTTYPES_H
29.18 +
29.19 +#include <newlib.h>
29.20 +#include <sys/config.h>
29.21 +#include <sys/_intsup.h>
29.22 +#include "_ansi.h"
29.23 +#include <stdint.h>
29.24 +#define __need_wchar_t
29.25 +#include <stddef.h>
29.26 +
29.27 +#if __BSD_VISIBLE
29.28 +#include <sys/_locale.h>
29.29 +#endif
29.30 +
29.31 +#define __STRINGIFY(a) #a
29.32 +
29.33 +/* 8-bit types */
29.34 +#define __PRI8(x) __INT8 __STRINGIFY(x)
29.35 +#define __PRI8LEAST(x) __LEAST8 __STRINGIFY(x)
29.36 +#define __PRI8FAST(x) __FAST8 __STRINGIFY(x)
29.37 +
29.38 +/* NOTICE: scanning 8-bit types requires use of the hh specifier
29.39 + * which is only supported on newlib platforms that
29.40 + * are built with C99 I/O format support enabled. If the flag in
29.41 + * newlib.h hasn't been set during configuration to indicate this, the 8-bit
29.42 + * scanning format macros are disabled here as they result in undefined
29.43 + * behaviour which can include memory overwrite. Overriding the flag after the
29.44 + * library has been built is not recommended as it will expose the underlying
29.45 + * undefined behaviour.
29.46 + */
29.47 +
29.48 +#if defined(_WANT_IO_C99_FORMATS)
29.49 + #define __SCN8(x) __INT8 __STRINGIFY(x)
29.50 + #define __SCN8LEAST(x) __LEAST8 __STRINGIFY(x)
29.51 + #define __SCN8FAST(x) __FAST8 __STRINGIFY(x)
29.52 +#endif /* _WANT_IO_C99_FORMATS */
29.53 +
29.54 +
29.55 +#define PRId8 __PRI8(d)
29.56 +#define PRIi8 __PRI8(i)
29.57 +#define PRIo8 __PRI8(o)
29.58 +#define PRIu8 __PRI8(u)
29.59 +#define PRIx8 __PRI8(x)
29.60 +#define PRIX8 __PRI8(X)
29.61 +
29.62 +/* Macros below are only enabled for a newlib built with C99 I/O format support. */
29.63 +#if defined(_WANT_IO_C99_FORMATS)
29.64 +
29.65 +#define SCNd8 __SCN8(d)
29.66 +#define SCNi8 __SCN8(i)
29.67 +#define SCNo8 __SCN8(o)
29.68 +#define SCNu8 __SCN8(u)
29.69 +#define SCNx8 __SCN8(x)
29.70 +
29.71 +#endif /* _WANT_IO_C99_FORMATS */
29.72 +
29.73 +
29.74 +#define PRIdLEAST8 __PRI8LEAST(d)
29.75 +#define PRIiLEAST8 __PRI8LEAST(i)
29.76 +#define PRIoLEAST8 __PRI8LEAST(o)
29.77 +#define PRIuLEAST8 __PRI8LEAST(u)
29.78 +#define PRIxLEAST8 __PRI8LEAST(x)
29.79 +#define PRIXLEAST8 __PRI8LEAST(X)
29.80 +
29.81 +/* Macros below are only enabled for a newlib built with C99 I/O format support. */
29.82 +#if defined(_WANT_IO_C99_FORMATS)
29.83 +
29.84 + #define SCNdLEAST8 __SCN8LEAST(d)
29.85 + #define SCNiLEAST8 __SCN8LEAST(i)
29.86 + #define SCNoLEAST8 __SCN8LEAST(o)
29.87 + #define SCNuLEAST8 __SCN8LEAST(u)
29.88 + #define SCNxLEAST8 __SCN8LEAST(x)
29.89 +
29.90 +#endif /* _WANT_IO_C99_FORMATS */
29.91 +
29.92 +#define PRIdFAST8 __PRI8FAST(d)
29.93 +#define PRIiFAST8 __PRI8FAST(i)
29.94 +#define PRIoFAST8 __PRI8FAST(o)
29.95 +#define PRIuFAST8 __PRI8FAST(u)
29.96 +#define PRIxFAST8 __PRI8FAST(x)
29.97 +#define PRIXFAST8 __PRI8FAST(X)
29.98 +
29.99 +/* Macros below are only enabled for a newlib built with C99 I/O format support. */
29.100 +#if defined(_WANT_IO_C99_FORMATS)
29.101 +
29.102 + #define SCNdFAST8 __SCN8FAST(d)
29.103 + #define SCNiFAST8 __SCN8FAST(i)
29.104 + #define SCNoFAST8 __SCN8FAST(o)
29.105 + #define SCNuFAST8 __SCN8FAST(u)
29.106 + #define SCNxFAST8 __SCN8FAST(x)
29.107 +
29.108 +#endif /* _WANT_IO_C99_FORMATS */
29.109 +
29.110 +/* 16-bit types */
29.111 +#define __PRI16(x) __INT16 __STRINGIFY(x)
29.112 +#define __PRI16LEAST(x) __LEAST16 __STRINGIFY(x)
29.113 +#define __PRI16FAST(x) __FAST16 __STRINGIFY(x)
29.114 +#define __SCN16(x) __INT16 __STRINGIFY(x)
29.115 +#define __SCN16LEAST(x) __LEAST16 __STRINGIFY(x)
29.116 +#define __SCN16FAST(x) __FAST16 __STRINGIFY(x)
29.117 +
29.118 +
29.119 +#define PRId16 __PRI16(d)
29.120 +#define PRIi16 __PRI16(i)
29.121 +#define PRIo16 __PRI16(o)
29.122 +#define PRIu16 __PRI16(u)
29.123 +#define PRIx16 __PRI16(x)
29.124 +#define PRIX16 __PRI16(X)
29.125 +
29.126 +#define SCNd16 __SCN16(d)
29.127 +#define SCNi16 __SCN16(i)
29.128 +#define SCNo16 __SCN16(o)
29.129 +#define SCNu16 __SCN16(u)
29.130 +#define SCNx16 __SCN16(x)
29.131 +
29.132 +
29.133 +#define PRIdLEAST16 __PRI16LEAST(d)
29.134 +#define PRIiLEAST16 __PRI16LEAST(i)
29.135 +#define PRIoLEAST16 __PRI16LEAST(o)
29.136 +#define PRIuLEAST16 __PRI16LEAST(u)
29.137 +#define PRIxLEAST16 __PRI16LEAST(x)
29.138 +#define PRIXLEAST16 __PRI16LEAST(X)
29.139 +
29.140 +#define SCNdLEAST16 __SCN16LEAST(d)
29.141 +#define SCNiLEAST16 __SCN16LEAST(i)
29.142 +#define SCNoLEAST16 __SCN16LEAST(o)
29.143 +#define SCNuLEAST16 __SCN16LEAST(u)
29.144 +#define SCNxLEAST16 __SCN16LEAST(x)
29.145 +
29.146 +
29.147 +#define PRIdFAST16 __PRI16FAST(d)
29.148 +#define PRIiFAST16 __PRI16FAST(i)
29.149 +#define PRIoFAST16 __PRI16FAST(o)
29.150 +#define PRIuFAST16 __PRI16FAST(u)
29.151 +#define PRIxFAST16 __PRI16FAST(x)
29.152 +#define PRIXFAST16 __PRI16FAST(X)
29.153 +
29.154 +#define SCNdFAST16 __SCN16FAST(d)
29.155 +#define SCNiFAST16 __SCN16FAST(i)
29.156 +#define SCNoFAST16 __SCN16FAST(o)
29.157 +#define SCNuFAST16 __SCN16FAST(u)
29.158 +#define SCNxFAST16 __SCN16FAST(x)
29.159 +
29.160 +/* 32-bit types */
29.161 +#define __PRI32(x) __INT32 __STRINGIFY(x)
29.162 +#define __SCN32(x) __INT32 __STRINGIFY(x)
29.163 +#define __PRI32LEAST(x) __LEAST32 __STRINGIFY(x)
29.164 +#define __SCN32LEAST(x) __LEAST32 __STRINGIFY(x)
29.165 +#define __PRI32FAST(x) __FAST32 __STRINGIFY(x)
29.166 +#define __SCN32FAST(x) __FAST32 __STRINGIFY(x)
29.167 +
29.168 +#define PRId32 __PRI32(d)
29.169 +#define PRIi32 __PRI32(i)
29.170 +#define PRIo32 __PRI32(o)
29.171 +#define PRIu32 __PRI32(u)
29.172 +#define PRIx32 __PRI32(x)
29.173 +#define PRIX32 __PRI32(X)
29.174 +
29.175 +#define SCNd32 __SCN32(d)
29.176 +#define SCNi32 __SCN32(i)
29.177 +#define SCNo32 __SCN32(o)
29.178 +#define SCNu32 __SCN32(u)
29.179 +#define SCNx32 __SCN32(x)
29.180 +
29.181 +
29.182 +#define PRIdLEAST32 __PRI32LEAST(d)
29.183 +#define PRIiLEAST32 __PRI32LEAST(i)
29.184 +#define PRIoLEAST32 __PRI32LEAST(o)
29.185 +#define PRIuLEAST32 __PRI32LEAST(u)
29.186 +#define PRIxLEAST32 __PRI32LEAST(x)
29.187 +#define PRIXLEAST32 __PRI32LEAST(X)
29.188 +
29.189 +#define SCNdLEAST32 __SCN32LEAST(d)
29.190 +#define SCNiLEAST32 __SCN32LEAST(i)
29.191 +#define SCNoLEAST32 __SCN32LEAST(o)
29.192 +#define SCNuLEAST32 __SCN32LEAST(u)
29.193 +#define SCNxLEAST32 __SCN32LEAST(x)
29.194 +
29.195 +
29.196 +#define PRIdFAST32 __PRI32FAST(d)
29.197 +#define PRIiFAST32 __PRI32FAST(i)
29.198 +#define PRIoFAST32 __PRI32FAST(o)
29.199 +#define PRIuFAST32 __PRI32FAST(u)
29.200 +#define PRIxFAST32 __PRI32FAST(x)
29.201 +#define PRIXFAST32 __PRI32FAST(X)
29.202 +
29.203 +#define SCNdFAST32 __SCN32FAST(d)
29.204 +#define SCNiFAST32 __SCN32FAST(i)
29.205 +#define SCNoFAST32 __SCN32FAST(o)
29.206 +#define SCNuFAST32 __SCN32FAST(u)
29.207 +#define SCNxFAST32 __SCN32FAST(x)
29.208 +
29.209 +
29.210 +/* 64-bit types */
29.211 +#define __PRI64(x) __INT64 __STRINGIFY(x)
29.212 +#define __SCN64(x) __INT64 __STRINGIFY(x)
29.213 +
29.214 +#define __PRI64LEAST(x) __LEAST64 __STRINGIFY(x)
29.215 +#define __SCN64LEAST(x) __LEAST64 __STRINGIFY(x)
29.216 +#define __PRI64FAST(x) __FAST64 __STRINGIFY(x)
29.217 +#define __SCN64FAST(x) __FAST64 __STRINGIFY(x)
29.218 +
29.219 +#if __int64_t_defined
29.220 +#define PRId64 __PRI64(d)
29.221 +#define PRIi64 __PRI64(i)
29.222 +#define PRIo64 __PRI64(o)
29.223 +#define PRIu64 __PRI64(u)
29.224 +#define PRIx64 __PRI64(x)
29.225 +#define PRIX64 __PRI64(X)
29.226 +
29.227 +#define SCNd64 __SCN64(d)
29.228 +#define SCNi64 __SCN64(i)
29.229 +#define SCNo64 __SCN64(o)
29.230 +#define SCNu64 __SCN64(u)
29.231 +#define SCNx64 __SCN64(x)
29.232 +#endif
29.233 +
29.234 +#if __int_least64_t_defined
29.235 +#define PRIdLEAST64 __PRI64LEAST(d)
29.236 +#define PRIiLEAST64 __PRI64LEAST(i)
29.237 +#define PRIoLEAST64 __PRI64LEAST(o)
29.238 +#define PRIuLEAST64 __PRI64LEAST(u)
29.239 +#define PRIxLEAST64 __PRI64LEAST(x)
29.240 +#define PRIXLEAST64 __PRI64LEAST(X)
29.241 +
29.242 +#define SCNdLEAST64 __SCN64LEAST(d)
29.243 +#define SCNiLEAST64 __SCN64LEAST(i)
29.244 +#define SCNoLEAST64 __SCN64LEAST(o)
29.245 +#define SCNuLEAST64 __SCN64LEAST(u)
29.246 +#define SCNxLEAST64 __SCN64LEAST(x)
29.247 +#endif
29.248 +
29.249 +#if __int_fast64_t_defined
29.250 +#define PRIdFAST64 __PRI64FAST(d)
29.251 +#define PRIiFAST64 __PRI64FAST(i)
29.252 +#define PRIoFAST64 __PRI64FAST(o)
29.253 +#define PRIuFAST64 __PRI64FAST(u)
29.254 +#define PRIxFAST64 __PRI64FAST(x)
29.255 +#define PRIXFAST64 __PRI64FAST(X)
29.256 +
29.257 +#define SCNdFAST64 __SCN64FAST(d)
29.258 +#define SCNiFAST64 __SCN64FAST(i)
29.259 +#define SCNoFAST64 __SCN64FAST(o)
29.260 +#define SCNuFAST64 __SCN64FAST(u)
29.261 +#define SCNxFAST64 __SCN64FAST(x)
29.262 +#endif
29.263 +
29.264 +/* max-bit types */
29.265 +#if __have_long64
29.266 +#define __PRIMAX(x) __STRINGIFY(l##x)
29.267 +#define __SCNMAX(x) __STRINGIFY(l##x)
29.268 +#elif __have_longlong64
29.269 +#define __PRIMAX(x) __STRINGIFY(ll##x)
29.270 +#define __SCNMAX(x) __STRINGIFY(ll##x)
29.271 +#else
29.272 +#define __PRIMAX(x) __STRINGIFY(x)
29.273 +#define __SCNMAX(x) __STRINGIFY(x)
29.274 +#endif
29.275 +
29.276 +#define PRIdMAX __PRIMAX(d)
29.277 +#define PRIiMAX __PRIMAX(i)
29.278 +#define PRIoMAX __PRIMAX(o)
29.279 +#define PRIuMAX __PRIMAX(u)
29.280 +#define PRIxMAX __PRIMAX(x)
29.281 +#define PRIXMAX __PRIMAX(X)
29.282 +
29.283 +#define SCNdMAX __SCNMAX(d)
29.284 +#define SCNiMAX __SCNMAX(i)
29.285 +#define SCNoMAX __SCNMAX(o)
29.286 +#define SCNuMAX __SCNMAX(u)
29.287 +#define SCNxMAX __SCNMAX(x)
29.288 +
29.289 +/* ptr types */
29.290 +#if defined (_INTPTR_EQ_LONGLONG)
29.291 +# define __PRIPTR(x) __STRINGIFY(ll##x)
29.292 +# define __SCNPTR(x) __STRINGIFY(ll##x)
29.293 +#elif defined (_INTPTR_EQ_LONG)
29.294 +# define __PRIPTR(x) __STRINGIFY(l##x)
29.295 +# define __SCNPTR(x) __STRINGIFY(l##x)
29.296 +#else
29.297 +# define __PRIPTR(x) __STRINGIFY(x)
29.298 +# define __SCNPTR(x) __STRINGIFY(x)
29.299 +#endif
29.300 +
29.301 +#define PRIdPTR __PRIPTR(d)
29.302 +#define PRIiPTR __PRIPTR(i)
29.303 +#define PRIoPTR __PRIPTR(o)
29.304 +#define PRIuPTR __PRIPTR(u)
29.305 +#define PRIxPTR __PRIPTR(x)
29.306 +#define PRIXPTR __PRIPTR(X)
29.307 +
29.308 +#define SCNdPTR __SCNPTR(d)
29.309 +#define SCNiPTR __SCNPTR(i)
29.310 +#define SCNoPTR __SCNPTR(o)
29.311 +#define SCNuPTR __SCNPTR(u)
29.312 +#define SCNxPTR __SCNPTR(x)
29.313 +
29.314 +
29.315 +typedef struct {
29.316 + intmax_t quot;
29.317 + intmax_t rem;
29.318 +} imaxdiv_t;
29.319 +
29.320 +struct _reent;
29.321 +
29.322 +#ifdef __cplusplus
29.323 +extern "C" {
29.324 +#endif
29.325 +
29.326 +extern intmax_t imaxabs(intmax_t j);
29.327 +extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
29.328 +extern intmax_t strtoimax(const char *__restrict, char **__restrict, int);
29.329 +extern intmax_t _strtoimax_r(struct _reent *, const char *__restrict, char **__restrict, int);
29.330 +extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
29.331 +extern uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int);
29.332 +extern intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
29.333 +extern intmax_t _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
29.334 +extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
29.335 +extern uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
29.336 +
29.337 +#if __BSD_VISIBLE
29.338 +extern intmax_t strtoimax_l(const char *__restrict, char **_restrict, int, locale_t);
29.339 +extern uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, locale_t);
29.340 +extern intmax_t wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
29.341 +extern uintmax_t wcstoumax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
29.342 +#endif
29.343 +
29.344 +#ifdef __cplusplus
29.345 +}
29.346 +#endif
29.347 +
29.348 +#endif
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/include/langinfo.h Mon Oct 21 16:11:07 2019 +0200
30.3 @@ -0,0 +1,332 @@
30.4 +/*-
30.5 + * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
30.6 + * All rights reserved.
30.7 + *
30.8 + * Redistribution and use in source and binary forms, with or without
30.9 + * modification, are permitted provided that the following conditions
30.10 + * are met:
30.11 + * 1. Redistributions of source code must retain the above copyright
30.12 + * notice, this list of conditions and the following disclaimer.
30.13 + * 2. Redistributions in binary form must reproduce the above copyright
30.14 + * notice, this list of conditions and the following disclaimer in the
30.15 + * documentation and/or other materials provided with the distribution.
30.16 + *
30.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
30.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
30.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.27 + * SUCH DAMAGE.
30.28 + *
30.29 + * $FreeBSD: src/include/langinfo.h,v 1.5 2002/03/23 17:24:53 imp Exp $
30.30 + */
30.31 +
30.32 +#ifndef _LANGINFO_H_
30.33 +#define _LANGINFO_H_
30.34 +
30.35 +#include <sys/cdefs.h>
30.36 +#include <sys/_types.h>
30.37 +#if __POSIX_VISIBLE >= 200809
30.38 +#include <sys/_locale.h>
30.39 +#endif
30.40 +
30.41 +#ifndef _NL_ITEM_DECLARED
30.42 +typedef __nl_item nl_item;
30.43 +#define _NL_ITEM_DECLARED
30.44 +#endif
30.45 +
30.46 +enum
30.47 +{
30.48 + /* POSIX and BSD defined items have to stick to the original values
30.49 + to maintain backward compatibility. */
30.50 + _NL_CTYPE_CODESET_NAME = 0, /* codeset name */
30.51 +#define CODESET _NL_CTYPE_CODESET_NAME
30.52 + D_T_FMT, /* string for formatting date and time */
30.53 +#define D_T_FMT D_T_FMT
30.54 + D_FMT, /* date format string */
30.55 +#define D_FMT D_FMT
30.56 + T_FMT, /* time format string */
30.57 +#define T_FMT T_FMT
30.58 + T_FMT_AMPM, /* a.m. or p.m. time formatting string */
30.59 +#define T_FMT_AMPM T_FMT_AMPM
30.60 + AM_STR, /* Ante Meridian affix */
30.61 +#define AM_STR AM_STR
30.62 + PM_STR, /* Post Meridian affix */
30.63 +#define PM_STR PM_STR
30.64 +
30.65 +/* week day names */
30.66 + DAY_1,
30.67 +#define DAY_1 DAY_1
30.68 + DAY_2,
30.69 +#define DAY_2 DAY_2
30.70 + DAY_3,
30.71 +#define DAY_3 DAY_3
30.72 + DAY_4,
30.73 +#define DAY_4 DAY_4
30.74 + DAY_5,
30.75 +#define DAY_5 DAY_5
30.76 + DAY_6,
30.77 +#define DAY_6 DAY_6
30.78 + DAY_7,
30.79 +#define DAY_7 DAY_7
30.80 +
30.81 +/* abbreviated week day names */
30.82 + ABDAY_1,
30.83 +#define ABDAY_1 ABDAY_1
30.84 + ABDAY_2,
30.85 +#define ABDAY_2 ABDAY_2
30.86 + ABDAY_3,
30.87 +#define ABDAY_3 ABDAY_3
30.88 + ABDAY_4,
30.89 +#define ABDAY_4 ABDAY_4
30.90 + ABDAY_5,
30.91 +#define ABDAY_5 ABDAY_5
30.92 + ABDAY_6,
30.93 +#define ABDAY_6 ABDAY_6
30.94 + ABDAY_7,
30.95 +#define ABDAY_7 ABDAY_7
30.96 +
30.97 +/* month names */
30.98 + MON_1,
30.99 +#define MON_1 MON_1
30.100 + MON_2,
30.101 +#define MON_2 MON_2
30.102 + MON_3,
30.103 +#define MON_3 MON_3
30.104 + MON_4,
30.105 +#define MON_4 MON_4
30.106 + MON_5,
30.107 +#define MON_5 MON_5
30.108 + MON_6,
30.109 +#define MON_6 MON_6
30.110 + MON_7,
30.111 +#define MON_7 MON_7
30.112 + MON_8,
30.113 +#define MON_8 MON_8
30.114 + MON_9,
30.115 +#define MON_9 MON_9
30.116 + MON_10,
30.117 +#define MON_10 MON_10
30.118 + MON_11,
30.119 +#define MON_11 MON_11
30.120 + MON_12,
30.121 +#define MON_12 MON_12
30.122 +
30.123 +/* abbreviated month names */
30.124 + ABMON_1,
30.125 +#define ABMON_1 ABMON_1
30.126 + ABMON_2,
30.127 +#define ABMON_2 ABMON_2
30.128 + ABMON_3,
30.129 +#define ABMON_3 ABMON_3
30.130 + ABMON_4,
30.131 +#define ABMON_4 ABMON_4
30.132 + ABMON_5,
30.133 +#define ABMON_5 ABMON_5
30.134 + ABMON_6,
30.135 +#define ABMON_6 ABMON_6
30.136 + ABMON_7,
30.137 +#define ABMON_7 ABMON_7
30.138 + ABMON_8,
30.139 +#define ABMON_8 ABMON_8
30.140 + ABMON_9,
30.141 +#define ABMON_9 ABMON_9
30.142 + ABMON_10,
30.143 +#define ABMON_10 ABMON_10
30.144 + ABMON_11,
30.145 +#define ABMON_11 ABMON_11
30.146 + ABMON_12,
30.147 +#define ABMON_12 ABMON_12
30.148 +
30.149 + ERA, /* era description segments */
30.150 +#define ERA ERA
30.151 + ERA_D_FMT, /* era date format string */
30.152 +#define ERA_D_FMT ERA_D_FMT
30.153 + ERA_D_T_FMT, /* era date and time format string */
30.154 +#define ERA_D_T_FMT ERA_D_T_FMT
30.155 + ERA_T_FMT, /* era time format string */
30.156 +#define ERA_T_FMT ERA_T_FMT
30.157 + ALT_DIGITS, /* alternative symbols for digits */
30.158 +#define ALT_DIGITS ALT_DIGITS
30.159 +
30.160 + RADIXCHAR, /* radix char */
30.161 +#define RADIXCHAR RADIXCHAR
30.162 + THOUSEP, /* separator for thousands */
30.163 +#define THOUSEP THOUSEP
30.164 +
30.165 + YESEXPR, /* affirmative response expression */
30.166 +#define YESEXPR YESEXPR
30.167 + NOEXPR, /* negative response expression */
30.168 +#define NOEXPR NOEXPR
30.169 + YESSTR, /* affirmative response for yes/no queries */
30.170 +#define YESSTR YESSTR
30.171 + NOSTR, /* negative response for yes/no queries */
30.172 +#define NOSTR NOSTR
30.173 +
30.174 + CRNCYSTR, /* currency symbol */
30.175 +#define CRNCYSTR CRNCYSTR
30.176 +
30.177 + D_MD_ORDER, /* month/day order (BSD extension) */
30.178 +#define D_MD_ORDER D_MD_ORDER
30.179 +
30.180 + _NL_TIME_DATE_FMT = 84, /* date fmt used by date(1) (GNU extension) */
30.181 +#define _DATE_FMT _NL_TIME_DATE_FMT
30.182 +
30.183 +#ifdef __HAVE_LOCALE_INFO__
30.184 + _NL_CTYPE_MB_CUR_MAX,
30.185 + _NL_MESSAGES_CODESET,
30.186 +
30.187 +#ifdef __HAVE_LOCALE_INFO_EXTENDED__
30.188 +
30.189 + /* NOTE:
30.190 +
30.191 + Always maintain the order and position of existing entries!
30.192 + Always append new entry to the list, prior to the definition
30.193 + of _NL_LOCALE_EXTENDED_LAST_ENTRY. */
30.194 +
30.195 + _NL_LOCALE_EXTENDED_FIRST_ENTRY,
30.196 +
30.197 + _NL_CTYPE_OUTDIGITS0_MB,
30.198 + _NL_CTYPE_OUTDIGITS1_MB,
30.199 + _NL_CTYPE_OUTDIGITS2_MB,
30.200 + _NL_CTYPE_OUTDIGITS3_MB,
30.201 + _NL_CTYPE_OUTDIGITS4_MB,
30.202 + _NL_CTYPE_OUTDIGITS5_MB,
30.203 + _NL_CTYPE_OUTDIGITS6_MB,
30.204 + _NL_CTYPE_OUTDIGITS7_MB,
30.205 + _NL_CTYPE_OUTDIGITS8_MB,
30.206 + _NL_CTYPE_OUTDIGITS9_MB,
30.207 + _NL_CTYPE_OUTDIGITS0_WC,
30.208 + _NL_CTYPE_OUTDIGITS1_WC,
30.209 + _NL_CTYPE_OUTDIGITS2_WC,
30.210 + _NL_CTYPE_OUTDIGITS3_WC,
30.211 + _NL_CTYPE_OUTDIGITS4_WC,
30.212 + _NL_CTYPE_OUTDIGITS5_WC,
30.213 + _NL_CTYPE_OUTDIGITS6_WC,
30.214 + _NL_CTYPE_OUTDIGITS7_WC,
30.215 + _NL_CTYPE_OUTDIGITS8_WC,
30.216 + _NL_CTYPE_OUTDIGITS9_WC,
30.217 +
30.218 + _NL_TIME_CODESET,
30.219 + _NL_TIME_WMON_1,
30.220 + _NL_TIME_WMON_2,
30.221 + _NL_TIME_WMON_3,
30.222 + _NL_TIME_WMON_4,
30.223 + _NL_TIME_WMON_5,
30.224 + _NL_TIME_WMON_6,
30.225 + _NL_TIME_WMON_7,
30.226 + _NL_TIME_WMON_8,
30.227 + _NL_TIME_WMON_9,
30.228 + _NL_TIME_WMON_10,
30.229 + _NL_TIME_WMON_11,
30.230 + _NL_TIME_WMON_12,
30.231 + _NL_TIME_WMONTH_1,
30.232 + _NL_TIME_WMONTH_2,
30.233 + _NL_TIME_WMONTH_3,
30.234 + _NL_TIME_WMONTH_4,
30.235 + _NL_TIME_WMONTH_5,
30.236 + _NL_TIME_WMONTH_6,
30.237 + _NL_TIME_WMONTH_7,
30.238 + _NL_TIME_WMONTH_8,
30.239 + _NL_TIME_WMONTH_9,
30.240 + _NL_TIME_WMONTH_10,
30.241 + _NL_TIME_WMONTH_11,
30.242 + _NL_TIME_WMONTH_12,
30.243 + _NL_TIME_WWDAY_1,
30.244 + _NL_TIME_WWDAY_2,
30.245 + _NL_TIME_WWDAY_3,
30.246 + _NL_TIME_WWDAY_4,
30.247 + _NL_TIME_WWDAY_5,
30.248 + _NL_TIME_WWDAY_6,
30.249 + _NL_TIME_WWDAY_7,
30.250 + _NL_TIME_WWEEKDAY_1,
30.251 + _NL_TIME_WWEEKDAY_2,
30.252 + _NL_TIME_WWEEKDAY_3,
30.253 + _NL_TIME_WWEEKDAY_4,
30.254 + _NL_TIME_WWEEKDAY_5,
30.255 + _NL_TIME_WWEEKDAY_6,
30.256 + _NL_TIME_WWEEKDAY_7,
30.257 + _NL_TIME_WT_FMT,
30.258 + _NL_TIME_WD_FMT,
30.259 + _NL_TIME_WD_T_FMT,
30.260 + _NL_TIME_WAM_STR,
30.261 + _NL_TIME_WPM_STR,
30.262 + _NL_TIME_WDATE_FMT,
30.263 + _NL_TIME_WT_FMT_AMPM,
30.264 + _NL_TIME_WERA,
30.265 + _NL_TIME_WERA_D_FMT,
30.266 + _NL_TIME_WERA_D_T_FMT,
30.267 + _NL_TIME_WERA_T_FMT,
30.268 + _NL_TIME_WALT_DIGITS,
30.269 +
30.270 + _NL_NUMERIC_CODESET,
30.271 + _NL_NUMERIC_GROUPING,
30.272 + _NL_NUMERIC_DECIMAL_POINT_WC,
30.273 + _NL_NUMERIC_THOUSANDS_SEP_WC,
30.274 +
30.275 + _NL_MONETARY_INT_CURR_SYMBOL,
30.276 + _NL_MONETARY_CURRENCY_SYMBOL,
30.277 + _NL_MONETARY_MON_DECIMAL_POINT,
30.278 + _NL_MONETARY_MON_THOUSANDS_SEP,
30.279 + _NL_MONETARY_MON_GROUPING,
30.280 + _NL_MONETARY_POSITIVE_SIGN,
30.281 + _NL_MONETARY_NEGATIVE_SIGN,
30.282 + _NL_MONETARY_INT_FRAC_DIGITS,
30.283 + _NL_MONETARY_FRAC_DIGITS,
30.284 + _NL_MONETARY_P_CS_PRECEDES,
30.285 + _NL_MONETARY_P_SEP_BY_SPACE,
30.286 + _NL_MONETARY_N_CS_PRECEDES,
30.287 + _NL_MONETARY_N_SEP_BY_SPACE,
30.288 + _NL_MONETARY_P_SIGN_POSN,
30.289 + _NL_MONETARY_N_SIGN_POSN,
30.290 + _NL_MONETARY_INT_P_CS_PRECEDES,
30.291 + _NL_MONETARY_INT_P_SEP_BY_SPACE,
30.292 + _NL_MONETARY_INT_N_CS_PRECEDES,
30.293 + _NL_MONETARY_INT_N_SEP_BY_SPACE,
30.294 + _NL_MONETARY_INT_P_SIGN_POSN,
30.295 + _NL_MONETARY_INT_N_SIGN_POSN,
30.296 + _NL_MONETARY_CODESET,
30.297 + _NL_MONETARY_WINT_CURR_SYMBOL,
30.298 + _NL_MONETARY_WCURRENCY_SYMBOL,
30.299 + _NL_MONETARY_WMON_DECIMAL_POINT,
30.300 + _NL_MONETARY_WMON_THOUSANDS_SEP,
30.301 + _NL_MONETARY_WPOSITIVE_SIGN,
30.302 + _NL_MONETARY_WNEGATIVE_SIGN,
30.303 +
30.304 + _NL_MESSAGES_WYESEXPR,
30.305 + _NL_MESSAGES_WNOEXPR,
30.306 + _NL_MESSAGES_WYESSTR,
30.307 + _NL_MESSAGES_WNOSTR,
30.308 +
30.309 + _NL_COLLATE_CODESET,
30.310 +
30.311 + /* This MUST be the last entry since it's used to check for an array
30.312 + index in nl_langinfo(). It also must not exceed _NL_LOCALE_NAME_BASE. */
30.313 + _NL_LOCALE_EXTENDED_LAST_ENTRY
30.314 +
30.315 +#endif /* __HAVE_LOCALE_INFO_EXTENDED__ */
30.316 +#endif /* __HAVE_LOCALE_INFO__ */
30.317 +
30.318 +};
30.319 +
30.320 +/* As an extension, nl_langinfo can retrive the name of a locale
30.321 + category, with this mapping from setlocale() category (other than
30.322 + LC_ALL) to nl_item. */
30.323 +#define _NL_LOCALE_NAME_BASE 100000
30.324 +#if __GNU_VISIBLE
30.325 +#define NL_LOCALE_NAME(category) (_NL_LOCALE_NAME_BASE + (category))
30.326 +#endif
30.327 +
30.328 +__BEGIN_DECLS
30.329 +char *nl_langinfo (nl_item);
30.330 +#if __POSIX_VISIBLE >= 200809
30.331 +char *nl_langinfo_l (nl_item, locale_t);
30.332 +#endif
30.333 +__END_DECLS
30.334 +
30.335 +#endif /* !_LANGINFO_H_ */
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/include/libgen.h Mon Oct 21 16:11:07 2019 +0200
31.3 @@ -0,0 +1,37 @@
31.4 +/*
31.5 + * libgen.h - defined by XPG4
31.6 + */
31.7 +
31.8 +#ifndef _LIBGEN_H_
31.9 +#define _LIBGEN_H_
31.10 +
31.11 +#include "_ansi.h"
31.12 +#include <sys/cdefs.h>
31.13 +#include <sys/reent.h>
31.14 +
31.15 +#ifdef __cplusplus
31.16 +extern "C" {
31.17 +#endif
31.18 +
31.19 +/* There are two common basename variants. If you do NOT #include <libgen.h>
31.20 + and you do
31.21 +
31.22 + #define _GNU_SOURCE
31.23 + #include <string.h>
31.24 +
31.25 + you get the GNU version. Otherwise you get the POSIX versionfor which you
31.26 + should #include <libgen.h>i for the function prototype. POSIX requires that
31.27 + #undef basename will still let you invoke the underlying function. However,
31.28 + this also implies that the POSIX version is used in this case. That's made
31.29 + sure here. */
31.30 +#undef basename
31.31 +#define basename __xpg_basename
31.32 +char *basename (char *) __asm__(__ASMNAME("basename"));
31.33 +char *dirname (char *);
31.34 +
31.35 +#ifdef __cplusplus
31.36 +}
31.37 +#endif
31.38 +
31.39 +#endif /* _LIBGEN_H_ */
31.40 +
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/include/limits.h Mon Oct 21 16:11:07 2019 +0200
32.3 @@ -0,0 +1,147 @@
32.4 +#ifndef _LIBC_LIMITS_H_
32.5 +# define _LIBC_LIMITS_H_ 1
32.6 +
32.7 +#include <newlib.h>
32.8 +#include <sys/cdefs.h>
32.9 +#include <sys/syslimits.h>
32.10 +
32.11 +# ifdef _MB_LEN_MAX
32.12 +# define MB_LEN_MAX _MB_LEN_MAX
32.13 +# else
32.14 +# define MB_LEN_MAX 1
32.15 +# endif
32.16 +
32.17 +/* Maximum number of positional arguments, if _WANT_IO_POS_ARGS. */
32.18 +# ifndef NL_ARGMAX
32.19 +# define NL_ARGMAX 32
32.20 +# endif
32.21 +
32.22 +/* if do not have #include_next support, then we
32.23 + have to define the limits here. */
32.24 +# if !defined __GNUC__ || __GNUC__ < 2
32.25 +
32.26 +# ifndef _LIMITS_H
32.27 +# define _LIMITS_H 1
32.28 +
32.29 +# include <sys/config.h>
32.30 +
32.31 +/* Number of bits in a `char'. */
32.32 +# undef CHAR_BIT
32.33 +# define CHAR_BIT 8
32.34 +
32.35 +/* Minimum and maximum values a `signed char' can hold. */
32.36 +# undef SCHAR_MIN
32.37 +# define SCHAR_MIN (-128)
32.38 +# undef SCHAR_MAX
32.39 +# define SCHAR_MAX 127
32.40 +
32.41 +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
32.42 +# undef UCHAR_MAX
32.43 +# define UCHAR_MAX 255
32.44 +
32.45 +/* Minimum and maximum values a `char' can hold. */
32.46 +# ifdef __CHAR_UNSIGNED__
32.47 +# undef CHAR_MIN
32.48 +# define CHAR_MIN 0
32.49 +# undef CHAR_MAX
32.50 +# define CHAR_MAX 255
32.51 +# else
32.52 +# undef CHAR_MIN
32.53 +# define CHAR_MIN (-128)
32.54 +# undef CHAR_MAX
32.55 +# define CHAR_MAX 127
32.56 +# endif
32.57 +
32.58 +/* Minimum and maximum values a `signed short int' can hold. */
32.59 +# undef SHRT_MIN
32.60 +/* For the sake of 16 bit hosts, we may not use -32768 */
32.61 +# define SHRT_MIN (-32767-1)
32.62 +# undef SHRT_MAX
32.63 +# define SHRT_MAX 32767
32.64 +
32.65 +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
32.66 +# undef USHRT_MAX
32.67 +# define USHRT_MAX 65535
32.68 +
32.69 +/* Minimum and maximum values a `signed int' can hold. */
32.70 +# ifndef __INT_MAX__
32.71 +# define __INT_MAX__ 2147483647
32.72 +# endif
32.73 +# undef INT_MIN
32.74 +# define INT_MIN (-INT_MAX-1)
32.75 +# undef INT_MAX
32.76 +# define INT_MAX __INT_MAX__
32.77 +
32.78 +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
32.79 +# undef UINT_MAX
32.80 +# define UINT_MAX (INT_MAX * 2U + 1)
32.81 +
32.82 +/* Minimum and maximum values a `signed long int' can hold.
32.83 + (Same as `int'). */
32.84 +# ifndef __LONG_MAX__
32.85 +# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9)
32.86 +# define __LONG_MAX__ 9223372036854775807L
32.87 +# else
32.88 +# define __LONG_MAX__ 2147483647L
32.89 +# endif /* __alpha__ || sparc64 */
32.90 +# endif
32.91 +# undef LONG_MIN
32.92 +# define LONG_MIN (-LONG_MAX-1)
32.93 +# undef LONG_MAX
32.94 +# define LONG_MAX __LONG_MAX__
32.95 +
32.96 +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
32.97 +# undef ULONG_MAX
32.98 +# define ULONG_MAX (LONG_MAX * 2UL + 1)
32.99 +
32.100 +# ifndef __LONG_LONG_MAX__
32.101 +# define __LONG_LONG_MAX__ 9223372036854775807LL
32.102 +# endif
32.103 +
32.104 +# if __ISO_C_VISIBLE >= 1999
32.105 +/* Minimum and maximum values a `signed long long int' can hold. */
32.106 +# undef LLONG_MIN
32.107 +# define LLONG_MIN (-LLONG_MAX-1)
32.108 +# undef LLONG_MAX
32.109 +# define LLONG_MAX __LONG_LONG_MAX__
32.110 +
32.111 +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
32.112 +# undef ULLONG_MAX
32.113 +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
32.114 +# endif
32.115 +
32.116 +# if __GNU_VISIBLE
32.117 +/* Minimum and maximum values a `signed long long int' can hold. */
32.118 +# undef LONG_LONG_MIN
32.119 +# define LONG_LONG_MIN (-LONG_LONG_MAX-1)
32.120 +# undef LONG_LONG_MAX
32.121 +# define LONG_LONG_MAX __LONG_LONG_MAX__
32.122 +
32.123 +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
32.124 +# undef ULONG_LONG_MAX
32.125 +# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
32.126 +# endif
32.127 +
32.128 +# endif /* _LIMITS_H */
32.129 +# endif /* GCC 2. */
32.130 +
32.131 +#endif /* !_LIBC_LIMITS_H_ */
32.132 +
32.133 +#if defined __GNUC__ && !defined _GCC_LIMITS_H_
32.134 +/* `_GCC_LIMITS_H_' is what GCC's file defines. */
32.135 +# include_next <limits.h>
32.136 +#endif /* __GNUC__ && !_GCC_LIMITS_H_ */
32.137 +
32.138 +#ifndef _POSIX2_RE_DUP_MAX
32.139 +/* The maximum number of repeated occurrences of a regular expression
32.140 + * permitted when using the interval notation `\{M,N\}'. */
32.141 +#define _POSIX2_RE_DUP_MAX 255
32.142 +#endif /* _POSIX2_RE_DUP_MAX */
32.143 +
32.144 +#ifndef ARG_MAX
32.145 +#define ARG_MAX 4096
32.146 +#endif
32.147 +
32.148 +#ifndef PATH_MAX
32.149 +#define PATH_MAX 4096
32.150 +#endif
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/include/locale.h Mon Oct 21 16:11:07 2019 +0200
33.3 @@ -0,0 +1,96 @@
33.4 +/*
33.5 + locale.h
33.6 + Values appropriate for the formatting of monetary and other
33.7 + numberic quantities.
33.8 +*/
33.9 +
33.10 +#ifndef _LOCALE_H_
33.11 +#define _LOCALE_H_
33.12 +
33.13 +#include "_ansi.h"
33.14 +#include <sys/cdefs.h>
33.15 +
33.16 +#define __need_NULL
33.17 +#include <stddef.h>
33.18 +
33.19 +#define LC_ALL 0
33.20 +#define LC_COLLATE 1
33.21 +#define LC_CTYPE 2
33.22 +#define LC_MONETARY 3
33.23 +#define LC_NUMERIC 4
33.24 +#define LC_TIME 5
33.25 +#define LC_MESSAGES 6
33.26 +
33.27 +#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
33.28 +
33.29 +#include <sys/_locale.h>
33.30 +
33.31 +#define LC_ALL_MASK (1 << LC_ALL)
33.32 +#define LC_COLLATE_MASK (1 << LC_COLLATE)
33.33 +#define LC_CTYPE_MASK (1 << LC_CTYPE)
33.34 +#define LC_MONETARY_MASK (1 << LC_MONETARY)
33.35 +#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
33.36 +#define LC_TIME_MASK (1 << LC_TIME)
33.37 +#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
33.38 +
33.39 +#define LC_GLOBAL_LOCALE ((struct __locale_t *) -1)
33.40 +
33.41 +#endif /* __POSIX_VISIBLE >= 200809 */
33.42 +
33.43 +_BEGIN_STD_C
33.44 +
33.45 +struct lconv
33.46 +{
33.47 + char *decimal_point;
33.48 + char *thousands_sep;
33.49 + char *grouping;
33.50 + char *int_curr_symbol;
33.51 + char *currency_symbol;
33.52 + char *mon_decimal_point;
33.53 + char *mon_thousands_sep;
33.54 + char *mon_grouping;
33.55 + char *positive_sign;
33.56 + char *negative_sign;
33.57 + char int_frac_digits;
33.58 + char frac_digits;
33.59 + char p_cs_precedes;
33.60 + char p_sep_by_space;
33.61 + char n_cs_precedes;
33.62 + char n_sep_by_space;
33.63 + char p_sign_posn;
33.64 + char n_sign_posn;
33.65 + char int_n_cs_precedes;
33.66 + char int_n_sep_by_space;
33.67 + char int_n_sign_posn;
33.68 + char int_p_cs_precedes;
33.69 + char int_p_sep_by_space;
33.70 + char int_p_sign_posn;
33.71 +};
33.72 +
33.73 +struct _reent;
33.74 +char *_setlocale_r (struct _reent *, int, const char *);
33.75 +struct lconv *_localeconv_r (struct _reent *);
33.76 +
33.77 +struct __locale_t *_newlocale_r (struct _reent *, int, const char *,
33.78 + struct __locale_t *);
33.79 +void _freelocale_r (struct _reent *, struct __locale_t *);
33.80 +struct __locale_t *_duplocale_r (struct _reent *, struct __locale_t *);
33.81 +struct __locale_t *_uselocale_r (struct _reent *, struct __locale_t *);
33.82 +
33.83 +#ifndef _REENT_ONLY
33.84 +
33.85 +char *setlocale (int, const char *);
33.86 +struct lconv *localeconv (void);
33.87 +
33.88 +#if __POSIX_VISIBLE >= 200809
33.89 +locale_t newlocale (int, const char *, locale_t);
33.90 +void freelocale (locale_t);
33.91 +locale_t duplocale (locale_t);
33.92 +locale_t uselocale (locale_t);
33.93 +#endif /* __POSIX_VISIBLE >= 200809 */
33.94 +
33.95 +#endif /* _REENT_ONLY */
33.96 +
33.97 +_END_STD_C
33.98 +
33.99 +#endif /* _LOCALE_H_ */
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/include/machine/_arc4random.h Mon Oct 21 16:11:07 2019 +0200
34.3 @@ -0,0 +1,1 @@
34.4 +/* Use default implementation, see arc4random.h */
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/include/machine/_default_types.h Mon Oct 21 16:11:07 2019 +0200
35.3 @@ -0,0 +1,250 @@
35.4 +/*
35.5 + * $Id$
35.6 + */
35.7 +
35.8 +#ifndef _MACHINE__DEFAULT_TYPES_H
35.9 +#define _MACHINE__DEFAULT_TYPES_H
35.10 +
35.11 +#include <sys/features.h>
35.12 +
35.13 +/*
35.14 + * Guess on types by examining *_MIN / *_MAX defines.
35.15 + */
35.16 +#if __GNUC_PREREQ (3, 3)
35.17 +/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
35.18 +#define __EXP(x) __##x##__
35.19 +#else
35.20 +/* Fall back to POSIX versions from <limits.h> */
35.21 +#define __EXP(x) x
35.22 +#include <limits.h>
35.23 +#endif
35.24 +
35.25 +/* Check if "long long" is 64bit wide */
35.26 +/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
35.27 +#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
35.28 + || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
35.29 +#define __have_longlong64 1
35.30 +#endif
35.31 +
35.32 +/* Check if "long" is 64bit or 32bit wide */
35.33 +#if __EXP(LONG_MAX) > 0x7fffffff
35.34 +#define __have_long64 1
35.35 +#elif __EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
35.36 +#define __have_long32 1
35.37 +#endif
35.38 +
35.39 +#ifdef __cplusplus
35.40 +extern "C" {
35.41 +#endif
35.42 +
35.43 +#ifdef __INT8_TYPE__
35.44 +typedef __INT8_TYPE__ __int8_t;
35.45 +#ifdef __UINT8_TYPE__
35.46 +typedef __UINT8_TYPE__ __uint8_t;
35.47 +#else
35.48 +typedef unsigned __INT8_TYPE__ __uint8_t;
35.49 +#endif
35.50 +#define ___int8_t_defined 1
35.51 +#elif __EXP(SCHAR_MAX) == 0x7f
35.52 +typedef signed char __int8_t ;
35.53 +typedef unsigned char __uint8_t ;
35.54 +#define ___int8_t_defined 1
35.55 +#endif
35.56 +
35.57 +#ifdef __INT16_TYPE__
35.58 +typedef __INT16_TYPE__ __int16_t;
35.59 +#ifdef __UINT16_TYPE__
35.60 +typedef __UINT16_TYPE__ __uint16_t;
35.61 +#else
35.62 +typedef unsigned __INT16_TYPE__ __uint16_t;
35.63 +#endif
35.64 +#define ___int16_t_defined 1
35.65 +#elif __EXP(INT_MAX) == 0x7fff
35.66 +typedef signed int __int16_t;
35.67 +typedef unsigned int __uint16_t;
35.68 +#define ___int16_t_defined 1
35.69 +#elif __EXP(SHRT_MAX) == 0x7fff
35.70 +typedef signed short __int16_t;
35.71 +typedef unsigned short __uint16_t;
35.72 +#define ___int16_t_defined 1
35.73 +#elif __EXP(SCHAR_MAX) == 0x7fff
35.74 +typedef signed char __int16_t;
35.75 +typedef unsigned char __uint16_t;
35.76 +#define ___int16_t_defined 1
35.77 +#endif
35.78 +
35.79 +#ifdef __INT32_TYPE__
35.80 +typedef __INT32_TYPE__ __int32_t;
35.81 +#ifdef __UINT32_TYPE__
35.82 +typedef __UINT32_TYPE__ __uint32_t;
35.83 +#else
35.84 +typedef unsigned __INT32_TYPE__ __uint32_t;
35.85 +#endif
35.86 +#define ___int32_t_defined 1
35.87 +#elif __EXP(INT_MAX) == 0x7fffffffL
35.88 +typedef signed int __int32_t;
35.89 +typedef unsigned int __uint32_t;
35.90 +#define ___int32_t_defined 1
35.91 +#elif __EXP(LONG_MAX) == 0x7fffffffL
35.92 +typedef signed long __int32_t;
35.93 +typedef unsigned long __uint32_t;
35.94 +#define ___int32_t_defined 1
35.95 +#elif __EXP(SHRT_MAX) == 0x7fffffffL
35.96 +typedef signed short __int32_t;
35.97 +typedef unsigned short __uint32_t;
35.98 +#define ___int32_t_defined 1
35.99 +#elif __EXP(SCHAR_MAX) == 0x7fffffffL
35.100 +typedef signed char __int32_t;
35.101 +typedef unsigned char __uint32_t;
35.102 +#define ___int32_t_defined 1
35.103 +#endif
35.104 +
35.105 +#ifdef __INT64_TYPE__
35.106 +typedef __INT64_TYPE__ __int64_t;
35.107 +#ifdef __UINT64_TYPE__
35.108 +typedef __UINT64_TYPE__ __uint64_t;
35.109 +#else
35.110 +typedef unsigned __INT64_TYPE__ __uint64_t;
35.111 +#endif
35.112 +#define ___int64_t_defined 1
35.113 +#elif __EXP(LONG_MAX) > 0x7fffffff
35.114 +typedef signed long __int64_t;
35.115 +typedef unsigned long __uint64_t;
35.116 +#define ___int64_t_defined 1
35.117 +
35.118 +/* GCC has __LONG_LONG_MAX__ */
35.119 +#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
35.120 +typedef signed long long __int64_t;
35.121 +typedef unsigned long long __uint64_t;
35.122 +#define ___int64_t_defined 1
35.123 +
35.124 +/* POSIX mandates LLONG_MAX in <limits.h> */
35.125 +#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
35.126 +typedef signed long long __int64_t;
35.127 +typedef unsigned long long __uint64_t;
35.128 +#define ___int64_t_defined 1
35.129 +
35.130 +#elif __EXP(INT_MAX) > 0x7fffffff
35.131 +typedef signed int __int64_t;
35.132 +typedef unsigned int __uint64_t;
35.133 +#define ___int64_t_defined 1
35.134 +#endif
35.135 +
35.136 +#ifdef __INT_LEAST8_TYPE__
35.137 +typedef __INT_LEAST8_TYPE__ __int_least8_t;
35.138 +#ifdef __UINT_LEAST8_TYPE__
35.139 +typedef __UINT_LEAST8_TYPE__ __uint_least8_t;
35.140 +#else
35.141 +typedef unsigned __INT_LEAST8_TYPE__ __uint_least8_t;
35.142 +#endif
35.143 +#define ___int_least8_t_defined 1
35.144 +#elif defined(___int8_t_defined)
35.145 +typedef __int8_t __int_least8_t;
35.146 +typedef __uint8_t __uint_least8_t;
35.147 +#define ___int_least8_t_defined 1
35.148 +#elif defined(___int16_t_defined)
35.149 +typedef __int16_t __int_least8_t;
35.150 +typedef __uint16_t __uint_least8_t;
35.151 +#define ___int_least8_t_defined 1
35.152 +#elif defined(___int32_t_defined)
35.153 +typedef __int32_t __int_least8_t;
35.154 +typedef __uint32_t __uint_least8_t;
35.155 +#define ___int_least8_t_defined 1
35.156 +#elif defined(___int64_t_defined)
35.157 +typedef __int64_t __int_least8_t;
35.158 +typedef __uint64_t __uint_least8_t;
35.159 +#define ___int_least8_t_defined 1
35.160 +#endif
35.161 +
35.162 +#ifdef __INT_LEAST16_TYPE__
35.163 +typedef __INT_LEAST16_TYPE__ __int_least16_t;
35.164 +#ifdef __UINT_LEAST16_TYPE__
35.165 +typedef __UINT_LEAST16_TYPE__ __uint_least16_t;
35.166 +#else
35.167 +typedef unsigned __INT_LEAST16_TYPE__ __uint_least16_t;
35.168 +#endif
35.169 +#define ___int_least16_t_defined 1
35.170 +#elif defined(___int16_t_defined)
35.171 +typedef __int16_t __int_least16_t;
35.172 +typedef __uint16_t __uint_least16_t;
35.173 +#define ___int_least16_t_defined 1
35.174 +#elif defined(___int32_t_defined)
35.175 +typedef __int32_t __int_least16_t;
35.176 +typedef __uint32_t __uint_least16_t;
35.177 +#define ___int_least16_t_defined 1
35.178 +#elif defined(___int64_t_defined)
35.179 +typedef __int64_t __int_least16_t;
35.180 +typedef __uint64_t __uint_least16_t;
35.181 +#define ___int_least16_t_defined 1
35.182 +#endif
35.183 +
35.184 +#ifdef __INT_LEAST32_TYPE__
35.185 +typedef __INT_LEAST32_TYPE__ __int_least32_t;
35.186 +#ifdef __UINT_LEAST32_TYPE__
35.187 +typedef __UINT_LEAST32_TYPE__ __uint_least32_t;
35.188 +#else
35.189 +typedef unsigned __INT_LEAST32_TYPE__ __uint_least32_t;
35.190 +#endif
35.191 +#define ___int_least32_t_defined 1
35.192 +#elif defined(___int32_t_defined)
35.193 +typedef __int32_t __int_least32_t;
35.194 +typedef __uint32_t __uint_least32_t;
35.195 +#define ___int_least32_t_defined 1
35.196 +#elif defined(___int64_t_defined)
35.197 +typedef __int64_t __int_least32_t;
35.198 +typedef __uint64_t __uint_least32_t;
35.199 +#define ___int_least32_t_defined 1
35.200 +#endif
35.201 +
35.202 +#ifdef __INT_LEAST64_TYPE__
35.203 +typedef __INT_LEAST64_TYPE__ __int_least64_t;
35.204 +#ifdef __UINT_LEAST64_TYPE__
35.205 +typedef __UINT_LEAST64_TYPE__ __uint_least64_t;
35.206 +#else
35.207 +typedef unsigned __INT_LEAST64_TYPE__ __uint_least64_t;
35.208 +#endif
35.209 +#define ___int_least64_t_defined 1
35.210 +#elif defined(___int64_t_defined)
35.211 +typedef __int64_t __int_least64_t;
35.212 +typedef __uint64_t __uint_least64_t;
35.213 +#define ___int_least64_t_defined 1
35.214 +#endif
35.215 +
35.216 +#if defined(__INTMAX_TYPE__)
35.217 +typedef __INTMAX_TYPE__ __intmax_t;
35.218 +#elif __have_longlong64
35.219 +typedef signed long long __intmax_t;
35.220 +#else
35.221 +typedef signed long __intmax_t;
35.222 +#endif
35.223 +
35.224 +#if defined(__UINTMAX_TYPE__)
35.225 +typedef __UINTMAX_TYPE__ __uintmax_t;
35.226 +#elif __have_longlong64
35.227 +typedef unsigned long long __uintmax_t;
35.228 +#else
35.229 +typedef unsigned long __uintmax_t;
35.230 +#endif
35.231 +
35.232 +#ifdef __INTPTR_TYPE__
35.233 +typedef __INTPTR_TYPE__ __intptr_t;
35.234 +#ifdef __UINTPTR_TYPE__
35.235 +typedef __UINTPTR_TYPE__ __uintptr_t;
35.236 +#else
35.237 +typedef unsigned __INTPTR_TYPE__ __uintptr_t;
35.238 +#endif
35.239 +#elif defined(__PTRDIFF_TYPE__)
35.240 +typedef __PTRDIFF_TYPE__ __intptr_t;
35.241 +typedef unsigned __PTRDIFF_TYPE__ __uintptr_t;
35.242 +#else
35.243 +typedef long __intptr_t;
35.244 +typedef unsigned long __uintptr_t;
35.245 +#endif
35.246 +
35.247 +#undef __EXP
35.248 +
35.249 +#ifdef __cplusplus
35.250 +}
35.251 +#endif
35.252 +
35.253 +#endif /* _MACHINE__DEFAULT_TYPES_H */
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/include/machine/_endian.h Mon Oct 21 16:11:07 2019 +0200
36.3 @@ -0,0 +1,35 @@
36.4 +#ifndef __MACHINE_ENDIAN_H__
36.5 +#error "must be included via <machine/endian.h>"
36.6 +#endif /* !__MACHINE_ENDIAN_H__ */
36.7 +
36.8 +#include <sys/config.h>
36.9 +
36.10 +#ifdef __PPC__
36.11 +/* Get rid of GCC builtin defines on PowerPC */
36.12 +#ifdef _BIG_ENDIAN
36.13 +#undef _BIG_ENDIAN
36.14 +#endif
36.15 +#ifdef _LITTLE_ENDIAN
36.16 +#undef _LITTLE_ENDIAN
36.17 +#endif
36.18 +#endif /* __PPC__ */
36.19 +
36.20 +#ifndef _LITTLE_ENDIAN
36.21 +#define _LITTLE_ENDIAN 1234
36.22 +#endif
36.23 +
36.24 +#ifndef _BIG_ENDIAN
36.25 +#define _BIG_ENDIAN 4321
36.26 +#endif
36.27 +
36.28 +#ifndef _PDP_ENDIAN
36.29 +#define _PDP_ENDIAN 3412
36.30 +#endif
36.31 +
36.32 +#ifndef _BYTE_ORDER
36.33 +#if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BYTES_LITTLE_ENDIAN)
36.34 +#define _BYTE_ORDER _LITTLE_ENDIAN
36.35 +#else
36.36 +#define _BYTE_ORDER _BIG_ENDIAN
36.37 +#endif
36.38 +#endif
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/include/machine/_time.h Mon Oct 21 16:11:07 2019 +0200
37.3 @@ -0,0 +1,3 @@
37.4 +#ifndef _SYS_TIME_H_
37.5 +#error "must be included via <sys/time.h>"
37.6 +#endif /* !_SYS_TIME_H_ */
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/include/machine/_types.h Mon Oct 21 16:11:07 2019 +0200
38.3 @@ -0,0 +1,8 @@
38.4 +/*
38.5 + * $Id$
38.6 + */
38.7 +
38.8 +#ifndef _MACHINE__TYPES_H
38.9 +#define _MACHINE__TYPES_H
38.10 +#include <machine/_default_types.h>
38.11 +#endif
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/include/machine/ansi.h Mon Oct 21 16:11:07 2019 +0200
39.3 @@ -0,0 +1,1 @@
39.4 +/* dummy header file to support BSD compiler */
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/include/machine/endian.h Mon Oct 21 16:11:07 2019 +0200
40.3 @@ -0,0 +1,69 @@
40.4 +#ifndef __MACHINE_ENDIAN_H__
40.5 +#define __MACHINE_ENDIAN_H__
40.6 +
40.7 +#include <sys/cdefs.h>
40.8 +#include <sys/_types.h>
40.9 +#include <machine/_endian.h>
40.10 +
40.11 +#if _BYTE_ORDER == _LITTLE_ENDIAN
40.12 +#define _QUAD_HIGHWORD 1
40.13 +#define _QUAD_LOWWORD 0
40.14 +#else
40.15 +#define _QUAD_HIGHWORD 0
40.16 +#define _QUAD_LOWWORD 1
40.17 +#endif
40.18 +
40.19 +#if __BSD_VISIBLE
40.20 +#define LITTLE_ENDIAN _LITTLE_ENDIAN
40.21 +#define BIG_ENDIAN _BIG_ENDIAN
40.22 +#define PDP_ENDIAN _PDP_ENDIAN
40.23 +#define BYTE_ORDER _BYTE_ORDER
40.24 +#endif
40.25 +
40.26 +#ifdef __GNUC__
40.27 +#define __bswap16(_x) __builtin_bswap16(_x)
40.28 +#define __bswap32(_x) __builtin_bswap32(_x)
40.29 +#define __bswap64(_x) __builtin_bswap64(_x)
40.30 +#else /* __GNUC__ */
40.31 +static __inline __uint16_t
40.32 +__bswap16(__uint16_t _x)
40.33 +{
40.34 +
40.35 + return ((__uint16_t)((_x >> 8) | ((_x << 8) & 0xff00)));
40.36 +}
40.37 +
40.38 +static __inline __uint32_t
40.39 +__bswap32(__uint32_t _x)
40.40 +{
40.41 +
40.42 + return ((__uint32_t)((_x >> 24) | ((_x >> 8) & 0xff00) |
40.43 + ((_x << 8) & 0xff0000) | ((_x << 24) & 0xff000000)));
40.44 +}
40.45 +
40.46 +static __inline __uint64_t
40.47 +__bswap64(__uint64_t _x)
40.48 +{
40.49 +
40.50 + return ((__uint64_t)((_x >> 56) | ((_x >> 40) & 0xff00) |
40.51 + ((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) |
40.52 + ((_x << 8) & ((__uint64_t)0xff << 32)) |
40.53 + ((_x << 24) & ((__uint64_t)0xff << 40)) |
40.54 + ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))));
40.55 +}
40.56 +#endif /* !__GNUC__ */
40.57 +
40.58 +#ifndef __machine_host_to_from_network_defined
40.59 +#if _BYTE_ORDER == _LITTLE_ENDIAN
40.60 +#define __htonl(_x) __bswap32(_x)
40.61 +#define __htons(_x) __bswap16(_x)
40.62 +#define __ntohl(_x) __bswap32(_x)
40.63 +#define __ntohs(_x) __bswap16(_x)
40.64 +#else
40.65 +#define __htonl(_x) ((__uint32_t)(_x))
40.66 +#define __htons(_x) ((__uint16_t)(_x))
40.67 +#define __ntohl(_x) ((__uint32_t)(_x))
40.68 +#define __ntohs(_x) ((__uint16_t)(_x))
40.69 +#endif
40.70 +#endif /* __machine_host_to_from_network_defined */
40.71 +
40.72 +#endif /* __MACHINE_ENDIAN_H__ */
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/include/machine/fastmath.h Mon Oct 21 16:11:07 2019 +0200
41.3 @@ -0,0 +1,98 @@
41.4 +#ifdef __sysvnecv70_target
41.5 +double EXFUN(fast_sin,(double));
41.6 +double EXFUN(fast_cos,(double));
41.7 +double EXFUN(fast_tan,(double));
41.8 +
41.9 +double EXFUN(fast_asin,(double));
41.10 +double EXFUN(fast_acos,(double));
41.11 +double EXFUN(fast_atan,(double));
41.12 +
41.13 +double EXFUN(fast_sinh,(double));
41.14 +double EXFUN(fast_cosh,(double));
41.15 +double EXFUN(fast_tanh,(double));
41.16 +
41.17 +double EXFUN(fast_asinh,(double));
41.18 +double EXFUN(fast_acosh,(double));
41.19 +double EXFUN(fast_atanh,(double));
41.20 +
41.21 +double EXFUN(fast_abs,(double));
41.22 +double EXFUN(fast_sqrt,(double));
41.23 +double EXFUN(fast_exp2,(double));
41.24 +double EXFUN(fast_exp10,(double));
41.25 +double EXFUN(fast_expe,(double));
41.26 +double EXFUN(fast_log10,(double));
41.27 +double EXFUN(fast_log2,(double));
41.28 +double EXFUN(fast_loge,(double));
41.29 +
41.30 +
41.31 +#define sin(x) fast_sin(x)
41.32 +#define cos(x) fast_cos(x)
41.33 +#define tan(x) fast_tan(x)
41.34 +#define asin(x) fast_asin(x)
41.35 +#define acos(x) fast_acos(x)
41.36 +#define atan(x) fast_atan(x)
41.37 +#define sinh(x) fast_sinh(x)
41.38 +#define cosh(x) fast_cosh(x)
41.39 +#define tanh(x) fast_tanh(x)
41.40 +#define asinh(x) fast_asinh(x)
41.41 +#define acosh(x) fast_acosh(x)
41.42 +#define atanh(x) fast_atanh(x)
41.43 +#define abs(x) fast_abs(x)
41.44 +#define sqrt(x) fast_sqrt(x)
41.45 +#define exp2(x) fast_exp2(x)
41.46 +#define exp10(x) fast_exp10(x)
41.47 +#define expe(x) fast_expe(x)
41.48 +#define log10(x) fast_log10(x)
41.49 +#define log2(x) fast_log2(x)
41.50 +#define loge(x) fast_loge(x)
41.51 +
41.52 +/* These functions are in assembler, they really do take floats. This
41.53 + can only be used with a real ANSI compiler */
41.54 +
41.55 +float EXFUN(fast_sinf,(float));
41.56 +float EXFUN(fast_cosf,(float));
41.57 +float EXFUN(fast_tanf,(float));
41.58 +
41.59 +float EXFUN(fast_asinf,(float));
41.60 +float EXFUN(fast_acosf,(float));
41.61 +float EXFUN(fast_atanf,(float));
41.62 +
41.63 +float EXFUN(fast_sinhf,(float));
41.64 +float EXFUN(fast_coshf,(float));
41.65 +float EXFUN(fast_tanhf,(float));
41.66 +
41.67 +float EXFUN(fast_asinhf,(float));
41.68 +float EXFUN(fast_acoshf,(float));
41.69 +float EXFUN(fast_atanhf,(float));
41.70 +
41.71 +float EXFUN(fast_absf,(float));
41.72 +float EXFUN(fast_sqrtf,(float));
41.73 +float EXFUN(fast_exp2f,(float));
41.74 +float EXFUN(fast_exp10f,(float));
41.75 +float EXFUN(fast_expef,(float));
41.76 +float EXFUN(fast_log10f,(float));
41.77 +float EXFUN(fast_log2f,(float));
41.78 +float EXFUN(fast_logef,(float));
41.79 +#define sinf(x) fast_sinf(x)
41.80 +#define cosf(x) fast_cosf(x)
41.81 +#define tanf(x) fast_tanf(x)
41.82 +#define asinf(x) fast_asinf(x)
41.83 +#define acosf(x) fast_acosf(x)
41.84 +#define atanf(x) fast_atanf(x)
41.85 +#define sinhf(x) fast_sinhf(x)
41.86 +#define coshf(x) fast_coshf(x)
41.87 +#define tanhf(x) fast_tanhf(x)
41.88 +#define asinhf(x) fast_asinhf(x)
41.89 +#define acoshf(x) fast_acoshf(x)
41.90 +#define atanhf(x) fast_atanhf(x)
41.91 +#define absf(x) fast_absf(x)
41.92 +#define sqrtf(x) fast_sqrtf(x)
41.93 +#define exp2f(x) fast_exp2f(x)
41.94 +#define exp10f(x) fast_exp10f(x)
41.95 +#define expef(x) fast_expef(x)
41.96 +#define log10f(x) fast_log10f(x)
41.97 +#define log2f(x) fast_log2f(x)
41.98 +#define logef(x) fast_logef(x)
41.99 +/* Override the functions defined in math.h */
41.100 +#endif /* __sysvnecv70_target */
41.101 +
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/include/machine/ieeefp.h Mon Oct 21 16:11:07 2019 +0200
42.3 @@ -0,0 +1,479 @@
42.4 +#ifndef __IEEE_BIG_ENDIAN
42.5 +#ifndef __IEEE_LITTLE_ENDIAN
42.6 +
42.7 +/* This file can define macros to choose variations of the IEEE float
42.8 + format:
42.9 +
42.10 + _FLT_LARGEST_EXPONENT_IS_NORMAL
42.11 +
42.12 + Defined if the float format uses the largest exponent for finite
42.13 + numbers rather than NaN and infinity representations. Such a
42.14 + format cannot represent NaNs or infinities at all, but it's FLT_MAX
42.15 + is twice the IEEE value.
42.16 +
42.17 + _FLT_NO_DENORMALS
42.18 +
42.19 + Defined if the float format does not support IEEE denormals. Every
42.20 + float with a zero exponent is taken to be a zero representation.
42.21 +
42.22 + ??? At the moment, there are no equivalent macros above for doubles and
42.23 + the macros are not fully supported by --enable-newlib-hw-fp.
42.24 +
42.25 + __IEEE_BIG_ENDIAN
42.26 +
42.27 + Defined if the float format is big endian. This is mutually exclusive
42.28 + with __IEEE_LITTLE_ENDIAN.
42.29 +
42.30 + __IEEE_LITTLE_ENDIAN
42.31 +
42.32 + Defined if the float format is little endian. This is mutually exclusive
42.33 + with __IEEE_BIG_ENDIAN.
42.34 +
42.35 + Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
42.36 + platform or error will occur.
42.37 +
42.38 + __IEEE_BYTES_LITTLE_ENDIAN
42.39 +
42.40 + This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
42.41 + whereby multiple words of an IEEE floating point are in big endian order, but the
42.42 + words themselves are little endian with respect to the bytes.
42.43 +
42.44 + _DOUBLE_IS_32BITS
42.45 +
42.46 + This is used on platforms that support double by using the 32-bit IEEE
42.47 + float type.
42.48 +
42.49 + _FLOAT_ARG
42.50 +
42.51 + This represents what type a float arg is passed as. It is used when the type is
42.52 + not promoted to double.
42.53 +
42.54 +
42.55 + __OBSOLETE_MATH_DEFAULT
42.56 +
42.57 + Default value for __OBSOLETE_MATH if that's not set by the user.
42.58 + It should be set here based on predefined feature macros.
42.59 +
42.60 + __OBSOLETE_MATH
42.61 +
42.62 + If set to 1 then some new math code will be disabled and older libm
42.63 + code will be used instead. This is necessary because the new math
42.64 + code does not support all targets, it assumes that the toolchain has
42.65 + ISO C99 support (hexfloat literals, standard fenv semantics), the
42.66 + target has IEEE-754 conforming binary32 float and binary64 double
42.67 + (not mixed endian) representation, standard SNaN representation,
42.68 + double and single precision arithmetics has similar latency and it
42.69 + has no legacy SVID matherr support, only POSIX errno and fenv
42.70 + exception based error handling.
42.71 +*/
42.72 +
42.73 +#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
42.74 +/* ARM traditionally used big-endian words; and within those words the
42.75 + byte ordering was big or little endian depending upon the target.
42.76 + Modern floating-point formats are naturally ordered; in this case
42.77 + __VFP_FP__ will be defined, even if soft-float. */
42.78 +#ifdef __VFP_FP__
42.79 +# ifdef __ARMEL__
42.80 +# define __IEEE_LITTLE_ENDIAN
42.81 +# else
42.82 +# define __IEEE_BIG_ENDIAN
42.83 +# endif
42.84 +# if __ARM_FP & 0x8
42.85 +# define __OBSOLETE_MATH_DEFAULT 0
42.86 +# endif
42.87 +#else
42.88 +# define __IEEE_BIG_ENDIAN
42.89 +# ifdef __ARMEL__
42.90 +# define __IEEE_BYTES_LITTLE_ENDIAN
42.91 +# endif
42.92 +#endif
42.93 +#endif
42.94 +
42.95 +#if defined (__aarch64__)
42.96 +#if defined (__AARCH64EL__)
42.97 +#define __IEEE_LITTLE_ENDIAN
42.98 +#else
42.99 +#define __IEEE_BIG_ENDIAN
42.100 +#endif
42.101 +#define __OBSOLETE_MATH_DEFAULT 0
42.102 +#endif
42.103 +
42.104 +#ifdef __epiphany__
42.105 +#define __IEEE_LITTLE_ENDIAN
42.106 +#define Sudden_Underflow 1
42.107 +#endif
42.108 +
42.109 +#ifdef __hppa__
42.110 +#define __IEEE_BIG_ENDIAN
42.111 +#endif
42.112 +
42.113 +#ifdef __nds32__
42.114 +#ifdef __big_endian__
42.115 +#define __IEEE_BIG_ENDIAN
42.116 +#else
42.117 +#define __IEEE_LITTLE_ENDIAN
42.118 +#endif
42.119 +#endif
42.120 +
42.121 +#ifdef __SPU__
42.122 +#define __IEEE_BIG_ENDIAN
42.123 +
42.124 +#define isfinite(__y) \
42.125 + (__extension__ ({int __cy; \
42.126 + (sizeof (__y) == sizeof (float)) ? (1) : \
42.127 + (__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
42.128 +
42.129 +#define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
42.130 +#define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
42.131 +
42.132 +/*
42.133 + * Macros for use in ieeefp.h. We can't just define the real ones here
42.134 + * (like those above) as we have name space issues when this is *not*
42.135 + * included via generic the ieeefp.h.
42.136 + */
42.137 +#define __ieeefp_isnanf(x) 0
42.138 +#define __ieeefp_isinff(x) 0
42.139 +#define __ieeefp_finitef(x) 1
42.140 +#endif
42.141 +
42.142 +#ifdef __sparc__
42.143 +#ifdef __LITTLE_ENDIAN_DATA__
42.144 +#define __IEEE_LITTLE_ENDIAN
42.145 +#else
42.146 +#define __IEEE_BIG_ENDIAN
42.147 +#endif
42.148 +#endif
42.149 +
42.150 +#if defined(__m68k__) || defined(__mc68000__)
42.151 +#define __IEEE_BIG_ENDIAN
42.152 +#endif
42.153 +
42.154 +#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
42.155 +#define __IEEE_BIG_ENDIAN
42.156 +#ifdef __HAVE_SHORT_DOUBLE__
42.157 +# define _DOUBLE_IS_32BITS
42.158 +#endif
42.159 +#endif
42.160 +
42.161 +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
42.162 +#define __IEEE_BIG_ENDIAN
42.163 +#define _FLOAT_ARG float
42.164 +#define _DOUBLE_IS_32BITS
42.165 +#endif
42.166 +
42.167 +#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
42.168 +#define __IEEE_LITTLE_ENDIAN
42.169 +#define _FLOAT_ARG float
42.170 +#define _DOUBLE_IS_32BITS
42.171 +#endif
42.172 +
42.173 +
42.174 +#ifdef __sh__
42.175 +#ifdef __LITTLE_ENDIAN__
42.176 +#define __IEEE_LITTLE_ENDIAN
42.177 +#else
42.178 +#define __IEEE_BIG_ENDIAN
42.179 +#endif
42.180 +#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
42.181 +#define _DOUBLE_IS_32BITS
42.182 +#endif
42.183 +#endif
42.184 +
42.185 +#ifdef _AM29K
42.186 +#define __IEEE_BIG_ENDIAN
42.187 +#endif
42.188 +
42.189 +#ifdef _WIN32
42.190 +#define __IEEE_LITTLE_ENDIAN
42.191 +#endif
42.192 +
42.193 +#ifdef __i386__
42.194 +#define __IEEE_LITTLE_ENDIAN
42.195 +#endif
42.196 +
42.197 +#ifdef __riscv
42.198 +#define __IEEE_LITTLE_ENDIAN
42.199 +#endif
42.200 +
42.201 +#ifdef __i960__
42.202 +#define __IEEE_LITTLE_ENDIAN
42.203 +#endif
42.204 +
42.205 +#ifdef __lm32__
42.206 +#define __IEEE_BIG_ENDIAN
42.207 +#endif
42.208 +
42.209 +#ifdef __M32R__
42.210 +#define __IEEE_BIG_ENDIAN
42.211 +#endif
42.212 +
42.213 +#ifdef __nvptx__
42.214 +#define __IEEE_LITTLE_ENDIAN
42.215 +#endif
42.216 +
42.217 +#if defined(_C4x) || defined(_C3x)
42.218 +#define __IEEE_BIG_ENDIAN
42.219 +#define _DOUBLE_IS_32BITS
42.220 +#endif
42.221 +
42.222 +#ifdef __TMS320C6X__
42.223 +#ifdef _BIG_ENDIAN
42.224 +#define __IEEE_BIG_ENDIAN
42.225 +#else
42.226 +#define __IEEE_LITTLE_ENDIAN
42.227 +#endif
42.228 +#endif
42.229 +
42.230 +#ifdef __TIC80__
42.231 +#define __IEEE_LITTLE_ENDIAN
42.232 +#endif
42.233 +
42.234 +#ifdef __MIPSEL__
42.235 +#define __IEEE_LITTLE_ENDIAN
42.236 +#endif
42.237 +#ifdef __MIPSEB__
42.238 +#define __IEEE_BIG_ENDIAN
42.239 +#endif
42.240 +
42.241 +#ifdef __MMIX__
42.242 +#define __IEEE_BIG_ENDIAN
42.243 +#endif
42.244 +
42.245 +#ifdef __D30V__
42.246 +#define __IEEE_BIG_ENDIAN
42.247 +#endif
42.248 +
42.249 +/* necv70 was __IEEE_LITTLE_ENDIAN. */
42.250 +
42.251 +#ifdef __W65__
42.252 +#define __IEEE_LITTLE_ENDIAN
42.253 +#define _DOUBLE_IS_32BITS
42.254 +#endif
42.255 +
42.256 +#if defined(__Z8001__) || defined(__Z8002__)
42.257 +#define __IEEE_BIG_ENDIAN
42.258 +#endif
42.259 +
42.260 +#ifdef __m88k__
42.261 +#define __IEEE_BIG_ENDIAN
42.262 +#endif
42.263 +
42.264 +#ifdef __mn10300__
42.265 +#define __IEEE_LITTLE_ENDIAN
42.266 +#endif
42.267 +
42.268 +#ifdef __mn10200__
42.269 +#define __IEEE_LITTLE_ENDIAN
42.270 +#define _DOUBLE_IS_32BITS
42.271 +#endif
42.272 +
42.273 +#ifdef __v800
42.274 +#define __IEEE_LITTLE_ENDIAN
42.275 +#endif
42.276 +
42.277 +#ifdef __v850
42.278 +#define __IEEE_LITTLE_ENDIAN
42.279 +#endif
42.280 +
42.281 +#ifdef __D10V__
42.282 +#define __IEEE_BIG_ENDIAN
42.283 +#if __DOUBLE__ == 32
42.284 +#define _DOUBLE_IS_32BITS
42.285 +#endif
42.286 +#endif
42.287 +
42.288 +#ifdef __PPC__
42.289 +#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
42.290 +#define __IEEE_BIG_ENDIAN
42.291 +#else
42.292 +#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
42.293 +#define __IEEE_LITTLE_ENDIAN
42.294 +#endif
42.295 +#endif
42.296 +#endif
42.297 +
42.298 +#ifdef __xstormy16__
42.299 +#define __IEEE_LITTLE_ENDIAN
42.300 +#endif
42.301 +
42.302 +#ifdef __arc__
42.303 +#ifdef __big_endian__
42.304 +#define __IEEE_BIG_ENDIAN
42.305 +#else
42.306 +#define __IEEE_LITTLE_ENDIAN
42.307 +#endif
42.308 +#endif
42.309 +
42.310 +#ifdef __CRX__
42.311 +#define __IEEE_LITTLE_ENDIAN
42.312 +#endif
42.313 +
42.314 +#ifdef __fr30__
42.315 +#define __IEEE_BIG_ENDIAN
42.316 +#endif
42.317 +
42.318 +#ifdef __FT32__
42.319 +#define __IEEE_LITTLE_ENDIAN
42.320 +#endif
42.321 +
42.322 +#ifdef __mcore__
42.323 +#define __IEEE_BIG_ENDIAN
42.324 +#endif
42.325 +
42.326 +#ifdef __mt__
42.327 +#define __IEEE_BIG_ENDIAN
42.328 +#endif
42.329 +
42.330 +#ifdef __frv__
42.331 +#define __IEEE_BIG_ENDIAN
42.332 +#endif
42.333 +
42.334 +#ifdef __moxie__
42.335 +#ifdef __MOXIE_BIG_ENDIAN__
42.336 +#define __IEEE_BIG_ENDIAN
42.337 +#else
42.338 +#define __IEEE_LITTLE_ENDIAN
42.339 +#endif
42.340 +#endif
42.341 +
42.342 +#ifdef __ia64__
42.343 +#ifdef __BIG_ENDIAN__
42.344 +#define __IEEE_BIG_ENDIAN
42.345 +#else
42.346 +#define __IEEE_LITTLE_ENDIAN
42.347 +#endif
42.348 +#endif
42.349 +
42.350 +#ifdef __AVR__
42.351 +#define __IEEE_LITTLE_ENDIAN
42.352 +#define _DOUBLE_IS_32BITS
42.353 +#endif
42.354 +
42.355 +#if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
42.356 +#define __IEEE_BIG_ENDIAN
42.357 +#endif
42.358 +
42.359 +#ifdef __IP2K__
42.360 +#define __IEEE_BIG_ENDIAN
42.361 +#define __SMALL_BITFIELDS
42.362 +#define _DOUBLE_IS_32BITS
42.363 +#endif
42.364 +
42.365 +#ifdef __iq2000__
42.366 +#define __IEEE_BIG_ENDIAN
42.367 +#endif
42.368 +
42.369 +#ifdef __MAVERICK__
42.370 +#ifdef __ARMEL__
42.371 +# define __IEEE_LITTLE_ENDIAN
42.372 +#else /* must be __ARMEB__ */
42.373 +# define __IEEE_BIG_ENDIAN
42.374 +#endif /* __ARMEL__ */
42.375 +#endif /* __MAVERICK__ */
42.376 +
42.377 +#ifdef __m32c__
42.378 +#define __IEEE_LITTLE_ENDIAN
42.379 +#define __SMALL_BITFIELDS
42.380 +#endif
42.381 +
42.382 +#ifdef __CRIS__
42.383 +#define __IEEE_LITTLE_ENDIAN
42.384 +#endif
42.385 +
42.386 +#ifdef __BFIN__
42.387 +#define __IEEE_LITTLE_ENDIAN
42.388 +#endif
42.389 +
42.390 +#ifdef __x86_64__
42.391 +#define __IEEE_LITTLE_ENDIAN
42.392 +#endif
42.393 +
42.394 +#ifdef __mep__
42.395 +#ifdef __LITTLE_ENDIAN__
42.396 +#define __IEEE_LITTLE_ENDIAN
42.397 +#else
42.398 +#define __IEEE_BIG_ENDIAN
42.399 +#endif
42.400 +#endif
42.401 +
42.402 +#ifdef __MICROBLAZE__
42.403 +#ifndef __MICROBLAZEEL__
42.404 +#define __IEEE_BIG_ENDIAN
42.405 +#else
42.406 +#define __IEEE_LITTLE_ENDIAN
42.407 +#endif
42.408 +#endif
42.409 +
42.410 +#ifdef __MSP430__
42.411 +#define __IEEE_LITTLE_ENDIAN
42.412 +#define __SMALL_BITFIELDS /* 16 Bit INT */
42.413 +#endif
42.414 +
42.415 +#ifdef __RL78__
42.416 +#define __IEEE_LITTLE_ENDIAN
42.417 +#define __SMALL_BITFIELDS /* 16 Bit INT */
42.418 +#ifndef __RL78_64BIT_DOUBLES__
42.419 +#define _DOUBLE_IS_32BITS
42.420 +#endif
42.421 +#endif
42.422 +
42.423 +#ifdef __RX__
42.424 +
42.425 +#ifdef __RX_BIG_ENDIAN__
42.426 +#define __IEEE_BIG_ENDIAN
42.427 +#else
42.428 +#define __IEEE_LITTLE_ENDIAN
42.429 +#endif
42.430 +
42.431 +#ifndef __RX_64BIT_DOUBLES__
42.432 +#define _DOUBLE_IS_32BITS
42.433 +#endif
42.434 +
42.435 +#ifdef __RX_16BIT_INTS__
42.436 +#define __SMALL_BITFIELDS
42.437 +#endif
42.438 +
42.439 +#endif
42.440 +
42.441 +#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
42.442 +#define __IEEE_LITTLE_ENDIAN
42.443 +#define __SMALL_BITFIELDS /* 16 Bit INT */
42.444 +#endif
42.445 +
42.446 +#ifdef __NIOS2__
42.447 +# ifdef __nios2_big_endian__
42.448 +# define __IEEE_BIG_ENDIAN
42.449 +# else
42.450 +# define __IEEE_LITTLE_ENDIAN
42.451 +# endif
42.452 +#endif
42.453 +
42.454 +#ifdef __VISIUM__
42.455 +#define __IEEE_BIG_ENDIAN
42.456 +#endif
42.457 +
42.458 +#ifdef __AMDGCN__
42.459 +#define __IEEE_LITTLE_ENDIAN
42.460 +#endif
42.461 +
42.462 +#ifdef __CYGWIN__
42.463 +#define __OBSOLETE_MATH_DEFAULT 0
42.464 +#endif
42.465 +
42.466 +#ifndef __OBSOLETE_MATH_DEFAULT
42.467 +/* Use old math code by default. */
42.468 +#define __OBSOLETE_MATH_DEFAULT 1
42.469 +#endif
42.470 +#ifndef __OBSOLETE_MATH
42.471 +#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
42.472 +#endif
42.473 +
42.474 +#ifndef __IEEE_BIG_ENDIAN
42.475 +#ifndef __IEEE_LITTLE_ENDIAN
42.476 +#error Endianess not declared!!
42.477 +#endif /* not __IEEE_LITTLE_ENDIAN */
42.478 +#endif /* not __IEEE_BIG_ENDIAN */
42.479 +
42.480 +#endif /* not __IEEE_LITTLE_ENDIAN */
42.481 +#endif /* not __IEEE_BIG_ENDIAN */
42.482 +
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/include/machine/malloc.h Mon Oct 21 16:11:07 2019 +0200
43.3 @@ -0,0 +1,8 @@
43.4 +#ifndef _MACHMALLOC_H_
43.5 +#define _MACHMALLOC_H_
43.6 +
43.7 +/* place holder so platforms may add malloc.h extensions */
43.8 +
43.9 +#endif /* _MACHMALLOC_H_ */
43.10 +
43.11 +
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/include/machine/param.h Mon Oct 21 16:11:07 2019 +0200
44.3 @@ -0,0 +1,1 @@
44.4 +/* Place holder for machine-specific param.h. */
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/include/machine/setjmp-dj.h Mon Oct 21 16:11:07 2019 +0200
45.3 @@ -0,0 +1,43 @@
45.4 +/*
45.5 + * Copyright (C) 1991 DJ Delorie
45.6 + * All rights reserved.
45.7 + *
45.8 + * Redistribution, modification, and use in source and binary forms is permitted
45.9 + * provided that the above copyright notice and following paragraph are
45.10 + * duplicated in all such forms.
45.11 + *
45.12 + * This file is distributed WITHOUT ANY WARRANTY; without even the implied
45.13 + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
45.14 + */
45.15 +
45.16 +/* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid
45.17 + conflicting with setjmp.h. Ian Taylor, Cygnus support, April,
45.18 + 1993. */
45.19 +
45.20 +#ifndef _SETJMP_DJ_H_
45.21 +#define _SETJMP_DJ_H_
45.22 +
45.23 +#ifdef __cplusplus
45.24 +extern "C" {
45.25 +#endif
45.26 +
45.27 +typedef struct {
45.28 + unsigned long eax;
45.29 + unsigned long ebx;
45.30 + unsigned long ecx;
45.31 + unsigned long edx;
45.32 + unsigned long esi;
45.33 + unsigned long edi;
45.34 + unsigned long ebp;
45.35 + unsigned long esp;
45.36 + unsigned long eip;
45.37 +} jmp_buf[1];
45.38 +
45.39 +extern int setjmp(jmp_buf);
45.40 +extern void longjmp(jmp_buf, int);
45.41 +
45.42 +#ifdef __cplusplus
45.43 +}
45.44 +#endif
45.45 +
45.46 +#endif
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/include/machine/setjmp.h Mon Oct 21 16:11:07 2019 +0200
46.3 @@ -0,0 +1,467 @@
46.4 +
46.5 +_BEGIN_STD_C
46.6 +
46.7 +#if defined(__or1k__) || defined(__or1knd__)
46.8 +/*
46.9 + * r1, r2, r9, r14, r16 .. r30, SR.
46.10 + */
46.11 +#define _JBLEN 13
46.12 +#define _JBTYPE unsigned long
46.13 +#endif
46.14 +
46.15 +#if defined(__arm__) || defined(__thumb__)
46.16 +/*
46.17 + * All callee preserved registers:
46.18 + * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
46.19 + */
46.20 +#define _JBLEN 23
46.21 +#endif
46.22 +
46.23 +#if defined(__aarch64__)
46.24 +#define _JBLEN 22
46.25 +#define _JBTYPE long long
46.26 +#endif
46.27 +
46.28 +#if defined(__AVR__)
46.29 +#define _JBLEN 24
46.30 +#endif
46.31 +
46.32 +#ifdef __sparc__
46.33 +/*
46.34 + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
46.35 + * All else recovered by under/over(flow) handling.
46.36 + */
46.37 +#define _JBLEN 13
46.38 +#endif
46.39 +
46.40 +#ifdef __BFIN__
46.41 +#define _JBLEN 40
46.42 +#endif
46.43 +
46.44 +#ifdef __epiphany__
46.45 +/* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */
46.46 +#define _JBTYPE long long
46.47 +#define _JBLEN 10
46.48 +#endif
46.49 +
46.50 +/* necv70 was 9 as well. */
46.51 +
46.52 +#if defined(__m68k__) || defined(__mc68000__)
46.53 +/*
46.54 + * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
46.55 + * fp2-fp7 for 68881.
46.56 + * All else recovered by under/over(flow) handling.
46.57 + */
46.58 +#define _JBLEN 34
46.59 +#endif
46.60 +
46.61 +#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
46.62 +/*
46.63 + * D, X, Y are not saved.
46.64 + * Only take into account the pseudo soft registers (max 32).
46.65 + */
46.66 +#define _JBLEN 32
46.67 +#endif
46.68 +
46.69 +#ifdef __nds32__
46.70 +/* 17 words for GPRs,
46.71 + 1 word for $fpcfg.freg and 30 words for FPUs
46.72 + Reserved 2 words for aligement-adjustment. When storeing double-precision
46.73 + floating-point register into memory, the address has to be
46.74 + double-word-aligned.
46.75 + Check libc/machine/nds32/setjmp.S for more information. */
46.76 +#if __NDS32_EXT_FPU_SP__ || __NDS32_EXT_FPU_DP__
46.77 +#define _JBLEN 50
46.78 +#else
46.79 +#define _JBLEN 18
46.80 +#endif
46.81 +#endif
46.82 +
46.83 +#if defined(__Z8001__) || defined(__Z8002__)
46.84 +/* 16 regs + pc */
46.85 +#define _JBLEN 20
46.86 +#endif
46.87 +
46.88 +#ifdef _AM29K
46.89 +/*
46.90 + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
46.91 + * All else recovered by under/over(flow) handling.
46.92 + */
46.93 +#define _JBLEN 9
46.94 +#endif
46.95 +
46.96 +#ifdef __i386__
46.97 +# if defined(__CYGWIN__) && !defined (_JBLEN)
46.98 +# define _JBLEN (13 * 4)
46.99 +# elif defined(__unix__) || defined(__rtems__)
46.100 +# define _JBLEN 9
46.101 +# elif defined(__iamcu__)
46.102 +/* Intel MCU jmp_buf only covers callee-saved registers. */
46.103 +# define _JBLEN 6
46.104 +# else
46.105 +# include "setjmp-dj.h"
46.106 +# endif
46.107 +#endif
46.108 +
46.109 +#ifdef __x86_64__
46.110 +# ifdef __CYGWIN__
46.111 +# define _JBTYPE long
46.112 +# define _JBLEN 32
46.113 +# else
46.114 +# define _JBTYPE long long
46.115 +# define _JBLEN 8
46.116 +# endif
46.117 +#endif
46.118 +
46.119 +#ifdef __i960__
46.120 +#define _JBLEN 35
46.121 +#endif
46.122 +
46.123 +#ifdef __M32R__
46.124 +/* Only 8 words are currently needed. 10 gives us some slop if we need
46.125 + to expand. */
46.126 +#define _JBLEN 10
46.127 +#endif
46.128 +
46.129 +#ifdef __mips__
46.130 +# if defined(__mips64)
46.131 +# define _JBTYPE long long
46.132 +# endif
46.133 +# ifdef __mips_soft_float
46.134 +# define _JBLEN 11
46.135 +# else
46.136 +# define _JBLEN 23
46.137 +# endif
46.138 +#endif
46.139 +
46.140 +#ifdef __m88000__
46.141 +#define _JBLEN 21
46.142 +#endif
46.143 +
46.144 +#ifdef __H8300__
46.145 +#define _JBLEN 5
46.146 +#define _JBTYPE int
46.147 +#endif
46.148 +
46.149 +#ifdef __H8300H__
46.150 +/* same as H8/300 but registers are twice as big */
46.151 +#define _JBLEN 5
46.152 +#define _JBTYPE long
46.153 +#endif
46.154 +
46.155 +#if defined (__H8300S__) || defined (__H8300SX__)
46.156 +/* same as H8/300 but registers are twice as big */
46.157 +#define _JBLEN 5
46.158 +#define _JBTYPE long
46.159 +#endif
46.160 +
46.161 +#ifdef __H8500__
46.162 +#define _JBLEN 4
46.163 +#endif
46.164 +
46.165 +#ifdef __sh__
46.166 +#if __SH5__
46.167 +#define _JBLEN 50
46.168 +#define _JBTYPE long long
46.169 +#else
46.170 +#define _JBLEN 20
46.171 +#endif /* __SH5__ */
46.172 +#endif
46.173 +
46.174 +#ifdef __v800
46.175 +#define _JBLEN 28
46.176 +#endif
46.177 +
46.178 +#ifdef __PPC__
46.179 +#ifdef __ALTIVEC__
46.180 +#define _JBLEN 64
46.181 +#else
46.182 +#define _JBLEN 32
46.183 +#endif
46.184 +#define _JBTYPE double
46.185 +#endif
46.186 +
46.187 +#ifdef __MICROBLAZE__
46.188 +#define _JBLEN 20
46.189 +#define _JBTYPE unsigned int
46.190 +#endif
46.191 +
46.192 +#ifdef __hppa__
46.193 +/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
46.194 + Note space exists for the FP registers, but they are not
46.195 + saved. */
46.196 +#define _JBLEN 28
46.197 +#endif
46.198 +
46.199 +#if defined(__mn10300__) || defined(__mn10200__)
46.200 +#ifdef __AM33_2__
46.201 +#define _JBLEN 26
46.202 +#else
46.203 +/* A guess */
46.204 +#define _JBLEN 10
46.205 +#endif
46.206 +#endif
46.207 +
46.208 +#ifdef __v850
46.209 +/* I think our setjmp is saving 15 regs at the moment. Gives us one word
46.210 + slop if we need to expand. */
46.211 +#define _JBLEN 16
46.212 +#endif
46.213 +
46.214 +#if defined(_C4x)
46.215 +#define _JBLEN 10
46.216 +#endif
46.217 +#if defined(_C3x)
46.218 +#define _JBLEN 9
46.219 +#endif
46.220 +
46.221 +#ifdef __TMS320C6X__
46.222 +#define _JBLEN 13
46.223 +#endif
46.224 +
46.225 +#ifdef __TIC80__
46.226 +#define _JBLEN 13
46.227 +#endif
46.228 +
46.229 +#ifdef __D10V__
46.230 +#define _JBLEN 8
46.231 +#endif
46.232 +
46.233 +#ifdef __D30V__
46.234 +#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
46.235 +#define _JBTYPE double
46.236 +#endif
46.237 +
46.238 +#ifdef __frv__
46.239 +#define _JBLEN (68/2) /* room for 68 32-bit regs */
46.240 +#define _JBTYPE double
46.241 +#endif
46.242 +
46.243 +#ifdef __moxie__
46.244 +#define _JBLEN 16
46.245 +#endif
46.246 +
46.247 +#ifdef __CRX__
46.248 +#define _JBLEN 9
46.249 +#endif
46.250 +
46.251 +#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
46.252 +/* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H),
46.253 + * r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */
46.254 +#define _JBLEN 14
46.255 +#define _JBTYPE unsigned short
46.256 +#endif
46.257 +
46.258 +#ifdef __fr30__
46.259 +#define _JBLEN 10
46.260 +#endif
46.261 +
46.262 +#ifdef __FT32__
46.263 +#define _JBLEN 27
46.264 +#endif
46.265 +
46.266 +#ifdef __iq2000__
46.267 +#define _JBLEN 32
46.268 +#endif
46.269 +
46.270 +#ifdef __mcore__
46.271 +#define _JBLEN 16
46.272 +#endif
46.273 +
46.274 +#ifdef __arc__
46.275 +#define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,mlo,mhi,status32 */
46.276 +#endif
46.277 +
46.278 +#ifdef __MMIX__
46.279 +/* Using a layout compatible with GCC's built-in. */
46.280 +#define _JBLEN 5
46.281 +#define _JBTYPE unsigned long
46.282 +#endif
46.283 +
46.284 +#ifdef __mt__
46.285 +#define _JBLEN 16
46.286 +#endif
46.287 +
46.288 +#ifdef __SPU__
46.289 +#define _JBLEN 50
46.290 +#define _JBTYPE __vector signed int
46.291 +#endif
46.292 +
46.293 +#ifdef __xstormy16__
46.294 +/* 4 GPRs plus SP plus PC. */
46.295 +#define _JBLEN 8
46.296 +#endif
46.297 +
46.298 +#ifdef __mep__
46.299 +/* 16 GPRs, pc, hi, lo */
46.300 +#define _JBLEN 19
46.301 +#endif
46.302 +
46.303 +#ifdef __CRIS__
46.304 +#define _JBLEN 18
46.305 +#endif
46.306 +
46.307 +#ifdef __ia64
46.308 +#define _JBLEN 64
46.309 +#endif
46.310 +
46.311 +#ifdef __lm32__
46.312 +#define _JBLEN 19
46.313 +#endif
46.314 +
46.315 +#ifdef __m32c__
46.316 +#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
46.317 +#define _JBLEN (22/2)
46.318 +#else
46.319 +#define _JBLEN (34/2)
46.320 +#endif
46.321 +#define _JBTYPE unsigned short
46.322 +#endif /* __m32c__ */
46.323 +
46.324 +#ifdef __MSP430__
46.325 +#define _JBLEN 9
46.326 +
46.327 +#ifdef __MSP430X_LARGE__
46.328 +#define _JBTYPE unsigned long
46.329 +#else
46.330 +#define _JBTYPE unsigned short
46.331 +#endif
46.332 +#endif
46.333 +
46.334 +#ifdef __RL78__
46.335 +/* Three banks of registers, SP, CS, ES, PC */
46.336 +#define _JBLEN (8*3+8)
46.337 +#define _JBTYPE unsigned char
46.338 +#endif
46.339 +
46.340 +/*
46.341 + * There are two versions of setjmp()/longjmp():
46.342 + * 1) Compiler (gcc) built-in versions.
46.343 + * 2) Function-call versions.
46.344 + *
46.345 + * The built-in versions are used most of the time. When used, gcc replaces
46.346 + * calls to setjmp()/longjmp() with inline assembly code. The built-in
46.347 + * versions save/restore a variable number of registers.
46.348 +
46.349 + * _JBLEN is set to 40 to be ultra-safe with the built-in versions.
46.350 + * It only needs to be 12 for the function-call versions
46.351 + * but this data structure is used by both versions.
46.352 + */
46.353 +#ifdef __NIOS2__
46.354 +#define _JBLEN 40
46.355 +#define _JBTYPE unsigned long
46.356 +#endif
46.357 +
46.358 +#ifdef __RX__
46.359 +#define _JBLEN 0x44
46.360 +#endif
46.361 +
46.362 +#ifdef __VISIUM__
46.363 +/* All call-saved GP registers: r11-r19,r21,r22,r23. */
46.364 +#define _JBLEN 12
46.365 +#endif
46.366 +
46.367 +#ifdef __riscv
46.368 +/* _JBTYPE using long long to make sure the alignment is align to 8 byte,
46.369 + otherwise in rv32imafd, store/restore FPR may mis-align. */
46.370 +#define _JBTYPE long long
46.371 +#ifdef __riscv_32e
46.372 +#define _JBLEN ((4*sizeof(long))/sizeof(long))
46.373 +#else
46.374 +#define _JBLEN ((14*sizeof(long) + 12*sizeof(double))/sizeof(long))
46.375 +#endif
46.376 +#endif
46.377 +
46.378 +#ifdef _JBLEN
46.379 +#ifdef _JBTYPE
46.380 +typedef _JBTYPE jmp_buf[_JBLEN];
46.381 +#else
46.382 +typedef int jmp_buf[_JBLEN];
46.383 +#endif
46.384 +#endif
46.385 +
46.386 +_END_STD_C
46.387 +
46.388 +#if (defined(__CYGWIN__) || defined(__rtems__)) && __POSIX_VISIBLE
46.389 +#include <signal.h>
46.390 +
46.391 +#ifdef __cplusplus
46.392 +extern "C" {
46.393 +#endif
46.394 +
46.395 +/* POSIX sigsetjmp/siglongjmp macros */
46.396 +#ifdef _JBTYPE
46.397 +typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1)
46.398 + /sizeof (_JBTYPE))];
46.399 +#else
46.400 +typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
46.401 +#endif
46.402 +
46.403 +#define _SAVEMASK _JBLEN
46.404 +#define _SIGMASK (_JBLEN+1)
46.405 +
46.406 +#ifdef __CYGWIN__
46.407 +# define _CYGWIN_WORKING_SIGSETJMP
46.408 +#endif
46.409 +
46.410 +#ifdef _POSIX_THREADS
46.411 +#define __SIGMASK_FUNC pthread_sigmask
46.412 +#else
46.413 +#define __SIGMASK_FUNC sigprocmask
46.414 +#endif
46.415 +
46.416 +#ifdef __CYGWIN__
46.417 +/* Per POSIX, siglongjmp has to be implemented as function. Cygwin
46.418 + provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
46.419 +extern void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__));
46.420 +extern int sigsetjmp (sigjmp_buf, int);
46.421 +#endif
46.422 +
46.423 +#if defined(__GNUC__)
46.424 +
46.425 +#define sigsetjmp(env, savemask) \
46.426 + __extension__ \
46.427 + ({ \
46.428 + sigjmp_buf *_sjbuf = &(env); \
46.429 + ((*_sjbuf)[_SAVEMASK] = savemask,\
46.430 + __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
46.431 + setjmp (*_sjbuf)); \
46.432 + })
46.433 +
46.434 +#define siglongjmp(env, val) \
46.435 + __extension__ \
46.436 + ({ \
46.437 + sigjmp_buf *_sjbuf = &(env); \
46.438 + ((((*_sjbuf)[_SAVEMASK]) ? \
46.439 + __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
46.440 + : 0), \
46.441 + longjmp (*_sjbuf, val)); \
46.442 + })
46.443 +
46.444 +#else /* !__GNUC__ */
46.445 +
46.446 +#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
46.447 + __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
46.448 + setjmp (env))
46.449 +
46.450 +#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
46.451 + __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
46.452 + longjmp (env, val))
46.453 +
46.454 +#endif
46.455 +
46.456 +/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
46.457 + are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
46.458 + New applications should use sigsetjmp/siglongjmp instead. */
46.459 +#ifdef __CYGWIN__
46.460 +extern void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__));
46.461 +extern int _setjmp (jmp_buf);
46.462 +#else
46.463 +#define _setjmp(env) sigsetjmp ((env), 0)
46.464 +#define _longjmp(env, val) siglongjmp ((env), (val))
46.465 +#endif
46.466 +
46.467 +#ifdef __cplusplus
46.468 +}
46.469 +#endif
46.470 +#endif /* (__CYGWIN__ or __rtems__) and __POSIX_VISIBLE */
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/include/machine/stdlib.h Mon Oct 21 16:11:07 2019 +0200
47.3 @@ -0,0 +1,8 @@
47.4 +#ifndef _MACHSTDLIB_H_
47.5 +#define _MACHSTDLIB_H_
47.6 +
47.7 +/* place holder so platforms may add stdlib.h extensions */
47.8 +
47.9 +#endif /* _MACHSTDLIB_H_ */
47.10 +
47.11 +
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/include/machine/termios.h Mon Oct 21 16:11:07 2019 +0200
48.3 @@ -0,0 +1,1 @@
48.4 +#define __MAX_BAUD B4000000
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/include/machine/time.h Mon Oct 21 16:11:07 2019 +0200
49.3 @@ -0,0 +1,15 @@
49.4 +#ifndef _MACHTIME_H_
49.5 +#define _MACHTIME_H_
49.6 +
49.7 +#if defined(__rtems__) || defined(__VISIUM__) || defined(__riscv)
49.8 +#define _CLOCKS_PER_SEC_ 1000000
49.9 +#elif defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
49.10 +#define _CLOCKS_PER_SEC_ 100
49.11 +#endif
49.12 +
49.13 +#ifdef __SPU__
49.14 +#include <sys/_timespec.h>
49.15 +int nanosleep (const struct timespec *, struct timespec *);
49.16 +#endif
49.17 +
49.18 +#endif /* _MACHTIME_H_ */
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/include/machine/types.h Mon Oct 21 16:11:07 2019 +0200
50.3 @@ -0,0 +1,13 @@
50.4 +/*
50.5 + * Newlib targets may provide an own version of this file in their machine
50.6 + * directory to add custom user types for <sys/types.h>.
50.7 + */
50.8 +#ifndef _SYS_TYPES_H
50.9 +#error "must be included via <sys/types.h>"
50.10 +#endif /* !_SYS_TYPES_H */
50.11 +
50.12 +#if defined(__XMK__) && defined(___int64_t_defined)
50.13 +typedef __uint64_t u_quad_t;
50.14 +typedef __int64_t quad_t;
50.15 +typedef quad_t * qaddr_t;
50.16 +#endif
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/include/malloc.h Mon Oct 21 16:11:07 2019 +0200
51.3 @@ -0,0 +1,173 @@
51.4 +/* malloc.h -- header file for memory routines. */
51.5 +
51.6 +#ifndef _INCLUDE_MALLOC_H_
51.7 +#define _INCLUDE_MALLOC_H_
51.8 +
51.9 +#include <_ansi.h>
51.10 +#include <sys/reent.h>
51.11 +
51.12 +#define __need_size_t
51.13 +#include <stddef.h>
51.14 +
51.15 +/* include any machine-specific extensions */
51.16 +#include <machine/malloc.h>
51.17 +
51.18 +#ifdef __cplusplus
51.19 +extern "C" {
51.20 +#endif
51.21 +
51.22 +/* This version of struct mallinfo must match the one in
51.23 + libc/stdlib/mallocr.c. */
51.24 +
51.25 +struct mallinfo {
51.26 + size_t arena; /* total space allocated from system */
51.27 + size_t ordblks; /* number of non-inuse chunks */
51.28 + size_t smblks; /* unused -- always zero */
51.29 + size_t hblks; /* number of mmapped regions */
51.30 + size_t hblkhd; /* total space in mmapped regions */
51.31 + size_t usmblks; /* unused -- always zero */
51.32 + size_t fsmblks; /* unused -- always zero */
51.33 + size_t uordblks; /* total allocated space */
51.34 + size_t fordblks; /* total non-inuse space */
51.35 + size_t keepcost; /* top-most, releasable (via malloc_trim) space */
51.36 +};
51.37 +
51.38 +/* The routines. */
51.39 +
51.40 +extern void *malloc (size_t);
51.41 +#ifdef __CYGWIN__
51.42 +#undef _malloc_r
51.43 +#define _malloc_r(r, s) malloc (s)
51.44 +#else
51.45 +extern void *_malloc_r (struct _reent *, size_t);
51.46 +#endif
51.47 +
51.48 +extern void free (void *);
51.49 +#ifdef __CYGWIN__
51.50 +#undef _free_r
51.51 +#define _free_r(r, p) free (p)
51.52 +#else
51.53 +extern void _free_r (struct _reent *, void *);
51.54 +#endif
51.55 +
51.56 +extern void *realloc (void *, size_t);
51.57 +#ifdef __CYGWIN__
51.58 +#undef _realloc_r
51.59 +#define _realloc_r(r, p, s) realloc (p, s)
51.60 +#else
51.61 +extern void *_realloc_r (struct _reent *, void *, size_t);
51.62 +#endif
51.63 +
51.64 +extern void *calloc (size_t, size_t);
51.65 +#ifdef __CYGWIN__
51.66 +#undef _calloc_r
51.67 +#define _calloc_r(r, s1, s2) calloc (s1, s2);
51.68 +#else
51.69 +extern void *_calloc_r (struct _reent *, size_t, size_t);
51.70 +#endif
51.71 +
51.72 +extern void *memalign (size_t, size_t);
51.73 +#ifdef __CYGWIN__
51.74 +#undef _memalign_r
51.75 +#define _memalign_r(r, s1, s2) memalign (s1, s2);
51.76 +#else
51.77 +extern void *_memalign_r (struct _reent *, size_t, size_t);
51.78 +#endif
51.79 +
51.80 +extern struct mallinfo mallinfo (void);
51.81 +#ifdef __CYGWIN__
51.82 +#undef _mallinfo_r
51.83 +#define _mallinfo_r(r) mallinfo ()
51.84 +#else
51.85 +extern struct mallinfo _mallinfo_r (struct _reent *);
51.86 +#endif
51.87 +
51.88 +extern void malloc_stats (void);
51.89 +#ifdef __CYGWIN__
51.90 +#undef _malloc_stats_r
51.91 +#define _malloc_stats_r(r) malloc_stats ()
51.92 +#else
51.93 +extern void _malloc_stats_r (struct _reent *);
51.94 +#endif
51.95 +
51.96 +extern int mallopt (int, int);
51.97 +#ifdef __CYGWIN__
51.98 +#undef _mallopt_r
51.99 +#define _mallopt_r(i1, i2) mallopt (i1, i2)
51.100 +#else
51.101 +extern int _mallopt_r (struct _reent *, int, int);
51.102 +#endif
51.103 +
51.104 +extern size_t malloc_usable_size (void *);
51.105 +#ifdef __CYGWIN__
51.106 +#undef _malloc_usable_size_r
51.107 +#define _malloc_usable_size_r(r, p) malloc_usable_size (p)
51.108 +#else
51.109 +extern size_t _malloc_usable_size_r (struct _reent *, void *);
51.110 +#endif
51.111 +
51.112 +/* These aren't too useful on an embedded system, but we define them
51.113 + anyhow. */
51.114 +
51.115 +extern void *valloc (size_t);
51.116 +#ifdef __CYGWIN__
51.117 +#undef _valloc_r
51.118 +#define _valloc_r(r, s) valloc (s)
51.119 +#else
51.120 +extern void *_valloc_r (struct _reent *, size_t);
51.121 +#endif
51.122 +
51.123 +extern void *pvalloc (size_t);
51.124 +#ifdef __CYGWIN__
51.125 +#undef _pvalloc_r
51.126 +#define _pvalloc_r(r, s) pvalloc (s)
51.127 +#else
51.128 +extern void *_pvalloc_r (struct _reent *, size_t);
51.129 +#endif
51.130 +
51.131 +extern int malloc_trim (size_t);
51.132 +#ifdef __CYGWIN__
51.133 +#undef _malloc_trim_r
51.134 +#define _malloc_trim_r(r, s) malloc_trim (s)
51.135 +#else
51.136 +extern int _malloc_trim_r (struct _reent *, size_t);
51.137 +#endif
51.138 +
51.139 +extern void __malloc_lock(struct _reent *);
51.140 +
51.141 +extern void __malloc_unlock(struct _reent *);
51.142 +
51.143 +/* A compatibility routine for an earlier version of the allocator. */
51.144 +
51.145 +extern void mstats (char *);
51.146 +#ifdef __CYGWIN__
51.147 +#undef _mstats_r
51.148 +#define _mstats_r(r, p) mstats (p)
51.149 +#else
51.150 +extern void _mstats_r (struct _reent *, char *);
51.151 +#endif
51.152 +
51.153 +/* SVID2/XPG mallopt options */
51.154 +
51.155 +#define M_MXFAST 1 /* UNUSED in this malloc */
51.156 +#define M_NLBLKS 2 /* UNUSED in this malloc */
51.157 +#define M_GRAIN 3 /* UNUSED in this malloc */
51.158 +#define M_KEEP 4 /* UNUSED in this malloc */
51.159 +
51.160 +/* mallopt options that actually do something */
51.161 +
51.162 +#define M_TRIM_THRESHOLD -1
51.163 +#define M_TOP_PAD -2
51.164 +#define M_MMAP_THRESHOLD -3
51.165 +#define M_MMAP_MAX -4
51.166 +
51.167 +#ifndef __CYGWIN__
51.168 +/* Some systems provide this, so do too for compatibility. */
51.169 +extern void cfree (void *);
51.170 +#endif /* __CYGWIN__ */
51.171 +
51.172 +#ifdef __cplusplus
51.173 +}
51.174 +#endif
51.175 +
51.176 +#endif /* _INCLUDE_MALLOC_H_ */
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/include/math.h Mon Oct 21 16:11:07 2019 +0200
52.3 @@ -0,0 +1,629 @@
52.4 +#ifndef _MATH_H_
52.5 +
52.6 +#define _MATH_H_
52.7 +
52.8 +#include <sys/reent.h>
52.9 +#include <sys/cdefs.h>
52.10 +#include <machine/ieeefp.h>
52.11 +#include "_ansi.h"
52.12 +
52.13 +_BEGIN_STD_C
52.14 +
52.15 +/* Natural log of 2 */
52.16 +#define _M_LN2 0.693147180559945309417
52.17 +
52.18 +#if __GNUC_PREREQ (3, 3)
52.19 + /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
52.20 +
52.21 +# ifndef HUGE_VAL
52.22 +# define HUGE_VAL (__builtin_huge_val())
52.23 +# endif
52.24 +
52.25 +# ifndef HUGE_VALF
52.26 +# define HUGE_VALF (__builtin_huge_valf())
52.27 +# endif
52.28 +
52.29 +# ifndef HUGE_VALL
52.30 +# define HUGE_VALL (__builtin_huge_vall())
52.31 +# endif
52.32 +
52.33 +# ifndef INFINITY
52.34 +# define INFINITY (__builtin_inff())
52.35 +# endif
52.36 +
52.37 +# ifndef NAN
52.38 +# define NAN (__builtin_nanf(""))
52.39 +# endif
52.40 +
52.41 +#else /* !gcc >= 3.3 */
52.42 +
52.43 + /* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY
52.44 + * and NAN macros are required to be constant expressions. Using a variable--
52.45 + * even a static const--does not meet this requirement, as it cannot be
52.46 + * evaluated at translation time.)
52.47 + * The infinities are done using numbers that are far in excess of
52.48 + * something that would be expected to be encountered in a floating-point
52.49 + * implementation. (A more certain way uses values from float.h, but that is
52.50 + * avoided because system includes are not supposed to include each other.)
52.51 + * This method might produce warnings from some compilers. (It does in
52.52 + * newer GCCs, but not for ones that would hit this #else.) If this happens,
52.53 + * please report details to the Newlib mailing list. */
52.54 +
52.55 + #ifndef HUGE_VAL
52.56 + #define HUGE_VAL (1.0e999999999)
52.57 + #endif
52.58 +
52.59 + #ifndef HUGE_VALF
52.60 + #define HUGE_VALF (1.0e999999999F)
52.61 + #endif
52.62 +
52.63 + #if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE)
52.64 + #define HUGE_VALL (1.0e999999999L)
52.65 + #endif
52.66 +
52.67 + #if !defined(INFINITY)
52.68 + #define INFINITY (HUGE_VALF)
52.69 + #endif
52.70 +
52.71 + #if !defined(NAN)
52.72 + #if defined(__GNUC__) && defined(__cplusplus)
52.73 + /* Exception: older g++ versions warn about the divide by 0 used in the
52.74 + * normal case (even though older gccs do not). This trick suppresses the
52.75 + * warning, but causes errors for plain gcc, so is only used in the one
52.76 + * special case. */
52.77 + static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000};
52.78 + #define NAN (__Nanf.__d)
52.79 + #else
52.80 + #define NAN (0.0F/0.0F)
52.81 + #endif
52.82 + #endif
52.83 +
52.84 +#endif /* !gcc >= 3.3 */
52.85 +
52.86 +/* Reentrant ANSI C functions. */
52.87 +
52.88 +#ifndef __math_68881
52.89 +extern double atan (double);
52.90 +extern double cos (double);
52.91 +extern double sin (double);
52.92 +extern double tan (double);
52.93 +extern double tanh (double);
52.94 +extern double frexp (double, int *);
52.95 +extern double modf (double, double *);
52.96 +extern double ceil (double);
52.97 +extern double fabs (double);
52.98 +extern double floor (double);
52.99 +#endif /* ! defined (__math_68881) */
52.100 +
52.101 +/* Non reentrant ANSI C functions. */
52.102 +
52.103 +#ifndef _REENT_ONLY
52.104 +#ifndef __math_68881
52.105 +extern double acos (double);
52.106 +extern double asin (double);
52.107 +extern double atan2 (double, double);
52.108 +extern double cosh (double);
52.109 +extern double sinh (double);
52.110 +extern double exp (double);
52.111 +extern double ldexp (double, int);
52.112 +extern double log (double);
52.113 +extern double log10 (double);
52.114 +extern double pow (double, double);
52.115 +extern double sqrt (double);
52.116 +extern double fmod (double, double);
52.117 +#endif /* ! defined (__math_68881) */
52.118 +#endif /* ! defined (_REENT_ONLY) */
52.119 +
52.120 +#if __MISC_VISIBLE
52.121 +extern int finite (double);
52.122 +extern int finitef (float);
52.123 +extern int finitel (long double);
52.124 +extern int isinff (float);
52.125 +extern int isnanf (float);
52.126 +#ifdef __CYGWIN__ /* not implemented in newlib yet */
52.127 +extern int isinfl (long double);
52.128 +extern int isnanl (long double);
52.129 +#endif
52.130 +#if !defined(__cplusplus) || __cplusplus < 201103L
52.131 +extern int isinf (double);
52.132 +#endif
52.133 +#endif /* __MISC_VISIBLE */
52.134 +#if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \
52.135 + && (!defined(__cplusplus) || __cplusplus < 201103L)
52.136 +extern int isnan (double);
52.137 +#endif
52.138 +
52.139 +#if __ISO_C_VISIBLE >= 1999
52.140 +/* ISO C99 types and macros. */
52.141 +
52.142 +/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard,
52.143 + * considering that the standard says the includes it defines should not
52.144 + * include other includes that it defines) and that value used. (This can be
52.145 + * solved, but autoconf has a bug which makes the solution more difficult, so
52.146 + * it has been skipped for now.) */
52.147 +#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
52.148 + #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
52.149 + #define __TMP_FLT_EVAL_METHOD
52.150 +#endif /* FLT_EVAL_METHOD */
52.151 +#if defined FLT_EVAL_METHOD
52.152 + #if FLT_EVAL_METHOD == 0
52.153 + typedef float float_t;
52.154 + typedef double double_t;
52.155 + #elif FLT_EVAL_METHOD == 1
52.156 + typedef double float_t;
52.157 + typedef double double_t;
52.158 + #elif FLT_EVAL_METHOD == 2
52.159 + typedef long double float_t;
52.160 + typedef long double double_t;
52.161 + #else
52.162 + /* Implementation-defined. Assume float_t and double_t have been
52.163 + * defined previously for this configuration (e.g. config.h). */
52.164 + #endif
52.165 +#else
52.166 + /* Assume basic definitions. */
52.167 + typedef float float_t;
52.168 + typedef double double_t;
52.169 +#endif
52.170 +#if defined(__TMP_FLT_EVAL_METHOD)
52.171 + #undef FLT_EVAL_METHOD
52.172 +#endif
52.173 +
52.174 +#define FP_NAN 0
52.175 +#define FP_INFINITE 1
52.176 +#define FP_ZERO 2
52.177 +#define FP_SUBNORMAL 3
52.178 +#define FP_NORMAL 4
52.179 +
52.180 +#ifndef FP_ILOGB0
52.181 +# define FP_ILOGB0 (-__INT_MAX__)
52.182 +#endif
52.183 +#ifndef FP_ILOGBNAN
52.184 +# define FP_ILOGBNAN __INT_MAX__
52.185 +#endif
52.186 +
52.187 +#ifndef MATH_ERRNO
52.188 +# define MATH_ERRNO 1
52.189 +#endif
52.190 +#ifndef MATH_ERREXCEPT
52.191 +# define MATH_ERREXCEPT 2
52.192 +#endif
52.193 +#ifndef math_errhandling
52.194 +# define math_errhandling MATH_ERRNO
52.195 +#endif
52.196 +
52.197 +extern int __isinff (float x);
52.198 +extern int __isinfd (double x);
52.199 +extern int __isnanf (float x);
52.200 +extern int __isnand (double x);
52.201 +extern int __fpclassifyf (float x);
52.202 +extern int __fpclassifyd (double x);
52.203 +extern int __signbitf (float x);
52.204 +extern int __signbitd (double x);
52.205 +
52.206 +/* Note: isinf and isnan were once functions in newlib that took double
52.207 + * arguments. C99 specifies that these names are reserved for macros
52.208 + * supporting multiple floating point types. Thus, they are
52.209 + * now defined as macros. Implementations of the old functions
52.210 + * taking double arguments still exist for compatibility purposes
52.211 + * (prototypes for them are earlier in this header). */
52.212 +
52.213 +#if __GNUC_PREREQ (4, 4)
52.214 + #define fpclassify(__x) (__builtin_fpclassify (FP_NAN, FP_INFINITE, \
52.215 + FP_NORMAL, FP_SUBNORMAL, \
52.216 + FP_ZERO, __x))
52.217 + #ifndef isfinite
52.218 + #define isfinite(__x) (__builtin_isfinite (__x))
52.219 + #endif
52.220 + #ifndef isinf
52.221 + #define isinf(__x) (__builtin_isinf_sign (__x))
52.222 + #endif
52.223 + #ifndef isnan
52.224 + #define isnan(__x) (__builtin_isnan (__x))
52.225 + #endif
52.226 + #define isnormal(__x) (__builtin_isnormal (__x))
52.227 +#else
52.228 + #define fpclassify(__x) \
52.229 + ((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
52.230 + __fpclassifyd(__x))
52.231 + #ifndef isfinite
52.232 + #define isfinite(__y) \
52.233 + (__extension__ ({int __cy = fpclassify(__y); \
52.234 + __cy != FP_INFINITE && __cy != FP_NAN;}))
52.235 + #endif
52.236 + #ifndef isinf
52.237 + #define isinf(__x) (fpclassify(__x) == FP_INFINITE)
52.238 + #endif
52.239 + #ifndef isnan
52.240 + #define isnan(__x) (fpclassify(__x) == FP_NAN)
52.241 + #endif
52.242 + #define isnormal(__x) (fpclassify(__x) == FP_NORMAL)
52.243 +#endif
52.244 +
52.245 +#if __GNUC_PREREQ (4, 0)
52.246 + #if defined(_HAVE_LONG_DOUBLE)
52.247 + #define signbit(__x) \
52.248 + ((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
52.249 + (sizeof(__x) == sizeof(double)) ? __builtin_signbit (__x) : \
52.250 + __builtin_signbitl(__x))
52.251 + #else
52.252 + #define signbit(__x) \
52.253 + ((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
52.254 + __builtin_signbit (__x))
52.255 + #endif
52.256 +#else
52.257 + #define signbit(__x) \
52.258 + ((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
52.259 + __signbitd(__x))
52.260 +#endif
52.261 +
52.262 +#if __GNUC_PREREQ (2, 97)
52.263 +#define isgreater(__x,__y) (__builtin_isgreater (__x, __y))
52.264 +#define isgreaterequal(__x,__y) (__builtin_isgreaterequal (__x, __y))
52.265 +#define isless(__x,__y) (__builtin_isless (__x, __y))
52.266 +#define islessequal(__x,__y) (__builtin_islessequal (__x, __y))
52.267 +#define islessgreater(__x,__y) (__builtin_islessgreater (__x, __y))
52.268 +#define isunordered(__x,__y) (__builtin_isunordered (__x, __y))
52.269 +#else
52.270 +#define isgreater(x,y) \
52.271 + (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
52.272 + !isunordered(__x,__y) && (__x > __y);}))
52.273 +#define isgreaterequal(x,y) \
52.274 + (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
52.275 + !isunordered(__x,__y) && (__x >= __y);}))
52.276 +#define isless(x,y) \
52.277 + (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
52.278 + !isunordered(__x,__y) && (__x < __y);}))
52.279 +#define islessequal(x,y) \
52.280 + (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
52.281 + !isunordered(__x,__y) && (__x <= __y);}))
52.282 +#define islessgreater(x,y) \
52.283 + (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
52.284 + !isunordered(__x,__y) && (__x < __y || __x > __y);}))
52.285 +
52.286 +#define isunordered(a,b) \
52.287 + (__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
52.288 + fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
52.289 +#endif
52.290 +
52.291 +/* Non ANSI double precision functions. */
52.292 +
52.293 +extern double infinity (void);
52.294 +extern double nan (const char *);
52.295 +extern double copysign (double, double);
52.296 +extern double logb (double);
52.297 +extern int ilogb (double);
52.298 +
52.299 +extern double asinh (double);
52.300 +extern double cbrt (double);
52.301 +extern double nextafter (double, double);
52.302 +extern double rint (double);
52.303 +extern double scalbn (double, int);
52.304 +
52.305 +extern double exp2 (double);
52.306 +extern double scalbln (double, long int);
52.307 +extern double tgamma (double);
52.308 +extern double nearbyint (double);
52.309 +extern long int lrint (double);
52.310 +extern long long int llrint (double);
52.311 +extern double round (double);
52.312 +extern long int lround (double);
52.313 +extern long long int llround (double);
52.314 +extern double trunc (double);
52.315 +extern double remquo (double, double, int *);
52.316 +extern double fdim (double, double);
52.317 +extern double fmax (double, double);
52.318 +extern double fmin (double, double);
52.319 +extern double fma (double, double, double);
52.320 +
52.321 +#ifndef __math_68881
52.322 +extern double log1p (double);
52.323 +extern double expm1 (double);
52.324 +#endif /* ! defined (__math_68881) */
52.325 +
52.326 +#ifndef _REENT_ONLY
52.327 +extern double acosh (double);
52.328 +extern double atanh (double);
52.329 +extern double remainder (double, double);
52.330 +extern double gamma (double);
52.331 +extern double lgamma (double);
52.332 +extern double erf (double);
52.333 +extern double erfc (double);
52.334 +extern double log2 (double);
52.335 +#if !defined(__cplusplus)
52.336 +#define log2(x) (log (x) / _M_LN2)
52.337 +#endif
52.338 +
52.339 +#ifndef __math_68881
52.340 +extern double hypot (double, double);
52.341 +#endif
52.342 +
52.343 +#endif /* ! defined (_REENT_ONLY) */
52.344 +
52.345 +/* Single precision versions of ANSI functions. */
52.346 +
52.347 +extern float atanf (float);
52.348 +extern float cosf (float);
52.349 +extern float sinf (float);
52.350 +extern float tanf (float);
52.351 +extern float tanhf (float);
52.352 +extern float frexpf (float, int *);
52.353 +extern float modff (float, float *);
52.354 +extern float ceilf (float);
52.355 +extern float fabsf (float);
52.356 +extern float floorf (float);
52.357 +
52.358 +#ifndef _REENT_ONLY
52.359 +extern float acosf (float);
52.360 +extern float asinf (float);
52.361 +extern float atan2f (float, float);
52.362 +extern float coshf (float);
52.363 +extern float sinhf (float);
52.364 +extern float expf (float);
52.365 +extern float ldexpf (float, int);
52.366 +extern float logf (float);
52.367 +extern float log10f (float);
52.368 +extern float powf (float, float);
52.369 +extern float sqrtf (float);
52.370 +extern float fmodf (float, float);
52.371 +#endif /* ! defined (_REENT_ONLY) */
52.372 +
52.373 +/* Other single precision functions. */
52.374 +
52.375 +extern float exp2f (float);
52.376 +extern float scalblnf (float, long int);
52.377 +extern float tgammaf (float);
52.378 +extern float nearbyintf (float);
52.379 +extern long int lrintf (float);
52.380 +extern long long int llrintf (float);
52.381 +extern float roundf (float);
52.382 +extern long int lroundf (float);
52.383 +extern long long int llroundf (float);
52.384 +extern float truncf (float);
52.385 +extern float remquof (float, float, int *);
52.386 +extern float fdimf (float, float);
52.387 +extern float fmaxf (float, float);
52.388 +extern float fminf (float, float);
52.389 +extern float fmaf (float, float, float);
52.390 +
52.391 +extern float infinityf (void);
52.392 +extern float nanf (const char *);
52.393 +extern float copysignf (float, float);
52.394 +extern float logbf (float);
52.395 +extern int ilogbf (float);
52.396 +
52.397 +extern float asinhf (float);
52.398 +extern float cbrtf (float);
52.399 +extern float nextafterf (float, float);
52.400 +extern float rintf (float);
52.401 +extern float scalbnf (float, int);
52.402 +extern float log1pf (float);
52.403 +extern float expm1f (float);
52.404 +
52.405 +#ifndef _REENT_ONLY
52.406 +extern float acoshf (float);
52.407 +extern float atanhf (float);
52.408 +extern float remainderf (float, float);
52.409 +extern float gammaf (float);
52.410 +extern float lgammaf (float);
52.411 +extern float erff (float);
52.412 +extern float erfcf (float);
52.413 +extern float log2f (float);
52.414 +extern float hypotf (float, float);
52.415 +#endif /* ! defined (_REENT_ONLY) */
52.416 +
52.417 +/* Newlib doesn't fully support long double math functions so far.
52.418 + On platforms where long double equals double the long double functions
52.419 + simply call the double functions. On Cygwin the long double functions
52.420 + are implemented independently from newlib to be able to use optimized
52.421 + assembler functions despite using the Microsoft x86_64 ABI. */
52.422 +#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
52.423 +/* Reentrant ANSI C functions. */
52.424 +#ifndef __math_68881
52.425 +extern long double atanl (long double);
52.426 +extern long double cosl (long double);
52.427 +extern long double sinl (long double);
52.428 +extern long double tanl (long double);
52.429 +extern long double tanhl (long double);
52.430 +extern long double frexpl (long double, int *);
52.431 +extern long double modfl (long double, long double *);
52.432 +extern long double ceill (long double);
52.433 +extern long double fabsl (long double);
52.434 +extern long double floorl (long double);
52.435 +extern long double log1pl (long double);
52.436 +extern long double expm1l (long double);
52.437 +#endif /* ! defined (__math_68881) */
52.438 +/* Non reentrant ANSI C functions. */
52.439 +#ifndef _REENT_ONLY
52.440 +#ifndef __math_68881
52.441 +extern long double acosl (long double);
52.442 +extern long double asinl (long double);
52.443 +extern long double atan2l (long double, long double);
52.444 +extern long double coshl (long double);
52.445 +extern long double sinhl (long double);
52.446 +extern long double expl (long double);
52.447 +extern long double ldexpl (long double, int);
52.448 +extern long double logl (long double);
52.449 +extern long double log10l (long double);
52.450 +extern long double powl (long double, long double);
52.451 +extern long double sqrtl (long double);
52.452 +extern long double fmodl (long double, long double);
52.453 +extern long double hypotl (long double, long double);
52.454 +#endif /* ! defined (__math_68881) */
52.455 +#endif /* ! defined (_REENT_ONLY) */
52.456 +extern long double copysignl (long double, long double);
52.457 +extern long double nanl (const char *);
52.458 +extern int ilogbl (long double);
52.459 +extern long double asinhl (long double);
52.460 +extern long double cbrtl (long double);
52.461 +extern long double nextafterl (long double, long double);
52.462 +extern float nexttowardf (float, long double);
52.463 +extern double nexttoward (double, long double);
52.464 +extern long double nexttowardl (long double, long double);
52.465 +extern long double logbl (long double);
52.466 +extern long double log2l (long double);
52.467 +extern long double rintl (long double);
52.468 +extern long double scalbnl (long double, int);
52.469 +extern long double exp2l (long double);
52.470 +extern long double scalblnl (long double, long);
52.471 +extern long double tgammal (long double);
52.472 +extern long double nearbyintl (long double);
52.473 +extern long int lrintl (long double);
52.474 +extern long long int llrintl (long double);
52.475 +extern long double roundl (long double);
52.476 +extern long lroundl (long double);
52.477 +extern long long int llroundl (long double);
52.478 +extern long double truncl (long double);
52.479 +extern long double remquol (long double, long double, int *);
52.480 +extern long double fdiml (long double, long double);
52.481 +extern long double fmaxl (long double, long double);
52.482 +extern long double fminl (long double, long double);
52.483 +extern long double fmal (long double, long double, long double);
52.484 +#ifndef _REENT_ONLY
52.485 +extern long double acoshl (long double);
52.486 +extern long double atanhl (long double);
52.487 +extern long double remainderl (long double, long double);
52.488 +extern long double lgammal (long double);
52.489 +extern long double erfl (long double);
52.490 +extern long double erfcl (long double);
52.491 +#endif /* ! defined (_REENT_ONLY) */
52.492 +#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
52.493 +extern long double hypotl (long double, long double);
52.494 +extern long double sqrtl (long double);
52.495 +#ifdef __i386__
52.496 +/* Other long double precision functions. */
52.497 +extern _LONG_DOUBLE rintl (_LONG_DOUBLE);
52.498 +extern long int lrintl (_LONG_DOUBLE);
52.499 +extern long long int llrintl (_LONG_DOUBLE);
52.500 +#endif /* __i386__ */
52.501 +#endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
52.502 +
52.503 +#endif /* __ISO_C_VISIBLE >= 1999 */
52.504 +
52.505 +#if __MISC_VISIBLE
52.506 +extern double drem (double, double);
52.507 +extern float dremf (float, float);
52.508 +#ifdef __CYGWIN__
52.509 +extern float dreml (long double, long double);
52.510 +#endif /* __CYGWIN__ */
52.511 +extern double gamma_r (double, int *);
52.512 +extern double lgamma_r (double, int *);
52.513 +extern float gammaf_r (float, int *);
52.514 +extern float lgammaf_r (float, int *);
52.515 +#endif
52.516 +
52.517 +#if __MISC_VISIBLE || __XSI_VISIBLE
52.518 +extern double y0 (double);
52.519 +extern double y1 (double);
52.520 +extern double yn (int, double);
52.521 +extern double j0 (double);
52.522 +extern double j1 (double);
52.523 +extern double jn (int, double);
52.524 +#endif
52.525 +
52.526 +#if __MISC_VISIBLE || __XSI_VISIBLE >= 600
52.527 +extern float y0f (float);
52.528 +extern float y1f (float);
52.529 +extern float ynf (int, float);
52.530 +extern float j0f (float);
52.531 +extern float j1f (float);
52.532 +extern float jnf (int, float);
52.533 +#endif
52.534 +
52.535 +/* GNU extensions */
52.536 +#if __GNU_VISIBLE
52.537 +extern void sincos (double, double *, double *);
52.538 +extern void sincosf (float, float *, float *);
52.539 +#ifdef __CYGWIN__
52.540 +extern void sincosl (long double, long double *, long double *);
52.541 +#endif /* __CYGWIN__ */
52.542 +# ifndef exp10
52.543 +extern double exp10 (double);
52.544 +# endif
52.545 +# ifndef pow10
52.546 +extern double pow10 (double);
52.547 +# endif
52.548 +# ifndef exp10f
52.549 +extern float exp10f (float);
52.550 +# endif
52.551 +# ifndef pow10f
52.552 +extern float pow10f (float);
52.553 +# endif
52.554 +#ifdef __CYGWIN__
52.555 +# ifndef exp10l
52.556 +extern float exp10l (float);
52.557 +# endif
52.558 +# ifndef pow10l
52.559 +extern float pow10l (float);
52.560 +# endif
52.561 +#endif /* __CYGWIN__ */
52.562 +#endif /* __GNU_VISIBLE */
52.563 +
52.564 +#if __MISC_VISIBLE || __XSI_VISIBLE
52.565 +/* The gamma functions use a global variable, signgam. */
52.566 +#ifndef _REENT_ONLY
52.567 +#define signgam (*__signgam())
52.568 +extern int *__signgam (void);
52.569 +#endif /* ! defined (_REENT_ONLY) */
52.570 +
52.571 +#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
52.572 +#endif /* __MISC_VISIBLE || __XSI_VISIBLE */
52.573 +
52.574 +/* Useful constants. */
52.575 +
52.576 +#if __BSD_VISIBLE || __XSI_VISIBLE
52.577 +
52.578 +#define MAXFLOAT 3.40282347e+38F
52.579 +
52.580 +#define M_E 2.7182818284590452354
52.581 +#define M_LOG2E 1.4426950408889634074
52.582 +#define M_LOG10E 0.43429448190325182765
52.583 +#define M_LN2 _M_LN2
52.584 +#define M_LN10 2.30258509299404568402
52.585 +#define M_PI 3.14159265358979323846
52.586 +#define M_PI_2 1.57079632679489661923
52.587 +#define M_PI_4 0.78539816339744830962
52.588 +#define M_1_PI 0.31830988618379067154
52.589 +#define M_2_PI 0.63661977236758134308
52.590 +#define M_2_SQRTPI 1.12837916709551257390
52.591 +#define M_SQRT2 1.41421356237309504880
52.592 +#define M_SQRT1_2 0.70710678118654752440
52.593 +
52.594 +#endif
52.595 +
52.596 +#if __BSD_VISIBLE
52.597 +
52.598 +#define M_TWOPI (M_PI * 2.0)
52.599 +#define M_3PI_4 2.3561944901923448370E0
52.600 +#define M_SQRTPI 1.77245385090551602792981
52.601 +#define M_LN2LO 1.9082149292705877000E-10
52.602 +#define M_LN2HI 6.9314718036912381649E-1
52.603 +#define M_SQRT3 1.73205080756887719000
52.604 +#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
52.605 +#define M_LOG2_E _M_LN2
52.606 +#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
52.607 +
52.608 +/* Global control over fdlibm error handling. */
52.609 +
52.610 +enum __fdlibm_version
52.611 +{
52.612 + __fdlibm_ieee = -1,
52.613 + __fdlibm_posix
52.614 +};
52.615 +
52.616 +#define _LIB_VERSION_TYPE enum __fdlibm_version
52.617 +#define _LIB_VERSION __fdlib_version
52.618 +
52.619 +extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION;
52.620 +
52.621 +#define _IEEE_ __fdlibm_ieee
52.622 +#define _POSIX_ __fdlibm_posix
52.623 +
52.624 +#endif /* __BSD_VISIBLE */
52.625 +
52.626 +_END_STD_C
52.627 +
52.628 +#ifdef __FAST_MATH__
52.629 +#include <machine/fastmath.h>
52.630 +#endif
52.631 +
52.632 +#endif /* _MATH_H_ */
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/include/memory.h Mon Oct 21 16:11:07 2019 +0200
53.3 @@ -0,0 +1,4 @@
53.4 +#ifndef _MEMORY_H
53.5 +#define _MEMORY_H
53.6 +#include <string.h>
53.7 +#endif /* !_MEMORY_H */
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/include/ndbm.h Mon Oct 21 16:11:07 2019 +0200
54.3 @@ -0,0 +1,90 @@
54.4 +/*-
54.5 + * SPDX-License-Identifier: BSD-3-Clause
54.6 + *
54.7 + * Copyright (c) 1990, 1993
54.8 + * The Regents of the University of California. All rights reserved.
54.9 + *
54.10 + * This code is derived from software contributed to Berkeley by
54.11 + * Margo Seltzer.
54.12 + *
54.13 + * Redistribution and use in source and binary forms, with or without
54.14 + * modification, are permitted provided that the following conditions
54.15 + * are met:
54.16 + * 1. Redistributions of source code must retain the above copyright
54.17 + * notice, this list of conditions and the following disclaimer.
54.18 + * 2. Redistributions in binary form must reproduce the above copyright
54.19 + * notice, this list of conditions and the following disclaimer in the
54.20 + * documentation and/or other materials provided with the distribution.
54.21 + * 3. Neither the name of the University nor the names of its contributors
54.22 + * may be used to endorse or promote products derived from this software
54.23 + * without specific prior written permission.
54.24 + *
54.25 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54.26 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54.27 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54.28 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54.29 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54.30 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54.31 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54.32 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54.33 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54.34 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54.35 + * SUCH DAMAGE.
54.36 + *
54.37 + * @(#)ndbm.h 8.1 (Berkeley) 6/2/93
54.38 + * $FreeBSD$ : src/include/ndbm.h
54.39 + * Nov 20 19:45:28 2017 UTC by pfg
54.40 + * SVN Revision 326024
54.41 + */
54.42 +
54.43 +#ifndef _NDBM_H_
54.44 +#define _NDBM_H_
54.45 +
54.46 +/* #include <db.h> */
54.47 +
54.48 +/*
54.49 + * The above header-file is directly included in `newlib/libc/search/ndbm.c`
54.50 + * as `db.h` is present in form of `db_local.h`, inside `newlib/libc/search`
54.51 + * directory and not in `newlib/libc/include`.
54.52 + * Necessary data-types are mentioned in form of forward-declarations
54.53 + */
54.54 +
54.55 +/* Map dbm interface onto db(3). */
54.56 +#define DBM_RDONLY O_RDONLY
54.57 +
54.58 +/* Flags to dbm_store(). */
54.59 +#define DBM_INSERT 0
54.60 +#define DBM_REPLACE 1
54.61 +
54.62 +/*
54.63 + * The db(3) support for ndbm always appends this suffix to the
54.64 + * file name to avoid overwriting the user's original database.
54.65 + */
54.66 +#define DBM_SUFFIX ".db"
54.67 +
54.68 +typedef struct {
54.69 + void *dptr;
54.70 + int dsize; /* XXX Should be size_t according to 1003.1-2008. */
54.71 +} datum;
54.72 +
54.73 +struct __db; /* Forward-declaration */
54.74 +typedef struct __db DB; /* Forward-declaration */
54.75 +typedef DB DBM;
54.76 +#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
54.77 +
54.78 +__BEGIN_DECLS
54.79 +int dbm_clearerr(DBM *);
54.80 +void dbm_close(DBM *);
54.81 +int dbm_delete(DBM *, datum);
54.82 +int dbm_error(DBM *);
54.83 +datum dbm_fetch(DBM *, datum);
54.84 +datum dbm_firstkey(DBM *);
54.85 +datum dbm_nextkey(DBM *);
54.86 +DBM *dbm_open(const char *, int, mode_t);
54.87 +int dbm_store(DBM *, datum, datum, int);
54.88 +#if __BSD_VISIBLE
54.89 +int dbm_dirfno(DBM *);
54.90 +#endif
54.91 +__END_DECLS
54.92 +
54.93 +#endif /* !_NDBM_H_ */
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/include/newlib.h Mon Oct 21 16:11:07 2019 +0200
55.3 @@ -0,0 +1,2 @@
55.4 +/* dummy file for external tools to use. Real file is created by
55.5 + newlib configuration. */
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/include/paths.h Mon Oct 21 16:11:07 2019 +0200
56.3 @@ -0,0 +1,9 @@
56.4 +#ifndef _PATHS_H_
56.5 +#define _PATHS_H_
56.6 +
56.7 +#define _PATH_DEV "/dev/"
56.8 +#define _PATH_DEVNULL "/dev/null"
56.9 +#define _PATH_DEVZERO "/dev/zero"
56.10 +#define _PATH_BSHELL "/bin/sh"
56.11 +
56.12 +#endif /* _PATHS_H_ */
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/include/pthread.h Mon Oct 21 16:11:07 2019 +0200
57.3 @@ -0,0 +1,434 @@
57.4 +/*
57.5 + * Written by Joel Sherrill <joel.sherrill@OARcorp.com>.
57.6 + *
57.7 + * COPYRIGHT (c) 1989-2013, 2015.
57.8 + * On-Line Applications Research Corporation (OAR).
57.9 + *
57.10 + * Permission to use, copy, modify, and distribute this software for any
57.11 + * purpose without fee is hereby granted, provided that this entire notice
57.12 + * is included in all copies of any software which is or includes a copy
57.13 + * or modification of this software.
57.14 + *
57.15 + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
57.16 + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
57.17 + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
57.18 + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
57.19 + */
57.20 +
57.21 +#ifndef __PTHREAD_h
57.22 +#define __PTHREAD_h
57.23 +
57.24 +#ifdef __cplusplus
57.25 +extern "C" {
57.26 +#endif
57.27 +
57.28 +#include <unistd.h>
57.29 +
57.30 +#if defined(_POSIX_THREADS)
57.31 +
57.32 +#include <sys/types.h>
57.33 +#include <time.h>
57.34 +#include <sched.h>
57.35 +#include <sys/cdefs.h>
57.36 +
57.37 +struct _pthread_cleanup_context {
57.38 + void (*_routine)(void *);
57.39 + void *_arg;
57.40 + int _canceltype;
57.41 + struct _pthread_cleanup_context *_previous;
57.42 +};
57.43 +
57.44 +/* Register Fork Handlers */
57.45 +int pthread_atfork (void (*prepare)(void), void (*parent)(void),
57.46 + void (*child)(void));
57.47 +
57.48 +/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */
57.49 +
57.50 +int pthread_mutexattr_init (pthread_mutexattr_t *__attr);
57.51 +int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
57.52 +int pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr,
57.53 + int *__pshared);
57.54 +int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
57.55 + int __pshared);
57.56 +
57.57 +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
57.58 +
57.59 +/* Single UNIX Specification 2 Mutex Attributes types */
57.60 +
57.61 +int pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr, int *__kind);
57.62 +int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind);
57.63 +
57.64 +#endif
57.65 +
57.66 +/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */
57.67 +
57.68 +int pthread_mutex_init (pthread_mutex_t *__mutex,
57.69 + const pthread_mutexattr_t *__attr);
57.70 +int pthread_mutex_destroy (pthread_mutex_t *__mutex);
57.71 +
57.72 +/* This is used to statically initialize a pthread_mutex_t. Example:
57.73 +
57.74 + pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
57.75 + */
57.76 +
57.77 +#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_MUTEX_INITIALIZER
57.78 +
57.79 +/* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
57.80 + NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */
57.81 +
57.82 +int pthread_mutex_lock (pthread_mutex_t *__mutex);
57.83 +int pthread_mutex_trylock (pthread_mutex_t *__mutex);
57.84 +int pthread_mutex_unlock (pthread_mutex_t *__mutex);
57.85 +
57.86 +#if defined(_POSIX_TIMEOUTS)
57.87 +
57.88 +int pthread_mutex_timedlock (pthread_mutex_t *__mutex,
57.89 + const struct timespec *__timeout);
57.90 +
57.91 +#endif /* _POSIX_TIMEOUTS */
57.92 +
57.93 +/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */
57.94 +
57.95 +int pthread_condattr_init (pthread_condattr_t *__attr);
57.96 +int pthread_condattr_destroy (pthread_condattr_t *__attr);
57.97 +
57.98 +int pthread_condattr_getclock (const pthread_condattr_t *__restrict __attr,
57.99 + clockid_t *__restrict __clock_id);
57.100 +int pthread_condattr_setclock (pthread_condattr_t *__attr,
57.101 + clockid_t __clock_id);
57.102 +
57.103 +int pthread_condattr_getpshared (const pthread_condattr_t *__attr,
57.104 + int *__pshared);
57.105 +int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared);
57.106 +
57.107 +/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */
57.108 +
57.109 +int pthread_cond_init (pthread_cond_t *__cond,
57.110 + const pthread_condattr_t *__attr);
57.111 +int pthread_cond_destroy (pthread_cond_t *__mutex);
57.112 +
57.113 +/* This is used to statically initialize a pthread_cond_t. Example:
57.114 +
57.115 + pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
57.116 + */
57.117 +
57.118 +#define PTHREAD_COND_INITIALIZER _PTHREAD_COND_INITIALIZER
57.119 +
57.120 +/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */
57.121 +
57.122 +int pthread_cond_signal (pthread_cond_t *__cond);
57.123 +int pthread_cond_broadcast (pthread_cond_t *__cond);
57.124 +
57.125 +/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */
57.126 +
57.127 +int pthread_cond_wait (pthread_cond_t *__cond, pthread_mutex_t *__mutex);
57.128 +
57.129 +int pthread_cond_timedwait (pthread_cond_t *__cond,
57.130 + pthread_mutex_t *__mutex,
57.131 + const struct timespec *__abstime);
57.132 +
57.133 +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
57.134 +
57.135 +/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */
57.136 +
57.137 +int pthread_attr_setscope (pthread_attr_t *__attr, int __contentionscope);
57.138 +int pthread_attr_getscope (const pthread_attr_t *__attr,
57.139 + int *__contentionscope);
57.140 +int pthread_attr_setinheritsched (pthread_attr_t *__attr,
57.141 + int __inheritsched);
57.142 +int pthread_attr_getinheritsched (const pthread_attr_t *__attr,
57.143 + int *__inheritsched);
57.144 +int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy);
57.145 +int pthread_attr_getschedpolicy (const pthread_attr_t *__attr,
57.146 + int *__policy);
57.147 +
57.148 +#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
57.149 +
57.150 +int pthread_attr_setschedparam (pthread_attr_t *__attr,
57.151 + const struct sched_param *__param);
57.152 +int pthread_attr_getschedparam (const pthread_attr_t *__attr,
57.153 + struct sched_param *__param);
57.154 +
57.155 +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
57.156 +
57.157 +/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */
57.158 +
57.159 +int pthread_getschedparam (pthread_t __pthread, int *__policy,
57.160 + struct sched_param *__param);
57.161 +int pthread_setschedparam (pthread_t __pthread, int __policy,
57.162 + const struct sched_param *__param);
57.163 +
57.164 +/* Set Scheduling Priority of a Thread */
57.165 +int pthread_setschedprio (pthread_t thread, int prio);
57.166 +
57.167 +#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
57.168 +
57.169 +#if __GNU_VISIBLE
57.170 +int pthread_getname_np(pthread_t, char *, size_t) __nonnull((2));
57.171 +
57.172 +int pthread_setname_np(pthread_t, const char *) __nonnull((2));
57.173 +#endif
57.174 +
57.175 +#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
57.176 +
57.177 +/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */
57.178 +
57.179 +int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
57.180 + int __protocol);
57.181 +int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *__attr,
57.182 + int *__protocol);
57.183 +int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
57.184 + int __prioceiling);
57.185 +int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *__attr,
57.186 + int *__prioceiling);
57.187 +
57.188 +#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
57.189 +
57.190 +#if defined(_POSIX_THREAD_PRIO_PROTECT)
57.191 +
57.192 +/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */
57.193 +
57.194 +int pthread_mutex_setprioceiling (pthread_mutex_t *__mutex,
57.195 + int __prioceiling, int *__old_ceiling);
57.196 +int pthread_mutex_getprioceiling (const pthread_mutex_t *__restrict __mutex,
57.197 + int *__prioceiling);
57.198 +
57.199 +#endif /* _POSIX_THREAD_PRIO_PROTECT */
57.200 +
57.201 +/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */
57.202 +
57.203 +int pthread_attr_init (pthread_attr_t *__attr);
57.204 +int pthread_attr_destroy (pthread_attr_t *__attr);
57.205 +int pthread_attr_setstack (pthread_attr_t *attr,
57.206 + void *__stackaddr, size_t __stacksize);
57.207 +int pthread_attr_getstack (const pthread_attr_t *attr,
57.208 + void **__stackaddr, size_t *__stacksize);
57.209 +int pthread_attr_getstacksize (const pthread_attr_t *__attr,
57.210 + size_t *__stacksize);
57.211 +int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize);
57.212 +int pthread_attr_getstackaddr (const pthread_attr_t *__attr,
57.213 + void **__stackaddr);
57.214 +int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr);
57.215 +int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
57.216 + int *__detachstate);
57.217 +int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate);
57.218 +int pthread_attr_getguardsize (const pthread_attr_t *__attr,
57.219 + size_t *__guardsize);
57.220 +int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize);
57.221 +
57.222 +/* POSIX thread APIs beyond the POSIX standard but provided
57.223 + * in GNU/Linux. They may be provided by other OSes for
57.224 + * compatibility.
57.225 + */
57.226 +#if __GNU_VISIBLE
57.227 +#if defined(__rtems__)
57.228 +int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
57.229 + size_t __cpusetsize,
57.230 + const cpu_set_t *__cpuset);
57.231 +int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
57.232 + size_t __cpusetsize, cpu_set_t *__cpuset);
57.233 +
57.234 +int pthread_setaffinity_np (pthread_t __id, size_t __cpusetsize,
57.235 + const cpu_set_t *__cpuset);
57.236 +int pthread_getaffinity_np (const pthread_t __id, size_t __cpusetsize,
57.237 + cpu_set_t *__cpuset);
57.238 +
57.239 +int pthread_getattr_np (pthread_t __id, pthread_attr_t *__attr);
57.240 +#endif /* defined(__rtems__) */
57.241 +#endif /* __GNU_VISIBLE */
57.242 +
57.243 +/* Thread Creation, P1003.1c/Draft 10, p. 144 */
57.244 +
57.245 +int pthread_create (pthread_t *__pthread, const pthread_attr_t *__attr,
57.246 + void *(*__start_routine)(void *), void *__arg);
57.247 +
57.248 +/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */
57.249 +
57.250 +int pthread_join (pthread_t __pthread, void **__value_ptr);
57.251 +
57.252 +/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */
57.253 +
57.254 +int pthread_detach (pthread_t __pthread);
57.255 +
57.256 +/* Thread Termination, p1003.1c/Draft 10, p. 150 */
57.257 +
57.258 +void pthread_exit (void *__value_ptr) __dead2;
57.259 +
57.260 +/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */
57.261 +
57.262 +pthread_t pthread_self (void);
57.263 +
57.264 +/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */
57.265 +
57.266 +int pthread_equal (pthread_t __t1, pthread_t __t2);
57.267 +
57.268 +/* Retrieve ID of a Thread's CPU Time Clock */
57.269 +int pthread_getcpuclockid (pthread_t thread, clockid_t *clock_id);
57.270 +
57.271 +/* Get/Set Current Thread's Concurrency Level */
57.272 +int pthread_setconcurrency (int new_level);
57.273 +int pthread_getconcurrency (void);
57.274 +
57.275 +#if __BSD_VISIBLE || __GNU_VISIBLE
57.276 +void pthread_yield (void);
57.277 +#endif
57.278 +
57.279 +/* Dynamic Package Initialization */
57.280 +
57.281 +/* This is used to statically initialize a pthread_once_t. Example:
57.282 +
57.283 + pthread_once_t once = PTHREAD_ONCE_INIT;
57.284 +
57.285 + NOTE: This is named inconsistently -- it should be INITIALIZER. */
57.286 +
57.287 +#define PTHREAD_ONCE_INIT _PTHREAD_ONCE_INIT
57.288 +
57.289 +int pthread_once (pthread_once_t *__once_control,
57.290 + void (*__init_routine)(void));
57.291 +
57.292 +/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */
57.293 +
57.294 +int pthread_key_create (pthread_key_t *__key,
57.295 + void (*__destructor)(void *));
57.296 +
57.297 +/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */
57.298 +
57.299 +int pthread_setspecific (pthread_key_t __key, const void *__value);
57.300 +void * pthread_getspecific (pthread_key_t __key);
57.301 +
57.302 +/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */
57.303 +
57.304 +int pthread_key_delete (pthread_key_t __key);
57.305 +
57.306 +/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */
57.307 +
57.308 +#define PTHREAD_CANCEL_ENABLE 0
57.309 +#define PTHREAD_CANCEL_DISABLE 1
57.310 +
57.311 +#define PTHREAD_CANCEL_DEFERRED 0
57.312 +#define PTHREAD_CANCEL_ASYNCHRONOUS 1
57.313 +
57.314 +#define PTHREAD_CANCELED ((void *) -1)
57.315 +
57.316 +int pthread_cancel (pthread_t __pthread);
57.317 +
57.318 +/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */
57.319 +
57.320 +int pthread_setcancelstate (int __state, int *__oldstate);
57.321 +int pthread_setcanceltype (int __type, int *__oldtype);
57.322 +void pthread_testcancel (void);
57.323 +
57.324 +/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
57.325 +
57.326 +void _pthread_cleanup_push (struct _pthread_cleanup_context *_context,
57.327 + void (*_routine)(void *), void *_arg);
57.328 +
57.329 +void _pthread_cleanup_pop (struct _pthread_cleanup_context *_context,
57.330 + int _execute);
57.331 +
57.332 +/* It is intentional to open and close the scope in two different macros */
57.333 +#define pthread_cleanup_push(_routine, _arg) \
57.334 + do { \
57.335 + struct _pthread_cleanup_context _pthread_clup_ctx; \
57.336 + _pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg))
57.337 +
57.338 +#define pthread_cleanup_pop(_execute) \
57.339 + _pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \
57.340 + } while (0)
57.341 +
57.342 +#if __GNU_VISIBLE
57.343 +void _pthread_cleanup_push_defer (struct _pthread_cleanup_context *_context,
57.344 + void (*_routine)(void *), void *_arg);
57.345 +
57.346 +void _pthread_cleanup_pop_restore (struct _pthread_cleanup_context *_context,
57.347 + int _execute);
57.348 +
57.349 +/* It is intentional to open and close the scope in two different macros */
57.350 +#define pthread_cleanup_push_defer_np(_routine, _arg) \
57.351 + do { \
57.352 + struct _pthread_cleanup_context _pthread_clup_ctx; \
57.353 + _pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg))
57.354 +
57.355 +#define pthread_cleanup_pop_restore_np(_execute) \
57.356 + _pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \
57.357 + } while (0)
57.358 +#endif /* __GNU_VISIBLE */
57.359 +
57.360 +#if defined(_POSIX_THREAD_CPUTIME)
57.361 +
57.362 +/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */
57.363 +
57.364 +int pthread_getcpuclockid (pthread_t __pthread_id, clockid_t *__clock_id);
57.365 +
57.366 +#endif /* defined(_POSIX_THREAD_CPUTIME) */
57.367 +
57.368 +
57.369 +#endif /* defined(_POSIX_THREADS) */
57.370 +
57.371 +#if defined(_POSIX_BARRIERS)
57.372 +
57.373 +int pthread_barrierattr_init (pthread_barrierattr_t *__attr);
57.374 +int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr);
57.375 +int pthread_barrierattr_getpshared (const pthread_barrierattr_t *__attr,
57.376 + int *__pshared);
57.377 +int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
57.378 + int __pshared);
57.379 +
57.380 +#define PTHREAD_BARRIER_SERIAL_THREAD -1
57.381 +
57.382 +int pthread_barrier_init (pthread_barrier_t *__barrier,
57.383 + const pthread_barrierattr_t *__attr,
57.384 + unsigned __count);
57.385 +int pthread_barrier_destroy (pthread_barrier_t *__barrier);
57.386 +int pthread_barrier_wait (pthread_barrier_t *__barrier);
57.387 +
57.388 +#endif /* defined(_POSIX_BARRIERS) */
57.389 +
57.390 +#if defined(_POSIX_SPIN_LOCKS)
57.391 +
57.392 +int pthread_spin_init (pthread_spinlock_t *__spinlock, int __pshared);
57.393 +int pthread_spin_destroy (pthread_spinlock_t *__spinlock);
57.394 +int pthread_spin_lock (pthread_spinlock_t *__spinlock);
57.395 +int pthread_spin_trylock (pthread_spinlock_t *__spinlock);
57.396 +int pthread_spin_unlock (pthread_spinlock_t *__spinlock);
57.397 +
57.398 +#endif /* defined(_POSIX_SPIN_LOCKS) */
57.399 +
57.400 +#if defined(_POSIX_READER_WRITER_LOCKS)
57.401 +
57.402 +/* This is used to statically initialize a pthread_rwlock_t. Example:
57.403 +
57.404 + pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER;
57.405 + */
57.406 +
57.407 +#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_RWLOCK_INITIALIZER
57.408 +
57.409 +int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr);
57.410 +int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr);
57.411 +int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__attr,
57.412 + int *__pshared);
57.413 +int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
57.414 + int __pshared);
57.415 +
57.416 +int pthread_rwlock_init (pthread_rwlock_t *__rwlock,
57.417 + const pthread_rwlockattr_t *__attr);
57.418 +int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
57.419 +int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
57.420 +int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
57.421 +int pthread_rwlock_timedrdlock (pthread_rwlock_t *__rwlock,
57.422 + const struct timespec *__abstime);
57.423 +int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
57.424 +int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
57.425 +int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
57.426 +int pthread_rwlock_timedwrlock (pthread_rwlock_t *__rwlock,
57.427 + const struct timespec *__abstime);
57.428 +
57.429 +#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
57.430 +
57.431 +
57.432 +#ifdef __cplusplus
57.433 +}
57.434 +#endif
57.435 +
57.436 +#endif
57.437 +/* end of include file */
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/include/pwd.h Mon Oct 21 16:11:07 2019 +0200
58.3 @@ -0,0 +1,87 @@
58.4 +/*-
58.5 + * Copyright (c) 1989 The Regents of the University of California.
58.6 + * All rights reserved.
58.7 + *
58.8 + * Redistribution and use in source and binary forms, with or without
58.9 + * modification, are permitted provided that the following conditions
58.10 + * are met:
58.11 + * 1. Redistributions of source code must retain the above copyright
58.12 + * notice, this list of conditions and the following disclaimer.
58.13 + * 2. Redistributions in binary form must reproduce the above copyright
58.14 + * notice, this list of conditions and the following disclaimer in the
58.15 + * documentation and/or other materials provided with the distribution.
58.16 + * 3. All advertising materials mentioning features or use of this software
58.17 + * must display the following acknowledgement:
58.18 + * This product includes software developed by the University of
58.19 + * California, Berkeley and its contributors.
58.20 + * 4. Neither the name of the University nor the names of its contributors
58.21 + * may be used to endorse or promote products derived from this software
58.22 + * without specific prior written permission.
58.23 + *
58.24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
58.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58.27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58.34 + * SUCH DAMAGE.
58.35 + *
58.36 + * @(#)pwd.h 5.13 (Berkeley) 5/28/91
58.37 + */
58.38 +
58.39 +#ifndef _PWD_H_
58.40 +#ifdef __cplusplus
58.41 +extern "C" {
58.42 +#endif
58.43 +#define _PWD_H_
58.44 +
58.45 +#include <sys/cdefs.h>
58.46 +#include <sys/types.h>
58.47 +
58.48 +#if __BSD_VISIBLE
58.49 +#define _PATH_PASSWD "/etc/passwd"
58.50 +
58.51 +#define _PASSWORD_LEN 128 /* max length, not counting NULL */
58.52 +#endif
58.53 +
58.54 +struct passwd {
58.55 + char *pw_name; /* user name */
58.56 + char *pw_passwd; /* encrypted password */
58.57 + uid_t pw_uid; /* user uid */
58.58 + gid_t pw_gid; /* user gid */
58.59 + char *pw_comment; /* comment */
58.60 + char *pw_gecos; /* Honeywell login info */
58.61 + char *pw_dir; /* home directory */
58.62 + char *pw_shell; /* default shell */
58.63 +};
58.64 +
58.65 +#ifndef __INSIDE_CYGWIN__
58.66 +struct passwd *getpwuid (uid_t);
58.67 +struct passwd *getpwnam (const char *);
58.68 +
58.69 +#if __MISC_VISIBLE || __POSIX_VISIBLE
58.70 +int getpwnam_r (const char *, struct passwd *,
58.71 + char *, size_t , struct passwd **);
58.72 +int getpwuid_r (uid_t, struct passwd *, char *,
58.73 + size_t, struct passwd **);
58.74 +#endif
58.75 +
58.76 +#if __MISC_VISIBLE || __XSI_VISIBLE >= 4
58.77 +struct passwd *getpwent (void);
58.78 +void setpwent (void);
58.79 +void endpwent (void);
58.80 +#endif
58.81 +
58.82 +#if __BSD_VISIBLE
58.83 +int setpassent (int);
58.84 +#endif
58.85 +#endif /*!__INSIDE_CYGWIN__*/
58.86 +
58.87 +#ifdef __cplusplus
58.88 +}
58.89 +#endif
58.90 +#endif /* _PWD_H_ */
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/include/reent.h Mon Oct 21 16:11:07 2019 +0200
59.3 @@ -0,0 +1,188 @@
59.4 +/* This header file provides the reentrancy. */
59.5 +
59.6 +/* The reentrant system calls here serve two purposes:
59.7 +
59.8 + 1) Provide reentrant versions of the system calls the ANSI C library
59.9 + requires.
59.10 + 2) Provide these system calls in a namespace clean way.
59.11 +
59.12 + It is intended that *all* system calls that the ANSI C library needs
59.13 + be declared here. It documents them all in one place. All library access
59.14 + to the system is via some form of these functions.
59.15 +
59.16 + The target may provide the needed syscalls by any of the following:
59.17 +
59.18 + 1) Define the reentrant versions of the syscalls directly.
59.19 + (eg: _open_r, _close_r, etc.). Please keep the namespace clean.
59.20 + When you do this, set "syscall_dir" to "syscalls" and add
59.21 + -DREENTRANT_SYSCALLS_PROVIDED to newlib_cflags in configure.host.
59.22 +
59.23 + 2) Define namespace clean versions of the system calls by prefixing
59.24 + them with '_' (eg: _open, _close, etc.). Technically, there won't be
59.25 + true reentrancy at the syscall level, but the library will be namespace
59.26 + clean.
59.27 + When you do this, set "syscall_dir" to "syscalls" in configure.host.
59.28 +
59.29 + 3) Define or otherwise provide the regular versions of the syscalls
59.30 + (eg: open, close, etc.). The library won't be reentrant nor namespace
59.31 + clean, but at least it will work.
59.32 + When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
59.33 + configure.host.
59.34 +
59.35 + 4) Define or otherwise provide the regular versions of the syscalls,
59.36 + and do not supply functional interfaces for any of the reentrant
59.37 + calls. With this method, the reentrant syscalls are redefined to
59.38 + directly call the regular system call without the reentrancy argument.
59.39 + When you do this, specify both -DREENTRANT_SYSCALLS_PROVIDED and
59.40 + -DMISSING_SYSCALL_NAMES via newlib_cflags in configure.host and do
59.41 + not specify "syscall_dir".
59.42 +
59.43 + Stubs of the reentrant versions of the syscalls exist in the libc/reent
59.44 + source directory and are provided if REENTRANT_SYSCALLS_PROVIDED isn't
59.45 + defined. These stubs call the native system calls: _open, _close, etc.
59.46 + if MISSING_SYSCALL_NAMES is *not* defined, otherwise they call the
59.47 + non-underscored versions: open, close, etc. when MISSING_SYSCALL_NAMES
59.48 + *is* defined.
59.49 +
59.50 + By default, newlib functions call the reentrant syscalls internally,
59.51 + passing a reentrancy structure as an argument. This reentrancy structure
59.52 + contains data that is thread-specific. For example, the errno value is
59.53 + kept in the reentrancy structure. If multiple threads exist, each will
59.54 + keep a separate errno value which is intuitive since the application flow
59.55 + cannot check for failure reliably otherwise.
59.56 +
59.57 + The reentrant syscalls are either provided by the platform, by the
59.58 + libc/reent stubs, or in the case of both MISSING_SYSCALL_NAMES and
59.59 + REENTRANT_SYSCALLS_PROVIDED being defined, the calls are redefined to
59.60 + simply call the regular syscalls with no reentrancy struct argument.
59.61 +
59.62 + A single-threaded application does not need to worry about the reentrancy
59.63 + structure. It is used internally.
59.64 +
59.65 + A multi-threaded application needs either to manually manage reentrancy
59.66 + structures or use dynamic reentrancy.
59.67 +
59.68 + Manually managing reentrancy structures entails calling special reentrant
59.69 + versions of newlib functions that have an additional reentrancy argument.
59.70 + For example, _printf_r. By convention, the first argument is the
59.71 + reentrancy structure. By default, the normal version of the function
59.72 + uses the default reentrancy structure: _REENT. The reentrancy structure
59.73 + is passed internally, eventually to the reentrant syscalls themselves.
59.74 + How the structures are stored and accessed in this model is up to the
59.75 + application.
59.76 +
59.77 + Dynamic reentrancy is specified by the __DYNAMIC_REENT__ flag. This
59.78 + flag denotes setting up a macro to replace _REENT with a function call
59.79 + to __getreent(). This function needs to be implemented by the platform
59.80 + and it is meant to return the reentrancy structure for the current
59.81 + thread. When the regular C functions (e.g. printf) go to call internal
59.82 + routines with the default _REENT structure, they end up calling with
59.83 + the reentrancy structure for the thread. Thus, application code does not
59.84 + need to call the _r routines nor worry about reentrancy structures. */
59.85 +
59.86 +/* WARNING: All identifiers here must begin with an underscore. This file is
59.87 + included by stdio.h and others and we therefore must only use identifiers
59.88 + in the namespace allotted to us. */
59.89 +
59.90 +#ifndef _REENT_H_
59.91 +#ifdef __cplusplus
59.92 +extern "C" {
59.93 +#endif
59.94 +#define _REENT_H_
59.95 +
59.96 +#include <sys/reent.h>
59.97 +#include <sys/_types.h>
59.98 +
59.99 +#define __need_size_t
59.100 +#define __need_ptrdiff_t
59.101 +#include <stddef.h>
59.102 +
59.103 +/* FIXME: not namespace clean */
59.104 +struct stat;
59.105 +struct tms;
59.106 +struct timeval;
59.107 +struct timezone;
59.108 +
59.109 +#if defined(REENTRANT_SYSCALLS_PROVIDED) && defined(MISSING_SYSCALL_NAMES)
59.110 +
59.111 +#define _close_r(__reent, __fd) close(__fd)
59.112 +#define _execve_r(__reent, __f, __arg, __env) execve(__f, __arg, __env)
59.113 +#define _fcntl_r(__reent, __fd, __cmd, __arg) fcntl(__fd, __cmd, __arg)
59.114 +#define _fork_r(__reent) fork()
59.115 +#define _fstat_r(__reent, __fdes, __stat) fstat(__fdes, __stat)
59.116 +#define _getpid_r(__reent) getpid()
59.117 +#define _isatty_r(__reent, __desc) isatty(__desc)
59.118 +#define _kill_r(__reent, __pid, __signal) kill(__pid, __signal)
59.119 +#define _link_r(__reent, __oldpath, __newpath) link(__oldpath, __newpath)
59.120 +#define _lseek_r(__reent, __fdes, __off, __w) lseek(__fdes, __off, __w)
59.121 +#define _mkdir_r(__reent, __path, __m) mkdir(__path, __m)
59.122 +#define _open_r(__reent, __path, __flag, __m) open(__path, __flag, __m)
59.123 +#define _read_r(__reent, __fd, __buff, __cnt) read(__fd, __buff, __cnt)
59.124 +#define _rename_r(__reent, __old, __new) rename(__old, __new)
59.125 +#define _sbrk_r(__reent, __incr) sbrk(__incr)
59.126 +#define _stat_r(__reent, __path, __buff) stat(__path, __buff)
59.127 +#define _times_r(__reent, __time) times(__time)
59.128 +#define _unlink_r(__reent, __path) unlink(__path)
59.129 +#define _wait_r(__reent, __status) wait(__status)
59.130 +#define _write_r(__reent, __fd, __buff, __cnt) write(__fd, __buff, __cnt)
59.131 +#define _gettimeofday_r(__reent, __tp, __tzp) gettimeofday(__tp, __tzp)
59.132 +
59.133 +#ifdef __LARGE64_FILES
59.134 +#define _lseek64_r(__reent, __fd, __off, __w) lseek64(__fd, __off, __w)
59.135 +#define _fstat64_r(__reent, __fd, __buff) fstat64(__fd, __buff)
59.136 +#define _open64_r(__reent, __path, __flag, __m) open64(__path, __flag, __m)
59.137 +#endif
59.138 +
59.139 +#else
59.140 +/* Reentrant versions of system calls. */
59.141 +
59.142 +extern int _close_r (struct _reent *, int);
59.143 +extern int _execve_r (struct _reent *, const char *, char *const *, char *const *);
59.144 +extern int _fcntl_r (struct _reent *, int, int, int);
59.145 +extern int _fork_r (struct _reent *);
59.146 +extern int _fstat_r (struct _reent *, int, struct stat *);
59.147 +extern int _getpid_r (struct _reent *);
59.148 +extern int _isatty_r (struct _reent *, int);
59.149 +extern int _kill_r (struct _reent *, int, int);
59.150 +extern int _link_r (struct _reent *, const char *, const char *);
59.151 +extern _off_t _lseek_r (struct _reent *, int, _off_t, int);
59.152 +extern int _mkdir_r (struct _reent *, const char *, int);
59.153 +extern int _open_r (struct _reent *, const char *, int, int);
59.154 +extern _ssize_t _read_r (struct _reent *, int, void *, size_t);
59.155 +extern int _rename_r (struct _reent *, const char *, const char *);
59.156 +extern void *_sbrk_r (struct _reent *, ptrdiff_t);
59.157 +extern int _stat_r (struct _reent *, const char *, struct stat *);
59.158 +extern _CLOCK_T_ _times_r (struct _reent *, struct tms *);
59.159 +extern int _unlink_r (struct _reent *, const char *);
59.160 +extern int _wait_r (struct _reent *, int *);
59.161 +extern _ssize_t _write_r (struct _reent *, int, const void *, size_t);
59.162 +
59.163 +/* This one is not guaranteed to be available on all targets. */
59.164 +extern int _gettimeofday_r (struct _reent *, struct timeval *__tp, void *__tzp);
59.165 +
59.166 +#ifdef __LARGE64_FILES
59.167 +
59.168 +
59.169 +#if defined(__CYGWIN__)
59.170 +#define stat64 stat
59.171 +#endif
59.172 +struct stat64;
59.173 +
59.174 +extern _off64_t _lseek64_r (struct _reent *, int, _off64_t, int);
59.175 +extern int _fstat64_r (struct _reent *, int, struct stat64 *);
59.176 +extern int _open64_r (struct _reent *, const char *, int, int);
59.177 +extern int _stat64_r (struct _reent *, const char *, struct stat64 *);
59.178 +
59.179 +/* Don't pollute namespace if not building newlib. */
59.180 +#if defined (__CYGWIN__) && !defined (_COMPILING_NEWLIB)
59.181 +#undef stat64
59.182 +#endif
59.183 +
59.184 +#endif
59.185 +
59.186 +#endif
59.187 +
59.188 +#ifdef __cplusplus
59.189 +}
59.190 +#endif
59.191 +#endif /* _REENT_H_ */
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/include/regdef.h Mon Oct 21 16:11:07 2019 +0200
60.3 @@ -0,0 +1,7 @@
60.4 +/* regdef.h -- define register names. */
60.5 +
60.6 +/* This is a standard include file for MIPS targets. Other target
60.7 + probably don't define it, and attempts to include this file will
60.8 + fail. */
60.9 +
60.10 +#include <machine/regdef.h>
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/include/regex.h Mon Oct 21 16:11:07 2019 +0200
61.3 @@ -0,0 +1,103 @@
61.4 +/*-
61.5 + * Copyright (c) 1992 Henry Spencer.
61.6 + * Copyright (c) 1992, 1993
61.7 + * The Regents of the University of California. All rights reserved.
61.8 + *
61.9 + * This code is derived from software contributed to Berkeley by
61.10 + * Henry Spencer of the University of Toronto.
61.11 + *
61.12 + * Redistribution and use in source and binary forms, with or without
61.13 + * modification, are permitted provided that the following conditions
61.14 + * are met:
61.15 + * 1. Redistributions of source code must retain the above copyright
61.16 + * notice, this list of conditions and the following disclaimer.
61.17 + * 2. Redistributions in binary form must reproduce the above copyright
61.18 + * notice, this list of conditions and the following disclaimer in the
61.19 + * documentation and/or other materials provided with the distribution.
61.20 + * 4. Neither the name of the University nor the names of its contributors
61.21 + * may be used to endorse or promote products derived from this software
61.22 + * without specific prior written permission.
61.23 + *
61.24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61.27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
61.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61.34 + * SUCH DAMAGE.
61.35 + *
61.36 + * @(#)regex.h 8.2 (Berkeley) 1/3/94
61.37 + * $FreeBSD: src/include/regex.h,v 1.4 2002/03/23 17:24:53 imp Exp $
61.38 + */
61.39 +
61.40 +#ifndef _REGEX_H_
61.41 +#define _REGEX_H_
61.42 +
61.43 +#include <sys/cdefs.h>
61.44 +
61.45 +/* types */
61.46 +typedef off_t regoff_t;
61.47 +
61.48 +typedef struct {
61.49 + int re_magic;
61.50 + size_t re_nsub; /* number of parenthesized subexpressions */
61.51 + __const char *re_endp; /* end pointer for REG_PEND */
61.52 + struct re_guts *re_g; /* none of your business :-) */
61.53 +} regex_t;
61.54 +
61.55 +typedef struct {
61.56 + regoff_t rm_so; /* start of match */
61.57 + regoff_t rm_eo; /* end of match */
61.58 +} regmatch_t;
61.59 +
61.60 +/* regcomp() flags */
61.61 +#define REG_BASIC 0000
61.62 +#define REG_EXTENDED 0001
61.63 +#define REG_ICASE 0002
61.64 +#define REG_NOSUB 0004
61.65 +#define REG_NEWLINE 0010
61.66 +#define REG_NOSPEC 0020
61.67 +#define REG_PEND 0040
61.68 +#define REG_DUMP 0200
61.69 +
61.70 +/* regerror() flags */
61.71 +#define REG_NOMATCH 1
61.72 +#define REG_BADPAT 2
61.73 +#define REG_ECOLLATE 3
61.74 +#define REG_ECTYPE 4
61.75 +#define REG_EESCAPE 5
61.76 +#define REG_ESUBREG 6
61.77 +#define REG_EBRACK 7
61.78 +#define REG_EPAREN 8
61.79 +#define REG_EBRACE 9
61.80 +#define REG_BADBR 10
61.81 +#define REG_ERANGE 11
61.82 +#define REG_ESPACE 12
61.83 +#define REG_BADRPT 13
61.84 +#define REG_EMPTY 14
61.85 +#define REG_ASSERT 15
61.86 +#define REG_INVARG 16
61.87 +#define REG_ATOI 255 /* convert name to number (!) */
61.88 +#define REG_ITOA 0400 /* convert number to name (!) */
61.89 +
61.90 +/* regexec() flags */
61.91 +#define REG_NOTBOL 00001
61.92 +#define REG_NOTEOL 00002
61.93 +#define REG_STARTEND 00004
61.94 +#define REG_TRACE 00400 /* tracing of execution */
61.95 +#define REG_LARGE 01000 /* force large representation */
61.96 +#define REG_BACKR 02000 /* force use of backref code */
61.97 +
61.98 +__BEGIN_DECLS
61.99 +int regcomp(regex_t *__restrict, const char *__restrict, int);
61.100 +size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
61.101 +int regexec(const regex_t *__restrict, const char *__restrict,
61.102 + size_t, regmatch_t [__restrict], int);
61.103 +void regfree(regex_t *);
61.104 +__END_DECLS
61.105 +
61.106 +#endif /* !_REGEX_H_ */
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/include/rpc/types.h Mon Oct 21 16:11:07 2019 +0200
62.3 @@ -0,0 +1,85 @@
62.4 +
62.5 +/*
62.6 + * Copyright (c) 2009, Sun Microsystems, Inc.
62.7 + * All rights reserved.
62.8 + *
62.9 + * Redistribution and use in source and binary forms, with or without
62.10 + * modification, are permitted provided that the following conditions are met:
62.11 + * - Redistributions of source code must retain the above copyright notice,
62.12 + * this list of conditions and the following disclaimer.
62.13 + * - Redistributions in binary form must reproduce the above copyright notice,
62.14 + * this list of conditions and the following disclaimer in the documentation
62.15 + * and/or other materials provided with the distribution.
62.16 + * - Neither the name of Sun Microsystems, Inc. nor the names of its
62.17 + * contributors may be used to endorse or promote products derived
62.18 + * from this software without specific prior written permission.
62.19 + *
62.20 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
62.21 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
62.24 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62.25 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
62.26 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
62.27 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62.28 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62.29 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
62.30 + * POSSIBILITY OF SUCH DAMAGE.
62.31 + *
62.32 + * from: @(#)types.h 1.18 87/07/24 SMI
62.33 + * from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
62.34 + * $FreeBSD: src/include/rpc/types.h,v 1.10.6.1 2003/12/18 00:59:50 peter Exp $
62.35 + * $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $
62.36 + */
62.37 +
62.38 +/*
62.39 + * Rpc additions to <sys/types.h>
62.40 + */
62.41 +#ifndef _RPC_TYPES_H
62.42 +#define _RPC_TYPES_H
62.43 +
62.44 +#include <stdint.h>
62.45 +#include <sys/types.h>
62.46 +
62.47 +#define __need_NULL
62.48 +#include <stddef.h>
62.49 +
62.50 +#ifdef __cplusplus
62.51 +extern "C" {
62.52 +#endif
62.53 +
62.54 +#if defined(___int64_t_defined)
62.55 +typedef u_int64_t u_quad_t;
62.56 +typedef int64_t quad_t;
62.57 +#endif /* ___int64_t_defined */
62.58 +typedef int32_t bool_t;
62.59 +typedef int32_t enum_t;
62.60 +
62.61 +typedef u_int32_t rpcprog_t;
62.62 +typedef u_int32_t rpcvers_t;
62.63 +typedef u_int32_t rpcproc_t;
62.64 +typedef u_int32_t rpcprot_t;
62.65 +typedef u_int32_t rpcport_t;
62.66 +typedef int32_t rpc_inline_t;
62.67 +
62.68 +#define __dontcare__ -1
62.69 +
62.70 +#ifndef FALSE
62.71 +# define FALSE 0
62.72 +#endif
62.73 +#ifndef TRUE
62.74 +# define TRUE 1
62.75 +#endif
62.76 +
62.77 +#ifndef mem_alloc
62.78 +#define mem_alloc(bsize) calloc(1, bsize)
62.79 +#endif
62.80 +#ifndef mem_free
62.81 +#define mem_free(ptr, bsize) free(ptr)
62.82 +#endif
62.83 +
62.84 +#ifdef __cplusplus
62.85 +}
62.86 +#endif
62.87 +
62.88 +#endif /* !_RPC_TYPES_H */
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/include/rpc/xdr.h Mon Oct 21 16:11:07 2019 +0200
63.3 @@ -0,0 +1,389 @@
63.4 +
63.5 +/*
63.6 + * Copyright (c) 2009, Sun Microsystems, Inc.
63.7 + * All rights reserved.
63.8 + *
63.9 + * Redistribution and use in source and binary forms, with or without
63.10 + * modification, are permitted provided that the following conditions are met:
63.11 + * - Redistributions of source code must retain the above copyright notice,
63.12 + * this list of conditions and the following disclaimer.
63.13 + * - Redistributions in binary form must reproduce the above copyright notice,
63.14 + * this list of conditions and the following disclaimer in the documentation
63.15 + * and/or other materials provided with the distribution.
63.16 + * - Neither the name of Sun Microsystems, Inc. nor the names of its
63.17 + * contributors may be used to endorse or promote products derived
63.18 + * from this software without specific prior written permission.
63.19 + *
63.20 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
63.21 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
63.24 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
63.25 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63.26 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63.27 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
63.28 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63.29 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
63.30 + * POSSIBILITY OF SUCH DAMAGE.
63.31 + *
63.32 + * from: @(#)xdr.h 1.19 87/04/22 SMI
63.33 + * from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
63.34 + * $FreeBSD: src/include/rpc/xdr.h,v 1.23 2003/03/07 13:19:40 nectar Exp $
63.35 + * $NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $
63.36 + */
63.37 +
63.38 +/*
63.39 + * xdr.h, External Data Representation Serialization Routines.
63.40 + *
63.41 + * Copyright (C) 1984, Sun Microsystems, Inc.
63.42 + */
63.43 +
63.44 +#ifndef _RPC_XDR_H
63.45 +#define _RPC_XDR_H
63.46 +#include <_ansi.h>
63.47 +#include <rpc/types.h>
63.48 +
63.49 +#ifdef __cplusplus
63.50 +extern "C" {
63.51 +#endif
63.52 +
63.53 +/*
63.54 + * XDR provides a conventional way for converting between C data
63.55 + * types and an external bit-string representation. Library supplied
63.56 + * routines provide for the conversion on built-in C data types. These
63.57 + * routines and utility routines defined here are used to help implement
63.58 + * a type encode/decode routine for each user-defined type.
63.59 + *
63.60 + * Each data type provides a single procedure which takes two arguments:
63.61 + *
63.62 + * bool_t
63.63 + * xdrproc(XDR *xdrs, <type> *argresp)
63.64 + *
63.65 + * xdrs is an instance of a XDR handle, to which or from which the data
63.66 + * type is to be converted. argresp is a pointer to the structure to be
63.67 + * converted. The XDR handle contains an operation field which indicates
63.68 + * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
63.69 + *
63.70 + * XDR_DECODE may allocate space if the pointer argresp is null. This
63.71 + * data can be freed with the XDR_FREE operation.
63.72 + *
63.73 + * We write only one procedure per data type to make it easy
63.74 + * to keep the encode and decode procedures for a data type consistent.
63.75 + * In many cases the same code performs all operations on a user defined type,
63.76 + * because all the hard work is done in the component type routines.
63.77 + * decode as a series of calls on the nested data types.
63.78 + */
63.79 +
63.80 +/*
63.81 + * Xdr operations. XDR_ENCODE causes the type to be encoded into the
63.82 + * stream. XDR_DECODE causes the type to be extracted from the stream.
63.83 + * XDR_FREE can be used to release the space allocated by an XDR_DECODE
63.84 + * request.
63.85 + */
63.86 +enum xdr_op
63.87 +{
63.88 + XDR_ENCODE = 0,
63.89 + XDR_DECODE = 1,
63.90 + XDR_FREE = 2
63.91 +};
63.92 +
63.93 +/*
63.94 + * This is the number of bytes per unit of external data.
63.95 + */
63.96 +#define BYTES_PER_XDR_UNIT (4)
63.97 +#if 1
63.98 +/* faster version when BYTES_PER_XDR_UNIT is a power of two */
63.99 +# define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1))
63.100 +#else /* old version */
63.101 +#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
63.102 + * BYTES_PER_XDR_UNIT)
63.103 +#endif
63.104 +
63.105 +/*
63.106 + * The XDR handle.
63.107 + * Contains operation which is being applied to the stream,
63.108 + * an operations vector for the particular implementation (e.g. see xdr_mem.c),
63.109 + * and two private fields for the use of the particular implementation.
63.110 + */
63.111 +typedef struct __rpc_xdr
63.112 +{
63.113 + enum xdr_op x_op; /* operation; fast additional param */
63.114 + const struct xdr_ops
63.115 + {
63.116 + /* get a long from underlying stream */
63.117 + bool_t (*x_getlong) (struct __rpc_xdr *, long *);
63.118 +
63.119 + /* put a long to " */
63.120 + bool_t (*x_putlong) (struct __rpc_xdr *, const long *);
63.121 +
63.122 + /* get some bytes from " */
63.123 + bool_t (*x_getbytes) (struct __rpc_xdr *, char *, u_int);
63.124 +
63.125 + /* put some bytes to " */
63.126 + bool_t (*x_putbytes) (struct __rpc_xdr *, const char *, u_int);
63.127 +
63.128 + /* returns bytes off from beginning */
63.129 + u_int (*x_getpostn) (struct __rpc_xdr *);
63.130 +
63.131 + /* lets you reposition the stream */
63.132 + bool_t (*x_setpostn) (struct __rpc_xdr *, u_int);
63.133 +
63.134 + /* buf quick ptr to buffered data */
63.135 + int32_t * (*x_inline) (struct __rpc_xdr *, u_int);
63.136 +
63.137 + /* free privates of this xdr_stream */
63.138 + void (*x_destroy) (struct __rpc_xdr *);
63.139 +
63.140 + /* get an int32 from this xdr_stream */
63.141 + bool_t (*x_getint32) (struct __rpc_xdr *, int32_t *);
63.142 +
63.143 + /* put an int32 to the underlying stream */
63.144 + bool_t (*x_putint32) (struct __rpc_xdr *, const int32_t *);
63.145 +
63.146 + } *x_ops;
63.147 + char *x_public; /* users' data */
63.148 + void *x_private; /* pointer to private data */
63.149 + char *x_base; /* private used for position info */
63.150 + u_int x_handy; /* extra private word */
63.151 +} XDR;
63.152 +
63.153 +/*
63.154 + * A xdrproc_t exists for each data type which is to be encoded or decoded.
63.155 + *
63.156 + * The second argument to the xdrproc_t is a pointer to an opaque pointer.
63.157 + * The opaque pointer generally points to a structure of the data type
63.158 + * to be decoded. If this pointer is 0, then the type routines should
63.159 + * allocate dynamic storage of the appropriate size and return it.
63.160 + * bool_t (*xdrproc_t)(XDR *, some_type *)
63.161 + */
63.162 +typedef bool_t (*xdrproc_t) (XDR *, ...);
63.163 +
63.164 +/*
63.165 + * Operations defined on a XDR handle
63.166 + *
63.167 + * XDR *xdrs;
63.168 + * long *longp;
63.169 + * char *addr;
63.170 + * u_int len;
63.171 + * u_int pos;
63.172 + */
63.173 +#define XDR_GETINT32(xdrs, int32p) \
63.174 + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
63.175 +#define xdr_getint32(xdrs, int32p) \
63.176 + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
63.177 +
63.178 +#define XDR_PUTINT32(xdrs, int32p) \
63.179 + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
63.180 +#define xdr_putint32(xdrs, int32p) \
63.181 + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
63.182 +
63.183 +#define XDR_GETLONG(xdrs, longp) \
63.184 + (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
63.185 +#define xdr_getlong(xdrs, longp) \
63.186 + (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
63.187 +
63.188 +#define XDR_PUTLONG(xdrs, longp) \
63.189 + (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
63.190 +#define xdr_putlong(xdrs, longp) \
63.191 + (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
63.192 +
63.193 +#define XDR_GETBYTES(xdrs, addr, len) \
63.194 + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
63.195 +#define xdr_getbytes(xdrs, addr, len) \
63.196 + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
63.197 +
63.198 +#define XDR_PUTBYTES(xdrs, addr, len) \
63.199 + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
63.200 +#define xdr_putbytes(xdrs, addr, len) \
63.201 + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
63.202 +
63.203 +#define XDR_GETPOS(xdrs) \
63.204 + (*(xdrs)->x_ops->x_getpostn)(xdrs)
63.205 +#define xdr_getpos(xdrs) \
63.206 + (*(xdrs)->x_ops->x_getpostn)(xdrs)
63.207 +
63.208 +#define XDR_SETPOS(xdrs, pos) \
63.209 + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
63.210 +#define xdr_setpos(xdrs, pos) \
63.211 + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
63.212 +
63.213 +#define XDR_INLINE(xdrs, len) \
63.214 + (*(xdrs)->x_ops->x_inline)(xdrs, len)
63.215 +#define xdr_inline(xdrs, len) \
63.216 + (*(xdrs)->x_ops->x_inline)(xdrs, len)
63.217 +
63.218 +#define XDR_DESTROY(xdrs) \
63.219 + do { \
63.220 + if ((xdrs)->x_ops->x_destroy) \
63.221 + (*(xdrs)->x_ops->x_destroy)(xdrs); \
63.222 + } while (0)
63.223 +#define xdr_destroy(xdrs) \
63.224 + do { \
63.225 + if ((xdrs)->x_ops->x_destroy) \
63.226 + (*(xdrs)->x_ops->x_destroy)(xdrs); \
63.227 + } while (0)
63.228 +
63.229 +/*
63.230 + * Solaris strips the '_t' from these types -- not sure why.
63.231 + * But, let's be compatible.
63.232 + */
63.233 +#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
63.234 +#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
63.235 +#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
63.236 +#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
63.237 +#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
63.238 +
63.239 +/*
63.240 + * Support struct for discriminated unions.
63.241 + * You create an array of xdrdiscrim structures, terminated with
63.242 + * an entry with a null procedure pointer. The xdr_union routine gets
63.243 + * the discriminant value and then searches the array of structures
63.244 + * for a matching value. If a match is found the associated xdr routine
63.245 + * is called to handle that part of the union. If there is
63.246 + * no match, then a default routine may be called.
63.247 + * If there is no match and no default routine it is an error.
63.248 + */
63.249 +#define NULL_xdrproc_t ((xdrproc_t)0)
63.250 +struct xdr_discrim
63.251 +{
63.252 + int value;
63.253 + xdrproc_t proc;
63.254 +};
63.255 +
63.256 +/*
63.257 + * In-line routines for fast encode/decode of primitive data types.
63.258 + * Caveat emptor: these use single memory cycles to get the
63.259 + * data from the underlying buffer, and will fail to operate
63.260 + * properly if the data is not aligned. The standard way to use these
63.261 + * is to say:
63.262 + * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
63.263 + * return (FALSE);
63.264 + * <<< macro calls >>>
63.265 + * where ``count'' is the number of bytes of data occupied
63.266 + * by the primitive data types.
63.267 + *
63.268 + * N.B. and frozen for all time: each data type here uses 4 bytes
63.269 + * of external representation.
63.270 + */
63.271 +#define IXDR_GET_INT32(buf) ((int32_t)ntohl((u_int32_t)*(buf)++))
63.272 +#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
63.273 +#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
63.274 +#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
63.275 +
63.276 +/* Warning: inline long routines are broken for 64 bit platforms.
63.277 + * Because the other inline routines below are implemented in terms
63.278 + * of them, they are all also broken for 64 bit platforms.
63.279 + */
63.280 +#define IXDR_GET_LONG(buf) ((long)ntohl((u_int32_t)*(buf)++))
63.281 +#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
63.282 +#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
63.283 +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v))
63.284 +
63.285 +#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
63.286 +#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
63.287 +#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
63.288 +#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
63.289 +
63.290 +#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), (v))
63.291 +#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v))
63.292 +#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v))
63.293 +#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v))
63.294 +
63.295 +/*
63.296 + * These are the "generic" xdr routines.
63.297 + */
63.298 +extern bool_t xdr_void (void);
63.299 +extern bool_t xdr_short (XDR *, short *);
63.300 +extern bool_t xdr_u_short (XDR *, u_short *);
63.301 +extern bool_t xdr_int (XDR *, int *);
63.302 +extern bool_t xdr_u_int (XDR *, u_int *);
63.303 +extern bool_t xdr_long (XDR *, long *);
63.304 +extern bool_t xdr_u_long (XDR *, u_long *);
63.305 +extern bool_t xdr_int8_t (XDR *, int8_t *);
63.306 +extern bool_t xdr_uint8_t (XDR *, uint8_t *);
63.307 +extern bool_t xdr_u_int8_t (XDR *, u_int8_t *);
63.308 +extern bool_t xdr_int16_t (XDR *, int16_t *);
63.309 +extern bool_t xdr_uint16_t (XDR *, uint16_t *);
63.310 +extern bool_t xdr_u_int16_t (XDR *, u_int16_t *);
63.311 +extern bool_t xdr_int32_t (XDR *, int32_t *);
63.312 +extern bool_t xdr_uint32_t (XDR *, uint32_t *);
63.313 +extern bool_t xdr_u_int32_t (XDR *, u_int32_t *);
63.314 +#if defined(___int64_t_defined)
63.315 +extern bool_t xdr_int64_t (XDR *, int64_t *);
63.316 +extern bool_t xdr_uint64_t (XDR *, uint64_t *);
63.317 +extern bool_t xdr_u_int64_t (XDR *, u_int64_t *);
63.318 +#endif /* ___int64_t_defined */
63.319 +extern bool_t xdr_bool (XDR *, bool_t *);
63.320 +extern bool_t xdr_enum (XDR *, enum_t *);
63.321 +extern bool_t xdr_array (XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
63.322 +extern bool_t xdr_bytes (XDR *, char **, u_int *, u_int);
63.323 +extern bool_t xdr_opaque (XDR *, char *, u_int);
63.324 +extern bool_t xdr_string (XDR *, char **, u_int);
63.325 +extern bool_t xdr_union (XDR *, enum_t *, char *,
63.326 + const struct xdr_discrim *, xdrproc_t);
63.327 +extern bool_t xdr_char (XDR *, char *);
63.328 +extern bool_t xdr_u_char (XDR *, u_char *);
63.329 +extern bool_t xdr_vector (XDR *, char *, u_int, u_int, xdrproc_t);
63.330 +extern bool_t xdr_float (XDR *, float *);
63.331 +extern bool_t xdr_double (XDR *, double *);
63.332 +/* extern bool_t xdr_quadruple (XDR *, long double *); */
63.333 +extern bool_t xdr_reference (XDR *, char **, u_int, xdrproc_t);
63.334 +extern bool_t xdr_pointer (XDR *, char **, u_int, xdrproc_t);
63.335 +extern bool_t xdr_wrapstring (XDR *, char **);
63.336 +#if defined(___int64_t_defined)
63.337 +extern bool_t xdr_hyper (XDR *, quad_t *);
63.338 +extern bool_t xdr_u_hyper (XDR *, u_quad_t *);
63.339 +extern bool_t xdr_longlong_t (XDR *, quad_t *);
63.340 +extern bool_t xdr_u_longlong_t (XDR *, u_quad_t *);
63.341 +#endif /* ___int64_t_defined */
63.342 +extern u_long xdr_sizeof (xdrproc_t, void *);
63.343 +
63.344 +/*
63.345 + * Common opaque bytes objects used by many rpc protocols;
63.346 + * declared here due to commonality.
63.347 + */
63.348 +#define MAX_NETOBJ_SZ 1024
63.349 +struct netobj
63.350 +{
63.351 + u_int n_len;
63.352 + char *n_bytes;
63.353 +};
63.354 +typedef struct netobj netobj;
63.355 +extern bool_t xdr_netobj (XDR *, struct netobj *);
63.356 +
63.357 +/*
63.358 + * These are the public routines for the various implementations of
63.359 + * xdr streams.
63.360 + */
63.361 +
63.362 +/* XDR using memory buffers */
63.363 +extern void xdrmem_create (XDR *, char *, u_int, enum xdr_op);
63.364 +
63.365 +/* XDR using stdio library */
63.366 +#if defined(_STDIO_H_)
63.367 +extern void xdrstdio_create (XDR *, FILE *, enum xdr_op);
63.368 +#endif
63.369 +
63.370 +/* XDR pseudo records for tcp */
63.371 +extern void xdrrec_create (XDR *, u_int, u_int, void *,
63.372 + int (*) (void *, void *, int),
63.373 + int (*) (void *, void *, int));
63.374 +
63.375 +/* make end of xdr record */
63.376 +extern bool_t xdrrec_endofrecord (XDR *, bool_t);
63.377 +
63.378 +/* move to beginning of next record */
63.379 +extern bool_t xdrrec_skiprecord (XDR *);
63.380 +
63.381 +/* true if no more input */
63.382 +extern bool_t xdrrec_eof (XDR *);
63.383 +extern u_int xdrrec_readbytes (XDR *, caddr_t, u_int);
63.384 +
63.385 +/* free memory buffers for xdr */
63.386 +extern void xdr_free (xdrproc_t, void *);
63.387 +
63.388 +#ifdef __cplusplus
63.389 +}
63.390 +#endif
63.391 +
63.392 +#endif /* !_RPC_XDR_H */
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/include/sched.h Mon Oct 21 16:11:07 2019 +0200
64.3 @@ -0,0 +1,112 @@
64.4 +/*
64.5 + * Written by Joel Sherrill <joel@OARcorp.com>.
64.6 + *
64.7 + * COPYRIGHT (c) 1989-2010.
64.8 + * On-Line Applications Research Corporation (OAR).
64.9 + *
64.10 + * Permission to use, copy, modify, and distribute this software for any
64.11 + * purpose without fee is hereby granted, provided that this entire notice
64.12 + * is included in all copies of any software which is or includes a copy
64.13 + * or modification of this software.
64.14 + *
64.15 + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
64.16 + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
64.17 + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
64.18 + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
64.19 + *
64.20 + * $Id$
64.21 + */
64.22 +
64.23 +#ifndef _SCHED_H_
64.24 +#define _SCHED_H_
64.25 +
64.26 +#include <sys/types.h>
64.27 +#include <sys/sched.h>
64.28 +
64.29 +#ifdef __cplusplus
64.30 +extern "C" {
64.31 +#endif
64.32 +
64.33 +#if defined(_POSIX_PRIORITY_SCHEDULING)
64.34 +/*
64.35 + * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803
64.36 + */
64.37 +int sched_setparam(
64.38 + pid_t __pid,
64.39 + const struct sched_param *__param
64.40 +);
64.41 +
64.42 +/*
64.43 + * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800
64.44 + */
64.45 +int sched_getparam(
64.46 + pid_t __pid,
64.47 + struct sched_param *__param
64.48 +);
64.49 +
64.50 +/*
64.51 + * XBD 13 - Set Scheduling Policy and Scheduling Parameters,
64.52 + * P1003.1b-2008, p. 1805
64.53 + */
64.54 +int sched_setscheduler(
64.55 + pid_t __pid,
64.56 + int __policy,
64.57 + const struct sched_param *__param
64.58 +);
64.59 +
64.60 +/*
64.61 + * XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801
64.62 + */
64.63 +int sched_getscheduler(
64.64 + pid_t __pid
64.65 +);
64.66 +
64.67 +/*
64.68 + * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799
64.69 + */
64.70 +int sched_get_priority_max(
64.71 + int __policy
64.72 +);
64.73 +
64.74 +int sched_get_priority_min(
64.75 + int __policy
64.76 +);
64.77 +
64.78 +/*
64.79 + * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802
64.80 + */
64.81 +int sched_rr_get_interval(
64.82 + pid_t __pid,
64.83 + struct timespec *__interval
64.84 +);
64.85 +#endif /* _POSIX_PRIORITY_SCHEDULING */
64.86 +
64.87 +#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
64.88 +
64.89 +/*
64.90 + * XBD 13 - Yield Processor, P1003.1b-2008, p. 1807
64.91 + */
64.92 +int sched_yield( void );
64.93 +
64.94 +#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
64.95 +
64.96 +#if __GNU_VISIBLE
64.97 +int sched_getcpu(void);
64.98 +
64.99 +/* The following functions should only be declared if the type
64.100 + cpu_set_t is defined through indirect inclusion of sys/cpuset.h,
64.101 + only available on some targets. */
64.102 +#ifdef _SYS_CPUSET_H_
64.103 +int sched_getaffinity (pid_t, size_t, cpu_set_t *);
64.104 +int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
64.105 +int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
64.106 +int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
64.107 +#endif /* _SYS_CPUSET_H_ */
64.108 +
64.109 +#endif
64.110 +
64.111 +#ifdef __cplusplus
64.112 +}
64.113 +#endif
64.114 +
64.115 +#endif /* _SCHED_H_ */
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/include/search.h Mon Oct 21 16:11:07 2019 +0200
65.3 @@ -0,0 +1,64 @@
65.4 +/* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
65.5 +/* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */
65.6 +
65.7 +/*
65.8 + * Written by J.T. Conklin <jtc@netbsd.org>
65.9 + * Public domain.
65.10 + */
65.11 +
65.12 +#ifndef _SEARCH_H_
65.13 +#define _SEARCH_H_
65.14 +
65.15 +#include <sys/cdefs.h>
65.16 +#include <machine/ansi.h>
65.17 +#include <sys/types.h>
65.18 +
65.19 +typedef struct entry {
65.20 + char *key;
65.21 + void *data;
65.22 +} ENTRY;
65.23 +
65.24 +typedef enum {
65.25 + FIND, ENTER
65.26 +} ACTION;
65.27 +
65.28 +typedef enum {
65.29 + preorder,
65.30 + postorder,
65.31 + endorder,
65.32 + leaf
65.33 +} VISIT;
65.34 +
65.35 +#ifdef _SEARCH_PRIVATE
65.36 +typedef struct node {
65.37 + char *key;
65.38 + struct node *llink, *rlink;
65.39 +} node_t;
65.40 +#endif
65.41 +
65.42 +struct hsearch_data
65.43 +{
65.44 + struct internal_head *htable;
65.45 + size_t htablesize;
65.46 +};
65.47 +
65.48 +#ifndef __compar_fn_t_defined
65.49 +#define __compar_fn_t_defined
65.50 +typedef int (*__compar_fn_t) (const void *, const void *);
65.51 +#endif
65.52 +
65.53 +__BEGIN_DECLS
65.54 +int hcreate(size_t);
65.55 +void hdestroy(void);
65.56 +ENTRY *hsearch(ENTRY, ACTION);
65.57 +int hcreate_r(size_t, struct hsearch_data *);
65.58 +void hdestroy_r(struct hsearch_data *);
65.59 +int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
65.60 +void *tdelete(const void *__restrict, void **__restrict, __compar_fn_t);
65.61 +void tdestroy (void *, void (*)(void *));
65.62 +void *tfind(const void *, void **, __compar_fn_t);
65.63 +void *tsearch(const void *, void **, __compar_fn_t);
65.64 +void twalk(const void *, void (*)(const void *, VISIT, int));
65.65 +__END_DECLS
65.66 +
65.67 +#endif /* !_SEARCH_H_ */
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/include/setjmp.h Mon Oct 21 16:11:07 2019 +0200
66.3 @@ -0,0 +1,25 @@
66.4 +/*
66.5 + setjmp.h
66.6 + stubs for future use.
66.7 +*/
66.8 +
66.9 +#ifndef _SETJMP_H_
66.10 +#define _SETJMP_H_
66.11 +
66.12 +#include "_ansi.h"
66.13 +#include <machine/setjmp.h>
66.14 +
66.15 +_BEGIN_STD_C
66.16 +
66.17 +#ifdef __GNUC__
66.18 +void longjmp (jmp_buf __jmpb, int __retval)
66.19 + __attribute__ ((__noreturn__));
66.20 +#else
66.21 +void longjmp (jmp_buf __jmpb, int __retval);
66.22 +#endif
66.23 +int setjmp (jmp_buf __jmpb);
66.24 +
66.25 +_END_STD_C
66.26 +
66.27 +#endif /* _SETJMP_H_ */
66.28 +
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/include/signal.h Mon Oct 21 16:11:07 2019 +0200
67.3 @@ -0,0 +1,35 @@
67.4 +#ifndef _SIGNAL_H_
67.5 +#define _SIGNAL_H_
67.6 +
67.7 +#include "_ansi.h"
67.8 +#include <sys/cdefs.h>
67.9 +#include <sys/signal.h>
67.10 +
67.11 +_BEGIN_STD_C
67.12 +
67.13 +typedef int sig_atomic_t; /* Atomic entity type (ANSI) */
67.14 +#if __BSD_VISIBLE
67.15 +typedef _sig_func_ptr sig_t; /* BSD naming */
67.16 +#endif
67.17 +#if __GNU_VISIBLE
67.18 +typedef _sig_func_ptr sighandler_t; /* glibc naming */
67.19 +#endif
67.20 +
67.21 +#define SIG_DFL ((_sig_func_ptr)0) /* Default action */
67.22 +#define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */
67.23 +#define SIG_ERR ((_sig_func_ptr)-1) /* Error return */
67.24 +
67.25 +struct _reent;
67.26 +
67.27 +_sig_func_ptr _signal_r (struct _reent *, int, _sig_func_ptr);
67.28 +int _raise_r (struct _reent *, int);
67.29 +
67.30 +#ifndef _REENT_ONLY
67.31 +_sig_func_ptr signal (int, _sig_func_ptr);
67.32 +int raise (int);
67.33 +void psignal (int, const char *);
67.34 +#endif
67.35 +
67.36 +_END_STD_C
67.37 +
67.38 +#endif /* _SIGNAL_H_ */
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/include/spawn.h Mon Oct 21 16:11:07 2019 +0200
68.3 @@ -0,0 +1,104 @@
68.4 +/*-
68.5 + * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
68.6 + * All rights reserved.
68.7 + *
68.8 + * Redistribution and use in source and binary forms, with or without
68.9 + * modification, are permitted provided that the following conditions
68.10 + * are met:
68.11 + * 1. Redistributions of source code must retain the above copyright
68.12 + * notice, this list of conditions and the following disclaimer.
68.13 + * 2. Redistributions in binary form must reproduce the above copyright
68.14 + * notice, this list of conditions and the following disclaimer in the
68.15 + * documentation and/or other materials provided with the distribution.
68.16 + *
68.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
68.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
68.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
68.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
68.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68.27 + * SUCH DAMAGE.
68.28 + */
68.29 +
68.30 +#ifndef _SPAWN_H_
68.31 +#define _SPAWN_H_
68.32 +
68.33 +#include <_ansi.h>
68.34 +#include <sys/cdefs.h>
68.35 +#include <sys/types.h>
68.36 +#include <sys/_types.h>
68.37 +#define __need_sigset_t
68.38 +#include <signal.h>
68.39 +
68.40 +struct sched_param;
68.41 +
68.42 +typedef struct __posix_spawnattr *posix_spawnattr_t;
68.43 +typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t;
68.44 +
68.45 +#define POSIX_SPAWN_RESETIDS 0x01
68.46 +#define POSIX_SPAWN_SETPGROUP 0x02
68.47 +#define POSIX_SPAWN_SETSCHEDPARAM 0x04
68.48 +#define POSIX_SPAWN_SETSCHEDULER 0x08
68.49 +#define POSIX_SPAWN_SETSIGDEF 0x10
68.50 +#define POSIX_SPAWN_SETSIGMASK 0x20
68.51 +
68.52 +_BEGIN_STD_C
68.53 +/*
68.54 + * Spawn routines
68.55 + *
68.56 + * XXX both arrays should be __restrict, but this does not work when GCC
68.57 + * is invoked with -std=c99.
68.58 + */
68.59 +int posix_spawn (pid_t * __restrict, const char * __restrict,
68.60 + const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
68.61 + char * const [], char * const []);
68.62 +int posix_spawnp (pid_t * __restrict, const char * __restrict,
68.63 + const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
68.64 + char * const [], char * const []);
68.65 +
68.66 +/*
68.67 + * File descriptor actions
68.68 + */
68.69 +int posix_spawn_file_actions_init (posix_spawn_file_actions_t *);
68.70 +int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *);
68.71 +
68.72 +int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict,
68.73 + int, const char * __restrict, int, mode_t);
68.74 +int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *, int, int);
68.75 +int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *, int);
68.76 +
68.77 +/*
68.78 + * Spawn attributes
68.79 + */
68.80 +int posix_spawnattr_init (posix_spawnattr_t *);
68.81 +int posix_spawnattr_destroy (posix_spawnattr_t *);
68.82 +
68.83 +int posix_spawnattr_getflags (const posix_spawnattr_t * __restrict,
68.84 + short * __restrict);
68.85 +int posix_spawnattr_getpgroup (const posix_spawnattr_t * __restrict,
68.86 + pid_t * __restrict);
68.87 +int posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict,
68.88 + struct sched_param * __restrict);
68.89 +int posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict,
68.90 + int * __restrict);
68.91 +int posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict,
68.92 + sigset_t * __restrict);
68.93 +int posix_spawnattr_getsigmask (const posix_spawnattr_t * __restrict,
68.94 + sigset_t * __restrict);
68.95 +
68.96 +int posix_spawnattr_setflags (posix_spawnattr_t *, short);
68.97 +int posix_spawnattr_setpgroup (posix_spawnattr_t *, pid_t);
68.98 +int posix_spawnattr_setschedparam (posix_spawnattr_t * __restrict,
68.99 + const struct sched_param * __restrict);
68.100 +int posix_spawnattr_setschedpolicy (posix_spawnattr_t *, int);
68.101 +int posix_spawnattr_setsigdefault (posix_spawnattr_t * __restrict,
68.102 + const sigset_t * __restrict);
68.103 +int posix_spawnattr_setsigmask (posix_spawnattr_t * __restrict,
68.104 + const sigset_t * __restrict);
68.105 +_END_STD_C
68.106 +
68.107 +#endif /* !_SPAWN_H_ */
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/include/ssp/ssp.h Mon Oct 21 16:11:07 2019 +0200
69.3 @@ -0,0 +1,76 @@
69.4 +/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */
69.5 +
69.6 +/*-
69.7 + * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc.
69.8 + * All rights reserved.
69.9 + *
69.10 + * This code is derived from software contributed to The NetBSD Foundation
69.11 + * by Christos Zoulas.
69.12 + *
69.13 + * Redistribution and use in source and binary forms, with or without
69.14 + * modification, are permitted provided that the following conditions
69.15 + * are met:
69.16 + * 1. Redistributions of source code must retain the above copyright
69.17 + * notice, this list of conditions and the following disclaimer.
69.18 + * 2. Redistributions in binary form must reproduce the above copyright
69.19 + * notice, this list of conditions and the following disclaimer in the
69.20 + * documentation and/or other materials provided with the distribution.
69.21 + *
69.22 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
69.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
69.24 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
69.25 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
69.26 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
69.27 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
69.28 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
69.29 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
69.30 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
69.31 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
69.32 + * POSSIBILITY OF SUCH DAMAGE.
69.33 + */
69.34 +#ifndef _SSP_SSP_H_
69.35 +#define _SSP_SSP_H_
69.36 +
69.37 +#include <sys/cdefs.h>
69.38 +
69.39 +/* __ssp_real is used by the implementation in libc */
69.40 +#if __SSP_FORTIFY_LEVEL == 0
69.41 +#define __ssp_real_(fun) fun
69.42 +#else
69.43 +#define __ssp_real_(fun) __ssp_real_ ## fun
69.44 +#endif
69.45 +#define __ssp_real(fun) __ssp_real_(fun)
69.46 +
69.47 +#define __ssp_inline extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
69.48 +
69.49 +#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1)
69.50 +#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
69.51 +
69.52 +#define __ssp_check(buf, len, bos) \
69.53 + if (bos(buf) != (size_t)-1 && len > bos(buf)) \
69.54 + __chk_fail()
69.55 +#define __ssp_decl(rtype, fun, args) \
69.56 +rtype __ssp_real_(fun) args __asm__(__ASMNAME(#fun)); \
69.57 +__ssp_inline rtype fun args
69.58 +#define __ssp_redirect_raw(rtype, fun, args, call, cond, bos) \
69.59 +__ssp_decl(rtype, fun, args) \
69.60 +{ \
69.61 + if (cond) \
69.62 + __ssp_check(__buf, __len, bos); \
69.63 + return __ssp_real_(fun) call; \
69.64 +}
69.65 +
69.66 +#define __ssp_redirect(rtype, fun, args, call) \
69.67 + __ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos)
69.68 +#define __ssp_redirect0(rtype, fun, args, call) \
69.69 + __ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos0)
69.70 +
69.71 +#define __ssp_overlap(a, b, l) \
69.72 + (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l)))
69.73 +
69.74 +__BEGIN_DECLS
69.75 +void __stack_chk_fail(void) __dead2;
69.76 +void __chk_fail(void) __dead2;
69.77 +__END_DECLS
69.78 +
69.79 +#endif /* _SSP_SSP_H_ */
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/include/ssp/stdio.h Mon Oct 21 16:11:07 2019 +0200
70.3 @@ -0,0 +1,101 @@
70.4 +/* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */
70.5 +
70.6 +/*-
70.7 + * Copyright (c) 2006 The NetBSD Foundation, Inc.
70.8 + * All rights reserved.
70.9 + *
70.10 + * This code is derived from software contributed to The NetBSD Foundation
70.11 + * by Christos Zoulas.
70.12 + *
70.13 + * Redistribution and use in source and binary forms, with or without
70.14 + * modification, are permitted provided that the following conditions
70.15 + * are met:
70.16 + * 1. Redistributions of source code must retain the above copyright
70.17 + * notice, this list of conditions and the following disclaimer.
70.18 + * 2. Redistributions in binary form must reproduce the above copyright
70.19 + * notice, this list of conditions and the following disclaimer in the
70.20 + * documentation and/or other materials provided with the distribution.
70.21 + *
70.22 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
70.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
70.24 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
70.25 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
70.26 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
70.27 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
70.28 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
70.29 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
70.30 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
70.31 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
70.32 + * POSSIBILITY OF SUCH DAMAGE.
70.33 + */
70.34 +#ifndef _SSP_STDIO_H_
70.35 +#define _SSP_STDIO_H_
70.36 +
70.37 +#include <ssp/ssp.h>
70.38 +
70.39 +__BEGIN_DECLS
70.40 +int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...)
70.41 + __printflike(4, 5);
70.42 +int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict,
70.43 + __va_list)
70.44 + __printflike(4, 0);
70.45 +int __snprintf_chk(char *__restrict, size_t, int, size_t,
70.46 + const char *__restrict, ...)
70.47 + __printflike(5, 6);
70.48 +int __vsnprintf_chk(char *__restrict, size_t, int, size_t,
70.49 + const char *__restrict, __va_list)
70.50 + __printflike(5, 0);
70.51 +char *__gets_chk(char *, size_t);
70.52 +__END_DECLS
70.53 +
70.54 +#if __SSP_FORTIFY_LEVEL > 0
70.55 +
70.56 +
70.57 +#define sprintf(str, ...) \
70.58 + __builtin___sprintf_chk(str, 0, __ssp_bos(str), __VA_ARGS__)
70.59 +
70.60 +#define vsprintf(str, fmt, ap) \
70.61 + __builtin___vsprintf_chk(str, 0, __ssp_bos(str), fmt, ap)
70.62 +
70.63 +#define snprintf(str, len, ...) \
70.64 + __builtin___snprintf_chk(str, len, 0, __ssp_bos(str), __VA_ARGS__)
70.65 +
70.66 +#define vsnprintf(str, len, fmt, ap) \
70.67 + __builtin___vsnprintf_chk(str, len, 0, __ssp_bos(str), fmt, ap)
70.68 +
70.69 +#define gets(str) \
70.70 + __gets_chk(str, __ssp_bos(str))
70.71 +
70.72 +__ssp_decl(char *, fgets, (char *__restrict __buf, int __len, FILE *__fp))
70.73 +{
70.74 + if (__len > 0)
70.75 + __ssp_check(__buf, (size_t)__len, __ssp_bos);
70.76 + return __ssp_real_fgets(__buf, __len, __fp);
70.77 +}
70.78 +
70.79 +#if __GNU_VISIBLE
70.80 +__ssp_decl(char *, fgets_unlocked, (char *__restrict __buf, int __len, FILE *__fp))
70.81 +{
70.82 + if (__len > 0)
70.83 + __ssp_check(__buf, (size_t)__len, __ssp_bos);
70.84 + return __ssp_real_fgets_unlocked(__buf, __len, __fp);
70.85 +}
70.86 +#endif /* __GNU_VISIBLE */
70.87 +
70.88 +__ssp_decl(size_t, fread, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp))
70.89 +{
70.90 + __ssp_check(__ptr, __size * __n, __ssp_bos0);
70.91 + return __ssp_real_fread(__ptr, __size, __n, __fp);
70.92 +}
70.93 +
70.94 +#if __MISC_VISIBLE
70.95 +__ssp_decl(size_t, fread_unlocked, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp))
70.96 +{
70.97 + __ssp_check(__ptr, __size * __n, __ssp_bos0);
70.98 + return __ssp_real_fread_unlocked(__ptr, __size, __n, __fp);
70.99 +}
70.100 +#endif /* __MISC_VISIBLE */
70.101 +
70.102 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
70.103 +
70.104 +#endif /* _SSP_STDIO_H_ */
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/include/ssp/stdlib.h Mon Oct 21 16:11:07 2019 +0200
71.3 @@ -0,0 +1,30 @@
71.4 +#ifndef _SSP_STDLIB_H_
71.5 +#define _SSP_STDLIB_H_
71.6 +
71.7 +#include <ssp/ssp.h>
71.8 +
71.9 +#if __SSP_FORTIFY_LEVEL > 0
71.10 +__BEGIN_DECLS
71.11 +
71.12 +__ssp_decl(size_t, mbstowcs, (wchar_t *__buf, const char *__src, size_t __n))
71.13 +{
71.14 + if (__buf != NULL)
71.15 + __ssp_check(__buf, __n * sizeof(wchar_t), __ssp_bos);
71.16 + return __ssp_real_mbstowcs (__buf, __src, __n);
71.17 +}
71.18 +
71.19 +__ssp_redirect_raw(size_t, wcstombs, \
71.20 + (char *__buf, const wchar_t *__src, size_t __len), \
71.21 + (__buf, __src, __len), __buf != NULL, __ssp_bos);
71.22 +
71.23 +__ssp_decl(int, wctomb, (char *__buf, wchar_t __wc))
71.24 +{
71.25 + if (__buf != NULL)
71.26 + __ssp_check(__buf, MB_CUR_MAX, __ssp_bos);
71.27 + return __ssp_real_wctomb (__buf, __wc);
71.28 +}
71.29 +
71.30 +__END_DECLS
71.31 +
71.32 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
71.33 +#endif /* _SSP_STDLIB_H_ */
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/include/ssp/string.h Mon Oct 21 16:11:07 2019 +0200
72.3 @@ -0,0 +1,115 @@
72.4 +/* $NetBSD: string.h,v 1.13 2014/11/29 13:23:48 pooka Exp $ */
72.5 +
72.6 +/*-
72.7 + * Copyright (c) 2006 The NetBSD Foundation, Inc.
72.8 + * All rights reserved.
72.9 + *
72.10 + * This code is derived from software contributed to The NetBSD Foundation
72.11 + * by Christos Zoulas.
72.12 + *
72.13 + * Redistribution and use in source and binary forms, with or without
72.14 + * modification, are permitted provided that the following conditions
72.15 + * are met:
72.16 + * 1. Redistributions of source code must retain the above copyright
72.17 + * notice, this list of conditions and the following disclaimer.
72.18 + * 2. Redistributions in binary form must reproduce the above copyright
72.19 + * notice, this list of conditions and the following disclaimer in the
72.20 + * documentation and/or other materials provided with the distribution.
72.21 + *
72.22 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
72.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
72.24 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
72.25 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
72.26 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
72.27 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
72.28 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
72.29 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
72.30 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
72.31 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
72.32 + * POSSIBILITY OF SUCH DAMAGE.
72.33 + */
72.34 +#ifndef _SSP_STRING_H_
72.35 +#define _SSP_STRING_H_
72.36 +
72.37 +#include <sys/cdefs.h>
72.38 +#include <ssp/ssp.h>
72.39 +
72.40 +__BEGIN_DECLS
72.41 +void *__memcpy_chk(void *, const void *, size_t, size_t);
72.42 +void *__memmove_chk(void *, void *, size_t, size_t);
72.43 +void *__mempcpy_chk(void *, const void *, size_t, size_t);
72.44 +void *__memset_chk(void *, int, size_t, size_t);
72.45 +char *__stpcpy_chk(char *, const char *, size_t);
72.46 +char *__strcat_chk(char *, const char *, size_t);
72.47 +char *__strcpy_chk(char *, const char *, size_t);
72.48 +char *__strncat_chk(char *, const char *, size_t, size_t);
72.49 +char *__strncpy_chk(char *, const char *, size_t, size_t);
72.50 +__END_DECLS
72.51 +
72.52 +#if __SSP_FORTIFY_LEVEL > 0
72.53 +
72.54 +#define __ssp_bos_check3(fun, dst, src, len) \
72.55 + ((__ssp_bos0(dst) != (size_t)-1) ? \
72.56 + __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)) : \
72.57 + __ ## fun ## _ichk(dst, src, len))
72.58 +
72.59 +#define __ssp_bos_check2(fun, dst, src) \
72.60 + ((__ssp_bos0(dst) != (size_t)-1) ? \
72.61 + __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)) : \
72.62 + __ ## fun ## _ichk(dst, src))
72.63 +
72.64 +#define __ssp_bos_icheck3_restrict(fun, type1, type2) \
72.65 +__ssp_inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \
72.66 +__ssp_inline type1 \
72.67 +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \
72.68 + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
72.69 +}
72.70 +
72.71 +#define __ssp_bos_icheck3(fun, type1, type2) \
72.72 +__ssp_inline type1 __ ## fun ## _ichk(type1, type2, size_t); \
72.73 +__ssp_inline type1 \
72.74 +__ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \
72.75 + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
72.76 +}
72.77 +
72.78 +#define __ssp_bos_icheck2_restrict(fun, type1, type2) \
72.79 +__ssp_inline type1 __ ## fun ## _ichk(type1, type2); \
72.80 +__ssp_inline type1 \
72.81 +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \
72.82 + return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \
72.83 +}
72.84 +
72.85 +__BEGIN_DECLS
72.86 +__ssp_bos_icheck3_restrict(memcpy, void *, const void *)
72.87 +__ssp_bos_icheck3(memmove, void *, const void *)
72.88 +__ssp_bos_icheck3_restrict(mempcpy, void *, const void *)
72.89 +__ssp_bos_icheck3(memset, void *, int)
72.90 +__ssp_bos_icheck2_restrict(stpcpy, char *, const char *)
72.91 +#if __GNUC_PREREQ__(4,8) || defined(__clang__)
72.92 +__ssp_bos_icheck3_restrict(stpncpy, char *, const char *)
72.93 +#endif
72.94 +__ssp_bos_icheck2_restrict(strcpy, char *, const char *)
72.95 +__ssp_bos_icheck2_restrict(strcat, char *, const char *)
72.96 +__ssp_bos_icheck3_restrict(strncpy, char *, const char *)
72.97 +__ssp_bos_icheck3_restrict(strncat, char *, const char *)
72.98 +__END_DECLS
72.99 +
72.100 +#define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
72.101 +#define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len)
72.102 +#if __GNU_VISIBLE
72.103 +#define mempcpy(dst, src, len) __ssp_bos_check3(mempcpy, dst, src, len)
72.104 +#endif
72.105 +#define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len)
72.106 +#if __POSIX_VISIBLE >= 200809
72.107 +#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src)
72.108 +#if __GNUC_PREREQ__(4,8) || defined(__clang__)
72.109 +#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len)
72.110 +#endif
72.111 +#endif
72.112 +#define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src)
72.113 +#define strcat(dst, src) __ssp_bos_check2(strcat, dst, src)
72.114 +#define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
72.115 +#define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len)
72.116 +
72.117 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
72.118 +#endif /* _SSP_STRING_H_ */
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/include/ssp/strings.h Mon Oct 21 16:11:07 2019 +0200
73.3 @@ -0,0 +1,55 @@
73.4 +/* $NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
73.5 +
73.6 +/*-
73.7 + * Copyright (c) 2007 The NetBSD Foundation, Inc.
73.8 + * All rights reserved.
73.9 + *
73.10 + * This code is derived from software contributed to The NetBSD Foundation
73.11 + * by Christos Zoulas.
73.12 + *
73.13 + * Redistribution and use in source and binary forms, with or without
73.14 + * modification, are permitted provided that the following conditions
73.15 + * are met:
73.16 + * 1. Redistributions of source code must retain the above copyright
73.17 + * notice, this list of conditions and the following disclaimer.
73.18 + * 2. Redistributions in binary form must reproduce the above copyright
73.19 + * notice, this list of conditions and the following disclaimer in the
73.20 + * documentation and/or other materials provided with the distribution.
73.21 + *
73.22 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
73.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
73.24 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
73.25 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
73.26 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
73.27 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
73.28 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
73.29 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
73.30 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
73.31 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
73.32 + * POSSIBILITY OF SUCH DAMAGE.
73.33 + */
73.34 +#ifndef _SSP_STRINGS_H_
73.35 +#define _SSP_STRINGS_H_
73.36 +
73.37 +#include <ssp/ssp.h>
73.38 +
73.39 +#if __SSP_FORTIFY_LEVEL > 0
73.40 +
73.41 +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
73.42 +#define bcopy(src, dst, len) \
73.43 + ((__ssp_bos0(dst) != (size_t)-1) ? \
73.44 + __builtin___memmove_chk(dst, src, len, __ssp_bos0(dst)) : \
73.45 + __memmove_ichk(dst, src, len))
73.46 +#define bzero(dst, len) \
73.47 + ((__ssp_bos0(dst) != (size_t)-1) ? \
73.48 + __builtin___memset_chk(dst, 0, len, __ssp_bos0(dst)) : \
73.49 + __memset_ichk(dst, 0, len))
73.50 +#endif
73.51 +
73.52 +#if __BSD_VISIBLE
73.53 +__ssp_redirect0(void, explicit_bzero, (void *__buf, size_t __len), \
73.54 + (__buf, __len));
73.55 +#endif
73.56 +
73.57 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
73.58 +#endif /* _SSP_STRINGS_H_ */
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/include/ssp/unistd.h Mon Oct 21 16:11:07 2019 +0200
74.3 @@ -0,0 +1,93 @@
74.4 +/* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */
74.5 +
74.6 +/*-
74.7 + * Copyright (c) 2006 The NetBSD Foundation, Inc.
74.8 + * All rights reserved.
74.9 + *
74.10 + * This code is derived from software contributed to The NetBSD Foundation
74.11 + * by Christos Zoulas.
74.12 + *
74.13 + * Redistribution and use in source and binary forms, with or without
74.14 + * modification, are permitted provided that the following conditions
74.15 + * are met:
74.16 + * 1. Redistributions of source code must retain the above copyright
74.17 + * notice, this list of conditions and the following disclaimer.
74.18 + * 2. Redistributions in binary form must reproduce the above copyright
74.19 + * notice, this list of conditions and the following disclaimer in the
74.20 + * documentation and/or other materials provided with the distribution.
74.21 + *
74.22 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
74.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
74.24 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
74.25 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
74.26 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
74.27 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
74.28 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
74.29 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
74.30 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
74.31 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
74.32 + * POSSIBILITY OF SUCH DAMAGE.
74.33 + */
74.34 +#ifndef _SSP_UNISTD_H_
74.35 +#define _SSP_UNISTD_H_
74.36 +
74.37 +#include <ssp/ssp.h>
74.38 +
74.39 +#if __SSP_FORTIFY_LEVEL > 0
74.40 +__BEGIN_DECLS
74.41 +
74.42 +#if __POSIX_VISIBLE >= 199209
74.43 +__ssp_redirect(size_t, confstr, (int __name, char *__buf, size_t __len), \
74.44 + (__name, __buf, __len));
74.45 +#endif
74.46 +
74.47 +__ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len),
74.48 + (__buf, __len), __buf != 0, __ssp_bos);
74.49 +
74.50 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
74.51 +__ssp_redirect(int, getdomainname, (char *__buf, size_t __len), \
74.52 + (__buf, __len));
74.53 +#endif
74.54 +
74.55 +__ssp_decl(int, getgroups, (int __n, gid_t __buf[]))
74.56 +{
74.57 + __ssp_check(__buf, __n * sizeof(gid_t), __ssp_bos);
74.58 + return __ssp_real_getgroups (__n, __buf);
74.59 +}
74.60 +
74.61 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
74.62 +#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
74.63 +__ssp_redirect(int, gethostname, (char *__buf, size_t __len), \
74.64 + (__buf, __len));
74.65 +#endif
74.66 +#endif
74.67 +
74.68 +__ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), \
74.69 + (__buf, __len));
74.70 +
74.71 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
74.72 +__ssp_redirect0(ssize_t, pread, (int __fd, void *__buf, size_t __len, off_t __off), \
74.73 + (__fd, __buf, __len, __off));
74.74 +#endif
74.75 +
74.76 +__ssp_redirect0(_READ_WRITE_RETURN_TYPE, read, \
74.77 + (int __fd, void *__buf, size_t __len), (__fd, __buf, __len));
74.78 +
74.79 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
74.80 +__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \
74.81 + char *__restrict __buf, size_t __len), (__path, __buf, __len));
74.82 +#endif
74.83 +
74.84 +#if __ATFILE_VISIBLE
74.85 +__ssp_redirect(ssize_t, readlinkat, \
74.86 + (int __dirfd1, const char *__restrict __path, char *__restrict __buf, size_t __len), \
74.87 + (__dirfd1, __path, __buf, __len));
74.88 +#endif
74.89 +
74.90 +__ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), \
74.91 + (__fd, __buf, __len));
74.92 +
74.93 +__END_DECLS
74.94 +
74.95 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
74.96 +#endif /* _SSP_UNISTD_H_ */
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
75.2 +++ b/include/ssp/wchar.h Mon Oct 21 16:11:07 2019 +0200
75.3 @@ -0,0 +1,97 @@
75.4 +#ifndef _SSP_WCHAR_H_
75.5 +#define _SSP_WCHAR_H_
75.6 +
75.7 +#include <sys/cdefs.h>
75.8 +#include <ssp/ssp.h>
75.9 +
75.10 +#if __SSP_FORTIFY_LEVEL > 0
75.11 +
75.12 +/* wide character variant, __wlen is number of wchar_t */
75.13 +#define __ssp_redirect_wc(rtype, fun, args, call, cond, bos) \
75.14 +__ssp_decl(rtype, fun, args) \
75.15 +{ \
75.16 + if (cond) \
75.17 + __ssp_check(__buf, __wlen * sizeof(wchar_t), bos); \
75.18 + return __ssp_real_(fun) call; \
75.19 +}
75.20 +
75.21 +#define __ssp_bos_wicheck3(fun) \
75.22 +__ssp_redirect_wc(wchar_t *, fun, \
75.23 + (wchar_t *__buf, const wchar_t *__src, size_t __wlen), \
75.24 + (__buf, __src, __wlen), 1, __ssp_bos0)
75.25 +
75.26 +#define __ssp_bos_wicheck3_restrict(fun) \
75.27 +__ssp_redirect_wc(wchar_t *, fun, \
75.28 + (wchar_t *__restrict __buf, const wchar_t *__restrict __src, size_t __wlen), \
75.29 + (__buf, __src, __wlen), 1, __ssp_bos0)
75.30 +
75.31 +#define __ssp_bos_wicheck2_restrict(fun) \
75.32 +__ssp_decl(wchar_t *, fun, (wchar_t *__restrict __buf, const wchar_t *__restrict __src)) \
75.33 +{ \
75.34 + __ssp_check(__buf, (wcslen(__src) + 1) * sizeof(wchar_t), __ssp_bos0); \
75.35 + return __ssp_real_(fun) (__buf, __src); \
75.36 +}
75.37 +
75.38 +__BEGIN_DECLS
75.39 +#if __POSIX_VISIBLE >= 200809
75.40 +__ssp_bos_wicheck2_restrict(wcpcpy)
75.41 +__ssp_bos_wicheck3_restrict(wcpncpy)
75.42 +#endif
75.43 +__ssp_bos_wicheck2_restrict(wcscpy)
75.44 +__ssp_bos_wicheck2_restrict(wcscat)
75.45 +__ssp_bos_wicheck3_restrict(wcsncpy)
75.46 +__ssp_bos_wicheck3_restrict(wcsncat)
75.47 +__ssp_bos_wicheck3_restrict(wmemcpy)
75.48 +__ssp_bos_wicheck3(wmemmove)
75.49 +#if __GNU_VISIBLE
75.50 +__ssp_bos_wicheck3_restrict(wmempcpy)
75.51 +#endif
75.52 +__ssp_redirect_wc(wchar_t *, wmemset, \
75.53 + (wchar_t *__buf, wchar_t __src, size_t __wlen), \
75.54 + (__buf, __src, __wlen), 1, __ssp_bos0)
75.55 +
75.56 +__ssp_decl(size_t, wcrtomb, (char *__buf, wchar_t __src, mbstate_t *__ps))
75.57 +{
75.58 + if (__buf != NULL && __src != L'\0')
75.59 + __ssp_check(__buf, sizeof(wchar_t), __ssp_bos);
75.60 + return __ssp_real_wcrtomb (__buf, __src, __ps);
75.61 +}
75.62 +
75.63 +__ssp_redirect_wc(size_t, mbsrtowcs, \
75.64 + (wchar_t *__buf, const char **__src, size_t __wlen, mbstate_t *__ps), \
75.65 + (__buf, __src, __wlen, __ps), __buf != NULL, __ssp_bos)
75.66 +
75.67 +__ssp_redirect_raw(size_t, wcsrtombs, \
75.68 + (char *__buf, const wchar_t **__src, size_t __len, mbstate_t *__ps), \
75.69 + (__buf, __src, __len, __ps), __buf != NULL, __ssp_bos)
75.70 +
75.71 +#if __POSIX_VISIBLE >= 200809
75.72 +__ssp_redirect_wc(size_t, mbsnrtowcs, \
75.73 + (wchar_t *__buf, const char **__src, size_t __nms, size_t __wlen, mbstate_t *__ps), \
75.74 + (__buf, __src, __nms, __wlen, __ps), __buf != NULL, __ssp_bos)
75.75 +
75.76 +__ssp_redirect_raw(size_t, wcsnrtombs, \
75.77 + (char *__buf, const wchar_t **__src, size_t __nwc, size_t __len, mbstate_t *__ps), \
75.78 + (__buf, __src, __nwc, __len, __ps), __buf != NULL, __ssp_bos)
75.79 +#endif
75.80 +
75.81 +__ssp_decl(wchar_t *, fgetws, (wchar_t *__restrict __buf, int __wlen, __FILE *__restrict __fp))
75.82 +{
75.83 + if (__wlen > 0)
75.84 + __ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos);
75.85 + return __ssp_real_fgetws(__buf, __wlen, __fp);
75.86 +}
75.87 +
75.88 +#if __GNU_VISIBLE
75.89 +__ssp_decl(wchar_t *, fgetws_unlocked, (wchar_t *__buf, int __wlen, __FILE *__fp))
75.90 +{
75.91 + if (__wlen > 0)
75.92 + __ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos);
75.93 + return __ssp_real_fgetws_unlocked(__buf, __wlen, __fp);
75.94 +}
75.95 +#endif /* __GNU_VISIBLE */
75.96 +
75.97 +__END_DECLS
75.98 +
75.99 +#endif /* __SSP_FORTIFY_LEVEL > 0 */
75.100 +#endif /* _SSP_WCHAR_H_ */
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/include/stdatomic.h Mon Oct 21 16:11:07 2019 +0200
76.3 @@ -0,0 +1,413 @@
76.4 +/*-
76.5 + * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
76.6 + * David Chisnall <theraven@FreeBSD.org>
76.7 + * All rights reserved.
76.8 + *
76.9 + * Redistribution and use in source and binary forms, with or without
76.10 + * modification, are permitted provided that the following conditions
76.11 + * are met:
76.12 + * 1. Redistributions of source code must retain the above copyright
76.13 + * notice, this list of conditions and the following disclaimer.
76.14 + * 2. Redistributions in binary form must reproduce the above copyright
76.15 + * notice, this list of conditions and the following disclaimer in the
76.16 + * documentation and/or other materials provided with the distribution.
76.17 + *
76.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
76.19 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76.20 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76.21 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
76.22 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76.23 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
76.24 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
76.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
76.26 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
76.27 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
76.28 + * SUCH DAMAGE.
76.29 + *
76.30 + * $FreeBSD$
76.31 + */
76.32 +
76.33 +#ifndef _STDATOMIC_H_
76.34 +#define _STDATOMIC_H_
76.35 +
76.36 +#include <sys/cdefs.h>
76.37 +#include <sys/_types.h>
76.38 +
76.39 +#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
76.40 +#define __CLANG_ATOMICS
76.41 +#elif __GNUC_PREREQ__(4, 7)
76.42 +#define __GNUC_ATOMICS
76.43 +#elif defined(__GNUC__)
76.44 +#define __SYNC_ATOMICS
76.45 +#else
76.46 +#error "stdatomic.h does not support your compiler"
76.47 +#endif
76.48 +
76.49 +/*
76.50 + * 7.17.1 Atomic lock-free macros.
76.51 + */
76.52 +
76.53 +#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE
76.54 +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
76.55 +#endif
76.56 +#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE
76.57 +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
76.58 +#endif
76.59 +#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE
76.60 +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
76.61 +#endif
76.62 +#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE
76.63 +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
76.64 +#endif
76.65 +#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE
76.66 +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
76.67 +#endif
76.68 +#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE
76.69 +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
76.70 +#endif
76.71 +#ifdef __GCC_ATOMIC_INT_LOCK_FREE
76.72 +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
76.73 +#endif
76.74 +#ifdef __GCC_ATOMIC_LONG_LOCK_FREE
76.75 +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
76.76 +#endif
76.77 +#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE
76.78 +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
76.79 +#endif
76.80 +#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE
76.81 +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
76.82 +#endif
76.83 +
76.84 +/*
76.85 + * 7.17.2 Initialization.
76.86 + */
76.87 +
76.88 +#if defined(__CLANG_ATOMICS)
76.89 +#define ATOMIC_VAR_INIT(value) (value)
76.90 +#define atomic_init(obj, value) __c11_atomic_init(obj, value)
76.91 +#else
76.92 +#define ATOMIC_VAR_INIT(value) { .__val = (value) }
76.93 +#define atomic_init(obj, value) ((void)((obj)->__val = (value)))
76.94 +#endif
76.95 +
76.96 +/*
76.97 + * Clang and recent GCC both provide predefined macros for the memory
76.98 + * orderings. If we are using a compiler that doesn't define them, use the
76.99 + * clang values - these will be ignored in the fallback path.
76.100 + */
76.101 +
76.102 +#ifndef __ATOMIC_RELAXED
76.103 +#define __ATOMIC_RELAXED 0
76.104 +#endif
76.105 +#ifndef __ATOMIC_CONSUME
76.106 +#define __ATOMIC_CONSUME 1
76.107 +#endif
76.108 +#ifndef __ATOMIC_ACQUIRE
76.109 +#define __ATOMIC_ACQUIRE 2
76.110 +#endif
76.111 +#ifndef __ATOMIC_RELEASE
76.112 +#define __ATOMIC_RELEASE 3
76.113 +#endif
76.114 +#ifndef __ATOMIC_ACQ_REL
76.115 +#define __ATOMIC_ACQ_REL 4
76.116 +#endif
76.117 +#ifndef __ATOMIC_SEQ_CST
76.118 +#define __ATOMIC_SEQ_CST 5
76.119 +#endif
76.120 +
76.121 +/*
76.122 + * 7.17.3 Order and consistency.
76.123 + *
76.124 + * The memory_order_* constants that denote the barrier behaviour of the
76.125 + * atomic operations.
76.126 + */
76.127 +
76.128 +typedef enum {
76.129 + memory_order_relaxed = __ATOMIC_RELAXED,
76.130 + memory_order_consume = __ATOMIC_CONSUME,
76.131 + memory_order_acquire = __ATOMIC_ACQUIRE,
76.132 + memory_order_release = __ATOMIC_RELEASE,
76.133 + memory_order_acq_rel = __ATOMIC_ACQ_REL,
76.134 + memory_order_seq_cst = __ATOMIC_SEQ_CST
76.135 +} memory_order;
76.136 +
76.137 +/*
76.138 + * 7.17.4 Fences.
76.139 + */
76.140 +
76.141 +static __inline void
76.142 +atomic_thread_fence(memory_order __order __unused)
76.143 +{
76.144 +
76.145 +#ifdef __CLANG_ATOMICS
76.146 + __c11_atomic_thread_fence(__order);
76.147 +#elif defined(__GNUC_ATOMICS)
76.148 + __atomic_thread_fence(__order);
76.149 +#else
76.150 + __sync_synchronize();
76.151 +#endif
76.152 +}
76.153 +
76.154 +static __inline void
76.155 +atomic_signal_fence(memory_order __order __unused)
76.156 +{
76.157 +
76.158 +#ifdef __CLANG_ATOMICS
76.159 + __c11_atomic_signal_fence(__order);
76.160 +#elif defined(__GNUC_ATOMICS)
76.161 + __atomic_signal_fence(__order);
76.162 +#else
76.163 + __asm volatile ("" ::: "memory");
76.164 +#endif
76.165 +}
76.166 +
76.167 +/*
76.168 + * 7.17.5 Lock-free property.
76.169 + */
76.170 +
76.171 +#if defined(_KERNEL)
76.172 +/* Atomics in kernelspace are always lock-free. */
76.173 +#define atomic_is_lock_free(obj) \
76.174 + ((void)(obj), (_Bool)1)
76.175 +#elif defined(__CLANG_ATOMICS)
76.176 +#define atomic_is_lock_free(obj) \
76.177 + __atomic_is_lock_free(sizeof(*(obj)), obj)
76.178 +#elif defined(__GNUC_ATOMICS)
76.179 +#define atomic_is_lock_free(obj) \
76.180 + __atomic_is_lock_free(sizeof((obj)->__val), &(obj)->__val)
76.181 +#else
76.182 +#define atomic_is_lock_free(obj) \
76.183 + ((void)(obj), sizeof((obj)->__val) <= sizeof(void *))
76.184 +#endif
76.185 +
76.186 +/*
76.187 + * 7.17.6 Atomic integer types.
76.188 + */
76.189 +
76.190 +typedef _Atomic(_Bool) atomic_bool;
76.191 +typedef _Atomic(char) atomic_char;
76.192 +typedef _Atomic(signed char) atomic_schar;
76.193 +typedef _Atomic(unsigned char) atomic_uchar;
76.194 +typedef _Atomic(short) atomic_short;
76.195 +typedef _Atomic(unsigned short) atomic_ushort;
76.196 +typedef _Atomic(int) atomic_int;
76.197 +typedef _Atomic(unsigned int) atomic_uint;
76.198 +typedef _Atomic(long) atomic_long;
76.199 +typedef _Atomic(unsigned long) atomic_ulong;
76.200 +typedef _Atomic(long long) atomic_llong;
76.201 +typedef _Atomic(unsigned long long) atomic_ullong;
76.202 +#if 0
76.203 +typedef _Atomic(__char16_t) atomic_char16_t;
76.204 +typedef _Atomic(__char32_t) atomic_char32_t;
76.205 +#endif
76.206 +typedef _Atomic(wchar_t) atomic_wchar_t;
76.207 +typedef _Atomic(int_least8_t) atomic_int_least8_t;
76.208 +typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
76.209 +typedef _Atomic(int_least16_t) atomic_int_least16_t;
76.210 +typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
76.211 +typedef _Atomic(int_least32_t) atomic_int_least32_t;
76.212 +typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
76.213 +typedef _Atomic(int_least64_t) atomic_int_least64_t;
76.214 +typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
76.215 +typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
76.216 +typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
76.217 +typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
76.218 +typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
76.219 +typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
76.220 +typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
76.221 +typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
76.222 +typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
76.223 +typedef _Atomic(intptr_t) atomic_intptr_t;
76.224 +typedef _Atomic(uintptr_t) atomic_uintptr_t;
76.225 +typedef _Atomic(size_t) atomic_size_t;
76.226 +typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t;
76.227 +typedef _Atomic(intmax_t) atomic_intmax_t;
76.228 +typedef _Atomic(uintmax_t) atomic_uintmax_t;
76.229 +
76.230 +/*
76.231 + * 7.17.7 Operations on atomic types.
76.232 + */
76.233 +
76.234 +/*
76.235 + * Compiler-specific operations.
76.236 + */
76.237 +
76.238 +#if defined(__CLANG_ATOMICS)
76.239 +#define atomic_compare_exchange_strong_explicit(object, expected, \
76.240 + desired, success, failure) \
76.241 + __c11_atomic_compare_exchange_strong(object, expected, desired, \
76.242 + success, failure)
76.243 +#define atomic_compare_exchange_weak_explicit(object, expected, \
76.244 + desired, success, failure) \
76.245 + __c11_atomic_compare_exchange_weak(object, expected, desired, \
76.246 + success, failure)
76.247 +#define atomic_exchange_explicit(object, desired, order) \
76.248 + __c11_atomic_exchange(object, desired, order)
76.249 +#define atomic_fetch_add_explicit(object, operand, order) \
76.250 + __c11_atomic_fetch_add(object, operand, order)
76.251 +#define atomic_fetch_and_explicit(object, operand, order) \
76.252 + __c11_atomic_fetch_and(object, operand, order)
76.253 +#define atomic_fetch_or_explicit(object, operand, order) \
76.254 + __c11_atomic_fetch_or(object, operand, order)
76.255 +#define atomic_fetch_sub_explicit(object, operand, order) \
76.256 + __c11_atomic_fetch_sub(object, operand, order)
76.257 +#define atomic_fetch_xor_explicit(object, operand, order) \
76.258 + __c11_atomic_fetch_xor(object, operand, order)
76.259 +#define atomic_load_explicit(object, order) \
76.260 + __c11_atomic_load(object, order)
76.261 +#define atomic_store_explicit(object, desired, order) \
76.262 + __c11_atomic_store(object, desired, order)
76.263 +#elif defined(__GNUC_ATOMICS)
76.264 +#define atomic_compare_exchange_strong_explicit(object, expected, \
76.265 + desired, success, failure) \
76.266 + __atomic_compare_exchange_n(&(object)->__val, expected, \
76.267 + desired, 0, success, failure)
76.268 +#define atomic_compare_exchange_weak_explicit(object, expected, \
76.269 + desired, success, failure) \
76.270 + __atomic_compare_exchange_n(&(object)->__val, expected, \
76.271 + desired, 1, success, failure)
76.272 +#define atomic_exchange_explicit(object, desired, order) \
76.273 + __atomic_exchange_n(&(object)->__val, desired, order)
76.274 +#define atomic_fetch_add_explicit(object, operand, order) \
76.275 + __atomic_fetch_add(&(object)->__val, operand, order)
76.276 +#define atomic_fetch_and_explicit(object, operand, order) \
76.277 + __atomic_fetch_and(&(object)->__val, operand, order)
76.278 +#define atomic_fetch_or_explicit(object, operand, order) \
76.279 + __atomic_fetch_or(&(object)->__val, operand, order)
76.280 +#define atomic_fetch_sub_explicit(object, operand, order) \
76.281 + __atomic_fetch_sub(&(object)->__val, operand, order)
76.282 +#define atomic_fetch_xor_explicit(object, operand, order) \
76.283 + __atomic_fetch_xor(&(object)->__val, operand, order)
76.284 +#define atomic_load_explicit(object, order) \
76.285 + __atomic_load_n(&(object)->__val, order)
76.286 +#define atomic_store_explicit(object, desired, order) \
76.287 + __atomic_store_n(&(object)->__val, desired, order)
76.288 +#else
76.289 +#define __atomic_apply_stride(object, operand) \
76.290 + (((__typeof__((object)->__val))0) + (operand))
76.291 +#define atomic_compare_exchange_strong_explicit(object, expected, \
76.292 + desired, success, failure) __extension__ ({ \
76.293 + __typeof__(expected) __ep = (expected); \
76.294 + __typeof__(*__ep) __e = *__ep; \
76.295 + (void)(success); (void)(failure); \
76.296 + (_Bool)((*__ep = __sync_val_compare_and_swap(&(object)->__val, \
76.297 + __e, desired)) == __e); \
76.298 +})
76.299 +#define atomic_compare_exchange_weak_explicit(object, expected, \
76.300 + desired, success, failure) \
76.301 + atomic_compare_exchange_strong_explicit(object, expected, \
76.302 + desired, success, failure)
76.303 +#if __has_builtin(__sync_swap)
76.304 +/* Clang provides a full-barrier atomic exchange - use it if available. */
76.305 +#define atomic_exchange_explicit(object, desired, order) \
76.306 + ((void)(order), __sync_swap(&(object)->__val, desired))
76.307 +#else
76.308 +/*
76.309 + * __sync_lock_test_and_set() is only an acquire barrier in theory (although in
76.310 + * practice it is usually a full barrier) so we need an explicit barrier before
76.311 + * it.
76.312 + */
76.313 +#define atomic_exchange_explicit(object, desired, order) \
76.314 +__extension__ ({ \
76.315 + __typeof__(object) __o = (object); \
76.316 + __typeof__(desired) __d = (desired); \
76.317 + (void)(order); \
76.318 + __sync_synchronize(); \
76.319 + __sync_lock_test_and_set(&(__o)->__val, __d); \
76.320 +})
76.321 +#endif
76.322 +#define atomic_fetch_add_explicit(object, operand, order) \
76.323 + ((void)(order), __sync_fetch_and_add(&(object)->__val, \
76.324 + __atomic_apply_stride(object, operand)))
76.325 +#define atomic_fetch_and_explicit(object, operand, order) \
76.326 + ((void)(order), __sync_fetch_and_and(&(object)->__val, operand))
76.327 +#define atomic_fetch_or_explicit(object, operand, order) \
76.328 + ((void)(order), __sync_fetch_and_or(&(object)->__val, operand))
76.329 +#define atomic_fetch_sub_explicit(object, operand, order) \
76.330 + ((void)(order), __sync_fetch_and_sub(&(object)->__val, \
76.331 + __atomic_apply_stride(object, operand)))
76.332 +#define atomic_fetch_xor_explicit(object, operand, order) \
76.333 + ((void)(order), __sync_fetch_and_xor(&(object)->__val, operand))
76.334 +#define atomic_load_explicit(object, order) \
76.335 + ((void)(order), __sync_fetch_and_add(&(object)->__val, 0))
76.336 +#define atomic_store_explicit(object, desired, order) \
76.337 + ((void)atomic_exchange_explicit(object, desired, order))
76.338 +#endif
76.339 +
76.340 +/*
76.341 + * Convenience functions.
76.342 + *
76.343 + * Don't provide these in kernel space. In kernel space, we should be
76.344 + * disciplined enough to always provide explicit barriers.
76.345 + */
76.346 +
76.347 +#ifndef _KERNEL
76.348 +#define atomic_compare_exchange_strong(object, expected, desired) \
76.349 + atomic_compare_exchange_strong_explicit(object, expected, \
76.350 + desired, memory_order_seq_cst, memory_order_seq_cst)
76.351 +#define atomic_compare_exchange_weak(object, expected, desired) \
76.352 + atomic_compare_exchange_weak_explicit(object, expected, \
76.353 + desired, memory_order_seq_cst, memory_order_seq_cst)
76.354 +#define atomic_exchange(object, desired) \
76.355 + atomic_exchange_explicit(object, desired, memory_order_seq_cst)
76.356 +#define atomic_fetch_add(object, operand) \
76.357 + atomic_fetch_add_explicit(object, operand, memory_order_seq_cst)
76.358 +#define atomic_fetch_and(object, operand) \
76.359 + atomic_fetch_and_explicit(object, operand, memory_order_seq_cst)
76.360 +#define atomic_fetch_or(object, operand) \
76.361 + atomic_fetch_or_explicit(object, operand, memory_order_seq_cst)
76.362 +#define atomic_fetch_sub(object, operand) \
76.363 + atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst)
76.364 +#define atomic_fetch_xor(object, operand) \
76.365 + atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst)
76.366 +#define atomic_load(object) \
76.367 + atomic_load_explicit(object, memory_order_seq_cst)
76.368 +#define atomic_store(object, desired) \
76.369 + atomic_store_explicit(object, desired, memory_order_seq_cst)
76.370 +#endif /* !_KERNEL */
76.371 +
76.372 +/*
76.373 + * 7.17.8 Atomic flag type and operations.
76.374 + *
76.375 + * XXX: Assume atomic_bool can be used as an atomic_flag. Is there some
76.376 + * kind of compiler built-in type we could use?
76.377 + */
76.378 +
76.379 +typedef struct {
76.380 + atomic_bool __flag;
76.381 +} atomic_flag;
76.382 +
76.383 +#define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(0) }
76.384 +
76.385 +static __inline _Bool
76.386 +atomic_flag_test_and_set_explicit(volatile atomic_flag *__object,
76.387 + memory_order __order)
76.388 +{
76.389 + return (atomic_exchange_explicit(&__object->__flag, 1, __order));
76.390 +}
76.391 +
76.392 +static __inline void
76.393 +atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order)
76.394 +{
76.395 +
76.396 + atomic_store_explicit(&__object->__flag, 0, __order);
76.397 +}
76.398 +
76.399 +#ifndef _KERNEL
76.400 +static __inline _Bool
76.401 +atomic_flag_test_and_set(volatile atomic_flag *__object)
76.402 +{
76.403 +
76.404 + return (atomic_flag_test_and_set_explicit(__object,
76.405 + memory_order_seq_cst));
76.406 +}
76.407 +
76.408 +static __inline void
76.409 +atomic_flag_clear(volatile atomic_flag *__object)
76.410 +{
76.411 +
76.412 + atomic_flag_clear_explicit(__object, memory_order_seq_cst);
76.413 +}
76.414 +#endif /* !_KERNEL */
76.415 +
76.416 +#endif /* !_STDATOMIC_H_ */
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/include/stdint.h Mon Oct 21 16:11:07 2019 +0200
77.3 @@ -0,0 +1,466 @@
77.4 +/*
77.5 + * Copyright (c) 2004, 2005 by
77.6 + * Ralf Corsepius, Ulm/Germany. All rights reserved.
77.7 + *
77.8 + * Permission to use, copy, modify, and distribute this software
77.9 + * is freely granted, provided that this notice is preserved.
77.10 + */
77.11 +
77.12 +#ifndef _STDINT_H
77.13 +#define _STDINT_H
77.14 +
77.15 +#include <machine/_default_types.h>
77.16 +#include <sys/_intsup.h>
77.17 +#include <sys/_stdint.h>
77.18 +
77.19 +#ifdef __cplusplus
77.20 +extern "C" {
77.21 +#endif
77.22 +
77.23 +#ifdef ___int_least8_t_defined
77.24 +typedef __int_least8_t int_least8_t;
77.25 +typedef __uint_least8_t uint_least8_t;
77.26 +#define __int_least8_t_defined 1
77.27 +#endif
77.28 +
77.29 +#ifdef ___int_least16_t_defined
77.30 +typedef __int_least16_t int_least16_t;
77.31 +typedef __uint_least16_t uint_least16_t;
77.32 +#define __int_least16_t_defined 1
77.33 +#endif
77.34 +
77.35 +#ifdef ___int_least32_t_defined
77.36 +typedef __int_least32_t int_least32_t;
77.37 +typedef __uint_least32_t uint_least32_t;
77.38 +#define __int_least32_t_defined 1
77.39 +#endif
77.40 +
77.41 +#ifdef ___int_least64_t_defined
77.42 +typedef __int_least64_t int_least64_t;
77.43 +typedef __uint_least64_t uint_least64_t;
77.44 +#define __int_least64_t_defined 1
77.45 +#endif
77.46 +
77.47 +/*
77.48 + * Fastest minimum-width integer types
77.49 + *
77.50 + * Assume int to be the fastest type for all types with a width
77.51 + * less than __INT_MAX__ rsp. INT_MAX
77.52 + */
77.53 +#ifdef __INT_FAST8_TYPE__
77.54 + typedef __INT_FAST8_TYPE__ int_fast8_t;
77.55 + typedef __UINT_FAST8_TYPE__ uint_fast8_t;
77.56 +#define __int_fast8_t_defined 1
77.57 +#elif __STDINT_EXP(INT_MAX) >= 0x7f
77.58 + typedef signed int int_fast8_t;
77.59 + typedef unsigned int uint_fast8_t;
77.60 +#define __int_fast8_t_defined 1
77.61 +#endif
77.62 +
77.63 +#ifdef __INT_FAST16_TYPE__
77.64 + typedef __INT_FAST16_TYPE__ int_fast16_t;
77.65 + typedef __UINT_FAST16_TYPE__ uint_fast16_t;
77.66 +#define __int_fast16_t_defined 1
77.67 +#elif __STDINT_EXP(INT_MAX) >= 0x7fff
77.68 + typedef signed int int_fast16_t;
77.69 + typedef unsigned int uint_fast16_t;
77.70 +#define __int_fast16_t_defined 1
77.71 +#endif
77.72 +
77.73 +#ifdef __INT_FAST32_TYPE__
77.74 + typedef __INT_FAST32_TYPE__ int_fast32_t;
77.75 + typedef __UINT_FAST32_TYPE__ uint_fast32_t;
77.76 +#define __int_fast32_t_defined 1
77.77 +#elif __STDINT_EXP(INT_MAX) >= 0x7fffffff
77.78 + typedef signed int int_fast32_t;
77.79 + typedef unsigned int uint_fast32_t;
77.80 +#define __int_fast32_t_defined 1
77.81 +#endif
77.82 +
77.83 +#ifdef __INT_FAST64_TYPE__
77.84 + typedef __INT_FAST64_TYPE__ int_fast64_t;
77.85 + typedef __UINT_FAST64_TYPE__ uint_fast64_t;
77.86 +#define __int_fast64_t_defined 1
77.87 +#elif __STDINT_EXP(INT_MAX) > 0x7fffffff
77.88 + typedef signed int int_fast64_t;
77.89 + typedef unsigned int uint_fast64_t;
77.90 +#define __int_fast64_t_defined 1
77.91 +#endif
77.92 +
77.93 +/*
77.94 + * Fall back to [u]int_least<N>_t for [u]int_fast<N>_t types
77.95 + * not having been defined, yet.
77.96 + * Leave undefined, if [u]int_least<N>_t should not be available.
77.97 + */
77.98 +#if !__int_fast8_t_defined
77.99 +#if __int_least8_t_defined
77.100 + typedef int_least8_t int_fast8_t;
77.101 + typedef uint_least8_t uint_fast8_t;
77.102 +#define __int_fast8_t_defined 1
77.103 +#endif
77.104 +#endif
77.105 +
77.106 +#if !__int_fast16_t_defined
77.107 +#if __int_least16_t_defined
77.108 + typedef int_least16_t int_fast16_t;
77.109 + typedef uint_least16_t uint_fast16_t;
77.110 +#define __int_fast16_t_defined 1
77.111 +#endif
77.112 +#endif
77.113 +
77.114 +#if !__int_fast32_t_defined
77.115 +#if __int_least32_t_defined
77.116 + typedef int_least32_t int_fast32_t;
77.117 + typedef uint_least32_t uint_fast32_t;
77.118 +#define __int_fast32_t_defined 1
77.119 +#endif
77.120 +#endif
77.121 +
77.122 +#if !__int_fast64_t_defined
77.123 +#if __int_least64_t_defined
77.124 + typedef int_least64_t int_fast64_t;
77.125 + typedef uint_least64_t uint_fast64_t;
77.126 +#define __int_fast64_t_defined 1
77.127 +#endif
77.128 +#endif
77.129 +
77.130 +#ifdef __INTPTR_TYPE__
77.131 +#define INTPTR_MIN (-__INTPTR_MAX__ - 1)
77.132 +#define INTPTR_MAX (__INTPTR_MAX__)
77.133 +#define UINTPTR_MAX (__UINTPTR_MAX__)
77.134 +#elif defined(__PTRDIFF_TYPE__)
77.135 +#define INTPTR_MAX PTRDIFF_MAX
77.136 +#define INTPTR_MIN PTRDIFF_MIN
77.137 +#ifdef __UINTPTR_MAX__
77.138 +#define UINTPTR_MAX (__UINTPTR_MAX__)
77.139 +#else
77.140 +#define UINTPTR_MAX (2UL * PTRDIFF_MAX + 1)
77.141 +#endif
77.142 +#else
77.143 +/*
77.144 + * Fallback to hardcoded values,
77.145 + * should be valid on cpu's with 32bit int/32bit void*
77.146 + */
77.147 +#define INTPTR_MAX (__STDINT_EXP(LONG_MAX))
77.148 +#define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
77.149 +#define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
77.150 +#endif
77.151 +
77.152 +/* Limits of Specified-Width Integer Types */
77.153 +
77.154 +#ifdef __INT8_MAX__
77.155 +#define INT8_MIN (-__INT8_MAX__ - 1)
77.156 +#define INT8_MAX (__INT8_MAX__)
77.157 +#define UINT8_MAX (__UINT8_MAX__)
77.158 +#elif defined(__int8_t_defined)
77.159 +#define INT8_MIN (-128)
77.160 +#define INT8_MAX (127)
77.161 +#define UINT8_MAX (255)
77.162 +#endif
77.163 +
77.164 +#ifdef __INT_LEAST8_MAX__
77.165 +#define INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)
77.166 +#define INT_LEAST8_MAX (__INT_LEAST8_MAX__)
77.167 +#define UINT_LEAST8_MAX (__UINT_LEAST8_MAX__)
77.168 +#elif defined(__int_least8_t_defined)
77.169 +#define INT_LEAST8_MIN (-128)
77.170 +#define INT_LEAST8_MAX (127)
77.171 +#define UINT_LEAST8_MAX (255)
77.172 +#else
77.173 +#error required type int_least8_t missing
77.174 +#endif
77.175 +
77.176 +#ifdef __INT16_MAX__
77.177 +#define INT16_MIN (-__INT16_MAX__ - 1)
77.178 +#define INT16_MAX (__INT16_MAX__)
77.179 +#define UINT16_MAX (__UINT16_MAX__)
77.180 +#elif defined(__int16_t_defined)
77.181 +#define INT16_MIN (-32768)
77.182 +#define INT16_MAX (32767)
77.183 +#define UINT16_MAX (65535)
77.184 +#endif
77.185 +
77.186 +#ifdef __INT_LEAST16_MAX__
77.187 +#define INT_LEAST16_MIN (-__INT_LEAST16_MAX__ - 1)
77.188 +#define INT_LEAST16_MAX (__INT_LEAST16_MAX__)
77.189 +#define UINT_LEAST16_MAX (__UINT_LEAST16_MAX__)
77.190 +#elif defined(__int_least16_t_defined)
77.191 +#define INT_LEAST16_MIN (-32768)
77.192 +#define INT_LEAST16_MAX (32767)
77.193 +#define UINT_LEAST16_MAX (65535)
77.194 +#else
77.195 +#error required type int_least16_t missing
77.196 +#endif
77.197 +
77.198 +#ifdef __INT32_MAX__
77.199 +#define INT32_MIN (-__INT32_MAX__ - 1)
77.200 +#define INT32_MAX (__INT32_MAX__)
77.201 +#define UINT32_MAX (__UINT32_MAX__)
77.202 +#elif defined(__int32_t_defined)
77.203 +#if defined (_INT32_EQ_LONG)
77.204 +#define INT32_MIN (-2147483647L-1)
77.205 +#define INT32_MAX (2147483647L)
77.206 +#define UINT32_MAX (4294967295UL)
77.207 +#else
77.208 +#define INT32_MIN (-2147483647-1)
77.209 +#define INT32_MAX (2147483647)
77.210 +#define UINT32_MAX (4294967295U)
77.211 +#endif
77.212 +#endif
77.213 +
77.214 +#ifdef __INT_LEAST32_MAX__
77.215 +#define INT_LEAST32_MIN (-__INT_LEAST32_MAX__ - 1)
77.216 +#define INT_LEAST32_MAX (__INT_LEAST32_MAX__)
77.217 +#define UINT_LEAST32_MAX (__UINT_LEAST32_MAX__)
77.218 +#elif defined(__int_least32_t_defined)
77.219 +#if defined (_INT32_EQ_LONG)
77.220 +#define INT_LEAST32_MIN (-2147483647L-1)
77.221 +#define INT_LEAST32_MAX (2147483647L)
77.222 +#define UINT_LEAST32_MAX (4294967295UL)
77.223 +#else
77.224 +#define INT_LEAST32_MIN (-2147483647-1)
77.225 +#define INT_LEAST32_MAX (2147483647)
77.226 +#define UINT_LEAST32_MAX (4294967295U)
77.227 +#endif
77.228 +#else
77.229 +#error required type int_least32_t missing
77.230 +#endif
77.231 +
77.232 +#ifdef __INT64_MAX__
77.233 +#define INT64_MIN (-__INT64_MAX__ - 1)
77.234 +#define INT64_MAX (__INT64_MAX__)
77.235 +#define UINT64_MAX (__UINT64_MAX__)
77.236 +#elif defined(__int64_t_defined)
77.237 +#if __have_long64
77.238 +#define INT64_MIN (-9223372036854775807L-1L)
77.239 +#define INT64_MAX (9223372036854775807L)
77.240 +#define UINT64_MAX (18446744073709551615U)
77.241 +#elif __have_longlong64
77.242 +#define INT64_MIN (-9223372036854775807LL-1LL)
77.243 +#define INT64_MAX (9223372036854775807LL)
77.244 +#define UINT64_MAX (18446744073709551615ULL)
77.245 +#endif
77.246 +#endif
77.247 +
77.248 +#ifdef __INT_LEAST64_MAX__
77.249 +#define INT_LEAST64_MIN (-__INT_LEAST64_MAX__ - 1)
77.250 +#define INT_LEAST64_MAX (__INT_LEAST64_MAX__)
77.251 +#define UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)
77.252 +#elif defined(__int_least64_t_defined)
77.253 +#if __have_long64
77.254 +#define INT_LEAST64_MIN (-9223372036854775807L-1L)
77.255 +#define INT_LEAST64_MAX (9223372036854775807L)
77.256 +#define UINT_LEAST64_MAX (18446744073709551615U)
77.257 +#elif __have_longlong64
77.258 +#define INT_LEAST64_MIN (-9223372036854775807LL-1LL)
77.259 +#define INT_LEAST64_MAX (9223372036854775807LL)
77.260 +#define UINT_LEAST64_MAX (18446744073709551615ULL)
77.261 +#endif
77.262 +#endif
77.263 +
77.264 +#ifdef __INT_FAST8_MAX__
77.265 +#define INT_FAST8_MIN (-__INT_FAST8_MAX__ - 1)
77.266 +#define INT_FAST8_MAX (__INT_FAST8_MAX__)
77.267 +#define UINT_FAST8_MAX (__UINT_FAST8_MAX__)
77.268 +#elif defined(__int_fast8_t_defined)
77.269 +#if __STDINT_EXP(INT_MAX) >= 0x7f
77.270 +#define INT_FAST8_MIN (-__STDINT_EXP(INT_MAX)-1)
77.271 +#define INT_FAST8_MAX (__STDINT_EXP(INT_MAX))
77.272 +#define UINT_FAST8_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
77.273 +#else
77.274 +#define INT_FAST8_MIN INT_LEAST8_MIN
77.275 +#define INT_FAST8_MAX INT_LEAST8_MAX
77.276 +#define UINT_FAST8_MAX UINT_LEAST8_MAX
77.277 +#endif
77.278 +#endif
77.279 +
77.280 +#ifdef __INT_FAST16_MAX__
77.281 +#define INT_FAST16_MIN (-__INT_FAST16_MAX__ - 1)
77.282 +#define INT_FAST16_MAX (__INT_FAST16_MAX__)
77.283 +#define UINT_FAST16_MAX (__UINT_FAST16_MAX__)
77.284 +#elif defined(__int_fast16_t_defined)
77.285 +#if __STDINT_EXP(INT_MAX) >= 0x7fff
77.286 +#define INT_FAST16_MIN (-__STDINT_EXP(INT_MAX)-1)
77.287 +#define INT_FAST16_MAX (__STDINT_EXP(INT_MAX))
77.288 +#define UINT_FAST16_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
77.289 +#else
77.290 +#define INT_FAST16_MIN INT_LEAST16_MIN
77.291 +#define INT_FAST16_MAX INT_LEAST16_MAX
77.292 +#define UINT_FAST16_MAX UINT_LEAST16_MAX
77.293 +#endif
77.294 +#endif
77.295 +
77.296 +#ifdef __INT_FAST32_MAX__
77.297 +#define INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)
77.298 +#define INT_FAST32_MAX (__INT_FAST32_MAX__)
77.299 +#define UINT_FAST32_MAX (__UINT_FAST32_MAX__)
77.300 +#elif defined(__int_fast32_t_defined)
77.301 +#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
77.302 +#define INT_FAST32_MIN (-__STDINT_EXP(INT_MAX)-1)
77.303 +#define INT_FAST32_MAX (__STDINT_EXP(INT_MAX))
77.304 +#define UINT_FAST32_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
77.305 +#else
77.306 +#define INT_FAST32_MIN INT_LEAST32_MIN
77.307 +#define INT_FAST32_MAX INT_LEAST32_MAX
77.308 +#define UINT_FAST32_MAX UINT_LEAST32_MAX
77.309 +#endif
77.310 +#endif
77.311 +
77.312 +#ifdef __INT_FAST64_MAX__
77.313 +#define INT_FAST64_MIN (-__INT_FAST64_MAX__ - 1)
77.314 +#define INT_FAST64_MAX (__INT_FAST64_MAX__)
77.315 +#define UINT_FAST64_MAX (__UINT_FAST64_MAX__)
77.316 +#elif defined(__int_fast64_t_defined)
77.317 +#if __STDINT_EXP(INT_MAX) > 0x7fffffff
77.318 +#define INT_FAST64_MIN (-__STDINT_EXP(INT_MAX)-1)
77.319 +#define INT_FAST64_MAX (__STDINT_EXP(INT_MAX))
77.320 +#define UINT_FAST64_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
77.321 +#else
77.322 +#define INT_FAST64_MIN INT_LEAST64_MIN
77.323 +#define INT_FAST64_MAX INT_LEAST64_MAX
77.324 +#define UINT_FAST64_MAX UINT_LEAST64_MAX
77.325 +#endif
77.326 +#endif
77.327 +
77.328 +#ifdef __INTMAX_MAX__
77.329 +#define INTMAX_MAX (__INTMAX_MAX__)
77.330 +#define INTMAX_MIN (-INTMAX_MAX - 1)
77.331 +#elif defined(__INTMAX_TYPE__)
77.332 +/* All relevant GCC versions prefer long to long long for intmax_t. */
77.333 +#define INTMAX_MAX INT64_MAX
77.334 +#define INTMAX_MIN INT64_MIN
77.335 +#endif
77.336 +
77.337 +#ifdef __UINTMAX_MAX__
77.338 +#define UINTMAX_MAX (__UINTMAX_MAX__)
77.339 +#elif defined(__UINTMAX_TYPE__)
77.340 +/* All relevant GCC versions prefer long to long long for intmax_t. */
77.341 +#define UINTMAX_MAX UINT64_MAX
77.342 +#endif
77.343 +
77.344 +/* This must match size_t in stddef.h, currently long unsigned int */
77.345 +#ifdef __SIZE_MAX__
77.346 +#define SIZE_MAX (__SIZE_MAX__)
77.347 +#else
77.348 +#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
77.349 +#endif
77.350 +
77.351 +/* This must match sig_atomic_t in <signal.h> (currently int) */
77.352 +#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
77.353 +#define SIG_ATOMIC_MAX (__STDINT_EXP(INT_MAX))
77.354 +
77.355 +/* This must match ptrdiff_t in <stddef.h> (currently long int) */
77.356 +#ifdef __PTRDIFF_MAX__
77.357 +#define PTRDIFF_MAX (__PTRDIFF_MAX__)
77.358 +#else
77.359 +#define PTRDIFF_MAX (__STDINT_EXP(LONG_MAX))
77.360 +#endif
77.361 +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
77.362 +
77.363 +/* This must match definition in <wchar.h> */
77.364 +#ifndef WCHAR_MIN
77.365 +#ifdef __WCHAR_MIN__
77.366 +#define WCHAR_MIN (__WCHAR_MIN__)
77.367 +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
77.368 +#define WCHAR_MIN (0 + L'\0')
77.369 +#else
77.370 +#define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
77.371 +#endif
77.372 +#endif
77.373 +
77.374 +/* This must match definition in <wchar.h> */
77.375 +#ifndef WCHAR_MAX
77.376 +#ifdef __WCHAR_MAX__
77.377 +#define WCHAR_MAX (__WCHAR_MAX__)
77.378 +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
77.379 +#define WCHAR_MAX (0xffffffffu + L'\0')
77.380 +#else
77.381 +#define WCHAR_MAX (0x7fffffff + L'\0')
77.382 +#endif
77.383 +#endif
77.384 +
77.385 +/* wint_t is unsigned int on almost all GCC targets. */
77.386 +#ifdef __WINT_MAX__
77.387 +#define WINT_MAX (__WINT_MAX__)
77.388 +#else
77.389 +#define WINT_MAX (__STDINT_EXP(INT_MAX) * 2U + 1U)
77.390 +#endif
77.391 +#ifdef __WINT_MIN__
77.392 +#define WINT_MIN (__WINT_MIN__)
77.393 +#else
77.394 +#define WINT_MIN (0U)
77.395 +#endif
77.396 +
77.397 +/** Macros for minimum-width integer constant expressions */
77.398 +#ifdef __INT8_C
77.399 +#define INT8_C(x) __INT8_C(x)
77.400 +#define UINT8_C(x) __UINT8_C(x)
77.401 +#else
77.402 +#define INT8_C(x) x
77.403 +#if __STDINT_EXP(INT_MAX) > 0x7f
77.404 +#define UINT8_C(x) x
77.405 +#else
77.406 +#define UINT8_C(x) x##U
77.407 +#endif
77.408 +#endif
77.409 +
77.410 +#ifdef __INT16_C
77.411 +#define INT16_C(x) __INT16_C(x)
77.412 +#define UINT16_C(x) __UINT16_C(x)
77.413 +#else
77.414 +#define INT16_C(x) x
77.415 +#if __STDINT_EXP(INT_MAX) > 0x7fff
77.416 +#define UINT16_C(x) x
77.417 +#else
77.418 +#define UINT16_C(x) x##U
77.419 +#endif
77.420 +#endif
77.421 +
77.422 +#ifdef __INT32_C
77.423 +#define INT32_C(x) __INT32_C(x)
77.424 +#define UINT32_C(x) __UINT32_C(x)
77.425 +#else
77.426 +#if defined (_INT32_EQ_LONG)
77.427 +#define INT32_C(x) x##L
77.428 +#define UINT32_C(x) x##UL
77.429 +#else
77.430 +#define INT32_C(x) x
77.431 +#define UINT32_C(x) x##U
77.432 +#endif
77.433 +#endif
77.434 +
77.435 +#ifdef __INT64_C
77.436 +#define INT64_C(x) __INT64_C(x)
77.437 +#define UINT64_C(x) __UINT64_C(x)
77.438 +#else
77.439 +#if __int64_t_defined
77.440 +#if __have_long64
77.441 +#define INT64_C(x) x##L
77.442 +#define UINT64_C(x) x##UL
77.443 +#else
77.444 +#define INT64_C(x) x##LL
77.445 +#define UINT64_C(x) x##ULL
77.446 +#endif
77.447 +#endif
77.448 +#endif
77.449 +
77.450 +/** Macros for greatest-width integer constant expression */
77.451 +#ifdef __INTMAX_C
77.452 +#define INTMAX_C(x) __INTMAX_C(x)
77.453 +#define UINTMAX_C(x) __UINTMAX_C(x)
77.454 +#else
77.455 +#if __have_long64
77.456 +#define INTMAX_C(x) x##L
77.457 +#define UINTMAX_C(x) x##UL
77.458 +#else
77.459 +#define INTMAX_C(x) x##LL
77.460 +#define UINTMAX_C(x) x##ULL
77.461 +#endif
77.462 +#endif
77.463 +
77.464 +
77.465 +#ifdef __cplusplus
77.466 +}
77.467 +#endif
77.468 +
77.469 +#endif /* _STDINT_H */
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/include/stdio.h Mon Oct 21 16:11:07 2019 +0200
78.3 @@ -0,0 +1,803 @@
78.4 +/*
78.5 + * Copyright (c) 1990 The Regents of the University of California.
78.6 + * All rights reserved.
78.7 + *
78.8 + * Redistribution and use in source and binary forms are permitted
78.9 + * provided that the above copyright notice and this paragraph are
78.10 + * duplicated in all such forms and that any documentation,
78.11 + * advertising materials, and other materials related to such
78.12 + * distribution and use acknowledge that the software was developed
78.13 + * by the University of California, Berkeley. The name of the
78.14 + * University may not be used to endorse or promote products derived
78.15 + * from this software without specific prior written permission.
78.16 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
78.17 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
78.18 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
78.19 + *
78.20 + * @(#)stdio.h 5.3 (Berkeley) 3/15/86
78.21 + */
78.22 +
78.23 +/*
78.24 + * NB: to fit things in six character monocase externals, the
78.25 + * stdio code uses the prefix `__s' for stdio objects, typically
78.26 + * followed by a three-character attempt at a mnemonic.
78.27 + */
78.28 +
78.29 +#ifndef _STDIO_H_
78.30 +#define _STDIO_H_
78.31 +
78.32 +#include "_ansi.h"
78.33 +
78.34 +#define _FSTDIO /* ``function stdio'' */
78.35 +
78.36 +#define __need_size_t
78.37 +#define __need_NULL
78.38 +#include <sys/cdefs.h>
78.39 +#include <stddef.h>
78.40 +
78.41 +/* typedef only __gnuc_va_list, used throughout the header */
78.42 +#define __need___va_list
78.43 +#include <stdarg.h>
78.44 +
78.45 +/* typedef va_list only when required */
78.46 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
78.47 +#ifdef __GNUC__
78.48 +#ifndef _VA_LIST_DEFINED
78.49 +typedef __gnuc_va_list va_list;
78.50 +#define _VA_LIST_DEFINED
78.51 +#endif
78.52 +#else /* !__GNUC__ */
78.53 +#include <stdarg.h>
78.54 +#endif
78.55 +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
78.56 +
78.57 +/*
78.58 + * <sys/reent.h> defines __FILE, _fpos_t.
78.59 + * They must be defined there because struct _reent needs them (and we don't
78.60 + * want reent.h to include this file.
78.61 + */
78.62 +
78.63 +#include <sys/reent.h>
78.64 +#include <sys/types.h>
78.65 +
78.66 +_BEGIN_STD_C
78.67 +
78.68 +#if !defined(__FILE_defined)
78.69 +typedef __FILE FILE;
78.70 +# define __FILE_defined
78.71 +#endif
78.72 +
78.73 +#ifdef __CYGWIN__
78.74 +typedef _fpos64_t fpos_t;
78.75 +#else
78.76 +typedef _fpos_t fpos_t;
78.77 +#ifdef __LARGE64_FILES
78.78 +typedef _fpos64_t fpos64_t;
78.79 +#endif
78.80 +#endif /* !__CYGWIN__ */
78.81 +
78.82 +#include <sys/stdio.h>
78.83 +
78.84 +#define __SLBF 0x0001 /* line buffered */
78.85 +#define __SNBF 0x0002 /* unbuffered */
78.86 +#define __SRD 0x0004 /* OK to read */
78.87 +#define __SWR 0x0008 /* OK to write */
78.88 + /* RD and WR are never simultaneously asserted */
78.89 +#define __SRW 0x0010 /* open for reading & writing */
78.90 +#define __SEOF 0x0020 /* found EOF */
78.91 +#define __SERR 0x0040 /* found error */
78.92 +#define __SMBF 0x0080 /* _buf is from malloc */
78.93 +#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */
78.94 +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
78.95 +#define __SOPT 0x0400 /* do fseek() optimisation */
78.96 +#define __SNPT 0x0800 /* do not do fseek() optimisation */
78.97 +#define __SOFF 0x1000 /* set iff _offset is in fact correct */
78.98 +#define __SORD 0x2000 /* true => stream orientation (byte/wide) decided */
78.99 +#if defined(__CYGWIN__)
78.100 +# define __SCLE 0x4000 /* convert line endings CR/LF <-> NL */
78.101 +#endif
78.102 +#define __SL64 0x8000 /* is 64-bit offset large file */
78.103 +
78.104 +/* _flags2 flags */
78.105 +#define __SNLK 0x0001 /* stdio functions do not lock streams themselves */
78.106 +#define __SWID 0x2000 /* true => stream orientation wide, false => byte, only valid if __SORD in _flags is true */
78.107 +
78.108 +/*
78.109 + * The following three definitions are for ANSI C, which took them
78.110 + * from System V, which stupidly took internal interface macros and
78.111 + * made them official arguments to setvbuf(), without renaming them.
78.112 + * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
78.113 + *
78.114 + * Although these happen to match their counterparts above, the
78.115 + * implementation does not rely on that (so these could be renumbered).
78.116 + */
78.117 +#define _IOFBF 0 /* setvbuf should set fully buffered */
78.118 +#define _IOLBF 1 /* setvbuf should set line buffered */
78.119 +#define _IONBF 2 /* setvbuf should set unbuffered */
78.120 +
78.121 +#define EOF (-1)
78.122 +
78.123 +#ifdef __BUFSIZ__
78.124 +#define BUFSIZ __BUFSIZ__
78.125 +#else
78.126 +#define BUFSIZ 1024
78.127 +#endif
78.128 +
78.129 +#ifdef __FOPEN_MAX__
78.130 +#define FOPEN_MAX __FOPEN_MAX__
78.131 +#else
78.132 +#define FOPEN_MAX 20
78.133 +#endif
78.134 +
78.135 +#ifdef __FILENAME_MAX__
78.136 +#define FILENAME_MAX __FILENAME_MAX__
78.137 +#else
78.138 +#define FILENAME_MAX 1024
78.139 +#endif
78.140 +
78.141 +#ifdef __L_tmpnam__
78.142 +#define L_tmpnam __L_tmpnam__
78.143 +#else
78.144 +#define L_tmpnam FILENAME_MAX
78.145 +#endif
78.146 +
78.147 +#if __BSD_VISIBLE || __XSI_VISIBLE
78.148 +#define P_tmpdir "/tmp"
78.149 +#endif
78.150 +
78.151 +#ifndef SEEK_SET
78.152 +#define SEEK_SET 0 /* set file offset to offset */
78.153 +#endif
78.154 +#ifndef SEEK_CUR
78.155 +#define SEEK_CUR 1 /* set file offset to current plus offset */
78.156 +#endif
78.157 +#ifndef SEEK_END
78.158 +#define SEEK_END 2 /* set file offset to EOF plus offset */
78.159 +#endif
78.160 +
78.161 +#define TMP_MAX 26
78.162 +
78.163 +#define stdin (_REENT->_stdin)
78.164 +#define stdout (_REENT->_stdout)
78.165 +#define stderr (_REENT->_stderr)
78.166 +
78.167 +#define _stdin_r(x) ((x)->_stdin)
78.168 +#define _stdout_r(x) ((x)->_stdout)
78.169 +#define _stderr_r(x) ((x)->_stderr)
78.170 +
78.171 +/*
78.172 + * Functions defined in ANSI C standard.
78.173 + */
78.174 +
78.175 +#ifndef __VALIST
78.176 +#ifdef __GNUC__
78.177 +#define __VALIST __gnuc_va_list
78.178 +#else
78.179 +#define __VALIST char*
78.180 +#endif
78.181 +#endif
78.182 +
78.183 +#if __POSIX_VISIBLE
78.184 +char * ctermid (char *);
78.185 +#endif
78.186 +#if __GNU_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)
78.187 +char * cuserid (char *);
78.188 +#endif
78.189 +FILE * tmpfile (void);
78.190 +char * tmpnam (char *);
78.191 +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
78.192 +char * tempnam (const char *, const char *) __malloc_like __result_use_check;
78.193 +#endif
78.194 +int fclose (FILE *);
78.195 +int fflush (FILE *);
78.196 +FILE * freopen (const char *__restrict, const char *__restrict, FILE *__restrict);
78.197 +void setbuf (FILE *__restrict, char *__restrict);
78.198 +int setvbuf (FILE *__restrict, char *__restrict, int, size_t);
78.199 +int fprintf (FILE *__restrict, const char *__restrict, ...)
78.200 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.201 +int fscanf (FILE *__restrict, const char *__restrict, ...)
78.202 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.203 +int printf (const char *__restrict, ...)
78.204 + _ATTRIBUTE ((__format__ (__printf__, 1, 2)));
78.205 +int scanf (const char *__restrict, ...)
78.206 + _ATTRIBUTE ((__format__ (__scanf__, 1, 2)));
78.207 +int sscanf (const char *__restrict, const char *__restrict, ...)
78.208 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.209 +int vfprintf (FILE *__restrict, const char *__restrict, __VALIST)
78.210 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.211 +int vprintf (const char *, __VALIST)
78.212 + _ATTRIBUTE ((__format__ (__printf__, 1, 0)));
78.213 +int vsprintf (char *__restrict, const char *__restrict, __VALIST)
78.214 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.215 +int fgetc (FILE *);
78.216 +char * fgets (char *__restrict, int, FILE *__restrict);
78.217 +int fputc (int, FILE *);
78.218 +int fputs (const char *__restrict, FILE *__restrict);
78.219 +int getc (FILE *);
78.220 +int getchar (void);
78.221 +char * gets (char *);
78.222 +int putc (int, FILE *);
78.223 +int putchar (int);
78.224 +int puts (const char *);
78.225 +int ungetc (int, FILE *);
78.226 +size_t fread (void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.227 +size_t fwrite (const void *__restrict , size_t _size, size_t _n, FILE *);
78.228 +#ifdef _COMPILING_NEWLIB
78.229 +int fgetpos (FILE *, _fpos_t *);
78.230 +#else
78.231 +int fgetpos (FILE *__restrict, fpos_t *__restrict);
78.232 +#endif
78.233 +int fseek (FILE *, long, int);
78.234 +#ifdef _COMPILING_NEWLIB
78.235 +int fsetpos (FILE *, const _fpos_t *);
78.236 +#else
78.237 +int fsetpos (FILE *, const fpos_t *);
78.238 +#endif
78.239 +long ftell ( FILE *);
78.240 +void rewind (FILE *);
78.241 +void clearerr (FILE *);
78.242 +int feof (FILE *);
78.243 +int ferror (FILE *);
78.244 +void perror (const char *);
78.245 +#ifndef _REENT_ONLY
78.246 +FILE * fopen (const char *__restrict _name, const char *__restrict _type);
78.247 +int sprintf (char *__restrict, const char *__restrict, ...)
78.248 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.249 +int remove (const char *);
78.250 +int rename (const char *, const char *);
78.251 +#ifdef _COMPILING_NEWLIB
78.252 +int _rename (const char *, const char *);
78.253 +#endif
78.254 +#endif
78.255 +#if __LARGEFILE_VISIBLE || __POSIX_VISIBLE >= 200112
78.256 +#ifdef _COMPILING_NEWLIB
78.257 +int fseeko (FILE *, _off_t, int);
78.258 +_off_t ftello (FILE *);
78.259 +#else
78.260 +int fseeko (FILE *, off_t, int);
78.261 +off_t ftello (FILE *);
78.262 +#endif
78.263 +#endif
78.264 +#if __GNU_VISIBLE
78.265 +int fcloseall (void);
78.266 +#endif
78.267 +#ifndef _REENT_ONLY
78.268 +#if __ISO_C_VISIBLE >= 1999
78.269 +int snprintf (char *__restrict, size_t, const char *__restrict, ...)
78.270 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.271 +int vsnprintf (char *__restrict, size_t, const char *__restrict, __VALIST)
78.272 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.273 +int vfscanf (FILE *__restrict, const char *__restrict, __VALIST)
78.274 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.275 +int vscanf (const char *, __VALIST)
78.276 + _ATTRIBUTE ((__format__ (__scanf__, 1, 0)));
78.277 +int vsscanf (const char *__restrict, const char *__restrict, __VALIST)
78.278 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.279 +#endif
78.280 +#if __GNU_VISIBLE
78.281 +int asprintf (char **__restrict, const char *__restrict, ...)
78.282 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.283 +int vasprintf (char **, const char *, __VALIST)
78.284 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.285 +#endif
78.286 +#if __MISC_VISIBLE /* Newlib-specific */
78.287 +int asiprintf (char **, const char *, ...)
78.288 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.289 +char * asniprintf (char *, size_t *, const char *, ...)
78.290 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.291 +char * asnprintf (char *__restrict, size_t *__restrict, const char *__restrict, ...)
78.292 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.293 +#ifndef diprintf
78.294 +int diprintf (int, const char *, ...)
78.295 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.296 +#endif
78.297 +int fiprintf (FILE *, const char *, ...)
78.298 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.299 +int fiscanf (FILE *, const char *, ...)
78.300 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.301 +int iprintf (const char *, ...)
78.302 + _ATTRIBUTE ((__format__ (__printf__, 1, 2)));
78.303 +int iscanf (const char *, ...)
78.304 + _ATTRIBUTE ((__format__ (__scanf__, 1, 2)));
78.305 +int siprintf (char *, const char *, ...)
78.306 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.307 +int siscanf (const char *, const char *, ...)
78.308 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.309 +int sniprintf (char *, size_t, const char *, ...)
78.310 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.311 +int vasiprintf (char **, const char *, __VALIST)
78.312 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.313 +char * vasniprintf (char *, size_t *, const char *, __VALIST)
78.314 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.315 +char * vasnprintf (char *, size_t *, const char *, __VALIST)
78.316 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.317 +int vdiprintf (int, const char *, __VALIST)
78.318 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.319 +int vfiprintf (FILE *, const char *, __VALIST)
78.320 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.321 +int vfiscanf (FILE *, const char *, __VALIST)
78.322 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.323 +int viprintf (const char *, __VALIST)
78.324 + _ATTRIBUTE ((__format__ (__printf__, 1, 0)));
78.325 +int viscanf (const char *, __VALIST)
78.326 + _ATTRIBUTE ((__format__ (__scanf__, 1, 0)));
78.327 +int vsiprintf (char *, const char *, __VALIST)
78.328 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.329 +int vsiscanf (const char *, const char *, __VALIST)
78.330 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.331 +int vsniprintf (char *, size_t, const char *, __VALIST)
78.332 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.333 +#endif /* __MISC_VISIBLE */
78.334 +#endif /* !_REENT_ONLY */
78.335 +
78.336 +/*
78.337 + * Routines in POSIX 1003.1:2001.
78.338 + */
78.339 +
78.340 +#if __POSIX_VISIBLE
78.341 +#ifndef _REENT_ONLY
78.342 +FILE * fdopen (int, const char *);
78.343 +#endif
78.344 +int fileno (FILE *);
78.345 +#endif
78.346 +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 199209
78.347 +int pclose (FILE *);
78.348 +FILE * popen (const char *, const char *);
78.349 +#endif
78.350 +
78.351 +#if __BSD_VISIBLE
78.352 +void setbuffer (FILE *, char *, int);
78.353 +int setlinebuf (FILE *);
78.354 +#endif
78.355 +
78.356 +#if __MISC_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112)
78.357 +int getw (FILE *);
78.358 +int putw (int, FILE *);
78.359 +#endif
78.360 +#if __MISC_VISIBLE || __POSIX_VISIBLE
78.361 +int getc_unlocked (FILE *);
78.362 +int getchar_unlocked (void);
78.363 +void flockfile (FILE *);
78.364 +int ftrylockfile (FILE *);
78.365 +void funlockfile (FILE *);
78.366 +int putc_unlocked (int, FILE *);
78.367 +int putchar_unlocked (int);
78.368 +#endif
78.369 +
78.370 +/*
78.371 + * Routines in POSIX 1003.1:200x.
78.372 + */
78.373 +
78.374 +#if __POSIX_VISIBLE >= 200809
78.375 +# ifndef _REENT_ONLY
78.376 +# ifndef dprintf
78.377 +int dprintf (int, const char *__restrict, ...)
78.378 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.379 +# endif
78.380 +FILE * fmemopen (void *__restrict, size_t, const char *__restrict);
78.381 +/* getdelim - see __getdelim for now */
78.382 +/* getline - see __getline for now */
78.383 +FILE * open_memstream (char **, size_t *);
78.384 +int vdprintf (int, const char *__restrict, __VALIST)
78.385 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.386 +# endif
78.387 +#endif
78.388 +#if __ATFILE_VISIBLE
78.389 +int renameat (int, const char *, int, const char *);
78.390 +# ifdef __CYGWIN__
78.391 +int renameat2 (int, const char *, int, const char *, unsigned int);
78.392 +# endif
78.393 +#endif
78.394 +
78.395 +/*
78.396 + * Recursive versions of the above.
78.397 + */
78.398 +
78.399 +int _asiprintf_r (struct _reent *, char **, const char *, ...)
78.400 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.401 +char * _asniprintf_r (struct _reent *, char *, size_t *, const char *, ...)
78.402 + _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
78.403 +char * _asnprintf_r (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
78.404 + _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
78.405 +int _asprintf_r (struct _reent *, char **__restrict, const char *__restrict, ...)
78.406 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.407 +int _diprintf_r (struct _reent *, int, const char *, ...)
78.408 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.409 +int _dprintf_r (struct _reent *, int, const char *__restrict, ...)
78.410 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.411 +int _fclose_r (struct _reent *, FILE *);
78.412 +int _fcloseall_r (struct _reent *);
78.413 +FILE * _fdopen_r (struct _reent *, int, const char *);
78.414 +int _fflush_r (struct _reent *, FILE *);
78.415 +int _fgetc_r (struct _reent *, FILE *);
78.416 +int _fgetc_unlocked_r (struct _reent *, FILE *);
78.417 +char * _fgets_r (struct _reent *, char *__restrict, int, FILE *__restrict);
78.418 +char * _fgets_unlocked_r (struct _reent *, char *__restrict, int, FILE *__restrict);
78.419 +#ifdef _COMPILING_NEWLIB
78.420 +int _fgetpos_r (struct _reent *, FILE *__restrict, _fpos_t *__restrict);
78.421 +int _fsetpos_r (struct _reent *, FILE *, const _fpos_t *);
78.422 +#else
78.423 +int _fgetpos_r (struct _reent *, FILE *, fpos_t *);
78.424 +int _fsetpos_r (struct _reent *, FILE *, const fpos_t *);
78.425 +#endif
78.426 +int _fiprintf_r (struct _reent *, FILE *, const char *, ...)
78.427 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.428 +int _fiscanf_r (struct _reent *, FILE *, const char *, ...)
78.429 + _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
78.430 +FILE * _fmemopen_r (struct _reent *, void *__restrict, size_t, const char *__restrict);
78.431 +FILE * _fopen_r (struct _reent *, const char *__restrict, const char *__restrict);
78.432 +FILE * _freopen_r (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict);
78.433 +int _fprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...)
78.434 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.435 +int _fpurge_r (struct _reent *, FILE *);
78.436 +int _fputc_r (struct _reent *, int, FILE *);
78.437 +int _fputc_unlocked_r (struct _reent *, int, FILE *);
78.438 +int _fputs_r (struct _reent *, const char *__restrict, FILE *__restrict);
78.439 +int _fputs_unlocked_r (struct _reent *, const char *__restrict, FILE *__restrict);
78.440 +size_t _fread_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.441 +size_t _fread_unlocked_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.442 +int _fscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...)
78.443 + _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
78.444 +int _fseek_r (struct _reent *, FILE *, long, int);
78.445 +int _fseeko_r (struct _reent *, FILE *, _off_t, int);
78.446 +long _ftell_r (struct _reent *, FILE *);
78.447 +_off_t _ftello_r (struct _reent *, FILE *);
78.448 +void _rewind_r (struct _reent *, FILE *);
78.449 +size_t _fwrite_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.450 +size_t _fwrite_unlocked_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.451 +int _getc_r (struct _reent *, FILE *);
78.452 +int _getc_unlocked_r (struct _reent *, FILE *);
78.453 +int _getchar_r (struct _reent *);
78.454 +int _getchar_unlocked_r (struct _reent *);
78.455 +char * _gets_r (struct _reent *, char *);
78.456 +int _iprintf_r (struct _reent *, const char *, ...)
78.457 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.458 +int _iscanf_r (struct _reent *, const char *, ...)
78.459 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.460 +FILE * _open_memstream_r (struct _reent *, char **, size_t *);
78.461 +void _perror_r (struct _reent *, const char *);
78.462 +int _printf_r (struct _reent *, const char *__restrict, ...)
78.463 + _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
78.464 +int _putc_r (struct _reent *, int, FILE *);
78.465 +int _putc_unlocked_r (struct _reent *, int, FILE *);
78.466 +int _putchar_unlocked_r (struct _reent *, int);
78.467 +int _putchar_r (struct _reent *, int);
78.468 +int _puts_r (struct _reent *, const char *);
78.469 +int _remove_r (struct _reent *, const char *);
78.470 +int _rename_r (struct _reent *,
78.471 + const char *_old, const char *_new);
78.472 +int _scanf_r (struct _reent *, const char *__restrict, ...)
78.473 + _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
78.474 +int _siprintf_r (struct _reent *, char *, const char *, ...)
78.475 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.476 +int _siscanf_r (struct _reent *, const char *, const char *, ...)
78.477 + _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
78.478 +int _sniprintf_r (struct _reent *, char *, size_t, const char *, ...)
78.479 + _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
78.480 +int _snprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
78.481 + _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
78.482 +int _sprintf_r (struct _reent *, char *__restrict, const char *__restrict, ...)
78.483 + _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
78.484 +int _sscanf_r (struct _reent *, const char *__restrict, const char *__restrict, ...)
78.485 + _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
78.486 +char * _tempnam_r (struct _reent *, const char *, const char *);
78.487 +FILE * _tmpfile_r (struct _reent *);
78.488 +char * _tmpnam_r (struct _reent *, char *);
78.489 +int _ungetc_r (struct _reent *, int, FILE *);
78.490 +int _vasiprintf_r (struct _reent *, char **, const char *, __VALIST)
78.491 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.492 +char * _vasniprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST)
78.493 + _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
78.494 +char * _vasnprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST)
78.495 + _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
78.496 +int _vasprintf_r (struct _reent *, char **, const char *, __VALIST)
78.497 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.498 +int _vdiprintf_r (struct _reent *, int, const char *, __VALIST)
78.499 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.500 +int _vdprintf_r (struct _reent *, int, const char *__restrict, __VALIST)
78.501 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.502 +int _vfiprintf_r (struct _reent *, FILE *, const char *, __VALIST)
78.503 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.504 +int _vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
78.505 + _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
78.506 +int _vfprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
78.507 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.508 +int _vfscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
78.509 + _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
78.510 +int _viprintf_r (struct _reent *, const char *, __VALIST)
78.511 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.512 +int _viscanf_r (struct _reent *, const char *, __VALIST)
78.513 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.514 +int _vprintf_r (struct _reent *, const char *__restrict, __VALIST)
78.515 + _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
78.516 +int _vscanf_r (struct _reent *, const char *__restrict, __VALIST)
78.517 + _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
78.518 +int _vsiprintf_r (struct _reent *, char *, const char *, __VALIST)
78.519 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.520 +int _vsiscanf_r (struct _reent *, const char *, const char *, __VALIST)
78.521 + _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
78.522 +int _vsniprintf_r (struct _reent *, char *, size_t, const char *, __VALIST)
78.523 + _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
78.524 +int _vsnprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
78.525 + _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
78.526 +int _vsprintf_r (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
78.527 + _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
78.528 +int _vsscanf_r (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
78.529 + _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
78.530 +
78.531 +/* Other extensions. */
78.532 +
78.533 +int fpurge (FILE *);
78.534 +ssize_t __getdelim (char **, size_t *, int, FILE *);
78.535 +ssize_t __getline (char **, size_t *, FILE *);
78.536 +
78.537 +#if __MISC_VISIBLE
78.538 +void clearerr_unlocked (FILE *);
78.539 +int feof_unlocked (FILE *);
78.540 +int ferror_unlocked (FILE *);
78.541 +int fileno_unlocked (FILE *);
78.542 +int fflush_unlocked (FILE *);
78.543 +int fgetc_unlocked (FILE *);
78.544 +int fputc_unlocked (int, FILE *);
78.545 +size_t fread_unlocked (void *__restrict, size_t _size, size_t _n, FILE *__restrict);
78.546 +size_t fwrite_unlocked (const void *__restrict , size_t _size, size_t _n, FILE *);
78.547 +#endif
78.548 +
78.549 +#if __GNU_VISIBLE
78.550 +char * fgets_unlocked (char *__restrict, int, FILE *__restrict);
78.551 +int fputs_unlocked (const char *__restrict, FILE *__restrict);
78.552 +#endif
78.553 +
78.554 +#ifdef __LARGE64_FILES
78.555 +#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
78.556 +FILE * fdopen64 (int, const char *);
78.557 +FILE * fopen64 (const char *, const char *);
78.558 +FILE * freopen64 (const char *, const char *, FILE *);
78.559 +_off64_t ftello64 (FILE *);
78.560 +_off64_t fseeko64 (FILE *, _off64_t, int);
78.561 +int fgetpos64 (FILE *, _fpos64_t *);
78.562 +int fsetpos64 (FILE *, const _fpos64_t *);
78.563 +FILE * tmpfile64 (void);
78.564 +
78.565 +FILE * _fdopen64_r (struct _reent *, int, const char *);
78.566 +FILE * _fopen64_r (struct _reent *,const char *, const char *);
78.567 +FILE * _freopen64_r (struct _reent *, const char *, const char *, FILE *);
78.568 +_off64_t _ftello64_r (struct _reent *, FILE *);
78.569 +_off64_t _fseeko64_r (struct _reent *, FILE *, _off64_t, int);
78.570 +int _fgetpos64_r (struct _reent *, FILE *, _fpos64_t *);
78.571 +int _fsetpos64_r (struct _reent *, FILE *, const _fpos64_t *);
78.572 +FILE * _tmpfile64_r (struct _reent *);
78.573 +#endif /* !__CYGWIN__ */
78.574 +#endif /* __LARGE64_FILES */
78.575 +
78.576 +/*
78.577 + * Routines internal to the implementation.
78.578 + */
78.579 +
78.580 +int __srget_r (struct _reent *, FILE *);
78.581 +int __swbuf_r (struct _reent *, int, FILE *);
78.582 +
78.583 +/*
78.584 + * Stdio function-access interface.
78.585 + */
78.586 +
78.587 +#if __BSD_VISIBLE
78.588 +# ifdef __LARGE64_FILES
78.589 +FILE *funopen (const void *__cookie,
78.590 + int (*__readfn)(void *__c, char *__buf,
78.591 + _READ_WRITE_BUFSIZE_TYPE __n),
78.592 + int (*__writefn)(void *__c, const char *__buf,
78.593 + _READ_WRITE_BUFSIZE_TYPE __n),
78.594 + _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence),
78.595 + int (*__closefn)(void *__c));
78.596 +FILE *_funopen_r (struct _reent *, const void *__cookie,
78.597 + int (*__readfn)(void *__c, char *__buf,
78.598 + _READ_WRITE_BUFSIZE_TYPE __n),
78.599 + int (*__writefn)(void *__c, const char *__buf,
78.600 + _READ_WRITE_BUFSIZE_TYPE __n),
78.601 + _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence),
78.602 + int (*__closefn)(void *__c));
78.603 +# else
78.604 +FILE *funopen (const void *__cookie,
78.605 + int (*__readfn)(void *__cookie, char *__buf,
78.606 + _READ_WRITE_BUFSIZE_TYPE __n),
78.607 + int (*__writefn)(void *__cookie, const char *__buf,
78.608 + _READ_WRITE_BUFSIZE_TYPE __n),
78.609 + fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence),
78.610 + int (*__closefn)(void *__cookie));
78.611 +FILE *_funopen_r (struct _reent *, const void *__cookie,
78.612 + int (*__readfn)(void *__cookie, char *__buf,
78.613 + _READ_WRITE_BUFSIZE_TYPE __n),
78.614 + int (*__writefn)(void *__cookie, const char *__buf,
78.615 + _READ_WRITE_BUFSIZE_TYPE __n),
78.616 + fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence),
78.617 + int (*__closefn)(void *__cookie));
78.618 +# endif /* !__LARGE64_FILES */
78.619 +
78.620 +# define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
78.621 + (fpos_t (*)())0, (int (*)())0)
78.622 +# define fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0, __fn, \
78.623 + (fpos_t (*)())0, (int (*)())0)
78.624 +#endif /* __BSD_VISIBLE */
78.625 +
78.626 +#if __GNU_VISIBLE
78.627 +typedef ssize_t cookie_read_function_t(void *__cookie, char *__buf, size_t __n);
78.628 +typedef ssize_t cookie_write_function_t(void *__cookie, const char *__buf,
78.629 + size_t __n);
78.630 +# ifdef __LARGE64_FILES
78.631 +typedef int cookie_seek_function_t(void *__cookie, _off64_t *__off,
78.632 + int __whence);
78.633 +# else
78.634 +typedef int cookie_seek_function_t(void *__cookie, off_t *__off, int __whence);
78.635 +# endif /* !__LARGE64_FILES */
78.636 +typedef int cookie_close_function_t(void *__cookie);
78.637 +typedef struct
78.638 +{
78.639 + /* These four struct member names are dictated by Linux; hopefully,
78.640 + they don't conflict with any macros. */
78.641 + cookie_read_function_t *read;
78.642 + cookie_write_function_t *write;
78.643 + cookie_seek_function_t *seek;
78.644 + cookie_close_function_t *close;
78.645 +} cookie_io_functions_t;
78.646 +FILE *fopencookie (void *__cookie,
78.647 + const char *__mode, cookie_io_functions_t __functions);
78.648 +FILE *_fopencookie_r (struct _reent *, void *__cookie,
78.649 + const char *__mode, cookie_io_functions_t __functions);
78.650 +#endif /* __GNU_VISIBLE */
78.651 +
78.652 +#ifndef __CUSTOM_FILE_IO__
78.653 +/*
78.654 + * The __sfoo macros are here so that we can
78.655 + * define function versions in the C library.
78.656 + */
78.657 +#define __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++))
78.658 +
78.659 +#ifdef __SCLE
78.660 +/* For a platform with CR/LF, additional logic is required by
78.661 + __sgetc_r which would otherwise simply be a macro; therefore we
78.662 + use an inlined function. The function is only meant to be inlined
78.663 + in place as used and the function body should never be emitted.
78.664 +
78.665 + There are two possible means to this end when compiling with GCC,
78.666 + one when compiling with a standard C99 compiler, and for other
78.667 + compilers we're just stuck. At the moment, this issue only
78.668 + affects the Cygwin target, so we'll most likely be using GCC. */
78.669 +
78.670 +_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
78.671 +
78.672 +_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
78.673 + {
78.674 + int __c = __sgetc_raw_r(__ptr, __p);
78.675 + if ((__p->_flags & __SCLE) && (__c == '\r'))
78.676 + {
78.677 + int __c2 = __sgetc_raw_r(__ptr, __p);
78.678 + if (__c2 == '\n')
78.679 + __c = __c2;
78.680 + else
78.681 + ungetc(__c2, __p);
78.682 + }
78.683 + return __c;
78.684 + }
78.685 +#else
78.686 +#define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p)
78.687 +#endif
78.688 +
78.689 +#ifdef __GNUC__
78.690 +_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
78.691 +#ifdef __SCLE
78.692 + if ((_p->_flags & __SCLE) && _c == '\n')
78.693 + __sputc_r (_ptr, '\r', _p);
78.694 +#endif
78.695 + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
78.696 + return (*_p->_p++ = _c);
78.697 + else
78.698 + return (__swbuf_r(_ptr, _c, _p));
78.699 +}
78.700 +#else
78.701 +/*
78.702 + * This has been tuned to generate reasonable code on the vax using pcc
78.703 + */
78.704 +#define __sputc_raw_r(__ptr, __c, __p) \
78.705 + (--(__p)->_w < 0 ? \
78.706 + (__p)->_w >= (__p)->_lbfsize ? \
78.707 + (*(__p)->_p = (__c)), *(__p)->_p != '\n' ? \
78.708 + (int)*(__p)->_p++ : \
78.709 + __swbuf_r(__ptr, '\n', __p) : \
78.710 + __swbuf_r(__ptr, (int)(__c), __p) : \
78.711 + (*(__p)->_p = (__c), (int)*(__p)->_p++))
78.712 +#ifdef __SCLE
78.713 +#define __sputc_r(__ptr, __c, __p) \
78.714 + ((((__p)->_flags & __SCLE) && ((__c) == '\n')) \
78.715 + ? __sputc_raw_r(__ptr, '\r', (__p)) : 0 , \
78.716 + __sputc_raw_r((__ptr), (__c), (__p)))
78.717 +#else
78.718 +#define __sputc_r(__ptr, __c, __p) __sputc_raw_r(__ptr, __c, __p)
78.719 +#endif
78.720 +#endif
78.721 +
78.722 +#define __sfeof(p) ((int)(((p)->_flags & __SEOF) != 0))
78.723 +#define __sferror(p) ((int)(((p)->_flags & __SERR) != 0))
78.724 +#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
78.725 +#define __sfileno(p) ((p)->_file)
78.726 +
78.727 +#ifndef __cplusplus
78.728 +#ifndef _REENT_SMALL
78.729 +#define feof(p) __sfeof(p)
78.730 +#define ferror(p) __sferror(p)
78.731 +#define clearerr(p) __sclearerr(p)
78.732 +
78.733 +#if __MISC_VISIBLE
78.734 +#define feof_unlocked(p) __sfeof(p)
78.735 +#define ferror_unlocked(p) __sferror(p)
78.736 +#define clearerr_unlocked(p) __sclearerr(p)
78.737 +#endif /* __MISC_VISIBLE */
78.738 +#endif /* _REENT_SMALL */
78.739 +
78.740 +#if 0 /* __POSIX_VISIBLE - FIXME: must initialize stdio first, use fn */
78.741 +#define fileno(p) __sfileno(p)
78.742 +#endif
78.743 +
78.744 +static __inline int
78.745 +_getchar_unlocked(void)
78.746 +{
78.747 + struct _reent *_ptr;
78.748 +
78.749 + _ptr = _REENT;
78.750 + return (__sgetc_r(_ptr, _stdin_r(_ptr)));
78.751 +}
78.752 +
78.753 +static __inline int
78.754 +_putchar_unlocked(int _c)
78.755 +{
78.756 + struct _reent *_ptr;
78.757 +
78.758 + _ptr = _REENT;
78.759 + return (__sputc_r(_ptr, _c, _stdout_r(_ptr)));
78.760 +}
78.761 +
78.762 +#ifdef __SINGLE_THREAD__
78.763 +#define getc(_p) __sgetc_r(_REENT, _p)
78.764 +#define putc(_c, _p) __sputc_r(_REENT, _c, _p)
78.765 +#define getchar() _getchar_unlocked()
78.766 +#define putchar(_c) _putchar_unlocked(_c)
78.767 +#endif /* __SINGLE_THREAD__ */
78.768 +
78.769 +#if __MISC_VISIBLE || __POSIX_VISIBLE
78.770 +#define getchar_unlocked() _getchar_unlocked()
78.771 +#define putchar_unlocked(_c) _putchar_unlocked(_c)
78.772 +#endif
78.773 +#endif /* __cplusplus */
78.774 +
78.775 +#if __MISC_VISIBLE
78.776 +/* fast always-buffered version, true iff error */
78.777 +#define fast_putc(x,p) (--(p)->_w < 0 ? \
78.778 + __swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
78.779 +#endif
78.780 +
78.781 +#if __GNU_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)
78.782 +#define L_cuserid 9 /* posix says it goes in stdio.h :( */
78.783 +#endif
78.784 +#if __POSIX_VISIBLE
78.785 +#define L_ctermid 16
78.786 +#endif
78.787 +
78.788 +#else /* __CUSTOM_FILE_IO__ */
78.789 +
78.790 +#define getchar() getc(stdin)
78.791 +#define putchar(x) putc(x, stdout)
78.792 +
78.793 +#if __MISC_VISIBLE || __POSIX_VISIBLE
78.794 +#define getchar_unlocked() getc_unlocked(stdin)
78.795 +#define putchar_unlocked(x) putc_unlocked(x, stdout)
78.796 +#endif
78.797 +
78.798 +#endif /* !__CUSTOM_FILE_IO__ */
78.799 +
78.800 +_END_STD_C
78.801 +
78.802 +#if __SSP_FORTIFY_LEVEL > 0
78.803 +#include <ssp/stdio.h>
78.804 +#endif
78.805 +
78.806 +#endif /* _STDIO_H_ */
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/include/stdio_ext.h Mon Oct 21 16:11:07 2019 +0200
79.3 @@ -0,0 +1,79 @@
79.4 +/*
79.5 + * stdio_ext.h
79.6 + *
79.7 + * Definitions for I/O internal operations, originally from Solaris.
79.8 + */
79.9 +
79.10 +#ifndef _STDIO_EXT_H_
79.11 +#define _STDIO_EXT_H_
79.12 +
79.13 +#ifdef __rtems__
79.14 +#error "<stdio_ext.h> not supported"
79.15 +#endif
79.16 +
79.17 +#include <stdio.h>
79.18 +
79.19 +#define FSETLOCKING_QUERY 0
79.20 +#define FSETLOCKING_INTERNAL 1
79.21 +#define FSETLOCKING_BYCALLER 2
79.22 +
79.23 +_BEGIN_STD_C
79.24 +
79.25 +void __fpurge (FILE *);
79.26 +int __fsetlocking (FILE *, int);
79.27 +
79.28 +/* TODO:
79.29 +
79.30 + void _flushlbf (void);
79.31 +*/
79.32 +
79.33 +#ifdef __GNUC__
79.34 +
79.35 +_ELIDABLE_INLINE size_t
79.36 +__fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
79.37 +
79.38 +_ELIDABLE_INLINE int
79.39 +__freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
79.40 +
79.41 +_ELIDABLE_INLINE int
79.42 +__fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
79.43 +
79.44 +_ELIDABLE_INLINE int
79.45 +__freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
79.46 +
79.47 +_ELIDABLE_INLINE int
79.48 +__fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
79.49 +
79.50 +_ELIDABLE_INLINE int
79.51 +__flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
79.52 +
79.53 +_ELIDABLE_INLINE size_t
79.54 +__fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
79.55 +
79.56 +#else
79.57 +
79.58 +size_t __fbufsize (FILE *);
79.59 +int __freading (FILE *);
79.60 +int __fwriting (FILE *);
79.61 +int __freadable (FILE *);
79.62 +int __fwritable (FILE *);
79.63 +int __flbf (FILE *);
79.64 +size_t __fpending (FILE *);
79.65 +
79.66 +#ifndef __cplusplus
79.67 +
79.68 +#define __fbufsize(__fp) ((size_t) (__fp)->_bf._size)
79.69 +#define __freading(__fp) (((__fp)->_flags & __SRD) != 0)
79.70 +#define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0)
79.71 +#define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0)
79.72 +#define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
79.73 +#define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
79.74 +#define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
79.75 +
79.76 +#endif /* __cplusplus */
79.77 +
79.78 +#endif /* __GNUC__ */
79.79 +
79.80 +_END_STD_C
79.81 +
79.82 +#endif /* _STDIO_EXT_H_ */
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/include/stdlib.h Mon Oct 21 16:11:07 2019 +0200
80.3 @@ -0,0 +1,345 @@
80.4 +/*
80.5 + * stdlib.h
80.6 + *
80.7 + * Definitions for common types, variables, and functions.
80.8 + */
80.9 +
80.10 +#ifndef _STDLIB_H_
80.11 +#define _STDLIB_H_
80.12 +
80.13 +#include <machine/ieeefp.h>
80.14 +#include "_ansi.h"
80.15 +
80.16 +#define __need_size_t
80.17 +#define __need_wchar_t
80.18 +#define __need_NULL
80.19 +#include <stddef.h>
80.20 +
80.21 +#include <sys/reent.h>
80.22 +#include <sys/cdefs.h>
80.23 +#include <machine/stdlib.h>
80.24 +#ifndef __STRICT_ANSI__
80.25 +#include <alloca.h>
80.26 +#endif
80.27 +
80.28 +#ifdef __CYGWIN__
80.29 +#include <cygwin/stdlib.h>
80.30 +#endif
80.31 +
80.32 +#if __GNU_VISIBLE
80.33 +#include <sys/_locale.h>
80.34 +#endif
80.35 +
80.36 +_BEGIN_STD_C
80.37 +
80.38 +typedef struct
80.39 +{
80.40 + int quot; /* quotient */
80.41 + int rem; /* remainder */
80.42 +} div_t;
80.43 +
80.44 +typedef struct
80.45 +{
80.46 + long quot; /* quotient */
80.47 + long rem; /* remainder */
80.48 +} ldiv_t;
80.49 +
80.50 +#if __ISO_C_VISIBLE >= 1999
80.51 +typedef struct
80.52 +{
80.53 + long long int quot; /* quotient */
80.54 + long long int rem; /* remainder */
80.55 +} lldiv_t;
80.56 +#endif
80.57 +
80.58 +#ifndef __compar_fn_t_defined
80.59 +#define __compar_fn_t_defined
80.60 +typedef int (*__compar_fn_t) (const void *, const void *);
80.61 +#endif
80.62 +
80.63 +#define EXIT_FAILURE 1
80.64 +#define EXIT_SUCCESS 0
80.65 +
80.66 +#define RAND_MAX __RAND_MAX
80.67 +
80.68 +int __locale_mb_cur_max (void);
80.69 +
80.70 +#define MB_CUR_MAX __locale_mb_cur_max()
80.71 +
80.72 +void abort (void) _ATTRIBUTE ((__noreturn__));
80.73 +int abs (int);
80.74 +#if __BSD_VISIBLE
80.75 +__uint32_t arc4random (void);
80.76 +__uint32_t arc4random_uniform (__uint32_t);
80.77 +void arc4random_buf (void *, size_t);
80.78 +#endif
80.79 +int atexit (void (*__func)(void));
80.80 +double atof (const char *__nptr);
80.81 +#if __MISC_VISIBLE
80.82 +float atoff (const char *__nptr);
80.83 +#endif
80.84 +int atoi (const char *__nptr);
80.85 +int _atoi_r (struct _reent *, const char *__nptr);
80.86 +long atol (const char *__nptr);
80.87 +long _atol_r (struct _reent *, const char *__nptr);
80.88 +void * bsearch (const void *__key,
80.89 + const void *__base,
80.90 + size_t __nmemb,
80.91 + size_t __size,
80.92 + __compar_fn_t _compar);
80.93 +void *calloc(size_t, size_t) __malloc_like __result_use_check
80.94 + __alloc_size2(1, 2) _NOTHROW;
80.95 +div_t div (int __numer, int __denom);
80.96 +void exit (int __status) _ATTRIBUTE ((__noreturn__));
80.97 +void free (void *) _NOTHROW;
80.98 +char * getenv (const char *__string);
80.99 +char * _getenv_r (struct _reent *, const char *__string);
80.100 +#if __GNU_VISIBLE
80.101 +char * secure_getenv (const char *__string);
80.102 +#endif
80.103 +char * _findenv (const char *, int *);
80.104 +char * _findenv_r (struct _reent *, const char *, int *);
80.105 +#if __POSIX_VISIBLE >= 200809
80.106 +extern char *suboptarg; /* getsubopt(3) external variable */
80.107 +int getsubopt (char **, char * const *, char **);
80.108 +#endif
80.109 +long labs (long);
80.110 +ldiv_t ldiv (long __numer, long __denom);
80.111 +void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1) _NOTHROW;
80.112 +int mblen (const char *, size_t);
80.113 +int _mblen_r (struct _reent *, const char *, size_t, _mbstate_t *);
80.114 +int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
80.115 +int _mbtowc_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
80.116 +int wctomb (char *, wchar_t);
80.117 +int _wctomb_r (struct _reent *, char *, wchar_t, _mbstate_t *);
80.118 +size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
80.119 +size_t _mbstowcs_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
80.120 +size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
80.121 +size_t _wcstombs_r (struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *);
80.122 +#ifndef _REENT_ONLY
80.123 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
80.124 +char * mkdtemp (char *);
80.125 +#endif
80.126 +#if __GNU_VISIBLE
80.127 +int mkostemp (char *, int);
80.128 +int mkostemps (char *, int, int);
80.129 +#endif
80.130 +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
80.131 +int mkstemp (char *);
80.132 +#endif
80.133 +#if __MISC_VISIBLE
80.134 +int mkstemps (char *, int);
80.135 +#endif
80.136 +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
80.137 +char * mktemp (char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
80.138 +#endif
80.139 +#endif /* !_REENT_ONLY */
80.140 +char * _mkdtemp_r (struct _reent *, char *);
80.141 +int _mkostemp_r (struct _reent *, char *, int);
80.142 +int _mkostemps_r (struct _reent *, char *, int, int);
80.143 +int _mkstemp_r (struct _reent *, char *);
80.144 +int _mkstemps_r (struct _reent *, char *, int);
80.145 +char * _mktemp_r (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
80.146 +void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
80.147 +int rand (void);
80.148 +void *realloc(void *, size_t) __result_use_check __alloc_size(2) _NOTHROW;
80.149 +#if __BSD_VISIBLE
80.150 +void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size2(2, 3);
80.151 +void *reallocf(void *, size_t) __result_use_check __alloc_size(2);
80.152 +#endif
80.153 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
80.154 +char * realpath (const char *__restrict path, char *__restrict resolved_path);
80.155 +#endif
80.156 +#if __BSD_VISIBLE
80.157 +int rpmatch (const char *response);
80.158 +#endif
80.159 +#if __XSI_VISIBLE
80.160 +void setkey (const char *__key);
80.161 +#endif
80.162 +void srand (unsigned __seed);
80.163 +double strtod (const char *__restrict __n, char **__restrict __end_PTR);
80.164 +double _strtod_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR);
80.165 +#if __ISO_C_VISIBLE >= 1999
80.166 +float strtof (const char *__restrict __n, char **__restrict __end_PTR);
80.167 +#endif
80.168 +#if __MISC_VISIBLE
80.169 +/* the following strtodf interface is deprecated...use strtof instead */
80.170 +# ifndef strtodf
80.171 +# define strtodf strtof
80.172 +# endif
80.173 +#endif
80.174 +long strtol (const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.175 +long _strtol_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.176 +unsigned long strtoul (const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.177 +unsigned long _strtoul_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.178 +
80.179 +#if __GNU_VISIBLE
80.180 +double strtod_l (const char *__restrict, char **__restrict, locale_t);
80.181 +float strtof_l (const char *__restrict, char **__restrict, locale_t);
80.182 +#ifdef _HAVE_LONG_DOUBLE
80.183 +extern long double strtold_l (const char *__restrict, char **__restrict,
80.184 + locale_t);
80.185 +#endif /* _HAVE_LONG_DOUBLE */
80.186 +long strtol_l (const char *__restrict, char **__restrict, int, locale_t);
80.187 +unsigned long strtoul_l (const char *__restrict, char **__restrict, int,
80.188 + locale_t __loc);
80.189 +long long strtoll_l (const char *__restrict, char **__restrict, int, locale_t);
80.190 +unsigned long long strtoull_l (const char *__restrict, char **__restrict, int,
80.191 + locale_t __loc);
80.192 +#endif
80.193 +
80.194 +int system (const char *__string);
80.195 +
80.196 +#if __SVID_VISIBLE || __XSI_VISIBLE >= 4
80.197 +long a64l (const char *__input);
80.198 +char * l64a (long __input);
80.199 +char * _l64a_r (struct _reent *,long __input);
80.200 +#endif
80.201 +#if __MISC_VISIBLE
80.202 +int on_exit (void (*__func)(int, void *),void *__arg);
80.203 +#endif
80.204 +#if __ISO_C_VISIBLE >= 1999
80.205 +void _Exit (int __status) _ATTRIBUTE ((__noreturn__));
80.206 +#endif
80.207 +#if __SVID_VISIBLE || __XSI_VISIBLE
80.208 +int putenv (char *__string);
80.209 +#endif
80.210 +int _putenv_r (struct _reent *, char *__string);
80.211 +void * _reallocf_r (struct _reent *, void *, size_t);
80.212 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
80.213 +int setenv (const char *__string, const char *__value, int __overwrite);
80.214 +#endif
80.215 +int _setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite);
80.216 +
80.217 +#if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112
80.218 +char * gcvt (double,int,char *);
80.219 +char * gcvtf (float,int,char *);
80.220 +char * fcvt (double,int,int *,int *);
80.221 +char * fcvtf (float,int,int *,int *);
80.222 +char * ecvt (double,int,int *,int *);
80.223 +char * ecvtbuf (double, int, int*, int*, char *);
80.224 +char * fcvtbuf (double, int, int*, int*, char *);
80.225 +char * ecvtf (float,int,int *,int *);
80.226 +#endif
80.227 +char * __itoa (int, char *, int);
80.228 +char * __utoa (unsigned, char *, int);
80.229 +#if __MISC_VISIBLE
80.230 +char * itoa (int, char *, int);
80.231 +char * utoa (unsigned, char *, int);
80.232 +#endif
80.233 +#if __POSIX_VISIBLE
80.234 +int rand_r (unsigned *__seed);
80.235 +#endif
80.236 +
80.237 +#if __SVID_VISIBLE || __XSI_VISIBLE
80.238 +double drand48 (void);
80.239 +double _drand48_r (struct _reent *);
80.240 +double erand48 (unsigned short [3]);
80.241 +double _erand48_r (struct _reent *, unsigned short [3]);
80.242 +long jrand48 (unsigned short [3]);
80.243 +long _jrand48_r (struct _reent *, unsigned short [3]);
80.244 +void lcong48 (unsigned short [7]);
80.245 +void _lcong48_r (struct _reent *, unsigned short [7]);
80.246 +long lrand48 (void);
80.247 +long _lrand48_r (struct _reent *);
80.248 +long mrand48 (void);
80.249 +long _mrand48_r (struct _reent *);
80.250 +long nrand48 (unsigned short [3]);
80.251 +long _nrand48_r (struct _reent *, unsigned short [3]);
80.252 +unsigned short *
80.253 + seed48 (unsigned short [3]);
80.254 +unsigned short *
80.255 + _seed48_r (struct _reent *, unsigned short [3]);
80.256 +void srand48 (long);
80.257 +void _srand48_r (struct _reent *, long);
80.258 +#endif /* __SVID_VISIBLE || __XSI_VISIBLE */
80.259 +#if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
80.260 +char * initstate (unsigned, char *, size_t);
80.261 +long random (void);
80.262 +char * setstate (char *);
80.263 +void srandom (unsigned);
80.264 +#endif
80.265 +#if __ISO_C_VISIBLE >= 1999
80.266 +long long atoll (const char *__nptr);
80.267 +#endif
80.268 +long long _atoll_r (struct _reent *, const char *__nptr);
80.269 +#if __ISO_C_VISIBLE >= 1999
80.270 +long long llabs (long long);
80.271 +lldiv_t lldiv (long long __numer, long long __denom);
80.272 +long long strtoll (const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.273 +#endif
80.274 +long long _strtoll_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.275 +#if __ISO_C_VISIBLE >= 1999
80.276 +unsigned long long strtoull (const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.277 +#endif
80.278 +unsigned long long _strtoull_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
80.279 +
80.280 +#ifndef __CYGWIN__
80.281 +#if __MISC_VISIBLE
80.282 +void cfree (void *);
80.283 +#endif
80.284 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
80.285 +int unsetenv (const char *__string);
80.286 +#endif
80.287 +int _unsetenv_r (struct _reent *, const char *__string);
80.288 +#endif /* !__CYGWIN__ */
80.289 +
80.290 +#if __POSIX_VISIBLE >= 200112
80.291 +int posix_memalign (void **, size_t, size_t) __nonnull((1))
80.292 + __result_use_check;
80.293 +#endif
80.294 +
80.295 +char * _dtoa_r (struct _reent *, double, int, int, int *, int*, char**);
80.296 +#ifndef __CYGWIN__
80.297 +void * _malloc_r (struct _reent *, size_t) _NOTHROW;
80.298 +void * _calloc_r (struct _reent *, size_t, size_t) _NOTHROW;
80.299 +void _free_r (struct _reent *, void *) _NOTHROW;
80.300 +void * _realloc_r (struct _reent *, void *, size_t) _NOTHROW;
80.301 +void _mstats_r (struct _reent *, char *);
80.302 +#endif
80.303 +int _system_r (struct _reent *, const char *);
80.304 +
80.305 +void __eprintf (const char *, const char *, unsigned int, const char *);
80.306 +
80.307 +/* There are two common qsort_r variants. If you request
80.308 + _BSD_SOURCE, you get the BSD version; otherwise you get the GNU
80.309 + version. We want that #undef qsort_r will still let you
80.310 + invoke the underlying function, but that requires gcc support. */
80.311 +#if __GNU_VISIBLE
80.312 +void qsort_r (void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk);
80.313 +#elif __BSD_VISIBLE
80.314 +# ifdef __GNUC__
80.315 +void qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))
80.316 + __asm__ (__ASMNAME ("__bsd_qsort_r"));
80.317 +# else
80.318 +void __bsd_qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *));
80.319 +# define qsort_r __bsd_qsort_r
80.320 +# endif
80.321 +#endif
80.322 +
80.323 +/* On platforms where long double equals double. */
80.324 +#ifdef _HAVE_LONG_DOUBLE
80.325 +extern long double _strtold_r (struct _reent *, const char *__restrict, char **__restrict);
80.326 +#if __ISO_C_VISIBLE >= 1999
80.327 +extern long double strtold (const char *__restrict, char **__restrict);
80.328 +#endif
80.329 +#endif /* _HAVE_LONG_DOUBLE */
80.330 +
80.331 +/*
80.332 + * If we're in a mode greater than C99, expose C11 functions.
80.333 + */
80.334 +#if __ISO_C_VISIBLE >= 2011
80.335 +void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
80.336 + __alloc_size(2) __result_use_check;
80.337 +int at_quick_exit(void (*)(void));
80.338 +_Noreturn void
80.339 + quick_exit(int);
80.340 +#endif /* __ISO_C_VISIBLE >= 2011 */
80.341 +
80.342 +_END_STD_C
80.343 +
80.344 +#if __SSP_FORTIFY_LEVEL > 0
80.345 +#include <ssp/stdlib.h>
80.346 +#endif
80.347 +
80.348 +#endif /* _STDLIB_H_ */
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/include/string.h Mon Oct 21 16:11:07 2019 +0200
81.3 @@ -0,0 +1,183 @@
81.4 +/*
81.5 + * string.h
81.6 + *
81.7 + * Definitions for memory and string functions.
81.8 + */
81.9 +
81.10 +#ifndef _STRING_H_
81.11 +#define _STRING_H_
81.12 +
81.13 +#include "_ansi.h"
81.14 +#include <sys/reent.h>
81.15 +#include <sys/cdefs.h>
81.16 +#include <sys/features.h>
81.17 +
81.18 +#define __need_size_t
81.19 +#define __need_NULL
81.20 +#include <stddef.h>
81.21 +
81.22 +#if __POSIX_VISIBLE >= 200809
81.23 +#include <sys/_locale.h>
81.24 +#endif
81.25 +
81.26 +#if __BSD_VISIBLE
81.27 +#include <strings.h>
81.28 +#endif
81.29 +
81.30 +_BEGIN_STD_C
81.31 +
81.32 +void * memchr (const void *, int, size_t);
81.33 +int memcmp (const void *, const void *, size_t);
81.34 +void * memcpy (void *__restrict, const void *__restrict, size_t);
81.35 +void * memmove (void *, const void *, size_t);
81.36 +void * memset (void *, int, size_t);
81.37 +char *strcat (char *__restrict, const char *__restrict);
81.38 +char *strchr (const char *, int);
81.39 +int strcmp (const char *, const char *);
81.40 +int strcoll (const char *, const char *);
81.41 +char *strcpy (char *__restrict, const char *__restrict);
81.42 +size_t strcspn (const char *, const char *);
81.43 +char *strerror (int);
81.44 +size_t strlen (const char *);
81.45 +char *strncat (char *__restrict, const char *__restrict, size_t);
81.46 +int strncmp (const char *, const char *, size_t);
81.47 +char *strncpy (char *__restrict, const char *__restrict, size_t);
81.48 +char *strpbrk (const char *, const char *);
81.49 +char *strrchr (const char *, int);
81.50 +size_t strspn (const char *, const char *);
81.51 +char *strstr (const char *, const char *);
81.52 +#ifndef _REENT_ONLY
81.53 +char *strtok (char *__restrict, const char *__restrict);
81.54 +#endif
81.55 +size_t strxfrm (char *__restrict, const char *__restrict, size_t);
81.56 +
81.57 +#if __POSIX_VISIBLE >= 200809
81.58 +int strcoll_l (const char *, const char *, locale_t);
81.59 +char *strerror_l (int, locale_t);
81.60 +size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
81.61 +#endif
81.62 +#if __MISC_VISIBLE || __POSIX_VISIBLE
81.63 +char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
81.64 +#endif
81.65 +#if __BSD_VISIBLE
81.66 +int timingsafe_bcmp (const void *, const void *, size_t);
81.67 +int timingsafe_memcmp (const void *, const void *, size_t);
81.68 +#endif
81.69 +#if __MISC_VISIBLE || __POSIX_VISIBLE
81.70 +void * memccpy (void *__restrict, const void *__restrict, int, size_t);
81.71 +#endif
81.72 +#if __GNU_VISIBLE
81.73 +void * mempcpy (void *, const void *, size_t);
81.74 +void * memmem (const void *, size_t, const void *, size_t);
81.75 +void * memrchr (const void *, int, size_t);
81.76 +void * rawmemchr (const void *, int);
81.77 +#endif
81.78 +#if __POSIX_VISIBLE >= 200809
81.79 +char *stpcpy (char *__restrict, const char *__restrict);
81.80 +char *stpncpy (char *__restrict, const char *__restrict, size_t);
81.81 +#endif
81.82 +#if __GNU_VISIBLE
81.83 +char *strcasestr (const char *, const char *);
81.84 +char *strchrnul (const char *, int);
81.85 +#endif
81.86 +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
81.87 +char *strdup (const char *) __malloc_like __result_use_check;
81.88 +#endif
81.89 +char *_strdup_r (struct _reent *, const char *);
81.90 +#if __POSIX_VISIBLE >= 200809
81.91 +char *strndup (const char *, size_t) __malloc_like __result_use_check;
81.92 +#endif
81.93 +char *_strndup_r (struct _reent *, const char *, size_t);
81.94 +
81.95 +/* There are two common strerror_r variants. If you request
81.96 + _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
81.97 + version. POSIX requires that #undef strerror_r will still let you
81.98 + invoke the underlying function, but that requires gcc support. */
81.99 +#if __GNU_VISIBLE
81.100 +char *strerror_r (int, char *, size_t);
81.101 +#elif __POSIX_VISIBLE >= 200112
81.102 +# ifdef __GNUC__
81.103 +int strerror_r (int, char *, size_t)
81.104 +#ifdef __ASMNAME
81.105 + __asm__ (__ASMNAME ("__xpg_strerror_r"))
81.106 +#endif
81.107 + ;
81.108 +# else
81.109 +int __xpg_strerror_r (int, char *, size_t);
81.110 +# define strerror_r __xpg_strerror_r
81.111 +# endif
81.112 +#endif
81.113 +
81.114 +/* Reentrant version of strerror. */
81.115 +char * _strerror_r (struct _reent *, int, int, int *);
81.116 +
81.117 +#if __BSD_VISIBLE
81.118 +size_t strlcat (char *, const char *, size_t);
81.119 +size_t strlcpy (char *, const char *, size_t);
81.120 +#endif
81.121 +#if __POSIX_VISIBLE >= 200809
81.122 +size_t strnlen (const char *, size_t);
81.123 +#endif
81.124 +#if __BSD_VISIBLE
81.125 +char *strsep (char **, const char *);
81.126 +#endif
81.127 +#if __BSD_VISIBLE
81.128 +char *strnstr(const char *, const char *, size_t) __pure;
81.129 +#endif
81.130 +
81.131 +#if __MISC_VISIBLE
81.132 +char *strlwr (char *);
81.133 +char *strupr (char *);
81.134 +#endif
81.135 +
81.136 +#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
81.137 +char *strsignal (int __signo);
81.138 +#endif
81.139 +
81.140 +#ifdef __CYGWIN__
81.141 +int strtosigno (const char *__name);
81.142 +#endif
81.143 +
81.144 +#if __GNU_VISIBLE
81.145 +int strverscmp (const char *, const char *);
81.146 +#endif
81.147 +
81.148 +#if __GNU_VISIBLE && defined(__GNUC__)
81.149 +#define strdupa(__s) \
81.150 + (__extension__ ({const char *__sin = (__s); \
81.151 + size_t __len = strlen (__sin) + 1; \
81.152 + char * __sout = (char *) __builtin_alloca (__len); \
81.153 + (char *) memcpy (__sout, __sin, __len);}))
81.154 +#define strndupa(__s, __n) \
81.155 + (__extension__ ({const char *__sin = (__s); \
81.156 + size_t __len = strnlen (__sin, (__n)) + 1; \
81.157 + char *__sout = (char *) __builtin_alloca (__len); \
81.158 + __sout[__len-1] = '\0'; \
81.159 + (char *) memcpy (__sout, __sin, __len-1);}))
81.160 +#endif /* __GNU_VISIBLE && __GNUC__ */
81.161 +
81.162 +/* There are two common basename variants. If you do NOT #include <libgen.h>
81.163 + and you do
81.164 +
81.165 + #define _GNU_SOURCE
81.166 + #include <string.h>
81.167 +
81.168 + you get the GNU version. Otherwise you get the POSIX versionfor which you
81.169 + should #include <libgen.h>i for the function prototype. POSIX requires that
81.170 + #undef basename will still let you invoke the underlying function. However,
81.171 + this also implies that the POSIX version is used in this case. That's made
81.172 + sure here. */
81.173 +#if __GNU_VISIBLE && !defined(basename)
81.174 +# define basename basename
81.175 +char *__nonnull ((1)) basename (const char *) __asm__(__ASMNAME("__gnu_basename"));
81.176 +#endif
81.177 +
81.178 +#include <sys/string.h>
81.179 +
81.180 +_END_STD_C
81.181 +
81.182 +#if __SSP_FORTIFY_LEVEL > 0
81.183 +#include <ssp/string.h>
81.184 +#endif
81.185 +
81.186 +#endif /* _STRING_H_ */
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/include/strings.h Mon Oct 21 16:11:07 2019 +0200
82.3 @@ -0,0 +1,80 @@
82.4 +/*-
82.5 + * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
82.6 + * All rights reserved.
82.7 + *
82.8 + * Redistribution and use in source and binary forms, with or without
82.9 + * modification, are permitted provided that the following conditions
82.10 + * are met:
82.11 + * 1. Redistributions of source code must retain the above copyright
82.12 + * notice, this list of conditions and the following disclaimer.
82.13 + * 2. Redistributions in binary form must reproduce the above copyright
82.14 + * notice, this list of conditions and the following disclaimer in the
82.15 + * documentation and/or other materials provided with the distribution.
82.16 + *
82.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
82.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
82.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
82.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
82.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
82.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
82.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
82.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
82.27 + * SUCH DAMAGE.
82.28 + *
82.29 + * $FreeBSD: head/include/strings.h 272673 2014-10-07 04:54:11Z delphij $
82.30 + */
82.31 +
82.32 +#ifndef _STRINGS_H_
82.33 +#define _STRINGS_H_
82.34 +
82.35 +#include <sys/cdefs.h>
82.36 +#include <sys/_types.h>
82.37 +
82.38 +#if __POSIX_VISIBLE >= 200809
82.39 +#include <sys/_locale.h>
82.40 +#endif
82.41 +
82.42 +#ifndef _SIZE_T_DECLARED
82.43 +typedef __size_t size_t;
82.44 +#define _SIZE_T_DECLARED
82.45 +#endif
82.46 +
82.47 +__BEGIN_DECLS
82.48 +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
82.49 +int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */
82.50 +void bcopy(const void *, void *, size_t); /* LEGACY */
82.51 +void bzero(void *, size_t); /* LEGACY */
82.52 +#endif
82.53 +#if __BSD_VISIBLE
82.54 +void explicit_bzero(void *, size_t);
82.55 +#endif
82.56 +#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
82.57 +int ffs(int) __pure2;
82.58 +#endif
82.59 +#if __BSD_VISIBLE
82.60 +int ffsl(long) __pure2;
82.61 +int ffsll(long long) __pure2;
82.62 +int fls(int) __pure2;
82.63 +int flsl(long) __pure2;
82.64 +int flsll(long long) __pure2;
82.65 +#endif
82.66 +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
82.67 +char *index(const char *, int) __pure; /* LEGACY */
82.68 +char *rindex(const char *, int) __pure; /* LEGACY */
82.69 +#endif
82.70 +int strcasecmp(const char *, const char *) __pure;
82.71 +int strncasecmp(const char *, const char *, size_t) __pure;
82.72 +
82.73 +#if __POSIX_VISIBLE >= 200809
82.74 +int strcasecmp_l (const char *, const char *, locale_t);
82.75 +int strncasecmp_l (const char *, const char *, size_t, locale_t);
82.76 +#endif
82.77 +__END_DECLS
82.78 +
82.79 +#if __SSP_FORTIFY_LEVEL > 0
82.80 +#include <ssp/strings.h>
82.81 +#endif
82.82 +
82.83 +#endif /* _STRINGS_H_ */
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/include/sys/_default_fcntl.h Mon Oct 21 16:11:07 2019 +0200
83.3 @@ -0,0 +1,240 @@
83.4 +
83.5 +#ifndef _SYS__DEFAULT_FCNTL_H_
83.6 +#ifdef __cplusplus
83.7 +extern "C" {
83.8 +#endif
83.9 +#define _SYS__DEFAULT_FCNTL_H_
83.10 +#include <_ansi.h>
83.11 +#include <sys/cdefs.h>
83.12 +#define _FOPEN (-1) /* from sys/file.h, kernel use only */
83.13 +#define _FREAD 0x0001 /* read enabled */
83.14 +#define _FWRITE 0x0002 /* write enabled */
83.15 +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
83.16 +#define _FMARK 0x0010 /* internal; mark during gc() */
83.17 +#define _FDEFER 0x0020 /* internal; defer for next gc pass */
83.18 +#define _FASYNC 0x0040 /* signal pgrp when data ready */
83.19 +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
83.20 +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
83.21 +#define _FCREAT 0x0200 /* open with file create */
83.22 +#define _FTRUNC 0x0400 /* open with truncation */
83.23 +#define _FEXCL 0x0800 /* error on open if file exists */
83.24 +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
83.25 +#define _FSYNC 0x2000 /* do all writes synchronously */
83.26 +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
83.27 +#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
83.28 +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
83.29 +#if defined (__CYGWIN__)
83.30 +#define _FBINARY 0x10000
83.31 +#define _FTEXT 0x20000
83.32 +#endif
83.33 +#define _FNOINHERIT 0x40000
83.34 +#define _FDIRECT 0x80000
83.35 +#define _FNOFOLLOW 0x100000
83.36 +#define _FDIRECTORY 0x200000
83.37 +#define _FEXECSRCH 0x400000
83.38 +#if defined (__CYGWIN__)
83.39 +#define _FTMPFILE 0x800000
83.40 +#define _FNOATIME 0x1000000
83.41 +#define _FPATH 0x2000000
83.42 +#endif
83.43 +
83.44 +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
83.45 +
83.46 +/*
83.47 + * Flag values for open(2) and fcntl(2)
83.48 + * The kernel adds 1 to the open modes to turn it into some
83.49 + * combination of FREAD and FWRITE.
83.50 + */
83.51 +#define O_RDONLY 0 /* +1 == FREAD */
83.52 +#define O_WRONLY 1 /* +1 == FWRITE */
83.53 +#define O_RDWR 2 /* +1 == FREAD|FWRITE */
83.54 +#define O_APPEND _FAPPEND
83.55 +#define O_CREAT _FCREAT
83.56 +#define O_TRUNC _FTRUNC
83.57 +#define O_EXCL _FEXCL
83.58 +#define O_SYNC _FSYNC
83.59 +/* O_NDELAY _FNDELAY set in include/fcntl.h */
83.60 +/* O_NDELAY _FNBIO set in include/fcntl.h */
83.61 +#define O_NONBLOCK _FNONBLOCK
83.62 +#define O_NOCTTY _FNOCTTY
83.63 +
83.64 +/* POSIX-1.2008 specific flags */
83.65 +#if __POSIX_VISIBLE >= 200809
83.66 +#define O_CLOEXEC _FNOINHERIT
83.67 +#define O_NOFOLLOW _FNOFOLLOW
83.68 +#define O_DIRECTORY _FDIRECTORY
83.69 +#define O_EXEC _FEXECSRCH
83.70 +#define O_SEARCH _FEXECSRCH
83.71 +#endif
83.72 +
83.73 +#if __BSD_VISIBLE
83.74 +#define O_DIRECT _FDIRECT
83.75 +#endif
83.76 +
83.77 +#if defined (__CYGWIN__)
83.78 +#define O_BINARY _FBINARY
83.79 +#define O_TEXT _FTEXT
83.80 +#define O_DSYNC _FSYNC
83.81 +#define O_RSYNC _FSYNC
83.82 +
83.83 +/* Linux-specific flags */
83.84 +#if __GNU_VISIBLE
83.85 +#define O_TMPFILE _FTMPFILE
83.86 +#define O_NOATIME _FNOATIME
83.87 +#define O_PATH _FPATH
83.88 +#endif
83.89 +#endif
83.90 +
83.91 +#if __MISC_VISIBLE
83.92 +
83.93 +/*
83.94 + * Flags that work for fcntl(fd, F_SETFL, FXXXX)
83.95 + */
83.96 +#define FAPPEND _FAPPEND
83.97 +#define FSYNC _FSYNC
83.98 +#define FASYNC _FASYNC
83.99 +#define FNBIO _FNBIO
83.100 +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */
83.101 +#define FNDELAY _FNDELAY
83.102 +
83.103 +/*
83.104 + * Flags that are disallowed for fcntl's (FCNTLCANT);
83.105 + * used for opens, internal state, or locking.
83.106 + */
83.107 +#define FREAD _FREAD
83.108 +#define FWRITE _FWRITE
83.109 +#define FMARK _FMARK
83.110 +#define FDEFER _FDEFER
83.111 +#define FSHLOCK _FSHLOCK
83.112 +#define FEXLOCK _FEXLOCK
83.113 +
83.114 +/*
83.115 + * The rest of the flags, used only for opens
83.116 + */
83.117 +#define FOPEN _FOPEN
83.118 +#define FCREAT _FCREAT
83.119 +#define FTRUNC _FTRUNC
83.120 +#define FEXCL _FEXCL
83.121 +#define FNOCTTY _FNOCTTY
83.122 +
83.123 +#endif /* __MISC_VISIBLE */
83.124 +
83.125 +#if __BSD_VISIBLE
83.126 +#define FNONBLOCK _FNONBLOCK
83.127 +#endif /* __BSD_VISIBLE */
83.128 +
83.129 +/* XXX close on exec request; must match UF_EXCLOSE in user.h */
83.130 +#define FD_CLOEXEC 1 /* posix */
83.131 +
83.132 +/* fcntl(2) requests */
83.133 +#define F_DUPFD 0 /* Duplicate fildes */
83.134 +#define F_GETFD 1 /* Get fildes flags (close on exec) */
83.135 +#define F_SETFD 2 /* Set fildes flags (close on exec) */
83.136 +#define F_GETFL 3 /* Get file flags */
83.137 +#define F_SETFL 4 /* Set file flags */
83.138 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
83.139 +#define F_GETOWN 5 /* Get owner - for ASYNC */
83.140 +#define F_SETOWN 6 /* Set owner - for ASYNC */
83.141 +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 */
83.142 +#define F_GETLK 7 /* Get record-locking information */
83.143 +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */
83.144 +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */
83.145 +#if __MISC_VISIBLE
83.146 +#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */
83.147 +#define F_RSETLK 11 /* Set or unlock a remote lock */
83.148 +#define F_CNVT 12 /* Convert a fhandle to an open fd */
83.149 +#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */
83.150 +#endif /* __MISC_VISIBLE */
83.151 +#if __POSIX_VISIBLE >= 200809
83.152 +#define F_DUPFD_CLOEXEC 14 /* As F_DUPFD, but set close-on-exec flag */
83.153 +#endif
83.154 +
83.155 +/* fcntl(2) flags (l_type field of flock structure) */
83.156 +#define F_RDLCK 1 /* read lock */
83.157 +#define F_WRLCK 2 /* write lock */
83.158 +#define F_UNLCK 3 /* remove lock(s) */
83.159 +#if __MISC_VISIBLE
83.160 +#define F_UNLKSYS 4 /* remove remote locks for a given system */
83.161 +#endif /* __MISC_VISIBLE */
83.162 +
83.163 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
83.164 +/* Special descriptor value to denote the cwd in calls to openat(2) etc. */
83.165 +#define AT_FDCWD -2
83.166 +
83.167 +/* Flag values for faccessat2) et al. */
83.168 +#define AT_EACCESS 1
83.169 +#define AT_SYMLINK_NOFOLLOW 2
83.170 +#define AT_SYMLINK_FOLLOW 4
83.171 +#define AT_REMOVEDIR 8
83.172 +#if __GNU_VISIBLE
83.173 +#define AT_EMPTY_PATH 16
83.174 +#endif
83.175 +#endif
83.176 +
83.177 +#if __BSD_VISIBLE
83.178 +/* lock operations for flock(2) */
83.179 +#define LOCK_SH 0x01 /* shared file lock */
83.180 +#define LOCK_EX 0x02 /* exclusive file lock */
83.181 +#define LOCK_NB 0x04 /* don't block when locking */
83.182 +#define LOCK_UN 0x08 /* unlock file */
83.183 +#endif
83.184 +
83.185 +/*#include <sys/stdtypes.h>*/
83.186 +
83.187 +#ifndef __CYGWIN__
83.188 +/* file segment locking set data type - information passed to system by user */
83.189 +struct flock {
83.190 + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
83.191 + short l_whence; /* flag to choose starting offset */
83.192 + long l_start; /* relative offset, in bytes */
83.193 + long l_len; /* length, in bytes; 0 means lock to EOF */
83.194 + short l_pid; /* returned with F_GETLK */
83.195 + short l_xxx; /* reserved for future use */
83.196 +};
83.197 +#endif /* __CYGWIN__ */
83.198 +
83.199 +#if __MISC_VISIBLE
83.200 +/* extended file segment locking set data type */
83.201 +struct eflock {
83.202 + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
83.203 + short l_whence; /* flag to choose starting offset */
83.204 + long l_start; /* relative offset, in bytes */
83.205 + long l_len; /* length, in bytes; 0 means lock to EOF */
83.206 + short l_pid; /* returned with F_GETLK */
83.207 + short l_xxx; /* reserved for future use */
83.208 + long l_rpid; /* Remote process id wanting this lock */
83.209 + long l_rsys; /* Remote system id wanting this lock */
83.210 +};
83.211 +#endif /* __MISC_VISIBLE */
83.212 +
83.213 +#include <sys/types.h>
83.214 +#include <sys/stat.h> /* sigh. for the mode bits for open/creat */
83.215 +
83.216 +extern int open (const char *, int, ...);
83.217 +#if __ATFILE_VISIBLE
83.218 +extern int openat (int, const char *, int, ...);
83.219 +#endif
83.220 +extern int creat (const char *, mode_t);
83.221 +extern int fcntl (int, int, ...);
83.222 +#if __BSD_VISIBLE
83.223 +extern int flock (int, int);
83.224 +#endif
83.225 +#if __GNU_VISIBLE
83.226 +#include <sys/time.h>
83.227 +extern int futimesat (int, const char *, const struct timeval *);
83.228 +#endif
83.229 +
83.230 +/* Provide _<systemcall> prototypes for functions provided by some versions
83.231 + of newlib. */
83.232 +#ifdef _COMPILING_NEWLIB
83.233 +extern int _open (const char *, int, ...);
83.234 +extern int _fcntl (int, int, ...);
83.235 +#ifdef __LARGE64_FILES
83.236 +extern int _open64 (const char *, int, ...);
83.237 +#endif
83.238 +#endif
83.239 +
83.240 +#ifdef __cplusplus
83.241 +}
83.242 +#endif
83.243 +#endif /* !_SYS__DEFAULT_FCNTL_H_ */
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84.2 +++ b/include/sys/_intsup.h Mon Oct 21 16:11:07 2019 +0200
84.3 @@ -0,0 +1,199 @@
84.4 +/*
84.5 + * Copyright (c) 2004, 2005 by
84.6 + * Ralf Corsepius, Ulm/Germany. All rights reserved.
84.7 + *
84.8 + * Permission to use, copy, modify, and distribute this software
84.9 + * is freely granted, provided that this notice is preserved.
84.10 + */
84.11 +
84.12 +#ifndef _SYS__INTSUP_H
84.13 +#define _SYS__INTSUP_H
84.14 +
84.15 +#include <sys/features.h>
84.16 +
84.17 +#if __GNUC_PREREQ (3, 2)
84.18 +/* gcc > 3.2 implicitly defines the values we are interested */
84.19 +#define __STDINT_EXP(x) __##x##__
84.20 +#else
84.21 +#define __STDINT_EXP(x) x
84.22 +#include <limits.h>
84.23 +#endif
84.24 +
84.25 +/* Determine how intptr_t and intN_t fastN_t and leastN_t are defined by gcc
84.26 + for this target. This is used to determine the correct printf() constant in
84.27 + inttypes.h and other constants in stdint.h.
84.28 + So we end up with
84.29 + ?(signed|unsigned) char == 0
84.30 + ?(signed|unsigned) short == 1
84.31 + ?(signed|unsigned) int == 2
84.32 + ?(signed|unsigned) short int == 3
84.33 + ?(signed|unsigned) long == 4
84.34 + ?(signed|unsigned) long int == 6
84.35 + ?(signed|unsigned) long long == 8
84.36 + ?(signed|unsigned) long long int == 10
84.37 + */
84.38 +#pragma push_macro("signed")
84.39 +#pragma push_macro("unsigned")
84.40 +#pragma push_macro("char")
84.41 +#pragma push_macro("short")
84.42 +#pragma push_macro("__int20")
84.43 +#pragma push_macro("__int20__")
84.44 +#pragma push_macro("int")
84.45 +#pragma push_macro("long")
84.46 +#undef signed
84.47 +#undef unsigned
84.48 +#undef char
84.49 +#undef short
84.50 +#undef int
84.51 +#undef __int20
84.52 +#undef __int20__
84.53 +#undef long
84.54 +#define signed +0
84.55 +#define unsigned +0
84.56 +#define char +0
84.57 +#define short +1
84.58 +#define __int20 +2
84.59 +#define __int20__ +2
84.60 +#define int +2
84.61 +#define long +4
84.62 +#if (__INTPTR_TYPE__ == 8 || __INTPTR_TYPE__ == 10)
84.63 +#define _INTPTR_EQ_LONGLONG
84.64 +#elif (__INTPTR_TYPE__ == 4 || __INTPTR_TYPE__ == 6)
84.65 +#define _INTPTR_EQ_LONG
84.66 +/* Note - the tests for _INTPTR_EQ_INT and _INTPTR_EQ_SHORT are currently
84.67 + redundant as the values are not used. But one day they may be needed
84.68 + and so the tests remain. */
84.69 +#elif __INTPTR_TYPE__ == 2
84.70 +#define _INTPTR_EQ_INT
84.71 +#elif (__INTPTR_TYPE__ == 1 || __INTPTR_TYPE__ == 3)
84.72 +#define _INTPTR_EQ_SHORT
84.73 +#else
84.74 +#error "Unable to determine type definition of intptr_t"
84.75 +#endif
84.76 +#if (__INT32_TYPE__ == 4 || __INT32_TYPE__ == 6)
84.77 +#define _INT32_EQ_LONG
84.78 +#elif __INT32_TYPE__ == 2
84.79 +/* Nothing to define because int32_t is safe to print as an int. */
84.80 +#else
84.81 +#error "Unable to determine type definition of int32_t"
84.82 +#endif
84.83 +
84.84 +#if (__INT8_TYPE__ == 0)
84.85 +#define __INT8 "hh"
84.86 +#elif (__INT8_TYPE__ == 1 || __INT8_TYPE__ == 3)
84.87 +#define __INT8 "h"
84.88 +#elif (__INT8_TYPE__ == 2)
84.89 +#define __INT8
84.90 +#elif (__INT8_TYPE__ == 4 || __INT8_TYPE__ == 6)
84.91 +#define __INT8 "l"
84.92 +#elif (__INT8_TYPE__ == 8 || __INT8_TYPE__ == 10)
84.93 +#define __INT8 "ll"
84.94 +#endif
84.95 +#if (__INT16_TYPE__ == 1 || __INT16_TYPE__ == 3)
84.96 +#define __INT16 "h"
84.97 +#elif (__INT16_TYPE__ == 2)
84.98 +#define __INT16
84.99 +#elif (__INT16_TYPE__ == 4 || __INT16_TYPE__ == 6)
84.100 +#define __INT16 "l"
84.101 +#elif (__INT16_TYPE__ == 8 || __INT16_TYPE__ == 10)
84.102 +#define __INT16 "ll"
84.103 +#endif
84.104 +#if (__INT32_TYPE__ == 2)
84.105 +#define __INT32
84.106 +#elif (__INT32_TYPE__ == 4 || __INT32_TYPE__ == 6)
84.107 +#define __INT32 "l"
84.108 +#elif (__INT32_TYPE__ == 8 || __INT32_TYPE__ == 10)
84.109 +#define __INT32 "ll"
84.110 +#endif
84.111 +#if (__INT64_TYPE__ == 2)
84.112 +#define __INT64
84.113 +#elif (__INT64_TYPE__ == 4 || __INT64_TYPE__ == 6)
84.114 +#define __INT64 "l"
84.115 +#elif (__INT64_TYPE__ == 8 || __INT64_TYPE__ == 10)
84.116 +#define __INT64 "ll"
84.117 +#endif
84.118 +#if (__INT_FAST8_TYPE__ == 0)
84.119 +#define __FAST8 "hh"
84.120 +#elif (__INT_FAST8_TYPE__ == 1 || __INT_FAST8_TYPE__ == 3)
84.121 +#define __FAST8 "h"
84.122 +#elif (__INT_FAST8_TYPE__ == 2)
84.123 +#define __FAST8
84.124 +#elif (__INT_FAST8_TYPE__ == 4 || __INT_FAST8_TYPE__ == 6)
84.125 +#define __FAST8 "l"
84.126 +#elif (__INT_FAST8_TYPE__ == 8 || __INT_FAST8_TYPE__ == 10)
84.127 +#define __FAST8 "ll"
84.128 +#endif
84.129 +#if (__INT_FAST16_TYPE__ == 1 || __INT_FAST16_TYPE__ == 3)
84.130 +#define __FAST16 "h"
84.131 +#elif (__INT_FAST16_TYPE__ == 2)
84.132 +#define __FAST16
84.133 +#elif (__INT_FAST16_TYPE__ == 4 || __INT_FAST16_TYPE__ == 6)
84.134 +#define __FAST16 "l"
84.135 +#elif (__INT_FAST16_TYPE__ == 8 || __INT_FAST16_TYPE__ == 10)
84.136 +#define __FAST16 "ll"
84.137 +#endif
84.138 +#if (__INT_FAST32_TYPE__ == 2)
84.139 +#define __FAST32
84.140 +#elif (__INT_FAST32_TYPE__ == 4 || __INT_FAST32_TYPE__ == 6)
84.141 +#define __FAST32 "l"
84.142 +#elif (__INT_FAST32_TYPE__ == 8 || __INT_FAST32_TYPE__ == 10)
84.143 +#define __FAST32 "ll"
84.144 +#endif
84.145 +#if (__INT_FAST64_TYPE__ == 2)
84.146 +#define __FAST64
84.147 +#elif (__INT_FAST64_TYPE__ == 4 || __INT_FAST64_TYPE__ == 6)
84.148 +#define __FAST64 "l"
84.149 +#elif (__INT_FAST64_TYPE__ == 8 || __INT_FAST64_TYPE__ == 10)
84.150 +#define __FAST64 "ll"
84.151 +#endif
84.152 +
84.153 +#if (__INT_LEAST8_TYPE__ == 0)
84.154 +#define __LEAST8 "hh"
84.155 +#elif (__INT_LEAST8_TYPE__ == 1 || __INT_LEAST8_TYPE__ == 3)
84.156 +#define __LEAST8 "h"
84.157 +#elif (__INT_LEAST8_TYPE__ == 2)
84.158 +#define __LEAST8
84.159 +#elif (__INT_LEAST8_TYPE__ == 4 || __INT_LEAST8_TYPE__ == 6)
84.160 +#define __LEAST8 "l"
84.161 +#elif (__INT_LEAST8_TYPE__ == 8 || __INT_LEAST8_TYPE__ == 10)
84.162 +#define __LEAST8 "ll"
84.163 +#endif
84.164 +#if (__INT_LEAST16_TYPE__ == 1 || __INT_LEAST16_TYPE__ == 3)
84.165 +#define __LEAST16 "h"
84.166 +#elif (__INT_LEAST16_TYPE__ == 2)
84.167 +#define __LEAST16
84.168 +#elif (__INT_LEAST16_TYPE__ == 4 || __INT_LEAST16_TYPE__ == 6)
84.169 +#define __LEAST16 "l"
84.170 +#elif (__INT_LEAST16_TYPE__ == 8 || __INT_LEAST16_TYPE__ == 10)
84.171 +#define __LEAST16 "ll"
84.172 +#endif
84.173 +#if (__INT_LEAST32_TYPE__ == 2)
84.174 +#define __LEAST32
84.175 +#elif (__INT_LEAST32_TYPE__ == 4 || __INT_LEAST32_TYPE__ == 6)
84.176 +#define __LEAST32 "l"
84.177 +#elif (__INT_LEAST32_TYPE__ == 8 || __INT_LEAST32_TYPE__ == 10)
84.178 +#define __LEAST32 "ll"
84.179 +#endif
84.180 +#if (__INT_LEAST64_TYPE__ == 2)
84.181 +#define __LEAST64
84.182 +#elif (__INT_LEAST64_TYPE__ == 4 || __INT_LEAST64_TYPE__ == 6)
84.183 +#define __LEAST64 "l"
84.184 +#elif (__INT_LEAST64_TYPE__ == 8 || __INT_LEAST64_TYPE__ == 10)
84.185 +#define __LEAST64 "ll"
84.186 +#endif
84.187 +#undef signed
84.188 +#undef unsigned
84.189 +#undef char
84.190 +#undef short
84.191 +#undef int
84.192 +#undef long
84.193 +#pragma pop_macro("signed")
84.194 +#pragma pop_macro("unsigned")
84.195 +#pragma pop_macro("char")
84.196 +#pragma pop_macro("short")
84.197 +#pragma pop_macro("__int20")
84.198 +#pragma pop_macro("__int20__")
84.199 +#pragma pop_macro("int")
84.200 +#pragma pop_macro("long")
84.201 +
84.202 +#endif /* _SYS__INTSUP_H */
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
85.2 +++ b/include/sys/_locale.h Mon Oct 21 16:11:07 2019 +0200
85.3 @@ -0,0 +1,12 @@
85.4 +/* Definition of opaque POSIX-1.2008 type locale_t for userspace. */
85.5 +
85.6 +#ifndef _SYS__LOCALE_H
85.7 +#define _SYS__LOCALE_H
85.8 +
85.9 +#include <newlib.h>
85.10 +#include <sys/config.h>
85.11 +
85.12 +struct __locale_t;
85.13 +typedef struct __locale_t *locale_t;
85.14 +
85.15 +#endif /* _SYS__LOCALE_H */
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
86.2 +++ b/include/sys/_pthreadtypes.h Mon Oct 21 16:11:07 2019 +0200
86.3 @@ -0,0 +1,233 @@
86.4 +/*
86.5 + * Written by Joel Sherrill <joel.sherrill@OARcorp.com>.
86.6 + *
86.7 + * COPYRIGHT (c) 1989-2013, 2015.
86.8 + * On-Line Applications Research Corporation (OAR).
86.9 + *
86.10 + * Permission to use, copy, modify, and distribute this software for any
86.11 + * purpose without fee is hereby granted, provided that this entire notice
86.12 + * is included in all copies of any software which is or includes a copy
86.13 + * or modification of this software.
86.14 + *
86.15 + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
86.16 + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
86.17 + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
86.18 + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
86.19 + */
86.20 +
86.21 +#ifndef _SYS__PTHREADTYPES_H_
86.22 +#define _SYS__PTHREADTYPES_H_
86.23 +
86.24 +#if defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506
86.25 +
86.26 +#include <sys/sched.h>
86.27 +
86.28 +/*
86.29 + * 2.5 Primitive System Data Types, P1003.1c/D10, p. 19.
86.30 + */
86.31 +
86.32 +#if defined(__XMK__)
86.33 +typedef unsigned int pthread_t; /* identify a thread */
86.34 +#else
86.35 +typedef __uint32_t pthread_t; /* identify a thread */
86.36 +#endif
86.37 +
86.38 +/* P1003.1c/D10, p. 118-119 */
86.39 +#define PTHREAD_SCOPE_PROCESS 0
86.40 +#define PTHREAD_SCOPE_SYSTEM 1
86.41 +
86.42 +/* P1003.1c/D10, p. 111 */
86.43 +#define PTHREAD_INHERIT_SCHED 1 /* scheduling policy and associated */
86.44 + /* attributes are inherited from */
86.45 + /* the calling thread. */
86.46 +#define PTHREAD_EXPLICIT_SCHED 2 /* set from provided attribute object */
86.47 +
86.48 +/* P1003.1c/D10, p. 141 */
86.49 +#define PTHREAD_CREATE_DETACHED 0
86.50 +#define PTHREAD_CREATE_JOINABLE 1
86.51 +
86.52 +#if defined(__XMK__)
86.53 +typedef struct pthread_attr_s {
86.54 + int contentionscope;
86.55 + struct sched_param schedparam;
86.56 + int detachstate;
86.57 + void *stackaddr;
86.58 + size_t stacksize;
86.59 +} pthread_attr_t;
86.60 +
86.61 +#define PTHREAD_STACK_MIN 200
86.62 +
86.63 +#else /* !defined(__XMK__) */
86.64 +typedef struct {
86.65 + int is_initialized;
86.66 + void *stackaddr;
86.67 + int stacksize;
86.68 + int contentionscope;
86.69 + int inheritsched;
86.70 + int schedpolicy;
86.71 + struct sched_param schedparam;
86.72 +
86.73 + /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute. */
86.74 +#if defined(_POSIX_THREAD_CPUTIME)
86.75 + int cputime_clock_allowed; /* see time.h */
86.76 +#endif
86.77 + int detachstate;
86.78 +} pthread_attr_t;
86.79 +
86.80 +#endif /* !defined(__XMK__) */
86.81 +
86.82 +#if defined(_POSIX_THREAD_PROCESS_SHARED)
86.83 +/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */
86.84 +
86.85 +#define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
86.86 +#define PTHREAD_PROCESS_SHARED 1 /* visible too all processes with access to */
86.87 + /* the memory where the resource is */
86.88 + /* located */
86.89 +#endif
86.90 +
86.91 +#if defined(_POSIX_THREAD_PRIO_PROTECT)
86.92 +/* Mutexes */
86.93 +
86.94 +/* Values for blocking protocol. */
86.95 +
86.96 +#define PTHREAD_PRIO_NONE 0
86.97 +#define PTHREAD_PRIO_INHERIT 1
86.98 +#define PTHREAD_PRIO_PROTECT 2
86.99 +#endif
86.100 +
86.101 +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
86.102 +
86.103 +/* Values for mutex type */
86.104 +
86.105 +/* The following defines are part of the X/Open System Interface (XSI). */
86.106 +
86.107 +/*
86.108 + * This type of mutex does not detect deadlock. A thread attempting to
86.109 + * relock this mutex without first unlocking it shall deadlock. Attempting
86.110 + * to unlock a mutex locked by a different thread results in undefined
86.111 + * behavior. Attempting to unlock an unlocked mutex results in undefined
86.112 + * behavior.
86.113 + */
86.114 +#define PTHREAD_MUTEX_NORMAL 0
86.115 +
86.116 +/*
86.117 + * A thread attempting to relock this mutex without first unlocking
86.118 + * it shall succeed in locking the mutex. The relocking deadlock which
86.119 + * can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with
86.120 + * this type of mutex. Multiple locks of this mutex shall require the
86.121 + * same number of unlocks to release the mutex before another thread can
86.122 + * acquire the mutex. A thread attempting to unlock a mutex which another
86.123 + * thread has locked shall return with an error. A thread attempting to
86.124 + * unlock an unlocked mutex shall return with an error.
86.125 + */
86.126 +#define PTHREAD_MUTEX_RECURSIVE 1
86.127 +
86.128 +/*
86.129 + * This type of mutex provides error checking. A thread attempting
86.130 + * to relock this mutex without first unlocking it shall return with an
86.131 + * error. A thread attempting to unlock a mutex which another thread has
86.132 + * locked shall return with an error. A thread attempting to unlock an
86.133 + * unlocked mutex shall return with an error.
86.134 + */
86.135 +#define PTHREAD_MUTEX_ERRORCHECK 2
86.136 +
86.137 +/*
86.138 + * Attempting to recursively lock a mutex of this type results
86.139 + * in undefined behavior. Attempting to unlock a mutex of this type
86.140 + * which was not locked by the calling thread results in undefined
86.141 + * behavior. Attempting to unlock a mutex of this type which is not locked
86.142 + * results in undefined behavior. An implementation may map this mutex to
86.143 + * one of the other mutex types.
86.144 + */
86.145 +#define PTHREAD_MUTEX_DEFAULT 3
86.146 +
86.147 +#endif /* !defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) */
86.148 +
86.149 +#if defined(__XMK__)
86.150 +typedef unsigned int pthread_mutex_t; /* identify a mutex */
86.151 +
86.152 +typedef struct {
86.153 + int type;
86.154 +} pthread_mutexattr_t;
86.155 +
86.156 +#else /* !defined(__XMK__) */
86.157 +typedef __uint32_t pthread_mutex_t; /* identify a mutex */
86.158 +
86.159 +typedef struct {
86.160 + int is_initialized;
86.161 +#if defined(_POSIX_THREAD_PROCESS_SHARED)
86.162 + int process_shared; /* allow mutex to be shared amongst processes */
86.163 +#endif
86.164 +#if defined(_POSIX_THREAD_PRIO_PROTECT)
86.165 + int prio_ceiling;
86.166 + int protocol;
86.167 +#endif
86.168 +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
86.169 + int type;
86.170 +#endif
86.171 + int recursive;
86.172 +} pthread_mutexattr_t;
86.173 +#endif /* !defined(__XMK__) */
86.174 +
86.175 +#define _PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
86.176 +
86.177 +/* Condition Variables */
86.178 +
86.179 +typedef __uint32_t pthread_cond_t; /* identify a condition variable */
86.180 +
86.181 +#define _PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF)
86.182 +
86.183 +typedef struct {
86.184 + int is_initialized;
86.185 + clock_t clock; /* specifiy clock for timeouts */
86.186 +#if defined(_POSIX_THREAD_PROCESS_SHARED)
86.187 + int process_shared; /* allow this to be shared amongst processes */
86.188 +#endif
86.189 +} pthread_condattr_t; /* a condition attribute object */
86.190 +
86.191 +/* Keys */
86.192 +
86.193 +typedef __uint32_t pthread_key_t; /* thread-specific data keys */
86.194 +
86.195 +typedef struct {
86.196 + int is_initialized; /* is this structure initialized? */
86.197 + int init_executed; /* has the initialization routine been run? */
86.198 +} pthread_once_t; /* dynamic package initialization */
86.199 +
86.200 +#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
86.201 +#endif /* defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506 */
86.202 +
86.203 +/* POSIX Barrier Types */
86.204 +
86.205 +#if defined(_POSIX_BARRIERS)
86.206 +typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */
86.207 +typedef struct {
86.208 + int is_initialized; /* is this structure initialized? */
86.209 +#if defined(_POSIX_THREAD_PROCESS_SHARED)
86.210 + int process_shared; /* allow this to be shared amongst processes */
86.211 +#endif
86.212 +} pthread_barrierattr_t;
86.213 +#endif /* defined(_POSIX_BARRIERS) */
86.214 +
86.215 +/* POSIX Spin Lock Types */
86.216 +
86.217 +#if defined(_POSIX_SPIN_LOCKS)
86.218 +typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */
86.219 +#endif /* defined(_POSIX_SPIN_LOCKS) */
86.220 +
86.221 +/* POSIX Reader/Writer Lock Types */
86.222 +
86.223 +#if defined(_POSIX_READER_WRITER_LOCKS)
86.224 +typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */
86.225 +
86.226 +#define _PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF)
86.227 +
86.228 +typedef struct {
86.229 + int is_initialized; /* is this structure initialized? */
86.230 +#if defined(_POSIX_THREAD_PROCESS_SHARED)
86.231 + int process_shared; /* allow this to be shared amongst processes */
86.232 +#endif
86.233 +} pthread_rwlockattr_t;
86.234 +#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
86.235 +
86.236 +#endif /* ! _SYS__PTHREADTYPES_H_ */
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
87.2 +++ b/include/sys/_sigset.h Mon Oct 21 16:11:07 2019 +0200
87.3 @@ -0,0 +1,43 @@
87.4 +/*-
87.5 + * Copyright (c) 1982, 1986, 1989, 1991, 1993
87.6 + * The Regents of the University of California. All rights reserved.
87.7 + * (c) UNIX System Laboratories, Inc.
87.8 + * All or some portions of this file are derived from material licensed
87.9 + * to the University of California by American Telephone and Telegraph
87.10 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
87.11 + * the permission of UNIX System Laboratories, Inc.
87.12 + *
87.13 + * Redistribution and use in source and binary forms, with or without
87.14 + * modification, are permitted provided that the following conditions
87.15 + * are met:
87.16 + * 1. Redistributions of source code must retain the above copyright
87.17 + * notice, this list of conditions and the following disclaimer.
87.18 + * 2. Redistributions in binary form must reproduce the above copyright
87.19 + * notice, this list of conditions and the following disclaimer in the
87.20 + * documentation and/or other materials provided with the distribution.
87.21 + * 4. Neither the name of the University nor the names of its contributors
87.22 + * may be used to endorse or promote products derived from this software
87.23 + * without specific prior written permission.
87.24 + *
87.25 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
87.26 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
87.27 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
87.28 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
87.29 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
87.30 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
87.31 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
87.32 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
87.33 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
87.34 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
87.35 + * SUCH DAMAGE.
87.36 + *
87.37 + * @(#)signal.h 8.4 (Berkeley) 5/4/95
87.38 + * $FreeBSD$
87.39 + */
87.40 +
87.41 +#ifndef _SYS__SIGSET_H_
87.42 +#define _SYS__SIGSET_H_
87.43 +
87.44 +typedef unsigned long __sigset_t;
87.45 +
87.46 +#endif /* !_SYS__SIGSET_H_ */
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
88.2 +++ b/include/sys/_stdint.h Mon Oct 21 16:11:07 2019 +0200
88.3 @@ -0,0 +1,90 @@
88.4 +/*
88.5 + * Copyright (c) 2004, 2005 by
88.6 + * Ralf Corsepius, Ulm/Germany. All rights reserved.
88.7 + *
88.8 + * Permission to use, copy, modify, and distribute this software
88.9 + * is freely granted, provided that this notice is preserved.
88.10 + */
88.11 +
88.12 +#ifndef _SYS__STDINT_H
88.13 +#define _SYS__STDINT_H
88.14 +
88.15 +#include <machine/_default_types.h>
88.16 +
88.17 +#ifdef __cplusplus
88.18 +extern "C" {
88.19 +#endif
88.20 +
88.21 +#ifdef ___int8_t_defined
88.22 +#ifndef _INT8_T_DECLARED
88.23 +typedef __int8_t int8_t ;
88.24 +#define _INT8_T_DECLARED
88.25 +#endif
88.26 +#ifndef _UINT8_T_DECLARED
88.27 +typedef __uint8_t uint8_t ;
88.28 +#define _UINT8_T_DECLARED
88.29 +#endif
88.30 +#define __int8_t_defined 1
88.31 +#endif /* ___int8_t_defined */
88.32 +
88.33 +#ifdef ___int16_t_defined
88.34 +#ifndef _INT16_T_DECLARED
88.35 +typedef __int16_t int16_t ;
88.36 +#define _INT16_T_DECLARED
88.37 +#endif
88.38 +#ifndef _UINT16_T_DECLARED
88.39 +typedef __uint16_t uint16_t ;
88.40 +#define _UINT16_T_DECLARED
88.41 +#endif
88.42 +#define __int16_t_defined 1
88.43 +#endif /* ___int16_t_defined */
88.44 +
88.45 +#ifdef ___int32_t_defined
88.46 +#ifndef _INT32_T_DECLARED
88.47 +typedef __int32_t int32_t ;
88.48 +#define _INT32_T_DECLARED
88.49 +#endif
88.50 +#ifndef _UINT32_T_DECLARED
88.51 +typedef __uint32_t uint32_t ;
88.52 +#define _UINT32_T_DECLARED
88.53 +#endif
88.54 +#define __int32_t_defined 1
88.55 +#endif /* ___int32_t_defined */
88.56 +
88.57 +#ifdef ___int64_t_defined
88.58 +#ifndef _INT64_T_DECLARED
88.59 +typedef __int64_t int64_t ;
88.60 +#define _INT64_T_DECLARED
88.61 +#endif
88.62 +#ifndef _UINT64_T_DECLARED
88.63 +typedef __uint64_t uint64_t ;
88.64 +#define _UINT64_T_DECLARED
88.65 +#endif
88.66 +#define __int64_t_defined 1
88.67 +#endif /* ___int64_t_defined */
88.68 +
88.69 +#ifndef _INTMAX_T_DECLARED
88.70 +typedef __intmax_t intmax_t;
88.71 +#define _INTMAX_T_DECLARED
88.72 +#endif
88.73 +
88.74 +#ifndef _UINTMAX_T_DECLARED
88.75 +typedef __uintmax_t uintmax_t;
88.76 +#define _UINTMAX_T_DECLARED
88.77 +#endif
88.78 +
88.79 +#ifndef _INTPTR_T_DECLARED
88.80 +typedef __intptr_t intptr_t;
88.81 +#define _INTPTR_T_DECLARED
88.82 +#endif
88.83 +
88.84 +#ifndef _UINTPTR_T_DECLARED
88.85 +typedef __uintptr_t uintptr_t;
88.86 +#define _UINTPTR_T_DECLARED
88.87 +#endif
88.88 +
88.89 +#ifdef __cplusplus
88.90 +}
88.91 +#endif
88.92 +
88.93 +#endif /* _SYS__STDINT_H */
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
89.2 +++ b/include/sys/_timespec.h Mon Oct 21 16:11:07 2019 +0200
89.3 @@ -0,0 +1,50 @@
89.4 +/*-
89.5 + * Copyright (c) 1982, 1986, 1993
89.6 + * The Regents of the University of California. All rights reserved.
89.7 + *
89.8 + * Redistribution and use in source and binary forms, with or without
89.9 + * modification, are permitted provided that the following conditions
89.10 + * are met:
89.11 + * 1. Redistributions of source code must retain the above copyright
89.12 + * notice, this list of conditions and the following disclaimer.
89.13 + * 2. Redistributions in binary form must reproduce the above copyright
89.14 + * notice, this list of conditions and the following disclaimer in the
89.15 + * documentation and/or other materials provided with the distribution.
89.16 + * 4. Neither the name of the University nor the names of its contributors
89.17 + * may be used to endorse or promote products derived from this software
89.18 + * without specific prior written permission.
89.19 + *
89.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
89.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
89.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
89.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
89.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
89.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
89.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
89.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
89.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
89.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89.30 + * SUCH DAMAGE.
89.31 + *
89.32 + * @(#)time.h 8.5 (Berkeley) 5/4/95
89.33 + * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
89.34 + * $FreeBSD$
89.35 + */
89.36 +
89.37 +#ifndef _SYS__TIMESPEC_H_
89.38 +#define _SYS__TIMESPEC_H_
89.39 +
89.40 +#include <sys/_types.h>
89.41 +
89.42 +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
89.43 +typedef _TIME_T_ time_t;
89.44 +#define __time_t_defined
89.45 +#define _TIME_T_DECLARED
89.46 +#endif
89.47 +
89.48 +struct timespec {
89.49 + time_t tv_sec; /* seconds */
89.50 + long tv_nsec; /* and nanoseconds */
89.51 +};
89.52 +
89.53 +#endif /* !_SYS__TIMESPEC_H_ */
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
90.2 +++ b/include/sys/_timeval.h Mon Oct 21 16:11:07 2019 +0200
90.3 @@ -0,0 +1,89 @@
90.4 +/*-
90.5 + * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
90.6 + * All rights reserved.
90.7 + *
90.8 + * Redistribution and use in source and binary forms, with or without
90.9 + * modification, are permitted provided that the following conditions
90.10 + * are met:
90.11 + * 1. Redistributions of source code must retain the above copyright
90.12 + * notice, this list of conditions and the following disclaimer.
90.13 + * 2. Redistributions in binary form must reproduce the above copyright
90.14 + * notice, this list of conditions and the following disclaimer in the
90.15 + * documentation and/or other materials provided with the distribution.
90.16 + *
90.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
90.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
90.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
90.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
90.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
90.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
90.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
90.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
90.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
90.27 + * SUCH DAMAGE.
90.28 + *
90.29 + * $FreeBSD$
90.30 + */
90.31 +
90.32 +#ifndef _SYS__TIMEVAL_H_
90.33 +#define _SYS__TIMEVAL_H_
90.34 +
90.35 +#include <sys/_types.h>
90.36 +
90.37 +#ifndef _SUSECONDS_T_DECLARED
90.38 +typedef __suseconds_t suseconds_t;
90.39 +#define _SUSECONDS_T_DECLARED
90.40 +#endif
90.41 +
90.42 +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
90.43 +typedef _TIME_T_ time_t;
90.44 +#define __time_t_defined
90.45 +#define _TIME_T_DECLARED
90.46 +#endif
90.47 +
90.48 +/* This define is also used outside of Newlib, e.g. in MinGW-w64 */
90.49 +#ifndef _TIMEVAL_DEFINED
90.50 +#define _TIMEVAL_DEFINED
90.51 +
90.52 +/*
90.53 + * Structure returned by gettimeofday(2) system call, and used in other calls.
90.54 + */
90.55 +struct timeval {
90.56 + time_t tv_sec; /* seconds */
90.57 + suseconds_t tv_usec; /* and microseconds */
90.58 +};
90.59 +
90.60 +#if __BSD_VISIBLE
90.61 +#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */
90.62 +
90.63 +#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
90.64 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
90.65 +#define timercmp(tvp, uvp, cmp) \
90.66 + (((tvp)->tv_sec == (uvp)->tv_sec) ? \
90.67 + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
90.68 + ((tvp)->tv_sec cmp (uvp)->tv_sec))
90.69 +#define timeradd(tvp, uvp, vvp) \
90.70 + do { \
90.71 + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
90.72 + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
90.73 + if ((vvp)->tv_usec >= 1000000) { \
90.74 + (vvp)->tv_sec++; \
90.75 + (vvp)->tv_usec -= 1000000; \
90.76 + } \
90.77 + } while (0)
90.78 +#define timersub(tvp, uvp, vvp) \
90.79 + do { \
90.80 + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
90.81 + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
90.82 + if ((vvp)->tv_usec < 0) { \
90.83 + (vvp)->tv_sec--; \
90.84 + (vvp)->tv_usec += 1000000; \
90.85 + } \
90.86 + } while (0)
90.87 +#endif
90.88 +#endif /* __BSD_VISIBLE */
90.89 +
90.90 +#endif /* _TIMEVAL_DEFINED */
90.91 +
90.92 +#endif /* !_SYS__TIMEVAL_H_ */
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
91.2 +++ b/include/sys/_types.h Mon Oct 21 16:11:07 2019 +0200
91.3 @@ -0,0 +1,224 @@
91.4 +/* ANSI C namespace clean utility typedefs */
91.5 +
91.6 +/* This file defines various typedefs needed by the system calls that support
91.7 + the C library. Basically, they're just the POSIX versions with an '_'
91.8 + prepended. Targets shall use <machine/_types.h> to define their own
91.9 + internal types if desired.
91.10 +
91.11 + There are three define patterns used for type definitions. Lets assume
91.12 + xyz_t is a user type.
91.13 +
91.14 + The internal type definition uses __machine_xyz_t_defined. It is defined by
91.15 + <machine/_types.h> to disable a default definition in <sys/_types.h>. It
91.16 + must not be used in other files.
91.17 +
91.18 + User type definitions are guarded by __xyz_t_defined in glibc and
91.19 + _XYZ_T_DECLARED in BSD compatible systems.
91.20 +*/
91.21 +
91.22 +#ifndef _SYS__TYPES_H
91.23 +#define _SYS__TYPES_H
91.24 +
91.25 +#define __need_size_t
91.26 +#define __need_wint_t
91.27 +#include <stddef.h>
91.28 +#include <newlib.h>
91.29 +#include <sys/config.h>
91.30 +#include <machine/_types.h>
91.31 +
91.32 +#ifndef __machine_blkcnt_t_defined
91.33 +typedef long __blkcnt_t;
91.34 +#endif
91.35 +
91.36 +#ifndef __machine_blksize_t_defined
91.37 +typedef long __blksize_t;
91.38 +#endif
91.39 +
91.40 +#ifndef __machine_fsblkcnt_t_defined
91.41 +typedef __uint64_t __fsblkcnt_t;
91.42 +#endif
91.43 +
91.44 +#ifndef __machine_fsfilcnt_t_defined
91.45 +typedef __uint32_t __fsfilcnt_t;
91.46 +#endif
91.47 +
91.48 +#ifndef __machine_off_t_defined
91.49 +typedef long _off_t;
91.50 +#endif
91.51 +
91.52 +#if defined(__XMK__)
91.53 +typedef signed char __pid_t;
91.54 +#else
91.55 +typedef int __pid_t;
91.56 +#endif
91.57 +
91.58 +#ifndef __machine_dev_t_defined
91.59 +typedef short __dev_t;
91.60 +#endif
91.61 +
91.62 +#ifndef __machine_uid_t_defined
91.63 +typedef unsigned short __uid_t;
91.64 +#endif
91.65 +#ifndef __machine_gid_t_defined
91.66 +typedef unsigned short __gid_t;
91.67 +#endif
91.68 +
91.69 +#ifndef __machine_id_t_defined
91.70 +typedef __uint32_t __id_t;
91.71 +#endif
91.72 +
91.73 +#ifndef __machine_ino_t_defined
91.74 +#if (defined(__i386__) && (defined(GO32) || defined(__MSDOS__))) || \
91.75 + defined(__sparc__) || defined(__SPU__)
91.76 +typedef unsigned long __ino_t;
91.77 +#else
91.78 +typedef unsigned short __ino_t;
91.79 +#endif
91.80 +#endif
91.81 +
91.82 +#ifndef __machine_mode_t_defined
91.83 +#if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
91.84 +typedef int __mode_t;
91.85 +#else
91.86 +#if defined(__sparc__) && !defined(__sparc_v9__)
91.87 +#ifdef __svr4__
91.88 +typedef unsigned long __mode_t;
91.89 +#else
91.90 +typedef unsigned short __mode_t;
91.91 +#endif
91.92 +#else
91.93 +typedef __uint32_t __mode_t;
91.94 +#endif
91.95 +#endif
91.96 +#endif
91.97 +
91.98 +#ifndef __machine_off64_t_defined
91.99 +__extension__ typedef long long _off64_t;
91.100 +#endif
91.101 +
91.102 +#if defined(__CYGWIN__) && !defined(__LP64__)
91.103 +typedef _off64_t __off_t;
91.104 +#else
91.105 +typedef _off_t __off_t;
91.106 +#endif
91.107 +
91.108 +typedef _off64_t __loff_t;
91.109 +
91.110 +#ifndef __machine_key_t_defined
91.111 +typedef long __key_t;
91.112 +#endif
91.113 +
91.114 +/*
91.115 + * We need fpos_t for the following, but it doesn't have a leading "_",
91.116 + * so we use _fpos_t instead.
91.117 + */
91.118 +#ifndef __machine_fpos_t_defined
91.119 +typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
91.120 + /* (and must be `long' for now) */
91.121 +#endif
91.122 +
91.123 +#ifdef __LARGE64_FILES
91.124 +#ifndef __machine_fpos64_t_defined
91.125 +typedef _off64_t _fpos64_t;
91.126 +#endif
91.127 +#endif
91.128 +
91.129 +/* Defined by GCC provided <stddef.h> */
91.130 +#undef __size_t
91.131 +
91.132 +#ifndef __machine_size_t_defined
91.133 +#ifdef __SIZE_TYPE__
91.134 +typedef __SIZE_TYPE__ __size_t;
91.135 +#else
91.136 +#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
91.137 +typedef unsigned int __size_t;
91.138 +#else
91.139 +typedef unsigned long __size_t;
91.140 +#endif
91.141 +#endif
91.142 +#endif
91.143 +
91.144 +#ifndef __machine_ssize_t_defined
91.145 +#ifdef __SIZE_TYPE__
91.146 +/* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t.
91.147 + We simply change "unsigned" to "signed" for this single definition
91.148 + to make sure ssize_t and size_t only differ by their signedness. */
91.149 +#define unsigned signed
91.150 +typedef __SIZE_TYPE__ _ssize_t;
91.151 +#undef unsigned
91.152 +#else
91.153 +#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
91.154 +typedef int _ssize_t;
91.155 +#else
91.156 +typedef long _ssize_t;
91.157 +#endif
91.158 +#endif
91.159 +#endif
91.160 +
91.161 +typedef _ssize_t __ssize_t;
91.162 +
91.163 +#ifndef __machine_mbstate_t_defined
91.164 +/* Conversion state information. */
91.165 +typedef struct
91.166 +{
91.167 + int __count;
91.168 + union
91.169 + {
91.170 + wint_t __wch;
91.171 + unsigned char __wchb[4];
91.172 + } __value; /* Value so far. */
91.173 +} _mbstate_t;
91.174 +#endif
91.175 +
91.176 +#ifndef __machine_iconv_t_defined
91.177 +/* Iconv descriptor type */
91.178 +typedef void *_iconv_t;
91.179 +#endif
91.180 +
91.181 +#ifndef __machine_clock_t_defined
91.182 +#define _CLOCK_T_ unsigned long /* clock() */
91.183 +#endif
91.184 +
91.185 +typedef _CLOCK_T_ __clock_t;
91.186 +
91.187 +#if defined(_USE_LONG_TIME_T) || __LONG_MAX__ > 0x7fffffffL
91.188 +#define _TIME_T_ long
91.189 +#else
91.190 +#define _TIME_T_ __int_least64_t
91.191 +#endif
91.192 +typedef _TIME_T_ __time_t;
91.193 +
91.194 +#ifndef __machine_clockid_t_defined
91.195 +#define _CLOCKID_T_ unsigned long
91.196 +#endif
91.197 +
91.198 +typedef _CLOCKID_T_ __clockid_t;
91.199 +
91.200 +#define _TIMER_T_ unsigned long
91.201 +typedef _TIMER_T_ __timer_t;
91.202 +
91.203 +#ifndef __machine_sa_family_t_defined
91.204 +typedef __uint8_t __sa_family_t;
91.205 +#endif
91.206 +
91.207 +#ifndef __machine_socklen_t_defined
91.208 +typedef __uint32_t __socklen_t;
91.209 +#endif
91.210 +
91.211 +typedef int __nl_item;
91.212 +typedef unsigned short __nlink_t;
91.213 +typedef long __suseconds_t; /* microseconds (signed) */
91.214 +typedef unsigned long __useconds_t; /* microseconds (unsigned) */
91.215 +
91.216 +/*
91.217 + * Must be identical to the __GNUCLIKE_BUILTIN_VAALIST definition in
91.218 + * <sys/cdefs.h>. The <sys/cdefs.h> must not be included here to avoid cyclic
91.219 + * header dependencies.
91.220 + */
91.221 +#if __GNUC_MINOR__ > 95 || __GNUC__ >= 3
91.222 +typedef __builtin_va_list __va_list;
91.223 +#else
91.224 +typedef char * __va_list;
91.225 +#endif
91.226 +
91.227 +#endif /* _SYS__TYPES_H */
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
92.2 +++ b/include/sys/cdefs.h Mon Oct 21 16:11:07 2019 +0200
92.3 @@ -0,0 +1,716 @@
92.4 +/* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */
92.5 +
92.6 +/* Written 2000 by Werner Almesberger */
92.7 +
92.8 +/*-
92.9 + * SPDX-License-Identifier: BSD-3-Clause
92.10 + *
92.11 + * Copyright (c) 1991, 1993
92.12 + * The Regents of the University of California. All rights reserved.
92.13 + *
92.14 + * This code is derived from software contributed to Berkeley by
92.15 + * Berkeley Software Design, Inc.
92.16 + *
92.17 + * Redistribution and use in source and binary forms, with or without
92.18 + * modification, are permitted provided that the following conditions
92.19 + * are met:
92.20 + * 1. Redistributions of source code must retain the above copyright
92.21 + * notice, this list of conditions and the following disclaimer.
92.22 + * 2. Redistributions in binary form must reproduce the above copyright
92.23 + * notice, this list of conditions and the following disclaimer in the
92.24 + * documentation and/or other materials provided with the distribution.
92.25 + * 3. Neither the name of the University nor the names of its contributors
92.26 + * may be used to endorse or promote products derived from this software
92.27 + * without specific prior written permission.
92.28 + *
92.29 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
92.30 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92.31 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
92.32 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
92.33 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
92.34 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
92.35 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
92.36 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
92.37 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
92.38 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
92.39 + * SUCH DAMAGE.
92.40 + *
92.41 + * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
92.42 + * $FreeBSD$
92.43 + */
92.44 +
92.45 +#ifndef _SYS_CDEFS_H_
92.46 +#define _SYS_CDEFS_H_
92.47 +
92.48 +#include <machine/_default_types.h>
92.49 +#include <sys/features.h>
92.50 +#include <stddef.h>
92.51 +
92.52 +#define __PMT(args) args
92.53 +#define __DOTS , ...
92.54 +#define __THROW
92.55 +
92.56 +#ifdef __GNUC__
92.57 +# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
92.58 +#endif
92.59 +
92.60 +#define __ptr_t void *
92.61 +#define __long_double_t long double
92.62 +
92.63 +#define __attribute_malloc__
92.64 +#define __attribute_pure__
92.65 +#define __attribute_format_strfmon__(a,b)
92.66 +#define __flexarr [0]
92.67 +
92.68 +#ifndef __BOUNDED_POINTERS__
92.69 +# define __bounded /* nothing */
92.70 +# define __unbounded /* nothing */
92.71 +# define __ptrvalue /* nothing */
92.72 +#endif
92.73 +
92.74 +/*
92.75 + * Testing against Clang-specific extensions.
92.76 + */
92.77 +#ifndef __has_attribute
92.78 +#define __has_attribute(x) 0
92.79 +#endif
92.80 +#ifndef __has_extension
92.81 +#define __has_extension __has_feature
92.82 +#endif
92.83 +#ifndef __has_feature
92.84 +#define __has_feature(x) 0
92.85 +#endif
92.86 +#ifndef __has_include
92.87 +#define __has_include(x) 0
92.88 +#endif
92.89 +#ifndef __has_builtin
92.90 +#define __has_builtin(x) 0
92.91 +#endif
92.92 +
92.93 +#if defined(__cplusplus)
92.94 +#define __BEGIN_DECLS extern "C" {
92.95 +#define __END_DECLS }
92.96 +#else
92.97 +#define __BEGIN_DECLS
92.98 +#define __END_DECLS
92.99 +#endif
92.100 +
92.101 +/*
92.102 + * This code has been put in place to help reduce the addition of
92.103 + * compiler specific defines in FreeBSD code. It helps to aid in
92.104 + * having a compiler-agnostic source tree.
92.105 + */
92.106 +
92.107 +#if defined(__GNUC__) || defined(__INTEL_COMPILER)
92.108 +
92.109 +#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
92.110 +#define __GNUCLIKE_ASM 3
92.111 +#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
92.112 +#else
92.113 +#define __GNUCLIKE_ASM 2
92.114 +#endif
92.115 +#define __GNUCLIKE___TYPEOF 1
92.116 +#define __GNUCLIKE___OFFSETOF 1
92.117 +#define __GNUCLIKE___SECTION 1
92.118 +
92.119 +#ifndef __INTEL_COMPILER
92.120 +#define __GNUCLIKE_CTOR_SECTION_HANDLING 1
92.121 +#endif
92.122 +
92.123 +#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
92.124 +#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
92.125 + __INTEL_COMPILER < 800
92.126 +#undef __GNUCLIKE_BUILTIN_CONSTANT_P
92.127 +#endif
92.128 +
92.129 +#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
92.130 +#define __GNUCLIKE_BUILTIN_VARARGS 1
92.131 +#define __GNUCLIKE_BUILTIN_STDARG 1
92.132 +#define __GNUCLIKE_BUILTIN_VAALIST 1
92.133 +#endif
92.134 +
92.135 +#if defined(__GNUC__)
92.136 +#define __GNUC_VA_LIST_COMPATIBILITY 1
92.137 +#endif
92.138 +
92.139 +/*
92.140 + * Compiler memory barriers, specific to gcc and clang.
92.141 + */
92.142 +#if defined(__GNUC__)
92.143 +#define __compiler_membar() __asm __volatile(" " : : : "memory")
92.144 +#endif
92.145 +
92.146 +#ifndef __INTEL_COMPILER
92.147 +#define __GNUCLIKE_BUILTIN_NEXT_ARG 1
92.148 +#define __GNUCLIKE_MATH_BUILTIN_RELOPS
92.149 +#endif
92.150 +
92.151 +#define __GNUCLIKE_BUILTIN_MEMCPY 1
92.152 +
92.153 +/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
92.154 +#define __CC_SUPPORTS_INLINE 1
92.155 +#define __CC_SUPPORTS___INLINE 1
92.156 +#define __CC_SUPPORTS___INLINE__ 1
92.157 +
92.158 +#define __CC_SUPPORTS___FUNC__ 1
92.159 +#define __CC_SUPPORTS_WARNING 1
92.160 +
92.161 +#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
92.162 +
92.163 +#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
92.164 +
92.165 +#endif /* __GNUC__ || __INTEL_COMPILER */
92.166 +
92.167 +/*
92.168 + * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
92.169 + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
92.170 + * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
92.171 + * mode -- there must be no spaces between its arguments, and for nested
92.172 + * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
92.173 + * concatenate double-quoted strings produced by the __STRING macro, but
92.174 + * this only works with ANSI C.
92.175 + *
92.176 + * __XSTRING is like __STRING, but it expands any macros in its argument
92.177 + * first. It is only available with ANSI C.
92.178 + */
92.179 +#if defined(__STDC__) || defined(__cplusplus)
92.180 +#define __P(protos) protos /* full-blown ANSI C */
92.181 +#define __CONCAT1(x,y) x ## y
92.182 +#define __CONCAT(x,y) __CONCAT1(x,y)
92.183 +#define __STRING(x) #x /* stringify without expanding x */
92.184 +#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
92.185 +
92.186 +#define __const const /* define reserved names to standard */
92.187 +#define __signed signed
92.188 +#define __volatile volatile
92.189 +#if defined(__cplusplus)
92.190 +#define __inline inline /* convert to C++ keyword */
92.191 +#else
92.192 +#if !(defined(__CC_SUPPORTS___INLINE))
92.193 +#define __inline /* delete GCC keyword */
92.194 +#endif /* ! __CC_SUPPORTS___INLINE */
92.195 +#endif /* !__cplusplus */
92.196 +
92.197 +#else /* !(__STDC__ || __cplusplus) */
92.198 +#define __P(protos) () /* traditional C preprocessor */
92.199 +#define __CONCAT(x,y) x/**/y
92.200 +#define __STRING(x) "x"
92.201 +
92.202 +#if !defined(__CC_SUPPORTS___INLINE)
92.203 +#define __const /* delete pseudo-ANSI C keywords */
92.204 +#define __inline
92.205 +#define __signed
92.206 +#define __volatile
92.207 +/*
92.208 + * In non-ANSI C environments, new programs will want ANSI-only C keywords
92.209 + * deleted from the program and old programs will want them left alone.
92.210 + * When using a compiler other than gcc, programs using the ANSI C keywords
92.211 + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
92.212 + * When using "gcc -traditional", we assume that this is the intent; if
92.213 + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
92.214 + */
92.215 +#ifndef NO_ANSI_KEYWORDS
92.216 +#define const /* delete ANSI C keywords */
92.217 +#define inline
92.218 +#define signed
92.219 +#define volatile
92.220 +#endif /* !NO_ANSI_KEYWORDS */
92.221 +#endif /* !__CC_SUPPORTS___INLINE */
92.222 +#endif /* !(__STDC__ || __cplusplus) */
92.223 +
92.224 +/*
92.225 + * Compiler-dependent macros to help declare dead (non-returning) and
92.226 + * pure (no side effects) functions, and unused variables. They are
92.227 + * null except for versions of gcc that are known to support the features
92.228 + * properly (old versions of gcc-2 supported the dead and pure features
92.229 + * in a different (wrong) way). If we do not provide an implementation
92.230 + * for a given compiler, let the compile fail if it is told to use
92.231 + * a feature that we cannot live without.
92.232 + */
92.233 +#define __weak_symbol __attribute__((__weak__))
92.234 +#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
92.235 +#define __dead2
92.236 +#define __pure2
92.237 +#define __unused
92.238 +#endif
92.239 +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
92.240 +#define __dead2 __attribute__((__noreturn__))
92.241 +#define __pure2 __attribute__((__const__))
92.242 +#define __unused
92.243 +/* XXX Find out what to do for __packed, __aligned and __section */
92.244 +#endif
92.245 +#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
92.246 +#define __dead2 __attribute__((__noreturn__))
92.247 +#define __pure2 __attribute__((__const__))
92.248 +#define __unused __attribute__((__unused__))
92.249 +#define __used __attribute__((__used__))
92.250 +#define __packed __attribute__((__packed__))
92.251 +#define __aligned(x) __attribute__((__aligned__(x)))
92.252 +#define __section(x) __attribute__((__section__(x)))
92.253 +#endif
92.254 +#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
92.255 +#define __alloc_size(x) __attribute__((__alloc_size__(x)))
92.256 +#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x)))
92.257 +#else
92.258 +#define __alloc_size(x)
92.259 +#define __alloc_size2(n, x)
92.260 +#endif
92.261 +#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
92.262 +#define __alloc_align(x) __attribute__((__alloc_align__(x)))
92.263 +#else
92.264 +#define __alloc_align(x)
92.265 +#endif
92.266 +
92.267 +#if !__GNUC_PREREQ__(2, 95)
92.268 +#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
92.269 +#endif
92.270 +
92.271 +/*
92.272 + * Keywords added in C11.
92.273 + */
92.274 +
92.275 +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
92.276 +
92.277 +#if !__has_extension(c_alignas)
92.278 +#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
92.279 + __has_extension(cxx_alignas)
92.280 +#define _Alignas(x) alignas(x)
92.281 +#else
92.282 +/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
92.283 +#define _Alignas(x) __aligned(x)
92.284 +#endif
92.285 +#endif
92.286 +
92.287 +#if defined(__cplusplus) && __cplusplus >= 201103L
92.288 +#define _Alignof(x) alignof(x)
92.289 +#else
92.290 +#define _Alignof(x) __alignof(x)
92.291 +#endif
92.292 +
92.293 +#if !defined(__cplusplus) && !__has_extension(c_atomic) && \
92.294 + !__has_extension(cxx_atomic)
92.295 +/*
92.296 + * No native support for _Atomic(). Place object in structure to prevent
92.297 + * most forms of direct non-atomic access.
92.298 + */
92.299 +#define _Atomic(T) struct { T volatile __val; }
92.300 +#endif
92.301 +
92.302 +#if defined(__cplusplus) && __cplusplus >= 201103L
92.303 +#define _Noreturn [[noreturn]]
92.304 +#else
92.305 +#define _Noreturn __dead2
92.306 +#endif
92.307 +
92.308 +#if !__has_extension(c_static_assert)
92.309 +#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
92.310 + __has_extension(cxx_static_assert)
92.311 +#define _Static_assert(x, y) static_assert(x, y)
92.312 +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
92.313 +/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
92.314 +#elif defined(__COUNTER__)
92.315 +#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
92.316 +#define __Static_assert(x, y) ___Static_assert(x, y)
92.317 +#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
92.318 + __unused
92.319 +#else
92.320 +#define _Static_assert(x, y) struct __hack
92.321 +#endif
92.322 +#endif
92.323 +
92.324 +#if !__has_extension(c_thread_local)
92.325 +/*
92.326 + * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode
92.327 + * without actually supporting the thread_local keyword. Don't check for
92.328 + * the presence of C++11 when defining _Thread_local.
92.329 + */
92.330 +#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
92.331 + __has_extension(cxx_thread_local)
92.332 +#define _Thread_local thread_local
92.333 +#else
92.334 +#define _Thread_local __thread
92.335 +#endif
92.336 +#endif
92.337 +
92.338 +#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
92.339 +
92.340 +/*
92.341 + * Emulation of C11 _Generic(). Unlike the previously defined C11
92.342 + * keywords, it is not possible to implement this using exactly the same
92.343 + * syntax. Therefore implement something similar under the name
92.344 + * __generic(). Unlike _Generic(), this macro can only distinguish
92.345 + * between a single type, so it requires nested invocations to
92.346 + * distinguish multiple cases.
92.347 + */
92.348 +
92.349 +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
92.350 + __has_extension(c_generic_selections)
92.351 +#define __generic(expr, t, yes, no) \
92.352 + _Generic(expr, t: yes, default: no)
92.353 +#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
92.354 +#define __generic(expr, t, yes, no) \
92.355 + __builtin_choose_expr( \
92.356 + __builtin_types_compatible_p(__typeof(expr), t), yes, no)
92.357 +#endif
92.358 +
92.359 +/*
92.360 + * C99 Static array indices in function parameter declarations. Syntax such as:
92.361 + * void bar(int myArray[static 10]);
92.362 + * is allowed in C99 but not in C++. Define __min_size appropriately so
92.363 + * headers using it can be compiled in either language. Use like this:
92.364 + * void bar(int myArray[__min_size(10)]);
92.365 + */
92.366 +#if !defined(__cplusplus) && \
92.367 + (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
92.368 + (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
92.369 +#define __min_size(x) static (x)
92.370 +#else
92.371 +#define __min_size(x) (x)
92.372 +#endif
92.373 +
92.374 +#if __GNUC_PREREQ__(2, 96)
92.375 +#define __malloc_like __attribute__((__malloc__))
92.376 +#define __pure __attribute__((__pure__))
92.377 +#else
92.378 +#define __malloc_like
92.379 +#define __pure
92.380 +#endif
92.381 +
92.382 +#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
92.383 +#define __always_inline __inline__ __attribute__((__always_inline__))
92.384 +#else
92.385 +#define __always_inline
92.386 +#endif
92.387 +
92.388 +#if __GNUC_PREREQ__(3, 1)
92.389 +#define __noinline __attribute__ ((__noinline__))
92.390 +#else
92.391 +#define __noinline
92.392 +#endif
92.393 +
92.394 +#if __GNUC_PREREQ__(3, 3)
92.395 +#define __nonnull(x) __attribute__((__nonnull__ x))
92.396 +#define __nonnull_all __attribute__((__nonnull__))
92.397 +#else
92.398 +#define __nonnull(x)
92.399 +#define __nonnull_all
92.400 +#endif
92.401 +
92.402 +#if __GNUC_PREREQ__(3, 4)
92.403 +#define __fastcall __attribute__((__fastcall__))
92.404 +#define __result_use_check __attribute__((__warn_unused_result__))
92.405 +#else
92.406 +#define __fastcall
92.407 +#define __result_use_check
92.408 +#endif
92.409 +
92.410 +#if __GNUC_PREREQ__(4, 1)
92.411 +#define __returns_twice __attribute__((__returns_twice__))
92.412 +#else
92.413 +#define __returns_twice
92.414 +#endif
92.415 +
92.416 +#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
92.417 +#define __unreachable() __builtin_unreachable()
92.418 +#else
92.419 +#define __unreachable() ((void)0)
92.420 +#endif
92.421 +
92.422 +/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
92.423 +#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
92.424 +#define __func__ NULL
92.425 +#endif
92.426 +
92.427 +/*
92.428 + * GCC 2.95 provides `__restrict' as an extension to C90 to support the
92.429 + * C99-specific `restrict' type qualifier. We happen to use `__restrict' as
92.430 + * a way to define the `restrict' type qualifier without disturbing older
92.431 + * software that is unaware of C99 keywords.
92.432 + */
92.433 +#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
92.434 +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
92.435 +#define __restrict
92.436 +#else
92.437 +#define __restrict restrict
92.438 +#endif
92.439 +#endif
92.440 +
92.441 +/*
92.442 + * GNU C version 2.96 adds explicit branch prediction so that
92.443 + * the CPU back-end can hint the processor and also so that
92.444 + * code blocks can be reordered such that the predicted path
92.445 + * sees a more linear flow, thus improving cache behavior, etc.
92.446 + *
92.447 + * The following two macros provide us with a way to utilize this
92.448 + * compiler feature. Use __predict_true() if you expect the expression
92.449 + * to evaluate to true, and __predict_false() if you expect the
92.450 + * expression to evaluate to false.
92.451 + *
92.452 + * A few notes about usage:
92.453 + *
92.454 + * * Generally, __predict_false() error condition checks (unless
92.455 + * you have some _strong_ reason to do otherwise, in which case
92.456 + * document it), and/or __predict_true() `no-error' condition
92.457 + * checks, assuming you want to optimize for the no-error case.
92.458 + *
92.459 + * * Other than that, if you don't know the likelihood of a test
92.460 + * succeeding from empirical or other `hard' evidence, don't
92.461 + * make predictions.
92.462 + *
92.463 + * * These are meant to be used in places that are run `a lot'.
92.464 + * It is wasteful to make predictions in code that is run
92.465 + * seldomly (e.g. at subsystem initialization time) as the
92.466 + * basic block reordering that this affects can often generate
92.467 + * larger code.
92.468 + */
92.469 +#if __GNUC_PREREQ__(2, 96)
92.470 +#define __predict_true(exp) __builtin_expect((exp), 1)
92.471 +#define __predict_false(exp) __builtin_expect((exp), 0)
92.472 +#else
92.473 +#define __predict_true(exp) (exp)
92.474 +#define __predict_false(exp) (exp)
92.475 +#endif
92.476 +
92.477 +#if __GNUC_PREREQ__(4, 0)
92.478 +#define __null_sentinel __attribute__((__sentinel__))
92.479 +#define __exported __attribute__((__visibility__("default")))
92.480 +/* Only default visibility is supported on PE/COFF targets. */
92.481 +#ifndef __CYGWIN__
92.482 +#define __hidden __attribute__((__visibility__("hidden")))
92.483 +#else
92.484 +#define __hidden
92.485 +#endif
92.486 +#else
92.487 +#define __null_sentinel
92.488 +#define __exported
92.489 +#define __hidden
92.490 +#endif
92.491 +
92.492 +#define __offsetof(type, field) offsetof(type, field)
92.493 +#define __rangeof(type, start, end) \
92.494 + (__offsetof(type, end) - __offsetof(type, start))
92.495 +
92.496 +/*
92.497 + * Given the pointer x to the member m of the struct s, return
92.498 + * a pointer to the containing structure. When using GCC, we first
92.499 + * assign pointer x to a local variable, to check that its type is
92.500 + * compatible with member m.
92.501 + */
92.502 +#if __GNUC_PREREQ__(3, 1)
92.503 +#define __containerof(x, s, m) ({ \
92.504 + const volatile __typeof(((s *)0)->m) *__x = (x); \
92.505 + __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
92.506 +})
92.507 +#else
92.508 +#define __containerof(x, s, m) \
92.509 + __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
92.510 +#endif
92.511 +
92.512 +/*
92.513 + * Compiler-dependent macros to declare that functions take printf-like
92.514 + * or scanf-like arguments. They are null except for versions of gcc
92.515 + * that are known to support the features properly (old versions of gcc-2
92.516 + * didn't permit keeping the keywords out of the application namespace).
92.517 + */
92.518 +#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
92.519 +#define __printflike(fmtarg, firstvararg)
92.520 +#define __scanflike(fmtarg, firstvararg)
92.521 +#define __format_arg(fmtarg)
92.522 +#define __strfmonlike(fmtarg, firstvararg)
92.523 +#define __strftimelike(fmtarg, firstvararg)
92.524 +#else
92.525 +#define __printflike(fmtarg, firstvararg) \
92.526 + __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
92.527 +#define __scanflike(fmtarg, firstvararg) \
92.528 + __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
92.529 +#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
92.530 +#define __strfmonlike(fmtarg, firstvararg) \
92.531 + __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
92.532 +#define __strftimelike(fmtarg, firstvararg) \
92.533 + __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
92.534 +#endif
92.535 +
92.536 +/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
92.537 +#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
92.538 + defined(__GNUC__) && !defined(__INTEL_COMPILER)
92.539 +#define __printf0like(fmtarg, firstvararg) \
92.540 + __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
92.541 +#else
92.542 +#define __printf0like(fmtarg, firstvararg)
92.543 +#endif
92.544 +
92.545 +#if defined(__GNUC__) || defined(__INTEL_COMPILER)
92.546 +#ifndef __INTEL_COMPILER
92.547 +#define __strong_reference(sym,aliassym) \
92.548 + extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
92.549 +#endif
92.550 +#ifdef __ELF__
92.551 +#ifdef __STDC__
92.552 +#define __weak_reference(sym,alias) \
92.553 + __asm__(".weak " #alias); \
92.554 + __asm__(".equ " #alias ", " #sym)
92.555 +#define __warn_references(sym,msg) \
92.556 + __asm__(".section .gnu.warning." #sym); \
92.557 + __asm__(".asciz \"" msg "\""); \
92.558 + __asm__(".previous")
92.559 +#define __sym_compat(sym,impl,verid) \
92.560 + __asm__(".symver " #impl ", " #sym "@" #verid)
92.561 +#define __sym_default(sym,impl,verid) \
92.562 + __asm__(".symver " #impl ", " #sym "@@" #verid)
92.563 +#else
92.564 +#define __weak_reference(sym,alias) \
92.565 + __asm__(".weak alias"); \
92.566 + __asm__(".equ alias, sym")
92.567 +#define __warn_references(sym,msg) \
92.568 + __asm__(".section .gnu.warning.sym"); \
92.569 + __asm__(".asciz \"msg\""); \
92.570 + __asm__(".previous")
92.571 +#define __sym_compat(sym,impl,verid) \
92.572 + __asm__(".symver impl, sym@verid")
92.573 +#define __sym_default(impl,sym,verid) \
92.574 + __asm__(".symver impl, sym@@verid")
92.575 +#endif /* __STDC__ */
92.576 +#else /* !__ELF__ */
92.577 +#ifdef __STDC__
92.578 +#define __weak_reference(sym,alias) \
92.579 + __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
92.580 + __asm__(".stabs \"_" #sym "\",1,0,0,0")
92.581 +#define __warn_references(sym,msg) \
92.582 + __asm__(".stabs \"" msg "\",30,0,0,0"); \
92.583 + __asm__(".stabs \"_" #sym "\",1,0,0,0")
92.584 +#else
92.585 +#define __weak_reference(sym,alias) \
92.586 + __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
92.587 + __asm__(".stabs \"_/**/sym\",1,0,0,0")
92.588 +#define __warn_references(sym,msg) \
92.589 + __asm__(".stabs msg,30,0,0,0"); \
92.590 + __asm__(".stabs \"_/**/sym\",1,0,0,0")
92.591 +#endif /* __STDC__ */
92.592 +#endif /* __ELF__ */
92.593 +#endif /* __GNUC__ || __INTEL_COMPILER */
92.594 +
92.595 +#ifndef __FBSDID
92.596 +#define __FBSDID(s) struct __hack
92.597 +#endif
92.598 +
92.599 +#ifndef __RCSID
92.600 +#define __RCSID(s) struct __hack
92.601 +#endif
92.602 +
92.603 +#ifndef __RCSID_SOURCE
92.604 +#define __RCSID_SOURCE(s) struct __hack
92.605 +#endif
92.606 +
92.607 +#ifndef __SCCSID
92.608 +#define __SCCSID(s) struct __hack
92.609 +#endif
92.610 +
92.611 +#ifndef __COPYRIGHT
92.612 +#define __COPYRIGHT(s) struct __hack
92.613 +#endif
92.614 +
92.615 +#ifndef __DECONST
92.616 +#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
92.617 +#endif
92.618 +
92.619 +#ifndef __DEVOLATILE
92.620 +#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
92.621 +#endif
92.622 +
92.623 +#ifndef __DEQUALIFY
92.624 +#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
92.625 +#endif
92.626 +
92.627 +/*
92.628 + * Nullability qualifiers: currently only supported by Clang.
92.629 + */
92.630 +#if !(defined(__clang__) && __has_feature(nullability))
92.631 +#define _Nonnull
92.632 +#define _Nullable
92.633 +#define _Null_unspecified
92.634 +#define __NULLABILITY_PRAGMA_PUSH
92.635 +#define __NULLABILITY_PRAGMA_POP
92.636 +#else
92.637 +#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
92.638 + _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
92.639 +#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
92.640 +#endif
92.641 +
92.642 +/*
92.643 + * Type Safety Checking
92.644 + *
92.645 + * Clang provides additional attributes to enable checking type safety
92.646 + * properties that cannot be enforced by the C type system.
92.647 + */
92.648 +
92.649 +#if __has_attribute(__argument_with_type_tag__) && \
92.650 + __has_attribute(__type_tag_for_datatype__)
92.651 +#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
92.652 + __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
92.653 +#define __datatype_type_tag(kind, type) \
92.654 + __attribute__((__type_tag_for_datatype__(kind, type)))
92.655 +#else
92.656 +#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
92.657 +#define __datatype_type_tag(kind, type)
92.658 +#endif
92.659 +
92.660 +/*
92.661 + * Lock annotations.
92.662 + *
92.663 + * Clang provides support for doing basic thread-safety tests at
92.664 + * compile-time, by marking which locks will/should be held when
92.665 + * entering/leaving a functions.
92.666 + *
92.667 + * Furthermore, it is also possible to annotate variables and structure
92.668 + * members to enforce that they are only accessed when certain locks are
92.669 + * held.
92.670 + */
92.671 +
92.672 +#if __has_extension(c_thread_safety_attributes)
92.673 +#define __lock_annotate(x) __attribute__((x))
92.674 +#else
92.675 +#define __lock_annotate(x)
92.676 +#endif
92.677 +
92.678 +/* Structure implements a lock. */
92.679 +/* FIXME: Use __lockable__, etc. to avoid colliding with user namespace macros,
92.680 + * once clang is fixed: https://bugs.llvm.org/show_bug.cgi?id=34319 */
92.681 +#define __lockable __lock_annotate(lockable)
92.682 +
92.683 +/* Function acquires an exclusive or shared lock. */
92.684 +#define __locks_exclusive(...) \
92.685 + __lock_annotate(exclusive_lock_function(__VA_ARGS__))
92.686 +#define __locks_shared(...) \
92.687 + __lock_annotate(shared_lock_function(__VA_ARGS__))
92.688 +
92.689 +/* Function attempts to acquire an exclusive or shared lock. */
92.690 +#define __trylocks_exclusive(...) \
92.691 + __lock_annotate(exclusive_trylock_function(__VA_ARGS__))
92.692 +#define __trylocks_shared(...) \
92.693 + __lock_annotate(shared_trylock_function(__VA_ARGS__))
92.694 +
92.695 +/* Function releases a lock. */
92.696 +#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
92.697 +
92.698 +/* Function asserts that an exclusive or shared lock is held. */
92.699 +#define __asserts_exclusive(...) \
92.700 + __lock_annotate(assert_exclusive_lock(__VA_ARGS__))
92.701 +#define __asserts_shared(...) \
92.702 + __lock_annotate(assert_shared_lock(__VA_ARGS__))
92.703 +
92.704 +/* Function requires that an exclusive or shared lock is or is not held. */
92.705 +#define __requires_exclusive(...) \
92.706 + __lock_annotate(exclusive_locks_required(__VA_ARGS__))
92.707 +#define __requires_shared(...) \
92.708 + __lock_annotate(shared_locks_required(__VA_ARGS__))
92.709 +#define __requires_unlocked(...) \
92.710 + __lock_annotate(locks_excluded(__VA_ARGS__))
92.711 +
92.712 +/* Function should not be analyzed. */
92.713 +#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
92.714 +
92.715 +/* Guard variables and structure members by lock. */
92.716 +#define __guarded_by(x) __lock_annotate(guarded_by(x))
92.717 +#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
92.718 +
92.719 +#endif /* !_SYS_CDEFS_H_ */
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
93.2 +++ b/include/sys/config.h Mon Oct 21 16:11:07 2019 +0200
93.3 @@ -0,0 +1,304 @@
93.4 +#ifndef __SYS_CONFIG_H__
93.5 +#define __SYS_CONFIG_H__
93.6 +
93.7 +#include <machine/ieeefp.h> /* floating point macros */
93.8 +#include <sys/features.h> /* POSIX defs */
93.9 +
93.10 +#ifdef __aarch64__
93.11 +#define MALLOC_ALIGNMENT 16
93.12 +#endif
93.13 +
93.14 +#ifdef __AMDGCN__
93.15 +#define __DYNAMIC_REENT__
93.16 +#endif
93.17 +
93.18 +/* exceptions first */
93.19 +#if defined(__H8500__) || defined(__W65__)
93.20 +#define __SMALL_BITFIELDS
93.21 +/* ??? This conditional is true for the h8500 and the w65, defining H8300
93.22 + in those cases probably isn't the right thing to do. */
93.23 +#define H8300 1
93.24 +#endif
93.25 +
93.26 +/* 16 bit integer machines */
93.27 +#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8500__) || defined(__W65__) || defined (__mn10200__) || defined (__AVR__)
93.28 +
93.29 +#undef INT_MAX
93.30 +#undef UINT_MAX
93.31 +#define INT_MAX 32767
93.32 +#define UINT_MAX 65535
93.33 +#endif
93.34 +
93.35 +#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) || defined (__H8300SX__)
93.36 +#define __SMALL_BITFIELDS
93.37 +#define H8300 1
93.38 +#undef INT_MAX
93.39 +#undef UINT_MAX
93.40 +#define INT_MAX __INT_MAX__
93.41 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.42 +#endif
93.43 +
93.44 +#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
93.45 +#ifndef __INT32__
93.46 +#define __SMALL_BITFIELDS
93.47 +#undef INT_MAX
93.48 +#undef UINT_MAX
93.49 +#define INT_MAX 32767
93.50 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.51 +#else /* INT32 */
93.52 +#undef INT_MAX
93.53 +#undef UINT_MAX
93.54 +#define INT_MAX 2147483647
93.55 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.56 +#endif /* INT32 */
93.57 +
93.58 +#endif /* CR16C */
93.59 +
93.60 +#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
93.61 +#define __SMALL_BITFIELDS
93.62 +#endif
93.63 +
93.64 +#ifdef __W65__
93.65 +#define __SMALL_BITFIELDS
93.66 +#endif
93.67 +
93.68 +#if defined(__D10V__)
93.69 +#define __SMALL_BITFIELDS
93.70 +#undef INT_MAX
93.71 +#undef UINT_MAX
93.72 +#define INT_MAX __INT_MAX__
93.73 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.74 +#define _POINTER_INT short
93.75 +#endif
93.76 +
93.77 +#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
93.78 +#undef INT_MAX
93.79 +#undef UINT_MAX
93.80 +#define INT_MAX __INT_MAX__
93.81 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.82 +#define _POINTER_INT short
93.83 +#endif
93.84 +
93.85 +#if defined(__m68k__) || defined(__mc68000__) || defined(__riscv)
93.86 +#define _READ_WRITE_RETURN_TYPE _ssize_t
93.87 +#endif
93.88 +
93.89 +#ifdef ___AM29K__
93.90 +#define _FLOAT_RET double
93.91 +#endif
93.92 +
93.93 +#ifdef __i386__
93.94 +#ifndef __unix__
93.95 +/* in other words, go32 */
93.96 +#define _FLOAT_RET double
93.97 +#endif
93.98 +#if defined(__linux__) || defined(__RDOS__)
93.99 +/* we want the reentrancy structure to be returned by a function */
93.100 +#define __DYNAMIC_REENT__
93.101 +#define HAVE_GETDATE
93.102 +#define _READ_WRITE_RETURN_TYPE _ssize_t
93.103 +#define __LARGE64_FILES 1
93.104 +/* we use some glibc header files so turn on glibc large file feature */
93.105 +#define _LARGEFILE64_SOURCE 1
93.106 +#endif
93.107 +#endif
93.108 +
93.109 +#ifdef __mn10200__
93.110 +#define __SMALL_BITFIELDS
93.111 +#endif
93.112 +
93.113 +#ifdef __AVR__
93.114 +#define __SMALL_BITFIELDS
93.115 +#define _POINTER_INT short
93.116 +#endif
93.117 +
93.118 +#if defined(__v850) && !defined(__rtems__)
93.119 +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))
93.120 +#endif
93.121 +
93.122 +/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
93.123 +#if defined(__PPC__)
93.124 +#if defined(_CALL_SYSV)
93.125 +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
93.126 +#endif
93.127 +#ifdef __SPE__
93.128 +#define _LONG_DOUBLE double
93.129 +#endif
93.130 +#endif
93.131 +
93.132 +/* Configure small REENT structure for Xilinx MicroBlaze platforms */
93.133 +#if defined (__MICROBLAZE__)
93.134 +#ifndef _REENT_SMALL
93.135 +#define _REENT_SMALL
93.136 +#endif
93.137 +/* Xilinx XMK uses Unix98 mutex */
93.138 +#ifdef __XMK__
93.139 +#define _UNIX98_THREAD_MUTEX_ATTRIBUTES
93.140 +#endif
93.141 +#endif
93.142 +
93.143 +#if defined(__mips__) && !defined(__rtems__)
93.144 +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
93.145 +#endif
93.146 +
93.147 +#ifdef __xstormy16__
93.148 +#define __SMALL_BITFIELDS
93.149 +#undef INT_MAX
93.150 +#undef UINT_MAX
93.151 +#define INT_MAX __INT_MAX__
93.152 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.153 +#define MALLOC_ALIGNMENT 8
93.154 +#define _POINTER_INT short
93.155 +#define __BUFSIZ__ 16
93.156 +#define _REENT_SMALL
93.157 +#endif
93.158 +
93.159 +#if defined __MSP430__
93.160 +#ifndef _REENT_SMALL
93.161 +#define _REENT_SMALL
93.162 +#endif
93.163 +
93.164 +#define __BUFSIZ__ 256
93.165 +#define __SMALL_BITFIELDS
93.166 +
93.167 +#ifdef __MSP430X_LARGE__
93.168 +#define _POINTER_INT long
93.169 +#else
93.170 +#define _POINTER_INT int
93.171 +#endif
93.172 +#endif
93.173 +
93.174 +#ifdef __m32c__
93.175 +#define __SMALL_BITFIELDS
93.176 +#undef INT_MAX
93.177 +#undef UINT_MAX
93.178 +#define INT_MAX __INT_MAX__
93.179 +#define UINT_MAX (__INT_MAX__ * 2U + 1)
93.180 +#define MALLOC_ALIGNMENT 8
93.181 +#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
93.182 +#define _POINTER_INT short
93.183 +#else
93.184 +#define _POINTER_INT long
93.185 +#endif
93.186 +#define __BUFSIZ__ 16
93.187 +#define _REENT_SMALL
93.188 +#endif /* __m32c__ */
93.189 +
93.190 +#ifdef __SPU__
93.191 +#define MALLOC_ALIGNMENT 16
93.192 +#define __CUSTOM_FILE_IO__
93.193 +#endif
93.194 +
93.195 +#if defined(__or1k__) || defined(__or1knd__)
93.196 +#define __DYNAMIC_REENT__
93.197 +#endif
93.198 +
93.199 +/* This block should be kept in sync with GCC's limits.h. The point
93.200 + of having these definitions here is to not include limits.h, which
93.201 + would pollute the user namespace, while still using types of the
93.202 + the correct widths when deciding how to define __int32_t and
93.203 + __int64_t. */
93.204 +#ifndef __INT_MAX__
93.205 +# ifdef INT_MAX
93.206 +# define __INT_MAX__ INT_MAX
93.207 +# else
93.208 +# define __INT_MAX__ 2147483647
93.209 +# endif
93.210 +#endif
93.211 +
93.212 +#ifndef __LONG_MAX__
93.213 +# ifdef LONG_MAX
93.214 +# define __LONG_MAX__ LONG_MAX
93.215 +# else
93.216 +# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
93.217 + || defined (__sparcv9)
93.218 +# define __LONG_MAX__ 9223372036854775807L
93.219 +# else
93.220 +# define __LONG_MAX__ 2147483647L
93.221 +# endif /* __alpha__ || sparc64 */
93.222 +# endif
93.223 +#endif
93.224 +/* End of block that should be kept in sync with GCC's limits.h. */
93.225 +
93.226 +#ifndef _POINTER_INT
93.227 +#define _POINTER_INT long
93.228 +#endif
93.229 +
93.230 +#ifdef __frv__
93.231 +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
93.232 +#endif
93.233 +#undef __RAND_MAX
93.234 +#if __INT_MAX__ == 32767
93.235 +#define __RAND_MAX 32767
93.236 +#else
93.237 +#define __RAND_MAX 0x7fffffff
93.238 +#endif
93.239 +
93.240 +#if defined(__CYGWIN__)
93.241 +#include <cygwin/config.h>
93.242 +#endif
93.243 +
93.244 +#if defined(__rtems__)
93.245 +#define __FILENAME_MAX__ 255
93.246 +#define _READ_WRITE_RETURN_TYPE _ssize_t
93.247 +#define __DYNAMIC_REENT__
93.248 +#define _REENT_GLOBAL_ATEXIT
93.249 +#define _REENT_GLOBAL_STDIO_STREAMS
93.250 +#endif
93.251 +
93.252 +#ifndef __EXPORT
93.253 +#define __EXPORT
93.254 +#endif
93.255 +
93.256 +#ifndef __IMPORT
93.257 +#define __IMPORT
93.258 +#endif
93.259 +
93.260 +/* Define return type of read/write routines. In POSIX, the return type
93.261 + for read()/write() is "ssize_t" but legacy newlib code has been using
93.262 + "int" for some time. If not specified, "int" is defaulted. */
93.263 +#ifndef _READ_WRITE_RETURN_TYPE
93.264 +#define _READ_WRITE_RETURN_TYPE int
93.265 +#endif
93.266 +/* Define `count' parameter of read/write routines. In POSIX, the `count'
93.267 + parameter is "size_t" but legacy newlib code has been using "int" for some
93.268 + time. If not specified, "int" is defaulted. */
93.269 +#ifndef _READ_WRITE_BUFSIZE_TYPE
93.270 +#define _READ_WRITE_BUFSIZE_TYPE int
93.271 +#endif
93.272 +
93.273 +#ifndef __WCHAR_MAX__
93.274 +#if __INT_MAX__ == 32767 || defined (_WIN32)
93.275 +#define __WCHAR_MAX__ 0xffffu
93.276 +#endif
93.277 +#endif
93.278 +
93.279 +/* See if small reent asked for at configuration time and
93.280 + is not chosen by the platform by default. */
93.281 +#ifdef _WANT_REENT_SMALL
93.282 +#ifndef _REENT_SMALL
93.283 +#define _REENT_SMALL
93.284 +#endif
93.285 +#endif
93.286 +
93.287 +#ifdef _WANT_REENT_GLOBAL_STDIO_STREAMS
93.288 +#ifndef _REENT_GLOBAL_STDIO_STREAMS
93.289 +#define _REENT_GLOBAL_STDIO_STREAMS
93.290 +#endif
93.291 +#endif
93.292 +
93.293 +#ifdef _WANT_USE_LONG_TIME_T
93.294 +#ifndef _USE_LONG_TIME_T
93.295 +#define _USE_LONG_TIME_T
93.296 +#endif
93.297 +#endif
93.298 +
93.299 +/* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
93.300 + charsets. The extended charsets add a few functions and a couple
93.301 + of tables of a few K each. */
93.302 +#ifdef _MB_EXTENDED_CHARSETS_ALL
93.303 +#define _MB_EXTENDED_CHARSETS_ISO 1
93.304 +#define _MB_EXTENDED_CHARSETS_WINDOWS 1
93.305 +#endif
93.306 +
93.307 +#endif /* __SYS_CONFIG_H__ */
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
94.2 +++ b/include/sys/custom_file.h Mon Oct 21 16:11:07 2019 +0200
94.3 @@ -0,0 +1,2 @@
94.4 +#error System-specific custom_file.h is missing.
94.5 +
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
95.2 +++ b/include/sys/dir.h Mon Oct 21 16:11:07 2019 +0200
95.3 @@ -0,0 +1,10 @@
95.4 +/* BSD predecessor of POSIX.1 <dirent.h> and struct dirent */
95.5 +
95.6 +#ifndef _SYS_DIR_H_
95.7 +#define _SYS_DIR_H_
95.8 +
95.9 +#include <dirent.h>
95.10 +
95.11 +#define direct dirent
95.12 +
95.13 +#endif /*_SYS_DIR_H_*/
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
96.2 +++ b/include/sys/dirent.h Mon Oct 21 16:11:07 2019 +0200
96.3 @@ -0,0 +1,13 @@
96.4 +/* <dirent.h> includes <sys/dirent.h>, which is this file. On a
96.5 + system which supports <dirent.h>, this file is overridden by
96.6 + dirent.h in the libc/sys/.../sys directory. On a system which does
96.7 + not support <dirent.h>, we will get this file which uses #error to force
96.8 + an error. */
96.9 +
96.10 +#ifdef __cplusplus
96.11 +extern "C" {
96.12 +#endif
96.13 +#error "<dirent.h> not supported"
96.14 +#ifdef __cplusplus
96.15 +}
96.16 +#endif
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
97.2 +++ b/include/sys/errno.h Mon Oct 21 16:11:07 2019 +0200
97.3 @@ -0,0 +1,192 @@
97.4 +/* errno is not a global variable, because that would make using it
97.5 + non-reentrant. Instead, its address is returned by the function
97.6 + __errno. */
97.7 +
97.8 +#ifndef _SYS_ERRNO_H_
97.9 +#ifdef __cplusplus
97.10 +extern "C" {
97.11 +#endif
97.12 +#define _SYS_ERRNO_H_
97.13 +
97.14 +#include <sys/reent.h>
97.15 +
97.16 +#ifndef _REENT_ONLY
97.17 +#define errno (*__errno())
97.18 +extern int *__errno (void);
97.19 +#endif
97.20 +
97.21 +/* Please don't use these variables directly.
97.22 + Use strerror instead. */
97.23 +extern __IMPORT const char * const _sys_errlist[];
97.24 +extern __IMPORT int _sys_nerr;
97.25 +#ifdef __CYGWIN__
97.26 +extern __IMPORT const char * const sys_errlist[];
97.27 +extern __IMPORT int sys_nerr;
97.28 +extern __IMPORT char *program_invocation_name;
97.29 +extern __IMPORT char *program_invocation_short_name;
97.30 +#endif
97.31 +
97.32 +#define __errno_r(ptr) ((ptr)->_errno)
97.33 +
97.34 +#define EPERM 1 /* Not owner */
97.35 +#define ENOENT 2 /* No such file or directory */
97.36 +#define ESRCH 3 /* No such process */
97.37 +#define EINTR 4 /* Interrupted system call */
97.38 +#define EIO 5 /* I/O error */
97.39 +#define ENXIO 6 /* No such device or address */
97.40 +#define E2BIG 7 /* Arg list too long */
97.41 +#define ENOEXEC 8 /* Exec format error */
97.42 +#define EBADF 9 /* Bad file number */
97.43 +#define ECHILD 10 /* No children */
97.44 +#define EAGAIN 11 /* No more processes */
97.45 +#define ENOMEM 12 /* Not enough space */
97.46 +#define EACCES 13 /* Permission denied */
97.47 +#define EFAULT 14 /* Bad address */
97.48 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.49 +#define ENOTBLK 15 /* Block device required */
97.50 +#endif
97.51 +#define EBUSY 16 /* Device or resource busy */
97.52 +#define EEXIST 17 /* File exists */
97.53 +#define EXDEV 18 /* Cross-device link */
97.54 +#define ENODEV 19 /* No such device */
97.55 +#define ENOTDIR 20 /* Not a directory */
97.56 +#define EISDIR 21 /* Is a directory */
97.57 +#define EINVAL 22 /* Invalid argument */
97.58 +#define ENFILE 23 /* Too many open files in system */
97.59 +#define EMFILE 24 /* File descriptor value too large */
97.60 +#define ENOTTY 25 /* Not a character device */
97.61 +#define ETXTBSY 26 /* Text file busy */
97.62 +#define EFBIG 27 /* File too large */
97.63 +#define ENOSPC 28 /* No space left on device */
97.64 +#define ESPIPE 29 /* Illegal seek */
97.65 +#define EROFS 30 /* Read-only file system */
97.66 +#define EMLINK 31 /* Too many links */
97.67 +#define EPIPE 32 /* Broken pipe */
97.68 +#define EDOM 33 /* Mathematics argument out of domain of function */
97.69 +#define ERANGE 34 /* Result too large */
97.70 +#define ENOMSG 35 /* No message of desired type */
97.71 +#define EIDRM 36 /* Identifier removed */
97.72 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.73 +#define ECHRNG 37 /* Channel number out of range */
97.74 +#define EL2NSYNC 38 /* Level 2 not synchronized */
97.75 +#define EL3HLT 39 /* Level 3 halted */
97.76 +#define EL3RST 40 /* Level 3 reset */
97.77 +#define ELNRNG 41 /* Link number out of range */
97.78 +#define EUNATCH 42 /* Protocol driver not attached */
97.79 +#define ENOCSI 43 /* No CSI structure available */
97.80 +#define EL2HLT 44 /* Level 2 halted */
97.81 +#endif
97.82 +#define EDEADLK 45 /* Deadlock */
97.83 +#define ENOLCK 46 /* No lock */
97.84 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.85 +#define EBADE 50 /* Invalid exchange */
97.86 +#define EBADR 51 /* Invalid request descriptor */
97.87 +#define EXFULL 52 /* Exchange full */
97.88 +#define ENOANO 53 /* No anode */
97.89 +#define EBADRQC 54 /* Invalid request code */
97.90 +#define EBADSLT 55 /* Invalid slot */
97.91 +#define EDEADLOCK 56 /* File locking deadlock error */
97.92 +#define EBFONT 57 /* Bad font file fmt */
97.93 +#endif
97.94 +#define ENOSTR 60 /* Not a stream */
97.95 +#define ENODATA 61 /* No data (for no delay io) */
97.96 +#define ETIME 62 /* Stream ioctl timeout */
97.97 +#define ENOSR 63 /* No stream resources */
97.98 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.99 +#define ENONET 64 /* Machine is not on the network */
97.100 +#define ENOPKG 65 /* Package not installed */
97.101 +#define EREMOTE 66 /* The object is remote */
97.102 +#endif
97.103 +#define ENOLINK 67 /* Virtual circuit is gone */
97.104 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.105 +#define EADV 68 /* Advertise error */
97.106 +#define ESRMNT 69 /* Srmount error */
97.107 +#define ECOMM 70 /* Communication error on send */
97.108 +#endif
97.109 +#define EPROTO 71 /* Protocol error */
97.110 +#define EMULTIHOP 74 /* Multihop attempted */
97.111 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.112 +#define ELBIN 75 /* Inode is remote (not really error) */
97.113 +#define EDOTDOT 76 /* Cross mount point (not really error) */
97.114 +#endif
97.115 +#define EBADMSG 77 /* Bad message */
97.116 +#define EFTYPE 79 /* Inappropriate file type or format */
97.117 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.118 +#define ENOTUNIQ 80 /* Given log. name not unique */
97.119 +#define EBADFD 81 /* f.d. invalid for this operation */
97.120 +#define EREMCHG 82 /* Remote address changed */
97.121 +#define ELIBACC 83 /* Can't access a needed shared lib */
97.122 +#define ELIBBAD 84 /* Accessing a corrupted shared lib */
97.123 +#define ELIBSCN 85 /* .lib section in a.out corrupted */
97.124 +#define ELIBMAX 86 /* Attempting to link in too many libs */
97.125 +#define ELIBEXEC 87 /* Attempting to exec a shared library */
97.126 +#endif
97.127 +#define ENOSYS 88 /* Function not implemented */
97.128 +#ifdef __CYGWIN__
97.129 +#define ENMFILE 89 /* No more files */
97.130 +#endif
97.131 +#define ENOTEMPTY 90 /* Directory not empty */
97.132 +#define ENAMETOOLONG 91 /* File or path name too long */
97.133 +#define ELOOP 92 /* Too many symbolic links */
97.134 +#define EOPNOTSUPP 95 /* Operation not supported on socket */
97.135 +#define EPFNOSUPPORT 96 /* Protocol family not supported */
97.136 +#define ECONNRESET 104 /* Connection reset by peer */
97.137 +#define ENOBUFS 105 /* No buffer space available */
97.138 +#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
97.139 +#define EPROTOTYPE 107 /* Protocol wrong type for socket */
97.140 +#define ENOTSOCK 108 /* Socket operation on non-socket */
97.141 +#define ENOPROTOOPT 109 /* Protocol not available */
97.142 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.143 +#define ESHUTDOWN 110 /* Can't send after socket shutdown */
97.144 +#endif
97.145 +#define ECONNREFUSED 111 /* Connection refused */
97.146 +#define EADDRINUSE 112 /* Address already in use */
97.147 +#define ECONNABORTED 113 /* Software caused connection abort */
97.148 +#define ENETUNREACH 114 /* Network is unreachable */
97.149 +#define ENETDOWN 115 /* Network interface is not configured */
97.150 +#define ETIMEDOUT 116 /* Connection timed out */
97.151 +#define EHOSTDOWN 117 /* Host is down */
97.152 +#define EHOSTUNREACH 118 /* Host is unreachable */
97.153 +#define EINPROGRESS 119 /* Connection already in progress */
97.154 +#define EALREADY 120 /* Socket already connected */
97.155 +#define EDESTADDRREQ 121 /* Destination address required */
97.156 +#define EMSGSIZE 122 /* Message too long */
97.157 +#define EPROTONOSUPPORT 123 /* Unknown protocol */
97.158 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.159 +#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
97.160 +#endif
97.161 +#define EADDRNOTAVAIL 125 /* Address not available */
97.162 +#define ENETRESET 126 /* Connection aborted by network */
97.163 +#define EISCONN 127 /* Socket is already connected */
97.164 +#define ENOTCONN 128 /* Socket is not connected */
97.165 +#define ETOOMANYREFS 129
97.166 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.167 +#define EPROCLIM 130
97.168 +#define EUSERS 131
97.169 +#endif
97.170 +#define EDQUOT 132
97.171 +#define ESTALE 133
97.172 +#define ENOTSUP 134 /* Not supported */
97.173 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.174 +#define ENOMEDIUM 135 /* No medium (in tape drive) */
97.175 +#endif
97.176 +#ifdef __CYGWIN__
97.177 +#define ENOSHARE 136 /* No such host or network path */
97.178 +#define ECASECLASH 137 /* Filename exists with different case */
97.179 +#endif
97.180 +#define EILSEQ 138 /* Illegal byte sequence */
97.181 +#define EOVERFLOW 139 /* Value too large for defined data type */
97.182 +#define ECANCELED 140 /* Operation canceled */
97.183 +#define ENOTRECOVERABLE 141 /* State not recoverable */
97.184 +#define EOWNERDEAD 142 /* Previous owner died */
97.185 +#ifdef __LINUX_ERRNO_EXTENSIONS__
97.186 +#define ESTRPIPE 143 /* Streams pipe error */
97.187 +#endif
97.188 +#define EWOULDBLOCK EAGAIN /* Operation would block */
97.189 +
97.190 +#define __ELASTERROR 2000 /* Users can add values starting here */
97.191 +
97.192 +#ifdef __cplusplus
97.193 +}
97.194 +#endif
97.195 +#endif /* _SYS_ERRNO_H */
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
98.2 +++ b/include/sys/fcntl.h Mon Oct 21 16:11:07 2019 +0200
98.3 @@ -0,0 +1,4 @@
98.4 +#ifndef _SYS_FCNTL_H_
98.5 +#define _SYS_FCNTL_H_
98.6 +#include <sys/_default_fcntl.h>
98.7 +#endif
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
99.2 +++ b/include/sys/features.h Mon Oct 21 16:11:07 2019 +0200
99.3 @@ -0,0 +1,533 @@
99.4 +/*
99.5 + * Written by Joel Sherrill <joel@OARcorp.com>.
99.6 + *
99.7 + * COPYRIGHT (c) 1989-2014.
99.8 + *
99.9 + * On-Line Applications Research Corporation (OAR).
99.10 + *
99.11 + * Permission to use, copy, modify, and distribute this software for any
99.12 + * purpose without fee is hereby granted, provided that this entire notice
99.13 + * is included in all copies of any software which is or includes a copy
99.14 + * or modification of this software.
99.15 + *
99.16 + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
99.17 + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
99.18 + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
99.19 + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
99.20 + *
99.21 + * $Id$
99.22 + */
99.23 +
99.24 +#ifndef _SYS_FEATURES_H
99.25 +#define _SYS_FEATURES_H
99.26 +
99.27 +#ifdef __cplusplus
99.28 +extern "C" {
99.29 +#endif
99.30 +
99.31 +#include <_newlib_version.h>
99.32 +
99.33 +/* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */
99.34 +#ifndef __GNUC_PREREQ
99.35 +# if defined __GNUC__ && defined __GNUC_MINOR__
99.36 +# define __GNUC_PREREQ(maj, min) \
99.37 + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
99.38 +# else
99.39 +# define __GNUC_PREREQ(maj, min) 0
99.40 +# endif
99.41 +#endif /* __GNUC_PREREQ */
99.42 +/* Version with trailing underscores for BSD compatibility. */
99.43 +#define __GNUC_PREREQ__(ma, mi) __GNUC_PREREQ(ma, mi)
99.44 +
99.45 +
99.46 +/*
99.47 + * Feature test macros control which symbols are exposed by the system
99.48 + * headers. Any of these must be defined before including any headers.
99.49 + *
99.50 + * __STRICT_ANSI__ (defined by gcc -ansi, -std=c90, -std=c99, or -std=c11)
99.51 + * ISO C
99.52 + *
99.53 + * _POSIX_SOURCE (deprecated by _POSIX_C_SOURCE=1)
99.54 + * _POSIX_C_SOURCE >= 1
99.55 + * POSIX.1-1990
99.56 + *
99.57 + * _POSIX_C_SOURCE >= 2
99.58 + * POSIX.2-1992
99.59 + *
99.60 + * _POSIX_C_SOURCE >= 199309L
99.61 + * POSIX.1b-1993 Real-time extensions
99.62 + *
99.63 + * _POSIX_C_SOURCE >= 199506L
99.64 + * POSIX.1c-1995 Threads extensions
99.65 + *
99.66 + * _POSIX_C_SOURCE >= 200112L
99.67 + * POSIX.1-2001 and C99
99.68 + *
99.69 + * _POSIX_C_SOURCE >= 200809L
99.70 + * POSIX.1-2008
99.71 + *
99.72 + * _XOPEN_SOURCE
99.73 + * POSIX.1-1990 and XPG4
99.74 + *
99.75 + * _XOPEN_SOURCE_EXTENDED
99.76 + * SUSv1 (POSIX.2-1992 plus XPG4v2)
99.77 + *
99.78 + * _XOPEN_SOURCE >= 500
99.79 + * SUSv2 (POSIX.1c-1995 plus XSI)
99.80 + *
99.81 + * _XOPEN_SOURCE >= 600
99.82 + * SUSv3 (POSIX.1-2001 plus XSI) and C99
99.83 + *
99.84 + * _XOPEN_SOURCE >= 700
99.85 + * SUSv4 (POSIX.1-2008 plus XSI)
99.86 + *
99.87 + * _ISOC99_SOURCE or gcc -std=c99 or g++
99.88 + * ISO C99
99.89 + *
99.90 + * _ISOC11_SOURCE or gcc -std=c11 or g++ -std=c++11
99.91 + * ISO C11
99.92 + *
99.93 + * _ATFILE_SOURCE (implied by _POSIX_C_SOURCE >= 200809L)
99.94 + * "at" functions
99.95 + *
99.96 + * _LARGEFILE_SOURCE (deprecated by _XOPEN_SOURCE >= 500)
99.97 + * fseeko, ftello
99.98 + *
99.99 + * _GNU_SOURCE
99.100 + * All of the above plus GNU extensions
99.101 + *
99.102 + * _BSD_SOURCE (deprecated by _DEFAULT_SOURCE)
99.103 + * _SVID_SOURCE (deprecated by _DEFAULT_SOURCE)
99.104 + * _DEFAULT_SOURCE (or none of the above)
99.105 + * POSIX-1.2008 with BSD and SVr4 extensions
99.106 + *
99.107 + * _FORTIFY_SOURCE = 1 or 2
99.108 + * Object Size Checking function wrappers
99.109 + */
99.110 +
99.111 +#ifdef _GNU_SOURCE
99.112 +#undef _ATFILE_SOURCE
99.113 +#define _ATFILE_SOURCE 1
99.114 +#undef _DEFAULT_SOURCE
99.115 +#define _DEFAULT_SOURCE 1
99.116 +#undef _ISOC99_SOURCE
99.117 +#define _ISOC99_SOURCE 1
99.118 +#undef _ISOC11_SOURCE
99.119 +#define _ISOC11_SOURCE 1
99.120 +#undef _POSIX_SOURCE
99.121 +#define _POSIX_SOURCE 1
99.122 +#undef _POSIX_C_SOURCE
99.123 +#define _POSIX_C_SOURCE 200809L
99.124 +#undef _XOPEN_SOURCE
99.125 +#define _XOPEN_SOURCE 700
99.126 +#undef _XOPEN_SOURCE_EXTENDED
99.127 +#define _XOPEN_SOURCE_EXTENDED 1
99.128 +#endif /* _GNU_SOURCE */
99.129 +
99.130 +#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \
99.131 + (!defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE) && \
99.132 + !defined(_ISOC99_SOURCE) && !defined(_POSIX_SOURCE) && \
99.133 + !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
99.134 +#undef _DEFAULT_SOURCE
99.135 +#define _DEFAULT_SOURCE 1
99.136 +#endif
99.137 +
99.138 +#if defined(_DEFAULT_SOURCE)
99.139 +#undef _POSIX_SOURCE
99.140 +#define _POSIX_SOURCE 1
99.141 +#undef _POSIX_C_SOURCE
99.142 +#define _POSIX_C_SOURCE 200809L
99.143 +#endif
99.144 +
99.145 +#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
99.146 + ((!defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE)) || \
99.147 + (_XOPEN_SOURCE - 0) >= 500)
99.148 +#define _POSIX_SOURCE 1
99.149 +#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 700
99.150 +#define _POSIX_C_SOURCE 200809L
99.151 +#elif (_XOPEN_SOURCE - 0) >= 600
99.152 +#define _POSIX_C_SOURCE 200112L
99.153 +#elif (_XOPEN_SOURCE - 0) >= 500
99.154 +#define _POSIX_C_SOURCE 199506L
99.155 +#elif (_XOPEN_SOURCE - 0) < 500
99.156 +#define _POSIX_C_SOURCE 2
99.157 +#endif
99.158 +#endif
99.159 +
99.160 +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809
99.161 +#undef _ATFILE_SOURCE
99.162 +#define _ATFILE_SOURCE 1
99.163 +#endif
99.164 +
99.165 +/*
99.166 + * The following private macros are used throughout the headers to control
99.167 + * which symbols should be exposed. They are for internal use only, as
99.168 + * indicated by the leading double underscore, and must never be used outside
99.169 + * of these headers.
99.170 + *
99.171 + * __POSIX_VISIBLE
99.172 + * any version of POSIX.1; enabled by default, or with _POSIX_SOURCE,
99.173 + * any value of _POSIX_C_SOURCE, or _XOPEN_SOURCE >= 500.
99.174 + *
99.175 + * __POSIX_VISIBLE >= 2
99.176 + * POSIX.2-1992; enabled by default, with _POSIX_C_SOURCE >= 2,
99.177 + * or _XOPEN_SOURCE >= 500.
99.178 + *
99.179 + * __POSIX_VISIBLE >= 199309
99.180 + * POSIX.1b-1993; enabled by default, with _POSIX_C_SOURCE >= 199309L,
99.181 + * or _XOPEN_SOURCE >= 500.
99.182 + *
99.183 + * __POSIX_VISIBLE >= 199506
99.184 + * POSIX.1c-1995; enabled by default, with _POSIX_C_SOURCE >= 199506L,
99.185 + * or _XOPEN_SOURCE >= 500.
99.186 + *
99.187 + * __POSIX_VISIBLE >= 200112
99.188 + * POSIX.1-2001; enabled by default, with _POSIX_C_SOURCE >= 200112L,
99.189 + * or _XOPEN_SOURCE >= 600.
99.190 + *
99.191 + * __POSIX_VISIBLE >= 200809
99.192 + * POSIX.1-2008; enabled by default, with _POSIX_C_SOURCE >= 200809L,
99.193 + * or _XOPEN_SOURCE >= 700.
99.194 + *
99.195 + * __XSI_VISIBLE
99.196 + * XPG4 XSI extensions; enabled with any version of _XOPEN_SOURCE.
99.197 + *
99.198 + * __XSI_VISIBLE >= 4
99.199 + * SUSv1 XSI extensions; enabled with both _XOPEN_SOURCE and
99.200 + * _XOPEN_SOURCE_EXTENDED together.
99.201 + *
99.202 + * __XSI_VISIBLE >= 500
99.203 + * SUSv2 XSI extensions; enabled with _XOPEN_SOURCE >= 500.
99.204 + *
99.205 + * __XSI_VISIBLE >= 600
99.206 + * SUSv3 XSI extensions; enabled with _XOPEN_SOURCE >= 600.
99.207 + *
99.208 + * __XSI_VISIBLE >= 700
99.209 + * SUSv4 XSI extensions; enabled with _XOPEN_SOURCE >= 700.
99.210 + *
99.211 + * __ISO_C_VISIBLE >= 1999
99.212 + * ISO C99; enabled with gcc -std=c99 or newer (on by default since GCC 5),
99.213 + * any version of C++, or with _ISOC99_SOURCE, _POSIX_C_SOURCE >= 200112L,
99.214 + * or _XOPEN_SOURCE >= 600.
99.215 + *
99.216 + * __ISO_C_VISIBLE >= 2011
99.217 + * ISO C11; enabled with gcc -std=c11 or newer (on by default since GCC 5),
99.218 + * g++ -std=c++11 or newer (on by default since GCC 6), or with
99.219 + * _ISOC11_SOURCE.
99.220 + *
99.221 + * __ATFILE_VISIBLE
99.222 + * "at" functions; enabled by default, with _ATFILE_SOURCE,
99.223 + * _POSIX_C_SOURCE >= 200809L, or _XOPEN_SOURCE >= 700.
99.224 + *
99.225 + * __LARGEFILE_VISIBLE
99.226 + * fseeko, ftello; enabled with _LARGEFILE_SOURCE or _XOPEN_SOURCE >= 500.
99.227 + *
99.228 + * __BSD_VISIBLE
99.229 + * BSD extensions; enabled by default, or with _BSD_SOURCE.
99.230 + *
99.231 + * __SVID_VISIBLE
99.232 + * SVr4 extensions; enabled by default, or with _SVID_SOURCE.
99.233 + *
99.234 + * __MISC_VISIBLE
99.235 + * Extensions found in both BSD and SVr4 (shorthand for
99.236 + * (__BSD_VISIBLE || __SVID_VISIBLE)), or newlib-specific
99.237 + * extensions; enabled by default.
99.238 + *
99.239 + * __GNU_VISIBLE
99.240 + * GNU extensions; enabled with _GNU_SOURCE.
99.241 + *
99.242 + * __SSP_FORTIFY_LEVEL
99.243 + * Object Size Checking; defined to 0 (off), 1, or 2.
99.244 + *
99.245 + * In all cases above, "enabled by default" means either by defining
99.246 + * _DEFAULT_SOURCE, or by not defining any of the public feature test macros.
99.247 + */
99.248 +
99.249 +#ifdef _ATFILE_SOURCE
99.250 +#define __ATFILE_VISIBLE 1
99.251 +#else
99.252 +#define __ATFILE_VISIBLE 0
99.253 +#endif
99.254 +
99.255 +#ifdef _DEFAULT_SOURCE
99.256 +#define __BSD_VISIBLE 1
99.257 +#else
99.258 +#define __BSD_VISIBLE 0
99.259 +#endif
99.260 +
99.261 +#ifdef _GNU_SOURCE
99.262 +#define __GNU_VISIBLE 1
99.263 +#else
99.264 +#define __GNU_VISIBLE 0
99.265 +#endif
99.266 +
99.267 +#if defined(_ISOC11_SOURCE) || \
99.268 + (__STDC_VERSION__ - 0) >= 201112L || (__cplusplus - 0) >= 201103L
99.269 +#define __ISO_C_VISIBLE 2011
99.270 +#elif defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) >= 200112L || \
99.271 + (__STDC_VERSION__ - 0) >= 199901L || defined(__cplusplus)
99.272 +#define __ISO_C_VISIBLE 1999
99.273 +#else
99.274 +#define __ISO_C_VISIBLE 1990
99.275 +#endif
99.276 +
99.277 +#if defined(_LARGEFILE_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
99.278 +#define __LARGEFILE_VISIBLE 1
99.279 +#else
99.280 +#define __LARGEFILE_VISIBLE 0
99.281 +#endif
99.282 +
99.283 +#ifdef _DEFAULT_SOURCE
99.284 +#define __MISC_VISIBLE 1
99.285 +#else
99.286 +#define __MISC_VISIBLE 0
99.287 +#endif
99.288 +
99.289 +#if (_POSIX_C_SOURCE - 0) >= 200809L
99.290 +#define __POSIX_VISIBLE 200809
99.291 +#elif (_POSIX_C_SOURCE - 0) >= 200112L
99.292 +#define __POSIX_VISIBLE 200112
99.293 +#elif (_POSIX_C_SOURCE - 0) >= 199506L
99.294 +#define __POSIX_VISIBLE 199506
99.295 +#elif (_POSIX_C_SOURCE - 0) >= 199309L
99.296 +#define __POSIX_VISIBLE 199309
99.297 +#elif (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE)
99.298 +#define __POSIX_VISIBLE 199209
99.299 +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)
99.300 +#define __POSIX_VISIBLE 199009
99.301 +#else
99.302 +#define __POSIX_VISIBLE 0
99.303 +#endif
99.304 +
99.305 +#ifdef _DEFAULT_SOURCE
99.306 +#define __SVID_VISIBLE 1
99.307 +#else
99.308 +#define __SVID_VISIBLE 0
99.309 +#endif
99.310 +
99.311 +#if (_XOPEN_SOURCE - 0) >= 700
99.312 +#define __XSI_VISIBLE 700
99.313 +#elif (_XOPEN_SOURCE - 0) >= 600
99.314 +#define __XSI_VISIBLE 600
99.315 +#elif (_XOPEN_SOURCE - 0) >= 500
99.316 +#define __XSI_VISIBLE 500
99.317 +#elif defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)
99.318 +#define __XSI_VISIBLE 4
99.319 +#elif defined(_XOPEN_SOURCE)
99.320 +#define __XSI_VISIBLE 1
99.321 +#else
99.322 +#define __XSI_VISIBLE 0
99.323 +#endif
99.324 +
99.325 +#if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \
99.326 + (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
99.327 +# if _FORTIFY_SOURCE > 1
99.328 +# define __SSP_FORTIFY_LEVEL 2
99.329 +# else
99.330 +# define __SSP_FORTIFY_LEVEL 1
99.331 +# endif
99.332 +#else
99.333 +# define __SSP_FORTIFY_LEVEL 0
99.334 +#endif
99.335 +
99.336 +/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
99.337 +
99.338 +#ifdef __rtems__
99.339 +#define _POSIX_JOB_CONTROL 1
99.340 +#define _POSIX_SAVED_IDS 1
99.341 +#define _POSIX_VERSION 199309L
99.342 +#define _POSIX_ASYNCHRONOUS_IO 1
99.343 +#define _POSIX_FSYNC 1
99.344 +#define _POSIX_MAPPED_FILES 1
99.345 +#define _POSIX_MEMLOCK 1
99.346 +#define _POSIX_MEMLOCK_RANGE 1
99.347 +#define _POSIX_MEMORY_PROTECTION 1
99.348 +#define _POSIX_MESSAGE_PASSING 1
99.349 +#define _POSIX_MONOTONIC_CLOCK 200112L
99.350 +#define _POSIX_CLOCK_SELECTION 200112L
99.351 +#define _POSIX_PRIORITIZED_IO 1
99.352 +#define _POSIX_PRIORITY_SCHEDULING 1
99.353 +#define _POSIX_REALTIME_SIGNALS 1
99.354 +#define _POSIX_SEMAPHORES 1
99.355 +#define _POSIX_SHARED_MEMORY_OBJECTS 1
99.356 +#define _POSIX_SYNCHRONIZED_IO 1
99.357 +#define _POSIX_TIMERS 1
99.358 +#define _POSIX_BARRIERS 200112L
99.359 +#define _POSIX_READER_WRITER_LOCKS 200112L
99.360 +#define _POSIX_SPIN_LOCKS 200112L
99.361 +
99.362 +
99.363 +/* In P1003.1b but defined by drafts at least as early as P1003.1c/D10 */
99.364 +#define _POSIX_THREADS 1
99.365 +#define _POSIX_THREAD_ATTR_STACKADDR 1
99.366 +#define _POSIX_THREAD_ATTR_STACKSIZE 1
99.367 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
99.368 +#define _POSIX_THREAD_PRIO_INHERIT 1
99.369 +#define _POSIX_THREAD_PRIO_PROTECT 1
99.370 +#define _POSIX_THREAD_PROCESS_SHARED 1
99.371 +#define _POSIX_THREAD_SAFE_FUNCTIONS 1
99.372 +
99.373 +/* P1003.4b/D8 defines the constants below this comment. */
99.374 +#define _POSIX_SPAWN 1
99.375 +#define _POSIX_TIMEOUTS 1
99.376 +#define _POSIX_CPUTIME 1
99.377 +#define _POSIX_THREAD_CPUTIME 1
99.378 +#define _POSIX_SPORADIC_SERVER 1
99.379 +#define _POSIX_THREAD_SPORADIC_SERVER 1
99.380 +#define _POSIX_DEVICE_CONTROL 1
99.381 +#define _POSIX_DEVCTL_DIRECTION 1
99.382 +#define _POSIX_INTERRUPT_CONTROL 1
99.383 +#define _POSIX_ADVISORY_INFO 1
99.384 +
99.385 +/* UNIX98 added some new pthread mutex attributes */
99.386 +#define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
99.387 +
99.388 +/* POSIX 1003.26-2003 defined device control method */
99.389 +#define _POSIX_26_VERSION 200312L
99.390 +
99.391 +#endif
99.392 +
99.393 +/* XMK loosely adheres to POSIX -- 1003.1 */
99.394 +#ifdef __XMK__
99.395 +#define _POSIX_THREADS 1
99.396 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
99.397 +#endif
99.398 +
99.399 +
99.400 +#ifdef __svr4__
99.401 +# define _POSIX_JOB_CONTROL 1
99.402 +# define _POSIX_SAVED_IDS 1
99.403 +# define _POSIX_VERSION 199009L
99.404 +#endif
99.405 +
99.406 +#ifdef __CYGWIN__
99.407 +
99.408 +#if __POSIX_VISIBLE >= 200809
99.409 +#define _POSIX_VERSION 200809L
99.410 +#define _POSIX2_VERSION 200809L
99.411 +#elif __POSIX_VISIBLE >= 200112
99.412 +#define _POSIX_VERSION 200112L
99.413 +#define _POSIX2_VERSION 200112L
99.414 +#elif __POSIX_VISIBLE >= 199506
99.415 +#define _POSIX_VERSION 199506L
99.416 +#define _POSIX2_VERSION 199506L
99.417 +#elif __POSIX_VISIBLE >= 199309
99.418 +#define _POSIX_VERSION 199309L
99.419 +#define _POSIX2_VERSION 199209L
99.420 +#elif __POSIX_VISIBLE >= 199209
99.421 +#define _POSIX_VERSION 199009L
99.422 +#define _POSIX2_VERSION 199209L
99.423 +#elif __POSIX_VISIBLE
99.424 +#define _POSIX_VERSION 199009L
99.425 +#endif
99.426 +#if __XSI_VISIBLE >= 4
99.427 +#define _XOPEN_VERSION __XSI_VISIBLE
99.428 +#endif
99.429 +
99.430 +#define _POSIX_ADVISORY_INFO 200809L
99.431 +#define _POSIX_ASYNCHRONOUS_IO 200809L
99.432 +#define _POSIX_BARRIERS 200809L
99.433 +#define _POSIX_CHOWN_RESTRICTED 1
99.434 +#define _POSIX_CLOCK_SELECTION 200809L
99.435 +#define _POSIX_CPUTIME 200809L
99.436 +#define _POSIX_FSYNC 200809L
99.437 +#define _POSIX_IPV6 200809L
99.438 +#define _POSIX_JOB_CONTROL 1
99.439 +#define _POSIX_MAPPED_FILES 200809L
99.440 +/* #define _POSIX_MEMLOCK -1 */
99.441 +#define _POSIX_MEMLOCK_RANGE 200809L
99.442 +#define _POSIX_MEMORY_PROTECTION 200809L
99.443 +#define _POSIX_MESSAGE_PASSING 200809L
99.444 +#define _POSIX_MONOTONIC_CLOCK 200809L
99.445 +#define _POSIX_NO_TRUNC 1
99.446 +/* #define _POSIX_PRIORITIZED_IO -1 */
99.447 +#define _POSIX_PRIORITY_SCHEDULING 200809L
99.448 +#define _POSIX_RAW_SOCKETS 200809L
99.449 +#define _POSIX_READER_WRITER_LOCKS 200809L
99.450 +#define _POSIX_REALTIME_SIGNALS 200809L
99.451 +#define _POSIX_REGEXP 1
99.452 +#define _POSIX_SAVED_IDS 1
99.453 +#define _POSIX_SEMAPHORES 200809L
99.454 +#define _POSIX_SHARED_MEMORY_OBJECTS 200809L
99.455 +#define _POSIX_SHELL 1
99.456 +#define _POSIX_SPAWN 200809L
99.457 +#define _POSIX_SPIN_LOCKS 200809L
99.458 +/* #define _POSIX_SPORADIC_SERVER -1 */
99.459 +#define _POSIX_SYNCHRONIZED_IO 200809L
99.460 +#define _POSIX_THREAD_ATTR_STACKADDR 200809L
99.461 +#define _POSIX_THREAD_ATTR_STACKSIZE 200809L
99.462 +#define _POSIX_THREAD_CPUTIME 200809L
99.463 +/* #define _POSIX_THREAD_PRIO_INHERIT -1 */
99.464 +/* #define _POSIX_THREAD_PRIO_PROTECT -1 */
99.465 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L
99.466 +#define _POSIX_THREAD_PROCESS_SHARED 200809L
99.467 +#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
99.468 +/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */
99.469 +#define _POSIX_THREADS 200809L
99.470 +#define _POSIX_TIMEOUTS 200809L
99.471 +#define _POSIX_TIMERS 200809L
99.472 +/* #define _POSIX_TRACE -1 */
99.473 +/* #define _POSIX_TRACE_EVENT_FILTER -1 */
99.474 +/* #define _POSIX_TRACE_INHERIT -1 */
99.475 +/* #define _POSIX_TRACE_LOG -1 */
99.476 +/* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */
99.477 +#define _POSIX_VDISABLE '\0'
99.478 +
99.479 +#if __POSIX_VISIBLE >= 2
99.480 +#define _POSIX2_C_VERSION _POSIX2_VERSION
99.481 +#define _POSIX2_C_BIND _POSIX2_VERSION
99.482 +#define _POSIX2_C_DEV _POSIX2_VERSION
99.483 +#define _POSIX2_CHAR_TERM _POSIX2_VERSION
99.484 +/* #define _POSIX2_FORT_DEV -1 */
99.485 +/* #define _POSIX2_FORT_RUN -1 */
99.486 +/* #define _POSIX2_LOCALEDEF -1 */
99.487 +/* #define _POSIX2_PBS -1 */
99.488 +/* #define _POSIX2_PBS_ACCOUNTING -1 */
99.489 +/* #define _POSIX2_PBS_CHECKPOINT -1 */
99.490 +/* #define _POSIX2_PBS_LOCATE -1 */
99.491 +/* #define _POSIX2_PBS_MESSAGE -1 */
99.492 +/* #define _POSIX2_PBS_TRACK -1 */
99.493 +#define _POSIX2_SW_DEV _POSIX2_VERSION
99.494 +#define _POSIX2_UPE _POSIX2_VERSION
99.495 +#endif /* __POSIX_VISIBLE >= 2 */
99.496 +
99.497 +#define _POSIX_V6_ILP32_OFF32 -1
99.498 +#ifdef __LP64__
99.499 +#define _POSIX_V6_ILP32_OFFBIG -1
99.500 +#define _POSIX_V6_LP64_OFF64 1
99.501 +#define _POSIX_V6_LPBIG_OFFBIG 1
99.502 +#else
99.503 +#define _POSIX_V6_ILP32_OFFBIG 1
99.504 +#define _POSIX_V6_LP64_OFF64 -1
99.505 +#define _POSIX_V6_LPBIG_OFFBIG -1
99.506 +#endif
99.507 +#define _POSIX_V7_ILP32_OFF32 _POSIX_V6_ILP32_OFF32
99.508 +#define _POSIX_V7_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG
99.509 +#define _POSIX_V7_LP64_OFF64 _POSIX_V6_LP64_OFF64
99.510 +#define _POSIX_V7_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG
99.511 +#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32
99.512 +#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG
99.513 +#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64
99.514 +#define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG
99.515 +
99.516 +#if __XSI_VISIBLE
99.517 +#define _XOPEN_CRYPT 1
99.518 +#define _XOPEN_ENH_I18N 1
99.519 +/* #define _XOPEN_LEGACY -1 */
99.520 +/* #define _XOPEN_REALTIME -1 */
99.521 +/* #define _XOPEN_REALTIME_THREADS -1 */
99.522 +#define _XOPEN_SHM 1
99.523 +/* #define _XOPEN_STREAMS -1 */
99.524 +/* #define _XOPEN_UNIX -1 */
99.525 +#endif /* __XSI_VISIBLE */
99.526 +
99.527 +/* The value corresponds to UNICODE version 5.2, which is the current
99.528 + state of newlib's wide char conversion functions. */
99.529 +#define __STDC_ISO_10646__ 200910L
99.530 +
99.531 +#endif /* __CYGWIN__ */
99.532 +
99.533 +#ifdef __cplusplus
99.534 +}
99.535 +#endif
99.536 +#endif /* _SYS_FEATURES_H */
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
100.2 +++ b/include/sys/fenv.h Mon Oct 21 16:11:07 2019 +0200
100.3 @@ -0,0 +1,113 @@
100.4 +/*
100.5 + (c) Copyright 2019 Joel Sherrill <joel@rtems.org
100.6 + (c) Copyright 2019 Craig Howlang <craig.howland@caci.com>
100.7 + All rights reserved.
100.8 +
100.9 + Redistribution and use in source and binary forms, with or without
100.10 + modification, are permitted provided that the following conditions
100.11 + are met:
100.12 +
100.13 + 1. Redistributions of source code must retain the above copyright
100.14 + notice, this list of conditions and the following disclaimer.
100.15 +
100.16 + 2. Redistributions in binary form must reproduce the above copyright
100.17 + notice, this list of conditions and the following disclaimer in the
100.18 + documentation and/or other materials provided with the distribution.
100.19 +
100.20 + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
100.21 + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
100.22 + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
100.23 + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
100.24 + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
100.25 + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
100.26 + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
100.27 + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
100.28 + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
100.29 + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
100.30 + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100.31 +*/
100.32 +
100.33 +#ifndef _SYS_FENV_H_
100.34 +#define _SYS_FENV_H_
100.35 +
100.36 +/*******************************************************************************
100.37 + * THIS FILE IS A TEMPLATE, INTENDED TO BE USED AS A STARTING POINT FOR
100.38 + * TARGET-SPECIFIC FLOATING-POINT IMPLEMENTATIONS. NOTES BELOW HIGHLIGHT THE
100.39 + * BASICS OF WHAT NEEDS TO BE DEFINED. THE DEFAULT IMPLEMTATION IS
100.40 + * DEGENERATE, WITH ALL FUNCTIONS RETURNING ERROR AND NO EXCEPTIONS AND NO
100.41 + * ROUNDING MODES DEFINED (SINCE NONE ARE SUPPORTED).
100.42 + * THE MACRO VALUES ARE EXAMPLES ONLY, ALTHOUGH TAKEN FROM A WORKING
100.43 + * IMPLEMENTATION.
100.44 + * REMOVE THIS NOTICE WHEN COPYING TO A REAL IMPLEMENTATION, REPLACING IT WITH
100.45 + * ANY TARGET-SPECIFIC NOTES OF INTEREST. THE FENV FUNCTION MAN PAGES POINT TO
100.46 + * THIS FILE AS A MEANS OF DETERMINING A FUNCTIONAL VS. NON-FUNCTIONAL
100.47 + * IMPLEMENTATION.
100.48 + ******************************************************************************/
100.49 +/*
100.50 + * The following macros are to be defined if the respective exception is
100.51 + * supported by the implementation, each with a unique bit mask:
100.52 + *
100.53 + * FE_DIVBYZERO
100.54 + * FE_INEXACT
100.55 + * FE_INVALID
100.56 + * FE_OVERFLOW
100.57 + * FE_UNDERFLOW
100.58 + *
100.59 + * Other implementation-specific exceptions may be defined, and must start
100.60 + * with FE_ followed by a capital letter.
100.61 + *
100.62 + * FE_ALL_EXCEPT must be defined as the logical OR of all exceptions.
100.63 + */
100.64 +//#define FE_DIVBYZERO 0x00000001
100.65 +//#define FE_INEXACT 0x00000002
100.66 +//#define FE_INVALID 0x00000004
100.67 +//#define FE_OVERFLOW 0x00000008
100.68 +//#define FE_UNDERFLOW 0x00000010
100.69 +
100.70 +//#define FE_ALL_EXCEPT \
100.71 + //(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW)
100.72 +#define FE_ALL_EXCEPT 0 /* NONE SUPPORTED IN PLACEHOLDER TEMPLATE */
100.73 +
100.74 +/*
100.75 + * The following macros are to be defined if the respective rounding
100.76 + * direction is supported by the implementation via the fegetround() and
100.77 + * fesetround() functions, each with a unique positive value.
100.78 + *
100.79 + * FE_DOWNWARD
100.80 + * FE_TONEAREST
100.81 + * FE_TOWARDZERO
100.82 + * FE_UPWARD
100.83 + *
100.84 + * Other implementation-specific rounding modes may be defined, and must start
100.85 + * with FE_ followed by a capital letter.
100.86 + */
100.87 +//#define FE_DOWNWARD 1
100.88 +//#define FE_TONEAREST 2
100.89 +//#define FE_TOWARDZERO 3
100.90 +//#define FE_UPWARD 4
100.91 +
100.92 +/*
100.93 + * The following typedefs are required. These should be defined properly
100.94 + * to support the architecture specific implementation. See the C and
100.95 + * POSIX standards for details:
100.96 + *
100.97 + * fenv_t
100.98 + * fexcept_t
100.99 + */
100.100 +typedef int fenv_t;
100.101 +typedef int fexcept_t;
100.102 +
100.103 +/*
100.104 + * Lastly, a FE_DFL_ENV macro must be defined, representing a pointer
100.105 + * to const fenv_t that contains the value of the default floating point
100.106 + * environment.
100.107 + *
100.108 + * NOTE: The extern'ed variable fe_default_env_p is an implementation
100.109 + * detail of this stub. FE_DFL_ENV must point to an instance of
100.110 + * fenv_t with the default fenv_t. The format of fenv_t and where
100.111 + * FE_DFL_ENV is are implementation specific.
100.112 + */
100.113 +extern const fenv_t *_fe_dfl_env;
100.114 +#define FE_DFL_ENV _fe_dfl_env
100.115 +
100.116 +#endif /* _SYS_FENV_H_ */
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
101.2 +++ b/include/sys/file.h Mon Oct 21 16:11:07 2019 +0200
101.3 @@ -0,0 +1,2 @@
101.4 +
101.5 +#include <sys/fcntl.h>
102.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
102.2 +++ b/include/sys/iconvnls.h Mon Oct 21 16:11:07 2019 +0200
102.3 @@ -0,0 +1,77 @@
102.4 +/*
102.5 + * Copyright (c) 2003-2004, Artem B. Bityuckiy.
102.6 + * Rights transferred to Franklin Electronic Publishers.
102.7 + *
102.8 + * Redistribution and use in source and binary forms, with or without
102.9 + * modification, are permitted provided that the following conditions
102.10 + * are met:
102.11 + * 1. Redistributions of source code must retain the above copyright
102.12 + * notice, this list of conditions and the following disclaimer.
102.13 + * 2. Redistributions in binary form must reproduce the above copyright
102.14 + * notice, this list of conditions and the following disclaimer in the
102.15 + * documentation and/or other materials provided with the distribution.
102.16 + *
102.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
102.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
102.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
102.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
102.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
102.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
102.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
102.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
102.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
102.27 + * SUCH DAMAGE.
102.28 + */
102.29 +
102.30 +/*
102.31 + * Funtions, macros, etc implimented in iconv library but used by other
102.32 + * NLS-related subsystems too.
102.33 + */
102.34 +#ifndef __SYS_ICONVNLS_H__
102.35 +#define __SYS_ICONVNLS_H__
102.36 +
102.37 +#include <_ansi.h>
102.38 +#include <reent.h>
102.39 +#include <wchar.h>
102.40 +#include <iconv.h>
102.41 +
102.42 +/* Iconv data path environment variable name */
102.43 +#define NLS_ENVVAR_NAME "NLSPATH"
102.44 +/* Default NLSPATH value */
102.45 +#define ICONV_DEFAULT_NLSPATH "/usr/locale"
102.46 +/* Direction markers */
102.47 +#define ICONV_NLS_FROM 0
102.48 +#define ICONV_NLS_TO 1
102.49 +
102.50 +void
102.51 +_iconv_nls_get_state (iconv_t cd, mbstate_t *ps, int direction);
102.52 +
102.53 +int
102.54 +_iconv_nls_set_state (iconv_t cd, mbstate_t *ps, int direction);
102.55 +
102.56 +int
102.57 +_iconv_nls_is_stateful (iconv_t cd, int direction);
102.58 +
102.59 +int
102.60 +_iconv_nls_get_mb_cur_max (iconv_t cd, int direction);
102.61 +
102.62 +size_t
102.63 +_iconv_nls_conv (struct _reent *rptr, iconv_t cd,
102.64 + const char **inbuf, size_t *inbytesleft,
102.65 + char **outbuf, size_t *outbytesleft);
102.66 +
102.67 +const char *
102.68 +_iconv_nls_construct_filename (struct _reent *rptr, const char *file,
102.69 + const char *dir, const char *ext);
102.70 +
102.71 +
102.72 +int
102.73 +_iconv_nls_open (struct _reent *rptr, const char *encoding,
102.74 + iconv_t *towc, iconv_t *fromwc, int flag);
102.75 +
102.76 +char *
102.77 +_iconv_resolve_encoding_name (struct _reent *rptr, const char *ca);
102.78 +
102.79 +#endif /* __SYS_ICONVNLS_H__ */
102.80 +
103.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
103.2 +++ b/include/sys/lock.h Mon Oct 21 16:11:07 2019 +0200
103.3 @@ -0,0 +1,69 @@
103.4 +#ifndef __SYS_LOCK_H__
103.5 +#define __SYS_LOCK_H__
103.6 +
103.7 +/* dummy lock routines for single-threaded aps */
103.8 +
103.9 +#include <newlib.h>
103.10 +#include <_ansi.h>
103.11 +
103.12 +#if !defined(_RETARGETABLE_LOCKING)
103.13 +
103.14 +typedef int _LOCK_T;
103.15 +typedef int _LOCK_RECURSIVE_T;
103.16 +
103.17 +#define __LOCK_INIT(class,lock) static int lock = 0;
103.18 +#define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
103.19 +#define __lock_init(lock) ((void) 0)
103.20 +#define __lock_init_recursive(lock) ((void) 0)
103.21 +#define __lock_close(lock) ((void) 0)
103.22 +#define __lock_close_recursive(lock) ((void) 0)
103.23 +#define __lock_acquire(lock) ((void) 0)
103.24 +#define __lock_acquire_recursive(lock) ((void) 0)
103.25 +#define __lock_try_acquire(lock) ((void) 0)
103.26 +#define __lock_try_acquire_recursive(lock) ((void) 0)
103.27 +#define __lock_release(lock) ((void) 0)
103.28 +#define __lock_release_recursive(lock) ((void) 0)
103.29 +
103.30 +#else
103.31 +
103.32 +#ifdef __cplusplus
103.33 +extern "C" {
103.34 +#endif
103.35 +
103.36 +struct __lock;
103.37 +typedef struct __lock * _LOCK_T;
103.38 +#define _LOCK_RECURSIVE_T _LOCK_T
103.39 +
103.40 +#define __LOCK_INIT(class,lock) extern struct __lock __lock_ ## lock; \
103.41 + class _LOCK_T lock = &__lock_ ## lock
103.42 +#define __LOCK_INIT_RECURSIVE(class,lock) __LOCK_INIT(class,lock)
103.43 +
103.44 +extern void __retarget_lock_init(_LOCK_T *lock);
103.45 +#define __lock_init(lock) __retarget_lock_init(&lock)
103.46 +extern void __retarget_lock_init_recursive(_LOCK_T *lock);
103.47 +#define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock)
103.48 +extern void __retarget_lock_close(_LOCK_T lock);
103.49 +#define __lock_close(lock) __retarget_lock_close(lock)
103.50 +extern void __retarget_lock_close_recursive(_LOCK_T lock);
103.51 +#define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock)
103.52 +extern void __retarget_lock_acquire(_LOCK_T lock);
103.53 +#define __lock_acquire(lock) __retarget_lock_acquire(lock)
103.54 +extern void __retarget_lock_acquire_recursive(_LOCK_T lock);
103.55 +#define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock)
103.56 +extern int __retarget_lock_try_acquire(_LOCK_T lock);
103.57 +#define __lock_try_acquire(lock) __retarget_lock_try_acquire(lock)
103.58 +extern int __retarget_lock_try_acquire_recursive(_LOCK_T lock);
103.59 +#define __lock_try_acquire_recursive(lock) \
103.60 + __retarget_lock_try_acquire_recursive(lock)
103.61 +extern void __retarget_lock_release(_LOCK_T lock);
103.62 +#define __lock_release(lock) __retarget_lock_release(lock)
103.63 +extern void __retarget_lock_release_recursive(_LOCK_T lock);
103.64 +#define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock)
103.65 +
103.66 +#ifdef __cplusplus
103.67 +}
103.68 +#endif
103.69 +
103.70 +#endif /* !defined(_RETARGETABLE_LOCKING) */
103.71 +
103.72 +#endif /* __SYS_LOCK_H__ */
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
104.2 +++ b/include/sys/param.h Mon Oct 21 16:11:07 2019 +0200
104.3 @@ -0,0 +1,35 @@
104.4 +/* This is a dummy <sys/param.h> file, not customized for any
104.5 + particular system. If there is a param.h in libc/sys/SYSDIR/sys,
104.6 + it will override this one. */
104.7 +
104.8 +#ifndef _SYS_PARAM_H
104.9 +# define _SYS_PARAM_H
104.10 +
104.11 +#include <sys/config.h>
104.12 +#include <sys/syslimits.h>
104.13 +#include <machine/endian.h>
104.14 +#include <machine/param.h>
104.15 +
104.16 +#ifndef NBBY
104.17 +# define NBBY 8 /* number of bits in a byte */
104.18 +#endif
104.19 +#ifndef HZ
104.20 +# define HZ (60)
104.21 +#endif
104.22 +#ifndef NOFILE
104.23 +# define NOFILE (60)
104.24 +#endif
104.25 +#ifndef PATHSIZE
104.26 +# define PATHSIZE (1024)
104.27 +#endif
104.28 +
104.29 +#define MAXPATHLEN PATH_MAX
104.30 +
104.31 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
104.32 +#define MIN(a,b) ((a) < (b) ? (a) : (b))
104.33 +
104.34 +#ifndef howmany
104.35 +#define howmany(x, y) (((x)+((y)-1))/(y))
104.36 +#endif
104.37 +
104.38 +#endif
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
105.2 +++ b/include/sys/queue.h Mon Oct 21 16:11:07 2019 +0200
105.3 @@ -0,0 +1,919 @@
105.4 +/*-
105.5 + * Copyright (c) 1991, 1993
105.6 + * The Regents of the University of California. All rights reserved.
105.7 + *
105.8 + * Redistribution and use in source and binary forms, with or without
105.9 + * modification, are permitted provided that the following conditions
105.10 + * are met:
105.11 + * 1. Redistributions of source code must retain the above copyright
105.12 + * notice, this list of conditions and the following disclaimer.
105.13 + * 2. Redistributions in binary form must reproduce the above copyright
105.14 + * notice, this list of conditions and the following disclaimer in the
105.15 + * documentation and/or other materials provided with the distribution.
105.16 + * 3. Neither the name of the University nor the names of its contributors
105.17 + * may be used to endorse or promote products derived from this software
105.18 + * without specific prior written permission.
105.19 + *
105.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
105.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
105.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
105.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
105.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
105.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
105.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
105.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
105.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
105.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
105.30 + * SUCH DAMAGE.
105.31 + *
105.32 + * @(#)queue.h 8.5 (Berkeley) 8/20/94
105.33 + * $FreeBSD$
105.34 + */
105.35 +
105.36 +#ifndef _SYS_QUEUE_H_
105.37 +#define _SYS_QUEUE_H_
105.38 +
105.39 +#include <sys/cdefs.h>
105.40 +
105.41 +/*
105.42 + * This file defines four types of data structures: singly-linked lists,
105.43 + * singly-linked tail queues, lists and tail queues.
105.44 + *
105.45 + * A singly-linked list is headed by a single forward pointer. The elements
105.46 + * are singly linked for minimum space and pointer manipulation overhead at
105.47 + * the expense of O(n) removal for arbitrary elements. New elements can be
105.48 + * added to the list after an existing element or at the head of the list.
105.49 + * Elements being removed from the head of the list should use the explicit
105.50 + * macro for this purpose for optimum efficiency. A singly-linked list may
105.51 + * only be traversed in the forward direction. Singly-linked lists are ideal
105.52 + * for applications with large datasets and few or no removals or for
105.53 + * implementing a LIFO queue.
105.54 + *
105.55 + * A singly-linked tail queue is headed by a pair of pointers, one to the
105.56 + * head of the list and the other to the tail of the list. The elements are
105.57 + * singly linked for minimum space and pointer manipulation overhead at the
105.58 + * expense of O(n) removal for arbitrary elements. New elements can be added
105.59 + * to the list after an existing element, at the head of the list, or at the
105.60 + * end of the list. Elements being removed from the head of the tail queue
105.61 + * should use the explicit macro for this purpose for optimum efficiency.
105.62 + * A singly-linked tail queue may only be traversed in the forward direction.
105.63 + * Singly-linked tail queues are ideal for applications with large datasets
105.64 + * and few or no removals or for implementing a FIFO queue.
105.65 + *
105.66 + * A list is headed by a single forward pointer (or an array of forward
105.67 + * pointers for a hash table header). The elements are doubly linked
105.68 + * so that an arbitrary element can be removed without a need to
105.69 + * traverse the list. New elements can be added to the list before
105.70 + * or after an existing element or at the head of the list. A list
105.71 + * may be traversed in either direction.
105.72 + *
105.73 + * A tail queue is headed by a pair of pointers, one to the head of the
105.74 + * list and the other to the tail of the list. The elements are doubly
105.75 + * linked so that an arbitrary element can be removed without a need to
105.76 + * traverse the list. New elements can be added to the list before or
105.77 + * after an existing element, at the head of the list, or at the end of
105.78 + * the list. A tail queue may be traversed in either direction.
105.79 + *
105.80 + * For details on the use of these macros, see the queue(3) manual page.
105.81 + *
105.82 + * Below is a summary of implemented functions where:
105.83 + * + means the macro is available
105.84 + * - means the macro is not available
105.85 + * s means the macro is available but is slow (runs in O(n) time)
105.86 + *
105.87 + * SLIST LIST STAILQ TAILQ
105.88 + * _HEAD + + + +
105.89 + * _CLASS_HEAD + + + +
105.90 + * _HEAD_INITIALIZER + + + +
105.91 + * _ENTRY + + + +
105.92 + * _CLASS_ENTRY + + + +
105.93 + * _INIT + + + +
105.94 + * _EMPTY + + + +
105.95 + * _FIRST + + + +
105.96 + * _NEXT + + + +
105.97 + * _PREV - + - +
105.98 + * _LAST - - + +
105.99 + * _LAST_FAST - - - +
105.100 + * _FOREACH + + + +
105.101 + * _FOREACH_FROM + + + +
105.102 + * _FOREACH_SAFE + + + +
105.103 + * _FOREACH_FROM_SAFE + + + +
105.104 + * _FOREACH_REVERSE - - - +
105.105 + * _FOREACH_REVERSE_FROM - - - +
105.106 + * _FOREACH_REVERSE_SAFE - - - +
105.107 + * _FOREACH_REVERSE_FROM_SAFE - - - +
105.108 + * _INSERT_HEAD + + + +
105.109 + * _INSERT_BEFORE - + - +
105.110 + * _INSERT_AFTER + + + +
105.111 + * _INSERT_TAIL - - + +
105.112 + * _CONCAT s s + +
105.113 + * _REMOVE_AFTER + - + -
105.114 + * _REMOVE_HEAD + - + -
105.115 + * _REMOVE s + s +
105.116 + * _SWAP + + + +
105.117 + *
105.118 + */
105.119 +#ifdef QUEUE_MACRO_DEBUG
105.120 +#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH
105.121 +#define QUEUE_MACRO_DEBUG_TRACE
105.122 +#define QUEUE_MACRO_DEBUG_TRASH
105.123 +#endif
105.124 +
105.125 +#ifdef QUEUE_MACRO_DEBUG_TRACE
105.126 +/* Store the last 2 places the queue element or head was altered */
105.127 +struct qm_trace {
105.128 + unsigned long lastline;
105.129 + unsigned long prevline;
105.130 + const char *lastfile;
105.131 + const char *prevfile;
105.132 +};
105.133 +
105.134 +#define TRACEBUF struct qm_trace trace;
105.135 +#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
105.136 +
105.137 +#define QMD_TRACE_HEAD(head) do { \
105.138 + (head)->trace.prevline = (head)->trace.lastline; \
105.139 + (head)->trace.prevfile = (head)->trace.lastfile; \
105.140 + (head)->trace.lastline = __LINE__; \
105.141 + (head)->trace.lastfile = __FILE__; \
105.142 +} while (0)
105.143 +
105.144 +#define QMD_TRACE_ELEM(elem) do { \
105.145 + (elem)->trace.prevline = (elem)->trace.lastline; \
105.146 + (elem)->trace.prevfile = (elem)->trace.lastfile; \
105.147 + (elem)->trace.lastline = __LINE__; \
105.148 + (elem)->trace.lastfile = __FILE__; \
105.149 +} while (0)
105.150 +
105.151 +#else /* !QUEUE_MACRO_DEBUG_TRACE */
105.152 +#define QMD_TRACE_ELEM(elem)
105.153 +#define QMD_TRACE_HEAD(head)
105.154 +#define TRACEBUF
105.155 +#define TRACEBUF_INITIALIZER
105.156 +#endif /* QUEUE_MACRO_DEBUG_TRACE */
105.157 +
105.158 +#ifdef QUEUE_MACRO_DEBUG_TRASH
105.159 +#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
105.160 +#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1)
105.161 +#else /* !QUEUE_MACRO_DEBUG_TRASH */
105.162 +#define TRASHIT(x)
105.163 +#define QMD_IS_TRASHED(x) 0
105.164 +#endif /* QUEUE_MACRO_DEBUG_TRASH */
105.165 +
105.166 +#if defined(QUEUE_MACRO_DEBUG_TRACE) || defined(QUEUE_MACRO_DEBUG_TRASH)
105.167 +#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
105.168 +#else /* !QUEUE_MACRO_DEBUG_TRACE && !QUEUE_MACRO_DEBUG_TRASH */
105.169 +#define QMD_SAVELINK(name, link)
105.170 +#endif /* QUEUE_MACRO_DEBUG_TRACE || QUEUE_MACRO_DEBUG_TRASH */
105.171 +
105.172 +#ifdef __cplusplus
105.173 +/*
105.174 + * In C++ there can be structure lists and class lists:
105.175 + */
105.176 +#define QUEUE_TYPEOF(type) type
105.177 +#else
105.178 +#define QUEUE_TYPEOF(type) struct type
105.179 +#endif
105.180 +
105.181 +/*
105.182 + * Singly-linked List declarations.
105.183 + */
105.184 +#define SLIST_HEAD(name, type) \
105.185 +struct name { \
105.186 + struct type *slh_first; /* first element */ \
105.187 +}
105.188 +
105.189 +#define SLIST_CLASS_HEAD(name, type) \
105.190 +struct name { \
105.191 + class type *slh_first; /* first element */ \
105.192 +}
105.193 +
105.194 +#define SLIST_HEAD_INITIALIZER(head) \
105.195 + { NULL }
105.196 +
105.197 +#define SLIST_ENTRY(type) \
105.198 +struct { \
105.199 + struct type *sle_next; /* next element */ \
105.200 +}
105.201 +
105.202 +#define SLIST_CLASS_ENTRY(type) \
105.203 +struct { \
105.204 + class type *sle_next; /* next element */ \
105.205 +}
105.206 +
105.207 +/*
105.208 + * Singly-linked List functions.
105.209 + */
105.210 +#if (defined(_KERNEL) && defined(INVARIANTS))
105.211 +#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \
105.212 + if (*(prevp) != (elm)) \
105.213 + panic("Bad prevptr *(%p) == %p != %p", \
105.214 + (prevp), *(prevp), (elm)); \
105.215 +} while (0)
105.216 +#else
105.217 +#define QMD_SLIST_CHECK_PREVPTR(prevp, elm)
105.218 +#endif
105.219 +
105.220 +#define SLIST_CONCAT(head1, head2, type, field) do { \
105.221 + QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \
105.222 + if (curelm == NULL) { \
105.223 + if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
105.224 + SLIST_INIT(head2); \
105.225 + } else if (SLIST_FIRST(head2) != NULL) { \
105.226 + while (SLIST_NEXT(curelm, field) != NULL) \
105.227 + curelm = SLIST_NEXT(curelm, field); \
105.228 + SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \
105.229 + SLIST_INIT(head2); \
105.230 + } \
105.231 +} while (0)
105.232 +
105.233 +#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
105.234 +
105.235 +#define SLIST_FIRST(head) ((head)->slh_first)
105.236 +
105.237 +#define SLIST_FOREACH(var, head, field) \
105.238 + for ((var) = SLIST_FIRST((head)); \
105.239 + (var); \
105.240 + (var) = SLIST_NEXT((var), field))
105.241 +
105.242 +#define SLIST_FOREACH_FROM(var, head, field) \
105.243 + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
105.244 + (var); \
105.245 + (var) = SLIST_NEXT((var), field))
105.246 +
105.247 +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
105.248 + for ((var) = SLIST_FIRST((head)); \
105.249 + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
105.250 + (var) = (tvar))
105.251 +
105.252 +#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
105.253 + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
105.254 + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
105.255 + (var) = (tvar))
105.256 +
105.257 +#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
105.258 + for ((varp) = &SLIST_FIRST((head)); \
105.259 + ((var) = *(varp)) != NULL; \
105.260 + (varp) = &SLIST_NEXT((var), field))
105.261 +
105.262 +#define SLIST_INIT(head) do { \
105.263 + SLIST_FIRST((head)) = NULL; \
105.264 +} while (0)
105.265 +
105.266 +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
105.267 + SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
105.268 + SLIST_NEXT((slistelm), field) = (elm); \
105.269 +} while (0)
105.270 +
105.271 +#define SLIST_INSERT_HEAD(head, elm, field) do { \
105.272 + SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
105.273 + SLIST_FIRST((head)) = (elm); \
105.274 +} while (0)
105.275 +
105.276 +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
105.277 +
105.278 +#define SLIST_REMOVE(head, elm, type, field) do { \
105.279 + QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
105.280 + if (SLIST_FIRST((head)) == (elm)) { \
105.281 + SLIST_REMOVE_HEAD((head), field); \
105.282 + } \
105.283 + else { \
105.284 + QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \
105.285 + while (SLIST_NEXT(curelm, field) != (elm)) \
105.286 + curelm = SLIST_NEXT(curelm, field); \
105.287 + SLIST_REMOVE_AFTER(curelm, field); \
105.288 + } \
105.289 + TRASHIT(*oldnext); \
105.290 +} while (0)
105.291 +
105.292 +#define SLIST_REMOVE_AFTER(elm, field) do { \
105.293 + SLIST_NEXT(elm, field) = \
105.294 + SLIST_NEXT(SLIST_NEXT(elm, field), field); \
105.295 +} while (0)
105.296 +
105.297 +#define SLIST_REMOVE_HEAD(head, field) do { \
105.298 + SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
105.299 +} while (0)
105.300 +
105.301 +#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \
105.302 + QMD_SLIST_CHECK_PREVPTR(prevp, elm); \
105.303 + *(prevp) = SLIST_NEXT(elm, field); \
105.304 + TRASHIT((elm)->field.sle_next); \
105.305 +} while (0)
105.306 +
105.307 +#define SLIST_SWAP(head1, head2, type) do { \
105.308 + QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \
105.309 + SLIST_FIRST(head1) = SLIST_FIRST(head2); \
105.310 + SLIST_FIRST(head2) = swap_first; \
105.311 +} while (0)
105.312 +
105.313 +/*
105.314 + * Singly-linked Tail queue declarations.
105.315 + */
105.316 +#define STAILQ_HEAD(name, type) \
105.317 +struct name { \
105.318 + struct type *stqh_first;/* first element */ \
105.319 + struct type **stqh_last;/* addr of last next element */ \
105.320 +}
105.321 +
105.322 +#define STAILQ_CLASS_HEAD(name, type) \
105.323 +struct name { \
105.324 + class type *stqh_first; /* first element */ \
105.325 + class type **stqh_last; /* addr of last next element */ \
105.326 +}
105.327 +
105.328 +#define STAILQ_HEAD_INITIALIZER(head) \
105.329 + { NULL, &(head).stqh_first }
105.330 +
105.331 +#define STAILQ_ENTRY(type) \
105.332 +struct { \
105.333 + struct type *stqe_next; /* next element */ \
105.334 +}
105.335 +
105.336 +#define STAILQ_CLASS_ENTRY(type) \
105.337 +struct { \
105.338 + class type *stqe_next; /* next element */ \
105.339 +}
105.340 +
105.341 +/*
105.342 + * Singly-linked Tail queue functions.
105.343 + */
105.344 +#define STAILQ_CONCAT(head1, head2) do { \
105.345 + if (!STAILQ_EMPTY((head2))) { \
105.346 + *(head1)->stqh_last = (head2)->stqh_first; \
105.347 + (head1)->stqh_last = (head2)->stqh_last; \
105.348 + STAILQ_INIT((head2)); \
105.349 + } \
105.350 +} while (0)
105.351 +
105.352 +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
105.353 +
105.354 +#define STAILQ_FIRST(head) ((head)->stqh_first)
105.355 +
105.356 +#define STAILQ_FOREACH(var, head, field) \
105.357 + for((var) = STAILQ_FIRST((head)); \
105.358 + (var); \
105.359 + (var) = STAILQ_NEXT((var), field))
105.360 +
105.361 +#define STAILQ_FOREACH_FROM(var, head, field) \
105.362 + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
105.363 + (var); \
105.364 + (var) = STAILQ_NEXT((var), field))
105.365 +
105.366 +#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
105.367 + for ((var) = STAILQ_FIRST((head)); \
105.368 + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
105.369 + (var) = (tvar))
105.370 +
105.371 +#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
105.372 + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
105.373 + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
105.374 + (var) = (tvar))
105.375 +
105.376 +#define STAILQ_INIT(head) do { \
105.377 + STAILQ_FIRST((head)) = NULL; \
105.378 + (head)->stqh_last = &STAILQ_FIRST((head)); \
105.379 +} while (0)
105.380 +
105.381 +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
105.382 + if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
105.383 + (head)->stqh_last = &STAILQ_NEXT((elm), field); \
105.384 + STAILQ_NEXT((tqelm), field) = (elm); \
105.385 +} while (0)
105.386 +
105.387 +#define STAILQ_INSERT_HEAD(head, elm, field) do { \
105.388 + if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
105.389 + (head)->stqh_last = &STAILQ_NEXT((elm), field); \
105.390 + STAILQ_FIRST((head)) = (elm); \
105.391 +} while (0)
105.392 +
105.393 +#define STAILQ_INSERT_TAIL(head, elm, field) do { \
105.394 + STAILQ_NEXT((elm), field) = NULL; \
105.395 + *(head)->stqh_last = (elm); \
105.396 + (head)->stqh_last = &STAILQ_NEXT((elm), field); \
105.397 +} while (0)
105.398 +
105.399 +#define STAILQ_LAST(head, type, field) \
105.400 + (STAILQ_EMPTY((head)) ? NULL : \
105.401 + __containerof((head)->stqh_last, \
105.402 + QUEUE_TYPEOF(type), field.stqe_next))
105.403 +
105.404 +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
105.405 +
105.406 +#define STAILQ_REMOVE(head, elm, type, field) do { \
105.407 + QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
105.408 + if (STAILQ_FIRST((head)) == (elm)) { \
105.409 + STAILQ_REMOVE_HEAD((head), field); \
105.410 + } \
105.411 + else { \
105.412 + QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \
105.413 + while (STAILQ_NEXT(curelm, field) != (elm)) \
105.414 + curelm = STAILQ_NEXT(curelm, field); \
105.415 + STAILQ_REMOVE_AFTER(head, curelm, field); \
105.416 + } \
105.417 + TRASHIT(*oldnext); \
105.418 +} while (0)
105.419 +
105.420 +#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
105.421 + if ((STAILQ_NEXT(elm, field) = \
105.422 + STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
105.423 + (head)->stqh_last = &STAILQ_NEXT((elm), field); \
105.424 +} while (0)
105.425 +
105.426 +#define STAILQ_REMOVE_HEAD(head, field) do { \
105.427 + if ((STAILQ_FIRST((head)) = \
105.428 + STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
105.429 + (head)->stqh_last = &STAILQ_FIRST((head)); \
105.430 +} while (0)
105.431 +
105.432 +#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
105.433 + if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
105.434 + (head)->stqh_last = &STAILQ_FIRST((head)); \
105.435 +} while (0)
105.436 +
105.437 +#define STAILQ_SWAP(head1, head2, type) do { \
105.438 + QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
105.439 + QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
105.440 + STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
105.441 + (head1)->stqh_last = (head2)->stqh_last; \
105.442 + STAILQ_FIRST(head2) = swap_first; \
105.443 + (head2)->stqh_last = swap_last; \
105.444 + if (STAILQ_EMPTY(head1)) \
105.445 + (head1)->stqh_last = &STAILQ_FIRST(head1); \
105.446 + if (STAILQ_EMPTY(head2)) \
105.447 + (head2)->stqh_last = &STAILQ_FIRST(head2); \
105.448 +} while (0)
105.449 +
105.450 +
105.451 +/*
105.452 + * List declarations.
105.453 + */
105.454 +#define LIST_HEAD(name, type) \
105.455 +struct name { \
105.456 + struct type *lh_first; /* first element */ \
105.457 +}
105.458 +
105.459 +#define LIST_CLASS_HEAD(name, type) \
105.460 +struct name { \
105.461 + class type *lh_first; /* first element */ \
105.462 +}
105.463 +
105.464 +#define LIST_HEAD_INITIALIZER(head) \
105.465 + { NULL }
105.466 +
105.467 +#define LIST_ENTRY(type) \
105.468 +struct { \
105.469 + struct type *le_next; /* next element */ \
105.470 + struct type **le_prev; /* address of previous next element */ \
105.471 +}
105.472 +
105.473 +#define LIST_CLASS_ENTRY(type) \
105.474 +struct { \
105.475 + class type *le_next; /* next element */ \
105.476 + class type **le_prev; /* address of previous next element */ \
105.477 +}
105.478 +
105.479 +/*
105.480 + * List functions.
105.481 + */
105.482 +
105.483 +#if (defined(_KERNEL) && defined(INVARIANTS))
105.484 +/*
105.485 + * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME)
105.486 + *
105.487 + * If the list is non-empty, validates that the first element of the list
105.488 + * points back at 'head.'
105.489 + */
105.490 +#define QMD_LIST_CHECK_HEAD(head, field) do { \
105.491 + if (LIST_FIRST((head)) != NULL && \
105.492 + LIST_FIRST((head))->field.le_prev != \
105.493 + &LIST_FIRST((head))) \
105.494 + panic("Bad list head %p first->prev != head", (head)); \
105.495 +} while (0)
105.496 +
105.497 +/*
105.498 + * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME)
105.499 + *
105.500 + * If an element follows 'elm' in the list, validates that the next element
105.501 + * points back at 'elm.'
105.502 + */
105.503 +#define QMD_LIST_CHECK_NEXT(elm, field) do { \
105.504 + if (LIST_NEXT((elm), field) != NULL && \
105.505 + LIST_NEXT((elm), field)->field.le_prev != \
105.506 + &((elm)->field.le_next)) \
105.507 + panic("Bad link elm %p next->prev != elm", (elm)); \
105.508 +} while (0)
105.509 +
105.510 +/*
105.511 + * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME)
105.512 + *
105.513 + * Validates that the previous element (or head of the list) points to 'elm.'
105.514 + */
105.515 +#define QMD_LIST_CHECK_PREV(elm, field) do { \
105.516 + if (*(elm)->field.le_prev != (elm)) \
105.517 + panic("Bad link elm %p prev->next != elm", (elm)); \
105.518 +} while (0)
105.519 +#else
105.520 +#define QMD_LIST_CHECK_HEAD(head, field)
105.521 +#define QMD_LIST_CHECK_NEXT(elm, field)
105.522 +#define QMD_LIST_CHECK_PREV(elm, field)
105.523 +#endif /* (_KERNEL && INVARIANTS) */
105.524 +
105.525 +#define LIST_CONCAT(head1, head2, type, field) do { \
105.526 + QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \
105.527 + if (curelm == NULL) { \
105.528 + if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
105.529 + LIST_FIRST(head2)->field.le_prev = \
105.530 + &LIST_FIRST((head1)); \
105.531 + LIST_INIT(head2); \
105.532 + } \
105.533 + } else if (LIST_FIRST(head2) != NULL) { \
105.534 + while (LIST_NEXT(curelm, field) != NULL) \
105.535 + curelm = LIST_NEXT(curelm, field); \
105.536 + LIST_NEXT(curelm, field) = LIST_FIRST(head2); \
105.537 + LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \
105.538 + LIST_INIT(head2); \
105.539 + } \
105.540 +} while (0)
105.541 +
105.542 +#define LIST_EMPTY(head) ((head)->lh_first == NULL)
105.543 +
105.544 +#define LIST_FIRST(head) ((head)->lh_first)
105.545 +
105.546 +#define LIST_FOREACH(var, head, field) \
105.547 + for ((var) = LIST_FIRST((head)); \
105.548 + (var); \
105.549 + (var) = LIST_NEXT((var), field))
105.550 +
105.551 +#define LIST_FOREACH_FROM(var, head, field) \
105.552 + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
105.553 + (var); \
105.554 + (var) = LIST_NEXT((var), field))
105.555 +
105.556 +#define LIST_FOREACH_SAFE(var, head, field, tvar) \
105.557 + for ((var) = LIST_FIRST((head)); \
105.558 + (var) && ((tvar) = LIST_NEXT((var), field), 1); \
105.559 + (var) = (tvar))
105.560 +
105.561 +#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
105.562 + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
105.563 + (var) && ((tvar) = LIST_NEXT((var), field), 1); \
105.564 + (var) = (tvar))
105.565 +
105.566 +#define LIST_INIT(head) do { \
105.567 + LIST_FIRST((head)) = NULL; \
105.568 +} while (0)
105.569 +
105.570 +#define LIST_INSERT_AFTER(listelm, elm, field) do { \
105.571 + QMD_LIST_CHECK_NEXT(listelm, field); \
105.572 + if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
105.573 + LIST_NEXT((listelm), field)->field.le_prev = \
105.574 + &LIST_NEXT((elm), field); \
105.575 + LIST_NEXT((listelm), field) = (elm); \
105.576 + (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
105.577 +} while (0)
105.578 +
105.579 +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
105.580 + QMD_LIST_CHECK_PREV(listelm, field); \
105.581 + (elm)->field.le_prev = (listelm)->field.le_prev; \
105.582 + LIST_NEXT((elm), field) = (listelm); \
105.583 + *(listelm)->field.le_prev = (elm); \
105.584 + (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
105.585 +} while (0)
105.586 +
105.587 +#define LIST_INSERT_HEAD(head, elm, field) do { \
105.588 + QMD_LIST_CHECK_HEAD((head), field); \
105.589 + if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
105.590 + LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
105.591 + LIST_FIRST((head)) = (elm); \
105.592 + (elm)->field.le_prev = &LIST_FIRST((head)); \
105.593 +} while (0)
105.594 +
105.595 +#define LIST_NEXT(elm, field) ((elm)->field.le_next)
105.596 +
105.597 +#define LIST_PREV(elm, head, type, field) \
105.598 + ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
105.599 + __containerof((elm)->field.le_prev, \
105.600 + QUEUE_TYPEOF(type), field.le_next))
105.601 +
105.602 +#define LIST_REMOVE(elm, field) do { \
105.603 + QMD_SAVELINK(oldnext, (elm)->field.le_next); \
105.604 + QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
105.605 + QMD_LIST_CHECK_NEXT(elm, field); \
105.606 + QMD_LIST_CHECK_PREV(elm, field); \
105.607 + if (LIST_NEXT((elm), field) != NULL) \
105.608 + LIST_NEXT((elm), field)->field.le_prev = \
105.609 + (elm)->field.le_prev; \
105.610 + *(elm)->field.le_prev = LIST_NEXT((elm), field); \
105.611 + TRASHIT(*oldnext); \
105.612 + TRASHIT(*oldprev); \
105.613 +} while (0)
105.614 +
105.615 +#define LIST_SWAP(head1, head2, type, field) do { \
105.616 + QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
105.617 + LIST_FIRST((head1)) = LIST_FIRST((head2)); \
105.618 + LIST_FIRST((head2)) = swap_tmp; \
105.619 + if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
105.620 + swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
105.621 + if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
105.622 + swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
105.623 +} while (0)
105.624 +
105.625 +/*
105.626 + * Tail queue declarations.
105.627 + */
105.628 +#define TAILQ_HEAD(name, type) \
105.629 +struct name { \
105.630 + struct type *tqh_first; /* first element */ \
105.631 + struct type **tqh_last; /* addr of last next element */ \
105.632 + TRACEBUF \
105.633 +}
105.634 +
105.635 +#define TAILQ_CLASS_HEAD(name, type) \
105.636 +struct name { \
105.637 + class type *tqh_first; /* first element */ \
105.638 + class type **tqh_last; /* addr of last next element */ \
105.639 + TRACEBUF \
105.640 +}
105.641 +
105.642 +#define TAILQ_HEAD_INITIALIZER(head) \
105.643 + { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
105.644 +
105.645 +#define TAILQ_ENTRY(type) \
105.646 +struct { \
105.647 + struct type *tqe_next; /* next element */ \
105.648 + struct type **tqe_prev; /* address of previous next element */ \
105.649 + TRACEBUF \
105.650 +}
105.651 +
105.652 +#define TAILQ_CLASS_ENTRY(type) \
105.653 +struct { \
105.654 + class type *tqe_next; /* next element */ \
105.655 + class type **tqe_prev; /* address of previous next element */ \
105.656 + TRACEBUF \
105.657 +}
105.658 +
105.659 +/*
105.660 + * Tail queue functions.
105.661 + */
105.662 +#if (defined(_KERNEL) && defined(INVARIANTS))
105.663 +/*
105.664 + * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
105.665 + *
105.666 + * If the tailq is non-empty, validates that the first element of the tailq
105.667 + * points back at 'head.'
105.668 + */
105.669 +#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
105.670 + if (!TAILQ_EMPTY(head) && \
105.671 + TAILQ_FIRST((head))->field.tqe_prev != \
105.672 + &TAILQ_FIRST((head))) \
105.673 + panic("Bad tailq head %p first->prev != head", (head)); \
105.674 +} while (0)
105.675 +
105.676 +/*
105.677 + * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
105.678 + *
105.679 + * Validates that the tail of the tailq is a pointer to pointer to NULL.
105.680 + */
105.681 +#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
105.682 + if (*(head)->tqh_last != NULL) \
105.683 + panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
105.684 +} while (0)
105.685 +
105.686 +/*
105.687 + * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME)
105.688 + *
105.689 + * If an element follows 'elm' in the tailq, validates that the next element
105.690 + * points back at 'elm.'
105.691 + */
105.692 +#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
105.693 + if (TAILQ_NEXT((elm), field) != NULL && \
105.694 + TAILQ_NEXT((elm), field)->field.tqe_prev != \
105.695 + &((elm)->field.tqe_next)) \
105.696 + panic("Bad link elm %p next->prev != elm", (elm)); \
105.697 +} while (0)
105.698 +
105.699 +/*
105.700 + * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME)
105.701 + *
105.702 + * Validates that the previous element (or head of the tailq) points to 'elm.'
105.703 + */
105.704 +#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
105.705 + if (*(elm)->field.tqe_prev != (elm)) \
105.706 + panic("Bad link elm %p prev->next != elm", (elm)); \
105.707 +} while (0)
105.708 +#else
105.709 +#define QMD_TAILQ_CHECK_HEAD(head, field)
105.710 +#define QMD_TAILQ_CHECK_TAIL(head, headname)
105.711 +#define QMD_TAILQ_CHECK_NEXT(elm, field)
105.712 +#define QMD_TAILQ_CHECK_PREV(elm, field)
105.713 +#endif /* (_KERNEL && INVARIANTS) */
105.714 +
105.715 +#define TAILQ_CONCAT(head1, head2, field) do { \
105.716 + if (!TAILQ_EMPTY(head2)) { \
105.717 + *(head1)->tqh_last = (head2)->tqh_first; \
105.718 + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
105.719 + (head1)->tqh_last = (head2)->tqh_last; \
105.720 + TAILQ_INIT((head2)); \
105.721 + QMD_TRACE_HEAD(head1); \
105.722 + QMD_TRACE_HEAD(head2); \
105.723 + } \
105.724 +} while (0)
105.725 +
105.726 +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
105.727 +
105.728 +#define TAILQ_FIRST(head) ((head)->tqh_first)
105.729 +
105.730 +#define TAILQ_FOREACH(var, head, field) \
105.731 + for ((var) = TAILQ_FIRST((head)); \
105.732 + (var); \
105.733 + (var) = TAILQ_NEXT((var), field))
105.734 +
105.735 +#define TAILQ_FOREACH_FROM(var, head, field) \
105.736 + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
105.737 + (var); \
105.738 + (var) = TAILQ_NEXT((var), field))
105.739 +
105.740 +#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
105.741 + for ((var) = TAILQ_FIRST((head)); \
105.742 + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
105.743 + (var) = (tvar))
105.744 +
105.745 +#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
105.746 + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
105.747 + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
105.748 + (var) = (tvar))
105.749 +
105.750 +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
105.751 + for ((var) = TAILQ_LAST((head), headname); \
105.752 + (var); \
105.753 + (var) = TAILQ_PREV((var), headname, field))
105.754 +
105.755 +#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
105.756 + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
105.757 + (var); \
105.758 + (var) = TAILQ_PREV((var), headname, field))
105.759 +
105.760 +#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
105.761 + for ((var) = TAILQ_LAST((head), headname); \
105.762 + (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
105.763 + (var) = (tvar))
105.764 +
105.765 +#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
105.766 + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
105.767 + (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
105.768 + (var) = (tvar))
105.769 +
105.770 +#define TAILQ_INIT(head) do { \
105.771 + TAILQ_FIRST((head)) = NULL; \
105.772 + (head)->tqh_last = &TAILQ_FIRST((head)); \
105.773 + QMD_TRACE_HEAD(head); \
105.774 +} while (0)
105.775 +
105.776 +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
105.777 + QMD_TAILQ_CHECK_NEXT(listelm, field); \
105.778 + if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
105.779 + TAILQ_NEXT((elm), field)->field.tqe_prev = \
105.780 + &TAILQ_NEXT((elm), field); \
105.781 + else { \
105.782 + (head)->tqh_last = &TAILQ_NEXT((elm), field); \
105.783 + QMD_TRACE_HEAD(head); \
105.784 + } \
105.785 + TAILQ_NEXT((listelm), field) = (elm); \
105.786 + (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
105.787 + QMD_TRACE_ELEM(&(elm)->field); \
105.788 + QMD_TRACE_ELEM(&(listelm)->field); \
105.789 +} while (0)
105.790 +
105.791 +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
105.792 + QMD_TAILQ_CHECK_PREV(listelm, field); \
105.793 + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
105.794 + TAILQ_NEXT((elm), field) = (listelm); \
105.795 + *(listelm)->field.tqe_prev = (elm); \
105.796 + (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
105.797 + QMD_TRACE_ELEM(&(elm)->field); \
105.798 + QMD_TRACE_ELEM(&(listelm)->field); \
105.799 +} while (0)
105.800 +
105.801 +#define TAILQ_INSERT_HEAD(head, elm, field) do { \
105.802 + QMD_TAILQ_CHECK_HEAD(head, field); \
105.803 + if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
105.804 + TAILQ_FIRST((head))->field.tqe_prev = \
105.805 + &TAILQ_NEXT((elm), field); \
105.806 + else \
105.807 + (head)->tqh_last = &TAILQ_NEXT((elm), field); \
105.808 + TAILQ_FIRST((head)) = (elm); \
105.809 + (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
105.810 + QMD_TRACE_HEAD(head); \
105.811 + QMD_TRACE_ELEM(&(elm)->field); \
105.812 +} while (0)
105.813 +
105.814 +#define TAILQ_INSERT_TAIL(head, elm, field) do { \
105.815 + QMD_TAILQ_CHECK_TAIL(head, field); \
105.816 + TAILQ_NEXT((elm), field) = NULL; \
105.817 + (elm)->field.tqe_prev = (head)->tqh_last; \
105.818 + *(head)->tqh_last = (elm); \
105.819 + (head)->tqh_last = &TAILQ_NEXT((elm), field); \
105.820 + QMD_TRACE_HEAD(head); \
105.821 + QMD_TRACE_ELEM(&(elm)->field); \
105.822 +} while (0)
105.823 +
105.824 +#define TAILQ_LAST(head, headname) \
105.825 + (*(((struct headname *)((head)->tqh_last))->tqh_last))
105.826 +
105.827 +/*
105.828 + * The FAST function is fast in that it causes no data access other
105.829 + * then the access to the head. The standard LAST function above
105.830 + * will cause a data access of both the element you want and
105.831 + * the previous element. FAST is very useful for instances when
105.832 + * you may want to prefetch the last data element.
105.833 + */
105.834 +#define TAILQ_LAST_FAST(head, type, field) \
105.835 + (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next))
105.836 +
105.837 +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
105.838 +
105.839 +#define TAILQ_PREV(elm, headname, field) \
105.840 + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
105.841 +
105.842 +#define TAILQ_REMOVE(head, elm, field) do { \
105.843 + QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
105.844 + QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
105.845 + QMD_TAILQ_CHECK_NEXT(elm, field); \
105.846 + QMD_TAILQ_CHECK_PREV(elm, field); \
105.847 + if ((TAILQ_NEXT((elm), field)) != NULL) \
105.848 + TAILQ_NEXT((elm), field)->field.tqe_prev = \
105.849 + (elm)->field.tqe_prev; \
105.850 + else { \
105.851 + (head)->tqh_last = (elm)->field.tqe_prev; \
105.852 + QMD_TRACE_HEAD(head); \
105.853 + } \
105.854 + *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
105.855 + TRASHIT(*oldnext); \
105.856 + TRASHIT(*oldprev); \
105.857 + QMD_TRACE_ELEM(&(elm)->field); \
105.858 +} while (0)
105.859 +
105.860 +#define TAILQ_SWAP(head1, head2, type, field) do { \
105.861 + QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
105.862 + QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
105.863 + (head1)->tqh_first = (head2)->tqh_first; \
105.864 + (head1)->tqh_last = (head2)->tqh_last; \
105.865 + (head2)->tqh_first = swap_first; \
105.866 + (head2)->tqh_last = swap_last; \
105.867 + if ((swap_first = (head1)->tqh_first) != NULL) \
105.868 + swap_first->field.tqe_prev = &(head1)->tqh_first; \
105.869 + else \
105.870 + (head1)->tqh_last = &(head1)->tqh_first; \
105.871 + if ((swap_first = (head2)->tqh_first) != NULL) \
105.872 + swap_first->field.tqe_prev = &(head2)->tqh_first; \
105.873 + else \
105.874 + (head2)->tqh_last = &(head2)->tqh_first; \
105.875 +} while (0)
105.876 +
105.877 +#ifdef _KERNEL
105.878 +
105.879 +/*
105.880 + * XXX insque() and remque() are an old way of handling certain queues.
105.881 + * They bogusly assumes that all queue heads look alike.
105.882 + */
105.883 +
105.884 +struct quehead {
105.885 + struct quehead *qh_link;
105.886 + struct quehead *qh_rlink;
105.887 +};
105.888 +
105.889 +#ifdef __GNUC__
105.890 +
105.891 +static __inline void
105.892 +insque(void *a, void *b)
105.893 +{
105.894 + struct quehead *element = (struct quehead *)a,
105.895 + *head = (struct quehead *)b;
105.896 +
105.897 + element->qh_link = head->qh_link;
105.898 + element->qh_rlink = head;
105.899 + head->qh_link = element;
105.900 + element->qh_link->qh_rlink = element;
105.901 +}
105.902 +
105.903 +static __inline void
105.904 +remque(void *a)
105.905 +{
105.906 + struct quehead *element = (struct quehead *)a;
105.907 +
105.908 + element->qh_link->qh_rlink = element->qh_rlink;
105.909 + element->qh_rlink->qh_link = element->qh_link;
105.910 + element->qh_rlink = 0;
105.911 +}
105.912 +
105.913 +#else /* !__GNUC__ */
105.914 +
105.915 +void insque(void *a, void *b);
105.916 +void remque(void *a);
105.917 +
105.918 +#endif /* __GNUC__ */
105.919 +
105.920 +#endif /* _KERNEL */
105.921 +
105.922 +#endif /* !_SYS_QUEUE_H_ */
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
106.2 +++ b/include/sys/reent.h Mon Oct 21 16:11:07 2019 +0200
106.3 @@ -0,0 +1,847 @@
106.4 +/* This header file provides the reentrancy. */
106.5 +
106.6 +/* WARNING: All identifiers here must begin with an underscore. This file is
106.7 + included by stdio.h and others and we therefore must only use identifiers
106.8 + in the namespace allotted to us. */
106.9 +
106.10 +#ifndef _SYS_REENT_H_
106.11 +#ifdef __cplusplus
106.12 +extern "C" {
106.13 +#endif
106.14 +#define _SYS_REENT_H_
106.15 +
106.16 +#include <_ansi.h>
106.17 +#include <stddef.h>
106.18 +#include <sys/_types.h>
106.19 +
106.20 +#define _NULL 0
106.21 +
106.22 +#ifndef __Long
106.23 +#if __LONG_MAX__ == 2147483647L
106.24 +#define __Long long
106.25 +typedef unsigned __Long __ULong;
106.26 +#elif __INT_MAX__ == 2147483647
106.27 +#define __Long int
106.28 +typedef unsigned __Long __ULong;
106.29 +#endif
106.30 +#endif
106.31 +
106.32 +#if !defined( __Long)
106.33 +#include <sys/types.h>
106.34 +#endif
106.35 +
106.36 +#ifndef __machine_flock_t_defined
106.37 +#include <sys/lock.h>
106.38 +typedef _LOCK_RECURSIVE_T _flock_t;
106.39 +#endif
106.40 +
106.41 +#ifndef __Long
106.42 +#define __Long __int32_t
106.43 +typedef __uint32_t __ULong;
106.44 +#endif
106.45 +
106.46 +struct _reent;
106.47 +
106.48 +struct __locale_t;
106.49 +
106.50 +/*
106.51 + * If _REENT_SMALL is defined, we make struct _reent as small as possible,
106.52 + * by having nearly everything possible allocated at first use.
106.53 + */
106.54 +
106.55 +struct _Bigint
106.56 +{
106.57 + struct _Bigint *_next;
106.58 + int _k, _maxwds, _sign, _wds;
106.59 + __ULong _x[1];
106.60 +};
106.61 +
106.62 +/* needed by reentrant structure */
106.63 +struct __tm
106.64 +{
106.65 + int __tm_sec;
106.66 + int __tm_min;
106.67 + int __tm_hour;
106.68 + int __tm_mday;
106.69 + int __tm_mon;
106.70 + int __tm_year;
106.71 + int __tm_wday;
106.72 + int __tm_yday;
106.73 + int __tm_isdst;
106.74 +};
106.75 +
106.76 +/*
106.77 + * atexit() support.
106.78 + */
106.79 +
106.80 +#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
106.81 +
106.82 +struct _on_exit_args {
106.83 + void * _fnargs[_ATEXIT_SIZE]; /* user fn args */
106.84 + void * _dso_handle[_ATEXIT_SIZE];
106.85 + /* Bitmask is set if user function takes arguments. */
106.86 + __ULong _fntypes; /* type of exit routine -
106.87 + Must have at least _ATEXIT_SIZE bits */
106.88 + /* Bitmask is set if function was registered via __cxa_atexit. */
106.89 + __ULong _is_cxa;
106.90 +};
106.91 +
106.92 +#ifdef _REENT_SMALL
106.93 +struct _atexit {
106.94 + struct _atexit *_next; /* next in list */
106.95 + int _ind; /* next index in this table */
106.96 + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
106.97 + struct _on_exit_args * _on_exit_args_ptr;
106.98 +};
106.99 +# define _ATEXIT_INIT {_NULL, 0, {_NULL}, _NULL}
106.100 +#else
106.101 +struct _atexit {
106.102 + struct _atexit *_next; /* next in list */
106.103 + int _ind; /* next index in this table */
106.104 + /* Some entries may already have been called, and will be NULL. */
106.105 + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
106.106 + struct _on_exit_args _on_exit_args;
106.107 +};
106.108 +# define _ATEXIT_INIT {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}
106.109 +#endif
106.110 +
106.111 +#ifdef _REENT_GLOBAL_ATEXIT
106.112 +# define _REENT_INIT_ATEXIT
106.113 +#else
106.114 +# define _REENT_INIT_ATEXIT \
106.115 + _NULL, _ATEXIT_INIT,
106.116 +#endif
106.117 +
106.118 +/*
106.119 + * Stdio buffers.
106.120 + *
106.121 + * This and __FILE are defined here because we need them for struct _reent,
106.122 + * but we don't want stdio.h included when stdlib.h is.
106.123 + */
106.124 +
106.125 +struct __sbuf {
106.126 + unsigned char *_base;
106.127 + int _size;
106.128 +};
106.129 +
106.130 +/*
106.131 + * Stdio state variables.
106.132 + *
106.133 + * The following always hold:
106.134 + *
106.135 + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
106.136 + * _lbfsize is -_bf._size, else _lbfsize is 0
106.137 + * if _flags&__SRD, _w is 0
106.138 + * if _flags&__SWR, _r is 0
106.139 + *
106.140 + * This ensures that the getc and putc macros (or inline functions) never
106.141 + * try to write or read from a file that is in `read' or `write' mode.
106.142 + * (Moreover, they can, and do, automatically switch from read mode to
106.143 + * write mode, and back, on "r+" and "w+" files.)
106.144 + *
106.145 + * _lbfsize is used only to make the inline line-buffered output stream
106.146 + * code as compact as possible.
106.147 + *
106.148 + * _ub, _up, and _ur are used when ungetc() pushes back more characters
106.149 + * than fit in the current _bf, or when ungetc() pushes back a character
106.150 + * that does not match the previous one in _bf. When this happens,
106.151 + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
106.152 + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
106.153 + */
106.154 +
106.155 +#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS)
106.156 +/*
106.157 + * struct __sFILE_fake is the start of a struct __sFILE, with only the
106.158 + * minimal fields allocated. In __sinit() we really allocate the 3
106.159 + * standard streams, etc., and point away from this fake.
106.160 + */
106.161 +struct __sFILE_fake {
106.162 + unsigned char *_p; /* current position in (some) buffer */
106.163 + int _r; /* read space left for getc() */
106.164 + int _w; /* write space left for putc() */
106.165 + short _flags; /* flags, below; this FILE is free if 0 */
106.166 + short _file; /* fileno, if Unix descriptor, else -1 */
106.167 + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
106.168 + int _lbfsize; /* 0 or -_bf._size, for inline putc */
106.169 +
106.170 + struct _reent *_data;
106.171 +};
106.172 +
106.173 +/* Following is needed both in libc/stdio and libc/stdlib so we put it
106.174 + * here instead of libc/stdio/local.h where it was previously. */
106.175 +
106.176 +extern void __sinit (struct _reent *);
106.177 +
106.178 +# define _REENT_SMALL_CHECK_INIT(ptr) \
106.179 + do \
106.180 + { \
106.181 + if ((ptr) && !(ptr)->__sdidinit) \
106.182 + __sinit (ptr); \
106.183 + } \
106.184 + while (0)
106.185 +#else /* _REENT_SMALL && !_REENT_GLOBAL_STDIO_STREAMS */
106.186 +# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
106.187 +#endif /* _REENT_SMALL && !_REENT_GLOBAL_STDIO_STREAMS */
106.188 +
106.189 +struct __sFILE {
106.190 + unsigned char *_p; /* current position in (some) buffer */
106.191 + int _r; /* read space left for getc() */
106.192 + int _w; /* write space left for putc() */
106.193 + short _flags; /* flags, below; this FILE is free if 0 */
106.194 + short _file; /* fileno, if Unix descriptor, else -1 */
106.195 + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
106.196 + int _lbfsize; /* 0 or -_bf._size, for inline putc */
106.197 +
106.198 +#ifdef _REENT_SMALL
106.199 + struct _reent *_data;
106.200 +#endif
106.201 +
106.202 + /* operations */
106.203 + void * _cookie; /* cookie passed to io functions */
106.204 +
106.205 + _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *,
106.206 + char *, _READ_WRITE_BUFSIZE_TYPE);
106.207 + _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *,
106.208 + const char *,
106.209 + _READ_WRITE_BUFSIZE_TYPE);
106.210 + _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int);
106.211 + int (*_close) (struct _reent *, void *);
106.212 +
106.213 + /* separate buffer for long sequences of ungetc() */
106.214 + struct __sbuf _ub; /* ungetc buffer */
106.215 + unsigned char *_up; /* saved _p when _p is doing ungetc data */
106.216 + int _ur; /* saved _r when _r is counting ungetc data */
106.217 +
106.218 + /* tricks to meet minimum requirements even when malloc() fails */
106.219 + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
106.220 + unsigned char _nbuf[1]; /* guarantee a getc() buffer */
106.221 +
106.222 + /* separate buffer for fgetline() when line crosses buffer boundary */
106.223 + struct __sbuf _lb; /* buffer for fgetline() */
106.224 +
106.225 + /* Unix stdio files get aligned to block boundaries on fseek() */
106.226 + int _blksize; /* stat.st_blksize (may be != _bf._size) */
106.227 + _off_t _offset; /* current lseek offset */
106.228 +
106.229 +#ifndef _REENT_SMALL
106.230 + struct _reent *_data; /* Here for binary compatibility? Remove? */
106.231 +#endif
106.232 +
106.233 +#ifndef __SINGLE_THREAD__
106.234 + _flock_t _lock; /* for thread-safety locking */
106.235 +#endif
106.236 + _mbstate_t _mbstate; /* for wide char stdio functions. */
106.237 + int _flags2; /* for future use */
106.238 +};
106.239 +
106.240 +#ifdef __CUSTOM_FILE_IO__
106.241 +
106.242 +/* Get custom _FILE definition. */
106.243 +#include <sys/custom_file.h>
106.244 +
106.245 +#else /* !__CUSTOM_FILE_IO__ */
106.246 +#ifdef __LARGE64_FILES
106.247 +struct __sFILE64 {
106.248 + unsigned char *_p; /* current position in (some) buffer */
106.249 + int _r; /* read space left for getc() */
106.250 + int _w; /* write space left for putc() */
106.251 + short _flags; /* flags, below; this FILE is free if 0 */
106.252 + short _file; /* fileno, if Unix descriptor, else -1 */
106.253 + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
106.254 + int _lbfsize; /* 0 or -_bf._size, for inline putc */
106.255 +
106.256 + struct _reent *_data;
106.257 +
106.258 + /* operations */
106.259 + void * _cookie; /* cookie passed to io functions */
106.260 +
106.261 + _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *,
106.262 + char *, _READ_WRITE_BUFSIZE_TYPE);
106.263 + _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *,
106.264 + const char *,
106.265 + _READ_WRITE_BUFSIZE_TYPE);
106.266 + _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int);
106.267 + int (*_close) (struct _reent *, void *);
106.268 +
106.269 + /* separate buffer for long sequences of ungetc() */
106.270 + struct __sbuf _ub; /* ungetc buffer */
106.271 + unsigned char *_up; /* saved _p when _p is doing ungetc data */
106.272 + int _ur; /* saved _r when _r is counting ungetc data */
106.273 +
106.274 + /* tricks to meet minimum requirements even when malloc() fails */
106.275 + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
106.276 + unsigned char _nbuf[1]; /* guarantee a getc() buffer */
106.277 +
106.278 + /* separate buffer for fgetline() when line crosses buffer boundary */
106.279 + struct __sbuf _lb; /* buffer for fgetline() */
106.280 +
106.281 + /* Unix stdio files get aligned to block boundaries on fseek() */
106.282 + int _blksize; /* stat.st_blksize (may be != _bf._size) */
106.283 + int _flags2; /* for future use */
106.284 +
106.285 + _off64_t _offset; /* current lseek offset */
106.286 + _fpos64_t (*_seek64) (struct _reent *, void *, _fpos64_t, int);
106.287 +
106.288 +#ifndef __SINGLE_THREAD__
106.289 + _flock_t _lock; /* for thread-safety locking */
106.290 +#endif
106.291 + _mbstate_t _mbstate; /* for wide char stdio functions. */
106.292 +};
106.293 +typedef struct __sFILE64 __FILE;
106.294 +#else
106.295 +typedef struct __sFILE __FILE;
106.296 +#endif /* __LARGE64_FILES */
106.297 +#endif /* !__CUSTOM_FILE_IO__ */
106.298 +
106.299 +struct _glue
106.300 +{
106.301 + struct _glue *_next;
106.302 + int _niobs;
106.303 + __FILE *_iobs;
106.304 +};
106.305 +
106.306 +/*
106.307 + * rand48 family support
106.308 + *
106.309 + * Copyright (c) 1993 Martin Birgmeier
106.310 + * All rights reserved.
106.311 + *
106.312 + * You may redistribute unmodified or modified versions of this source
106.313 + * code provided that the above copyright notice and this and the
106.314 + * following conditions are retained.
106.315 + *
106.316 + * This software is provided ``as is'', and comes with no warranties
106.317 + * of any kind. I shall in no event be liable for anything that happens
106.318 + * to anyone/anything when using this software.
106.319 + */
106.320 +#define _RAND48_SEED_0 (0x330e)
106.321 +#define _RAND48_SEED_1 (0xabcd)
106.322 +#define _RAND48_SEED_2 (0x1234)
106.323 +#define _RAND48_MULT_0 (0xe66d)
106.324 +#define _RAND48_MULT_1 (0xdeec)
106.325 +#define _RAND48_MULT_2 (0x0005)
106.326 +#define _RAND48_ADD (0x000b)
106.327 +struct _rand48 {
106.328 + unsigned short _seed[3];
106.329 + unsigned short _mult[3];
106.330 + unsigned short _add;
106.331 +#ifdef _REENT_SMALL
106.332 + /* Put this in here as well, for good luck. */
106.333 + __extension__ unsigned long long _rand_next;
106.334 +#endif
106.335 +};
106.336 +
106.337 +/* How big the some arrays are. */
106.338 +#define _REENT_EMERGENCY_SIZE 25
106.339 +#define _REENT_ASCTIME_SIZE 26
106.340 +#define _REENT_SIGNAL_SIZE 24
106.341 +
106.342 +/*
106.343 + * struct _reent
106.344 + *
106.345 + * This structure contains *all* globals needed by the library.
106.346 + * It's raison d'etre is to facilitate threads by making all library routines
106.347 + * reentrant. IE: All state information is contained here.
106.348 + */
106.349 +
106.350 +#ifdef _REENT_SMALL
106.351 +
106.352 +struct _mprec
106.353 +{
106.354 + /* used by mprec routines */
106.355 + struct _Bigint *_result;
106.356 + int _result_k;
106.357 + struct _Bigint *_p5s;
106.358 + struct _Bigint **_freelist;
106.359 +};
106.360 +
106.361 +
106.362 +struct _misc_reent
106.363 +{
106.364 + /* miscellaneous reentrant data */
106.365 + char *_strtok_last;
106.366 + _mbstate_t _mblen_state;
106.367 + _mbstate_t _wctomb_state;
106.368 + _mbstate_t _mbtowc_state;
106.369 + char _l64a_buf[8];
106.370 + int _getdate_err;
106.371 + _mbstate_t _mbrlen_state;
106.372 + _mbstate_t _mbrtowc_state;
106.373 + _mbstate_t _mbsrtowcs_state;
106.374 + _mbstate_t _wcrtomb_state;
106.375 + _mbstate_t _wcsrtombs_state;
106.376 +};
106.377 +
106.378 +/* This version of _reent is laid out with "int"s in pairs, to help
106.379 + * ports with 16-bit int's but 32-bit pointers, align nicely. */
106.380 +struct _reent
106.381 +{
106.382 + /* As an exception to the above put _errno first for binary
106.383 + compatibility with non _REENT_SMALL targets. */
106.384 + int _errno; /* local copy of errno */
106.385 +
106.386 + /* FILE is a big struct and may change over time. To try to achieve binary
106.387 + compatibility with future versions, put stdin,stdout,stderr here.
106.388 + These are pointers into member __sf defined below. */
106.389 + __FILE *_stdin, *_stdout, *_stderr; /* XXX */
106.390 +
106.391 + int _inc; /* used by tmpnam */
106.392 +
106.393 + char *_emergency;
106.394 +
106.395 + int __sdidinit; /* 1 means stdio has been init'd */
106.396 +
106.397 + int _unspecified_locale_info; /* unused, reserved for locale stuff */
106.398 + struct __locale_t *_locale;/* per-thread locale */
106.399 +
106.400 + struct _mprec *_mp;
106.401 +
106.402 + void (*__cleanup) (struct _reent *);
106.403 +
106.404 + int _gamma_signgam;
106.405 +
106.406 + /* used by some fp conversion routines */
106.407 + int _cvtlen; /* should be size_t */
106.408 + char *_cvtbuf;
106.409 +
106.410 + struct _rand48 *_r48;
106.411 + struct __tm *_localtime_buf;
106.412 + char *_asctime_buf;
106.413 +
106.414 + /* signal info */
106.415 + void (**(_sig_func))(int);
106.416 +
106.417 +# ifndef _REENT_GLOBAL_ATEXIT
106.418 + /* atexit stuff */
106.419 + struct _atexit *_atexit;
106.420 + struct _atexit _atexit0;
106.421 +# endif
106.422 +
106.423 + struct _glue __sglue; /* root of glue chain */
106.424 + __FILE *__sf; /* file descriptors */
106.425 + struct _misc_reent *_misc; /* strtok, multibyte states */
106.426 + char *_signal_buf; /* strsignal */
106.427 +};
106.428 +
106.429 +#ifdef _REENT_GLOBAL_STDIO_STREAMS
106.430 +extern __FILE __sf[3];
106.431 +
106.432 +# define _REENT_INIT(var) \
106.433 + { 0, \
106.434 + &__sf[0], \
106.435 + &__sf[1], \
106.436 + &__sf[2], \
106.437 + 0, \
106.438 + _NULL, \
106.439 + 0, \
106.440 + 0, \
106.441 + _NULL, \
106.442 + _NULL, \
106.443 + _NULL, \
106.444 + 0, \
106.445 + 0, \
106.446 + _NULL, \
106.447 + _NULL, \
106.448 + _NULL, \
106.449 + _NULL, \
106.450 + _NULL, \
106.451 + _REENT_INIT_ATEXIT \
106.452 + {_NULL, 0, _NULL}, \
106.453 + _NULL, \
106.454 + _NULL, \
106.455 + _NULL \
106.456 + }
106.457 +
106.458 +#define _REENT_INIT_PTR_ZEROED(var) \
106.459 + { (var)->_stdin = &__sf[0]; \
106.460 + (var)->_stdout = &__sf[1]; \
106.461 + (var)->_stderr = &__sf[2]; \
106.462 + }
106.463 +
106.464 +#else /* _REENT_GLOBAL_STDIO_STREAMS */
106.465 +
106.466 +extern const struct __sFILE_fake __sf_fake_stdin;
106.467 +extern const struct __sFILE_fake __sf_fake_stdout;
106.468 +extern const struct __sFILE_fake __sf_fake_stderr;
106.469 +
106.470 +# define _REENT_INIT(var) \
106.471 + { 0, \
106.472 + (__FILE *)&__sf_fake_stdin, \
106.473 + (__FILE *)&__sf_fake_stdout, \
106.474 + (__FILE *)&__sf_fake_stderr, \
106.475 + 0, \
106.476 + _NULL, \
106.477 + 0, \
106.478 + 0, \
106.479 + _NULL, \
106.480 + _NULL, \
106.481 + _NULL, \
106.482 + 0, \
106.483 + 0, \
106.484 + _NULL, \
106.485 + _NULL, \
106.486 + _NULL, \
106.487 + _NULL, \
106.488 + _NULL, \
106.489 + _REENT_INIT_ATEXIT \
106.490 + {_NULL, 0, _NULL}, \
106.491 + _NULL, \
106.492 + _NULL, \
106.493 + _NULL \
106.494 + }
106.495 +
106.496 +#define _REENT_INIT_PTR_ZEROED(var) \
106.497 + { (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
106.498 + (var)->_stdout = (__FILE *)&__sf_fake_stdout; \
106.499 + (var)->_stderr = (__FILE *)&__sf_fake_stderr; \
106.500 + }
106.501 +
106.502 +#endif /* _REENT_GLOBAL_STDIO_STREAMS */
106.503 +
106.504 +/* Specify how to handle reent_check malloc failures. */
106.505 +#ifdef _REENT_CHECK_VERIFY
106.506 +#include <assert.h>
106.507 +#define __reent_assert(x) ((x) ? (void)0 : __assert_func(__FILE__, __LINE__, (char *)0, "REENT malloc succeeded"))
106.508 +#else
106.509 +#define __reent_assert(x) ((void)0)
106.510 +#endif
106.511 +
106.512 +#ifdef __CUSTOM_FILE_IO__
106.513 +#error Custom FILE I/O and _REENT_SMALL not currently supported.
106.514 +#endif
106.515 +
106.516 +/* Generic _REENT check macro. */
106.517 +#define _REENT_CHECK(var, what, type, size, init) do { \
106.518 + struct _reent *_r = (var); \
106.519 + if (_r->what == NULL) { \
106.520 + _r->what = (type)malloc(size); \
106.521 + __reent_assert(_r->what); \
106.522 + init; \
106.523 + } \
106.524 +} while (0)
106.525 +
106.526 +#define _REENT_CHECK_TM(var) \
106.527 + _REENT_CHECK(var, _localtime_buf, struct __tm *, sizeof *((var)->_localtime_buf), \
106.528 + /* nothing */)
106.529 +
106.530 +#define _REENT_CHECK_ASCTIME_BUF(var) \
106.531 + _REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \
106.532 + memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE))
106.533 +
106.534 +/* Handle the dynamically allocated rand48 structure. */
106.535 +#define _REENT_INIT_RAND48(var) do { \
106.536 + struct _reent *_r = (var); \
106.537 + _r->_r48->_seed[0] = _RAND48_SEED_0; \
106.538 + _r->_r48->_seed[1] = _RAND48_SEED_1; \
106.539 + _r->_r48->_seed[2] = _RAND48_SEED_2; \
106.540 + _r->_r48->_mult[0] = _RAND48_MULT_0; \
106.541 + _r->_r48->_mult[1] = _RAND48_MULT_1; \
106.542 + _r->_r48->_mult[2] = _RAND48_MULT_2; \
106.543 + _r->_r48->_add = _RAND48_ADD; \
106.544 + _r->_r48->_rand_next = 1; \
106.545 +} while (0)
106.546 +#define _REENT_CHECK_RAND48(var) \
106.547 + _REENT_CHECK(var, _r48, struct _rand48 *, sizeof *((var)->_r48), _REENT_INIT_RAND48((var)))
106.548 +
106.549 +#define _REENT_INIT_MP(var) do { \
106.550 + struct _reent *_r = (var); \
106.551 + _r->_mp->_result_k = 0; \
106.552 + _r->_mp->_result = _r->_mp->_p5s = _NULL; \
106.553 + _r->_mp->_freelist = _NULL; \
106.554 +} while (0)
106.555 +#define _REENT_CHECK_MP(var) \
106.556 + _REENT_CHECK(var, _mp, struct _mprec *, sizeof *((var)->_mp), _REENT_INIT_MP(var))
106.557 +
106.558 +#define _REENT_CHECK_EMERGENCY(var) \
106.559 + _REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
106.560 +
106.561 +#define _REENT_INIT_MISC(var) do { \
106.562 + struct _reent *_r = (var); \
106.563 + _r->_misc->_strtok_last = _NULL; \
106.564 + _r->_misc->_mblen_state.__count = 0; \
106.565 + _r->_misc->_mblen_state.__value.__wch = 0; \
106.566 + _r->_misc->_wctomb_state.__count = 0; \
106.567 + _r->_misc->_wctomb_state.__value.__wch = 0; \
106.568 + _r->_misc->_mbtowc_state.__count = 0; \
106.569 + _r->_misc->_mbtowc_state.__value.__wch = 0; \
106.570 + _r->_misc->_mbrlen_state.__count = 0; \
106.571 + _r->_misc->_mbrlen_state.__value.__wch = 0; \
106.572 + _r->_misc->_mbrtowc_state.__count = 0; \
106.573 + _r->_misc->_mbrtowc_state.__value.__wch = 0; \
106.574 + _r->_misc->_mbsrtowcs_state.__count = 0; \
106.575 + _r->_misc->_mbsrtowcs_state.__value.__wch = 0; \
106.576 + _r->_misc->_wcrtomb_state.__count = 0; \
106.577 + _r->_misc->_wcrtomb_state.__value.__wch = 0; \
106.578 + _r->_misc->_wcsrtombs_state.__count = 0; \
106.579 + _r->_misc->_wcsrtombs_state.__value.__wch = 0; \
106.580 + _r->_misc->_l64a_buf[0] = '\0'; \
106.581 + _r->_misc->_getdate_err = 0; \
106.582 +} while (0)
106.583 +#define _REENT_CHECK_MISC(var) \
106.584 + _REENT_CHECK(var, _misc, struct _misc_reent *, sizeof *((var)->_misc), _REENT_INIT_MISC(var))
106.585 +
106.586 +#define _REENT_CHECK_SIGNAL_BUF(var) \
106.587 + _REENT_CHECK(var, _signal_buf, char *, _REENT_SIGNAL_SIZE, /* nothing */)
106.588 +
106.589 +#define _REENT_SIGNGAM(ptr) ((ptr)->_gamma_signgam)
106.590 +#define _REENT_RAND_NEXT(ptr) ((ptr)->_r48->_rand_next)
106.591 +#define _REENT_RAND48_SEED(ptr) ((ptr)->_r48->_seed)
106.592 +#define _REENT_RAND48_MULT(ptr) ((ptr)->_r48->_mult)
106.593 +#define _REENT_RAND48_ADD(ptr) ((ptr)->_r48->_add)
106.594 +#define _REENT_MP_RESULT(ptr) ((ptr)->_mp->_result)
106.595 +#define _REENT_MP_RESULT_K(ptr) ((ptr)->_mp->_result_k)
106.596 +#define _REENT_MP_P5S(ptr) ((ptr)->_mp->_p5s)
106.597 +#define _REENT_MP_FREELIST(ptr) ((ptr)->_mp->_freelist)
106.598 +#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_asctime_buf)
106.599 +#define _REENT_TM(ptr) ((ptr)->_localtime_buf)
106.600 +#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
106.601 +#define _REENT_STRTOK_LAST(ptr) ((ptr)->_misc->_strtok_last)
106.602 +#define _REENT_MBLEN_STATE(ptr) ((ptr)->_misc->_mblen_state)
106.603 +#define _REENT_MBTOWC_STATE(ptr)((ptr)->_misc->_mbtowc_state)
106.604 +#define _REENT_WCTOMB_STATE(ptr)((ptr)->_misc->_wctomb_state)
106.605 +#define _REENT_MBRLEN_STATE(ptr) ((ptr)->_misc->_mbrlen_state)
106.606 +#define _REENT_MBRTOWC_STATE(ptr) ((ptr)->_misc->_mbrtowc_state)
106.607 +#define _REENT_MBSRTOWCS_STATE(ptr) ((ptr)->_misc->_mbsrtowcs_state)
106.608 +#define _REENT_WCRTOMB_STATE(ptr) ((ptr)->_misc->_wcrtomb_state)
106.609 +#define _REENT_WCSRTOMBS_STATE(ptr) ((ptr)->_misc->_wcsrtombs_state)
106.610 +#define _REENT_L64A_BUF(ptr) ((ptr)->_misc->_l64a_buf)
106.611 +#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_misc->_getdate_err))
106.612 +#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_signal_buf)
106.613 +
106.614 +#else /* !_REENT_SMALL */
106.615 +
106.616 +struct _reent
106.617 +{
106.618 + int _errno; /* local copy of errno */
106.619 +
106.620 + /* FILE is a big struct and may change over time. To try to achieve binary
106.621 + compatibility with future versions, put stdin,stdout,stderr here.
106.622 + These are pointers into member __sf defined below. */
106.623 + __FILE *_stdin, *_stdout, *_stderr;
106.624 +
106.625 + int _inc; /* used by tmpnam */
106.626 + char _emergency[_REENT_EMERGENCY_SIZE];
106.627 +
106.628 + /* TODO */
106.629 + int _unspecified_locale_info; /* unused, reserved for locale stuff */
106.630 + struct __locale_t *_locale;/* per-thread locale */
106.631 +
106.632 + int __sdidinit; /* 1 means stdio has been init'd */
106.633 +
106.634 + void (*__cleanup) (struct _reent *);
106.635 +
106.636 + /* used by mprec routines */
106.637 + struct _Bigint *_result;
106.638 + int _result_k;
106.639 + struct _Bigint *_p5s;
106.640 + struct _Bigint **_freelist;
106.641 +
106.642 + /* used by some fp conversion routines */
106.643 + int _cvtlen; /* should be size_t */
106.644 + char *_cvtbuf;
106.645 +
106.646 + union
106.647 + {
106.648 + struct
106.649 + {
106.650 + unsigned int _unused_rand;
106.651 + char * _strtok_last;
106.652 + char _asctime_buf[_REENT_ASCTIME_SIZE];
106.653 + struct __tm _localtime_buf;
106.654 + int _gamma_signgam;
106.655 + __extension__ unsigned long long _rand_next;
106.656 + struct _rand48 _r48;
106.657 + _mbstate_t _mblen_state;
106.658 + _mbstate_t _mbtowc_state;
106.659 + _mbstate_t _wctomb_state;
106.660 + char _l64a_buf[8];
106.661 + char _signal_buf[_REENT_SIGNAL_SIZE];
106.662 + int _getdate_err;
106.663 + _mbstate_t _mbrlen_state;
106.664 + _mbstate_t _mbrtowc_state;
106.665 + _mbstate_t _mbsrtowcs_state;
106.666 + _mbstate_t _wcrtomb_state;
106.667 + _mbstate_t _wcsrtombs_state;
106.668 + int _h_errno;
106.669 + } _reent;
106.670 + /* Two next two fields were once used by malloc. They are no longer
106.671 + used. They are used to preserve the space used before so as to
106.672 + allow addition of new reent fields and keep binary compatibility. */
106.673 + struct
106.674 + {
106.675 +#define _N_LISTS 30
106.676 + unsigned char * _nextf[_N_LISTS];
106.677 + unsigned int _nmalloc[_N_LISTS];
106.678 + } _unused;
106.679 + } _new;
106.680 +
106.681 +# ifndef _REENT_GLOBAL_ATEXIT
106.682 + /* atexit stuff */
106.683 + struct _atexit *_atexit; /* points to head of LIFO stack */
106.684 + struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
106.685 +# endif
106.686 +
106.687 + /* signal info */
106.688 + void (**(_sig_func))(int);
106.689 +
106.690 + /* These are here last so that __FILE can grow without changing the offsets
106.691 + of the above members (on the off chance that future binary compatibility
106.692 + would be broken otherwise). */
106.693 + struct _glue __sglue; /* root of glue chain */
106.694 +# ifndef _REENT_GLOBAL_STDIO_STREAMS
106.695 + __FILE __sf[3]; /* first three file descriptors */
106.696 +# endif
106.697 +};
106.698 +
106.699 +#ifdef _REENT_GLOBAL_STDIO_STREAMS
106.700 +extern __FILE __sf[3];
106.701 +#define _REENT_STDIO_STREAM(var, index) &__sf[index]
106.702 +#else
106.703 +#define _REENT_STDIO_STREAM(var, index) &(var)->__sf[index]
106.704 +#endif
106.705 +
106.706 +#define _REENT_INIT(var) \
106.707 + { 0, \
106.708 + _REENT_STDIO_STREAM(&(var), 0), \
106.709 + _REENT_STDIO_STREAM(&(var), 1), \
106.710 + _REENT_STDIO_STREAM(&(var), 2), \
106.711 + 0, \
106.712 + "", \
106.713 + 0, \
106.714 + _NULL, \
106.715 + 0, \
106.716 + _NULL, \
106.717 + _NULL, \
106.718 + 0, \
106.719 + _NULL, \
106.720 + _NULL, \
106.721 + 0, \
106.722 + _NULL, \
106.723 + { \
106.724 + { \
106.725 + 0, \
106.726 + _NULL, \
106.727 + "", \
106.728 + {0, 0, 0, 0, 0, 0, 0, 0, 0}, \
106.729 + 0, \
106.730 + 1, \
106.731 + { \
106.732 + {_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
106.733 + {_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, \
106.734 + _RAND48_ADD \
106.735 + }, \
106.736 + {0, {0}}, \
106.737 + {0, {0}}, \
106.738 + {0, {0}}, \
106.739 + "", \
106.740 + "", \
106.741 + 0, \
106.742 + {0, {0}}, \
106.743 + {0, {0}}, \
106.744 + {0, {0}}, \
106.745 + {0, {0}}, \
106.746 + {0, {0}} \
106.747 + } \
106.748 + }, \
106.749 + _REENT_INIT_ATEXIT \
106.750 + _NULL, \
106.751 + {_NULL, 0, _NULL} \
106.752 + }
106.753 +
106.754 +#define _REENT_INIT_PTR_ZEROED(var) \
106.755 + { (var)->_stdin = _REENT_STDIO_STREAM(var, 0); \
106.756 + (var)->_stdout = _REENT_STDIO_STREAM(var, 1); \
106.757 + (var)->_stderr = _REENT_STDIO_STREAM(var, 2); \
106.758 + (var)->_new._reent._rand_next = 1; \
106.759 + (var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
106.760 + (var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
106.761 + (var)->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
106.762 + (var)->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
106.763 + (var)->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
106.764 + (var)->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
106.765 + (var)->_new._reent._r48._add = _RAND48_ADD; \
106.766 + }
106.767 +
106.768 +#define _REENT_CHECK_RAND48(ptr) /* nothing */
106.769 +#define _REENT_CHECK_MP(ptr) /* nothing */
106.770 +#define _REENT_CHECK_TM(ptr) /* nothing */
106.771 +#define _REENT_CHECK_ASCTIME_BUF(ptr) /* nothing */
106.772 +#define _REENT_CHECK_EMERGENCY(ptr) /* nothing */
106.773 +#define _REENT_CHECK_MISC(ptr) /* nothing */
106.774 +#define _REENT_CHECK_SIGNAL_BUF(ptr) /* nothing */
106.775 +
106.776 +#define _REENT_SIGNGAM(ptr) ((ptr)->_new._reent._gamma_signgam)
106.777 +#define _REENT_RAND_NEXT(ptr) ((ptr)->_new._reent._rand_next)
106.778 +#define _REENT_RAND48_SEED(ptr) ((ptr)->_new._reent._r48._seed)
106.779 +#define _REENT_RAND48_MULT(ptr) ((ptr)->_new._reent._r48._mult)
106.780 +#define _REENT_RAND48_ADD(ptr) ((ptr)->_new._reent._r48._add)
106.781 +#define _REENT_MP_RESULT(ptr) ((ptr)->_result)
106.782 +#define _REENT_MP_RESULT_K(ptr) ((ptr)->_result_k)
106.783 +#define _REENT_MP_P5S(ptr) ((ptr)->_p5s)
106.784 +#define _REENT_MP_FREELIST(ptr) ((ptr)->_freelist)
106.785 +#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_new._reent._asctime_buf)
106.786 +#define _REENT_TM(ptr) (&(ptr)->_new._reent._localtime_buf)
106.787 +#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
106.788 +#define _REENT_STRTOK_LAST(ptr) ((ptr)->_new._reent._strtok_last)
106.789 +#define _REENT_MBLEN_STATE(ptr) ((ptr)->_new._reent._mblen_state)
106.790 +#define _REENT_MBTOWC_STATE(ptr)((ptr)->_new._reent._mbtowc_state)
106.791 +#define _REENT_WCTOMB_STATE(ptr)((ptr)->_new._reent._wctomb_state)
106.792 +#define _REENT_MBRLEN_STATE(ptr)((ptr)->_new._reent._mbrlen_state)
106.793 +#define _REENT_MBRTOWC_STATE(ptr)((ptr)->_new._reent._mbrtowc_state)
106.794 +#define _REENT_MBSRTOWCS_STATE(ptr)((ptr)->_new._reent._mbsrtowcs_state)
106.795 +#define _REENT_WCRTOMB_STATE(ptr)((ptr)->_new._reent._wcrtomb_state)
106.796 +#define _REENT_WCSRTOMBS_STATE(ptr)((ptr)->_new._reent._wcsrtombs_state)
106.797 +#define _REENT_L64A_BUF(ptr) ((ptr)->_new._reent._l64a_buf)
106.798 +#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_new._reent._signal_buf)
106.799 +#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_new._reent._getdate_err))
106.800 +
106.801 +#endif /* !_REENT_SMALL */
106.802 +
106.803 +#define _REENT_INIT_PTR(var) \
106.804 + { memset((var), 0, sizeof(*(var))); \
106.805 + _REENT_INIT_PTR_ZEROED(var); \
106.806 + }
106.807 +
106.808 +/* This value is used in stdlib/misc.c. reent/reent.c has to know it
106.809 + as well to make sure the freelist is correctly free'd. Therefore
106.810 + we define it here, rather than in stdlib/misc.c, as before. */
106.811 +#define _Kmax (sizeof (size_t) << 3)
106.812 +
106.813 +/*
106.814 + * All references to struct _reent are via this pointer.
106.815 + * Internally, newlib routines that need to reference it should use _REENT.
106.816 + */
106.817 +
106.818 +#ifndef __ATTRIBUTE_IMPURE_PTR__
106.819 +#define __ATTRIBUTE_IMPURE_PTR__
106.820 +#endif
106.821 +
106.822 +extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
106.823 +extern struct _reent *const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
106.824 +
106.825 +void _reclaim_reent (struct _reent *);
106.826 +
106.827 +/* #define _REENT_ONLY define this to get only reentrant routines */
106.828 +
106.829 +#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
106.830 +#ifndef __getreent
106.831 + struct _reent * __getreent (void);
106.832 +#endif
106.833 +# define _REENT (__getreent())
106.834 +#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
106.835 +# define _REENT _impure_ptr
106.836 +#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
106.837 +
106.838 +#define _GLOBAL_REENT _global_impure_ptr
106.839 +
106.840 +#ifdef _REENT_GLOBAL_ATEXIT
106.841 +extern struct _atexit *_global_atexit; /* points to head of LIFO stack */
106.842 +# define _GLOBAL_ATEXIT _global_atexit
106.843 +#else
106.844 +# define _GLOBAL_ATEXIT (_GLOBAL_REENT->_atexit)
106.845 +#endif
106.846 +
106.847 +#ifdef __cplusplus
106.848 +}
106.849 +#endif
106.850 +#endif /* _SYS_REENT_H_ */
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
107.2 +++ b/include/sys/resource.h Mon Oct 21 16:11:07 2019 +0200
107.3 @@ -0,0 +1,17 @@
107.4 +#ifndef _SYS_RESOURCE_H_
107.5 +#define _SYS_RESOURCE_H_
107.6 +
107.7 +#include <sys/time.h>
107.8 +
107.9 +#define RUSAGE_SELF 0 /* calling process */
107.10 +#define RUSAGE_CHILDREN -1 /* terminated child processes */
107.11 +
107.12 +struct rusage {
107.13 + struct timeval ru_utime; /* user time used */
107.14 + struct timeval ru_stime; /* system time used */
107.15 +};
107.16 +
107.17 +int getrusage (int, struct rusage*);
107.18 +
107.19 +#endif
107.20 +
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108.2 +++ b/include/sys/sched.h Mon Oct 21 16:11:07 2019 +0200
108.3 @@ -0,0 +1,69 @@
108.4 +/*
108.5 + * Written by Joel Sherrill <joel@OARcorp.com>.
108.6 + *
108.7 + * COPYRIGHT (c) 1989-2010.
108.8 + * On-Line Applications Research Corporation (OAR).
108.9 + *
108.10 + * Permission to use, copy, modify, and distribute this software for any
108.11 + * purpose without fee is hereby granted, provided that this entire notice
108.12 + * is included in all copies of any software which is or includes a copy
108.13 + * or modification of this software.
108.14 + *
108.15 + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
108.16 + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
108.17 + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
108.18 + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
108.19 + *
108.20 + * $Id$
108.21 + */
108.22 +
108.23 +
108.24 +#ifndef _SYS_SCHED_H_
108.25 +#define _SYS_SCHED_H_
108.26 +
108.27 +#include <sys/_timespec.h>
108.28 +
108.29 +#ifdef __cplusplus
108.30 +extern "C" {
108.31 +#endif
108.32 +
108.33 +/* Scheduling Policies */
108.34 +/* Open Group Specifications Issue 6 */
108.35 +#if defined(__CYGWIN__)
108.36 +#define SCHED_OTHER 3
108.37 +#else
108.38 +#define SCHED_OTHER 0
108.39 +#endif
108.40 +
108.41 +#define SCHED_FIFO 1
108.42 +#define SCHED_RR 2
108.43 +
108.44 +#if defined(_POSIX_SPORADIC_SERVER)
108.45 +#define SCHED_SPORADIC 4
108.46 +#endif
108.47 +
108.48 +/* Scheduling Parameters */
108.49 +/* Open Group Specifications Issue 6 */
108.50 +
108.51 +struct sched_param {
108.52 + int sched_priority; /* Process execution scheduling priority */
108.53 +
108.54 +#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER)
108.55 + int sched_ss_low_priority; /* Low scheduling priority for sporadic */
108.56 + /* server */
108.57 + struct timespec sched_ss_repl_period;
108.58 + /* Replenishment period for sporadic server */
108.59 + struct timespec sched_ss_init_budget;
108.60 + /* Initial budget for sporadic server */
108.61 + int sched_ss_max_repl; /* Maximum pending replenishments for */
108.62 + /* sporadic server */
108.63 +#endif
108.64 +};
108.65 +
108.66 +#ifdef __cplusplus
108.67 +}
108.68 +#endif
108.69 +
108.70 +#endif
108.71 +/* end of include file */
108.72 +
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
109.2 +++ b/include/sys/select.h Mon Oct 21 16:11:07 2019 +0200
109.3 @@ -0,0 +1,76 @@
109.4 +#ifndef _SYS_SELECT_H
109.5 +#define _SYS_SELECT_H
109.6 +
109.7 +/* We don't define fd_set and friends if we are compiling POSIX
109.8 + source, or if we have included (or may include as indicated
109.9 + by __USE_W32_SOCKETS) the W32api winsock[2].h header which
109.10 + defines Windows versions of them. Note that a program which
109.11 + includes the W32api winsock[2].h header must know what it is doing;
109.12 + it must not call the Cygwin select function.
109.13 +*/
109.14 +# if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
109.15 +
109.16 +#include <sys/cdefs.h>
109.17 +#include <sys/_sigset.h>
109.18 +#include <sys/_timeval.h>
109.19 +#include <sys/timespec.h>
109.20 +
109.21 +#if !defined(_SIGSET_T_DECLARED)
109.22 +#define _SIGSET_T_DECLARED
109.23 +typedef __sigset_t sigset_t;
109.24 +#endif
109.25 +
109.26 +# define _SYS_TYPES_FD_SET
109.27 +/*
109.28 + * Select uses bit masks of file descriptors in longs.
109.29 + * These macros manipulate such bit fields (the filesystem macros use chars).
109.30 + * FD_SETSIZE may be defined by the user, but the default here
109.31 + * should be >= NOFILE (param.h).
109.32 + */
109.33 +# ifndef FD_SETSIZE
109.34 +# define FD_SETSIZE 64
109.35 +# endif
109.36 +
109.37 +typedef unsigned long fd_mask;
109.38 +# define NFDBITS (sizeof (fd_mask) * 8) /* bits per mask */
109.39 +# ifndef _howmany
109.40 +# define _howmany(x,y) (((x)+((y)-1))/(y))
109.41 +# endif
109.42 +
109.43 +/* We use a macro for fd_set so that including Sockets.h afterwards
109.44 + can work. */
109.45 +typedef struct _types_fd_set {
109.46 + fd_mask fds_bits[_howmany(FD_SETSIZE, NFDBITS)];
109.47 +} _types_fd_set;
109.48 +
109.49 +#define fd_set _types_fd_set
109.50 +
109.51 +# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
109.52 +# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
109.53 +# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
109.54 +# define FD_ZERO(p) (__extension__ (void)({ \
109.55 + size_t __i; \
109.56 + char *__tmp = (char *)p; \
109.57 + for (__i = 0; __i < sizeof (*(p)); ++__i) \
109.58 + *__tmp++ = 0; \
109.59 +}))
109.60 +
109.61 +#if !defined (__INSIDE_CYGWIN_NET__)
109.62 +
109.63 +__BEGIN_DECLS
109.64 +
109.65 +int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
109.66 + fd_set *__exceptfds, struct timeval *__timeout));
109.67 +#if __POSIX_VISIBLE >= 200112
109.68 +int pselect __P ((int __n, fd_set *__readfds, fd_set *__writefds,
109.69 + fd_set *__exceptfds, const struct timespec *__timeout,
109.70 + const sigset_t *__set));
109.71 +#endif
109.72 +
109.73 +__END_DECLS
109.74 +
109.75 +#endif /* !__INSIDE_CYGWIN_NET__ */
109.76 +
109.77 +#endif /* !(_WINSOCK_H || _WINSOCKAPI_ || __USE_W32_SOCKETS) */
109.78 +
109.79 +#endif /* sys/select.h */
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
110.2 +++ b/include/sys/signal.h Mon Oct 21 16:11:07 2019 +0200
110.3 @@ -0,0 +1,371 @@
110.4 +/* sys/signal.h */
110.5 +
110.6 +#ifndef _SYS_SIGNAL_H
110.7 +#define _SYS_SIGNAL_H
110.8 +#ifdef __cplusplus
110.9 +extern "C" {
110.10 +#endif
110.11 +
110.12 +#include "_ansi.h"
110.13 +#include <sys/cdefs.h>
110.14 +#include <sys/features.h>
110.15 +#include <sys/types.h>
110.16 +#include <sys/_sigset.h>
110.17 +#include <sys/_timespec.h>
110.18 +
110.19 +#if !defined(_SIGSET_T_DECLARED)
110.20 +#define _SIGSET_T_DECLARED
110.21 +typedef __sigset_t sigset_t;
110.22 +#endif
110.23 +
110.24 +#if defined(__CYGWIN__)
110.25 +#include <cygwin/signal.h>
110.26 +#else
110.27 +
110.28 +#if defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309
110.29 +
110.30 +/* sigev_notify values
110.31 + NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
110.32 +
110.33 +#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */
110.34 + /* when the event of interest occurs. */
110.35 +#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */
110.36 + /* value, shall be delivered when the event of */
110.37 + /* interest occurs. */
110.38 +#define SIGEV_THREAD 3 /* A notification function shall be called to */
110.39 + /* perform notification. */
110.40 +
110.41 +/* Signal Generation and Delivery, P1003.1b-1993, p. 63
110.42 + NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
110.43 + sigev_notify_attributes to the sigevent structure. */
110.44 +
110.45 +union sigval {
110.46 + int sival_int; /* Integer signal value */
110.47 + void *sival_ptr; /* Pointer signal value */
110.48 +};
110.49 +
110.50 +struct sigevent {
110.51 + int sigev_notify; /* Notification type */
110.52 + int sigev_signo; /* Signal number */
110.53 + union sigval sigev_value; /* Signal value */
110.54 +
110.55 +#if defined(_POSIX_THREADS)
110.56 + void (*sigev_notify_function)( union sigval );
110.57 + /* Notification function */
110.58 + pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */
110.59 +#endif
110.60 +};
110.61 +
110.62 +/* Signal Actions, P1003.1b-1993, p. 64 */
110.63 +/* si_code values, p. 66 */
110.64 +
110.65 +#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
110.66 +#define SI_QUEUE 2 /* Sent by sigqueue() */
110.67 +#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
110.68 +#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
110.69 +#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
110.70 +
110.71 +typedef struct {
110.72 + int si_signo; /* Signal number */
110.73 + int si_code; /* Cause of the signal */
110.74 + union sigval si_value; /* Signal value */
110.75 +} siginfo_t;
110.76 +#endif /* defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309 */
110.77 +
110.78 +#if defined(__rtems__)
110.79 +
110.80 +/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
110.81 +
110.82 +#define SA_NOCLDSTOP 0x1 /* Do not generate SIGCHLD when children stop */
110.83 +#define SA_SIGINFO 0x2 /* Invoke the signal catching function with */
110.84 + /* three arguments instead of one. */
110.85 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
110.86 +#define SA_ONSTACK 0x4 /* Signal delivery will be on a separate stack. */
110.87 +#endif
110.88 +
110.89 +/* struct sigaction notes from POSIX:
110.90 + *
110.91 + * (1) Routines stored in sa_handler should take a single int as
110.92 + * their argument although the POSIX standard does not require this.
110.93 + * This is not longer true since at least POSIX.1-2008
110.94 + * (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
110.95 + * application should not use both simultaneously.
110.96 + */
110.97 +
110.98 +typedef void (*_sig_func_ptr)(int);
110.99 +
110.100 +struct sigaction {
110.101 + int sa_flags; /* Special flags to affect behavior of signal */
110.102 + sigset_t sa_mask; /* Additional set of signals to be blocked */
110.103 + /* during execution of signal-catching */
110.104 + /* function. */
110.105 + union {
110.106 + _sig_func_ptr _handler; /* SIG_DFL, SIG_IGN, or pointer to a function */
110.107 +#if defined(_POSIX_REALTIME_SIGNALS)
110.108 + void (*_sigaction)( int, siginfo_t *, void * );
110.109 +#endif
110.110 + } _signal_handlers;
110.111 +};
110.112 +
110.113 +#define sa_handler _signal_handlers._handler
110.114 +#if defined(_POSIX_REALTIME_SIGNALS)
110.115 +#define sa_sigaction _signal_handlers._sigaction
110.116 +#endif
110.117 +
110.118 +#else /* defined(__rtems__) */
110.119 +
110.120 +#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
110.121 +
110.122 +typedef void (*_sig_func_ptr)(int);
110.123 +
110.124 +struct sigaction
110.125 +{
110.126 + _sig_func_ptr sa_handler;
110.127 + sigset_t sa_mask;
110.128 + int sa_flags;
110.129 +};
110.130 +#endif /* defined(__rtems__) */
110.131 +#endif /* defined(__CYGWIN__) */
110.132 +
110.133 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
110.134 +/*
110.135 + * Minimum and default signal stack constants. Allow for target overrides
110.136 + * from <sys/features.h>.
110.137 + */
110.138 +#ifndef MINSIGSTKSZ
110.139 +#define MINSIGSTKSZ 2048
110.140 +#endif
110.141 +#ifndef SIGSTKSZ
110.142 +#define SIGSTKSZ 8192
110.143 +#endif
110.144 +
110.145 +/*
110.146 + * Possible values for ss_flags in stack_t below.
110.147 + */
110.148 +#define SS_ONSTACK 0x1
110.149 +#define SS_DISABLE 0x2
110.150 +
110.151 +#endif
110.152 +
110.153 +/*
110.154 + * Structure used in sigaltstack call.
110.155 + */
110.156 +typedef struct sigaltstack {
110.157 + void *ss_sp; /* Stack base or pointer. */
110.158 + int ss_flags; /* Flags. */
110.159 + size_t ss_size; /* Stack size. */
110.160 +} stack_t;
110.161 +
110.162 +#if __POSIX_VISIBLE
110.163 +#define SIG_SETMASK 0 /* set mask with sigprocmask() */
110.164 +#define SIG_BLOCK 1 /* set of signals to block */
110.165 +#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
110.166 +
110.167 +int sigprocmask (int, const sigset_t *, sigset_t *);
110.168 +#endif
110.169 +
110.170 +#if __POSIX_VISIBLE >= 199506
110.171 +int pthread_sigmask (int, const sigset_t *, sigset_t *);
110.172 +#endif
110.173 +
110.174 +#ifdef _COMPILING_NEWLIB
110.175 +int _kill (pid_t, int);
110.176 +#endif /* _COMPILING_NEWLIB */
110.177 +
110.178 +#if __POSIX_VISIBLE
110.179 +int kill (pid_t, int);
110.180 +#endif
110.181 +
110.182 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
110.183 +int killpg (pid_t, int);
110.184 +#endif
110.185 +#if __POSIX_VISIBLE
110.186 +int sigaction (int, const struct sigaction *, struct sigaction *);
110.187 +int sigaddset (sigset_t *, const int);
110.188 +int sigdelset (sigset_t *, const int);
110.189 +int sigismember (const sigset_t *, int);
110.190 +int sigfillset (sigset_t *);
110.191 +int sigemptyset (sigset_t *);
110.192 +int sigpending (sigset_t *);
110.193 +int sigsuspend (const sigset_t *);
110.194 +int sigwait (const sigset_t *, int *);
110.195 +
110.196 +#if !defined(__CYGWIN__) && !defined(__rtems__)
110.197 +/* These depend upon the type of sigset_t, which right now
110.198 + is always a long.. They're in the POSIX namespace, but
110.199 + are not ANSI. */
110.200 +#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
110.201 +#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
110.202 +#define sigemptyset(what) (*(what) = 0, 0)
110.203 +#define sigfillset(what) (*(what) = ~(0), 0)
110.204 +#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
110.205 +#endif /* !__CYGWIN__ && !__rtems__ */
110.206 +#endif /* __POSIX_VISIBLE */
110.207 +
110.208 +/* There are two common sigpause variants, both of which take an int argument.
110.209 + If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
110.210 + which removes the given signal from the process's signal mask; otherwise
110.211 + you get the BSD version, which sets the process's signal mask to the given
110.212 + value. */
110.213 +#if __XSI_VISIBLE && !defined(__INSIDE_CYGWIN__)
110.214 +# ifdef __GNUC__
110.215 +int sigpause (int) __asm__ (__ASMNAME ("__xpg_sigpause"));
110.216 +# else
110.217 +int __xpg_sigpause (int);
110.218 +# define sigpause __xpg_sigpause
110.219 +# endif
110.220 +#elif __BSD_VISIBLE
110.221 +int sigpause (int);
110.222 +#endif
110.223 +
110.224 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
110.225 +int sigaltstack (const stack_t *__restrict, stack_t *__restrict);
110.226 +#endif
110.227 +
110.228 +#if __POSIX_VISIBLE >= 199506
110.229 +int pthread_kill (pthread_t, int);
110.230 +#endif
110.231 +
110.232 +#if __POSIX_VISIBLE >= 199309
110.233 +
110.234 +/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
110.235 + NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
110.236 +
110.237 +int sigwaitinfo (const sigset_t *, siginfo_t *);
110.238 +int sigtimedwait (const sigset_t *, siginfo_t *, const struct timespec *);
110.239 +/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
110.240 +int sigqueue (pid_t, int, const union sigval);
110.241 +
110.242 +#endif /* __POSIX_VISIBLE >= 199309 */
110.243 +
110.244 +#if defined(___AM29K__)
110.245 +/* These all need to be defined for ANSI C, but I don't think they are
110.246 + meaningful. */
110.247 +#define SIGABRT 1
110.248 +#define SIGFPE 1
110.249 +#define SIGILL 1
110.250 +#define SIGINT 1
110.251 +#define SIGSEGV 1
110.252 +#define SIGTERM 1
110.253 +/* These need to be defined for POSIX, and some others do too. */
110.254 +#define SIGHUP 1
110.255 +#define SIGQUIT 1
110.256 +#define NSIG 2
110.257 +#elif defined(__GO32__)
110.258 +#define SIGINT 1
110.259 +#define SIGKILL 2
110.260 +#define SIGPIPE 3
110.261 +#define SIGFPE 4
110.262 +#define SIGHUP 5
110.263 +#define SIGTERM 6
110.264 +#define SIGSEGV 7
110.265 +#define SIGTSTP 8
110.266 +#define SIGQUIT 9
110.267 +#define SIGTRAP 10
110.268 +#define SIGILL 11
110.269 +#define SIGEMT 12
110.270 +#define SIGALRM 13
110.271 +#define SIGBUS 14
110.272 +#define SIGLOST 15
110.273 +#define SIGSTOP 16
110.274 +#define SIGABRT 17
110.275 +#define SIGUSR1 18
110.276 +#define SIGUSR2 19
110.277 +#define NSIG 20
110.278 +#elif !defined(SIGTRAP)
110.279 +#define SIGHUP 1 /* hangup */
110.280 +#define SIGINT 2 /* interrupt */
110.281 +#define SIGQUIT 3 /* quit */
110.282 +#define SIGILL 4 /* illegal instruction (not reset when caught) */
110.283 +#define SIGTRAP 5 /* trace trap (not reset when caught) */
110.284 +#define SIGIOT 6 /* IOT instruction */
110.285 +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
110.286 +#define SIGEMT 7 /* EMT instruction */
110.287 +#define SIGFPE 8 /* floating point exception */
110.288 +#define SIGKILL 9 /* kill (cannot be caught or ignored) */
110.289 +#define SIGBUS 10 /* bus error */
110.290 +#define SIGSEGV 11 /* segmentation violation */
110.291 +#define SIGSYS 12 /* bad argument to system call */
110.292 +#define SIGPIPE 13 /* write on a pipe with no one to read it */
110.293 +#define SIGALRM 14 /* alarm clock */
110.294 +#define SIGTERM 15 /* software termination signal from kill */
110.295 +
110.296 +#if defined(__rtems__)
110.297 +#define SIGURG 16 /* urgent condition on IO channel */
110.298 +#define SIGSTOP 17 /* sendable stop signal not from tty */
110.299 +#define SIGTSTP 18 /* stop signal from tty */
110.300 +#define SIGCONT 19 /* continue a stopped process */
110.301 +#define SIGCHLD 20 /* to parent on child stop or exit */
110.302 +#define SIGCLD 20 /* System V name for SIGCHLD */
110.303 +#define SIGTTIN 21 /* to readers pgrp upon background tty read */
110.304 +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
110.305 +#define SIGIO 23 /* input/output possible signal */
110.306 +#define SIGPOLL SIGIO /* System V name for SIGIO */
110.307 +#define SIGWINCH 24 /* window changed */
110.308 +#define SIGUSR1 25 /* user defined signal 1 */
110.309 +#define SIGUSR2 26 /* user defined signal 2 */
110.310 +
110.311 +/* Real-Time Signals Range, P1003.1b-1993, p. 61
110.312 + NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX
110.313 + (which is a minimum of 8) signals.
110.314 + */
110.315 +#define SIGRTMIN 27
110.316 +#define SIGRTMAX 31
110.317 +#define __SIGFIRSTNOTRT SIGHUP
110.318 +#define __SIGLASTNOTRT SIGUSR2
110.319 +
110.320 +#define NSIG 32 /* signal 0 implied */
110.321 +
110.322 +#elif defined(__svr4__)
110.323 +/* svr4 specifics. different signals above 15, and sigaction. */
110.324 +#define SIGUSR1 16
110.325 +#define SIGUSR2 17
110.326 +#define SIGCLD 18
110.327 +#define SIGPWR 19
110.328 +#define SIGWINCH 20
110.329 +#define SIGPOLL 22 /* 20 for x.out binaries!!!! */
110.330 +#define SIGSTOP 23 /* sendable stop signal not from tty */
110.331 +#define SIGTSTP 24 /* stop signal from tty */
110.332 +#define SIGCONT 25 /* continue a stopped process */
110.333 +#define SIGTTIN 26 /* to readers pgrp upon background tty read */
110.334 +#define SIGTTOU 27 /* like TTIN for output if (tp->t_local<OSTOP) */
110.335 +#define NSIG 28
110.336 +#else
110.337 +#define SIGURG 16 /* urgent condition on IO channel */
110.338 +#define SIGSTOP 17 /* sendable stop signal not from tty */
110.339 +#define SIGTSTP 18 /* stop signal from tty */
110.340 +#define SIGCONT 19 /* continue a stopped process */
110.341 +#define SIGCHLD 20 /* to parent on child stop or exit */
110.342 +#define SIGCLD 20 /* System V name for SIGCHLD */
110.343 +#define SIGTTIN 21 /* to readers pgrp upon background tty read */
110.344 +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
110.345 +#define SIGIO 23 /* input/output possible signal */
110.346 +#define SIGPOLL SIGIO /* System V name for SIGIO */
110.347 +#define SIGXCPU 24 /* exceeded CPU time limit */
110.348 +#define SIGXFSZ 25 /* exceeded file size limit */
110.349 +#define SIGVTALRM 26 /* virtual time alarm */
110.350 +#define SIGPROF 27 /* profiling time alarm */
110.351 +#define SIGWINCH 28 /* window changed */
110.352 +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */
110.353 +#define SIGUSR1 30 /* user defined signal 1 */
110.354 +#define SIGUSR2 31 /* user defined signal 2 */
110.355 +#define NSIG 32 /* signal 0 implied */
110.356 +#endif
110.357 +#endif
110.358 +
110.359 +#ifdef __cplusplus
110.360 +}
110.361 +#endif
110.362 +
110.363 +#if defined(__CYGWIN__)
110.364 +#if __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
110.365 +#include <sys/ucontext.h>
110.366 +#endif
110.367 +#endif
110.368 +
110.369 +#ifndef _SIGNAL_H_
110.370 +/* Some applications take advantage of the fact that <sys/signal.h>
110.371 + * and <signal.h> are equivalent in glibc. Allow for that here. */
110.372 +#include <signal.h>
110.373 +#endif
110.374 +#endif /* _SYS_SIGNAL_H */
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
111.2 +++ b/include/sys/stat.h Mon Oct 21 16:11:07 2019 +0200
111.3 @@ -0,0 +1,179 @@
111.4 +#ifndef _SYS_STAT_H
111.5 +#define _SYS_STAT_H
111.6 +
111.7 +#ifdef __cplusplus
111.8 +extern "C" {
111.9 +#endif
111.10 +
111.11 +#include <_ansi.h>
111.12 +#include <time.h>
111.13 +#include <sys/cdefs.h>
111.14 +#include <sys/types.h>
111.15 +#include <sys/_timespec.h>
111.16 +
111.17 +/* dj's stat defines _STAT_H_ */
111.18 +#ifndef _STAT_H_
111.19 +
111.20 +/* It is intended that the layout of this structure not change when the
111.21 + sizes of any of the basic types change (short, int, long) [via a compile
111.22 + time option]. */
111.23 +
111.24 +#ifdef __CYGWIN__
111.25 +#include <cygwin/stat.h>
111.26 +#ifdef _COMPILING_NEWLIB
111.27 +#define stat64 stat
111.28 +#endif
111.29 +#else
111.30 +struct stat
111.31 +{
111.32 + dev_t st_dev;
111.33 + ino_t st_ino;
111.34 + mode_t st_mode;
111.35 + nlink_t st_nlink;
111.36 + uid_t st_uid;
111.37 + gid_t st_gid;
111.38 + dev_t st_rdev;
111.39 + off_t st_size;
111.40 +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
111.41 + time_t st_atime;
111.42 + time_t st_mtime;
111.43 + time_t st_ctime;
111.44 +#else
111.45 + struct timespec st_atim;
111.46 + struct timespec st_mtim;
111.47 + struct timespec st_ctim;
111.48 + blksize_t st_blksize;
111.49 + blkcnt_t st_blocks;
111.50 +#if !defined(__rtems__)
111.51 + long st_spare4[2];
111.52 +#endif
111.53 +#endif
111.54 +};
111.55 +
111.56 +#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) && !defined(__cris__)
111.57 +#define st_atime st_atim.tv_sec
111.58 +#define st_ctime st_ctim.tv_sec
111.59 +#define st_mtime st_mtim.tv_sec
111.60 +#endif
111.61 +
111.62 +#endif
111.63 +
111.64 +#define _IFMT 0170000 /* type of file */
111.65 +#define _IFDIR 0040000 /* directory */
111.66 +#define _IFCHR 0020000 /* character special */
111.67 +#define _IFBLK 0060000 /* block special */
111.68 +#define _IFREG 0100000 /* regular */
111.69 +#define _IFLNK 0120000 /* symbolic link */
111.70 +#define _IFSOCK 0140000 /* socket */
111.71 +#define _IFIFO 0010000 /* fifo */
111.72 +
111.73 +#define S_BLKSIZE 1024 /* size of a block */
111.74 +
111.75 +#define S_ISUID 0004000 /* set user id on execution */
111.76 +#define S_ISGID 0002000 /* set group id on execution */
111.77 +#define S_ISVTX 0001000 /* save swapped text even after use */
111.78 +#if __BSD_VISIBLE
111.79 +#define S_IREAD 0000400 /* read permission, owner */
111.80 +#define S_IWRITE 0000200 /* write permission, owner */
111.81 +#define S_IEXEC 0000100 /* execute/search permission, owner */
111.82 +#define S_ENFMT 0002000 /* enforcement-mode locking */
111.83 +#endif /* !_BSD_VISIBLE */
111.84 +
111.85 +#define S_IFMT _IFMT
111.86 +#define S_IFDIR _IFDIR
111.87 +#define S_IFCHR _IFCHR
111.88 +#define S_IFBLK _IFBLK
111.89 +#define S_IFREG _IFREG
111.90 +#define S_IFLNK _IFLNK
111.91 +#define S_IFSOCK _IFSOCK
111.92 +#define S_IFIFO _IFIFO
111.93 +
111.94 +#ifdef _WIN32
111.95 +/* The Windows header files define _S_ forms of these, so we do too
111.96 + for easier portability. */
111.97 +#define _S_IFMT _IFMT
111.98 +#define _S_IFDIR _IFDIR
111.99 +#define _S_IFCHR _IFCHR
111.100 +#define _S_IFIFO _IFIFO
111.101 +#define _S_IFREG _IFREG
111.102 +#define _S_IREAD 0000400
111.103 +#define _S_IWRITE 0000200
111.104 +#define _S_IEXEC 0000100
111.105 +#endif
111.106 +
111.107 +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
111.108 +#define S_IRUSR 0000400 /* read permission, owner */
111.109 +#define S_IWUSR 0000200 /* write permission, owner */
111.110 +#define S_IXUSR 0000100/* execute/search permission, owner */
111.111 +#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
111.112 +#define S_IRGRP 0000040 /* read permission, group */
111.113 +#define S_IWGRP 0000020 /* write permission, grougroup */
111.114 +#define S_IXGRP 0000010/* execute/search permission, group */
111.115 +#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
111.116 +#define S_IROTH 0000004 /* read permission, other */
111.117 +#define S_IWOTH 0000002 /* write permission, other */
111.118 +#define S_IXOTH 0000001/* execute/search permission, other */
111.119 +
111.120 +#if __BSD_VISIBLE
111.121 +#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
111.122 +#define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */
111.123 +#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */
111.124 +#endif
111.125 +
111.126 +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
111.127 +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
111.128 +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
111.129 +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
111.130 +#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
111.131 +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
111.132 +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
111.133 +
111.134 +#if defined(__CYGWIN__)
111.135 +/* Special tv_nsec values for futimens(2) and utimensat(2). */
111.136 +#define UTIME_NOW -2L
111.137 +#define UTIME_OMIT -1L
111.138 +#endif
111.139 +
111.140 +int chmod (const char *__path, mode_t __mode );
111.141 +int fchmod (int __fd, mode_t __mode);
111.142 +int fstat (int __fd, struct stat *__sbuf );
111.143 +int mkdir (const char *_path, mode_t __mode );
111.144 +int mkfifo (const char *__path, mode_t __mode );
111.145 +int stat (const char *__restrict __path, struct stat *__restrict __sbuf );
111.146 +mode_t umask (mode_t __mask );
111.147 +
111.148 +#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
111.149 +int lstat (const char *__restrict __path, struct stat *__restrict __buf );
111.150 +int mknod (const char *__path, mode_t __mode, dev_t __dev );
111.151 +#endif
111.152 +
111.153 +#if __ATFILE_VISIBLE && !defined(__INSIDE_CYGWIN__)
111.154 +int fchmodat (int, const char *, mode_t, int);
111.155 +int fstatat (int, const char *__restrict , struct stat *__restrict, int);
111.156 +int mkdirat (int, const char *, mode_t);
111.157 +int mkfifoat (int, const char *, mode_t);
111.158 +int mknodat (int, const char *, mode_t, dev_t);
111.159 +int utimensat (int, const char *, const struct timespec *, int);
111.160 +#endif
111.161 +#if __POSIX_VISIBLE >= 200809 && !defined(__INSIDE_CYGWIN__)
111.162 +int futimens (int, const struct timespec *);
111.163 +#endif
111.164 +
111.165 +/* Provide prototypes for most of the _<systemcall> names that are
111.166 + provided in newlib for some compilers. */
111.167 +#ifdef _COMPILING_NEWLIB
111.168 +int _fstat (int __fd, struct stat *__sbuf );
111.169 +int _stat (const char *__restrict __path, struct stat *__restrict __sbuf );
111.170 +int _mkdir (const char *_path, mode_t __mode );
111.171 +#ifdef __LARGE64_FILES
111.172 +struct stat64;
111.173 +int _stat64 (const char *__restrict __path, struct stat64 *__restrict __sbuf );
111.174 +int _fstat64 (int __fd, struct stat64 *__sbuf );
111.175 +#endif
111.176 +#endif
111.177 +
111.178 +#endif /* !_STAT_H_ */
111.179 +#ifdef __cplusplus
111.180 +}
111.181 +#endif
111.182 +#endif /* _SYS_STAT_H */
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
112.2 +++ b/include/sys/stdio.h Mon Oct 21 16:11:07 2019 +0200
112.3 @@ -0,0 +1,27 @@
112.4 +#ifndef _NEWLIB_STDIO_H
112.5 +#define _NEWLIB_STDIO_H
112.6 +
112.7 +#include <sys/lock.h>
112.8 +#include <sys/reent.h>
112.9 +
112.10 +/* Internal locking macros, used to protect stdio functions. In the
112.11 + general case, expand to nothing. Use __SSTR flag in FILE _flags to
112.12 + detect if FILE is private to sprintf/sscanf class of functions; if
112.13 + set then do nothing as lock is not initialised. */
112.14 +#if !defined(_flockfile)
112.15 +#ifndef __SINGLE_THREAD__
112.16 +# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
112.17 +#else
112.18 +# define _flockfile(fp) ((void) 0)
112.19 +#endif
112.20 +#endif
112.21 +
112.22 +#if !defined(_funlockfile)
112.23 +#ifndef __SINGLE_THREAD__
112.24 +# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
112.25 +#else
112.26 +# define _funlockfile(fp) ((void) 0)
112.27 +#endif
112.28 +#endif
112.29 +
112.30 +#endif /* _NEWLIB_STDIO_H */
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
113.2 +++ b/include/sys/string.h Mon Oct 21 16:11:07 2019 +0200
113.3 @@ -0,0 +1,2 @@
113.4 +/* This is a dummy <sys/string.h> used as a placeholder for
113.5 + systems that need to have a special header file. */
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
114.2 +++ b/include/sys/syslimits.h Mon Oct 21 16:11:07 2019 +0200
114.3 @@ -0,0 +1,65 @@
114.4 +/*
114.5 + * Copyright (c) 1988, 1993
114.6 + * The Regents of the University of California. All rights reserved.
114.7 + *
114.8 + * Redistribution and use in source and binary forms, with or without
114.9 + * modification, are permitted provided that the following conditions
114.10 + * are met:
114.11 + * 1. Redistributions of source code must retain the above copyright
114.12 + * notice, this list of conditions and the following disclaimer.
114.13 + * 2. Redistributions in binary form must reproduce the above copyright
114.14 + * notice, this list of conditions and the following disclaimer in the
114.15 + * documentation and/or other materials provided with the distribution.
114.16 + * 3. All advertising materials mentioning features or use of this software
114.17 + * must display the following acknowledgement:
114.18 + * This product includes software developed by the University of
114.19 + * California, Berkeley and its contributors.
114.20 + * 4. Neither the name of the University nor the names of its contributors
114.21 + * may be used to endorse or promote products derived from this software
114.22 + * without specific prior written permission.
114.23 + *
114.24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
114.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
114.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
114.27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
114.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
114.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
114.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
114.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
114.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
114.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
114.34 + * SUCH DAMAGE.
114.35 + *
114.36 + * @(#)syslimits.h 8.1 (Berkeley) 6/2/93
114.37 + * $FreeBSD: src/sys/sys/syslimits.h,v 1.10 2001/06/18 20:24:54 wollman Exp $
114.38 + */
114.39 +
114.40 +#ifndef _SYS_SYSLIMITS_H_
114.41 +#define _SYS_SYSLIMITS_H_
114.42 +
114.43 +#define ARG_MAX 65536 /* max bytes for an exec function */
114.44 +#ifndef CHILD_MAX
114.45 +#define CHILD_MAX 40 /* max simultaneous processes */
114.46 +#endif
114.47 +#define LINK_MAX 32767 /* max file link count */
114.48 +#define MAX_CANON 255 /* max bytes in term canon input line */
114.49 +#define MAX_INPUT 255 /* max bytes in terminal input */
114.50 +#define NAME_MAX 255 /* max bytes in a file name */
114.51 +#define NGROUPS_MAX 16 /* max supplemental group id's */
114.52 +#ifndef OPEN_MAX
114.53 +#define OPEN_MAX 64 /* max open files per process */
114.54 +#endif
114.55 +#define PATH_MAX 1024 /* max bytes in pathname */
114.56 +#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
114.57 +#define IOV_MAX 1024 /* max elements in i/o vector */
114.58 +
114.59 +#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
114.60 +#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
114.61 +#define BC_SCALE_MAX 99 /* max scale value in bc(1) */
114.62 +#define BC_STRING_MAX 1000 /* max const string length in bc(1) */
114.63 +#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */
114.64 +#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
114.65 +#define LINE_MAX 2048 /* max bytes in an input line */
114.66 +#define RE_DUP_MAX 255 /* max RE's in interval notation */
114.67 +
114.68 +#endif
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
115.2 +++ b/include/sys/time.h Mon Oct 21 16:11:07 2019 +0200
115.3 @@ -0,0 +1,386 @@
115.4 +/* time.h -- An implementation of the standard Unix <sys/time.h> file.
115.5 + Written by Geoffrey Noer <noer@cygnus.com>
115.6 + Public domain; no rights reserved. */
115.7 +
115.8 +/*-
115.9 + * SPDX-License-Identifier: BSD-3-Clause
115.10 + *
115.11 + * Copyright (c) 1982, 1986, 1993
115.12 + * The Regents of the University of California. All rights reserved.
115.13 + *
115.14 + * Redistribution and use in source and binary forms, with or without
115.15 + * modification, are permitted provided that the following conditions
115.16 + * are met:
115.17 + * 1. Redistributions of source code must retain the above copyright
115.18 + * notice, this list of conditions and the following disclaimer.
115.19 + * 2. Redistributions in binary form must reproduce the above copyright
115.20 + * notice, this list of conditions and the following disclaimer in the
115.21 + * documentation and/or other materials provided with the distribution.
115.22 + * 3. Neither the name of the University nor the names of its contributors
115.23 + * may be used to endorse or promote products derived from this software
115.24 + * without specific prior written permission.
115.25 + *
115.26 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
115.27 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
115.28 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
115.29 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
115.30 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
115.31 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
115.32 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
115.33 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
115.34 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
115.35 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
115.36 + * SUCH DAMAGE.
115.37 + *
115.38 + * @(#)time.h 8.5 (Berkeley) 5/4/95
115.39 + * $FreeBSD: head/sys/sys/time.h 340664 2018-11-20 07:11:23Z imp $
115.40 + */
115.41 +
115.42 +#ifndef _SYS_TIME_H_
115.43 +#define _SYS_TIME_H_
115.44 +
115.45 +#include <_ansi.h>
115.46 +#include <sys/cdefs.h>
115.47 +#include <sys/_timeval.h>
115.48 +#include <sys/types.h>
115.49 +#include <sys/timespec.h>
115.50 +
115.51 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
115.52 +#include <sys/select.h>
115.53 +#endif
115.54 +
115.55 +struct timezone {
115.56 + int tz_minuteswest; /* minutes west of Greenwich */
115.57 + int tz_dsttime; /* type of dst correction */
115.58 +};
115.59 +#define DST_NONE 0 /* not on dst */
115.60 +#define DST_USA 1 /* USA style dst */
115.61 +#define DST_AUST 2 /* Australian style dst */
115.62 +#define DST_WET 3 /* Western European dst */
115.63 +#define DST_MET 4 /* Middle European dst */
115.64 +#define DST_EET 5 /* Eastern European dst */
115.65 +#define DST_CAN 6 /* Canada */
115.66 +
115.67 +#if __BSD_VISIBLE
115.68 +struct bintime {
115.69 + time_t sec;
115.70 + uint64_t frac;
115.71 +};
115.72 +
115.73 +static __inline void
115.74 +bintime_addx(struct bintime *_bt, uint64_t _x)
115.75 +{
115.76 + uint64_t _u;
115.77 +
115.78 + _u = _bt->frac;
115.79 + _bt->frac += _x;
115.80 + if (_u > _bt->frac)
115.81 + _bt->sec++;
115.82 +}
115.83 +
115.84 +static __inline void
115.85 +bintime_add(struct bintime *_bt, const struct bintime *_bt2)
115.86 +{
115.87 + uint64_t _u;
115.88 +
115.89 + _u = _bt->frac;
115.90 + _bt->frac += _bt2->frac;
115.91 + if (_u > _bt->frac)
115.92 + _bt->sec++;
115.93 + _bt->sec += _bt2->sec;
115.94 +}
115.95 +
115.96 +static __inline void
115.97 +bintime_sub(struct bintime *_bt, const struct bintime *_bt2)
115.98 +{
115.99 + uint64_t _u;
115.100 +
115.101 + _u = _bt->frac;
115.102 + _bt->frac -= _bt2->frac;
115.103 + if (_u < _bt->frac)
115.104 + _bt->sec--;
115.105 + _bt->sec -= _bt2->sec;
115.106 +}
115.107 +
115.108 +static __inline void
115.109 +bintime_mul(struct bintime *_bt, u_int _x)
115.110 +{
115.111 + uint64_t _p1, _p2;
115.112 +
115.113 + _p1 = (_bt->frac & 0xffffffffull) * _x;
115.114 + _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32);
115.115 + _bt->sec *= _x;
115.116 + _bt->sec += (_p2 >> 32);
115.117 + _bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull);
115.118 +}
115.119 +
115.120 +static __inline void
115.121 +bintime_shift(struct bintime *_bt, int _exp)
115.122 +{
115.123 +
115.124 + if (_exp > 0) {
115.125 + _bt->sec <<= _exp;
115.126 + _bt->sec |= _bt->frac >> (64 - _exp);
115.127 + _bt->frac <<= _exp;
115.128 + } else if (_exp < 0) {
115.129 + _bt->frac >>= -_exp;
115.130 + _bt->frac |= (uint64_t)_bt->sec << (64 + _exp);
115.131 + _bt->sec >>= -_exp;
115.132 + }
115.133 +}
115.134 +
115.135 +#define bintime_clear(a) ((a)->sec = (a)->frac = 0)
115.136 +#define bintime_isset(a) ((a)->sec || (a)->frac)
115.137 +#define bintime_cmp(a, b, cmp) \
115.138 + (((a)->sec == (b)->sec) ? \
115.139 + ((a)->frac cmp (b)->frac) : \
115.140 + ((a)->sec cmp (b)->sec))
115.141 +
115.142 +#define SBT_1S ((sbintime_t)1 << 32)
115.143 +#define SBT_1M (SBT_1S * 60)
115.144 +#define SBT_1MS (SBT_1S / 1000)
115.145 +#define SBT_1US (SBT_1S / 1000000)
115.146 +#define SBT_1NS (SBT_1S / 1000000000) /* beware rounding, see nstosbt() */
115.147 +#define SBT_MAX 0x7fffffffffffffffLL
115.148 +
115.149 +static __inline int
115.150 +sbintime_getsec(sbintime_t _sbt)
115.151 +{
115.152 +
115.153 + return (_sbt >> 32);
115.154 +}
115.155 +
115.156 +static __inline sbintime_t
115.157 +bttosbt(const struct bintime _bt)
115.158 +{
115.159 +
115.160 + return (((sbintime_t)_bt.sec << 32) + (_bt.frac >> 32));
115.161 +}
115.162 +
115.163 +static __inline struct bintime
115.164 +sbttobt(sbintime_t _sbt)
115.165 +{
115.166 + struct bintime _bt;
115.167 +
115.168 + _bt.sec = _sbt >> 32;
115.169 + _bt.frac = _sbt << 32;
115.170 + return (_bt);
115.171 +}
115.172 +
115.173 +/*
115.174 + * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS results in
115.175 + * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and
115.176 + * microsecond functions are also provided for completeness.
115.177 + *
115.178 + * These functions return the smallest sbt larger or equal to the
115.179 + * number of seconds requested so that sbttoX(Xtosbt(y)) == y. Unlike
115.180 + * top of second computations below, which require that we tick at the
115.181 + * top of second, these need to be rounded up so we do whatever for at
115.182 + * least as long as requested.
115.183 + *
115.184 + * The naive computation we'd do is this
115.185 + * ((unit * 2^64 / SIFACTOR) + 2^32-1) >> 32
115.186 + * However, that overflows. Instead, we compute
115.187 + * ((unit * 2^63 / SIFACTOR) + 2^31-1) >> 32
115.188 + * and use pre-computed constants that are the ceil of the 2^63 / SIFACTOR
115.189 + * term to ensure we are using exactly the right constant. We use the lesser
115.190 + * evil of ull rather than a uint64_t cast to ensure we have well defined
115.191 + * right shift semantics. With these changes, we get all the ns, us and ms
115.192 + * conversions back and forth right.
115.193 + */
115.194 +static __inline int64_t
115.195 +sbttons(sbintime_t _sbt)
115.196 +{
115.197 +
115.198 + return ((1000000000 * _sbt) >> 32);
115.199 +}
115.200 +
115.201 +static __inline sbintime_t
115.202 +nstosbt(int64_t _ns)
115.203 +{
115.204 + sbintime_t sb = 0;
115.205 +
115.206 + if (_ns >= SBT_1S) {
115.207 + sb = (_ns / 1000000000) * SBT_1S;
115.208 + _ns = _ns % 1000000000;
115.209 + }
115.210 + /* 9223372037 = ceil(2^63 / 1000000000) */
115.211 + sb += ((_ns * 9223372037ull) + 0x7fffffff) >> 31;
115.212 + return (sb);
115.213 +}
115.214 +
115.215 +static __inline int64_t
115.216 +sbttous(sbintime_t _sbt)
115.217 +{
115.218 +
115.219 + return ((1000000 * _sbt) >> 32);
115.220 +}
115.221 +
115.222 +static __inline sbintime_t
115.223 +ustosbt(int64_t _us)
115.224 +{
115.225 + sbintime_t sb = 0;
115.226 +
115.227 + if (_us >= SBT_1S) {
115.228 + sb = (_us / 1000000) * SBT_1S;
115.229 + _us = _us % 1000000;
115.230 + }
115.231 + /* 9223372036855 = ceil(2^63 / 1000000) */
115.232 + sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31;
115.233 + return (sb);
115.234 +}
115.235 +
115.236 +static __inline int64_t
115.237 +sbttoms(sbintime_t _sbt)
115.238 +{
115.239 +
115.240 + return ((1000 * _sbt) >> 32);
115.241 +}
115.242 +
115.243 +static __inline sbintime_t
115.244 +mstosbt(int64_t _ms)
115.245 +{
115.246 + sbintime_t sb = 0;
115.247 +
115.248 + if (_ms >= SBT_1S) {
115.249 + sb = (_ms / 1000) * SBT_1S;
115.250 + _ms = _ms % 1000;
115.251 + }
115.252 + /* 9223372036854776 = ceil(2^63 / 1000) */
115.253 + sb += ((_ms * 9223372036854776ull) + 0x7fffffff) >> 31;
115.254 + return (sb);
115.255 +}
115.256 +
115.257 +/*-
115.258 + * Background information:
115.259 + *
115.260 + * When converting between timestamps on parallel timescales of differing
115.261 + * resolutions it is historical and scientific practice to round down rather
115.262 + * than doing 4/5 rounding.
115.263 + *
115.264 + * The date changes at midnight, not at noon.
115.265 + *
115.266 + * Even at 15:59:59.999999999 it's not four'o'clock.
115.267 + *
115.268 + * time_second ticks after N.999999999 not after N.4999999999
115.269 + */
115.270 +
115.271 +static __inline void
115.272 +bintime2timespec(const struct bintime *_bt, struct timespec *_ts)
115.273 +{
115.274 +
115.275 + _ts->tv_sec = _bt->sec;
115.276 + _ts->tv_nsec = ((uint64_t)1000000000 *
115.277 + (uint32_t)(_bt->frac >> 32)) >> 32;
115.278 +}
115.279 +
115.280 +static __inline void
115.281 +timespec2bintime(const struct timespec *_ts, struct bintime *_bt)
115.282 +{
115.283 +
115.284 + _bt->sec = _ts->tv_sec;
115.285 + /* 18446744073 = int(2^64 / 1000000000) */
115.286 + _bt->frac = _ts->tv_nsec * (uint64_t)18446744073LL;
115.287 +}
115.288 +
115.289 +static __inline void
115.290 +bintime2timeval(const struct bintime *_bt, struct timeval *_tv)
115.291 +{
115.292 +
115.293 + _tv->tv_sec = _bt->sec;
115.294 + _tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(_bt->frac >> 32)) >> 32;
115.295 +}
115.296 +
115.297 +static __inline void
115.298 +timeval2bintime(const struct timeval *_tv, struct bintime *_bt)
115.299 +{
115.300 +
115.301 + _bt->sec = _tv->tv_sec;
115.302 + /* 18446744073709 = int(2^64 / 1000000) */
115.303 + _bt->frac = _tv->tv_usec * (uint64_t)18446744073709LL;
115.304 +}
115.305 +
115.306 +static __inline struct timespec
115.307 +sbttots(sbintime_t _sbt)
115.308 +{
115.309 + struct timespec _ts;
115.310 +
115.311 + _ts.tv_sec = _sbt >> 32;
115.312 + _ts.tv_nsec = sbttons((uint32_t)_sbt);
115.313 + return (_ts);
115.314 +}
115.315 +
115.316 +static __inline sbintime_t
115.317 +tstosbt(struct timespec _ts)
115.318 +{
115.319 +
115.320 + return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec));
115.321 +}
115.322 +
115.323 +static __inline struct timeval
115.324 +sbttotv(sbintime_t _sbt)
115.325 +{
115.326 + struct timeval _tv;
115.327 +
115.328 + _tv.tv_sec = _sbt >> 32;
115.329 + _tv.tv_usec = sbttous((uint32_t)_sbt);
115.330 + return (_tv);
115.331 +}
115.332 +
115.333 +static __inline sbintime_t
115.334 +tvtosbt(struct timeval _tv)
115.335 +{
115.336 +
115.337 + return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec));
115.338 +}
115.339 +#endif /* __BSD_VISIBLE */
115.340 +
115.341 +/*
115.342 + * Names of the interval timers, and structure
115.343 + * defining a timer setting.
115.344 + */
115.345 +#define ITIMER_REAL 0
115.346 +#define ITIMER_VIRTUAL 1
115.347 +#define ITIMER_PROF 2
115.348 +
115.349 +struct itimerval {
115.350 + struct timeval it_interval; /* timer interval */
115.351 + struct timeval it_value; /* current value */
115.352 +};
115.353 +
115.354 +#ifndef _KERNEL
115.355 +#include <time.h>
115.356 +
115.357 +__BEGIN_DECLS
115.358 +int utimes (const char *__path, const struct timeval *__tvp);
115.359 +
115.360 +#if __BSD_VISIBLE
115.361 +int adjtime (const struct timeval *, struct timeval *);
115.362 +int futimes (int, const struct timeval *);
115.363 +int lutimes (const char *, const struct timeval *);
115.364 +int settimeofday (const struct timeval *, const struct timezone *);
115.365 +#endif
115.366 +
115.367 +#if __MISC_VISIBLE || __XSI_VISIBLE
115.368 +int getitimer (int __which, struct itimerval *__value);
115.369 +int setitimer (int __which, const struct itimerval *__restrict __value,
115.370 + struct itimerval *__restrict __ovalue);
115.371 +#endif
115.372 +
115.373 +int gettimeofday (struct timeval *__restrict __p,
115.374 + void *__restrict __tz);
115.375 +
115.376 +#if __GNU_VISIBLE
115.377 +int futimesat (int, const char *, const struct timeval [2]);
115.378 +#endif
115.379 +
115.380 +#ifdef _COMPILING_NEWLIB
115.381 +int _gettimeofday (struct timeval *__p, void *__tz);
115.382 +#endif
115.383 +
115.384 +__END_DECLS
115.385 +
115.386 +#endif /* !_KERNEL */
115.387 +#include <machine/_time.h>
115.388 +
115.389 +#endif /* !_SYS_TIME_H_ */
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117.2 +++ b/include/sys/times.h Mon Oct 21 16:11:07 2019 +0200
117.3 @@ -0,0 +1,32 @@
117.4 +#ifndef _SYS_TIMES_H
117.5 +#ifdef __cplusplus
117.6 +extern "C" {
117.7 +#endif
117.8 +#define _SYS_TIMES_H
117.9 +
117.10 +#include <_ansi.h>
117.11 +#include <sys/_types.h>
117.12 +
117.13 +#if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
117.14 +typedef _CLOCK_T_ clock_t;
117.15 +#define __clock_t_defined
117.16 +#define _CLOCK_T_DECLARED
117.17 +#endif
117.18 +
117.19 +/* Get Process Times, P1003.1b-1993, p. 92 */
117.20 +struct tms {
117.21 + clock_t tms_utime; /* user time */
117.22 + clock_t tms_stime; /* system time */
117.23 + clock_t tms_cutime; /* user time, children */
117.24 + clock_t tms_cstime; /* system time, children */
117.25 +};
117.26 +
117.27 +clock_t times (struct tms *);
117.28 +#ifdef _COMPILING_NEWLIB
117.29 +clock_t _times (struct tms *);
117.30 +#endif
117.31 +
117.32 +#ifdef __cplusplus
117.33 +}
117.34 +#endif
117.35 +#endif /* !_SYS_TIMES_H */
118.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
118.2 +++ b/include/sys/timespec.h Mon Oct 21 16:11:07 2019 +0200
118.3 @@ -0,0 +1,63 @@
118.4 +/*-
118.5 + * Copyright (c) 1982, 1986, 1993
118.6 + * The Regents of the University of California. All rights reserved.
118.7 + *
118.8 + * Redistribution and use in source and binary forms, with or without
118.9 + * modification, are permitted provided that the following conditions
118.10 + * are met:
118.11 + * 1. Redistributions of source code must retain the above copyright
118.12 + * notice, this list of conditions and the following disclaimer.
118.13 + * 2. Redistributions in binary form must reproduce the above copyright
118.14 + * notice, this list of conditions and the following disclaimer in the
118.15 + * documentation and/or other materials provided with the distribution.
118.16 + * 4. Neither the name of the University nor the names of its contributors
118.17 + * may be used to endorse or promote products derived from this software
118.18 + * without specific prior written permission.
118.19 + *
118.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
118.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
118.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
118.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
118.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
118.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
118.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
118.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
118.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
118.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
118.30 + * SUCH DAMAGE.
118.31 + *
118.32 + * @(#)time.h 8.5 (Berkeley) 5/4/95
118.33 + * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
118.34 + * $FreeBSD$
118.35 + */
118.36 +
118.37 +#ifndef _SYS_TIMESPEC_H_
118.38 +#define _SYS_TIMESPEC_H_
118.39 +
118.40 +#include <sys/cdefs.h>
118.41 +#include <sys/_timespec.h>
118.42 +
118.43 +#if __BSD_VISIBLE
118.44 +#define TIMEVAL_TO_TIMESPEC(tv, ts) \
118.45 + do { \
118.46 + (ts)->tv_sec = (tv)->tv_sec; \
118.47 + (ts)->tv_nsec = (tv)->tv_usec * 1000; \
118.48 + } while (0)
118.49 +#define TIMESPEC_TO_TIMEVAL(tv, ts) \
118.50 + do { \
118.51 + (tv)->tv_sec = (ts)->tv_sec; \
118.52 + (tv)->tv_usec = (ts)->tv_nsec / 1000; \
118.53 + } while (0)
118.54 +
118.55 +#endif /* __BSD_VISIBLE */
118.56 +
118.57 +/*
118.58 + * Structure defined by POSIX.1b to be like a itimerval, but with
118.59 + * timespecs. Used in the timer_*() system calls.
118.60 + */
118.61 +struct itimerspec {
118.62 + struct timespec it_interval;
118.63 + struct timespec it_value;
118.64 +};
118.65 +
118.66 +#endif /* _SYS_TIMESPEC_H_ */
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
119.2 +++ b/include/sys/tree.h Mon Oct 21 16:11:07 2019 +0200
119.3 @@ -0,0 +1,803 @@
119.4 +/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */
119.5 +/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */
119.6 +/* $FreeBSD: head/sys/sys/tree.h 347360 2019-05-08 18:47:00Z trasz $ */
119.7 +
119.8 +/*-
119.9 + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
119.10 + *
119.11 + * Copyright 2002 Niels Provos <provos@citi.umich.edu>
119.12 + * All rights reserved.
119.13 + *
119.14 + * Redistribution and use in source and binary forms, with or without
119.15 + * modification, are permitted provided that the following conditions
119.16 + * are met:
119.17 + * 1. Redistributions of source code must retain the above copyright
119.18 + * notice, this list of conditions and the following disclaimer.
119.19 + * 2. Redistributions in binary form must reproduce the above copyright
119.20 + * notice, this list of conditions and the following disclaimer in the
119.21 + * documentation and/or other materials provided with the distribution.
119.22 + *
119.23 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
119.24 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
119.25 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
119.26 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
119.27 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
119.28 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
119.29 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
119.30 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
119.31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
119.32 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
119.33 + */
119.34 +
119.35 +#ifndef _SYS_TREE_H_
119.36 +#define _SYS_TREE_H_
119.37 +
119.38 +#include <sys/cdefs.h>
119.39 +
119.40 +/*
119.41 + * This file defines data structures for different types of trees:
119.42 + * splay trees and red-black trees.
119.43 + *
119.44 + * A splay tree is a self-organizing data structure. Every operation
119.45 + * on the tree causes a splay to happen. The splay moves the requested
119.46 + * node to the root of the tree and partly rebalances it.
119.47 + *
119.48 + * This has the benefit that request locality causes faster lookups as
119.49 + * the requested nodes move to the top of the tree. On the other hand,
119.50 + * every lookup causes memory writes.
119.51 + *
119.52 + * The Balance Theorem bounds the total access time for m operations
119.53 + * and n inserts on an initially empty tree as O((m + n)lg n). The
119.54 + * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
119.55 + *
119.56 + * A red-black tree is a binary search tree with the node color as an
119.57 + * extra attribute. It fulfills a set of conditions:
119.58 + * - every search path from the root to a leaf consists of the
119.59 + * same number of black nodes,
119.60 + * - each red node (except for the root) has a black parent,
119.61 + * - each leaf node is black.
119.62 + *
119.63 + * Every operation on a red-black tree is bounded as O(lg n).
119.64 + * The maximum height of a red-black tree is 2lg (n+1).
119.65 + */
119.66 +
119.67 +#define SPLAY_HEAD(name, type) \
119.68 +struct name { \
119.69 + struct type *sph_root; /* root of the tree */ \
119.70 +}
119.71 +
119.72 +#define SPLAY_INITIALIZER(root) \
119.73 + { NULL }
119.74 +
119.75 +#define SPLAY_INIT(root) do { \
119.76 + (root)->sph_root = NULL; \
119.77 +} while (/*CONSTCOND*/ 0)
119.78 +
119.79 +#define SPLAY_ENTRY(type) \
119.80 +struct { \
119.81 + struct type *spe_left; /* left element */ \
119.82 + struct type *spe_right; /* right element */ \
119.83 +}
119.84 +
119.85 +#define SPLAY_LEFT(elm, field) (elm)->field.spe_left
119.86 +#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right
119.87 +#define SPLAY_ROOT(head) (head)->sph_root
119.88 +#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL)
119.89 +
119.90 +/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
119.91 +#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \
119.92 + SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
119.93 + SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
119.94 + (head)->sph_root = tmp; \
119.95 +} while (/*CONSTCOND*/ 0)
119.96 +
119.97 +#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
119.98 + SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
119.99 + SPLAY_LEFT(tmp, field) = (head)->sph_root; \
119.100 + (head)->sph_root = tmp; \
119.101 +} while (/*CONSTCOND*/ 0)
119.102 +
119.103 +#define SPLAY_LINKLEFT(head, tmp, field) do { \
119.104 + SPLAY_LEFT(tmp, field) = (head)->sph_root; \
119.105 + tmp = (head)->sph_root; \
119.106 + (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
119.107 +} while (/*CONSTCOND*/ 0)
119.108 +
119.109 +#define SPLAY_LINKRIGHT(head, tmp, field) do { \
119.110 + SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
119.111 + tmp = (head)->sph_root; \
119.112 + (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
119.113 +} while (/*CONSTCOND*/ 0)
119.114 +
119.115 +#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
119.116 + SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
119.117 + SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
119.118 + SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
119.119 + SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
119.120 +} while (/*CONSTCOND*/ 0)
119.121 +
119.122 +/* Generates prototypes and inline functions */
119.123 +
119.124 +#define SPLAY_PROTOTYPE(name, type, field, cmp) \
119.125 +void name##_SPLAY(struct name *, struct type *); \
119.126 +void name##_SPLAY_MINMAX(struct name *, int); \
119.127 +struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
119.128 +struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
119.129 + \
119.130 +/* Finds the node with the same key as elm */ \
119.131 +static __unused __inline struct type * \
119.132 +name##_SPLAY_FIND(struct name *head, struct type *elm) \
119.133 +{ \
119.134 + if (SPLAY_EMPTY(head)) \
119.135 + return(NULL); \
119.136 + name##_SPLAY(head, elm); \
119.137 + if ((cmp)(elm, (head)->sph_root) == 0) \
119.138 + return (head->sph_root); \
119.139 + return (NULL); \
119.140 +} \
119.141 + \
119.142 +static __unused __inline struct type * \
119.143 +name##_SPLAY_NEXT(struct name *head, struct type *elm) \
119.144 +{ \
119.145 + name##_SPLAY(head, elm); \
119.146 + if (SPLAY_RIGHT(elm, field) != NULL) { \
119.147 + elm = SPLAY_RIGHT(elm, field); \
119.148 + while (SPLAY_LEFT(elm, field) != NULL) { \
119.149 + elm = SPLAY_LEFT(elm, field); \
119.150 + } \
119.151 + } else \
119.152 + elm = NULL; \
119.153 + return (elm); \
119.154 +} \
119.155 + \
119.156 +static __unused __inline struct type * \
119.157 +name##_SPLAY_MIN_MAX(struct name *head, int val) \
119.158 +{ \
119.159 + name##_SPLAY_MINMAX(head, val); \
119.160 + return (SPLAY_ROOT(head)); \
119.161 +}
119.162 +
119.163 +/* Main splay operation.
119.164 + * Moves node close to the key of elm to top
119.165 + */
119.166 +#define SPLAY_GENERATE(name, type, field, cmp) \
119.167 +struct type * \
119.168 +name##_SPLAY_INSERT(struct name *head, struct type *elm) \
119.169 +{ \
119.170 + if (SPLAY_EMPTY(head)) { \
119.171 + SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
119.172 + } else { \
119.173 + int __comp; \
119.174 + name##_SPLAY(head, elm); \
119.175 + __comp = (cmp)(elm, (head)->sph_root); \
119.176 + if(__comp < 0) { \
119.177 + SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
119.178 + SPLAY_RIGHT(elm, field) = (head)->sph_root; \
119.179 + SPLAY_LEFT((head)->sph_root, field) = NULL; \
119.180 + } else if (__comp > 0) { \
119.181 + SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
119.182 + SPLAY_LEFT(elm, field) = (head)->sph_root; \
119.183 + SPLAY_RIGHT((head)->sph_root, field) = NULL; \
119.184 + } else \
119.185 + return ((head)->sph_root); \
119.186 + } \
119.187 + (head)->sph_root = (elm); \
119.188 + return (NULL); \
119.189 +} \
119.190 + \
119.191 +struct type * \
119.192 +name##_SPLAY_REMOVE(struct name *head, struct type *elm) \
119.193 +{ \
119.194 + struct type *__tmp; \
119.195 + if (SPLAY_EMPTY(head)) \
119.196 + return (NULL); \
119.197 + name##_SPLAY(head, elm); \
119.198 + if ((cmp)(elm, (head)->sph_root) == 0) { \
119.199 + if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \
119.200 + (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
119.201 + } else { \
119.202 + __tmp = SPLAY_RIGHT((head)->sph_root, field); \
119.203 + (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
119.204 + name##_SPLAY(head, elm); \
119.205 + SPLAY_RIGHT((head)->sph_root, field) = __tmp; \
119.206 + } \
119.207 + return (elm); \
119.208 + } \
119.209 + return (NULL); \
119.210 +} \
119.211 + \
119.212 +void \
119.213 +name##_SPLAY(struct name *head, struct type *elm) \
119.214 +{ \
119.215 + struct type __node, *__left, *__right, *__tmp; \
119.216 + int __comp; \
119.217 +\
119.218 + SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
119.219 + __left = __right = &__node; \
119.220 +\
119.221 + while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \
119.222 + if (__comp < 0) { \
119.223 + __tmp = SPLAY_LEFT((head)->sph_root, field); \
119.224 + if (__tmp == NULL) \
119.225 + break; \
119.226 + if ((cmp)(elm, __tmp) < 0){ \
119.227 + SPLAY_ROTATE_RIGHT(head, __tmp, field); \
119.228 + if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
119.229 + break; \
119.230 + } \
119.231 + SPLAY_LINKLEFT(head, __right, field); \
119.232 + } else if (__comp > 0) { \
119.233 + __tmp = SPLAY_RIGHT((head)->sph_root, field); \
119.234 + if (__tmp == NULL) \
119.235 + break; \
119.236 + if ((cmp)(elm, __tmp) > 0){ \
119.237 + SPLAY_ROTATE_LEFT(head, __tmp, field); \
119.238 + if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
119.239 + break; \
119.240 + } \
119.241 + SPLAY_LINKRIGHT(head, __left, field); \
119.242 + } \
119.243 + } \
119.244 + SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
119.245 +} \
119.246 + \
119.247 +/* Splay with either the minimum or the maximum element \
119.248 + * Used to find minimum or maximum element in tree. \
119.249 + */ \
119.250 +void name##_SPLAY_MINMAX(struct name *head, int __comp) \
119.251 +{ \
119.252 + struct type __node, *__left, *__right, *__tmp; \
119.253 +\
119.254 + SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
119.255 + __left = __right = &__node; \
119.256 +\
119.257 + while (1) { \
119.258 + if (__comp < 0) { \
119.259 + __tmp = SPLAY_LEFT((head)->sph_root, field); \
119.260 + if (__tmp == NULL) \
119.261 + break; \
119.262 + if (__comp < 0){ \
119.263 + SPLAY_ROTATE_RIGHT(head, __tmp, field); \
119.264 + if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
119.265 + break; \
119.266 + } \
119.267 + SPLAY_LINKLEFT(head, __right, field); \
119.268 + } else if (__comp > 0) { \
119.269 + __tmp = SPLAY_RIGHT((head)->sph_root, field); \
119.270 + if (__tmp == NULL) \
119.271 + break; \
119.272 + if (__comp > 0) { \
119.273 + SPLAY_ROTATE_LEFT(head, __tmp, field); \
119.274 + if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
119.275 + break; \
119.276 + } \
119.277 + SPLAY_LINKRIGHT(head, __left, field); \
119.278 + } \
119.279 + } \
119.280 + SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
119.281 +}
119.282 +
119.283 +#define SPLAY_NEGINF -1
119.284 +#define SPLAY_INF 1
119.285 +
119.286 +#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
119.287 +#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
119.288 +#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y)
119.289 +#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y)
119.290 +#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \
119.291 + : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
119.292 +#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \
119.293 + : name##_SPLAY_MIN_MAX(x, SPLAY_INF))
119.294 +
119.295 +#define SPLAY_FOREACH(x, name, head) \
119.296 + for ((x) = SPLAY_MIN(name, head); \
119.297 + (x) != NULL; \
119.298 + (x) = SPLAY_NEXT(name, head, x))
119.299 +
119.300 +/* Macros that define a red-black tree */
119.301 +#define RB_HEAD(name, type) \
119.302 +struct name { \
119.303 + struct type *rbh_root; /* root of the tree */ \
119.304 +}
119.305 +
119.306 +#define RB_INITIALIZER(root) \
119.307 + { NULL }
119.308 +
119.309 +#define RB_INIT(root) do { \
119.310 + (root)->rbh_root = NULL; \
119.311 +} while (/*CONSTCOND*/ 0)
119.312 +
119.313 +#define RB_BLACK 0
119.314 +#define RB_RED 1
119.315 +#define RB_ENTRY(type) \
119.316 +struct { \
119.317 + struct type *rbe_left; /* left element */ \
119.318 + struct type *rbe_right; /* right element */ \
119.319 + struct type *rbe_parent; /* parent element */ \
119.320 + int rbe_color; /* node color */ \
119.321 +}
119.322 +
119.323 +#define RB_LEFT(elm, field) (elm)->field.rbe_left
119.324 +#define RB_RIGHT(elm, field) (elm)->field.rbe_right
119.325 +#define RB_PARENT(elm, field) (elm)->field.rbe_parent
119.326 +#define RB_COLOR(elm, field) (elm)->field.rbe_color
119.327 +#define RB_ROOT(head) (head)->rbh_root
119.328 +#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
119.329 +
119.330 +#define RB_SET(elm, parent, field) do { \
119.331 + RB_PARENT(elm, field) = parent; \
119.332 + RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
119.333 + RB_COLOR(elm, field) = RB_RED; \
119.334 +} while (/*CONSTCOND*/ 0)
119.335 +
119.336 +#define RB_SET_BLACKRED(black, red, field) do { \
119.337 + RB_COLOR(black, field) = RB_BLACK; \
119.338 + RB_COLOR(red, field) = RB_RED; \
119.339 +} while (/*CONSTCOND*/ 0)
119.340 +
119.341 +#ifndef RB_AUGMENT
119.342 +#define RB_AUGMENT(x) do {} while (0)
119.343 +#endif
119.344 +
119.345 +#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
119.346 + (tmp) = RB_RIGHT(elm, field); \
119.347 + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
119.348 + RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
119.349 + } \
119.350 + RB_AUGMENT(elm); \
119.351 + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
119.352 + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
119.353 + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
119.354 + else \
119.355 + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
119.356 + } else \
119.357 + (head)->rbh_root = (tmp); \
119.358 + RB_LEFT(tmp, field) = (elm); \
119.359 + RB_PARENT(elm, field) = (tmp); \
119.360 + RB_AUGMENT(tmp); \
119.361 + if ((RB_PARENT(tmp, field))) \
119.362 + RB_AUGMENT(RB_PARENT(tmp, field)); \
119.363 +} while (/*CONSTCOND*/ 0)
119.364 +
119.365 +#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
119.366 + (tmp) = RB_LEFT(elm, field); \
119.367 + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
119.368 + RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
119.369 + } \
119.370 + RB_AUGMENT(elm); \
119.371 + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
119.372 + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
119.373 + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
119.374 + else \
119.375 + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
119.376 + } else \
119.377 + (head)->rbh_root = (tmp); \
119.378 + RB_RIGHT(tmp, field) = (elm); \
119.379 + RB_PARENT(elm, field) = (tmp); \
119.380 + RB_AUGMENT(tmp); \
119.381 + if ((RB_PARENT(tmp, field))) \
119.382 + RB_AUGMENT(RB_PARENT(tmp, field)); \
119.383 +} while (/*CONSTCOND*/ 0)
119.384 +
119.385 +/* Generates prototypes and inline functions */
119.386 +#define RB_PROTOTYPE(name, type, field, cmp) \
119.387 + RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
119.388 +#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
119.389 + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
119.390 +#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
119.391 + RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \
119.392 + RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \
119.393 + RB_PROTOTYPE_INSERT(name, type, attr); \
119.394 + RB_PROTOTYPE_REMOVE(name, type, attr); \
119.395 + RB_PROTOTYPE_FIND(name, type, attr); \
119.396 + RB_PROTOTYPE_NFIND(name, type, attr); \
119.397 + RB_PROTOTYPE_NEXT(name, type, attr); \
119.398 + RB_PROTOTYPE_PREV(name, type, attr); \
119.399 + RB_PROTOTYPE_MINMAX(name, type, attr);
119.400 +#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \
119.401 + attr void name##_RB_INSERT_COLOR(struct name *, struct type *)
119.402 +#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \
119.403 + attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *)
119.404 +#define RB_PROTOTYPE_REMOVE(name, type, attr) \
119.405 + attr struct type *name##_RB_REMOVE(struct name *, struct type *)
119.406 +#define RB_PROTOTYPE_INSERT(name, type, attr) \
119.407 + attr struct type *name##_RB_INSERT(struct name *, struct type *)
119.408 +#define RB_PROTOTYPE_FIND(name, type, attr) \
119.409 + attr struct type *name##_RB_FIND(struct name *, struct type *)
119.410 +#define RB_PROTOTYPE_NFIND(name, type, attr) \
119.411 + attr struct type *name##_RB_NFIND(struct name *, struct type *)
119.412 +#define RB_PROTOTYPE_NEXT(name, type, attr) \
119.413 + attr struct type *name##_RB_NEXT(struct type *)
119.414 +#define RB_PROTOTYPE_PREV(name, type, attr) \
119.415 + attr struct type *name##_RB_PREV(struct type *)
119.416 +#define RB_PROTOTYPE_MINMAX(name, type, attr) \
119.417 + attr struct type *name##_RB_MINMAX(struct name *, int)
119.418 +
119.419 +/* Main rb operation.
119.420 + * Moves node close to the key of elm to top
119.421 + */
119.422 +#define RB_GENERATE(name, type, field, cmp) \
119.423 + RB_GENERATE_INTERNAL(name, type, field, cmp,)
119.424 +#define RB_GENERATE_STATIC(name, type, field, cmp) \
119.425 + RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
119.426 +#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
119.427 + RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
119.428 + RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
119.429 + RB_GENERATE_INSERT(name, type, field, cmp, attr) \
119.430 + RB_GENERATE_REMOVE(name, type, field, attr) \
119.431 + RB_GENERATE_FIND(name, type, field, cmp, attr) \
119.432 + RB_GENERATE_NFIND(name, type, field, cmp, attr) \
119.433 + RB_GENERATE_NEXT(name, type, field, attr) \
119.434 + RB_GENERATE_PREV(name, type, field, attr) \
119.435 + RB_GENERATE_MINMAX(name, type, field, attr)
119.436 +
119.437 +#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
119.438 +attr void \
119.439 +name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
119.440 +{ \
119.441 + struct type *parent, *gparent, *tmp; \
119.442 + while ((parent = RB_PARENT(elm, field)) != NULL && \
119.443 + RB_COLOR(parent, field) == RB_RED) { \
119.444 + gparent = RB_PARENT(parent, field); \
119.445 + if (parent == RB_LEFT(gparent, field)) { \
119.446 + tmp = RB_RIGHT(gparent, field); \
119.447 + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
119.448 + RB_COLOR(tmp, field) = RB_BLACK; \
119.449 + RB_SET_BLACKRED(parent, gparent, field);\
119.450 + elm = gparent; \
119.451 + continue; \
119.452 + } \
119.453 + if (RB_RIGHT(parent, field) == elm) { \
119.454 + RB_ROTATE_LEFT(head, parent, tmp, field);\
119.455 + tmp = parent; \
119.456 + parent = elm; \
119.457 + elm = tmp; \
119.458 + } \
119.459 + RB_SET_BLACKRED(parent, gparent, field); \
119.460 + RB_ROTATE_RIGHT(head, gparent, tmp, field); \
119.461 + } else { \
119.462 + tmp = RB_LEFT(gparent, field); \
119.463 + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
119.464 + RB_COLOR(tmp, field) = RB_BLACK; \
119.465 + RB_SET_BLACKRED(parent, gparent, field);\
119.466 + elm = gparent; \
119.467 + continue; \
119.468 + } \
119.469 + if (RB_LEFT(parent, field) == elm) { \
119.470 + RB_ROTATE_RIGHT(head, parent, tmp, field);\
119.471 + tmp = parent; \
119.472 + parent = elm; \
119.473 + elm = tmp; \
119.474 + } \
119.475 + RB_SET_BLACKRED(parent, gparent, field); \
119.476 + RB_ROTATE_LEFT(head, gparent, tmp, field); \
119.477 + } \
119.478 + } \
119.479 + RB_COLOR(head->rbh_root, field) = RB_BLACK; \
119.480 +}
119.481 +
119.482 +#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
119.483 +attr void \
119.484 +name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
119.485 +{ \
119.486 + struct type *tmp; \
119.487 + while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
119.488 + elm != RB_ROOT(head)) { \
119.489 + if (RB_LEFT(parent, field) == elm) { \
119.490 + tmp = RB_RIGHT(parent, field); \
119.491 + if (RB_COLOR(tmp, field) == RB_RED) { \
119.492 + RB_SET_BLACKRED(tmp, parent, field); \
119.493 + RB_ROTATE_LEFT(head, parent, tmp, field);\
119.494 + tmp = RB_RIGHT(parent, field); \
119.495 + } \
119.496 + if ((RB_LEFT(tmp, field) == NULL || \
119.497 + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
119.498 + (RB_RIGHT(tmp, field) == NULL || \
119.499 + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
119.500 + RB_COLOR(tmp, field) = RB_RED; \
119.501 + elm = parent; \
119.502 + parent = RB_PARENT(elm, field); \
119.503 + } else { \
119.504 + if (RB_RIGHT(tmp, field) == NULL || \
119.505 + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
119.506 + struct type *oleft; \
119.507 + if ((oleft = RB_LEFT(tmp, field)) \
119.508 + != NULL) \
119.509 + RB_COLOR(oleft, field) = RB_BLACK;\
119.510 + RB_COLOR(tmp, field) = RB_RED; \
119.511 + RB_ROTATE_RIGHT(head, tmp, oleft, field);\
119.512 + tmp = RB_RIGHT(parent, field); \
119.513 + } \
119.514 + RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
119.515 + RB_COLOR(parent, field) = RB_BLACK; \
119.516 + if (RB_RIGHT(tmp, field)) \
119.517 + RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
119.518 + RB_ROTATE_LEFT(head, parent, tmp, field);\
119.519 + elm = RB_ROOT(head); \
119.520 + break; \
119.521 + } \
119.522 + } else { \
119.523 + tmp = RB_LEFT(parent, field); \
119.524 + if (RB_COLOR(tmp, field) == RB_RED) { \
119.525 + RB_SET_BLACKRED(tmp, parent, field); \
119.526 + RB_ROTATE_RIGHT(head, parent, tmp, field);\
119.527 + tmp = RB_LEFT(parent, field); \
119.528 + } \
119.529 + if ((RB_LEFT(tmp, field) == NULL || \
119.530 + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
119.531 + (RB_RIGHT(tmp, field) == NULL || \
119.532 + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
119.533 + RB_COLOR(tmp, field) = RB_RED; \
119.534 + elm = parent; \
119.535 + parent = RB_PARENT(elm, field); \
119.536 + } else { \
119.537 + if (RB_LEFT(tmp, field) == NULL || \
119.538 + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
119.539 + struct type *oright; \
119.540 + if ((oright = RB_RIGHT(tmp, field)) \
119.541 + != NULL) \
119.542 + RB_COLOR(oright, field) = RB_BLACK;\
119.543 + RB_COLOR(tmp, field) = RB_RED; \
119.544 + RB_ROTATE_LEFT(head, tmp, oright, field);\
119.545 + tmp = RB_LEFT(parent, field); \
119.546 + } \
119.547 + RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
119.548 + RB_COLOR(parent, field) = RB_BLACK; \
119.549 + if (RB_LEFT(tmp, field)) \
119.550 + RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
119.551 + RB_ROTATE_RIGHT(head, parent, tmp, field);\
119.552 + elm = RB_ROOT(head); \
119.553 + break; \
119.554 + } \
119.555 + } \
119.556 + } \
119.557 + if (elm) \
119.558 + RB_COLOR(elm, field) = RB_BLACK; \
119.559 +}
119.560 +
119.561 +#define RB_GENERATE_REMOVE(name, type, field, attr) \
119.562 +attr struct type * \
119.563 +name##_RB_REMOVE(struct name *head, struct type *elm) \
119.564 +{ \
119.565 + struct type *child, *parent, *old = elm; \
119.566 + int color; \
119.567 + if (RB_LEFT(elm, field) == NULL) \
119.568 + child = RB_RIGHT(elm, field); \
119.569 + else if (RB_RIGHT(elm, field) == NULL) \
119.570 + child = RB_LEFT(elm, field); \
119.571 + else { \
119.572 + struct type *left; \
119.573 + elm = RB_RIGHT(elm, field); \
119.574 + while ((left = RB_LEFT(elm, field)) != NULL) \
119.575 + elm = left; \
119.576 + child = RB_RIGHT(elm, field); \
119.577 + parent = RB_PARENT(elm, field); \
119.578 + color = RB_COLOR(elm, field); \
119.579 + if (child) \
119.580 + RB_PARENT(child, field) = parent; \
119.581 + if (parent) { \
119.582 + if (RB_LEFT(parent, field) == elm) \
119.583 + RB_LEFT(parent, field) = child; \
119.584 + else \
119.585 + RB_RIGHT(parent, field) = child; \
119.586 + RB_AUGMENT(parent); \
119.587 + } else \
119.588 + RB_ROOT(head) = child; \
119.589 + if (RB_PARENT(elm, field) == old) \
119.590 + parent = elm; \
119.591 + (elm)->field = (old)->field; \
119.592 + if (RB_PARENT(old, field)) { \
119.593 + if (RB_LEFT(RB_PARENT(old, field), field) == old)\
119.594 + RB_LEFT(RB_PARENT(old, field), field) = elm;\
119.595 + else \
119.596 + RB_RIGHT(RB_PARENT(old, field), field) = elm;\
119.597 + RB_AUGMENT(RB_PARENT(old, field)); \
119.598 + } else \
119.599 + RB_ROOT(head) = elm; \
119.600 + RB_PARENT(RB_LEFT(old, field), field) = elm; \
119.601 + if (RB_RIGHT(old, field)) \
119.602 + RB_PARENT(RB_RIGHT(old, field), field) = elm; \
119.603 + if (parent) { \
119.604 + left = parent; \
119.605 + do { \
119.606 + RB_AUGMENT(left); \
119.607 + } while ((left = RB_PARENT(left, field)) != NULL); \
119.608 + } \
119.609 + goto color; \
119.610 + } \
119.611 + parent = RB_PARENT(elm, field); \
119.612 + color = RB_COLOR(elm, field); \
119.613 + if (child) \
119.614 + RB_PARENT(child, field) = parent; \
119.615 + if (parent) { \
119.616 + if (RB_LEFT(parent, field) == elm) \
119.617 + RB_LEFT(parent, field) = child; \
119.618 + else \
119.619 + RB_RIGHT(parent, field) = child; \
119.620 + RB_AUGMENT(parent); \
119.621 + } else \
119.622 + RB_ROOT(head) = child; \
119.623 +color: \
119.624 + if (color == RB_BLACK) \
119.625 + name##_RB_REMOVE_COLOR(head, parent, child); \
119.626 + return (old); \
119.627 +} \
119.628 +
119.629 +#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \
119.630 +/* Inserts a node into the RB tree */ \
119.631 +attr struct type * \
119.632 +name##_RB_INSERT(struct name *head, struct type *elm) \
119.633 +{ \
119.634 + struct type *tmp; \
119.635 + struct type *parent = NULL; \
119.636 + int comp = 0; \
119.637 + tmp = RB_ROOT(head); \
119.638 + while (tmp) { \
119.639 + parent = tmp; \
119.640 + comp = (cmp)(elm, parent); \
119.641 + if (comp < 0) \
119.642 + tmp = RB_LEFT(tmp, field); \
119.643 + else if (comp > 0) \
119.644 + tmp = RB_RIGHT(tmp, field); \
119.645 + else \
119.646 + return (tmp); \
119.647 + } \
119.648 + RB_SET(elm, parent, field); \
119.649 + if (parent != NULL) { \
119.650 + if (comp < 0) \
119.651 + RB_LEFT(parent, field) = elm; \
119.652 + else \
119.653 + RB_RIGHT(parent, field) = elm; \
119.654 + RB_AUGMENT(parent); \
119.655 + } else \
119.656 + RB_ROOT(head) = elm; \
119.657 + name##_RB_INSERT_COLOR(head, elm); \
119.658 + return (NULL); \
119.659 +}
119.660 +
119.661 +#define RB_GENERATE_FIND(name, type, field, cmp, attr) \
119.662 +/* Finds the node with the same key as elm */ \
119.663 +attr struct type * \
119.664 +name##_RB_FIND(struct name *head, struct type *elm) \
119.665 +{ \
119.666 + struct type *tmp = RB_ROOT(head); \
119.667 + int comp; \
119.668 + while (tmp) { \
119.669 + comp = cmp(elm, tmp); \
119.670 + if (comp < 0) \
119.671 + tmp = RB_LEFT(tmp, field); \
119.672 + else if (comp > 0) \
119.673 + tmp = RB_RIGHT(tmp, field); \
119.674 + else \
119.675 + return (tmp); \
119.676 + } \
119.677 + return (NULL); \
119.678 +}
119.679 +
119.680 +#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \
119.681 +/* Finds the first node greater than or equal to the search key */ \
119.682 +attr struct type * \
119.683 +name##_RB_NFIND(struct name *head, struct type *elm) \
119.684 +{ \
119.685 + struct type *tmp = RB_ROOT(head); \
119.686 + struct type *res = NULL; \
119.687 + int comp; \
119.688 + while (tmp) { \
119.689 + comp = cmp(elm, tmp); \
119.690 + if (comp < 0) { \
119.691 + res = tmp; \
119.692 + tmp = RB_LEFT(tmp, field); \
119.693 + } \
119.694 + else if (comp > 0) \
119.695 + tmp = RB_RIGHT(tmp, field); \
119.696 + else \
119.697 + return (tmp); \
119.698 + } \
119.699 + return (res); \
119.700 +}
119.701 +
119.702 +#define RB_GENERATE_NEXT(name, type, field, attr) \
119.703 +/* ARGSUSED */ \
119.704 +attr struct type * \
119.705 +name##_RB_NEXT(struct type *elm) \
119.706 +{ \
119.707 + if (RB_RIGHT(elm, field)) { \
119.708 + elm = RB_RIGHT(elm, field); \
119.709 + while (RB_LEFT(elm, field)) \
119.710 + elm = RB_LEFT(elm, field); \
119.711 + } else { \
119.712 + if (RB_PARENT(elm, field) && \
119.713 + (elm == RB_LEFT(RB_PARENT(elm, field), field))) \
119.714 + elm = RB_PARENT(elm, field); \
119.715 + else { \
119.716 + while (RB_PARENT(elm, field) && \
119.717 + (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
119.718 + elm = RB_PARENT(elm, field); \
119.719 + elm = RB_PARENT(elm, field); \
119.720 + } \
119.721 + } \
119.722 + return (elm); \
119.723 +}
119.724 +
119.725 +#define RB_GENERATE_PREV(name, type, field, attr) \
119.726 +/* ARGSUSED */ \
119.727 +attr struct type * \
119.728 +name##_RB_PREV(struct type *elm) \
119.729 +{ \
119.730 + if (RB_LEFT(elm, field)) { \
119.731 + elm = RB_LEFT(elm, field); \
119.732 + while (RB_RIGHT(elm, field)) \
119.733 + elm = RB_RIGHT(elm, field); \
119.734 + } else { \
119.735 + if (RB_PARENT(elm, field) && \
119.736 + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
119.737 + elm = RB_PARENT(elm, field); \
119.738 + else { \
119.739 + while (RB_PARENT(elm, field) && \
119.740 + (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
119.741 + elm = RB_PARENT(elm, field); \
119.742 + elm = RB_PARENT(elm, field); \
119.743 + } \
119.744 + } \
119.745 + return (elm); \
119.746 +}
119.747 +
119.748 +#define RB_GENERATE_MINMAX(name, type, field, attr) \
119.749 +attr struct type * \
119.750 +name##_RB_MINMAX(struct name *head, int val) \
119.751 +{ \
119.752 + struct type *tmp = RB_ROOT(head); \
119.753 + struct type *parent = NULL; \
119.754 + while (tmp) { \
119.755 + parent = tmp; \
119.756 + if (val < 0) \
119.757 + tmp = RB_LEFT(tmp, field); \
119.758 + else \
119.759 + tmp = RB_RIGHT(tmp, field); \
119.760 + } \
119.761 + return (parent); \
119.762 +}
119.763 +
119.764 +#define RB_NEGINF -1
119.765 +#define RB_INF 1
119.766 +
119.767 +#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
119.768 +#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
119.769 +#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
119.770 +#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
119.771 +#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
119.772 +#define RB_PREV(name, x, y) name##_RB_PREV(y)
119.773 +#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
119.774 +#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
119.775 +
119.776 +#define RB_FOREACH(x, name, head) \
119.777 + for ((x) = RB_MIN(name, head); \
119.778 + (x) != NULL; \
119.779 + (x) = name##_RB_NEXT(x))
119.780 +
119.781 +#define RB_FOREACH_FROM(x, name, y) \
119.782 + for ((x) = (y); \
119.783 + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
119.784 + (x) = (y))
119.785 +
119.786 +#define RB_FOREACH_SAFE(x, name, head, y) \
119.787 + for ((x) = RB_MIN(name, head); \
119.788 + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
119.789 + (x) = (y))
119.790 +
119.791 +#define RB_FOREACH_REVERSE(x, name, head) \
119.792 + for ((x) = RB_MAX(name, head); \
119.793 + (x) != NULL; \
119.794 + (x) = name##_RB_PREV(x))
119.795 +
119.796 +#define RB_FOREACH_REVERSE_FROM(x, name, y) \
119.797 + for ((x) = (y); \
119.798 + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
119.799 + (x) = (y))
119.800 +
119.801 +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
119.802 + for ((x) = RB_MAX(name, head); \
119.803 + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
119.804 + (x) = (y))
119.805 +
119.806 +#endif /* _SYS_TREE_H_ */
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120.2 +++ b/include/sys/types.h Mon Oct 21 16:11:07 2019 +0200
120.3 @@ -0,0 +1,230 @@
120.4 +/* unified sys/types.h:
120.5 + start with sef's sysvi386 version.
120.6 + merge go32 version -- a few ifdefs.
120.7 + h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
120.8 +
120.9 + typedef int gid_t;
120.10 + typedef int uid_t;
120.11 + typedef int dev_t;
120.12 + typedef int ino_t;
120.13 + typedef int mode_t;
120.14 + typedef int caddr_t;
120.15 +
120.16 + however, these aren't "reasonable" values, the sysvi386 ones make far
120.17 + more sense, and should work sufficiently well (in particular, h8300
120.18 + doesn't have a stat, and the necv70 doesn't matter.) -- eichin
120.19 + */
120.20 +
120.21 +#ifndef _SYS_TYPES_H
120.22 +
120.23 +#include <_ansi.h>
120.24 +#include <sys/cdefs.h>
120.25 +#include <machine/_types.h>
120.26 +
120.27 +/* BSD types permitted by POSIX and always exposed as in Glibc. Only provided
120.28 + for backward compatibility with BSD code. The uintN_t standard types should
120.29 + be preferred in new code. */
120.30 +#if ___int8_t_defined
120.31 +typedef __uint8_t u_int8_t;
120.32 +#endif
120.33 +#if ___int16_t_defined
120.34 +typedef __uint16_t u_int16_t;
120.35 +#endif
120.36 +#if ___int32_t_defined
120.37 +typedef __uint32_t u_int32_t;
120.38 +#endif
120.39 +#if ___int64_t_defined
120.40 +typedef __uint64_t u_int64_t;
120.41 +#endif
120.42 +typedef __intptr_t register_t;
120.43 +#define __BIT_TYPES_DEFINED__ 1
120.44 +
120.45 +#ifndef __need_inttypes
120.46 +
120.47 +#define _SYS_TYPES_H
120.48 +#include <sys/_types.h>
120.49 +#include <sys/_stdint.h>
120.50 +
120.51 +#if __BSD_VISIBLE
120.52 +#include <machine/endian.h>
120.53 +#include <sys/select.h>
120.54 +# define physadr physadr_t
120.55 +# define quad quad_t
120.56 +
120.57 +#ifndef _IN_ADDR_T_DECLARED
120.58 +typedef __uint32_t in_addr_t; /* base type for internet address */
120.59 +#define _IN_ADDR_T_DECLARED
120.60 +#endif
120.61 +
120.62 +#ifndef _IN_PORT_T_DECLARED
120.63 +typedef __uint16_t in_port_t;
120.64 +#define _IN_PORT_T_DECLARED
120.65 +#endif
120.66 +
120.67 +typedef __uintptr_t u_register_t;
120.68 +#endif /* __BSD_VISIBLE */
120.69 +
120.70 +#if __MISC_VISIBLE
120.71 +#ifndef _BSDTYPES_DEFINED
120.72 +/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
120.73 +#ifndef __u_char_defined
120.74 +typedef unsigned char u_char;
120.75 +#define __u_char_defined
120.76 +#endif
120.77 +#ifndef __u_short_defined
120.78 +typedef unsigned short u_short;
120.79 +#define __u_short_defined
120.80 +#endif
120.81 +#ifndef __u_int_defined
120.82 +typedef unsigned int u_int;
120.83 +#define __u_int_defined
120.84 +#endif
120.85 +#ifndef __u_long_defined
120.86 +typedef unsigned long u_long;
120.87 +#define __u_long_defined
120.88 +#endif
120.89 +#define _BSDTYPES_DEFINED
120.90 +#endif
120.91 +#endif /* __MISC_VISIBLE */
120.92 +
120.93 +#if __MISC_VISIBLE
120.94 +typedef unsigned short ushort; /* System V compatibility */
120.95 +typedef unsigned int uint; /* System V compatibility */
120.96 +typedef unsigned long ulong; /* System V compatibility */
120.97 +#endif
120.98 +
120.99 +#ifndef _BLKCNT_T_DECLARED
120.100 +typedef __blkcnt_t blkcnt_t;
120.101 +#define _BLKCNT_T_DECLARED
120.102 +#endif
120.103 +
120.104 +#ifndef _BLKSIZE_T_DECLARED
120.105 +typedef __blksize_t blksize_t;
120.106 +#define _BLKSIZE_T_DECLARED
120.107 +#endif
120.108 +
120.109 +#if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
120.110 +typedef _CLOCK_T_ clock_t;
120.111 +#define __clock_t_defined
120.112 +#define _CLOCK_T_DECLARED
120.113 +#endif
120.114 +
120.115 +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
120.116 +typedef _TIME_T_ time_t;
120.117 +#define __time_t_defined
120.118 +#define _TIME_T_DECLARED
120.119 +#endif
120.120 +
120.121 +#ifndef __daddr_t_defined
120.122 +typedef long daddr_t;
120.123 +#define __daddr_t_defined
120.124 +#endif
120.125 +#ifndef __caddr_t_defined
120.126 +typedef char * caddr_t;
120.127 +#define __caddr_t_defined
120.128 +#endif
120.129 +
120.130 +#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
120.131 +typedef __fsblkcnt_t fsblkcnt_t;
120.132 +typedef __fsfilcnt_t fsfilcnt_t;
120.133 +#define _FSBLKCNT_T_DECLARED
120.134 +#endif
120.135 +
120.136 +#ifndef _ID_T_DECLARED
120.137 +typedef __id_t id_t; /* can hold a uid_t or pid_t */
120.138 +#define _ID_T_DECLARED
120.139 +#endif
120.140 +
120.141 +#ifndef _INO_T_DECLARED
120.142 +typedef __ino_t ino_t; /* inode number */
120.143 +#define _INO_T_DECLARED
120.144 +#endif
120.145 +
120.146 +#if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
120.147 +typedef char * addr_t;
120.148 +typedef unsigned long vm_offset_t;
120.149 +typedef unsigned long vm_size_t;
120.150 +#endif /* __i386__ && (GO32 || __MSDOS__) */
120.151 +
120.152 +/*
120.153 + * All these should be machine specific - right now they are all broken.
120.154 + * However, for all of Cygnus' embedded targets, we want them to all be
120.155 + * the same. Otherwise things like sizeof (struct stat) might depend on
120.156 + * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
120.157 + */
120.158 +
120.159 +#ifndef _OFF_T_DECLARED
120.160 +typedef __off_t off_t; /* file offset */
120.161 +#define _OFF_T_DECLARED
120.162 +#endif
120.163 +#ifndef _DEV_T_DECLARED
120.164 +typedef __dev_t dev_t; /* device number or struct cdev */
120.165 +#define _DEV_T_DECLARED
120.166 +#endif
120.167 +#ifndef _UID_T_DECLARED
120.168 +typedef __uid_t uid_t; /* user id */
120.169 +#define _UID_T_DECLARED
120.170 +#endif
120.171 +#ifndef _GID_T_DECLARED
120.172 +typedef __gid_t gid_t; /* group id */
120.173 +#define _GID_T_DECLARED
120.174 +#endif
120.175 +
120.176 +#ifndef _PID_T_DECLARED
120.177 +typedef __pid_t pid_t; /* process id */
120.178 +#define _PID_T_DECLARED
120.179 +#endif
120.180 +
120.181 +#ifndef _KEY_T_DECLARED
120.182 +typedef __key_t key_t; /* IPC key */
120.183 +#define _KEY_T_DECLARED
120.184 +#endif
120.185 +
120.186 +#ifndef _SSIZE_T_DECLARED
120.187 +typedef _ssize_t ssize_t;
120.188 +#define _SSIZE_T_DECLARED
120.189 +#endif
120.190 +
120.191 +#ifndef _MODE_T_DECLARED
120.192 +typedef __mode_t mode_t; /* permissions */
120.193 +#define _MODE_T_DECLARED
120.194 +#endif
120.195 +
120.196 +#ifndef _NLINK_T_DECLARED
120.197 +typedef __nlink_t nlink_t; /* link count */
120.198 +#define _NLINK_T_DECLARED
120.199 +#endif
120.200 +
120.201 +#if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED)
120.202 +typedef __clockid_t clockid_t;
120.203 +#define __clockid_t_defined
120.204 +#define _CLOCKID_T_DECLARED
120.205 +#endif
120.206 +
120.207 +#if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
120.208 +typedef __timer_t timer_t;
120.209 +#define __timer_t_defined
120.210 +#define _TIMER_T_DECLARED
120.211 +#endif
120.212 +
120.213 +#ifndef _USECONDS_T_DECLARED
120.214 +typedef __useconds_t useconds_t; /* microseconds (unsigned) */
120.215 +#define _USECONDS_T_DECLARED
120.216 +#endif
120.217 +
120.218 +#ifndef _SUSECONDS_T_DECLARED
120.219 +typedef __suseconds_t suseconds_t;
120.220 +#define _SUSECONDS_T_DECLARED
120.221 +#endif
120.222 +
120.223 +typedef __int64_t sbintime_t;
120.224 +
120.225 +#include <sys/features.h>
120.226 +#include <sys/_pthreadtypes.h>
120.227 +#include <machine/types.h>
120.228 +
120.229 +#endif /* !__need_inttypes */
120.230 +
120.231 +#undef __need_inttypes
120.232 +
120.233 +#endif /* _SYS_TYPES_H */
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121.2 +++ b/include/sys/unistd.h Mon Oct 21 16:11:07 2019 +0200
121.3 @@ -0,0 +1,599 @@
121.4 +#ifndef _SYS_UNISTD_H
121.5 +#define _SYS_UNISTD_H
121.6 +
121.7 +#ifdef __cplusplus
121.8 +extern "C" {
121.9 +#endif
121.10 +
121.11 +#include <_ansi.h>
121.12 +#define __need_size_t
121.13 +#define __need_ptrdiff_t
121.14 +#include <sys/cdefs.h>
121.15 +#include <sys/types.h>
121.16 +#include <sys/_types.h>
121.17 +#include <stddef.h>
121.18 +
121.19 +extern char **environ;
121.20 +
121.21 +void _exit (int __status) _ATTRIBUTE ((__noreturn__));
121.22 +
121.23 +int access (const char *__path, int __amode);
121.24 +unsigned alarm (unsigned __secs);
121.25 +int chdir (const char *__path);
121.26 +int chmod (const char *__path, mode_t __mode);
121.27 +#if !defined(__INSIDE_CYGWIN__)
121.28 +int chown (const char *__path, uid_t __owner, gid_t __group);
121.29 +#endif
121.30 +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
121.31 +int chroot (const char *__path);
121.32 +#endif
121.33 +int close (int __fildes);
121.34 +#if __POSIX_VISIBLE >= 199209
121.35 +size_t confstr (int __name, char *__buf, size_t __len);
121.36 +#endif
121.37 +#if __XSI_VISIBLE
121.38 +char * crypt (const char *__key, const char *__salt);
121.39 +#endif
121.40 +#if __XSI_VISIBLE && __XSI_VISIBLE < 700
121.41 +char * ctermid (char *__s);
121.42 +#endif
121.43 +#if __XSI_VISIBLE && __XSI_VISIBLE < 600
121.44 +char * cuserid (char *__s);
121.45 +#endif
121.46 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.47 +int daemon (int nochdir, int noclose);
121.48 +#endif
121.49 +int dup (int __fildes);
121.50 +int dup2 (int __fildes, int __fildes2);
121.51 +#if __GNU_VISIBLE
121.52 +int dup3 (int __fildes, int __fildes2, int flags);
121.53 +int eaccess (const char *__path, int __mode);
121.54 +#endif
121.55 +#if __XSI_VISIBLE
121.56 +void encrypt (char *__block, int __edflag);
121.57 +#endif
121.58 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.59 +void endusershell (void);
121.60 +#endif
121.61 +#if __GNU_VISIBLE
121.62 +int euidaccess (const char *__path, int __mode);
121.63 +#endif
121.64 +int execl (const char *__path, const char *, ...);
121.65 +int execle (const char *__path, const char *, ...);
121.66 +int execlp (const char *__file, const char *, ...);
121.67 +#if __MISC_VISIBLE
121.68 +int execlpe (const char *__file, const char *, ...);
121.69 +#endif
121.70 +int execv (const char *__path, char * const __argv[]);
121.71 +int execve (const char *__path, char * const __argv[], char * const __envp[]);
121.72 +int execvp (const char *__file, char * const __argv[]);
121.73 +#if __GNU_VISIBLE
121.74 +int execvpe (const char *__file, char * const __argv[], char * const __envp[]);
121.75 +#endif
121.76 +#if __ATFILE_VISIBLE
121.77 +int faccessat (int __dirfd, const char *__path, int __mode, int __flags);
121.78 +#endif
121.79 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
121.80 +int fchdir (int __fildes);
121.81 +#endif
121.82 +#if __POSIX_VISIBLE >= 199309
121.83 +int fchmod (int __fildes, mode_t __mode);
121.84 +#endif
121.85 +#if !defined(__INSIDE_CYGWIN__)
121.86 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
121.87 +int fchown (int __fildes, uid_t __owner, gid_t __group);
121.88 +#endif
121.89 +#endif
121.90 +#if __ATFILE_VISIBLE
121.91 +int fchownat (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags);
121.92 +#endif
121.93 +#if __POSIX_VISIBLE >= 200809
121.94 +int fexecve (int __fd, char * const __argv[], char * const __envp[]);
121.95 +#endif
121.96 +pid_t fork (void);
121.97 +long fpathconf (int __fd, int __name);
121.98 +int fsync (int __fd);
121.99 +#if __POSIX_VISIBLE >= 199309
121.100 +int fdatasync (int __fd);
121.101 +#endif
121.102 +#if __GNU_VISIBLE
121.103 +char * get_current_dir_name (void);
121.104 +#endif
121.105 +char * getcwd (char *__buf, size_t __size);
121.106 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.107 +int getdomainname (char *__name, size_t __len);
121.108 +#endif
121.109 +#if __BSD_VISIBLE
121.110 +int getentropy (void *, size_t);
121.111 +#endif
121.112 +#if !defined(__INSIDE_CYGWIN__)
121.113 +gid_t getegid (void);
121.114 +uid_t geteuid (void);
121.115 +gid_t getgid (void);
121.116 +#endif
121.117 +int getgroups (int __gidsetsize, gid_t __grouplist[]);
121.118 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
121.119 +long gethostid (void);
121.120 +#endif
121.121 +char * getlogin (void);
121.122 +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
121.123 +int getlogin_r (char *name, size_t namesize) ;
121.124 +#endif
121.125 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112)
121.126 +char * getpass (const char *__prompt);
121.127 +int getpagesize (void);
121.128 +#endif
121.129 +#if __BSD_VISIBLE
121.130 +int getpeereid (int, uid_t *, gid_t *);
121.131 +#endif
121.132 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
121.133 +pid_t getpgid (pid_t);
121.134 +#endif
121.135 +pid_t getpgrp (void);
121.136 +pid_t getpid (void);
121.137 +pid_t getppid (void);
121.138 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
121.139 +pid_t getsid (pid_t);
121.140 +#endif
121.141 +#if !defined(__INSIDE_CYGWIN__)
121.142 +uid_t getuid (void);
121.143 +#endif
121.144 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.145 +char * getusershell (void);
121.146 +#endif
121.147 +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200809)
121.148 +char * getwd (char *__buf);
121.149 +#endif
121.150 +#if __BSD_VISIBLE
121.151 +int iruserok (unsigned long raddr, int superuser, const char *ruser, const char *luser);
121.152 +#endif
121.153 +int isatty (int __fildes);
121.154 +#if __BSD_VISIBLE
121.155 +int issetugid (void);
121.156 +#endif
121.157 +#if !defined(__INSIDE_CYGWIN__)
121.158 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
121.159 +int lchown (const char *__path, uid_t __owner, gid_t __group);
121.160 +#endif
121.161 +#endif
121.162 +int link (const char *__path1, const char *__path2);
121.163 +#if __ATFILE_VISIBLE
121.164 +int linkat (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags);
121.165 +#endif
121.166 +#if __MISC_VISIBLE || __XSI_VISIBLE
121.167 +int nice (int __nice_value);
121.168 +#endif
121.169 +#if !defined(__INSIDE_CYGWIN__)
121.170 +off_t lseek (int __fildes, off_t __offset, int __whence);
121.171 +#endif
121.172 +#if __MISC_VISIBLE || __XSI_VISIBLE >= 4
121.173 +#define F_ULOCK 0
121.174 +#define F_LOCK 1
121.175 +#define F_TLOCK 2
121.176 +#define F_TEST 3
121.177 +int lockf (int __fd, int __cmd, off_t __len);
121.178 +#endif
121.179 +long pathconf (const char *__path, int __name);
121.180 +int pause (void);
121.181 +#if __POSIX_VISIBLE >= 199506
121.182 +int pthread_atfork (void (*)(void), void (*)(void), void (*)(void));
121.183 +#endif
121.184 +int pipe (int __fildes[2]);
121.185 +#if __GNU_VISIBLE
121.186 +int pipe2 (int __fildes[2], int flags);
121.187 +#endif
121.188 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
121.189 +ssize_t pread (int __fd, void *__buf, size_t __nbytes, off_t __offset);
121.190 +ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, off_t __offset);
121.191 +#endif
121.192 +_READ_WRITE_RETURN_TYPE read (int __fd, void *__buf, size_t __nbyte);
121.193 +#if __BSD_VISIBLE
121.194 +int rresvport (int *__alport);
121.195 +int revoke (char *__path);
121.196 +#endif
121.197 +int rmdir (const char *__path);
121.198 +#if __BSD_VISIBLE
121.199 +int ruserok (const char *rhost, int superuser, const char *ruser, const char *luser);
121.200 +#endif
121.201 +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
121.202 +void * sbrk (ptrdiff_t __incr);
121.203 +#endif
121.204 +#if !defined(__INSIDE_CYGWIN__)
121.205 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
121.206 +int setegid (gid_t __gid);
121.207 +int seteuid (uid_t __uid);
121.208 +#endif
121.209 +int setgid (gid_t __gid);
121.210 +#endif
121.211 +#if __BSD_VISIBLE
121.212 +int setgroups (int ngroups, const gid_t *grouplist);
121.213 +#endif
121.214 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.215 +int sethostname (const char *, size_t);
121.216 +#endif
121.217 +int setpgid (pid_t __pid, pid_t __pgid);
121.218 +#if __SVID_VISIBLE || __XSI_VISIBLE >= 500
121.219 +int setpgrp (void);
121.220 +#endif
121.221 +#if (__BSD_VISIBLE || __XSI_VISIBLE >= 4) && !defined(__INSIDE_CYGWIN__)
121.222 +int setregid (gid_t __rgid, gid_t __egid);
121.223 +int setreuid (uid_t __ruid, uid_t __euid);
121.224 +#endif
121.225 +pid_t setsid (void);
121.226 +#if !defined(__INSIDE_CYGWIN__)
121.227 +int setuid (uid_t __uid);
121.228 +#endif
121.229 +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500)
121.230 +void setusershell (void);
121.231 +#endif
121.232 +unsigned sleep (unsigned int __seconds);
121.233 +#if __XSI_VISIBLE
121.234 +void swab (const void *__restrict, void *__restrict, ssize_t);
121.235 +#endif
121.236 +long sysconf (int __name);
121.237 +pid_t tcgetpgrp (int __fildes);
121.238 +int tcsetpgrp (int __fildes, pid_t __pgrp_id);
121.239 +char * ttyname (int __fildes);
121.240 +int ttyname_r (int, char *, size_t);
121.241 +int unlink (const char *__path);
121.242 +#if __XSI_VISIBLE >= 500 && __POSIX_VISIBLE < 200809 || __BSD_VISIBLE
121.243 +int usleep (useconds_t __useconds);
121.244 +#endif
121.245 +#if __BSD_VISIBLE
121.246 +int vhangup (void);
121.247 +#endif
121.248 +_READ_WRITE_RETURN_TYPE write (int __fd, const void *__buf, size_t __nbyte);
121.249 +
121.250 +#ifdef __CYGWIN__
121.251 +# define __UNISTD_GETOPT__
121.252 +# include <getopt.h>
121.253 +# undef __UNISTD_GETOPT__
121.254 +#else
121.255 +extern char *optarg; /* getopt(3) external variables */
121.256 +extern int optind, opterr, optopt;
121.257 +int getopt(int, char * const [], const char *);
121.258 +extern int optreset; /* getopt(3) external variable */
121.259 +#endif
121.260 +
121.261 +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200809)
121.262 +pid_t vfork (void);
121.263 +#endif
121.264 +
121.265 +#ifdef _COMPILING_NEWLIB
121.266 +/* Provide prototypes for most of the _<systemcall> names that are
121.267 + provided in newlib for some compilers. */
121.268 +int _close (int __fildes);
121.269 +pid_t _fork (void);
121.270 +pid_t _getpid (void);
121.271 +int _isatty (int __fildes);
121.272 +int _link (const char *__path1, const char *__path2);
121.273 +_off_t _lseek (int __fildes, _off_t __offset, int __whence);
121.274 +#ifdef __LARGE64_FILES
121.275 +_off64_t _lseek64 (int __filedes, _off64_t __offset, int __whence);
121.276 +#endif
121.277 +_READ_WRITE_RETURN_TYPE _read (int __fd, void *__buf, size_t __nbyte);
121.278 +void * _sbrk (ptrdiff_t __incr);
121.279 +int _unlink (const char *__path);
121.280 +_READ_WRITE_RETURN_TYPE _write (int __fd, const void *__buf, size_t __nbyte);
121.281 +int _execve (const char *__path, char * const __argv[], char * const __envp[]);
121.282 +#endif
121.283 +
121.284 +#if !defined(__INSIDE_CYGWIN__)
121.285 +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
121.286 +int ftruncate (int __fd, off_t __length);
121.287 +#endif
121.288 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
121.289 +int truncate (const char *, off_t __length);
121.290 +#endif
121.291 +#endif
121.292 +
121.293 +#if __BSD_VISIBLE || __POSIX_VISIBLE < 200112
121.294 +int getdtablesize (void);
121.295 +#endif
121.296 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
121.297 +useconds_t ualarm (useconds_t __useconds, useconds_t __interval);
121.298 +#endif
121.299 +
121.300 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
121.301 +#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
121.302 +/* winsock[2].h defines as __stdcall, and with int as 2nd arg */
121.303 + int gethostname (char *__name, size_t __len);
121.304 +#endif
121.305 +#endif
121.306 +
121.307 +#if __MISC_VISIBLE
121.308 +int setdtablesize (int);
121.309 +#endif
121.310 +
121.311 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 500
121.312 +void sync (void);
121.313 +#endif
121.314 +
121.315 +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
121.316 +ssize_t readlink (const char *__restrict __path,
121.317 + char *__restrict __buf, size_t __buflen);
121.318 +int symlink (const char *__name1, const char *__name2);
121.319 +#endif
121.320 +#if __ATFILE_VISIBLE
121.321 +ssize_t readlinkat (int __dirfd1, const char *__restrict __path,
121.322 + char *__restrict __buf, size_t __buflen);
121.323 +int symlinkat (const char *, int, const char *);
121.324 +int unlinkat (int, const char *, int);
121.325 +#endif
121.326 +
121.327 +#define F_OK 0
121.328 +#define R_OK 4
121.329 +#define W_OK 2
121.330 +#define X_OK 1
121.331 +
121.332 +# define SEEK_SET 0
121.333 +# define SEEK_CUR 1
121.334 +# define SEEK_END 2
121.335 +
121.336 +#include <sys/features.h>
121.337 +
121.338 +#define STDIN_FILENO 0 /* standard input file descriptor */
121.339 +#define STDOUT_FILENO 1 /* standard output file descriptor */
121.340 +#define STDERR_FILENO 2 /* standard error file descriptor */
121.341 +
121.342 +/*
121.343 + * sysconf values per IEEE Std 1003.1, 2008 Edition
121.344 + */
121.345 +
121.346 +#define _SC_ARG_MAX 0
121.347 +#define _SC_CHILD_MAX 1
121.348 +#define _SC_CLK_TCK 2
121.349 +#define _SC_NGROUPS_MAX 3
121.350 +#define _SC_OPEN_MAX 4
121.351 +#define _SC_JOB_CONTROL 5
121.352 +#define _SC_SAVED_IDS 6
121.353 +#define _SC_VERSION 7
121.354 +#define _SC_PAGESIZE 8
121.355 +#define _SC_PAGE_SIZE _SC_PAGESIZE
121.356 +/* These are non-POSIX values we accidentally introduced in 2000 without
121.357 + guarding them. Keeping them unguarded for backward compatibility. */
121.358 +#define _SC_NPROCESSORS_CONF 9
121.359 +#define _SC_NPROCESSORS_ONLN 10
121.360 +#define _SC_PHYS_PAGES 11
121.361 +#define _SC_AVPHYS_PAGES 12
121.362 +/* End of non-POSIX values. */
121.363 +#define _SC_MQ_OPEN_MAX 13
121.364 +#define _SC_MQ_PRIO_MAX 14
121.365 +#define _SC_RTSIG_MAX 15
121.366 +#define _SC_SEM_NSEMS_MAX 16
121.367 +#define _SC_SEM_VALUE_MAX 17
121.368 +#define _SC_SIGQUEUE_MAX 18
121.369 +#define _SC_TIMER_MAX 19
121.370 +#define _SC_TZNAME_MAX 20
121.371 +#define _SC_ASYNCHRONOUS_IO 21
121.372 +#define _SC_FSYNC 22
121.373 +#define _SC_MAPPED_FILES 23
121.374 +#define _SC_MEMLOCK 24
121.375 +#define _SC_MEMLOCK_RANGE 25
121.376 +#define _SC_MEMORY_PROTECTION 26
121.377 +#define _SC_MESSAGE_PASSING 27
121.378 +#define _SC_PRIORITIZED_IO 28
121.379 +#define _SC_REALTIME_SIGNALS 29
121.380 +#define _SC_SEMAPHORES 30
121.381 +#define _SC_SHARED_MEMORY_OBJECTS 31
121.382 +#define _SC_SYNCHRONIZED_IO 32
121.383 +#define _SC_TIMERS 33
121.384 +#define _SC_AIO_LISTIO_MAX 34
121.385 +#define _SC_AIO_MAX 35
121.386 +#define _SC_AIO_PRIO_DELTA_MAX 36
121.387 +#define _SC_DELAYTIMER_MAX 37
121.388 +#define _SC_THREAD_KEYS_MAX 38
121.389 +#define _SC_THREAD_STACK_MIN 39
121.390 +#define _SC_THREAD_THREADS_MAX 40
121.391 +#define _SC_TTY_NAME_MAX 41
121.392 +#define _SC_THREADS 42
121.393 +#define _SC_THREAD_ATTR_STACKADDR 43
121.394 +#define _SC_THREAD_ATTR_STACKSIZE 44
121.395 +#define _SC_THREAD_PRIORITY_SCHEDULING 45
121.396 +#define _SC_THREAD_PRIO_INHERIT 46
121.397 +/* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
121.398 +#define _SC_THREAD_PRIO_PROTECT 47
121.399 +#define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT
121.400 +#define _SC_THREAD_PROCESS_SHARED 48
121.401 +#define _SC_THREAD_SAFE_FUNCTIONS 49
121.402 +#define _SC_GETGR_R_SIZE_MAX 50
121.403 +#define _SC_GETPW_R_SIZE_MAX 51
121.404 +#define _SC_LOGIN_NAME_MAX 52
121.405 +#define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
121.406 +#define _SC_ADVISORY_INFO 54
121.407 +#define _SC_ATEXIT_MAX 55
121.408 +#define _SC_BARRIERS 56
121.409 +#define _SC_BC_BASE_MAX 57
121.410 +#define _SC_BC_DIM_MAX 58
121.411 +#define _SC_BC_SCALE_MAX 59
121.412 +#define _SC_BC_STRING_MAX 60
121.413 +#define _SC_CLOCK_SELECTION 61
121.414 +#define _SC_COLL_WEIGHTS_MAX 62
121.415 +#define _SC_CPUTIME 63
121.416 +#define _SC_EXPR_NEST_MAX 64
121.417 +#define _SC_HOST_NAME_MAX 65
121.418 +#define _SC_IOV_MAX 66
121.419 +#define _SC_IPV6 67
121.420 +#define _SC_LINE_MAX 68
121.421 +#define _SC_MONOTONIC_CLOCK 69
121.422 +#define _SC_RAW_SOCKETS 70
121.423 +#define _SC_READER_WRITER_LOCKS 71
121.424 +#define _SC_REGEXP 72
121.425 +#define _SC_RE_DUP_MAX 73
121.426 +#define _SC_SHELL 74
121.427 +#define _SC_SPAWN 75
121.428 +#define _SC_SPIN_LOCKS 76
121.429 +#define _SC_SPORADIC_SERVER 77
121.430 +#define _SC_SS_REPL_MAX 78
121.431 +#define _SC_SYMLOOP_MAX 79
121.432 +#define _SC_THREAD_CPUTIME 80
121.433 +#define _SC_THREAD_SPORADIC_SERVER 81
121.434 +#define _SC_TIMEOUTS 82
121.435 +#define _SC_TRACE 83
121.436 +#define _SC_TRACE_EVENT_FILTER 84
121.437 +#define _SC_TRACE_EVENT_NAME_MAX 85
121.438 +#define _SC_TRACE_INHERIT 86
121.439 +#define _SC_TRACE_LOG 87
121.440 +#define _SC_TRACE_NAME_MAX 88
121.441 +#define _SC_TRACE_SYS_MAX 89
121.442 +#define _SC_TRACE_USER_EVENT_MAX 90
121.443 +#define _SC_TYPED_MEMORY_OBJECTS 91
121.444 +#define _SC_V7_ILP32_OFF32 92
121.445 +#define _SC_V6_ILP32_OFF32 _SC_V7_ILP32_OFF32
121.446 +#define _SC_XBS5_ILP32_OFF32 _SC_V7_ILP32_OFF32
121.447 +#define _SC_V7_ILP32_OFFBIG 93
121.448 +#define _SC_V6_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
121.449 +#define _SC_XBS5_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG
121.450 +#define _SC_V7_LP64_OFF64 94
121.451 +#define _SC_V6_LP64_OFF64 _SC_V7_LP64_OFF64
121.452 +#define _SC_XBS5_LP64_OFF64 _SC_V7_LP64_OFF64
121.453 +#define _SC_V7_LPBIG_OFFBIG 95
121.454 +#define _SC_V6_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
121.455 +#define _SC_XBS5_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG
121.456 +#define _SC_XOPEN_CRYPT 96
121.457 +#define _SC_XOPEN_ENH_I18N 97
121.458 +#define _SC_XOPEN_LEGACY 98
121.459 +#define _SC_XOPEN_REALTIME 99
121.460 +#define _SC_STREAM_MAX 100
121.461 +#define _SC_PRIORITY_SCHEDULING 101
121.462 +#define _SC_XOPEN_REALTIME_THREADS 102
121.463 +#define _SC_XOPEN_SHM 103
121.464 +#define _SC_XOPEN_STREAMS 104
121.465 +#define _SC_XOPEN_UNIX 105
121.466 +#define _SC_XOPEN_VERSION 106
121.467 +#define _SC_2_CHAR_TERM 107
121.468 +#define _SC_2_C_BIND 108
121.469 +#define _SC_2_C_DEV 109
121.470 +#define _SC_2_FORT_DEV 110
121.471 +#define _SC_2_FORT_RUN 111
121.472 +#define _SC_2_LOCALEDEF 112
121.473 +#define _SC_2_PBS 113
121.474 +#define _SC_2_PBS_ACCOUNTING 114
121.475 +#define _SC_2_PBS_CHECKPOINT 115
121.476 +#define _SC_2_PBS_LOCATE 116
121.477 +#define _SC_2_PBS_MESSAGE 117
121.478 +#define _SC_2_PBS_TRACK 118
121.479 +#define _SC_2_SW_DEV 119
121.480 +#define _SC_2_UPE 120
121.481 +#define _SC_2_VERSION 121
121.482 +#define _SC_THREAD_ROBUST_PRIO_INHERIT 122
121.483 +#define _SC_THREAD_ROBUST_PRIO_PROTECT 123
121.484 +#define _SC_XOPEN_UUCP 124
121.485 +#define _SC_LEVEL1_ICACHE_SIZE 125
121.486 +#define _SC_LEVEL1_ICACHE_ASSOC 126
121.487 +#define _SC_LEVEL1_ICACHE_LINESIZE 127
121.488 +#define _SC_LEVEL1_DCACHE_SIZE 128
121.489 +#define _SC_LEVEL1_DCACHE_ASSOC 129
121.490 +#define _SC_LEVEL1_DCACHE_LINESIZE 130
121.491 +#define _SC_LEVEL2_CACHE_SIZE 131
121.492 +#define _SC_LEVEL2_CACHE_ASSOC 132
121.493 +#define _SC_LEVEL2_CACHE_LINESIZE 133
121.494 +#define _SC_LEVEL3_CACHE_SIZE 134
121.495 +#define _SC_LEVEL3_CACHE_ASSOC 135
121.496 +#define _SC_LEVEL3_CACHE_LINESIZE 136
121.497 +#define _SC_LEVEL4_CACHE_SIZE 137
121.498 +#define _SC_LEVEL4_CACHE_ASSOC 138
121.499 +#define _SC_LEVEL4_CACHE_LINESIZE 139
121.500 +#define _SC_POSIX_26_VERSION 140
121.501 +
121.502 +/*
121.503 + * pathconf values per IEEE Std 1003.1, 2008 Edition
121.504 + */
121.505 +
121.506 +#define _PC_LINK_MAX 0
121.507 +#define _PC_MAX_CANON 1
121.508 +#define _PC_MAX_INPUT 2
121.509 +#define _PC_NAME_MAX 3
121.510 +#define _PC_PATH_MAX 4
121.511 +#define _PC_PIPE_BUF 5
121.512 +#define _PC_CHOWN_RESTRICTED 6
121.513 +#define _PC_NO_TRUNC 7
121.514 +#define _PC_VDISABLE 8
121.515 +#define _PC_ASYNC_IO 9
121.516 +#define _PC_PRIO_IO 10
121.517 +#define _PC_SYNC_IO 11
121.518 +#define _PC_FILESIZEBITS 12
121.519 +#define _PC_2_SYMLINKS 13
121.520 +#define _PC_SYMLINK_MAX 14
121.521 +#define _PC_ALLOC_SIZE_MIN 15
121.522 +#define _PC_REC_INCR_XFER_SIZE 16
121.523 +#define _PC_REC_MAX_XFER_SIZE 17
121.524 +#define _PC_REC_MIN_XFER_SIZE 18
121.525 +#define _PC_REC_XFER_ALIGN 19
121.526 +#define _PC_TIMESTAMP_RESOLUTION 20
121.527 +#ifdef __CYGWIN__
121.528 +/* Ask for POSIX permission bits support. */
121.529 +#define _PC_POSIX_PERMISSIONS 90
121.530 +/* Ask for full POSIX permission support including uid/gid settings. */
121.531 +#define _PC_POSIX_SECURITY 91
121.532 +#define _PC_CASE_INSENSITIVE 92
121.533 +#endif
121.534 +
121.535 +/*
121.536 + * confstr values per IEEE Std 1003.1, 2004 Edition
121.537 + */
121.538 +
121.539 +#ifdef __CYGWIN__ /* Only defined on Cygwin for now. */
121.540 +#define _CS_PATH 0
121.541 +#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1
121.542 +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
121.543 +#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
121.544 +#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 2
121.545 +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
121.546 +#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
121.547 +#define _CS_POSIX_V7_ILP32_OFF32_LIBS 3
121.548 +#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
121.549 +#define _CS_XBS5_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS
121.550 +#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 4
121.551 +#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 5
121.552 +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
121.553 +#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
121.554 +#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 6
121.555 +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
121.556 +#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
121.557 +#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 7
121.558 +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
121.559 +#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS
121.560 +#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 8
121.561 +#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 9
121.562 +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
121.563 +#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS
121.564 +#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 10
121.565 +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
121.566 +#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS
121.567 +#define _CS_POSIX_V7_LP64_OFF64_LIBS 11
121.568 +#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
121.569 +#define _CS_XBS5_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS
121.570 +#define _CS_XBS5_LP64_OFF64_LINTFLAGS 12
121.571 +#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 13
121.572 +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
121.573 +#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
121.574 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 14
121.575 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
121.576 +#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
121.577 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 15
121.578 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
121.579 +#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
121.580 +#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 16
121.581 +#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 17
121.582 +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
121.583 +#define _CS_XBS5_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
121.584 +#define _CS_POSIX_V7_THREADS_CFLAGS 18
121.585 +#define _CS_POSIX_V7_THREADS_LDFLAGS 19
121.586 +#define _CS_V7_ENV 20
121.587 +#define _CS_V6_ENV _CS_V7_ENV
121.588 +#define _CS_LFS_CFLAGS 21
121.589 +#define _CS_LFS_LDFLAGS 22
121.590 +#define _CS_LFS_LIBS 23
121.591 +#define _CS_LFS_LINTFLAGS 24
121.592 +#endif
121.593 +
121.594 +#ifdef __cplusplus
121.595 +}
121.596 +#endif
121.597 +
121.598 +#if __SSP_FORTIFY_LEVEL > 0
121.599 +#include <ssp/unistd.h>
121.600 +#endif
121.601 +
121.602 +#endif /* _SYS_UNISTD_H */
123.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
123.2 +++ b/include/sys/wait.h Mon Oct 21 16:11:07 2019 +0200
123.3 @@ -0,0 +1,44 @@
123.4 +#ifndef _SYS_WAIT_H
123.5 +#define _SYS_WAIT_H
123.6 +
123.7 +#ifdef __cplusplus
123.8 +extern "C" {
123.9 +#endif
123.10 +
123.11 +#include <sys/types.h>
123.12 +
123.13 +#define WNOHANG 1
123.14 +#define WUNTRACED 2
123.15 +
123.16 +/* A status looks like:
123.17 + <1 byte info> <1 byte code>
123.18 +
123.19 + <code> == 0, child has exited, info is the exit value
123.20 + <code> == 1..7e, child has exited, info is the signal number.
123.21 + <code> == 7f, child has stopped, info was the signal number.
123.22 + <code> == 80, there was a core dump.
123.23 +*/
123.24 +
123.25 +#define WIFEXITED(w) (((w) & 0xff) == 0)
123.26 +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
123.27 +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
123.28 +#define WEXITSTATUS(w) (((w) >> 8) & 0xff)
123.29 +#define WTERMSIG(w) ((w) & 0x7f)
123.30 +#define WSTOPSIG WEXITSTATUS
123.31 +
123.32 +pid_t wait (int *);
123.33 +pid_t waitpid (pid_t, int *, int);
123.34 +
123.35 +#ifdef _COMPILING_NEWLIB
123.36 +pid_t _wait (int *);
123.37 +#endif
123.38 +
123.39 +/* Provide prototypes for most of the _<systemcall> names that are
123.40 + provided in newlib for some compilers. */
123.41 +pid_t _wait (int *);
123.42 +
123.43 +#ifdef __cplusplus
123.44 +};
123.45 +#endif
123.46 +
123.47 +#endif
124.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
124.2 +++ b/include/tar.h Mon Oct 21 16:11:07 2019 +0200
124.3 @@ -0,0 +1,43 @@
124.4 +/*
124.5 + * tar.h
124.6 + */
124.7 +
124.8 +#ifndef _TAR_H
124.9 +#define _TAR_H
124.10 +
124.11 +#include <sys/features.h>
124.12 +
124.13 +/* General definitions */
124.14 +#define TMAGIC "ustar" /* ustar plus null byte. */
124.15 +#define TMAGLEN 6 /* Length of the above. */
124.16 +#define TVERSION "00" /* 00 without a null byte. */
124.17 +#define TVERSLEN 2 /* Length of the above. */
124.18 +
124.19 +/* Typeflag field definitions */
124.20 +#define REGTYPE '0' /* Regular file. */
124.21 +#define AREGTYPE '\0' /* Regular file. */
124.22 +#define LNKTYPE '1' /* Link. */
124.23 +#define SYMTYPE '2' /* Symbolic link. */
124.24 +#define CHRTYPE '3' /* Character special. */
124.25 +#define BLKTYPE '4' /* Block special. */
124.26 +#define DIRTYPE '5' /* Directory. */
124.27 +#define FIFOTYPE '6' /* FIFO special. */
124.28 +#define CONTTYPE '7' /* Reserved. */
124.29 +
124.30 +/* Mode field bit definitions (octal) */
124.31 +#define TSUID 04000 /* Set UID on execution. */
124.32 +#define TSGID 02000 /* Set GID on execution. */
124.33 +#if __XSI_VISIBLE || __POSIX_VISIBLE < 200112
124.34 +#define TSVTX 01000 /* On directories, restricted deletion flag. */
124.35 +#endif
124.36 +#define TUREAD 00400 /* Read by owner. */
124.37 +#define TUWRITE 00200 /* Write by owner. */
124.38 +#define TUEXEC 00100 /* Execute/search by owner. */
124.39 +#define TGREAD 00040 /* Read by group. */
124.40 +#define TGWRITE 00020 /* Write by group. */
124.41 +#define TGEXEC 00010 /* Execute/search by group. */
124.42 +#define TOREAD 00004 /* Read by other. */
124.43 +#define TOWRITE 00002 /* Write by other. */
124.44 +#define TOEXEC 00001 /* Execute/search by other. */
124.45 +
124.46 +#endif
125.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125.2 +++ b/include/termios.h Mon Oct 21 16:11:07 2019 +0200
125.3 @@ -0,0 +1,7 @@
125.4 +#ifdef __cplusplus
125.5 +extern "C" {
125.6 +#endif
125.7 +#include <sys/termios.h>
125.8 +#ifdef __cplusplus
125.9 +}
125.10 +#endif
126.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126.2 +++ b/include/tgmath.h Mon Oct 21 16:11:07 2019 +0200
126.3 @@ -0,0 +1,185 @@
126.4 +/* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.html */
126.5 +/*-
126.6 + * Copyright (c) 2004 Stefan Farfeleder.
126.7 + * All rights reserved.
126.8 + *
126.9 + * Redistribution and use in source and binary forms, with or without
126.10 + * modification, are permitted provided that the following conditions
126.11 + * are met:
126.12 + * 1. Redistributions of source code must retain the above copyright
126.13 + * notice, this list of conditions and the following disclaimer.
126.14 + * 2. Redistributions in binary form must reproduce the above copyright
126.15 + * notice, this list of conditions and the following disclaimer in the
126.16 + * documentation and/or other materials provided with the distribution.
126.17 + *
126.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
126.19 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126.20 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126.21 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
126.22 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
126.23 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
126.24 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
126.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
126.26 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
126.27 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
126.28 + * SUCH DAMAGE.
126.29 + *
126.30 + * $FreeBSD$
126.31 + */
126.32 +
126.33 +#ifndef _TGMATH_H_
126.34 +#define _TGMATH_H_
126.35 +
126.36 +#include <complex.h>
126.37 +#include <math.h>
126.38 +
126.39 +#ifdef log2
126.40 +#undef log2
126.41 +#endif
126.42 +
126.43 +/*
126.44 + * This implementation of <tgmath.h> requires two implementation-dependent
126.45 + * macros to be defined:
126.46 + * __tg_impl_simple(x, y, z, fn, fnf, fnl, ...)
126.47 + * Invokes fnl() if the corresponding real type of x, y or z is long
126.48 + * double, fn() if it is double or any has an integer type, and fnf()
126.49 + * otherwise.
126.50 + * __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...)
126.51 + * Invokes [c]fnl() if the corresponding real type of x, y or z is long
126.52 + * double, [c]fn() if it is double or any has an integer type, and
126.53 + * [c]fnf() otherwise. The function with the 'c' prefix is called if
126.54 + * any of x, y or z is a complex number.
126.55 + * Both macros call the chosen function with all additional arguments passed
126.56 + * to them, as given by __VA_ARGS__.
126.57 + *
126.58 + * Note that these macros cannot be implemented with C's ?: operator,
126.59 + * because the return type of the whole expression would incorrectly be long
126.60 + * double complex regardless of the argument types.
126.61 + */
126.62 +
126.63 +/* requires GCC >= 3.1 */
126.64 +#if !__GNUC_PREREQ (3, 1)
126.65 +#error "<tgmath.h> not implemented for this compiler"
126.66 +#endif
126.67 +
126.68 +#define __tg_type(__e, __t) \
126.69 + __builtin_types_compatible_p(__typeof__(__e), __t)
126.70 +#define __tg_type3(__e1, __e2, __e3, __t) \
126.71 + (__tg_type(__e1, __t) || __tg_type(__e2, __t) || \
126.72 + __tg_type(__e3, __t))
126.73 +#define __tg_type_corr(__e1, __e2, __e3, __t) \
126.74 + (__tg_type3(__e1, __e2, __e3, __t) || \
126.75 + __tg_type3(__e1, __e2, __e3, __t _Complex))
126.76 +#define __tg_integer(__e1, __e2, __e3) \
126.77 + (((__typeof__(__e1))1.5 == 1) || ((__typeof__(__e2))1.5 == 1) || \
126.78 + ((__typeof__(__e3))1.5 == 1))
126.79 +#define __tg_is_complex(__e1, __e2, __e3) \
126.80 + (__tg_type3(__e1, __e2, __e3, float _Complex) || \
126.81 + __tg_type3(__e1, __e2, __e3, double _Complex) || \
126.82 + __tg_type3(__e1, __e2, __e3, long double _Complex) || \
126.83 + __tg_type3(__e1, __e2, __e3, __typeof__(_Complex_I)))
126.84 +
126.85 +#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
126.86 +#define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \
126.87 + __builtin_choose_expr(__tg_type_corr(x, y, z, long double), \
126.88 + fnl(__VA_ARGS__), __builtin_choose_expr( \
126.89 + __tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\
126.90 + fn(__VA_ARGS__), fnf(__VA_ARGS__)))
126.91 +#else
126.92 +#define __tg_impl_simple(__x, __y, __z, __fn, __fnf, __fnl, ...) \
126.93 + (__tg_type_corr(__x, __y, __z, double) || __tg_integer(__x, __y, __z)) \
126.94 + ? __fn(__VA_ARGS__) : __fnf(__VA_ARGS__)
126.95 +#endif
126.96 +
126.97 +#define __tg_impl_full(__x, __y, __z, __fn, __fnf, __fnl, __cfn, __cfnf, __cfnl, ...) \
126.98 + __builtin_choose_expr(__tg_is_complex(__x, __y, __z), \
126.99 + __tg_impl_simple(__x, __y, __z, __cfn, __cfnf, __cfnl, __VA_ARGS__), \
126.100 + __tg_impl_simple(__x, __y, __z, __fn, __fnf, __fnl, __VA_ARGS__))
126.101 +
126.102 +/* Macros to save lots of repetition below */
126.103 +#define __tg_simple(__x, __fn) \
126.104 + __tg_impl_simple(__x, __x, __x, __fn, __fn##f, __fn##l, __x)
126.105 +#define __tg_simple2(__x, __y, __fn) \
126.106 + __tg_impl_simple(__x, __x, __y, __fn, __fn##f, __fn##l, __x, __y)
126.107 +#define __tg_simplev(__x, __fn, ...) \
126.108 + __tg_impl_simple(__x, __x, __x, __fn, __fn##f, __fn##l, __VA_ARGS__)
126.109 +#define __tg_full(__x, __fn) \
126.110 + __tg_impl_full(__x, __x, __x, __fn, __fn##f, __fn##l, c##__fn, c##__fn##f, c##__fn##l, __x)
126.111 +
126.112 +/* 7.22#4 -- These macros expand to real or complex functions, depending on
126.113 + * the type of their arguments. */
126.114 +#define acos(__x) __tg_full(__x, acos)
126.115 +#define asin(__x) __tg_full(__x, asin)
126.116 +#define atan(__x) __tg_full(__x, atan)
126.117 +#define acosh(__x) __tg_full(__x, acosh)
126.118 +#define asinh(__x) __tg_full(__x, asinh)
126.119 +#define atanh(__x) __tg_full(__x, atanh)
126.120 +#define cos(__x) __tg_full(__x, cos)
126.121 +#define sin(__x) __tg_full(__x, sin)
126.122 +#define tan(__x) __tg_full(__x, tan)
126.123 +#define cosh(__x) __tg_full(__x, cosh)
126.124 +#define sinh(__x) __tg_full(__x, sinh)
126.125 +#define tanh(__x) __tg_full(__x, tanh)
126.126 +#define exp(__x) __tg_full(__x, exp)
126.127 +#define log(__x) __tg_full(__x, log)
126.128 +#define pow(__x, __y) __tg_impl_full(__x, __x, __y, pow, powf, powl, \
126.129 + cpow, cpowf, cpowl, __x, __y)
126.130 +#define sqrt(__x) __tg_full(__x, sqrt)
126.131 +
126.132 +/* "The corresponding type-generic macro for fabs and cabs is fabs." */
126.133 +#define fabs(__x) __tg_impl_full(__x, __x, __x, fabs, fabsf, fabsl, \
126.134 + cabs, cabsf, cabsl, __x)
126.135 +
126.136 +/* 7.22#5 -- These macros are only defined for arguments with real type. */
126.137 +#define atan2(__x, __y) __tg_simple2(__x, __y, atan2)
126.138 +#define cbrt(__x) __tg_simple(__x, cbrt)
126.139 +#define ceil(__x) __tg_simple(__x, ceil)
126.140 +#define copysign(__x, __y) __tg_simple2(__x, __y, copysign)
126.141 +#define erf(__x) __tg_simple(__x, erf)
126.142 +#define erfc(__x) __tg_simple(__x, erfc)
126.143 +#define exp2(__x) __tg_simple(__x, exp2)
126.144 +#define expm1(__x) __tg_simple(__x, expm1)
126.145 +#define fdim(__x, __y) __tg_simple2(__x, __y, fdim)
126.146 +#define floor(__x) __tg_simple(__x, floor)
126.147 +#define fma(__x, __y, __z) __tg_impl_simple(__x, __y, __z, fma, fmaf, fmal, \
126.148 + __x, __y, __z)
126.149 +#define fmax(__x, __y) __tg_simple2(__x, __y, fmax)
126.150 +#define fmin(__x, __y) __tg_simple2(__x, __y, fmin)
126.151 +#define fmod(__x, __y) __tg_simple2(__x, __y, fmod)
126.152 +#define frexp(__x, __y) __tg_simplev(__x, frexp, __x, __y)
126.153 +#define hypot(__x, __y) __tg_simple2(__x, __y, hypot)
126.154 +#define ilogb(__x) __tg_simple(__x, ilogb)
126.155 +#define ldexp(__x, __y) __tg_simplev(__x, ldexp, __x, __y)
126.156 +#define lgamma(__x) __tg_simple(__x, lgamma)
126.157 +#define llrint(__x) __tg_simple(__x, llrint)
126.158 +#define llround(__x) __tg_simple(__x, llround)
126.159 +#define log10(__x) __tg_simple(__x, log10)
126.160 +#define log1p(__x) __tg_simple(__x, log1p)
126.161 +#define log2(__x) __tg_simple(__x, log2)
126.162 +#define logb(__x) __tg_simple(__x, logb)
126.163 +#define lrint(__x) __tg_simple(__x, lrint)
126.164 +#define lround(__x) __tg_simple(__x, lround)
126.165 +#define nearbyint(__x) __tg_simple(__x, nearbyint)
126.166 +#define nextafter(__x, __y) __tg_simple2(__x, __y, nextafter)
126.167 +/* not yet implemented even for _LDBL_EQ_DBL platforms */
126.168 +#ifdef __CYGWIN__
126.169 +#define nexttoward(__x, __y) __tg_simplev(__x, nexttoward, __x, __y)
126.170 +#endif
126.171 +#define remainder(__x, __y) __tg_simple2(__x, __y, remainder)
126.172 +#define remquo(__x, __y, __z) __tg_impl_simple(__x, __x, __y, remquo, remquof, \
126.173 + remquol, __x, __y, __z)
126.174 +#define rint(__x) __tg_simple(__x, rint)
126.175 +#define round(__x) __tg_simple(__x, round)
126.176 +#define scalbn(__x, __y) __tg_simplev(__x, scalbn, __x, __y)
126.177 +#define scalbln(__x, __y) __tg_simplev(__x, scalbln, __x, __y)
126.178 +#define tgamma(__x) __tg_simple(__x, tgamma)
126.179 +#define trunc(__x) __tg_simple(__x, trunc)
126.180 +
126.181 +/* 7.22#6 -- These macros always expand to complex functions. */
126.182 +#define carg(__x) __tg_simple(__x, carg)
126.183 +#define cimag(__x) __tg_simple(__x, cimag)
126.184 +#define conj(__x) __tg_simple(__x, conj)
126.185 +#define cproj(__x) __tg_simple(__x, cproj)
126.186 +#define creal(__x) __tg_simple(__x, creal)
126.187 +
126.188 +#endif /* !_TGMATH_H_ */
127.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
127.2 +++ b/include/threads.h Mon Oct 21 16:11:07 2019 +0200
127.3 @@ -0,0 +1,93 @@
127.4 +/*-
127.5 + * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
127.6 + * All rights reserved.
127.7 + *
127.8 + * Redistribution and use in source and binary forms, with or without
127.9 + * modification, are permitted provided that the following conditions
127.10 + * are met:
127.11 + * 1. Redistributions of source code must retain the above copyright
127.12 + * notice, this list of conditions and the following disclaimer.
127.13 + * 2. Redistributions in binary form must reproduce the above copyright
127.14 + * notice, this list of conditions and the following disclaimer in the
127.15 + * documentation and/or other materials provided with the distribution.
127.16 + *
127.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
127.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
127.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
127.20 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
127.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
127.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
127.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
127.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
127.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
127.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
127.27 + * SUCH DAMAGE.
127.28 + */
127.29 +
127.30 +#ifndef _THREADS_H_
127.31 +#define _THREADS_H_
127.32 +
127.33 +#include <machine/_threads.h>
127.34 +#include <time.h>
127.35 +
127.36 +typedef void (*tss_dtor_t)(void *);
127.37 +typedef int (*thrd_start_t)(void *);
127.38 +
127.39 +enum {
127.40 + mtx_plain = 0x1,
127.41 + mtx_recursive = 0x2,
127.42 + mtx_timed = 0x4
127.43 +};
127.44 +
127.45 +enum {
127.46 + thrd_busy = 1,
127.47 + thrd_error = 2,
127.48 + thrd_nomem = 3,
127.49 + thrd_success = 4,
127.50 + thrd_timedout = 5
127.51 +};
127.52 +
127.53 +#if !defined(__cplusplus) || __cplusplus < 201103L
127.54 +#define thread_local _Thread_local
127.55 +#endif
127.56 +
127.57 +__BEGIN_DECLS
127.58 +void call_once(once_flag *, void (*)(void));
127.59 +int cnd_broadcast(cnd_t *);
127.60 +void cnd_destroy(cnd_t *);
127.61 +int cnd_init(cnd_t *);
127.62 +int cnd_signal(cnd_t *);
127.63 +int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict __mtx,
127.64 + const struct timespec *__restrict)
127.65 + __requires_exclusive(*__mtx);
127.66 +int cnd_wait(cnd_t *, mtx_t *__mtx)
127.67 + __requires_exclusive(*__mtx);
127.68 +void mtx_destroy(mtx_t *__mtx)
127.69 + __requires_unlocked(*__mtx);
127.70 +int mtx_init(mtx_t *__mtx, int)
127.71 + __requires_unlocked(*__mtx);
127.72 +int mtx_lock(mtx_t *__mtx)
127.73 + __locks_exclusive(*__mtx);
127.74 +int mtx_timedlock(mtx_t *__restrict __mtx,
127.75 + const struct timespec *__restrict)
127.76 + __trylocks_exclusive(thrd_success, *__mtx);
127.77 +int mtx_trylock(mtx_t *__mtx)
127.78 + __trylocks_exclusive(thrd_success, *__mtx);
127.79 +int mtx_unlock(mtx_t *__mtx)
127.80 + __unlocks(*__mtx);
127.81 +int thrd_create(thrd_t *, thrd_start_t, void *);
127.82 +thrd_t thrd_current(void);
127.83 +int thrd_detach(thrd_t);
127.84 +int thrd_equal(thrd_t, thrd_t);
127.85 +_Noreturn void
127.86 + thrd_exit(int);
127.87 +int thrd_join(thrd_t, int *);
127.88 +int thrd_sleep(const struct timespec *, struct timespec *);
127.89 +void thrd_yield(void);
127.90 +int tss_create(tss_t *, tss_dtor_t);
127.91 +void tss_delete(tss_t);
127.92 +void * tss_get(tss_t);
127.93 +int tss_set(tss_t, void *);
127.94 +__END_DECLS
127.95 +
127.96 +#endif /* !_THREADS_H_ */
128.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128.2 +++ b/include/time.h Mon Oct 21 16:11:07 2019 +0200
128.3 @@ -0,0 +1,333 @@
128.4 +/*
128.5 + * time.h
128.6 + *
128.7 + * Struct and function declarations for dealing with time.
128.8 + */
128.9 +
128.10 +#ifndef _TIME_H_
128.11 +#define _TIME_H_
128.12 +
128.13 +#include "_ansi.h"
128.14 +#include <sys/cdefs.h>
128.15 +#include <sys/reent.h>
128.16 +
128.17 +#define __need_size_t
128.18 +#define __need_NULL
128.19 +#include <stddef.h>
128.20 +
128.21 +/* Get _CLOCKS_PER_SEC_ */
128.22 +#include <machine/time.h>
128.23 +
128.24 +#ifndef _CLOCKS_PER_SEC_
128.25 +#define _CLOCKS_PER_SEC_ 1000
128.26 +#endif
128.27 +
128.28 +#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
128.29 +#define CLK_TCK CLOCKS_PER_SEC
128.30 +
128.31 +#include <sys/types.h>
128.32 +#include <sys/timespec.h>
128.33 +
128.34 +#if __POSIX_VISIBLE >= 200809
128.35 +#include <sys/_locale.h>
128.36 +#endif
128.37 +
128.38 +_BEGIN_STD_C
128.39 +
128.40 +struct tm
128.41 +{
128.42 + int tm_sec;
128.43 + int tm_min;
128.44 + int tm_hour;
128.45 + int tm_mday;
128.46 + int tm_mon;
128.47 + int tm_year;
128.48 + int tm_wday;
128.49 + int tm_yday;
128.50 + int tm_isdst;
128.51 +#ifdef __TM_GMTOFF
128.52 + long __TM_GMTOFF;
128.53 +#endif
128.54 +#ifdef __TM_ZONE
128.55 + const char *__TM_ZONE;
128.56 +#endif
128.57 +};
128.58 +
128.59 +clock_t clock (void);
128.60 +double difftime (time_t _time2, time_t _time1);
128.61 +time_t mktime (struct tm *_timeptr);
128.62 +time_t time (time_t *_timer);
128.63 +#ifndef _REENT_ONLY
128.64 +char *asctime (const struct tm *_tblock);
128.65 +char *ctime (const time_t *_time);
128.66 +struct tm *gmtime (const time_t *_timer);
128.67 +struct tm *localtime (const time_t *_timer);
128.68 +#endif
128.69 +size_t strftime (char *__restrict _s,
128.70 + size_t _maxsize, const char *__restrict _fmt,
128.71 + const struct tm *__restrict _t);
128.72 +
128.73 +#if __POSIX_VISIBLE >= 200809
128.74 +extern size_t strftime_l (char *__restrict _s, size_t _maxsize,
128.75 + const char *__restrict _fmt,
128.76 + const struct tm *__restrict _t, locale_t _l);
128.77 +#endif
128.78 +
128.79 +char *asctime_r (const struct tm *__restrict,
128.80 + char *__restrict);
128.81 +char *ctime_r (const time_t *, char *);
128.82 +struct tm *gmtime_r (const time_t *__restrict,
128.83 + struct tm *__restrict);
128.84 +struct tm *localtime_r (const time_t *__restrict,
128.85 + struct tm *__restrict);
128.86 +
128.87 +_END_STD_C
128.88 +
128.89 +#ifdef __cplusplus
128.90 +extern "C" {
128.91 +#endif
128.92 +
128.93 +#if __XSI_VISIBLE
128.94 +char *strptime (const char *__restrict,
128.95 + const char *__restrict,
128.96 + struct tm *__restrict);
128.97 +#endif
128.98 +#if __GNU_VISIBLE
128.99 +char *strptime_l (const char *__restrict, const char *__restrict,
128.100 + struct tm *__restrict, locale_t);
128.101 +#endif
128.102 +
128.103 +#if __POSIX_VISIBLE
128.104 +void tzset (void);
128.105 +#endif
128.106 +void _tzset_r (struct _reent *);
128.107 +
128.108 +typedef struct __tzrule_struct
128.109 +{
128.110 + char ch;
128.111 + int m;
128.112 + int n;
128.113 + int d;
128.114 + int s;
128.115 + time_t change;
128.116 + long offset; /* Match type of _timezone. */
128.117 +} __tzrule_type;
128.118 +
128.119 +typedef struct __tzinfo_struct
128.120 +{
128.121 + int __tznorth;
128.122 + int __tzyear;
128.123 + __tzrule_type __tzrule[2];
128.124 +} __tzinfo_type;
128.125 +
128.126 +__tzinfo_type *__gettzinfo (void);
128.127 +
128.128 +/* getdate functions */
128.129 +
128.130 +#ifdef HAVE_GETDATE
128.131 +#if __XSI_VISIBLE >= 4
128.132 +#ifndef _REENT_ONLY
128.133 +#define getdate_err (*__getdate_err())
128.134 +int *__getdate_err (void);
128.135 +
128.136 +struct tm * getdate (const char *);
128.137 +/* getdate_err is set to one of the following values to indicate the error.
128.138 + 1 the DATEMSK environment variable is null or undefined,
128.139 + 2 the template file cannot be opened for reading,
128.140 + 3 failed to get file status information,
128.141 + 4 the template file is not a regular file,
128.142 + 5 an error is encountered while reading the template file,
128.143 + 6 memory allication failed (not enough memory available),
128.144 + 7 there is no line in the template that matches the input,
128.145 + 8 invalid input specification */
128.146 +#endif /* !_REENT_ONLY */
128.147 +#endif /* __XSI_VISIBLE >= 4 */
128.148 +
128.149 +#if __GNU_VISIBLE
128.150 +/* getdate_r returns the error code as above */
128.151 +int getdate_r (const char *, struct tm *);
128.152 +#endif /* __GNU_VISIBLE */
128.153 +#endif /* HAVE_GETDATE */
128.154 +
128.155 +/* defines for the opengroup specifications Derived from Issue 1 of the SVID. */
128.156 +#if __SVID_VISIBLE || __XSI_VISIBLE
128.157 +extern __IMPORT long _timezone;
128.158 +extern __IMPORT int _daylight;
128.159 +#endif
128.160 +#if __POSIX_VISIBLE
128.161 +extern __IMPORT char *_tzname[2];
128.162 +
128.163 +/* POSIX defines the external tzname being defined in time.h */
128.164 +#ifndef tzname
128.165 +#define tzname _tzname
128.166 +#endif
128.167 +#endif /* __POSIX_VISIBLE */
128.168 +
128.169 +#ifdef __cplusplus
128.170 +}
128.171 +#endif
128.172 +
128.173 +#include <sys/features.h>
128.174 +
128.175 +#ifdef __CYGWIN__
128.176 +#include <cygwin/time.h>
128.177 +#endif /*__CYGWIN__*/
128.178 +
128.179 +#if defined(_POSIX_TIMERS)
128.180 +
128.181 +#include <signal.h>
128.182 +
128.183 +#ifdef __cplusplus
128.184 +extern "C" {
128.185 +#endif
128.186 +
128.187 +/* Clocks, P1003.1b-1993, p. 263 */
128.188 +
128.189 +int clock_settime (clockid_t clock_id, const struct timespec *tp);
128.190 +int clock_gettime (clockid_t clock_id, struct timespec *tp);
128.191 +int clock_getres (clockid_t clock_id, struct timespec *res);
128.192 +
128.193 +/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
128.194 +
128.195 +int timer_create (clockid_t clock_id,
128.196 + struct sigevent *__restrict evp,
128.197 + timer_t *__restrict timerid);
128.198 +
128.199 +/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
128.200 +
128.201 +int timer_delete (timer_t timerid);
128.202 +
128.203 +/* Per-Process Timers, P1003.1b-1993, p. 267 */
128.204 +
128.205 +int timer_settime (timer_t timerid, int flags,
128.206 + const struct itimerspec *__restrict value,
128.207 + struct itimerspec *__restrict ovalue);
128.208 +int timer_gettime (timer_t timerid, struct itimerspec *value);
128.209 +int timer_getoverrun (timer_t timerid);
128.210 +
128.211 +/* High Resolution Sleep, P1003.1b-1993, p. 269 */
128.212 +
128.213 +int nanosleep (const struct timespec *rqtp, struct timespec *rmtp);
128.214 +
128.215 +#ifdef __cplusplus
128.216 +}
128.217 +#endif
128.218 +#endif /* _POSIX_TIMERS */
128.219 +
128.220 +#if defined(_POSIX_CLOCK_SELECTION)
128.221 +
128.222 +#ifdef __cplusplus
128.223 +extern "C" {
128.224 +#endif
128.225 +
128.226 +int clock_nanosleep (clockid_t clock_id, int flags,
128.227 + const struct timespec *rqtp, struct timespec *rmtp);
128.228 +
128.229 +#ifdef __cplusplus
128.230 +}
128.231 +#endif
128.232 +
128.233 +#endif /* _POSIX_CLOCK_SELECTION */
128.234 +
128.235 +#ifdef __cplusplus
128.236 +extern "C" {
128.237 +#endif
128.238 +
128.239 +/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
128.240 +
128.241 +/* values for the clock enable attribute */
128.242 +
128.243 +#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */
128.244 +#define CLOCK_DISABLED 0 /* clock is disabled */
128.245 +
128.246 +/* values for the pthread cputime_clock_allowed attribute */
128.247 +
128.248 +#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */
128.249 + /* CPU-time clock attached to that thread */
128.250 + /* shall be accessible. */
128.251 +#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
128.252 + /* thread shall not have a CPU-time clock */
128.253 + /* accessible. */
128.254 +
128.255 +/* Flag indicating time is "absolute" with respect to the clock
128.256 + associated with a time. Value 4 is historic. */
128.257 +
128.258 +#define TIMER_ABSTIME 4
128.259 +
128.260 +/* Manifest Constants, P1003.1b-1993, p. 262 */
128.261 +
128.262 +#if __GNU_VISIBLE
128.263 +#define CLOCK_REALTIME_COARSE ((clockid_t) 0)
128.264 +#endif
128.265 +
128.266 +#define CLOCK_REALTIME ((clockid_t) 1)
128.267 +
128.268 +/* Manifest Constants, P1003.4b/D8, p. 55 */
128.269 +
128.270 +#if defined(_POSIX_CPUTIME)
128.271 +
128.272 +/* When used in a clock or timer function call, this is interpreted as
128.273 + the identifier of the CPU_time clock associated with the PROCESS
128.274 + making the function call. */
128.275 +
128.276 +#define CLOCK_PROCESS_CPUTIME_ID ((clockid_t) 2)
128.277 +
128.278 +#endif
128.279 +
128.280 +#if defined(_POSIX_THREAD_CPUTIME)
128.281 +
128.282 +/* When used in a clock or timer function call, this is interpreted as
128.283 + the identifier of the CPU_time clock associated with the THREAD
128.284 + making the function call. */
128.285 +
128.286 +#define CLOCK_THREAD_CPUTIME_ID ((clockid_t) 3)
128.287 +
128.288 +#endif
128.289 +
128.290 +#if defined(_POSIX_MONOTONIC_CLOCK)
128.291 +
128.292 +/* The identifier for the system-wide monotonic clock, which is defined
128.293 + * as a clock whose value cannot be set via clock_settime() and which
128.294 + * cannot have backward clock jumps. */
128.295 +
128.296 +#define CLOCK_MONOTONIC ((clockid_t) 4)
128.297 +
128.298 +#endif
128.299 +
128.300 +#if __GNU_VISIBLE
128.301 +
128.302 +#define CLOCK_MONOTONIC_RAW ((clockid_t) 5)
128.303 +
128.304 +#define CLOCK_MONOTONIC_COARSE ((clockid_t) 6)
128.305 +
128.306 +#define CLOCK_BOOTTIME ((clockid_t) 7)
128.307 +
128.308 +#define CLOCK_REALTIME_ALARM ((clockid_t) 8)
128.309 +
128.310 +#define CLOCK_BOOTTIME_ALARM ((clockid_t) 9)
128.311 +
128.312 +#endif
128.313 +
128.314 +#if defined(_POSIX_CPUTIME)
128.315 +
128.316 +/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
128.317 +
128.318 +int clock_getcpuclockid (pid_t pid, clockid_t *clock_id);
128.319 +
128.320 +#endif /* _POSIX_CPUTIME */
128.321 +
128.322 +#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
128.323 +
128.324 +/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
128.325 +
128.326 +int clock_setenable_attr (clockid_t clock_id, int attr);
128.327 +int clock_getenable_attr (clockid_t clock_id, int *attr);
128.328 +
128.329 +#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
128.330 +
128.331 +#ifdef __cplusplus
128.332 +}
128.333 +#endif
128.334 +
128.335 +#endif /* _TIME_H_ */
128.336 +
129.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129.2 +++ b/include/unctrl.h Mon Oct 21 16:11:07 2019 +0200
129.3 @@ -0,0 +1,46 @@
129.4 +/* From curses.h. */
129.5 +/*
129.6 + * Copyright (c) 1981, 1993
129.7 + * The Regents of the University of California. All rights reserved.
129.8 + *
129.9 + * Redistribution and use in source and binary forms, with or without
129.10 + * modification, are permitted provided that the following conditions
129.11 + * are met:
129.12 + * 1. Redistributions of source code must retain the above copyright
129.13 + * notice, this list of conditions and the following disclaimer.
129.14 + * 2. Redistributions in binary form must reproduce the above copyright
129.15 + * notice, this list of conditions and the following disclaimer in the
129.16 + * documentation and/or other materials provided with the distribution.
129.17 + * 3. All advertising materials mentioning features or use of this software
129.18 + * must display the following acknowledgement:
129.19 + * This product includes software developed by the University of
129.20 + * California, Berkeley and its contributors.
129.21 + * 4. Neither the name of the University nor the names of its contributors
129.22 + * may be used to endorse or promote products derived from this software
129.23 + * without specific prior written permission.
129.24 + *
129.25 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
129.26 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
129.27 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
129.28 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
129.29 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
129.30 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
129.31 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
129.32 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
129.33 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
129.34 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
129.35 + * SUCH DAMAGE.
129.36 + */
129.37 +
129.38 +#ifndef _UNCTRL_H_
129.39 +#define _UNCTRL_H_
129.40 +
129.41 +#include <_ansi.h>
129.42 +
129.43 +#define unctrl(c) __unctrl[(c) & 0xff]
129.44 +#define unctrllen(ch) __unctrllen[(ch) & 0xff]
129.45 +
129.46 +extern __IMPORT const char * const __unctrl[256]; /* Control strings. */
129.47 +extern __IMPORT const char __unctrllen[256]; /* Control strings length. */
129.48 +
129.49 +#endif /* _UNCTRL_H_ */
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
130.2 +++ b/include/unistd.h Mon Oct 21 16:11:07 2019 +0200
130.3 @@ -0,0 +1,6 @@
130.4 +#ifndef _UNISTD_H_
130.5 +#define _UNISTD_H_
130.6 +
130.7 +# include <sys/unistd.h>
130.8 +
130.9 +#endif /* _UNISTD_H_ */
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131.2 +++ b/include/utime.h Mon Oct 21 16:11:07 2019 +0200
131.3 @@ -0,0 +1,12 @@
131.4 +#ifdef __cplusplus
131.5 +extern "C" {
131.6 +#endif
131.7 +
131.8 +#include <_ansi.h>
131.9 +
131.10 +/* The utime function is defined in libc/sys/<arch>/sys if it exists. */
131.11 +#include <sys/utime.h>
131.12 +
131.13 +#ifdef __cplusplus
131.14 +}
131.15 +#endif
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133.2 +++ b/include/wchar.h Mon Oct 21 16:11:07 2019 +0200
133.3 @@ -0,0 +1,339 @@
133.4 +#ifndef _WCHAR_H_
133.5 +#define _WCHAR_H_
133.6 +
133.7 +#include <_ansi.h>
133.8 +
133.9 +#include <sys/reent.h>
133.10 +
133.11 +#define __need_size_t
133.12 +#define __need_wchar_t
133.13 +#define __need_wint_t
133.14 +#define __need_NULL
133.15 +#include <stddef.h>
133.16 +
133.17 +/* For _mbstate_t definition. */
133.18 +#include <sys/_types.h>
133.19 +#include <sys/cdefs.h>
133.20 +/* For __STDC_ISO_10646__ */
133.21 +#include <sys/features.h>
133.22 +
133.23 +/* typedef only __gnuc_va_list, used throughout the header */
133.24 +#define __need___va_list
133.25 +#include <stdarg.h>
133.26 +
133.27 +/* typedef va_list only when required */
133.28 +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
133.29 +#ifdef __GNUC__
133.30 +#ifndef _VA_LIST_DEFINED
133.31 +typedef __gnuc_va_list va_list;
133.32 +#define _VA_LIST_DEFINED
133.33 +#endif
133.34 +#else /* !__GNUC__ */
133.35 +#include <stdarg.h>
133.36 +#endif
133.37 +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
133.38 +
133.39 +#if __XSI_VISIBLE /* && __XSI_VISIBLE < 800 */ && !__GNU_VISIBLE
133.40 +#include <wctype.h>
133.41 +#endif
133.42 +
133.43 +#ifndef WEOF
133.44 +# define WEOF ((wint_t)-1)
133.45 +#endif
133.46 +
133.47 +/* This must match definition in <stdint.h> */
133.48 +#ifndef WCHAR_MIN
133.49 +#ifdef __WCHAR_MIN__
133.50 +#define WCHAR_MIN __WCHAR_MIN__
133.51 +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
133.52 +#define WCHAR_MIN (0 + L'\0')
133.53 +#else
133.54 +#define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
133.55 +#endif
133.56 +#endif
133.57 +
133.58 +/* This must match definition in <stdint.h> */
133.59 +#ifndef WCHAR_MAX
133.60 +#ifdef __WCHAR_MAX__
133.61 +#define WCHAR_MAX __WCHAR_MAX__
133.62 +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
133.63 +#define WCHAR_MAX (0xffffffffu + L'\0')
133.64 +#else
133.65 +#define WCHAR_MAX (0x7fffffff + L'\0')
133.66 +#endif
133.67 +#endif
133.68 +
133.69 +#if __POSIX_VISIBLE >= 200809
133.70 +#include <sys/_locale.h>
133.71 +#endif
133.72 +
133.73 +_BEGIN_STD_C
133.74 +
133.75 +#if __POSIX_VISIBLE >= 200809 || _XSI_VISIBLE
133.76 +/* As in stdio.h, <sys/reent.h> defines __FILE. */
133.77 +#if !defined(__FILE_defined)
133.78 +typedef __FILE FILE;
133.79 +# define __FILE_defined
133.80 +#endif
133.81 +#endif
133.82 +
133.83 +/* As required by POSIX.1-2008, declare tm as incomplete type.
133.84 + The actual definition is in time.h. */
133.85 +struct tm;
133.86 +
133.87 +#ifndef _MBSTATE_T
133.88 +#define _MBSTATE_T
133.89 +typedef _mbstate_t mbstate_t;
133.90 +#endif /* _MBSTATE_T */
133.91 +
133.92 +wint_t btowc (int);
133.93 +int wctob (wint_t);
133.94 +size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
133.95 +size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t,
133.96 + mbstate_t *__restrict);
133.97 +size_t _mbrtowc_r (struct _reent *, wchar_t * , const char * ,
133.98 + size_t, mbstate_t *);
133.99 +int mbsinit (const mbstate_t *);
133.100 +#if __POSIX_VISIBLE >= 200809
133.101 +size_t mbsnrtowcs (wchar_t *__restrict, const char **__restrict,
133.102 + size_t, size_t, mbstate_t *__restrict);
133.103 +#endif
133.104 +size_t _mbsnrtowcs_r (struct _reent *, wchar_t * , const char ** ,
133.105 + size_t, size_t, mbstate_t *);
133.106 +size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t,
133.107 + mbstate_t *__restrict);
133.108 +size_t _mbsrtowcs_r (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *);
133.109 +size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
133.110 +size_t _wcrtomb_r (struct _reent *, char * , wchar_t, mbstate_t *);
133.111 +#if __POSIX_VISIBLE >= 200809
133.112 +size_t wcsnrtombs (char *__restrict, const wchar_t **__restrict,
133.113 + size_t, size_t, mbstate_t *__restrict);
133.114 +#endif
133.115 +size_t _wcsnrtombs_r (struct _reent *, char * , const wchar_t ** ,
133.116 + size_t, size_t, mbstate_t *);
133.117 +size_t wcsrtombs (char *__restrict, const wchar_t **__restrict,
133.118 + size_t, mbstate_t *__restrict);
133.119 +size_t _wcsrtombs_r (struct _reent *, char * , const wchar_t ** ,
133.120 + size_t, mbstate_t *);
133.121 +#if __POSIX_VISIBLE >= 200809
133.122 +int wcscasecmp (const wchar_t *, const wchar_t *);
133.123 +#endif
133.124 +wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
133.125 +wchar_t *wcschr (const wchar_t *, wchar_t);
133.126 +int wcscmp (const wchar_t *, const wchar_t *);
133.127 +int wcscoll (const wchar_t *, const wchar_t *);
133.128 +wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
133.129 +#if __POSIX_VISIBLE >= 200809
133.130 +wchar_t *wcpcpy (wchar_t *__restrict,
133.131 + const wchar_t *__restrict);
133.132 +wchar_t *wcsdup (const wchar_t *) __malloc_like __result_use_check;
133.133 +#endif
133.134 +wchar_t *_wcsdup_r (struct _reent *, const wchar_t * );
133.135 +size_t wcscspn (const wchar_t *, const wchar_t *);
133.136 +size_t wcsftime (wchar_t *__restrict, size_t,
133.137 + const wchar_t *__restrict, const struct tm *__restrict);
133.138 +#if __GNU_VISIBLE
133.139 +size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict,
133.140 + const struct tm *__restrict, locale_t);
133.141 +#endif
133.142 +size_t wcslcat (wchar_t *, const wchar_t *, size_t);
133.143 +size_t wcslcpy (wchar_t *, const wchar_t *, size_t);
133.144 +size_t wcslen (const wchar_t *);
133.145 +#if __POSIX_VISIBLE >= 200809
133.146 +int wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
133.147 +#endif
133.148 +wchar_t *wcsncat (wchar_t *__restrict,
133.149 + const wchar_t *__restrict, size_t);
133.150 +int wcsncmp (const wchar_t *, const wchar_t *, size_t);
133.151 +wchar_t *wcsncpy (wchar_t *__restrict,
133.152 + const wchar_t *__restrict, size_t);
133.153 +#if __POSIX_VISIBLE >= 200809
133.154 +wchar_t *wcpncpy (wchar_t *__restrict,
133.155 + const wchar_t *__restrict, size_t);
133.156 +size_t wcsnlen (const wchar_t *, size_t);
133.157 +#endif
133.158 +wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
133.159 +wchar_t *wcsrchr (const wchar_t *, wchar_t);
133.160 +size_t wcsspn (const wchar_t *, const wchar_t *);
133.161 +wchar_t *wcsstr (const wchar_t *__restrict,
133.162 + const wchar_t *__restrict);
133.163 +wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict,
133.164 + wchar_t **__restrict);
133.165 +double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
133.166 +double _wcstod_r (struct _reent *, const wchar_t *, wchar_t **);
133.167 +#if __ISO_C_VISIBLE >= 1999
133.168 +float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
133.169 +#endif
133.170 +float _wcstof_r (struct _reent *, const wchar_t *, wchar_t **);
133.171 +#if __XSI_VISIBLE
133.172 +int wcswidth (const wchar_t *, size_t);
133.173 +#endif
133.174 +size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict,
133.175 + size_t);
133.176 +#if __POSIX_VISIBLE >= 200809
133.177 +extern int wcscasecmp_l (const wchar_t *, const wchar_t *, locale_t);
133.178 +extern int wcsncasecmp_l (const wchar_t *, const wchar_t *, size_t, locale_t);
133.179 +extern int wcscoll_l (const wchar_t *, const wchar_t *, locale_t);
133.180 +extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t,
133.181 + locale_t);
133.182 +#endif
133.183 +
133.184 +#if __XSI_VISIBLE
133.185 +int wcwidth (const wchar_t);
133.186 +#endif
133.187 +wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
133.188 +int wmemcmp (const wchar_t *, const wchar_t *, size_t);
133.189 +wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict,
133.190 + size_t);
133.191 +wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
133.192 +#if __GNU_VISIBLE
133.193 +wchar_t *wmempcpy (wchar_t *__restrict, const wchar_t *__restrict,
133.194 + size_t);
133.195 +#endif
133.196 +wchar_t *wmemset (wchar_t *, wchar_t, size_t);
133.197 +
133.198 +long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
133.199 +#if __ISO_C_VISIBLE >= 1999
133.200 +long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict,
133.201 + int);
133.202 +#endif
133.203 +unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict,
133.204 + int);
133.205 +#if __ISO_C_VISIBLE >= 1999
133.206 +unsigned long long wcstoull (const wchar_t *__restrict,
133.207 + wchar_t **__restrict, int);
133.208 +#endif
133.209 +long _wcstol_r (struct _reent *, const wchar_t *, wchar_t **, int);
133.210 +long long _wcstoll_r (struct _reent *, const wchar_t *, wchar_t **, int);
133.211 +unsigned long _wcstoul_r (struct _reent *, const wchar_t *, wchar_t **, int);
133.212 +unsigned long long _wcstoull_r (struct _reent *, const wchar_t *, wchar_t **, int);
133.213 +#if __ISO_C_VISIBLE >= 1999
133.214 +long double wcstold (const wchar_t *, wchar_t **);
133.215 +#endif
133.216 +
133.217 +#if __GNU_VISIBLE
133.218 +long wcstol_l (const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
133.219 +long long wcstoll_l (const wchar_t *__restrict, wchar_t **__restrict, int,
133.220 + locale_t);
133.221 +unsigned long wcstoul_l (const wchar_t *__restrict, wchar_t **__restrict, int,
133.222 + locale_t);
133.223 +unsigned long long wcstoull_l (const wchar_t *__restrict, wchar_t **__restrict,
133.224 + int, locale_t);
133.225 +double wcstod_l (const wchar_t *, wchar_t **, locale_t);
133.226 +float wcstof_l (const wchar_t *, wchar_t **, locale_t);
133.227 +long double wcstold_l (const wchar_t *, wchar_t **, locale_t);
133.228 +#endif
133.229 +
133.230 +wint_t fgetwc (__FILE *);
133.231 +wchar_t *fgetws (wchar_t *__restrict, int, __FILE *__restrict);
133.232 +wint_t fputwc (wchar_t, __FILE *);
133.233 +int fputws (const wchar_t *__restrict, __FILE *__restrict);
133.234 +#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
133.235 +int fwide (__FILE *, int);
133.236 +#endif
133.237 +wint_t getwc (__FILE *);
133.238 +wint_t getwchar (void);
133.239 +wint_t putwc (wchar_t, __FILE *);
133.240 +wint_t putwchar (wchar_t);
133.241 +wint_t ungetwc (wint_t wc, __FILE *);
133.242 +
133.243 +wint_t _fgetwc_r (struct _reent *, __FILE *);
133.244 +wint_t _fgetwc_unlocked_r (struct _reent *, __FILE *);
133.245 +wchar_t *_fgetws_r (struct _reent *, wchar_t *, int, __FILE *);
133.246 +wchar_t *_fgetws_unlocked_r (struct _reent *, wchar_t *, int, __FILE *);
133.247 +wint_t _fputwc_r (struct _reent *, wchar_t, __FILE *);
133.248 +wint_t _fputwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
133.249 +int _fputws_r (struct _reent *, const wchar_t *, __FILE *);
133.250 +int _fputws_unlocked_r (struct _reent *, const wchar_t *, __FILE *);
133.251 +int _fwide_r (struct _reent *, __FILE *, int);
133.252 +wint_t _getwc_r (struct _reent *, __FILE *);
133.253 +wint_t _getwc_unlocked_r (struct _reent *, __FILE *);
133.254 +wint_t _getwchar_r (struct _reent *ptr);
133.255 +wint_t _getwchar_unlocked_r (struct _reent *ptr);
133.256 +wint_t _putwc_r (struct _reent *, wchar_t, __FILE *);
133.257 +wint_t _putwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
133.258 +wint_t _putwchar_r (struct _reent *, wchar_t);
133.259 +wint_t _putwchar_unlocked_r (struct _reent *, wchar_t);
133.260 +wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *);
133.261 +
133.262 +#if __GNU_VISIBLE
133.263 +wint_t fgetwc_unlocked (__FILE *);
133.264 +wchar_t *fgetws_unlocked (wchar_t *__restrict, int, __FILE *__restrict);
133.265 +wint_t fputwc_unlocked (wchar_t, __FILE *);
133.266 +int fputws_unlocked (const wchar_t *__restrict, __FILE *__restrict);
133.267 +wint_t getwc_unlocked (__FILE *);
133.268 +wint_t getwchar_unlocked (void);
133.269 +wint_t putwc_unlocked (wchar_t, __FILE *);
133.270 +wint_t putwchar_unlocked (wchar_t);
133.271 +#endif
133.272 +
133.273 +#if __POSIX_VISIBLE >= 200809
133.274 +__FILE *open_wmemstream (wchar_t **, size_t *);
133.275 +#endif
133.276 +__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *);
133.277 +
133.278 +#ifndef __VALIST
133.279 +#ifdef __GNUC__
133.280 +#define __VALIST __gnuc_va_list
133.281 +#else
133.282 +#define __VALIST char*
133.283 +#endif
133.284 +#endif
133.285 +
133.286 +#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
133.287 +int fwprintf (__FILE *__restrict, const wchar_t *__restrict, ...);
133.288 +int swprintf (wchar_t *__restrict, size_t,
133.289 + const wchar_t *__restrict, ...);
133.290 +int vfwprintf (__FILE *__restrict, const wchar_t *__restrict,
133.291 + __VALIST);
133.292 +int vswprintf (wchar_t *__restrict, size_t,
133.293 + const wchar_t *__restrict, __VALIST);
133.294 +int vwprintf (const wchar_t *__restrict, __VALIST);
133.295 +int wprintf (const wchar_t *__restrict, ...);
133.296 +#endif
133.297 +
133.298 +int _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...);
133.299 +int _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...);
133.300 +int _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
133.301 +int _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST);
133.302 +int _vwprintf_r (struct _reent *, const wchar_t *, __VALIST);
133.303 +int _wprintf_r (struct _reent *, const wchar_t *, ...);
133.304 +
133.305 +#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
133.306 +int fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...);
133.307 +int swscanf (const wchar_t *__restrict,
133.308 + const wchar_t *__restrict, ...);
133.309 +int vfwscanf (__FILE *__restrict, const wchar_t *__restrict,
133.310 + __VALIST);
133.311 +int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict,
133.312 + __VALIST);
133.313 +int vwscanf (const wchar_t *__restrict, __VALIST);
133.314 +int wscanf (const wchar_t *__restrict, ...);
133.315 +#endif
133.316 +
133.317 +int _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...);
133.318 +int _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...);
133.319 +int _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
133.320 +int _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, __VALIST);
133.321 +int _vwscanf_r (struct _reent *, const wchar_t *, __VALIST);
133.322 +int _wscanf_r (struct _reent *, const wchar_t *, ...);
133.323 +
133.324 +#define getwc(fp) fgetwc(fp)
133.325 +#define putwc(wc,fp) fputwc((wc), (fp))
133.326 +#define getwchar() fgetwc(_REENT->_stdin)
133.327 +#define putwchar(wc) fputwc((wc), _REENT->_stdout)
133.328 +
133.329 +#if __GNU_VISIBLE
133.330 +#define getwc_unlocked(fp) fgetwc_unlocked(fp)
133.331 +#define putwc_unlocked(wc,fp) fputwc_unlocked((wc), (fp))
133.332 +#define getwchar_unlocked() fgetwc_unlocked(_REENT->_stdin)
133.333 +#define putwchar_unlocked(wc) fputwc_unlocked((wc), _REENT->_stdout)
133.334 +#endif
133.335 +
133.336 +_END_STD_C
133.337 +
133.338 +#if __SSP_FORTIFY_LEVEL > 0
133.339 +#include <ssp/wchar.h>
133.340 +#endif
133.341 +
133.342 +#endif /* _WCHAR_H_ */
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
134.2 +++ b/include/wctype.h Mon Oct 21 16:11:07 2019 +0200
134.3 @@ -0,0 +1,74 @@
134.4 +#ifndef _WCTYPE_H_
134.5 +#define _WCTYPE_H_
134.6 +
134.7 +#include <_ansi.h>
134.8 +#include <sys/_types.h>
134.9 +
134.10 +#define __need_wint_t
134.11 +#include <stddef.h>
134.12 +
134.13 +#if __POSIX_VISIBLE >= 200809
134.14 +#include <sys/_locale.h>
134.15 +#endif
134.16 +
134.17 +#ifndef WEOF
134.18 +# define WEOF ((wint_t)-1)
134.19 +#endif
134.20 +
134.21 +_BEGIN_STD_C
134.22 +
134.23 +#ifndef _WCTYPE_T
134.24 +#define _WCTYPE_T
134.25 +typedef int wctype_t;
134.26 +#endif
134.27 +
134.28 +#ifndef _WCTRANS_T
134.29 +#define _WCTRANS_T
134.30 +typedef int wctrans_t;
134.31 +#endif
134.32 +
134.33 +int iswalpha (wint_t);
134.34 +int iswalnum (wint_t);
134.35 +#if __ISO_C_VISIBLE >= 1999
134.36 +int iswblank (wint_t);
134.37 +#endif
134.38 +int iswcntrl (wint_t);
134.39 +int iswctype (wint_t, wctype_t);
134.40 +int iswdigit (wint_t);
134.41 +int iswgraph (wint_t);
134.42 +int iswlower (wint_t);
134.43 +int iswprint (wint_t);
134.44 +int iswpunct (wint_t);
134.45 +int iswspace (wint_t);
134.46 +int iswupper (wint_t);
134.47 +int iswxdigit (wint_t);
134.48 +wint_t towctrans (wint_t, wctrans_t);
134.49 +wint_t towupper (wint_t);
134.50 +wint_t towlower (wint_t);
134.51 +wctrans_t wctrans (const char *);
134.52 +wctype_t wctype (const char *);
134.53 +
134.54 +#if __POSIX_VISIBLE >= 200809
134.55 +extern int iswalpha_l (wint_t, locale_t);
134.56 +extern int iswalnum_l (wint_t, locale_t);
134.57 +extern int iswblank_l (wint_t, locale_t);
134.58 +extern int iswcntrl_l (wint_t, locale_t);
134.59 +extern int iswctype_l (wint_t, wctype_t, locale_t);
134.60 +extern int iswdigit_l (wint_t, locale_t);
134.61 +extern int iswgraph_l (wint_t, locale_t);
134.62 +extern int iswlower_l (wint_t, locale_t);
134.63 +extern int iswprint_l (wint_t, locale_t);
134.64 +extern int iswpunct_l (wint_t, locale_t);
134.65 +extern int iswspace_l (wint_t, locale_t);
134.66 +extern int iswupper_l (wint_t, locale_t);
134.67 +extern int iswxdigit_l (wint_t, locale_t);
134.68 +extern wint_t towctrans_l (wint_t, wctrans_t, locale_t);
134.69 +extern wint_t towupper_l (wint_t, locale_t);
134.70 +extern wint_t towlower_l (wint_t, locale_t);
134.71 +extern wctrans_t wctrans_l (const char *, locale_t);
134.72 +extern wctype_t wctype_l (const char *, locale_t);
134.73 +#endif
134.74 +
134.75 +_END_STD_C
134.76 +
134.77 +#endif /* _WCTYPE_H_ */
135.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135.2 +++ b/include/wordexp.h Mon Oct 21 16:11:07 2019 +0200
135.3 @@ -0,0 +1,53 @@
135.4 +/* Copyright (C) 2002, 2010 by Red Hat, Incorporated. All rights reserved.
135.5 + *
135.6 + * Permission to use, copy, modify, and distribute this software
135.7 + * is freely granted, provided that this notice is preserved.
135.8 + */
135.9 +
135.10 +#ifndef _WORDEXP_H_
135.11 +#define _WORDEXP_H_
135.12 +
135.13 +#include <sys/types.h>
135.14 +
135.15 +#ifdef __cplusplus
135.16 +extern "C" {
135.17 +#endif
135.18 +
135.19 +struct _wordexp_t
135.20 +{
135.21 + size_t we_wordc; /* Count of words matched by words. */
135.22 + char **we_wordv; /* Pointer to list of expanded words. */
135.23 + size_t we_offs; /* Slots to reserve at the beginning of we_wordv. */
135.24 +};
135.25 +
135.26 +typedef struct _wordexp_t wordexp_t;
135.27 +
135.28 +#define WRDE_DOOFFS 0x0001 /* Use we_offs. */
135.29 +#define WRDE_APPEND 0x0002 /* Append to output from previous call. */
135.30 +#define WRDE_NOCMD 0x0004 /* Don't perform command substitution. */
135.31 +#define WRDE_REUSE 0x0008 /* pwordexp points to a wordexp_t struct returned from
135.32 + a previous successful call to wordexp. */
135.33 +#define WRDE_SHOWERR 0x0010 /* Print error messages to stderr. */
135.34 +#define WRDE_UNDEF 0x0020 /* Report attempt to expand undefined shell variable. */
135.35 +
135.36 +enum {
135.37 + WRDE_SUCCESS,
135.38 + WRDE_NOSPACE,
135.39 + WRDE_BADCHAR,
135.40 + WRDE_BADVAL,
135.41 + WRDE_CMDSUB,
135.42 + WRDE_SYNTAX,
135.43 + WRDE_NOSYS
135.44 +};
135.45 +
135.46 +/* Note: This implementation of wordexp requires a version of bash
135.47 + that supports the --wordexp and --protected arguments to be present
135.48 + on the system. It does not support the WRDE_UNDEF flag. */
135.49 +int wordexp(const char *__restrict, wordexp_t *__restrict, int);
135.50 +void wordfree(wordexp_t *);
135.51 +
135.52 +#ifdef __cplusplus
135.53 +}
135.54 +#endif
135.55 +
135.56 +#endif /* _WORDEXP_H_ */