am 16636e4b: Merge "Refresh 64-bit headers and libs"

* commit '16636e4bf101847c57b6bcb2d54635e7c41b6941':
  Refresh 64-bit headers and libs
This commit is contained in:
Andrew Hsieh
2014-03-24 12:33:47 +00:00
committed by Android Git Automerger
59 changed files with 1691 additions and 2794 deletions

View File

@@ -38,91 +38,17 @@
#ifndef _AARCH64_ASM_H_
#define _AARCH64_ASM_H_
/* TODO: Add cfi directives for creating/restoring FP */
#ifdef __ELF__
# define _C_LABEL(x) x
#else
# ifdef __STDC__
# define _C_LABEL(x) _ ## x
# else
# define _C_LABEL(x) _/**/x
# endif
#endif
#define _ASM_LABEL(x) x
#ifdef __STDC__
# define __CONCAT(x,y) x ## y
# define __STRING(x) #x
#else
# define __CONCAT(x,y) x/**/y
# define __STRING(x) "x"
#endif
#ifndef _ALIGN_TEXT
# define _ALIGN_TEXT .align 0
# define _ALIGN_TEXT .align 0
#endif
#define _ASM_TYPE_FUNCTION %function
#define _ASM_TYPE_OBJECT %object
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .cfi_startproc
#define _ASM_SIZE(x) .size x, .-x;
#define _END(x) \
.cfi_endproc; \
_ASM_SIZE(x)
#define ENTRY(y) _ENTRY(_C_LABEL(y));
#define ENTRY_NP(y) _ENTRY(_C_LABEL(y))
#define END(y) _END(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define ASEND(y) _END(_ASM_LABEL(y))
#ifdef __ELF__
#define ENTRY_PRIVATE(y) ENTRY(y); .hidden _C_LABEL(y)
#else
#define ENTRY_PRIVATE(y) ENTRY(y)
#endif
#define ASMSTR .asciz
#undef __bionic_asm_function_type
#define __bionic_asm_function_type %function
#if defined(__ELF__) && defined(PIC)
#ifdef __STDC__
#define PIC_SYM(x,y) x ## ( ## y ## )
#define PIC_SYM(x,y) x ## ( ## y ## )
#else
#define PIC_SYM(x,y) x/**/(/**/y/**/)
#define PIC_SYM(x,y) x
#endif
#else
#define PIC_SYM(x,y) x
#endif
#ifdef __ELF__
#define RCSID(x) .section ".ident"; .asciz x
#else
#define RCSID(x) .text; .asciz x
#endif
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
#ifdef __STDC__
#define WARN_REFERENCES(sym,msg) \
.stabs msg ## ,30,0,0,0 ; \
.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
#elif defined(__ELF__)
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(sym),1,0,0,0
#else
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(_/**/sym),1,0,0,0
#endif /* __STDC__ */
#endif /* _AARCH64_ASM_H_ */

View File

@@ -38,8 +38,8 @@
* section 5.1.2 SIMD and Floating-Point Registers
*/
#ifndef _FENV_H_
#define _FENV_H_
#ifndef _ARM64_FENV_H_
#define _ARM64_FENV_H_
#include <sys/types.h>
@@ -54,15 +54,18 @@ typedef __uint32_t fexcept_t;
#define FE_OVERFLOW 0x04
#define FE_UNDERFLOW 0x08
#define FE_INEXACT 0x10
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
FE_OVERFLOW | FE_UNDERFLOW)
#define _FPSCR_ENABLE_SHIFT 8
#define _FPSCR_ENABLE_MASK (FE_ALL_EXCEPT << _FPSCR_ENABLE_SHIFT)
#define _FPSCR_ENABLE_MASK (FE_ALL_EXCEPT << _FPSCR_ENABLE_SHIFT)
/* Rounding modes. */
#define FE_TONEAREST 0x0
#define FE_UPWARD 0x1
#define FE_DOWNWARD 0x2
#define FE_TOWARDZERO 0x3
#define _FPSCR_RMODE_SHIFT 22
#define FPCR_IOE (1 << 8)
@@ -113,120 +116,6 @@ typedef __uint32_t fexcept_t;
FPSR_Z | \
FPSR_N )
/* Default floating-point environment. */
extern const fenv_t __fe_dfl_env;
#define FE_DFL_ENV (&__fe_dfl_env)
static __inline int fegetenv(fenv_t* __envp) {
fenv_t _fpcr, _fpsr;
__asm__ __volatile__("mrs %0,fpcr" : "=r" (_fpcr));
__asm__ __volatile__("mrs %0,fpsr" : "=r" (_fpsr));
*__envp = (_fpcr | _fpsr);
return 0;
}
static __inline int fesetenv(const fenv_t* __envp) {
fenv_t _fpcr = (*__envp & FPCR_MASK);
fenv_t _fpsr = (*__envp & FPSR_MASK);
__asm__ __volatile__("msr fpcr,%0" : :"ri" (_fpcr));
__asm__ __volatile__("msr fpsr,%0" : :"ri" (_fpsr));
return 0;
}
static __inline int feclearexcept(int __excepts) {
fexcept_t __fpscr;
fegetenv(&__fpscr);
__fpscr &= ~__excepts;
fesetenv(&__fpscr);
return 0;
}
static __inline int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
fexcept_t __fpscr;
fegetenv(&__fpscr);
*__flagp = __fpscr & __excepts;
return 0;
}
static __inline int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
fexcept_t __fpscr;
fegetenv(&__fpscr);
__fpscr &= ~__excepts;
__fpscr |= *__flagp & __excepts;
fesetenv(&__fpscr);
return 0;
}
static __inline int feraiseexcept(int __excepts) {
fexcept_t __ex = __excepts;
fesetexceptflag(&__ex, __excepts);
return 0;
}
static __inline int fetestexcept(int __excepts) {
fexcept_t __fpscr;
fegetenv(&__fpscr);
return (__fpscr & __excepts);
}
static __inline int fegetround(void) {
fenv_t _fpscr;
fegetenv(&_fpscr);
return ((_fpscr >> _FPSCR_RMODE_SHIFT) & 0x3);
}
static __inline int fesetround(int __round) {
fenv_t _fpscr;
fegetenv(&_fpscr);
_fpscr &= ~(0x3 << _FPSCR_RMODE_SHIFT);
_fpscr |= (__round << _FPSCR_RMODE_SHIFT);
fesetenv(&_fpscr);
return 0;
}
static __inline int feholdexcept(fenv_t* __envp) {
fenv_t __env;
fegetenv(&__env);
*__envp = __env;
__env &= ~(FE_ALL_EXCEPT | _FPSCR_ENABLE_MASK);
fesetenv(&__env);
return 0;
}
static __inline int feupdateenv(const fenv_t* __envp) {
fexcept_t __fpscr;
fegetenv(&__fpscr);
fesetenv(__envp);
feraiseexcept(__fpscr & FE_ALL_EXCEPT);
return 0;
}
#if __BSD_VISIBLE
static __inline int feenableexcept(int __mask) {
fenv_t __old_fpscr, __new_fpscr;
fegetenv(&__old_fpscr);
__new_fpscr = __old_fpscr | (__mask & FE_ALL_EXCEPT) << _FPSCR_ENABLE_SHIFT;
fesetenv(&__new_fpscr);
return ((__old_fpscr >> _FPSCR_ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
static __inline int fedisableexcept(int __mask) {
fenv_t __old_fpscr, __new_fpscr;
fegetenv(&__old_fpscr);
__new_fpscr = __old_fpscr & ~((__mask & FE_ALL_EXCEPT) << _FPSCR_ENABLE_SHIFT);
fesetenv(&__new_fpscr);
return ((__old_fpscr >> _FPSCR_ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
static __inline int fegetexcept(void) {
fenv_t __fpscr;
fegetenv(&__fpscr);
return ((__fpscr & _FPSCR_ENABLE_MASK) >> _FPSCR_ENABLE_SHIFT);
}
#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_FENV_H_ */
#endif /* !_ARM64_FENV_H_ */

View File

@@ -19,10 +19,10 @@
#ifndef _UAPI_ASM_SIGNAL_H
#define _UAPI_ASM_SIGNAL_H
#include <linux/types.h>
#define _NSIG 128
#define _KERNEL__NSIG 128
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _NSIG_BPW (sizeof(unsigned long) * 8)
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_NSIG_WORDS];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -72,7 +72,7 @@ typedef unsigned long old_sigset_t;
#define SIGXFSZ 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#define SA_ONSTACK 0x08000000
#define SA_RESETHAND 0x80000000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -1,225 +0,0 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $
*/
/*
Rewritten for Android.
*/
/* MIPS FPU floating point control register bits.
*
* 31-25 -> floating point conditions code bits set by FP compare
* instructions
* 24 -> flush denormalized results to zero instead of
* causing unimplemented operation exception.
* 23 -> Condition bit
* 22 -> In conjunction with FS detects denormalized
* operands and replaces them internally with 0.
* 21 -> In conjunction with FS forces denormalized operands
* to the closest normalized value.
* 20-18 -> reserved (read as 0, write with 0)
* 17 -> cause bit for unimplemented operation
* 16 -> cause bit for invalid exception
* 15 -> cause bit for division by zero exception
* 14 -> cause bit for overflow exception
* 13 -> cause bit for underflow exception
* 12 -> cause bit for inexact exception
* 11 -> enable exception for invalid exception
* 10 -> enable exception for division by zero exception
* 9 -> enable exception for overflow exception
* 8 -> enable exception for underflow exception
* 7 -> enable exception for inexact exception
* 6 -> flag invalid exception
* 5 -> flag division by zero exception
* 4 -> flag overflow exception
* 3 -> flag underflow exception
* 2 -> flag inexact exception
* 1-0 -> rounding control
*
*
* Rounding Control:
* 00 - rounding to nearest (RN)
* 01 - rounding toward zero (RZ)
* 10 - rounding (up) toward plus infinity (RP)
* 11 - rounding (down)toward minus infinity (RM)
*/
#ifndef _FENV_H_
#define _FENV_H_
#include <sys/types.h>
__BEGIN_DECLS
typedef __uint32_t fenv_t;
typedef __uint32_t fexcept_t;
/* Exception flags */
#define FE_INVALID 0x40
#define FE_DIVBYZERO 0x20
#define FE_OVERFLOW 0x10
#define FE_UNDERFLOW 0x08
#define FE_INEXACT 0x04
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#define _FCSR_CAUSE_SHIFT 10
#define _ENABLE_SHIFT 5
#define _FCSR_ENABLE_MASK (FE_ALL_EXCEPT << _ENABLE_SHIFT)
/* Rounding modes */
#define FE_TONEAREST 0x0000
#define FE_TOWARDZERO 0x0001
#define FE_UPWARD 0x0002
#define FE_DOWNWARD 0x0003
#define _FCSR_RMODE_SHIFT 0
#define _FCSR_RMASK 0x3
/* Default floating-point environment */
extern const fenv_t __fe_dfl_env;
#define FE_DFL_ENV (&__fe_dfl_env)
static __inline int fegetenv(fenv_t* __envp) {
fenv_t _fcsr = 0;
#ifdef __mips_hard_float
__asm__ __volatile__("cfc1 %0,$31" : "=r" (_fcsr));
#endif
*__envp = _fcsr;
return 0;
}
static __inline int fesetenv(const fenv_t* __envp) {
fenv_t _fcsr = *__envp;
#ifdef __mips_hard_float
__asm__ __volatile__("ctc1 %0,$31" : : "r" (_fcsr));
#endif
return 0;
}
static __inline int feclearexcept(int __excepts) {
fexcept_t __fcsr;
fegetenv(&__fcsr);
__excepts &= FE_ALL_EXCEPT;
__fcsr &= ~(__excepts | (__excepts << _FCSR_CAUSE_SHIFT));
fesetenv(&__fcsr);
return 0;
}
static __inline int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
fexcept_t __fcsr;
fegetenv(&__fcsr);
*__flagp = __fcsr & __excepts & FE_ALL_EXCEPT;
return 0;
}
static __inline int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
fexcept_t __fcsr;
fegetenv(&__fcsr);
/* Ensure that flags are all legal */
__excepts &= FE_ALL_EXCEPT;
__fcsr &= ~__excepts;
__fcsr |= *__flagp & __excepts;
fesetenv(&__fcsr);
return 0;
}
static __inline int feraiseexcept(int __excepts) {
fexcept_t __fcsr;
fegetenv(&__fcsr);
/* Ensure that flags are all legal */
__excepts &= FE_ALL_EXCEPT;
/* Cause bit needs to be set as well for generating the exception*/
__fcsr |= __excepts | (__excepts << _FCSR_CAUSE_SHIFT);
fesetenv(&__fcsr);
return 0;
}
static __inline int fetestexcept(int __excepts) {
fexcept_t __FCSR;
fegetenv(&__FCSR);
return (__FCSR & __excepts & FE_ALL_EXCEPT);
}
static __inline int fegetround(void) {
fenv_t _fcsr;
fegetenv(&_fcsr);
return (_fcsr & _FCSR_RMASK);
}
static __inline int fesetround(int __round) {
fenv_t _fcsr;
fegetenv(&_fcsr);
_fcsr &= ~_FCSR_RMASK;
_fcsr |= (__round & _FCSR_RMASK ) ;
fesetenv(&_fcsr);
return 0;
}
static __inline int feholdexcept(fenv_t* __envp) {
fenv_t __env;
fegetenv(&__env);
*__envp = __env;
__env &= ~(FE_ALL_EXCEPT | _FCSR_ENABLE_MASK);
fesetenv(&__env);
return 0;
}
static __inline int feupdateenv(const fenv_t* __envp) {
fexcept_t __fcsr;
fegetenv(&__fcsr);
fesetenv(__envp);
feraiseexcept(__fcsr & FE_ALL_EXCEPT);
return 0;
}
#if __BSD_VISIBLE
static __inline int feenableexcept(int __mask) {
fenv_t __old_fcsr, __new_fcsr;
fegetenv(&__old_fcsr);
__new_fcsr = __old_fcsr | (__mask & FE_ALL_EXCEPT) << _ENABLE_SHIFT;
fesetenv(&__new_fcsr);
return ((__old_fcsr >> _ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
static __inline int fedisableexcept(int __mask) {
fenv_t __old_fcsr, __new_fcsr;
fegetenv(&__old_fcsr);
__new_fcsr = __old_fcsr & ~((__mask & FE_ALL_EXCEPT) << _ENABLE_SHIFT);
fesetenv(&__new_fcsr);
return ((__old_fcsr >> _ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
static __inline int fegetexcept(void) {
fenv_t __fcsr;
fegetenv(&__fcsr);
return ((__fcsr & _FCSR_ENABLE_MASK) >> _ENABLE_SHIFT);
}
#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_FENV_H_ */

View File

@@ -28,25 +28,24 @@
#ifndef _MIPS64_ASM_H
#define _MIPS64_ASM_H
#include <machine/regdef.h>
#ifdef NEED_OLD_RM7KFIX
#define ITLBNOPFIX nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
#else
#define ITLBNOPFIX nop;nop;nop;nop
#ifndef _ALIGN_TEXT
# define _ALIGN_TEXT .align 4
#endif
#undef __bionic_asm_custom_entry
#undef __bionic_asm_custom_end
#define __bionic_asm_custom_entry(f) .ent f
#define __bionic_asm_custom_end(f) .end f
#include <machine/regdef.h>
#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
#define _MIPS_ISA_MIPS3 3 /* R4000 */
#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
#ifdef __linux__
#define _MIPS_ISA_MIPS5 5
#define _MIPS_ISA_MIPS32 6
#define _MIPS_ISA_MIPS64 7
#else
#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
#endif
#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
#define ABICALLS .abicalls
@@ -56,8 +55,6 @@
ABICALLS
#endif
#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */
#if !defined(__MIPSEL__) && !defined(__MIPSEB__)
#error "__MIPSEL__ or __MIPSEB__ must be defined"
#endif
@@ -90,15 +87,6 @@
*/
#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
#ifndef _MIPS_SIM
#define _MIPS_SIM 1
#define _ABIO32 1
#endif
#ifndef _MIPS_ISA
#define _MIPS_ISA 2
#define _MIPS_ISA_MIPS2 2
#endif
#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
#define NARGSAVE 4
@@ -189,28 +177,6 @@
#define PTR_VAL .dword
#endif
/*
* Define -pg profile entry code.
*/
#if defined(XGPROF) || defined(XPROF)
#define MCOUNT \
PTR_SUBU sp, sp, 64; \
SAVE_GP(16); \
sd ra, 56(sp); \
sd gp, 48(sp); \
.set noat; \
.set noreorder; \
move AT, ra; \
jal _mcount; \
PTR_SUBU sp, sp, 16; \
ld ra, 56(sp); \
PTR_ADDU sp, sp, 64; \
.set reorder; \
.set at;
#else
#define MCOUNT
#endif
/*
* LEAF(x, fsize)
*
@@ -221,26 +187,9 @@
.globl x; \
.ent x, 0; \
x: ; \
.cfi_startproc; \
.frame sp, fsize, ra; \
SETUP_GP \
MCOUNT
#define ALEAF(x) \
.globl x; \
x:
/*
* NLEAF(x)
*
* Declare a non-profiled leaf routine.
*/
#define NLEAF(x, fsize) \
.align 3; \
.globl x; \
.ent x, 0; \
x: ; \
.frame sp, fsize, ra; \
SETUP_GP
/*
* NON_LEAF(x)
@@ -252,54 +201,8 @@ x: ; \
.globl x; \
.ent x, 0; \
x: ; \
.cfi_startproc; \
.frame sp, fsize, retpc; \
SETUP_GP \
MCOUNT
/*
* NNON_LEAF(x)
*
* Declare a non-profiled non-leaf routine
* (a routine that makes other C calls).
*/
#define NNON_LEAF(x, fsize, retpc) \
.align 3; \
.globl x; \
.ent x, 0; \
x: ; \
.frame sp, fsize, retpc \
SETUP_GP
/*
* END(x)
*
* Mark end of a procedure.
*/
#define END(x) \
.end x
/*
* Macros to panic and printf from assembly language.
*/
#define PANIC(msg) \
LA a0, 9f; \
jal panic; \
nop ; \
MSG(msg)
#define PRINTF(msg) \
LA a0, 9f; \
jal printf; \
nop ; \
MSG(msg)
#define MSG(msg) \
.rdata; \
9: .asciiz msg; \
.text
#define ASMSTR(str) \
.asciiz str; \
.align 3
#endif /* !_MIPS_ASM_H */

View File

@@ -0,0 +1,105 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $
*/
/*
Rewritten for Android.
*/
/* MIPS FPU floating point control register bits.
*
* 31-25 -> floating point conditions code bits set by FP compare
* instructions
* 24 -> flush denormalized results to zero instead of
* causing unimplemented operation exception.
* 23 -> Condition bit
* 22 -> In conjunction with FS detects denormalized
* operands and replaces them internally with 0.
* 21 -> In conjunction with FS forces denormalized operands
* to the closest normalized value.
* 20-18 -> reserved (read as 0, write with 0)
* 17 -> cause bit for unimplemented operation
* 16 -> cause bit for invalid exception
* 15 -> cause bit for division by zero exception
* 14 -> cause bit for overflow exception
* 13 -> cause bit for underflow exception
* 12 -> cause bit for inexact exception
* 11 -> enable exception for invalid exception
* 10 -> enable exception for division by zero exception
* 9 -> enable exception for overflow exception
* 8 -> enable exception for underflow exception
* 7 -> enable exception for inexact exception
* 6 -> flag invalid exception
* 5 -> flag division by zero exception
* 4 -> flag overflow exception
* 3 -> flag underflow exception
* 2 -> flag inexact exception
* 1-0 -> rounding control
*
*
* Rounding Control:
* 00 - rounding to nearest (RN)
* 01 - rounding toward zero (RZ)
* 10 - rounding (up) toward plus infinity (RP)
* 11 - rounding (down)toward minus infinity (RM)
*/
#ifndef _MIPS_FENV_H_
#define _MIPS_FENV_H_
#include <sys/types.h>
__BEGIN_DECLS
typedef __uint32_t fenv_t;
typedef __uint32_t fexcept_t;
/* Exception flags */
#define FE_INVALID 0x40
#define FE_DIVBYZERO 0x20
#define FE_OVERFLOW 0x10
#define FE_UNDERFLOW 0x08
#define FE_INEXACT 0x04
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#define _FCSR_CAUSE_SHIFT 10
#define _ENABLE_SHIFT 5
#define _FCSR_ENABLE_MASK (FE_ALL_EXCEPT << _ENABLE_SHIFT)
/* Rounding modes */
#define FE_TONEAREST 0x0000
#define FE_TOWARDZERO 0x0001
#define FE_UPWARD 0x0002
#define FE_DOWNWARD 0x0003
#define _FCSR_RMODE_SHIFT 0
#define _FCSR_RMASK 0x3
__END_DECLS
#endif /* !_MIPS_FENV_H_ */

View File

@@ -37,111 +37,15 @@
#ifndef _MIPS_SIGNAL_H_
#define _MIPS_SIGNAL_H_
#include <sys/cdefs.h>
#if !defined(__LANGUAGE_ASSEMBLY)
#include <sys/types.h>
/*
* Machine-dependent signal definitions
*/
typedef int sig_atomic_t;
#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
/*
* Information pushed on stack when a signal is delivered.
* This is used by the kernel to restore state following
* execution of the signal handler. It is also made available
* to the handler to allow it to restore state properly if
* a non-standard exit is performed.
*/
#if defined(__ANDROID__)
/*
* The Linux and OpenBSD sigcontext structures are slightly different
* This is the Linux O32 ABI compatible sigcontext
*/
struct sigcontext {
unsigned int sc_regmask;
unsigned int sc_status;
unsigned long long sc_pc;
unsigned long long sc_regs[32];
unsigned long long sc_fpregs[32];
unsigned int sc_acx;
unsigned int sc_fpc_csr;
unsigned int sc_fpc_eir;
unsigned int sc_used_math;
unsigned int sc_dsp;
unsigned long long sc_mdhi;
unsigned long long sc_mdlo;
unsigned long sc_hi1;
unsigned long sc_lo1;
unsigned long sc_hi2;
unsigned long sc_lo2;
unsigned long sc_hi3;
unsigned long sc_lo3;
};
#else
struct sigcontext {
long sc_onstack; /* sigstack state to restore */
long sc_mask; /* signal mask to restore */
__register_t sc_pc; /* pc at time of signal */
__register_t sc_regs[32]; /* processor regs 0 to 31 */
__register_t mullo; /* mullo and mulhi registers... */
__register_t mulhi; /* mullo and mulhi registers... */
f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */
long sc_fpused; /* fp has been used */
long sc_fpc_eir; /* floating point exception instruction reg */
long xxx[8]; /* XXX reserved */
};
#endif
#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
#else /* __LANGUAGE_ASSEMBLY */
#ifdef __ANDROID__
#define SC_REGMASK (0*REGSZ)
#define SC_STATUS (1*REGSZ)
#define SC_PC (2*REGSZ)
#define SC_REGS (SC_PC+8)
#define SC_FPREGS (SC_REGS+32*8)
#define SC_ACX (SC_FPREGS+32*REGSZ_FP)
#define SC_FPC_CSR (SC_ACX+1*REGSZ)
#define SC_FPC_EIR (SC_ACX+2*REGSZ)
#define SC_USED_MATH (SC_ACX+3*REGSZ)
#define SC_DSP (SC_ACX+4*REGSZ)
#define SC_MDHI (SC_ACX+5*REGSZ)
#define SC_MDLO (SC_MDHI+8)
#define SC_HI1 (SC_MDLO+8)
#define SC_LO1 (SC_HI1+1*REGSZ)
#define SC_HI2 (SC_HI1+2*REGSZ)
#define SC_LO2 (SC_HI1+3*REGSZ)
#define SC_HI3 (SC_HI1+4*REGSZ)
#define SC_LO3 (SC_HI1+5*REGSZ)
/* OpenBSD compatibility */
#define SC_MASK SC_REGMASK
#define SC_FPUSED SC_USED_MATH
#else
#define SC_ONSTACK (0 * REGSZ)
#define SC_MASK (1 * REGSZ)
#define SC_PC (2 * REGSZ)
#define SC_REGS (3 * REGSZ)
#define SC_MULLO (35 * REGSZ)
#define SC_MULHI (36 * REGSZ)
#define SC_FPREGS (37 * REGSZ)
#define SC_FPUSED (70 * REGSZ)
#define SC_FPC_EIR (71 * REGSZ)
#endif /* __ANDROID__ */
#endif /* __LANGUAGE_ASSEMBLY */
#endif /* !_MIPS_SIGNAL_H_ */

View File

@@ -24,7 +24,7 @@
#include <linux/time.h>
#include <linux/compiler.h>
struct siginfo;
#define NSIG 32
#define _KERNEL_NSIG 32
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef unsigned long sigset_t;
#endif
@@ -72,7 +72,7 @@ typedef unsigned long sigset_t;
#define SIGUNUSED 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#define SA_NOCLDSTOP 0x00000001u
#define SA_NOCLDWAIT 0x00000002u
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -102,7 +102,7 @@ struct stat {
long __linux_unused[3];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define INIT_STRUCT_STAT_PADDING(st) do { st.__pad0 = 0; st.__unused[0] = 0; st.__unused[1] = 0; st.__unused[2] = 0; } while (0)
#define INIT_STRUCT_STAT_PADDING(st) do { st.__pad0 = 0; st.__linux_unused[0] = 0; st.__linux_unused[1] = 0; st.__linux_unused[2] = 0; } while (0)
#endif
struct __old_kernel_stat {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -37,8 +37,6 @@
#ifndef _AMD64_ASM_H_
#define _AMD64_ASM_H_
#ifdef __x86_64__
#ifdef __PIC__
#define PIC_PLT(x) x@PLT
#define PIC_GOT(x) x@GOTPCREL(%rip)
@@ -47,19 +45,6 @@
#define PIC_GOT(x) x
#endif
# define _C_LABEL(x) x
#define _ASM_LABEL(x) x
#define CVAROFF(x,y) (_C_LABEL(x)+y)(%rip)
#ifdef __STDC__
# define __CONCAT(x,y) x ## y
# define __STRING(x) #x
#else
# define __CONCAT(x,y) x/**/y
# define __STRING(x) "x"
#endif
/* let kernels and others override entrypoint alignment */
#ifndef _ALIGN_TEXT
# ifdef _STANDALONE
@@ -69,78 +54,4 @@
# endif
#endif
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
#define _LABEL(x) \
.globl x; x:
#ifdef _KERNEL
/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
#ifdef __STDC__
#define IDTVEC(name) \
ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
#define IDTVEC_END(name) \
.size X ## name, . - X ## name
#else
#define IDTVEC(name) \
ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
#define IDTVEC_END(name) \
.size X/**/name, . - X/**/name
#endif /* __STDC__ */
#endif /* _KERNEL */
#ifdef __STDC__
#define CPUVAR(off) %gs:CPU_INFO_ ## off
#else
#define CPUVAR(off) %gs:CPU_INFO_/**/off
#endif
#ifdef GPROF
# define _PROF_PROLOGUE \
pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp
#else
# define _PROF_PROLOGUE
#endif
#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
#define NENTRY(y) _ENTRY(_C_LABEL(y))
#define ALTENTRY(x) NENTRY(x)
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define LABEL(y) _LABEL(_C_LABEL(y))
#define END(y) .cfi_endproc; .size y, . - y
#define ASMSTR .asciz
#define RCSID(x) .pushsection ".ident"; .asciz x; .popsection
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
/*
* STRONG_ALIAS: create a strong alias.
*/
#define STRONG_ALIAS(alias,sym) \
.globl alias; \
alias = sym
#ifdef __STDC__
#define WARN_REFERENCES(sym,msg) \
.pushsection .gnu.warning. ## sym; \
.ascii msg; \
.popsection
#else
#define WARN_REFERENCES(sym,msg) \
.pushsection .gnu.warning./**/sym; \
.ascii msg; \
.popsection
#endif /* __STDC__ */
#else /* __x86_64__ */
#include <i386/asm.h>
#endif /* __x86_64__ */
#endif /* !_AMD64_ASM_H_ */

View File

@@ -26,76 +26,46 @@
* $FreeBSD: src/lib/msun/i387/fenv.h,v 1.4 2005/03/17 22:21:46 das Exp $
*/
#ifndef _FENV_H_
#define _FENV_H_
#ifndef _I387_FENV_H_
#define _I387_FENV_H_
#include <sys/types.h>
__BEGIN_DECLS
/*
/*
* To preserve binary compatibility with FreeBSD 5.3, we pack the
* mxcsr into some reserved fields, rather than changing sizeof(fenv_t).
*/
typedef struct {
__uint16_t __control;
__uint16_t __mxcsr_hi;
__uint16_t __status;
__uint16_t __mxcsr_lo;
__uint32_t __tag;
char __other[16];
__uint16_t __control;
__uint16_t __mxcsr_hi;
__uint16_t __status;
__uint16_t __mxcsr_lo;
__uint32_t __tag;
char __other[16];
} fenv_t;
typedef __uint16_t fexcept_t;
typedef __uint16_t fexcept_t;
/* Exception flags */
#define FE_INVALID 0x01
#define FE_DENORMAL 0x02
#define FE_DIVBYZERO 0x04
#define FE_OVERFLOW 0x08
#define FE_UNDERFLOW 0x10
#define FE_INEXACT 0x20
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#define FE_INVALID 0x01
#define FE_DENORMAL 0x02
#define FE_DIVBYZERO 0x04
#define FE_OVERFLOW 0x08
#define FE_UNDERFLOW 0x10
#define FE_INEXACT 0x20
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
/* Rounding modes */
#define FE_TONEAREST 0x0000
#define FE_DOWNWARD 0x0400
#define FE_UPWARD 0x0800
#define FE_TOWARDZERO 0x0c00
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
FE_UPWARD | FE_TOWARDZERO)
/* Default floating-point environment */
extern const fenv_t __fe_dfl_env;
#define FE_DFL_ENV (&__fe_dfl_env)
/* C99 floating-point exception functions */
int feclearexcept(int excepts);
int fegetexceptflag(fexcept_t *flagp, int excepts);
int fesetexceptflag(const fexcept_t *flagp, int excepts);
/* feraiseexcept does not set the inexact flag on overflow/underflow */
int feraiseexcept(int excepts);
int fetestexcept(int excepts);
/* C99 rounding control functions */
int fegetround(void);
int fesetround(int round);
/* C99 floating-point environment functions */
int fegetenv(fenv_t *__envp);
int feholdexcept(fenv_t *__envp);
int fesetenv(const fenv_t *envp);
int feupdateenv(const fenv_t *__envp);
#if __BSD_VISIBLE
/* Additional support functions to set/query floating point traps */
int feenableexcept(int __mask);
int fedisableexcept(int __mask);
int fegetexcept(void);
#endif /* __BSD_VISIBLE */
#define FE_TONEAREST 0x0000
#define FE_DOWNWARD 0x0400
#define FE_UPWARD 0x0800
#define FE_TOWARDZERO 0x0c00
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
FE_UPWARD | FE_TOWARDZERO)
__END_DECLS
#endif /* !_FENV_H_ */
#endif /* !I387_FENV_H_ */

View File

@@ -1,41 +1,668 @@
/* $NetBSD: nameser.h,v 1.25 2009/04/12 17:07:34 christos Exp $ */
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
* Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 1996-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _arpa_nameser_h
#define _arpa_nameser_h
/*
* Id: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp
*/
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
#define BIND_4_COMPAT
#include <sys/types.h>
#include <sys/cdefs.h>
/* this header intentionally blank
*
* the definitions normally found in <arpa/nameser.h> are
* really a bunch of resolver's internal declarations that
* should not be exposed to client code in any way
/*
* Revision information. This is the release date in YYYYMMDD format.
* It can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not
* compare for equality; rather, use it to determine whether your libbind.a
* contains a new enough lib/nameser/ to support the feature you need.
*/
#endif /* _arpa_nameser_h */
#define __NAMESER 20090302 /*%< New interface version stamp. */
/*
* Define constants based on RFC0883, RFC1034, RFC 1035
*/
#define NS_PACKETSZ 512 /* default UDP packet size */
#define NS_MAXDNAME 1025 /* maximum domain name (presentation format)*/
#define NS_MAXMSG 65535 /* maximum message size */
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
#define NS_MAXLABEL 63 /* maximum length of domain label */
#define NS_MAXLABELS 128 /* theoretical max #/labels per domain name */
#define NS_MAXNNAME 256 /* maximum uncompressed (binary) domain name*/
#define NS_MAXPADDR (sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
#define NS_INT32SZ 4 /* #/bytes of data in a uint32_t */
#define NS_INT16SZ 2 /* #/bytes of data in a uint16_t */
#define NS_INT8SZ 1 /* #/bytes of data in a uint8_t */
#define NS_INADDRSZ 4 /* IPv4 T_A */
#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
/*
* These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
* in synch with it.
*/
typedef enum __ns_sect {
ns_s_qd = 0, /* Query: Question. */
ns_s_zn = 0, /* Update: Zone. */
ns_s_an = 1, /* Query: Answer. */
ns_s_pr = 1, /* Update: Prerequisites. */
ns_s_ns = 2, /* Query: Name servers. */
ns_s_ud = 2, /* Update: Update. */
ns_s_ar = 3, /* Query|Update: Additional records. */
ns_s_max = 4
} ns_sect;
/*
* Network name (compressed or not) type. Equivilent to a pointer when used
* in a function prototype. Can be const'd.
*/
typedef u_char ns_nname[NS_MAXNNAME];
typedef const u_char *ns_nname_ct;
typedef u_char *ns_nname_t;
struct ns_namemap { ns_nname_ct base; int len; };
typedef struct ns_namemap *ns_namemap_t;
typedef const struct ns_namemap *ns_namemap_ct;
/*
* This is a message handle. It is caller allocated and has no dynamic data.
* This structure is intended to be opaque to all but ns_parse.c, thus the
* leading _'s on the member names. Use the accessor functions, not the _'s.
*/
typedef struct __ns_msg {
const u_char *_msg, *_eom;
uint16_t _id, _flags, _counts[ns_s_max];
const u_char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
const u_char *_msg_ptr;
} ns_msg;
/*
* This is a newmsg handle, used when constructing new messages with
* ns_newmsg_init, et al.
*/
struct ns_newmsg {
ns_msg msg;
const u_char *dnptrs[25];
const u_char **lastdnptr;
};
typedef struct ns_newmsg ns_newmsg;
/* Private data structure - do not use from outside library. */
struct _ns_flagdata { int mask, shift; };
extern const struct _ns_flagdata _ns_flagdata[];
/* Accessor macros - this is part of the public interface. */
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
#define ns_msg_size(handle) ((size_t)((handle)._eom - (handle)._msg))
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
/*
* This is a parsed record. It is caller allocated and has no dynamic data.
*/
typedef struct __ns_rr {
char name[NS_MAXDNAME];
uint16_t type;
uint16_t rr_class;
uint32_t ttl;
uint16_t rdlength;
const u_char * rdata;
} ns_rr;
/*
* Same thing, but using uncompressed network binary names, and real C types.
*/
typedef struct __ns_rr2 {
ns_nname nname;
size_t nnamel;
int type;
int rr_class;
u_int ttl;
int rdlength;
const u_char * rdata;
} ns_rr2;
/* Accessor macros - this is part of the public interface. */
#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
#define ns_rr_nname(rr) ((const ns_nname_t)(rr).nname)
#define ns_rr_nnamel(rr) ((rr).nnamel + 0)
#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0))
#define ns_rr_ttl(rr) ((u_long)(rr).ttl + 0)
#define ns_rr_rdlen(rr) ((size_t)(rr).rdlength + 0)
#define ns_rr_rdata(rr) ((rr).rdata + 0)
/*
* These don't have to be in the same order as in the packet flags word,
* and they can even overlap in some cases, but they will need to be kept
* in synch with ns_parse.c:ns_flagdata[].
*/
typedef enum __ns_flag {
ns_f_qr, /* Question/Response. */
ns_f_opcode, /* Operation code. */
ns_f_aa, /* Authoritative Answer. */
ns_f_tc, /* Truncation occurred. */
ns_f_rd, /* Recursion Desired. */
ns_f_ra, /* Recursion Available. */
ns_f_z, /* MBZ. */
ns_f_ad, /* Authentic Data (DNSSEC). */
ns_f_cd, /* Checking Disabled (DNSSEC). */
ns_f_rcode, /* Response code. */
ns_f_max
} ns_flag;
/*
* Currently defined opcodes.
*/
typedef enum __ns_opcode {
ns_o_query = 0, /* Standard query. */
ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
ns_o_status = 2, /* Name server status query (unsupported). */
/* Opcode 3 is undefined/reserved. */
ns_o_notify = 4, /* Zone change notification. */
ns_o_update = 5, /* Zone update message. */
ns_o_max = 6
} ns_opcode;
/*
* Currently defined response codes.
*/
typedef enum __ns_rcode {
ns_r_noerror = 0, /* No error occurred. */
ns_r_formerr = 1, /* Format error. */
ns_r_servfail = 2, /* Server failure. */
ns_r_nxdomain = 3, /* Name error. */
ns_r_notimpl = 4, /* Unimplemented. */
ns_r_refused = 5, /* Operation refused. */
/* these are for BIND_UPDATE */
ns_r_yxdomain = 6, /* Name exists */
ns_r_yxrrset = 7, /* RRset exists */
ns_r_nxrrset = 8, /* RRset does not exist */
ns_r_notauth = 9, /* Not authoritative for zone */
ns_r_notzone = 10, /* Zone of record different from zone section */
ns_r_max = 11,
/* The following are EDNS extended rcodes */
ns_r_badvers = 16,
/* The following are TSIG errors */
ns_r_badsig = 16,
ns_r_badkey = 17,
ns_r_badtime = 18
} ns_rcode;
/* BIND_UPDATE */
typedef enum __ns_update_operation {
ns_uop_delete = 0,
ns_uop_add = 1,
ns_uop_max = 2
} ns_update_operation;
/*
* This structure is used for TSIG authenticated messages
*/
struct ns_tsig_key {
char name[NS_MAXDNAME], alg[NS_MAXDNAME];
unsigned char *data;
int len;
};
typedef struct ns_tsig_key ns_tsig_key;
/*
* This structure is used for TSIG authenticated TCP messages
*/
struct ns_tcp_tsig_state {
int counter;
struct dst_key *key;
void *ctx;
unsigned char sig[NS_PACKETSZ];
int siglen;
};
typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
#define NS_TSIG_FUDGE 300
#define NS_TSIG_TCP_COUNT 100
#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
#define NS_TSIG_ERROR_NO_TSIG -10
#define NS_TSIG_ERROR_NO_SPACE -11
#define NS_TSIG_ERROR_FORMERR -12
/*
* Currently defined type values for resources and queries.
*/
typedef enum __ns_type {
ns_t_invalid = 0, /* Cookie. */
ns_t_a = 1, /* Host address. */
ns_t_ns = 2, /* Authoritative server. */
ns_t_md = 3, /* Mail destination. */
ns_t_mf = 4, /* Mail forwarder. */
ns_t_cname = 5, /* Canonical name. */
ns_t_soa = 6, /* Start of authority zone. */
ns_t_mb = 7, /* Mailbox domain name. */
ns_t_mg = 8, /* Mail group member. */
ns_t_mr = 9, /* Mail rename name. */
ns_t_null = 10, /* Null resource record. */
ns_t_wks = 11, /* Well known service. */
ns_t_ptr = 12, /* Domain name pointer. */
ns_t_hinfo = 13, /* Host information. */
ns_t_minfo = 14, /* Mailbox information. */
ns_t_mx = 15, /* Mail routing information. */
ns_t_txt = 16, /* Text strings. */
ns_t_rp = 17, /* Responsible person. */
ns_t_afsdb = 18, /* AFS cell database. */
ns_t_x25 = 19, /* X_25 calling address. */
ns_t_isdn = 20, /* ISDN calling address. */
ns_t_rt = 21, /* Router. */
ns_t_nsap = 22, /* NSAP address. */
ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
ns_t_sig = 24, /* Security signature. */
ns_t_key = 25, /* Security key. */
ns_t_px = 26, /* X.400 mail mapping. */
ns_t_gpos = 27, /* Geographical position (withdrawn). */
ns_t_aaaa = 28, /* IPv6 Address. */
ns_t_loc = 29, /* Location Information. */
ns_t_nxt = 30, /* Next domain (security). */
ns_t_eid = 31, /* Endpoint identifier. */
ns_t_nimloc = 32, /* Nimrod Locator. */
ns_t_srv = 33, /* Server Selection. */
ns_t_atma = 34, /* ATM Address */
ns_t_naptr = 35, /* Naming Authority PoinTeR */
ns_t_kx = 36, /* Key Exchange */
ns_t_cert = 37, /* Certification record */
ns_t_a6 = 38, /* IPv6 address (experimental) */
ns_t_dname = 39, /* Non-terminal DNAME */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
ns_t_apl = 42, /* Address prefix list (RFC 3123) */
ns_t_ds = 43, /* Delegation Signer */
ns_t_sshfp = 44, /* SSH Fingerprint */
ns_t_ipseckey = 45, /* IPSEC Key */
ns_t_rrsig = 46, /* RRset Signature */
ns_t_nsec = 47, /* Negative security */
ns_t_dnskey = 48, /* DNS Key */
ns_t_dhcid = 49, /* Dynamic host configuratin identifier */
ns_t_nsec3 = 50, /* Negative security type 3 */
ns_t_nsec3param = 51, /* Negative security type 3 parameters */
ns_t_hip = 55, /* Host Identity Protocol */
ns_t_spf = 99, /* Sender Policy Framework */
ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
ns_t_axfr = 252, /* Transfer zone of authority. */
ns_t_mailb = 253, /* Transfer mailbox records. */
ns_t_maila = 254, /* Transfer mail agent records. */
ns_t_any = 255, /* Wildcard match. */
ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
ns_t_dlv = 32769, /* DNSSEC look-aside validatation. */
ns_t_max = 65536
} ns_type;
/* Exclusively a QTYPE? (not also an RTYPE) */
#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
(t) == ns_t_mailb || (t) == ns_t_maila)
/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
(t) == ns_t_zxfr)
/*
* Values for class field
*/
typedef enum __ns_class {
ns_c_invalid = 0, /* Cookie. */
ns_c_in = 1, /* Internet. */
ns_c_2 = 2, /* unallocated/unsupported. */
ns_c_chaos = 3, /* MIT Chaos-net. */
ns_c_hs = 4, /* MIT Hesiod. */
/* Query class values which do not appear in resource records */
ns_c_none = 254, /* for prereq. sections in update requests */
ns_c_any = 255, /* Wildcard match. */
ns_c_max = 65536
} ns_class;
/* DNSSEC constants. */
typedef enum __ns_key_types {
ns_kt_rsa = 1, /* key type RSA/MD5 */
ns_kt_dh = 2, /* Diffie Hellman */
ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */
ns_kt_private = 254 /* Private key type starts with OID */
} ns_key_types;
typedef enum __ns_cert_types {
cert_t_pkix = 1, /* PKIX (X.509v3) */
cert_t_spki = 2, /* SPKI */
cert_t_pgp = 3, /* PGP */
cert_t_url = 253, /* URL private type */
cert_t_oid = 254 /* OID private type */
} ns_cert_types;
/* Flags field of the KEY RR rdata. */
#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */
#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
/* The type bits can also be interpreted independently, as single bits: */
#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */
#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */
#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */
#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */
#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */
#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */
#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */
#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */
#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */
#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */
#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */
#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */
#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */
#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */
#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
NS_KEY_RESERVED4 | \
NS_KEY_RESERVED5 | \
NS_KEY_RESERVED8 | \
NS_KEY_RESERVED9 | \
NS_KEY_RESERVED10 | \
NS_KEY_RESERVED11 )
#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
#define NS_ALG_DH 2 /* Diffie Hellman KEY */
#define NS_ALG_DSA 3 /* DSA KEY */
#define NS_ALG_DSS NS_ALG_DSA
#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
/* Protocol values */
/* value 0 is reserved */
#define NS_KEY_PROT_TLS 1
#define NS_KEY_PROT_EMAIL 2
#define NS_KEY_PROT_DNSSEC 3
#define NS_KEY_PROT_IPSEC 4
#define NS_KEY_PROT_ANY 255
/* Signatures */
#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
#define NS_MD5RSA_MAX_BITS 4096
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
/* Max length of text sig block */
#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8)
#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8)
#define NS_DSA_SIG_SIZE 41
#define NS_DSA_MIN_SIZE 213
#define NS_DSA_MAX_BYTES 405
/* Offsets into SIG record rdata to find various values */
#define NS_SIG_TYPE 0 /* Type flags */
#define NS_SIG_ALG 2 /* Algorithm */
#define NS_SIG_LABELS 3 /* How many labels in name */
#define NS_SIG_OTTL 4 /* Original TTL */
#define NS_SIG_EXPIR 8 /* Expiration time */
#define NS_SIG_SIGNED 12 /* Signature time */
#define NS_SIG_FOOT 16 /* Key footprint */
#define NS_SIG_SIGNER 18 /* Domain name of who signed it */
/* How RR types are represented as bit-flags in NXT records */
#define NS_NXT_BITS 8
#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_MAX 127
/*
* EDNS0 extended flags and option codes, host order.
*/
#define NS_OPT_DNSSEC_OK 0x8000U
#define NS_OPT_NSID 3
/*
* Inline versions of get/put short/long. Pointer is advanced.
*/
#define NS_GET16(s, cp) do { \
const u_char *t_cp = (const u_char *)(cp); \
(s) = ((uint16_t)t_cp[0] << 8) \
| ((uint16_t)t_cp[1]) \
; \
(cp) += NS_INT16SZ; \
} while (/*CONSTCOND*/0)
#define NS_GET32(l, cp) do { \
const u_char *t_cp = (const u_char *)(cp); \
(l) = ((uint32_t)t_cp[0] << 24) \
| ((uint32_t)t_cp[1] << 16) \
| ((uint32_t)t_cp[2] << 8) \
| ((uint32_t)t_cp[3]) \
; \
(cp) += NS_INT32SZ; \
} while (/*CONSTCOND*/0)
#define NS_PUT16(s, cp) do { \
uint32_t t_s = (uint32_t)(s); \
u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
(cp) += NS_INT16SZ; \
} while (/*CONSTCOND*/0)
#define NS_PUT32(l, cp) do { \
uint32_t t_l = (uint32_t)(l); \
u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp = t_l; \
(cp) += NS_INT32SZ; \
} while (/*CONSTCOND*/0)
/*
* ANSI C identifier hiding for bind's lib/nameser.
*/
#define ns_msg_getflag __ns_msg_getflag
#define ns_get16 __ns_get16
#define ns_get32 __ns_get32
#define ns_put16 __ns_put16
#define ns_put32 __ns_put32
#define ns_initparse __ns_initparse
#define ns_skiprr __ns_skiprr
#define ns_parserr __ns_parserr
#define ns_parserr2 __ns_parserr2
#define ns_sprintrr __ns_sprintrr
#define ns_sprintrrf __ns_sprintrrf
#define ns_format_ttl __ns_format_ttl
#define ns_parse_ttl __ns_parse_ttl
#define ns_datetosecs __ns_datetosecs
#define ns_name_ntol __ns_name_ntol
#define ns_name_ntop __ns_name_ntop
#define ns_name_pton __ns_name_pton
#define ns_name_pton2 __ns_name_pton2
#define ns_name_unpack __ns_name_unpack
#define ns_name_unpack2 __ns_name_unpack2
#define ns_name_pack __ns_name_pack
#define ns_name_compress __ns_name_compress
#define ns_name_uncompress __ns_name_uncompress
#define ns_name_skip __ns_name_skip
#define ns_name_rollback __ns_name_rollback
#define ns_name_length __ns_name_length
#define ns_name_eq __ns_name_eq
#define ns_name_owned __ns_name_owned
#define ns_name_map __ns_name_map
#define ns_name_labels __ns_name_labels
#define ns_sign __ns_sign
#define ns_sign2 __ns_sign2
#define ns_sign_tcp __ns_sign_tcp
#define ns_sign_tcp2 __ns_sign_tcp2
#define ns_sign_tcp_init __ns_sign_tcp_init
#define ns_find_tsig __ns_find_tsig
#define ns_verify __ns_verify
#define ns_verify_tcp __ns_verify_tcp
#define ns_verify_tcp_init __ns_verify_tcp_init
#define ns_samedomain __ns_samedomain
#define ns_subdomain __ns_subdomain
#define ns_makecanon __ns_makecanon
#define ns_samename __ns_samename
#define ns_newmsg_init __ns_newmsg_init
#define ns_newmsg_copy __ns_newmsg_copy
#define ns_newmsg_id __ns_newmsg_id
#define ns_newmsg_flag __ns_newmsg_flag
#define ns_newmsg_q __ns_newmsg_q
#define ns_newmsg_rr __ns_newmsg_rr
#define ns_newmsg_done __ns_newmsg_done
#define ns_rdata_unpack __ns_rdata_unpack
#define ns_rdata_equal __ns_rdata_equal
#define ns_rdata_refers __ns_rdata_refers
__BEGIN_DECLS
int ns_msg_getflag(ns_msg, int);
uint16_t ns_get16(const u_char *);
uint32_t ns_get32(const u_char *);
void ns_put16(uint16_t, u_char *);
void ns_put32(uint32_t, u_char *);
int ns_initparse(const u_char *, int, ns_msg *);
int ns_skiprr(const u_char *, const u_char *, ns_sect, int);
int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
int ns_parserr2(ns_msg *, ns_sect, int, ns_rr2 *);
int ns_sprintrr(const ns_msg *, const ns_rr *,
const char *, const char *, char *, size_t);
int ns_sprintrrf(const u_char *, size_t, const char *,
ns_class, ns_type, u_long, const u_char *,
size_t, const char *, const char *,
char *, size_t);
int ns_format_ttl(u_long, char *, size_t);
int ns_parse_ttl(const char *, u_long *);
uint32_t ns_datetosecs(const char *cp, int *errp);
int ns_name_ntol(const u_char *, u_char *, size_t);
int ns_name_ntop(const u_char *, char *, size_t);
int ns_name_pton(const char *, u_char *, size_t);
int ns_name_pton2(const char *, u_char *, size_t, size_t *);
int ns_name_unpack(const u_char *, const u_char *,
const u_char *, u_char *, size_t);
int ns_name_unpack2(const u_char *, const u_char *,
const u_char *, u_char *, size_t,
size_t *);
int ns_name_pack(const u_char *, u_char *, int,
const u_char **, const u_char **);
int ns_name_uncompress(const u_char *, const u_char *,
const u_char *, char *, size_t);
int ns_name_compress(const char *, u_char *, size_t,
const u_char **, const u_char **);
int ns_name_skip(const u_char **, const u_char *);
void ns_name_rollback(const u_char *, const u_char **,
const u_char **);
int ns_sign(u_char *, int *, int, int, void *,
const u_char *, int, u_char *, int *, time_t);
int ns_sign2(u_char *, int *, int, int, void *,
const u_char *, int, u_char *, int *, time_t,
u_char **, u_char **);
ssize_t ns_name_length(ns_nname_ct, size_t);
int ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t);
int ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int);
int ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
int ns_name_labels(ns_nname_ct, size_t);
int ns_sign_tcp(u_char *, int *, int, int,
ns_tcp_tsig_state *, int);
int ns_sign_tcp2(u_char *, int *, int, int,
ns_tcp_tsig_state *, int,
u_char **, u_char **);
int ns_sign_tcp_init(void *, const u_char *, int,
ns_tcp_tsig_state *);
u_char *ns_find_tsig(u_char *, u_char *);
int ns_verify(u_char *, int *, void *,
const u_char *, int, u_char *, int *,
time_t *, int);
int ns_verify_tcp(u_char *, int *, ns_tcp_tsig_state *, int);
int ns_verify_tcp_init(void *, const u_char *, int,
ns_tcp_tsig_state *);
int ns_samedomain(const char *, const char *);
int ns_subdomain(const char *, const char *);
int ns_makecanon(const char *, char *, size_t);
int ns_samename(const char *, const char *);
int ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *);
int ns_newmsg_copy(ns_newmsg *, ns_msg *);
void ns_newmsg_id(ns_newmsg *handle, uint16_t id);
void ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value);
int ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
ns_type qtype, ns_class qclass);
int ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
ns_nname_ct name, ns_type type,
ns_class rr_class, uint32_t ttl,
uint16_t rdlen, const u_char *rdata);
size_t ns_newmsg_done(ns_newmsg *handle);
ssize_t ns_rdata_unpack(const u_char *, const u_char *, ns_type,
const u_char *, size_t, u_char *, size_t);
int ns_rdata_equal(ns_type,
const u_char *, size_t,
const u_char *, size_t);
int ns_rdata_refers(ns_type,
const u_char *, size_t,
const u_char *);
__END_DECLS
#ifdef BIND_4_COMPAT
#include <arpa/nameser_compat.h>
#endif
#endif /* !_ARPA_NAMESER_H_ */

View File

@@ -0,0 +1,238 @@
/* $NetBSD: nameser_compat.h,v 1.1.1.2 2004/11/07 01:28:27 christos Exp $ */
/* Copyright (c) 1983, 1989
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* from nameser.h 8.1 (Berkeley) 6/2/93
* Id: nameser_compat.h,v 1.8 2006/05/19 02:33:40 marka Exp
*/
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
#define __BIND 19950621 /* (DEAD) interface version stamp. */
#include <endian.h>
#ifndef BYTE_ORDER
#if (BSD >= 199103)
# include <machine/endian.h>
#else
#ifdef __linux__
# include <endian.h>
#else
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
defined(__i386__) || defined(__i386) || defined(__amd64__) || \
defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \
defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
(defined(__Lynx__) && defined(__x86__))
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
defined(apollo) || defined(__convex__) || defined(_CRAY) || \
defined(__hppa) || defined(__hp9000) || \
defined(__hp9000s300) || defined(__hp9000s700) || \
defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \
defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) || \
(defined(__Lynx__) && \
(defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif /* __linux */
#endif /* BSD */
#endif /* BYTE_ORDER */
#if !defined(BYTE_ORDER) || \
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
BYTE_ORDER != PDP_ENDIAN)
/* you must determine what the correct bit order is for
* your compiler - the next line is an intentional error
* which will force your compiles to bomb until you fix
* the above macros.
*/
#error "Undefined or invalid BYTE_ORDER";
#endif
/*
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
* is all ANSI requires. This requires a somewhat confusing rearrangement.
*/
typedef struct {
unsigned id :16; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ad: 1; /* authentic data from named */
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned cd: 1; /* checking disabled by resolver */
unsigned ad: 1; /* authentic data from named */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
#define PACKETSZ NS_PACKETSZ
#define MAXDNAME NS_MAXDNAME
#define MAXCDNAME NS_MAXCDNAME
#define MAXLABEL NS_MAXLABEL
#define HFIXEDSZ NS_HFIXEDSZ
#define QFIXEDSZ NS_QFIXEDSZ
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
#define INT8SZ NS_INT8SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
#define NAMESERVER_PORT NS_DEFAULTPORT
#define S_ZONE ns_s_zn
#define S_PREREQ ns_s_pr
#define S_UPDATE ns_s_ud
#define S_ADDT ns_s_ar
#define QUERY ns_o_query
#define IQUERY ns_o_iquery
#define STATUS ns_o_status
#define NS_NOTIFY_OP ns_o_notify
#define NS_UPDATE_OP ns_o_update
#define NOERROR ns_r_noerror
#define FORMERR ns_r_formerr
#define SERVFAIL ns_r_servfail
#define NXDOMAIN ns_r_nxdomain
#define NOTIMP ns_r_notimpl
#define REFUSED ns_r_refused
#define YXDOMAIN ns_r_yxdomain
#define YXRRSET ns_r_yxrrset
#define NXRRSET ns_r_nxrrset
#define NOTAUTH ns_r_notauth
#define NOTZONE ns_r_notzone
/*#define BADSIG ns_r_badsig*/
/*#define BADKEY ns_r_badkey*/
/*#define BADTIME ns_r_badtime*/
#define DELETE ns_uop_delete
#define ADD ns_uop_add
#define T_A ns_t_a
#define T_NS ns_t_ns
#define T_MD ns_t_md
#define T_MF ns_t_mf
#define T_CNAME ns_t_cname
#define T_SOA ns_t_soa
#define T_MB ns_t_mb
#define T_MG ns_t_mg
#define T_MR ns_t_mr
#define T_NULL ns_t_null
#define T_WKS ns_t_wks
#define T_PTR ns_t_ptr
#define T_HINFO ns_t_hinfo
#define T_MINFO ns_t_minfo
#define T_MX ns_t_mx
#define T_TXT ns_t_txt
#define T_RP ns_t_rp
#define T_AFSDB ns_t_afsdb
#define T_X25 ns_t_x25
#define T_ISDN ns_t_isdn
#define T_RT ns_t_rt
#define T_NSAP ns_t_nsap
#define T_NSAP_PTR ns_t_nsap_ptr
#define T_SIG ns_t_sig
#define T_KEY ns_t_key
#define T_PX ns_t_px
#define T_GPOS ns_t_gpos
#define T_AAAA ns_t_aaaa
#define T_LOC ns_t_loc
#define T_NXT ns_t_nxt
#define T_EID ns_t_eid
#define T_NIMLOC ns_t_nimloc
#define T_SRV ns_t_srv
#define T_ATMA ns_t_atma
#define T_NAPTR ns_t_naptr
#define T_A6 ns_t_a6
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
#define T_AXFR ns_t_axfr
#define T_MAILB ns_t_mailb
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
#define C_IN ns_c_in
#define C_CHAOS ns_c_chaos
#define C_HS ns_c_hs
/* BIND_UPDATE */
#define C_NONE ns_c_none
#define C_ANY ns_c_any
#define GETSHORT NS_GET16
#define GETLONG NS_GET32
#define PUTSHORT NS_PUT16
#define PUTLONG NS_PUT32
#endif /* _ARPA_NAMESER_COMPAT_ */

View File

@@ -19,10 +19,10 @@
#ifndef _UAPI__ASM_GENERIC_SIGNAL_H
#define _UAPI__ASM_GENERIC_SIGNAL_H
#include <linux/types.h>
#define _NSIG 64
#define _KERNEL__NSIG 64
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _NSIG_BPW __BITS_PER_LONG
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
#define SIGHUP 1
#define SIGINT 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -68,7 +68,7 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#ifndef SIGRTMAX
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SA_NOCLDSTOP 0x00000001

View File

@@ -46,27 +46,33 @@ __BEGIN_DECLS
#define DT_WHT 14
#endif
struct dirent {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
#define __DIRENT64_BODY \
uint64_t d_ino; \
int64_t d_off; \
unsigned short d_reclen; \
unsigned char d_type; \
char d_name[256]; \
struct dirent { __DIRENT64_BODY };
struct dirent64 { __DIRENT64_BODY };
#define d_fileno d_ino
#define dirent64 dirent
typedef struct DIR DIR;
extern DIR* opendir(const char*);
extern DIR* fdopendir(int);
extern struct dirent* readdir(DIR*);
extern struct dirent64* readdir64(DIR*);
extern int readdir_r(DIR*, struct dirent*, struct dirent**);
extern int readdir64_r(DIR*, struct dirent64*, struct dirent64**);
extern int closedir(DIR*);
extern void rewinddir(DIR*);
extern int dirfd(DIR*);
extern int alphasort(const struct dirent**, const struct dirent**);
extern int alphasort64(const struct dirent64**, const struct dirent64**);
extern int scandir(const char*, struct dirent***, int (*)(const struct dirent*), int (*)(const struct dirent**, const struct dirent**));
extern int scandir64(const char*, struct dirent64***, int (*)(const struct dirent64*), int (*)(const struct dirent64**, const struct dirent64**));
extern int getdents(unsigned int, struct dirent*, unsigned int);
__END_DECLS

View File

@@ -28,33 +28,58 @@
#ifndef _ELF_H
#define _ELF_H
#include <stdint.h>
#include <linux/auxvec.h>
#include <linux/elf.h>
#include <linux/elf-em.h>
/* TODO: can we switch to <linux/elf.h> instead? http://b/12476126. */
#include <sys/exec_elf.h>
#include <machine/elf_machdep.h>
typedef struct {
uint32_t a_type;
__u32 a_type;
union {
uint32_t a_val;
__u32 a_val;
} a_un;
} Elf32_auxv_t;
typedef struct {
uint64_t a_type;
__u64 a_type;
union {
uint64_t a_val;
__u64 a_val;
} a_un;
} Elf64_auxv_t;
#ifdef __LP64__
# define Elf_auxv_t Elf64_auxv_t
#else
# define Elf_auxv_t Elf32_auxv_t
#endif
#define DF_ORIGIN 0x00000001
#define DF_SYMBOLIC 0x00000002
#define DF_TEXTREL 0x00000004
#define DF_BIND_NOW 0x00000008
#define DF_STATIC_TLS 0x00000010
/* <sys/exec_elf.h> doesn't contain any NT_ constants. aarch64 strace needs this one. */
#define NT_PRSTATUS 1
#define DT_BIND_NOW 24
#define DT_INIT_ARRAY 25
#define DT_FINI_ARRAY 26
#define DT_INIT_ARRAYSZ 27
#define DT_FINI_ARRAYSZ 28
#define DT_RUNPATH 29
#define DT_FLAGS 30
/* glibc and BSD disagree for DT_ENCODING; glibc looks wrong. */
#define DT_PREINIT_ARRAY 32
#define DT_PREINIT_ARRAYSZ 33
#define ELFOSABI_SYSV 0 /* Synonym for ELFOSABI_NONE used by valgrind. */
#define EM_ARM 40
#define EM_AARCH64 183
#define PT_GNU_RELRO 0x6474e552
#define STB_LOOS 10
#define STB_HIOS 12
#define STB_LOPROC 13
#define STB_HIPROC 15
#define STT_LOOS 10
#define STT_HIOS 12
#define STT_LOPROC 13
#define STT_HIPROC 15
#endif /* _ELF_H */

View File

@@ -41,12 +41,19 @@ __BEGIN_DECLS
#define O_ASYNC FASYNC
#endif
#define SYNC_FILE_RANGE_WAIT_BEFORE 1
#define SYNC_FILE_RANGE_WRITE 2
#define SYNC_FILE_RANGE_WAIT_AFTER 4
extern int creat(const char*, mode_t);
extern int creat64(const char*, mode_t);
extern int fallocate64(int, int, off64_t, off64_t);
extern int fallocate(int, int, off_t, off_t);
extern int fcntl(int, int, ...);
extern int openat(int, const char*, int, ...);
extern int openat64(int, const char*, int, ...);
extern int open(const char*, int, ...);
extern int open64(const char*, int, ...);
extern int posix_fallocate64(int, off64_t, off64_t);
extern int posix_fallocate(int, off_t, off_t);
extern int unlinkat(int, const char*, int);

View File

@@ -0,0 +1,69 @@
/* $OpenBSD: fenv.h,v 1.2 2011/05/25 21:46:49 martynas Exp $ */
/* $NetBSD: fenv.h,v 1.2.4.1 2011/02/08 16:18:55 bouyer Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FENV_H_
#define _FENV_H_
#include <sys/cdefs.h>
#include <machine/fenv.h>
__BEGIN_DECLS
int feclearexcept(int);
int fegetexceptflag(fexcept_t *, int);
int feraiseexcept(int);
int fesetexceptflag(const fexcept_t *, int);
int fetestexcept(int);
int fegetround(void);
int fesetround(int);
int fegetenv(fenv_t *);
int feholdexcept(fenv_t *);
int fesetenv(const fenv_t *);
int feupdateenv(const fenv_t *);
int feenableexcept(int);
int fedisableexcept(int);
int fegetexcept(void);
/*
* The following constant represents the default floating-point environment
* (that is, the one installed at program startup) and has type pointer to
* const-qualified fenv_t.
*
* It can be used as an argument to the functions that manage the floating-point
* environment, namely fesetenv() and feupdateenv().
*/
extern const fenv_t __fe_dfl_env;
#define FE_DFL_ENV (&__fe_dfl_env)
__END_DECLS
#endif /* ! _FENV_H_ */

View File

@@ -57,6 +57,9 @@ __BEGIN_DECLS
int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
int nftw(const char *, int (*)(const char *, const struct stat *, int,
struct FTW *), int, int);
int ftw64(const char *, int (*)(const char *, const struct stat64 *, int), int);
int nftw64(const char *, int (*)(const char *, const struct stat64 *, int,
struct FTW *), int, int);
__END_DECLS
#endif /* !_FTW_H */

View File

@@ -105,9 +105,15 @@
#define ULONG_LONG_MAX ULLONG_MAX
#endif
/* New code should use sysconf(_SC_PAGE_SIZE) instead. */
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif
#ifndef PAGESIZE
#include <asm/page.h>
#define PAGESIZE PAGE_SIZE
#endif
/* glibc's PAGE_MASK is the bitwise negation of BSD's! TODO: remove? */
#define PAGE_MASK (~(PAGE_SIZE - 1))
#endif /* !_LIMITS_H_ */

View File

@@ -33,7 +33,11 @@
__BEGIN_DECLS
#define ElfW(type) Elf_##type
#if __LP64__
#define ElfW(type) Elf64_ ## type
#else
#define ElfW(type) Elf32_ ## type
#endif
struct dl_phdr_info {
ElfW(Addr) dlpi_addr;
@@ -42,13 +46,35 @@ struct dl_phdr_info {
ElfW(Half) dlpi_phnum;
};
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*);
int dl_iterate_phdr(int (*)(struct dl_phdr_info*, size_t, void*), void*);
#ifdef __arm__
typedef long unsigned int* _Unwind_Ptr;
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount);
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr, int*);
#endif
/* Used by the dynamic linker to communicate with the debugger. */
struct link_map {
ElfW(Addr) l_addr;
char* l_name;
ElfW(Dyn)* l_ld;
struct link_map* l_next;
struct link_map* l_prev;
};
/* Used by the dynamic linker to communicate with the debugger. */
struct r_debug {
int32_t r_version;
struct link_map* r_map;
ElfW(Addr) r_brk;
enum {
RT_CONSISTENT,
RT_ADD,
RT_DELETE
} r_state;
ElfW(Addr) r_ldbase;
};
__END_DECLS
#endif /* _LINK_H_ */

View File

@@ -49,11 +49,13 @@ enum {
LC_IDENTIFICATION = 12
};
extern char *setlocale(int category, const char *locale);
extern char* setlocale(int, const char*);
/* Make libstdc++-v3 happy. */
#if !defined(__LP64__)
// TODO: LP32 had these bogus declarations but LP64 should have a real struct lconv and localeconv(3).
struct lconv { };
struct lconv *localeconv(void);
struct lconv* localeconv(void);
#endif
__END_DECLS

View File

@@ -18,7 +18,6 @@
#define _MATH_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <limits.h>
/*
@@ -124,8 +123,10 @@ extern const union __nan_un {
: (sizeof (x) == sizeof (double)) ? __signbit(x) \
: __signbitl(x))
typedef __double_t double_t;
typedef __float_t float_t;
typedef double __double_t;
typedef __double_t double_t;
typedef float __float_t;
typedef __float_t float_t;
#endif /* __ISO_C_VISIBLE >= 1999 */
/*

View File

@@ -127,11 +127,13 @@ int pthread_attr_setschedparam(pthread_attr_t*, const struct sched_param*) __non
int pthread_attr_setschedpolicy(pthread_attr_t*, int) __nonnull((1));
int pthread_attr_setscope(pthread_attr_t*, int) __nonnull((1));
int pthread_attr_setstack(pthread_attr_t*, void*, size_t) __nonnull((1));
int pthread_attr_setstacksize(pthread_attr_t * attr, size_t stack_size) __nonnull((1));
int pthread_attr_setstacksize(pthread_attr_t*, size_t stack_size) __nonnull((1));
int pthread_condattr_destroy(pthread_condattr_t*) __nonnull((1));
int pthread_condattr_getclock(const pthread_condattr_t*, clockid_t*) __nonnull((1, 2));
int pthread_condattr_getpshared(const pthread_condattr_t*, int*) __nonnull((1, 2));
int pthread_condattr_init(pthread_condattr_t*) __nonnull((1));
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t) __nonnull((1));
int pthread_condattr_setpshared(pthread_condattr_t*, int) __nonnull((1));
int pthread_cond_broadcast(pthread_cond_t*) __nonnull((1));
@@ -172,7 +174,7 @@ int pthread_mutexattr_settype(pthread_mutexattr_t*, int) __nonnull((1));
int pthread_mutex_destroy(pthread_mutex_t*) __nonnull((1));
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __nonnull((1));
int pthread_mutex_lock(pthread_mutex_t*) __nonnull((1));
int pthread_mutex_timedlock(pthread_mutex_t*, struct timespec*) __nonnull((1, 2));
int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec*) __nonnull((1, 2));
int pthread_mutex_trylock(pthread_mutex_t*) __nonnull((1));
int pthread_mutex_unlock(pthread_mutex_t*) __nonnull((1));
@@ -232,32 +234,17 @@ extern void __pthread_cleanup_pop(__pthread_cleanup_t*, int);
#if !defined(__LP64__)
/* Deprecated by POSIX. TODO: support for LP64 but add deprecated attribute instead? */
int pthread_attr_getstackaddr(const pthread_attr_t*, void**) __nonnull((1, 2)); /* deprecated */
int pthread_attr_setstackaddr(pthread_attr_t*, void*) __nonnull((1)); /* deprecated */
/* Bionic additions that are deprecated even in the 32-bit ABI. */
// Bionic additions that are deprecated even in the 32-bit ABI.
//
// TODO: Remove them once chromium_org / NFC have switched over.
int pthread_cond_timedwait_monotonic_np(pthread_cond_t*, pthread_mutex_t*, const struct timespec*);
int pthread_cond_timedwait_monotonic(pthread_cond_t*, pthread_mutex_t*, const struct timespec*);
#define HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC 1
/*
* Like pthread_cond_timedwait except 'reltime' is relative to the current time.
* TODO: not like glibc; include in LP64?
*/
int pthread_cond_timedwait_relative_np(pthread_cond_t*, pthread_mutex_t*, const struct timespec*);
#define HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE 1
int pthread_cond_timedwait_relative_np(pthread_cond_t*, pthread_mutex_t*, const struct timespec*) /* TODO: __attribute__((deprecated("use pthread_cond_timedwait instead")))*/;
#define HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE 1 /* TODO: stop defining this to push LP32 off this API sooner. */
int pthread_cond_timeout_np(pthread_cond_t*, pthread_mutex_t*, unsigned) /* TODO: __attribute__((deprecated("use pthread_cond_timedwait instead")))*/;
/* TODO: not like glibc; include in LP64? */
int pthread_cond_timeout_np(pthread_cond_t*, pthread_mutex_t*, unsigned);
/* Like pthread_mutex_lock(), but will wait up to 'msecs' milli-seconds
* before returning. Same return values as pthread_mutex_trylock though, i.e.
* returns EBUSY if the lock could not be acquired after the timeout expired.
*
* TODO: replace with pthread_mutex_timedlock_np for LP64.
*/
int pthread_mutex_lock_timeout_np(pthread_mutex_t*, unsigned);
int pthread_mutex_lock_timeout_np(pthread_mutex_t*, unsigned) __attribute__((deprecated("use pthread_mutex_timedlock instead")));
#endif /* !defined(__LP64__) */

View File

@@ -10,7 +10,6 @@
#define _SEARCH_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
typedef enum {
preorder,

View File

@@ -51,20 +51,23 @@ __BEGIN_DECLS
typedef int sig_atomic_t;
/* TODO: 64-bit: we should probably #undef the uapi NSIG and add a unit test that NSIG == _NSIG && NSIG >= 64. */
#ifndef _NSIG
# define _NSIG 64
#endif
#ifndef NSIG
# define NSIG _NSIG
/* The arm and x86 kernel header files don't define _NSIG. */
#ifndef _KERNEL__NSIG
#define _KERNEL__NSIG 64
#endif
/* Userspace's NSIG is the kernel's _NSIG + 1. */
#define _NSIG (_KERNEL__NSIG + 1)
#define NSIG _NSIG
extern const char* const sys_siglist[];
extern const char* const sys_signame[];
extern const char* const sys_signame[]; /* BSD compatibility. */
typedef __sighandler_t sig_t; /* BSD compatibility. */
typedef __sighandler_t sighandler_t; /* glibc compatibility. */
#define si_timerid si_tid /* glibc compatibility. */
#if defined(__LP64__)
struct sigaction {

View File

@@ -30,7 +30,28 @@
#define _STDINT_H
#include <stddef.h>
#include <sys/_types.h>
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#if __LP64__
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
#endif
#if __LP64__
typedef long __intptr_t;
typedef unsigned long __uintptr_t;
#else
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
#endif
typedef __int8_t int8_t;
typedef __uint8_t uint8_t;
@@ -44,40 +65,41 @@ typedef __uint32_t uint32_t;
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
typedef int8_t int_least8_t;
typedef int8_t int_fast8_t;
typedef __intptr_t intptr_t;
typedef __uintptr_t uintptr_t;
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef uint8_t uint_fast8_t;
typedef int16_t int_least16_t;
typedef int32_t int_fast16_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_fast16_t;
typedef int32_t int_least32_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_least32_t;
typedef uint32_t uint_fast32_t;
typedef int64_t int_least64_t;
typedef int64_t int_fast64_t;
typedef uint64_t uint_least64_t;
typedef int8_t int_fast8_t;
typedef uint8_t uint_fast8_t;
typedef int64_t int_fast64_t;
typedef uint64_t uint_fast64_t;
#ifdef __LP64__
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef int64_t int_fast16_t;
typedef uint64_t uint_fast16_t;
typedef int64_t int_fast32_t;
typedef uint64_t uint_fast32_t;
#else
typedef int intptr_t;
typedef unsigned int uintptr_t;
typedef int32_t int_fast16_t;
typedef uint32_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
#endif
typedef uint64_t uintmax_t;
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
typedef int64_t intmax_t;
/* Keep the kernel from trying to define these types... */
#define __BIT_TYPES_DEFINED__

View File

@@ -359,83 +359,6 @@ __END_DECLS
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif /* __BSD_VISIBLE */
/*
* Functions internal to the implementation.
*/
__BEGIN_DECLS
int __srget(FILE *);
int __swbuf(int, FILE *);
__END_DECLS
/*
* The __sfoo macros are here so that we can
* define function versions in the C library.
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__)
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
#else
/*
* This has been tuned to generate reasonable code on the vax using pcc.
*/
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
extern int __isthreaded;
#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
#if __POSIX_VISIBLE
#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
#endif
#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
#if __BSD_VISIBLE
/*
* The macro implementations of putc and putc_unlocked are not
* fully POSIX compliant; they do not set errno on failure
*/
#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
#endif /* __BSD_VISIBLE */
#ifndef lint
#if __POSIX_VISIBLE >= 199506
#define getc_unlocked(fp) __sgetc(fp)
/*
* The macro implementations of putc and putc_unlocked are not
* fully POSIX compliant; they do not set errno on failure
*/
#if __BSD_VISIBLE
#define putc_unlocked(x, fp) __sputc(x, fp)
#endif /* __BSD_VISIBLE */
#endif /* __POSIX_VISIBLE >= 199506 */
#endif /* lint */
#define getchar() getc(stdin)
#define putchar(x) putc(x, stdout)
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(c) putc_unlocked(c, stdout)
#ifdef _GNU_SOURCE
/*
* glibc defines dprintf(int, const char*, ...), which is poorly named
@@ -470,8 +393,10 @@ int vsprintf(char *dest, const char *format, __va_list ap)
}
#if defined(__clang__)
#if !defined(WITH_SYNTAX_CHECK)
#define __wrap_snprintf(dest, size, ...) __builtin___snprintf_chk(dest, size, 0, __bos(dest), __VA_ARGS__)
#define snprintf(...) __wrap_snprintf(__VA_ARGS__)
#endif
#else
__BIONIC_FORTIFY_INLINE
__printflike(3, 4)
@@ -483,8 +408,10 @@ int snprintf(char *dest, size_t size, const char *format, ...)
#endif
#if defined(__clang__)
#if !defined(WITH_SYNTAX_CHECK)
#define __wrap_sprintf(dest, ...) __builtin___sprintf_chk(dest, 0, __bos(dest), __VA_ARGS__)
#define sprintf(...) __wrap_sprintf(__VA_ARGS__)
#endif
#else
__BIONIC_FORTIFY_INLINE
__printflike(2, 3)

View File

@@ -54,28 +54,23 @@ extern int clearenv(void);
extern char* mkdtemp(char*);
extern char* mktemp(char*) __warnattr("mktemp possibly used unsafely; consider using mkstemp");
extern int mkstemp(char*);
extern int mkstemp64(char*);
extern long strtol(const char *, char **, int);
extern long long strtoll(const char *, char **, int);
extern unsigned long strtoul(const char *, char **, int);
extern unsigned long long strtoull(const char *, char **, int);
extern double strtod(const char *nptr, char **endptr);
extern int posix_memalign(void **memptr, size_t alignment, size_t size);
static __inline__ float strtof(const char *nptr, char **endptr)
{
return (float)strtod(nptr, endptr);
}
extern double atof(const char*);
extern double strtod(const char*, char**);
extern float strtof(const char*, char**);
extern long double strtold(const char*, char**);
extern int atoi(const char *) __purefunc;
extern long atol(const char *) __purefunc;
extern long long atoll(const char *) __purefunc;
static __inline__ double atof(const char *nptr)
{
return (strtod(nptr, NULL));
}
extern int atoi(const char*) __purefunc;
extern long atol(const char*) __purefunc;
extern long long atoll(const char*) __purefunc;
extern int abs(int) __pure2;
extern long labs(long) __pure2;
@@ -152,6 +147,10 @@ typedef struct {
extern lldiv_t lldiv(long long, long long);
/* BSD compatibility. */
extern const char* getprogname(void);
extern void setprogname(const char*);
#if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */
/* make STLPort happy */
extern int mblen(const char *, size_t);

View File

@@ -42,13 +42,13 @@ extern void* memcpy(void* __restrict, const void* __restrict, size_t);
extern void* memmove(void *, const void *, size_t);
extern void* memset(void *, int, size_t);
extern void* memmem(const void *, size_t, const void *, size_t) __purefunc;
extern void memswap(void *, void *, size_t);
extern char* index(const char *, int) __purefunc;
extern char* strchr(const char *, int) __purefunc;
extern char* __strchr_chk(const char *, int, size_t);
extern char* strrchr(const char *, int) __purefunc;
extern char* __strrchr_chk(const char *, int, size_t);
extern size_t strlen(const char *) __purefunc;
extern size_t __strlen_chk(const char *, size_t);
@@ -244,6 +244,7 @@ size_t strlen(const char *s) {
return __strlen_chk(s, bos);
}
#if !defined(HAS_STRCHR)
__BIONIC_FORTIFY_INLINE
char* strchr(const char *s, int c) {
size_t bos = __bos(s);
@@ -262,8 +263,7 @@ char* strchr(const char *s, int c) {
return __strchr_chk(s, c, bos);
}
extern char* __strrchr_chk(const char *, int, size_t);
#endif
__BIONIC_FORTIFY_INLINE
char* strrchr(const char *s, int c) {

View File

@@ -35,67 +35,41 @@
#error __BIONIC_SIGDEF not defined
#endif
__BIONIC_SIGDEF(HUP,1,"Hangup")
__BIONIC_SIGDEF(INT,2,"Interrupt")
__BIONIC_SIGDEF(QUIT,3,"Quit")
__BIONIC_SIGDEF(ILL,4,"Illegal instruction")
__BIONIC_SIGDEF(TRAP,5,"Trap")
__BIONIC_SIGDEF(ABRT,6,"Aborted")
#ifdef __mips__
__BIONIC_SIGDEF(EMT,7,"EMT")
#else
__BIONIC_SIGDEF(BUS,7,"Bus error")
__BIONIC_SIGDEF(SIGHUP, "Hangup")
__BIONIC_SIGDEF(SIGINT, "Interrupt")
__BIONIC_SIGDEF(SIGQUIT, "Quit")
__BIONIC_SIGDEF(SIGILL, "Illegal instruction")
__BIONIC_SIGDEF(SIGTRAP, "Trap")
__BIONIC_SIGDEF(SIGABRT, "Aborted")
#ifdef SIGEMT
__BIONIC_SIGDEF(SIGEMT, "EMT")
#endif
__BIONIC_SIGDEF(FPE,8,"Floating point exception")
__BIONIC_SIGDEF(KILL,9,"Killed")
#ifdef __mips__
__BIONIC_SIGDEF(BUS,10,"Bus error")
#else
__BIONIC_SIGDEF(USR1,10,"User signal 1")
#endif
__BIONIC_SIGDEF(SEGV,11,"Segmentation fault")
#ifdef __mips__
__BIONIC_SIGDEF(SYS,12,"Bad system call")
#else
__BIONIC_SIGDEF(USR2,12,"User signal 2")
#endif
__BIONIC_SIGDEF(PIPE,13,"Broken pipe")
__BIONIC_SIGDEF(ALRM,14,"Alarm clock")
__BIONIC_SIGDEF(TERM,15,"Terminated")
#ifdef __mips__
__BIONIC_SIGDEF(USR1,16,"User signal 1")
__BIONIC_SIGDEF(USR2,17,"User signal 2")
__BIONIC_SIGDEF(CHLD,18,"Child exited")
__BIONIC_SIGDEF(PWR,19,"Power failure")
__BIONIC_SIGDEF(WINCH,20,"Window size changed")
__BIONIC_SIGDEF(URG,21,"Urgent I/O condition")
__BIONIC_SIGDEF(IO,22,"I/O possible")
__BIONIC_SIGDEF(STOP,23,"Stopped (signal)")
__BIONIC_SIGDEF(TSTP,24,"Stopped")
__BIONIC_SIGDEF(CONT,25,"Continue")
__BIONIC_SIGDEF(TTIN,26,"Stopped (tty input)")
__BIONIC_SIGDEF(TTOU,27,"Stopped (tty output)")
__BIONIC_SIGDEF(VTALRM,28,"Virtual timer expired")
__BIONIC_SIGDEF(PROF,29,"Profiling timer expired")
__BIONIC_SIGDEF(XCPU,30,"CPU time limit exceeded")
__BIONIC_SIGDEF(XFSZ,31,"File size limit exceeded")
#else
__BIONIC_SIGDEF(STKFLT,16,"Stack fault")
__BIONIC_SIGDEF(CHLD,17,"Child exited")
__BIONIC_SIGDEF(CONT,18,"Continue")
__BIONIC_SIGDEF(STOP,19,"Stopped (signal)")
__BIONIC_SIGDEF(TSTP,20,"Stopped")
__BIONIC_SIGDEF(TTIN,21,"Stopped (tty input)")
__BIONIC_SIGDEF(TTOU,22,"Stopped (tty output)")
__BIONIC_SIGDEF(URG,23,"Urgent I/O condition")
__BIONIC_SIGDEF(XCPU,24,"CPU time limit exceeded")
__BIONIC_SIGDEF(XFSZ,25,"File size limit exceeded")
__BIONIC_SIGDEF(VTALRM,26,"Virtual timer expired")
__BIONIC_SIGDEF(PROF,27,"Profiling timer expired")
__BIONIC_SIGDEF(WINCH,28,"Window size changed")
__BIONIC_SIGDEF(IO,29,"I/O possible")
__BIONIC_SIGDEF(PWR,30,"Power failure")
__BIONIC_SIGDEF(SYS,31,"Bad system call")
__BIONIC_SIGDEF(SIGFPE, "Floating point exception")
__BIONIC_SIGDEF(SIGKILL, "Killed")
__BIONIC_SIGDEF(SIGBUS, "Bus error")
__BIONIC_SIGDEF(SIGSEGV, "Segmentation fault")
__BIONIC_SIGDEF(SIGPIPE, "Broken pipe")
__BIONIC_SIGDEF(SIGALRM, "Alarm clock")
__BIONIC_SIGDEF(SIGTERM, "Terminated")
__BIONIC_SIGDEF(SIGUSR1, "User signal 1")
__BIONIC_SIGDEF(SIGUSR2, "User signal 2")
__BIONIC_SIGDEF(SIGCHLD, "Child exited")
__BIONIC_SIGDEF(SIGPWR, "Power failure")
__BIONIC_SIGDEF(SIGWINCH, "Window size changed")
__BIONIC_SIGDEF(SIGURG, "Urgent I/O condition")
__BIONIC_SIGDEF(SIGIO, "I/O possible")
__BIONIC_SIGDEF(SIGSTOP, "Stopped (signal)")
__BIONIC_SIGDEF(SIGTSTP, "Stopped")
__BIONIC_SIGDEF(SIGCONT, "Continue")
__BIONIC_SIGDEF(SIGTTIN, "Stopped (tty input)")
__BIONIC_SIGDEF(SIGTTOU, "Stopped (tty output)")
__BIONIC_SIGDEF(SIGVTALRM, "Virtual timer expired")
__BIONIC_SIGDEF(SIGPROF, "Profiling timer expired")
__BIONIC_SIGDEF(SIGXCPU, "CPU time limit exceeded")
__BIONIC_SIGDEF(SIGXFSZ, "File size limit exceeded")
#if defined(SIGSTKFLT)
__BIONIC_SIGDEF(SIGSTKFLT, "Stack fault")
#endif
__BIONIC_SIGDEF(SIGSYS, "Bad system call")
#undef __BIONIC_SIGDEF

View File

@@ -139,6 +139,14 @@ int __system_property_foreach_compat(
void (*propfn)(const prop_info *pi, void *cookie),
void *cookie);
/* Initialize the system properties area in read only mode.
* Should be done by all processes that need to read system
* properties.
*
* Returns 0 on success, -1 otherwise.
*/
int __system_properties_init();
__END_DECLS
#endif

View File

@@ -1,107 +0,0 @@
/* $OpenBSD: _types.h,v 1.1 2006/01/06 18:53:05 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#if __LP64__
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
#endif
#if __LP64__
typedef long __intptr_t;
typedef unsigned long __uintptr_t;
#else
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
#endif
#if __LP64__
typedef long __time_t;
#else
typedef int __time_t; /* Historical accident. */
#endif
typedef int __timer_t;
typedef int __clockid_t;
#ifndef __cplusplus
typedef int __wchar_t;
#endif
typedef double __double_t;
typedef float __float_t;
typedef __builtin_va_list __va_list;
typedef unsigned long __cpuid_t; /* CPU id */
typedef __uint32_t __fixpt_t; /* fixed point number */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __id_t; /* may contain pid, uid or gid */
typedef __uint32_t __in_addr_t; /* base type for internet address */
typedef __uint16_t __in_port_t; /* IP port type */
typedef __uint32_t __ino_t; /* inode number */
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __uint32_t __mode_t; /* permissions */
typedef __uint32_t __nlink_t; /* link count */
typedef __int32_t __pid_t; /* process id */
typedef __uint64_t __rlim_t; /* resource limit */
typedef __uint16_t __sa_family_t; /* sockaddr address family type */
typedef __int32_t __segsz_t; /* segment size */
typedef __uint32_t __socklen_t; /* length type for network syscalls */
typedef __int32_t __swblk_t; /* swap offset */
typedef __uint32_t __uid_t; /* user id */
typedef __uint32_t __useconds_t; /* microseconds */
typedef __int32_t __suseconds_t; /* microseconds (signed) */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
__int64_t __mbstateL; /* for alignment */
} __mbstate_t;
#endif /* !_SYS__TYPES_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_KLOG_H_
#define _SYS_KLOG_H_
@@ -45,13 +46,6 @@ __BEGIN_DECLS
#define KLOG_SIZE_UNREAD 9
#define KLOG_SIZE_BUFFER 10
/* These are deprecated names that were used in earlier bionic releases. Do not use. */
#define KLOG_DISABLE 6
#define KLOG_ENABLE 7
#define KLOG_SETLEVEL 8
#define KLOG_UNREADSIZE 9
#define KLOG_WRITE 10
extern int klogctl(int, char *, int);
__END_DECLS

View File

@@ -31,7 +31,6 @@
#include <sys/cdefs.h>
#include <sys/types.h>
#include <asm/mman.h>
#include <asm/page.h>
__BEGIN_DECLS
@@ -44,23 +43,23 @@ __BEGIN_DECLS
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
extern void* mmap(void *, size_t, int, int, int, off_t);
extern void* mmap64(void *, size_t, int, int, int, off64_t);
extern int munmap(void *, size_t);
extern int msync(const void *, size_t, int);
extern int mprotect(const void *, size_t, int);
extern void* mremap(void *, size_t, size_t, unsigned long);
extern void* mmap(void*, size_t, int, int, int, off_t);
extern void* mmap64(void*, size_t, int, int, int, off64_t);
extern int munmap(void*, size_t);
extern int msync(const void*, size_t, int);
extern int mprotect(const void*, size_t, int);
extern void* mremap(void*, size_t, size_t, unsigned long);
extern int mlockall(int);
extern int munlockall(void);
extern int mlock(const void *, size_t);
extern int munlock(const void *, size_t);
extern int madvise(const void *, size_t, int);
extern int mlockall(int);
extern int munlockall(void);
extern int mlock(const void*, size_t);
extern int munlock(const void*, size_t);
extern int madvise(const void*, size_t, int);
extern int mlock(const void *addr, size_t len);
extern int munlock(const void *addr, size_t len);
extern int mlock(const void*, size_t);
extern int munlock(const void*, size_t);
extern int mincore(void* start, size_t length, unsigned char* vec);
extern int mincore(void*, size_t, unsigned char*);
__END_DECLS

View File

@@ -43,8 +43,9 @@
__BEGIN_DECLS
#define sockaddr_storage __kernel_sockaddr_storage
typedef __sa_family_t sa_family_t;
typedef int socklen_t;
typedef unsigned short sa_family_t;
struct timespec;
#ifdef __mips__
#define SOCK_DGRAM 1
@@ -76,40 +77,45 @@ enum {
};
struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
sa_family_t sa_family;
char sa_data[14];
};
struct linger {
int l_onoff;
int l_linger;
int l_onoff;
int l_linger;
};
struct msghdr {
void * msg_name;
int msg_namelen;
struct iovec * msg_iov;
__kernel_size_t msg_iovlen;
void * msg_control;
__kernel_size_t msg_controllen;
unsigned msg_flags;
void* msg_name;
socklen_t msg_namelen;
struct iovec* msg_iov;
size_t msg_iovlen;
void* msg_control;
size_t msg_controllen;
int msg_flags;
};
struct mmsghdr {
struct msghdr msg_hdr;
unsigned int msg_len;
};
struct cmsghdr {
__kernel_size_t cmsg_len;
int cmsg_level;
int cmsg_type;
size_t cmsg_len;
int cmsg_level;
int cmsg_type;
};
#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
#define CMSG_DATA(cmsg) ((void*)((char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? (struct cmsghdr *)(ctl) : (struct cmsghdr *)NULL)
#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? (struct cmsghdr*)(ctl) : (struct cmsghdr*)NULL)
#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && (cmsg)->cmsg_len <= (unsigned long) ((mhdr)->msg_controllen - ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && (cmsg)->cmsg_len <= (unsigned long) ((mhdr)->msg_controllen - ((char*)(cmsg) - (char*)(mhdr)->msg_control)))
#ifdef __GNUC__
#define __KINLINE static __inline__
@@ -119,16 +125,17 @@ struct cmsghdr {
#define __KINLINE static
#endif
__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, struct cmsghdr *__cmsg) {
struct cmsghdr * __ptr;
__ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
return (struct cmsghdr *)0;
return __ptr;
__KINLINE struct cmsghdr* __cmsg_nxthdr(void* __ctl, size_t __size, struct cmsghdr* __cmsg) {
struct cmsghdr* __ptr;
__ptr = (struct cmsghdr*)(((unsigned char*) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
if ((unsigned long)((char*)(__ptr+1) - (char*) __ctl) > __size) {
return NULL;
}
return __ptr;
}
__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) {
return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
__KINLINE struct cmsghdr* cmsg_nxthdr (struct msghdr* __msg, struct cmsghdr* __cmsg) {
return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
}
#define SCM_RIGHTS 0x01
@@ -136,9 +143,9 @@ __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__
#define SCM_SECURITY 0x03
struct ucred {
__u32 pid;
__u32 uid;
__u32 gid;
pid_t pid;
uid_t uid;
gid_t gid;
};
#define AF_UNSPEC 0
@@ -242,6 +249,9 @@ struct ucred {
#define MSG_ERRQUEUE 0x2000
#define MSG_NOSIGNAL 0x4000
#define MSG_MORE 0x8000
#define MSG_WAITFORONE 0x10000
#define MSG_FASTOPEN 0x20000000
#define MSG_CMSG_CLOEXEC 0x40000000
#define MSG_EOF MSG_FIN
#define MSG_CMSG_COMPAT 0
@@ -277,43 +287,45 @@ struct ucred {
# define __socketcall extern
#endif
__socketcall int socket(int, int, int);
__socketcall int bind(int, const struct sockaddr *, int);
__socketcall int connect(int, const struct sockaddr *, socklen_t);
__socketcall int accept(int, struct sockaddr*, socklen_t*);
__socketcall int bind(int, const struct sockaddr*, int);
__socketcall int connect(int, const struct sockaddr*, socklen_t);
__socketcall int getpeername(int, struct sockaddr*, socklen_t*);
__socketcall int getsockname(int, struct sockaddr*, socklen_t*);
__socketcall int getsockopt(int, int, int, void*, socklen_t*);
__socketcall int listen(int, int);
__socketcall int accept(int, struct sockaddr *, socklen_t *);
__socketcall int getsockname(int, struct sockaddr *, socklen_t *);
__socketcall int getpeername(int, struct sockaddr *, socklen_t *);
__socketcall int socketpair(int, int, int, int *);
__socketcall int recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*);
__socketcall int recvmsg(int, struct msghdr*, int);
__socketcall int sendmmsg(int, const struct mmsghdr*, unsigned int, int);
__socketcall int sendmsg(int, const struct msghdr*, int);
__socketcall int setsockopt(int, int, int, const void*, socklen_t);
__socketcall int shutdown(int, int);
__socketcall int setsockopt(int, int, int, const void *, socklen_t);
__socketcall int getsockopt(int, int, int, void *, socklen_t *);
__socketcall int sendmsg(int, const struct msghdr *, unsigned int);
__socketcall int recvmsg(int, struct msghdr *, unsigned int);
__socketcall int socket(int, int, int);
__socketcall int socketpair(int, int, int, int*);
extern ssize_t send(int, const void *, size_t, unsigned int);
extern ssize_t recv(int, void *, size_t, unsigned int);
extern ssize_t send(int, const void*, size_t, int);
extern ssize_t recv(int, void*, size_t, int);
__socketcall ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
__socketcall ssize_t recvfrom(int, void *, size_t, unsigned int, const struct sockaddr *, socklen_t *);
__socketcall ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
__socketcall ssize_t recvfrom(int, void*, size_t, int, const struct sockaddr*, socklen_t*);
#if defined(__BIONIC_FORTIFY)
__errordecl(__recvfrom_error, "recvfrom called with size bigger than buffer");
extern ssize_t __recvfrom_chk(int, void*, size_t, size_t, unsigned int, const struct sockaddr*, socklen_t *);
extern ssize_t __recvfrom_real(int, void *, size_t, unsigned int, const struct sockaddr*, socklen_t*)
extern ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, const struct sockaddr*, socklen_t*);
extern ssize_t __recvfrom_real(int, void*, size_t, int, const struct sockaddr*, socklen_t*)
__asm__(__USER_LABEL_PREFIX__ "recvfrom");
__BIONIC_FORTIFY_INLINE
ssize_t recvfrom(int fd, void* buf, size_t len, unsigned int flags, const struct sockaddr* src_addr, socklen_t* addrlen) {
ssize_t recvfrom(int fd, void* buf, size_t len, int flags, const struct sockaddr* src_addr, socklen_t* addr_len) {
size_t bos = __bos0(buf);
#if !defined(__clang__)
if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
return __recvfrom_real(fd, buf, len, flags, src_addr, addrlen);
return __recvfrom_real(fd, buf, len, flags, src_addr, addr_len);
}
if (__builtin_constant_p(len) && (len <= bos)) {
return __recvfrom_real(fd, buf, len, flags, src_addr, addrlen);
return __recvfrom_real(fd, buf, len, flags, src_addr, addr_len);
}
if (__builtin_constant_p(len) && (len > bos)) {
@@ -321,12 +333,12 @@ ssize_t recvfrom(int fd, void* buf, size_t len, unsigned int flags, const struct
}
#endif
return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addrlen);
return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len);
}
__BIONIC_FORTIFY_INLINE
ssize_t recv(int socket, void *buf, size_t buflen, unsigned int flags) {
return recvfrom(socket, buf, buflen, flags, NULL, 0);
ssize_t recv(int socket, void* buf, size_t len, int flags) {
return recvfrom(socket, buf, len, flags, NULL, 0);
}
#endif /* __BIONIC_FORTIFY */

View File

@@ -38,101 +38,101 @@
__BEGIN_DECLS
#if defined(__aarch64__)
struct stat {
unsigned long st_dev;
unsigned long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long st_rdev;
unsigned long __pad1;
long st_size;
int st_blksize;
int __pad2;
long st_blocks;
long st_atime;
unsigned long st_atime_nsec;
long st_mtime;
unsigned long st_mtime_nsec;
long st_ctime;
unsigned long st_ctime_nsec;
unsigned int __unused4;
unsigned int __unused5;
};
#define __STAT64_BODY \
unsigned long st_dev; \
unsigned long st_ino; \
unsigned int st_mode; \
unsigned int st_nlink; \
uid_t st_uid; \
gid_t st_gid; \
unsigned long st_rdev; \
unsigned long __pad1; \
long st_size; \
int st_blksize; \
int __pad2; \
long st_blocks; \
long st_atime; \
unsigned long st_atime_nsec; \
long st_mtime; \
unsigned long st_mtime_nsec; \
long st_ctime; \
unsigned long st_ctime_nsec; \
unsigned int __unused4; \
unsigned int __unused5; \
#elif defined(__mips__)
struct stat {
unsigned int st_dev;
unsigned int __pad0[3];
unsigned long long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_rdev;
unsigned int __pad1[3];
long long st_size;
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int st_blksize;
unsigned int __pad2;
unsigned long long st_blocks;
};
#define __STAT64_BODY \
unsigned int st_dev; \
unsigned int __pad0[3]; \
unsigned long long st_ino; \
unsigned int st_mode; \
unsigned int st_nlink; \
uid_t st_uid; \
gid_t st_gid; \
unsigned int st_rdev; \
unsigned int __pad1[3]; \
long long st_size; \
unsigned int st_atime; \
unsigned int st_atime_nsec; \
unsigned int st_mtime; \
unsigned int st_mtime_nsec; \
unsigned int st_ctime; \
unsigned int st_ctime_nsec; \
unsigned int st_blksize; \
unsigned int __pad2; \
unsigned long long st_blocks; \
#elif defined(__x86_64__)
struct stat {
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_nlink;
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int __pad0;
unsigned long st_rdev;
long st_size;
long st_blksize;
long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
long __pad3[3];
};
#define __STAT64_BODY \
unsigned long st_dev; \
unsigned long st_ino; \
unsigned long st_nlink; \
unsigned int st_mode; \
uid_t st_uid; \
gid_t st_gid; \
unsigned int __pad0; \
unsigned long st_rdev; \
long st_size; \
long st_blksize; \
long st_blocks; \
unsigned long st_atime; \
unsigned long st_atime_nsec; \
unsigned long st_mtime; \
unsigned long st_mtime_nsec; \
unsigned long st_ctime; \
unsigned long st_ctime_nsec; \
long __pad3[3]; \
#else
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
#define __STAT64_BODY \
unsigned long long st_dev; \
unsigned char __pad0[4]; \
unsigned long __st_ino; \
unsigned int st_mode; \
unsigned int st_nlink; \
uid_t st_uid; \
gid_t st_gid; \
unsigned long long st_rdev; \
unsigned char __pad3[4]; \
long long st_size; \
unsigned long st_blksize; \
unsigned long long st_blocks; \
unsigned long st_atime; \
unsigned long st_atime_nsec; \
unsigned long st_mtime; \
unsigned long st_mtime_nsec; \
unsigned long st_ctime; \
unsigned long st_ctime_nsec; \
unsigned long long st_ino; \
#endif
/* For compatibility with GLibc, we provide macro aliases
* for the non-Posix nano-seconds accessors.
*/
#define st_atimensec st_atime_nsec
#define st_mtimensec st_mtime_nsec
#define st_ctimensec st_ctime_nsec
struct stat { __STAT64_BODY };
struct stat64 { __STAT64_BODY };
#define st_atimensec st_atime_nsec
#define st_mtimensec st_mtime_nsec
#define st_ctimensec st_ctime_nsec
#ifdef __USE_BSD
/* Permission macros provided by glibc for compatibility with BSDs. */
@@ -141,21 +141,26 @@ struct stat {
#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */
#endif
extern int chmod(const char *, mode_t);
extern int fchmod(int, mode_t);
extern int mkdir(const char *, mode_t);
extern int chmod(const char*, mode_t);
extern int fchmod(int, mode_t);
extern int mkdir(const char*, mode_t);
extern int stat(const char *, struct stat *);
extern int fstat(int, struct stat *);
extern int lstat(const char *, struct stat *);
extern int mknod(const char *, mode_t, dev_t);
extern int fstat(int, struct stat*);
extern int fstat64(int, struct stat64*);
extern int fstatat(int, const char*, struct stat*, int);
extern int fstatat64(int, const char*, struct stat64*, int);
extern int lstat(const char*, struct stat*);
extern int lstat64(const char*, struct stat64*);
extern int stat(const char*, struct stat*);
extern int stat64(const char*, struct stat64*);
extern int mknod(const char*, mode_t, dev_t);
extern mode_t umask(mode_t);
#if defined(__BIONIC_FORTIFY)
extern mode_t __umask_chk(mode_t);
extern mode_t __umask_real(mode_t)
__asm__(__USER_LABEL_PREFIX__ "umask");
extern mode_t __umask_real(mode_t) __asm__(__USER_LABEL_PREFIX__ "umask");
__errordecl(__umask_invalid_mode, "umask called with invalid mode");
__BIONIC_FORTIFY_INLINE
@@ -172,20 +177,14 @@ mode_t umask(mode_t mode) {
}
#endif /* defined(__BIONIC_FORTIFY) */
#define stat64 stat
#define fstat64 fstat
#define lstat64 lstat
extern int mkfifo(const char*, mode_t);
extern int fchmodat(int, const char*, mode_t, int);
extern int fstatat(int, const char*, struct stat*, int);
extern int mkdirat(int, const char*, mode_t);
extern int mknodat(int, const char*, mode_t, dev_t);
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#define UTIME_NOW ((1L << 30) - 1L)
#define UTIME_OMIT ((1L << 30) - 2L)
extern int utimensat(int fd, const char *path, const struct timespec times[2], int flags);
extern int futimens(int fd, const struct timespec times[2]);

View File

@@ -23,19 +23,21 @@
__BEGIN_DECLS
struct statvfs {
unsigned long f_bsize;
unsigned long f_frsize;
fsblkcnt_t f_blocks;
fsblkcnt_t f_bfree;
fsblkcnt_t f_bavail;
fsfilcnt_t f_files;
fsfilcnt_t f_ffree;
fsfilcnt_t f_favail;
unsigned long f_fsid;
unsigned long f_flag;
unsigned long f_namemax;
};
#define __STATVFS64_BODY \
unsigned long f_bsize; \
unsigned long f_frsize; \
fsblkcnt_t f_blocks; \
fsblkcnt_t f_bfree; \
fsblkcnt_t f_bavail; \
fsfilcnt_t f_files; \
fsfilcnt_t f_ffree; \
fsfilcnt_t f_favail; \
unsigned long f_fsid; \
unsigned long f_flag; \
unsigned long f_namemax; \
struct statvfs { __STATVFS64_BODY };
struct statvfs64 { __STATVFS64_BODY };
#define ST_RDONLY 0x0001
#define ST_NOSUID 0x0002
@@ -48,7 +50,9 @@ struct statvfs {
#define ST_RELATIME 0x1000
extern int statvfs(const char* __restrict, struct statvfs* __restrict) __nonnull((1, 2));
extern int statvfs64(const char* __restrict, struct statvfs64* __restrict) __nonnull((1, 2));
extern int fstatvfs(int, struct statvfs*) __nonnull((2));
extern int fstatvfs64(int, struct statvfs64*) __nonnull((2));
__END_DECLS

View File

@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_TIMES_H_
#define _SYS_TIMES_H_
@@ -34,7 +35,7 @@
__BEGIN_DECLS
extern clock_t times(struct tms *);
extern clock_t times(struct tms*);
__END_DECLS

View File

@@ -35,28 +35,48 @@
#include <linux/types.h>
#include <linux/posix_types.h>
/* __kernel_gid_t and __kernel_uid_t are 16 bit for legacy reasons.
* Android uses __kernel_uid32_t and __kernel_gid32_t instead.
*/
typedef __kernel_gid32_t gid_t;
typedef __kernel_uid32_t uid_t;
/* gids, uids, and pids are all 32-bit. */
typedef __kernel_gid32_t __gid_t;
typedef __gid_t gid_t;
typedef __kernel_uid32_t __uid_t;
typedef __uid_t uid_t;
typedef __kernel_pid_t __pid_t;
typedef __pid_t pid_t;
typedef uint32_t __id_t;
typedef __id_t id_t;
typedef unsigned long blkcnt_t;
typedef unsigned long blksize_t;
typedef __kernel_caddr_t caddr_t;
typedef __kernel_clock_t clock_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_clockid_t __clockid_t;
typedef __clockid_t clockid_t;
typedef __kernel_daddr_t daddr_t;
typedef unsigned long fsblkcnt_t;
typedef unsigned long fsfilcnt_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_key_t key_t;
typedef __kernel_mode_t mode_t;
typedef __kernel_mode_t __mode_t;
typedef __mode_t mode_t;
typedef __kernel_key_t __key_t;
typedef __key_t key_t;
typedef uint32_t __ino_t;
typedef __ino_t ino_t;
typedef uint32_t __nlink_t;
typedef __nlink_t nlink_t;
typedef __kernel_pid_t pid_t;
typedef __kernel_suseconds_t suseconds_t;
typedef __kernel_timer_t timer_t;
typedef unsigned int useconds_t;
typedef void* __timer_t;
typedef __timer_t timer_t;
typedef int32_t __suseconds_t;
typedef __suseconds_t suseconds_t;
typedef uint32_t __useconds_t;
typedef __useconds_t useconds_t;
#if !defined(__LP64__)
/* This historical accident means that we had a 32-bit dev_t on 32-bit architectures. */
@@ -66,7 +86,8 @@ typedef uint64_t dev_t;
#endif
/* This historical accident means that we had a 32-bit time_t on 32-bit architectures. */
typedef __kernel_time_t time_t;
typedef __kernel_time_t __time_t;
typedef __time_t time_t;
/* This historical accident means that we had a 32-bit off_t on 32-bit architectures. */
#ifndef _OFF_T_DEFINED_
@@ -76,9 +97,6 @@ typedef __kernel_off_t off_t;
typedef __kernel_loff_t loff_t;
typedef loff_t off64_t;
/* This one really is meant to be just 32 bits! */
typedef uint32_t id_t;
/* while POSIX wants these in <sys/types.h>, we
* declare then in <pthread.h> instead */
#if 0
@@ -93,6 +111,17 @@ typedef .... pthread_rwlock_attr_t;
typedef .... pthread_t;
#endif
#if !defined(__LP64__)
/* This historical accident means that we had a signed socklen_t on 32-bit architectures. */
typedef int32_t __socklen_t;
#else
/* LP64 still has a 32-bit socklen_t. */
typedef uint32_t __socklen_t;
#endif
typedef __socklen_t socklen_t;
typedef __builtin_va_list __va_list;
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
/* Traditionally, bionic's ssize_t was "long int". This caused GCC to emit warnings when you

View File

@@ -28,8 +28,7 @@
#ifndef _SYS_UN_H_
#define _SYS_UN_H_
#include <sys/_types.h>
typedef __sa_family_t sa_family_t;
typedef unsigned short sa_family_t;
#include <linux/un.h>

View File

@@ -30,6 +30,7 @@
#define _SYS_USER_H_
#include <sys/cdefs.h>
#include <limits.h> /* For PAGE_SIZE. */
__BEGIN_DECLS

View File

@@ -38,76 +38,74 @@ __BEGIN_DECLS
typedef struct { int __val[2]; } __fsid_t;
typedef __fsid_t fsid_t;
#if defined(__LP64__)
#if defined(__mips__)
/* 64-bit MIPS */
struct statfs {
uint64_t f_type;
uint64_t f_bsize;
uint64_t f_frsize; /* Fragment size - unsupported */
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_bavail;
fsid_t f_fsid;
uint64_t f_namelen;
uint64_t f_flags;
uint64_t f_spare[5];
};
#else
struct statfs {
uint64_t f_type;
uint64_t f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
fsid_t f_fsid;
uint64_t f_namelen;
uint64_t f_frsize;
uint64_t f_flags;
uint64_t f_spare[4];
};
#endif
#if defined(__aarch64__) || defined(__x86_64__)
#define __STATFS64_BODY \
uint64_t f_type; \
uint64_t f_bsize; \
uint64_t f_blocks; \
uint64_t f_bfree; \
uint64_t f_bavail; \
uint64_t f_files; \
uint64_t f_ffree; \
fsid_t f_fsid; \
uint64_t f_namelen; \
uint64_t f_frsize; \
uint64_t f_flags; \
uint64_t f_spare[4]; \
#elif defined(__mips__) && defined(__LP64__)
/* 64-bit MIPS. */
#define __STATFS64_BODY \
uint64_t f_type; \
uint64_t f_bsize; \
uint64_t f_frsize; /* Fragment size - unsupported. */ \
uint64_t f_blocks; \
uint64_t f_bfree; \
uint64_t f_files; \
uint64_t f_ffree; \
uint64_t f_bavail; \
fsid_t f_fsid; \
uint64_t f_namelen; \
uint64_t f_flags; \
uint64_t f_spare[5]; \
#elif defined(__mips__)
/* 32-bit MIPS (corresponds to the kernel's statfs64 type). */
struct statfs {
uint32_t f_type;
uint32_t f_bsize;
uint32_t f_frsize;
uint32_t __pad;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_bavail;
fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_flags;
uint32_t f_spare[5];
};
#define __STATFS64_BODY \
uint32_t f_type; \
uint32_t f_bsize; \
uint32_t f_frsize; \
uint32_t __pad; \
uint64_t f_blocks; \
uint64_t f_bfree; \
uint64_t f_files; \
uint64_t f_ffree; \
uint64_t f_bavail; \
fsid_t f_fsid; \
uint32_t f_namelen; \
uint32_t f_flags; \
uint32_t f_spare[5]; \
#else
/* 32-bit ARM or x86 (corresponds to the kernel's statfs64 type). */
struct statfs {
uint32_t f_type;
uint32_t f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_frsize;
uint32_t f_flags;
uint32_t f_spare[4];
};
#define __STATFS64_BODY \
uint32_t f_type; \
uint32_t f_bsize; \
uint64_t f_blocks; \
uint64_t f_bfree; \
uint64_t f_bavail; \
uint64_t f_files; \
uint64_t f_ffree; \
fsid_t f_fsid; \
uint32_t f_namelen; \
uint32_t f_frsize; \
uint32_t f_flags; \
uint32_t f_spare[4]; \
#endif
/* Source compatibility with glibc. */
#define statfs64 statfs
struct statfs { __STATFS64_BODY };
struct statfs64 { __STATFS64_BODY };
/* Declare that we have the f_namelen, f_frsize, and f_flags fields. */
#define _STATFS_F_NAMELEN
@@ -160,7 +158,9 @@ struct statfs {
#define _XIAFS_SUPER_MAGIC 0x012FD16D
extern int statfs(const char*, struct statfs*) __nonnull((1, 2));
extern int statfs64(const char*, struct statfs64*) __nonnull((1, 2));
extern int fstatfs(int, struct statfs*) __nonnull((2));
extern int fstatfs64(int, struct statfs64*) __nonnull((2));
__END_DECLS

View File

@@ -31,87 +31,23 @@
#include <sys/cdefs.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <stdint.h>
#include <linux/termios.h>
__BEGIN_DECLS
/* Redefine these to match their ioctl number */
#undef TCSANOW
#define TCSANOW TCSETS
#undef TCSADRAIN
#define TCSADRAIN TCSETSW
#undef TCSAFLUSH
#define TCSAFLUSH TCSETSF
static __inline__ int tcgetattr(int fd, struct termios *s)
{
return ioctl(fd, TCGETS, s);
}
static __inline__ int tcsetattr(int fd, int __opt, const struct termios *s)
{
return ioctl(fd, __opt, (void *)s);
}
static __inline__ int tcflow(int fd, int action)
{
return ioctl(fd, TCXONC, (void *)(intptr_t)action);
}
static __inline__ int tcflush(int fd, int __queue)
{
return ioctl(fd, TCFLSH, (void *)(intptr_t)__queue);
}
static __inline__ int tcdrain(int fd)
{
return ioctl(fd, TCSBRK, (void *)(intptr_t)1);
}
static __inline__ pid_t tcgetsid(int fd)
{
pid_t _pid;
return ioctl(fd, TIOCGSID, &_pid) ? (pid_t)-1 : _pid;
}
static __inline__ int tcsendbreak(int fd, int __duration)
{
return ioctl(fd, TCSBRKP, (void *)(uintptr_t)__duration);
}
static __inline__ speed_t cfgetospeed(const struct termios *s)
{
return (speed_t)(s->c_cflag & CBAUD);
}
static __inline__ int cfsetospeed(struct termios *s, speed_t speed)
{
s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD);
return 0;
}
static __inline__ speed_t cfgetispeed(const struct termios *s)
{
return (speed_t)(s->c_cflag & CBAUD);
}
static __inline__ int cfsetispeed(struct termios *s, speed_t speed)
{
s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD);
return 0;
}
static __inline__ void cfmakeraw(struct termios *s)
{
s->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
s->c_oflag &= ~OPOST;
s->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
s->c_cflag &= ~(CSIZE|PARENB);
s->c_cflag |= CS8;
}
speed_t cfgetispeed(const struct termios*);
speed_t cfgetospeed(const struct termios*);
void cfmakeraw(struct termios*);
int cfsetispeed(struct termios*, speed_t);
int cfsetospeed(struct termios*, speed_t);
int cfsetspeed(struct termios*, speed_t);
int tcdrain(int);
int tcflow(int, int);
int tcflush(int, int);
int tcgetattr(int, struct termios*);
pid_t tcgetsid(int);
int tcsendbreak(int, int);
int tcsetattr(int, int, const struct termios*);
__END_DECLS

View File

@@ -64,6 +64,7 @@ extern pid_t setsid(void);
extern int execv(const char *, char * const *);
extern int execvp(const char *, char * const *);
extern int execvpe(const char *, char * const *, char * const *);
extern int execve(const char *, char * const *, char * const *);
extern int execl(const char *, const char *, ...);
extern int execlp(const char *, const char *, ...);
@@ -185,14 +186,15 @@ extern int sysconf(int name);
extern int daemon(int, int);
/* A special syscall that is only available on the ARM, not x86 function. */
extern int cacheflush(long start, long end, long flags);
#if defined(__arm__) || (defined(__mips__) && !defined(__LP64__))
extern int cacheflush(long, long, long);
/* __attribute__((deprecated("use __builtin___clear_cache instead"))); */
#endif
extern pid_t tcgetpgrp(int fd);
extern int tcsetpgrp(int fd, pid_t _pid);
#if 0 /* MISSING FROM BIONIC */
extern int execvpe(const char *, char * const *, char * const *);
extern int execlpe(const char *, const char *, ...);
extern int getfsuid(uid_t);
extern int setfsuid(uid_t);

View File

@@ -147,6 +147,9 @@ extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
extern int wprintf(const wchar_t *, ...);
extern int wscanf(const wchar_t *, ...);
extern size_t wcslcat(wchar_t*, const wchar_t*, size_t);
extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
/* No really supported. These are just for making libstdc++-v3 happy. */
typedef void *wctrans_t;
extern wint_t towctrans(wint_t, wctrans_t);