Add NBSD-like Minix system includes.
This commit is contained in:
parent
5518fe9be1
commit
4cf101caae
|
@ -77,6 +77,7 @@ SUBDIR+= ../common/include/prop
|
|||
|
||||
.if defined(__MINIX)
|
||||
.include "${MINIXSRCDIR}/common/include/Makefile.inc"
|
||||
SUBDIR+= arch/${MACHINE}
|
||||
SUBDIR+= arch sys minix
|
||||
SUBDIR+= net netinet netinet6
|
||||
.endif
|
||||
|
|
62
nbsd_include/arch/Makefile
Normal file
62
nbsd_include/arch/Makefile
Normal file
|
@ -0,0 +1,62 @@
|
|||
# $NetBSD: Makefile,v 1.40 2009/12/13 05:01:33 nakayama Exp $
|
||||
|
||||
# For now, we install the machine and arch includes, and symlink 'machine'
|
||||
# to the location of the machine includes (usually).
|
||||
#
|
||||
# Eventually, we should install everything.
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SUBDIR= ${MACHINE}
|
||||
ARCHSUBDIR= ${MACHINE_CPU}
|
||||
|
||||
.if ${ARCHSUBDIR} == "mips64"
|
||||
ARCHSUBDIR= mips
|
||||
.endif
|
||||
.if ${ARCHSUBDIR} == "powerpc64"
|
||||
ARCHSUBDIR= powerpc
|
||||
.endif
|
||||
|
||||
.if ${MACHINE} != ${ARCHSUBDIR}
|
||||
.if exists(${ARCHSUBDIR})
|
||||
SUBDIR+= ${ARCHSUBDIR}
|
||||
.endif
|
||||
.endif
|
||||
.if ${MACHINE} == sparc
|
||||
SUBDIR+= sparc64
|
||||
.endif
|
||||
.if (${MACHINE} == hpcmips || ${MACHINE} == hpcsh)
|
||||
SUBDIR+= hpc
|
||||
.endif
|
||||
.if (${MACHINE} == sun2 || ${MACHINE} == sun3)
|
||||
SUBDIR+= sun68k
|
||||
.endif
|
||||
.if defined(XEN_BUILD)
|
||||
SUBDIR+= xen
|
||||
.endif
|
||||
|
||||
#SUBDIR=acorn26 acorn32 algor alpha amiga amigappc arm arc atari \
|
||||
# bebox \
|
||||
# cats cesfic cobalt \
|
||||
# dreamcast \
|
||||
# evbarm evbmips evbppc evbsh3 ews4800mips\
|
||||
# hp300 hpc hpcarm hpcmips hpcsh \
|
||||
# i386 iyonix \
|
||||
# luna68k \
|
||||
# m68k mac68k macppc mips mipsco mmeye mvme68k \
|
||||
# netwinder news68k newsmips next68k \
|
||||
# ofppc \
|
||||
# pmax powerpc prep \
|
||||
# sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
|
||||
# rs6000 \
|
||||
# vax \
|
||||
# x68k x86_64 xen \
|
||||
# zaurus
|
||||
|
||||
INCSYMLINKS= ${MACHINE} /usr/netbsd/include/machine
|
||||
|
||||
INCSYMLINKS+= /usr/netbsd/include/machine/float.h /usr/netbsd/include/float.h \
|
||||
/usr/netbsd/include/machine/stdarg.h /usr/netbsd/include/stdarg.h
|
||||
|
||||
|
||||
.include <bsd.inc.mk>
|
6
nbsd_include/arch/i386/Makefile
Normal file
6
nbsd_include/arch/i386/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
|
||||
|
||||
|
||||
SUBDIR= include ../x86/include
|
||||
|
||||
.include <bsd.subdir.mk>
|
16
nbsd_include/arch/i386/include/Makefile
Normal file
16
nbsd_include/arch/i386/include/Makefile
Normal file
|
@ -0,0 +1,16 @@
|
|||
# $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $
|
||||
.include <bsd.own.mk>
|
||||
|
||||
INCSDIR= /usr/netbsd/include/i386
|
||||
|
||||
INCS= ansi.h asm.h bswap.h byte_swap.h cdefs.h \
|
||||
endian.h endian_machdep.h fenv.h float.h ieee.h \
|
||||
ieeefp.h int_const.h int_fmtio.h int_limits.h \
|
||||
int_mwgwtypes.h int_types.h limits.h \
|
||||
math.h mcontext.h npx.h param.h profile.h \
|
||||
setjmp.h signal.h stdarg.h types.h \
|
||||
vmparam.h wchar_limits.h
|
||||
|
||||
|
||||
.include "${MINIXSRCDIR}/common/include/arch/i386/Makefile.inc"
|
||||
.include <bsd.kinc.mk>
|
76
nbsd_include/arch/i386/include/ansi.h
Normal file
76
nbsd_include/arch/i386/include/ansi.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* $NetBSD: ansi.h,v 1.24 2010/03/27 22:14:09 tnozaki 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.
|
||||
*
|
||||
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
/* These types are Minix specific. */
|
||||
|
||||
#ifndef _I386_ANSI_H_
|
||||
#define _I386_ANSI_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <machine/int_types.h>
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and may appear in
|
||||
* more than one standard header are defined here. Standard headers
|
||||
* then use:
|
||||
* #ifdef _BSD_SIZE_T_
|
||||
* typedef _BSD_SIZE_T_ size_t;
|
||||
* #undef _BSD_SIZE_T_
|
||||
* #endif
|
||||
*/
|
||||
|
||||
#define _BSD_CLOCK_T_ long
|
||||
|
||||
#if _EM_PSIZE == _EM_WSIZE
|
||||
#define _BSD_PTRDIFF_T_ int
|
||||
#else /* _EM_PSIZE == _EM_LSIZE */
|
||||
#define _BSD_PTRDIFF_T_ long
|
||||
#endif
|
||||
|
||||
#define _BSD_SIZE_T_ unsigned int
|
||||
#define _BSD_SSIZE_T_ int
|
||||
#define _BSD_TIME_T_ long /* time() */
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define _BSD_VA_LIST_ __builtin_va_list /* GCC built-in type */
|
||||
#else
|
||||
#define _BSD_VA_LIST_ char * /* va_list */
|
||||
#endif
|
||||
#define _BSD_CLOCKID_T_ int /* clockid_t */
|
||||
#define _BSD_TIMER_T_ int /* timer_t */
|
||||
#define _BSD_SUSECONDS_T_ long /* suseconds_t */
|
||||
#define _BSD_USECONDS_T_ long /* useconds_t */
|
||||
#define _BSD_WCHAR_T_ int /* wchar_t */
|
||||
#define _BSD_WINT_T_ int /* wint_t */
|
||||
|
||||
#endif /* _I386_ANSI_H_ */
|
223
nbsd_include/arch/i386/include/asm.h
Normal file
223
nbsd_include/arch/i386/include/asm.h
Normal file
|
@ -0,0 +1,223 @@
|
|||
/* $NetBSD: asm.h,v 1.39 2010/12/20 21:11:24 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)asm.h 5.5 (Berkeley) 5/7/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_ASM_H_
|
||||
#define _I386_ASM_H_
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_multiprocessor.h"
|
||||
#endif
|
||||
|
||||
#ifdef PIC
|
||||
#define PIC_PROLOGUE \
|
||||
pushl %ebx; \
|
||||
call 1f; \
|
||||
1: \
|
||||
popl %ebx; \
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
|
||||
#define PIC_EPILOGUE \
|
||||
popl %ebx
|
||||
#define PIC_PLT(x) x@PLT
|
||||
#define PIC_GOT(x) x@GOT(%ebx)
|
||||
#define PIC_GOTOFF(x) x@GOTOFF(%ebx)
|
||||
#else
|
||||
#define PIC_PROLOGUE
|
||||
#define PIC_EPILOGUE
|
||||
#define PIC_PLT(x) x
|
||||
#define PIC_GOT(x) x
|
||||
#define PIC_GOTOFF(x) x
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#define CVAROFF(x, y) _C_LABEL(x) + y
|
||||
|
||||
#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 */
|
||||
#if !defined(_ALIGN_TEXT) && !defined(_KERNEL)
|
||||
# ifdef _STANDALONE
|
||||
# define _ALIGN_TEXT .align 4
|
||||
# elif defined __ELF__
|
||||
# define _ALIGN_TEXT .align 16
|
||||
# else
|
||||
# define _ALIGN_TEXT .align 4
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define _ENTRY(x) \
|
||||
.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
|
||||
#define _LABEL(x) \
|
||||
.globl x; x:
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define CPUVAR(off) %fs:__CONCAT(CPU_INFO_,off)
|
||||
|
||||
/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
|
||||
#ifdef __ELF__
|
||||
#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__ */
|
||||
#else
|
||||
#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 /* __ELF__ */
|
||||
|
||||
#ifdef _STANDALONE
|
||||
#define ALIGN_DATA .align 4
|
||||
#define ALIGN_TEXT .align 4 /* 4-byte boundaries */
|
||||
#define SUPERALIGN_TEXT .align 16 /* 15-byte boundaries */
|
||||
#elif defined __ELF__
|
||||
#define ALIGN_DATA .align 4
|
||||
#define ALIGN_TEXT .align 16 /* 16-byte boundaries */
|
||||
#define SUPERALIGN_TEXT .align 16 /* 16-byte boundaries */
|
||||
#else
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 4 /* 16-byte boundaries */
|
||||
#define SUPERALIGN_TEXT .align 4 /* 16-byte boundaries */
|
||||
#endif /* __ELF__ */
|
||||
|
||||
#define _ALIGN_TEXT ALIGN_TEXT
|
||||
|
||||
#ifdef GPROF
|
||||
#ifdef __ELF__
|
||||
#define MCOUNT_ASM call _C_LABEL(__mcount)
|
||||
#else /* __ELF__ */
|
||||
#define MCOUNT_ASM call _C_LABEL(mcount)
|
||||
#endif /* __ELF__ */
|
||||
#else /* GPROF */
|
||||
#define MCOUNT_ASM /* nothing */
|
||||
#endif /* GPROF */
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
||||
|
||||
#ifdef GPROF
|
||||
# ifdef __ELF__
|
||||
# define _PROF_PROLOGUE \
|
||||
pushl %ebp; movl %esp,%ebp; call PIC_PLT(__mcount); popl %ebp
|
||||
# else
|
||||
# define _PROF_PROLOGUE \
|
||||
pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
|
||||
# endif
|
||||
#else
|
||||
# define _PROF_PROLOGUE
|
||||
#endif
|
||||
|
||||
#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
|
||||
#define NENTRY(y) _ENTRY(_C_LABEL(y))
|
||||
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
|
||||
#define LABEL(y) _LABEL(_C_LABEL(y))
|
||||
#define END(y) .size y, . - y
|
||||
|
||||
#define ASMSTR .asciz
|
||||
|
||||
#ifdef __ELF__
|
||||
#define RCSID(x) .pushsection ".ident"; .asciz x; .popsection
|
||||
#else
|
||||
#define RCSID(x) .text; .asciz x
|
||||
#endif
|
||||
|
||||
#ifdef NO_KERNEL_RCSIDS
|
||||
#define __KERNEL_RCSID(_n, _s) /* nothing */
|
||||
#else
|
||||
#define __KERNEL_RCSID(_n, _s) RCSID(_s)
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__) || defined(__minix)
|
||||
#define WEAK_ALIAS(alias,sym) \
|
||||
.weak alias; \
|
||||
alias = sym
|
||||
#endif
|
||||
/*
|
||||
* 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__ */
|
||||
|
||||
#ifdef __minix
|
||||
#define IMPORT(sym) \
|
||||
.extern _C_LABEL(sym)
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_ASM_H_ */
|
13
nbsd_include/arch/i386/include/bswap.h
Normal file
13
nbsd_include/arch/i386/include/bswap.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: bswap.h,v 1.4 2008/10/26 06:57:30 mrg Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _I386_BSWAP_H_
|
||||
#define _I386_BSWAP_H_
|
||||
|
||||
#include <machine/byte_swap.h>
|
||||
|
||||
#define __BSWAP_RENAME
|
||||
#include <sys/bswap.h>
|
||||
|
||||
#endif /* !_I386_BSWAP_H_ */
|
68
nbsd_include/arch/i386/include/byte_swap.h
Normal file
68
nbsd_include/arch/i386/include/byte_swap.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: byte_swap.h,v 1.15 2008/04/28 20:23:24 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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 _I386_BYTE_SWAP_H_
|
||||
#define _I386_BYTE_SWAP_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
|
||||
static __inline uint32_t __byte_swap_u32_variable(uint32_t);
|
||||
static __inline uint32_t
|
||||
__byte_swap_u32_variable(uint32_t x)
|
||||
{
|
||||
__asm volatile (
|
||||
"bswap %1"
|
||||
: "=r" (x) : "0" (x));
|
||||
return (x);
|
||||
}
|
||||
|
||||
#define __BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
|
||||
static __inline uint16_t __byte_swap_u16_variable(uint16_t);
|
||||
static __inline uint16_t
|
||||
__byte_swap_u16_variable(uint16_t x)
|
||||
{
|
||||
__asm volatile ("rorw $8, %w1" : "=r" (x) : "0" (x));
|
||||
return (x);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
#elif defined(_KERNEL) || defined(_LKM)
|
||||
#define __BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
|
||||
#define __BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
|
||||
uint32_t __byte_swap_u32_variable(uint32_t);
|
||||
uint16_t __byte_swap_u16_variable(uint16_t);
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_BYTE_SWAP_H_ */
|
14
nbsd_include/arch/i386/include/cdefs.h
Normal file
14
nbsd_include/arch/i386/include/cdefs.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: cdefs.h,v 1.7 2008/10/26 06:57:30 mrg Exp $ */
|
||||
|
||||
#ifndef _I386_CDEFS_H_
|
||||
#define _I386_CDEFS_H_
|
||||
|
||||
#ifdef __minix
|
||||
#define __LEADING_UNDERSCORE
|
||||
#else /* !__minix */
|
||||
/* No arch-specific cdefs. */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* !_I386_CDEFS_H_ */
|
74
nbsd_include/arch/i386/include/disklabel.h
Normal file
74
nbsd_include/arch/i386/include/disklabel.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* $NetBSD: disklabel.h,v 1.15 2009/11/23 13:40:10 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
* 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 Christopher G. Demetriou.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _I386_DISKLABEL_H_
|
||||
#define _I386_DISKLABEL_H_
|
||||
|
||||
#define LABELSECTOR 1 /* sector containing label */
|
||||
#define LABELOFFSET 0 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 16 /* number of partitions */
|
||||
#define OLDMAXPARTITIONS 8 /* number of partitions before 1.6 */
|
||||
#define RAW_PART 3 /* raw partition: XX?d (XXX) */
|
||||
|
||||
/*
|
||||
* We use the highest bit of the minor number for the partition number.
|
||||
* This maintains backward compatibility with device nodes created before
|
||||
* MAXPARTITIONS was increased.
|
||||
*/
|
||||
#define __I386_MAXDISKS ((1 << 20) / MAXPARTITIONS)
|
||||
#define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS)
|
||||
#define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \
|
||||
((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
|
||||
#define DISKMINOR(unit, part) \
|
||||
(((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
|
||||
((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS))
|
||||
|
||||
/* Pull in MBR partition definitions. */
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include <nbinclude/sys/bootblock.h>
|
||||
#else
|
||||
#include <sys/bootblock.h>
|
||||
#endif /* HAVE_NBTOOL_CONFIG_H */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include <nbinclude/sys/dkbad.h>
|
||||
#else
|
||||
#include <sys/dkbad.h>
|
||||
#endif /* HAVE_NBTOOL_CONFIG_H */
|
||||
struct cpu_disklabel {
|
||||
#define __HAVE_DISKLABEL_DKBAD
|
||||
struct dkbad bad;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _I386_DISKLABEL_H_ */
|
3
nbsd_include/arch/i386/include/endian.h
Normal file
3
nbsd_include/arch/i386/include/endian.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian.h,v 1.29 2000/03/17 00:09:20 mycroft Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
3
nbsd_include/arch/i386/include/endian_machdep.h
Normal file
3
nbsd_include/arch/i386/include/endian_machdep.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian_machdep.h,v 1.3 2006/01/30 21:52:38 dsl Exp $ */
|
||||
|
||||
#define _BYTE_ORDER _LITTLE_ENDIAN
|
116
nbsd_include/arch/i386/include/fenv.h
Normal file
116
nbsd_include/arch/i386/include/fenv.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* $NetBSD: fenv.h,v 1.1 2010/07/31 21:47:54 joerg Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _X86_FENV_H_
|
||||
#define _X86_FENV_H_
|
||||
|
||||
#include <sys/stdint.h>
|
||||
#include <i386/npx.h>
|
||||
|
||||
/*
|
||||
* Each symbol representing a floating point exception expands to an integer
|
||||
* constant expression with values, such that bitwise-inclusive ORs of _all
|
||||
* combinations_ of the constants result in distinct values.
|
||||
*
|
||||
* We use such values that allow direct bitwise operations on FPU/SSE registers.
|
||||
*/
|
||||
#define FE_INVALID 0x01 /* 000000000001 */
|
||||
#define FE_DENORMAL 0x02 /* 000000000010 */
|
||||
#define FE_DIVBYZERO 0x04 /* 000000000100 */
|
||||
#define FE_OVERFLOW 0x08 /* 000000001000 */
|
||||
#define FE_UNDERFLOW 0x10 /* 000000010000 */
|
||||
#define FE_INEXACT 0x20 /* 000000100000 */
|
||||
|
||||
/*
|
||||
* The following symbol is simply the bitwise-inclusive OR of all floating-point
|
||||
* exception constants defined above.
|
||||
*/
|
||||
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
|
||||
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
|
||||
|
||||
/*
|
||||
* Each symbol representing the rounding direction, expands to an integer
|
||||
* constant expression whose value is distinct non-negative value.
|
||||
*
|
||||
* We use such values that allow direct bitwise operations on FPU/SSE registers.
|
||||
*/
|
||||
#define FE_TONEAREST 0x000 /* 000000000000 */
|
||||
#define FE_DOWNWARD 0x400 /* 010000000000 */
|
||||
#define FE_UPWARD 0x800 /* 100000000000 */
|
||||
#define FE_TOWARDZERO 0xC00 /* 110000000000 */
|
||||
|
||||
/*
|
||||
* As compared to the x87 control word, the SSE unit's control has the rounding
|
||||
* control bits offset by 3 and the exception mask bits offset by 7
|
||||
*/
|
||||
#define __X87_ROUND_MASK 0xC00 /* 110000000000 */
|
||||
#define __SSE_ROUND_SHIFT 3
|
||||
#define __SSE_EMASK_SHIFT 7
|
||||
|
||||
/*
|
||||
* fenv_t represents the entire floating-point environment
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
uint16_t control; /* Control word register */
|
||||
uint16_t unused1;
|
||||
uint16_t status; /* Status word register */
|
||||
uint16_t unused2;
|
||||
uint16_t tag; /* Tag word register */
|
||||
uint16_t unused3;
|
||||
uint32_t others[4]; /* EIP, Pointer Selector, etc */
|
||||
} x87;
|
||||
|
||||
uint32_t mxcsr; /* Control and status register */
|
||||
} fenv_t;
|
||||
|
||||
/*
|
||||
* 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 within the <fenv.h> header
|
||||
* that manage the floating-point environment.
|
||||
*/
|
||||
extern fenv_t __fe_dfl_env;
|
||||
#define FE_DFL_ENV ((const fenv_t *) &__fe_dfl_env)
|
||||
|
||||
/*
|
||||
* fexcept_t represents the floating-point status flags collectively, including
|
||||
* any status the implementation associates with the flags.
|
||||
*
|
||||
* A floating-point status flag is a system variable whose value is set (but
|
||||
* never cleared) when a floating-point exception is raised, which occurs as a
|
||||
* side effect of exceptional floating-point arithmetic to provide auxiliary
|
||||
* information.
|
||||
*
|
||||
* A floating-point control mode is a system variable whose value may be set by
|
||||
* the user to affect the subsequent behavior of floating-point arithmetic.
|
||||
*/
|
||||
typedef uint32_t fexcept_t;
|
||||
|
||||
#endif /* ! _X86_FENV_H_ */
|
3
nbsd_include/arch/i386/include/float.h
Normal file
3
nbsd_include/arch/i386/include/float.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: float.h,v 1.12 2003/02/26 21:29:00 fvdl Exp $ */
|
||||
|
||||
#include <x86/float.h>
|
3
nbsd_include/arch/i386/include/ieee.h
Normal file
3
nbsd_include/arch/i386/include/ieee.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ieee.h,v 1.2 2003/02/26 21:29:01 fvdl Exp $ */
|
||||
|
||||
#include <x86/ieee.h>
|
3
nbsd_include/arch/i386/include/ieeefp.h
Normal file
3
nbsd_include/arch/i386/include/ieeefp.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.3 2003/02/26 21:29:01 fvdl Exp $ */
|
||||
|
||||
#include <x86/ieeefp.h>
|
56
nbsd_include/arch/i386/include/int_const.h
Normal file
56
nbsd_include/arch/i386/include/int_const.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: int_const.h,v 1.3 2010/05/29 17:33:57 tnozaki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* 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 _I386_INT_CONST_H_
|
||||
#define _I386_INT_CONST_H_
|
||||
|
||||
/*
|
||||
* 7.18.4 Macros for integer constants
|
||||
*/
|
||||
|
||||
/* 7.18.4.1 Macros for minimum-width integer constants */
|
||||
|
||||
#define INT8_C(c) c
|
||||
#define INT16_C(c) c
|
||||
#define INT32_C(c) c
|
||||
#define INT64_C(c) c ## LL
|
||||
|
||||
#define UINT8_C(c) c
|
||||
#define UINT16_C(c) c
|
||||
#define UINT32_C(c) c ## U
|
||||
#define UINT64_C(c) c ## ULL
|
||||
|
||||
/* 7.18.4.2 Macros for greatest-width integer constants */
|
||||
|
||||
#define INTMAX_C(c) c ## LL
|
||||
#define UINTMAX_C(c) c ## ULL
|
||||
|
||||
#endif /* !_I386_INT_CONST_H_ */
|
212
nbsd_include/arch/i386/include/int_fmtio.h
Normal file
212
nbsd_include/arch/i386/include/int_fmtio.h
Normal file
|
@ -0,0 +1,212 @@
|
|||
/* $NetBSD: int_fmtio.h,v 1.7 2008/04/28 20:23:24 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* 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 _I386_INT_FMTIO_H_
|
||||
#define _I386_INT_FMTIO_H_
|
||||
|
||||
/*
|
||||
* 7.8.1 Macros for format specifiers
|
||||
*/
|
||||
|
||||
/* fprintf macros for signed integers */
|
||||
|
||||
#define PRId8 "d" /* int8_t */
|
||||
#define PRId16 "d" /* int16_t */
|
||||
#define PRId32 "d" /* int32_t */
|
||||
#define PRId64 "lld" /* int64_t */
|
||||
#define PRIdLEAST8 "d" /* int_least8_t */
|
||||
#define PRIdLEAST16 "d" /* int_least16_t */
|
||||
#define PRIdLEAST32 "d" /* int_least32_t */
|
||||
#define PRIdLEAST64 "lld" /* int_least64_t */
|
||||
#define PRIdFAST8 "d" /* int_fast8_t */
|
||||
#define PRIdFAST16 "d" /* int_fast16_t */
|
||||
#define PRIdFAST32 "d" /* int_fast32_t */
|
||||
#define PRIdFAST64 "lld" /* int_fast64_t */
|
||||
#define PRIdMAX "lld" /* intmax_t */
|
||||
#define PRIdPTR "d" /* intptr_t */
|
||||
|
||||
#define PRIi8 "i" /* int8_t */
|
||||
#define PRIi16 "i" /* int16_t */
|
||||
#define PRIi32 "i" /* int32_t */
|
||||
#define PRIi64 "lli" /* int64_t */
|
||||
#define PRIiLEAST8 "i" /* int_least8_t */
|
||||
#define PRIiLEAST16 "i" /* int_least16_t */
|
||||
#define PRIiLEAST32 "i" /* int_least32_t */
|
||||
#define PRIiLEAST64 "lli" /* int_least64_t */
|
||||
#define PRIiFAST8 "i" /* int_fast8_t */
|
||||
#define PRIiFAST16 "i" /* int_fast16_t */
|
||||
#define PRIiFAST32 "i" /* int_fast32_t */
|
||||
#define PRIiFAST64 "lli" /* int_fast64_t */
|
||||
#define PRIiMAX "lli" /* intmax_t */
|
||||
#define PRIiPTR "i" /* intptr_t */
|
||||
|
||||
/* fprintf macros for unsigned integers */
|
||||
|
||||
#define PRIo8 "o" /* uint8_t */
|
||||
#define PRIo16 "o" /* uint16_t */
|
||||
#define PRIo32 "o" /* uint32_t */
|
||||
#define PRIo64 "llo" /* uint64_t */
|
||||
#define PRIoLEAST8 "o" /* uint_least8_t */
|
||||
#define PRIoLEAST16 "o" /* uint_least16_t */
|
||||
#define PRIoLEAST32 "o" /* uint_least32_t */
|
||||
#define PRIoLEAST64 "llo" /* uint_least64_t */
|
||||
#define PRIoFAST8 "o" /* uint_fast8_t */
|
||||
#define PRIoFAST16 "o" /* uint_fast16_t */
|
||||
#define PRIoFAST32 "o" /* uint_fast32_t */
|
||||
#define PRIoFAST64 "llo" /* uint_fast64_t */
|
||||
#define PRIoMAX "llo" /* uintmax_t */
|
||||
#define PRIoPTR "o" /* uintptr_t */
|
||||
|
||||
#define PRIu8 "u" /* uint8_t */
|
||||
#define PRIu16 "u" /* uint16_t */
|
||||
#define PRIu32 "u" /* uint32_t */
|
||||
#define PRIu64 "llu" /* uint64_t */
|
||||
#define PRIuLEAST8 "u" /* uint_least8_t */
|
||||
#define PRIuLEAST16 "u" /* uint_least16_t */
|
||||
#define PRIuLEAST32 "u" /* uint_least32_t */
|
||||
#define PRIuLEAST64 "llu" /* uint_least64_t */
|
||||
#define PRIuFAST8 "u" /* uint_fast8_t */
|
||||
#define PRIuFAST16 "u" /* uint_fast16_t */
|
||||
#define PRIuFAST32 "u" /* uint_fast32_t */
|
||||
#define PRIuFAST64 "llu" /* uint_fast64_t */
|
||||
#define PRIuMAX "llu" /* uintmax_t */
|
||||
#define PRIuPTR "u" /* uintptr_t */
|
||||
|
||||
#define PRIx8 "x" /* uint8_t */
|
||||
#define PRIx16 "x" /* uint16_t */
|
||||
#define PRIx32 "x" /* uint32_t */
|
||||
#define PRIx64 "llx" /* uint64_t */
|
||||
#define PRIxLEAST8 "x" /* uint_least8_t */
|
||||
#define PRIxLEAST16 "x" /* uint_least16_t */
|
||||
#define PRIxLEAST32 "x" /* uint_least32_t */
|
||||
#define PRIxLEAST64 "llx" /* uint_least64_t */
|
||||
#define PRIxFAST8 "x" /* uint_fast8_t */
|
||||
#define PRIxFAST16 "x" /* uint_fast16_t */
|
||||
#define PRIxFAST32 "x" /* uint_fast32_t */
|
||||
#define PRIxFAST64 "llx" /* uint_fast64_t */
|
||||
#define PRIxMAX "llx" /* uintmax_t */
|
||||
#define PRIxPTR "x" /* uintptr_t */
|
||||
|
||||
#define PRIX8 "X" /* uint8_t */
|
||||
#define PRIX16 "X" /* uint16_t */
|
||||
#define PRIX32 "X" /* uint32_t */
|
||||
#define PRIX64 "llX" /* uint64_t */
|
||||
#define PRIXLEAST8 "X" /* uint_least8_t */
|
||||
#define PRIXLEAST16 "X" /* uint_least16_t */
|
||||
#define PRIXLEAST32 "X" /* uint_least32_t */
|
||||
#define PRIXLEAST64 "llX" /* uint_least64_t */
|
||||
#define PRIXFAST8 "X" /* uint_fast8_t */
|
||||
#define PRIXFAST16 "X" /* uint_fast16_t */
|
||||
#define PRIXFAST32 "X" /* uint_fast32_t */
|
||||
#define PRIXFAST64 "llX" /* uint_fast64_t */
|
||||
#define PRIXMAX "llX" /* uintmax_t */
|
||||
#define PRIXPTR "X" /* uintptr_t */
|
||||
|
||||
/* fscanf macros for signed integers */
|
||||
|
||||
#define SCNd8 "hhd" /* int8_t */
|
||||
#define SCNd16 "hd" /* int16_t */
|
||||
#define SCNd32 "d" /* int32_t */
|
||||
#define SCNd64 "lld" /* int64_t */
|
||||
#define SCNdLEAST8 "hhd" /* int_least8_t */
|
||||
#define SCNdLEAST16 "hd" /* int_least16_t */
|
||||
#define SCNdLEAST32 "d" /* int_least32_t */
|
||||
#define SCNdLEAST64 "lld" /* int_least64_t */
|
||||
#define SCNdFAST8 "hhd" /* int_fast8_t */
|
||||
#define SCNdFAST16 "d" /* int_fast16_t */
|
||||
#define SCNdFAST32 "d" /* int_fast32_t */
|
||||
#define SCNdFAST64 "lld" /* int_fast64_t */
|
||||
#define SCNdMAX "lld" /* intmax_t */
|
||||
#define SCNdPTR "d" /* intptr_t */
|
||||
|
||||
#define SCNi8 "hhi" /* int8_t */
|
||||
#define SCNi16 "hi" /* int16_t */
|
||||
#define SCNi32 "i" /* int32_t */
|
||||
#define SCNi64 "lli" /* int64_t */
|
||||
#define SCNiLEAST8 "hhi" /* int_least8_t */
|
||||
#define SCNiLEAST16 "hi" /* int_least16_t */
|
||||
#define SCNiLEAST32 "i" /* int_least32_t */
|
||||
#define SCNiLEAST64 "lli" /* int_least64_t */
|
||||
#define SCNiFAST8 "hhi" /* int_fast8_t */
|
||||
#define SCNiFAST16 "i" /* int_fast16_t */
|
||||
#define SCNiFAST32 "i" /* int_fast32_t */
|
||||
#define SCNiFAST64 "lli" /* int_fast64_t */
|
||||
#define SCNiMAX "lli" /* intmax_t */
|
||||
#define SCNiPTR "i" /* intptr_t */
|
||||
|
||||
/* fscanf macros for unsigned integers */
|
||||
|
||||
#define SCNo8 "hho" /* uint8_t */
|
||||
#define SCNo16 "ho" /* uint16_t */
|
||||
#define SCNo32 "o" /* uint32_t */
|
||||
#define SCNo64 "llo" /* uint64_t */
|
||||
#define SCNoLEAST8 "hho" /* uint_least8_t */
|
||||
#define SCNoLEAST16 "ho" /* uint_least16_t */
|
||||
#define SCNoLEAST32 "o" /* uint_least32_t */
|
||||
#define SCNoLEAST64 "llo" /* uint_least64_t */
|
||||
#define SCNoFAST8 "hho" /* uint_fast8_t */
|
||||
#define SCNoFAST16 "o" /* uint_fast16_t */
|
||||
#define SCNoFAST32 "o" /* uint_fast32_t */
|
||||
#define SCNoFAST64 "llo" /* uint_fast64_t */
|
||||
#define SCNoMAX "llo" /* uintmax_t */
|
||||
#define SCNoPTR "o" /* uintptr_t */
|
||||
|
||||
#define SCNu8 "hhu" /* uint8_t */
|
||||
#define SCNu16 "hu" /* uint16_t */
|
||||
#define SCNu32 "u" /* uint32_t */
|
||||
#define SCNu64 "llu" /* uint64_t */
|
||||
#define SCNuLEAST8 "hhu" /* uint_least8_t */
|
||||
#define SCNuLEAST16 "hu" /* uint_least16_t */
|
||||
#define SCNuLEAST32 "u" /* uint_least32_t */
|
||||
#define SCNuLEAST64 "llu" /* uint_least64_t */
|
||||
#define SCNuFAST8 "hhu" /* uint_fast8_t */
|
||||
#define SCNuFAST16 "u" /* uint_fast16_t */
|
||||
#define SCNuFAST32 "u" /* uint_fast32_t */
|
||||
#define SCNuFAST64 "llu" /* uint_fast64_t */
|
||||
#define SCNuMAX "llu" /* uintmax_t */
|
||||
#define SCNuPTR "u" /* uintptr_t */
|
||||
|
||||
#define SCNx8 "hhx" /* uint8_t */
|
||||
#define SCNx16 "hx" /* uint16_t */
|
||||
#define SCNx32 "x" /* uint32_t */
|
||||
#define SCNx64 "llx" /* uint64_t */
|
||||
#define SCNxLEAST8 "hhx" /* uint_least8_t */
|
||||
#define SCNxLEAST16 "hx" /* uint_least16_t */
|
||||
#define SCNxLEAST32 "x" /* uint_least32_t */
|
||||
#define SCNxLEAST64 "llx" /* uint_least64_t */
|
||||
#define SCNxFAST8 "hhx" /* uint_fast8_t */
|
||||
#define SCNxFAST16 "x" /* uint_fast16_t */
|
||||
#define SCNxFAST32 "x" /* uint_fast32_t */
|
||||
#define SCNxFAST64 "llx" /* uint_fast64_t */
|
||||
#define SCNxMAX "llx" /* uintmax_t */
|
||||
#define SCNxPTR "x" /* uintptr_t */
|
||||
|
||||
#endif /* !_I386_INT_FMTIO_H_ */
|
127
nbsd_include/arch/i386/include/int_limits.h
Normal file
127
nbsd_include/arch/i386/include/int_limits.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/* $NetBSD: int_limits.h,v 1.8 2008/04/28 20:23:24 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* 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 _I386_INT_LIMITS_H_
|
||||
#define _I386_INT_LIMITS_H_
|
||||
|
||||
/*
|
||||
* 7.18.2 Limits of specified-width integer types
|
||||
*/
|
||||
|
||||
/* 7.18.2.1 Limits of exact-width integer types */
|
||||
|
||||
/* minimum values of exact-width signed integer types */
|
||||
#define INT8_MIN (-0x7f-1) /* int8_t */
|
||||
#define INT16_MIN (-0x7fff-1) /* int16_t */
|
||||
#define INT32_MIN (-0x7fffffff-1) /* int32_t */
|
||||
#define INT64_MIN (-0x7fffffffffffffffLL-1) /* int64_t */
|
||||
|
||||
/* maximum values of exact-width signed integer types */
|
||||
#define INT8_MAX 0x7f /* int8_t */
|
||||
#define INT16_MAX 0x7fff /* int16_t */
|
||||
#define INT32_MAX 0x7fffffff /* int32_t */
|
||||
#define INT64_MAX 0x7fffffffffffffffLL /* int64_t */
|
||||
|
||||
/* maximum values of exact-width unsigned integer types */
|
||||
#define UINT8_MAX 0xff /* uint8_t */
|
||||
#define UINT16_MAX 0xffff /* uint16_t */
|
||||
#define UINT32_MAX 0xffffffffU /* uint32_t */
|
||||
#define UINT64_MAX 0xffffffffffffffffULL /* uint64_t */
|
||||
|
||||
/* 7.18.2.2 Limits of minimum-width integer types */
|
||||
|
||||
/* minimum values of minimum-width signed integer types */
|
||||
#define INT_LEAST8_MIN (-0x7f-1) /* int_least8_t */
|
||||
#define INT_LEAST16_MIN (-0x7fff-1) /* int_least16_t */
|
||||
#define INT_LEAST32_MIN (-0x7fffffff-1) /* int_least32_t */
|
||||
#define INT_LEAST64_MIN (-0x7fffffffffffffffLL-1) /* int_least64_t */
|
||||
|
||||
/* maximum values of minimum-width signed integer types */
|
||||
#define INT_LEAST8_MAX 0x7f /* int_least8_t */
|
||||
#define INT_LEAST16_MAX 0x7fff /* int_least16_t */
|
||||
#define INT_LEAST32_MAX 0x7fffffff /* int_least32_t */
|
||||
#define INT_LEAST64_MAX 0x7fffffffffffffffLL /* int_least64_t */
|
||||
|
||||
/* maximum values of minimum-width unsigned integer types */
|
||||
#define UINT_LEAST8_MAX 0xff /* uint_least8_t */
|
||||
#define UINT_LEAST16_MAX 0xffff /* uint_least16_t */
|
||||
#define UINT_LEAST32_MAX 0xffffffffU /* uint_least32_t */
|
||||
#define UINT_LEAST64_MAX 0xffffffffffffffffULL /* uint_least64_t */
|
||||
|
||||
/* 7.18.2.3 Limits of fastest minimum-width integer types */
|
||||
|
||||
/* minimum values of fastest minimum-width signed integer types */
|
||||
#define INT_FAST8_MIN (-0x7f-1) /* int_fast8_t */
|
||||
#define INT_FAST16_MIN (-0x7fffffff-1) /* int_fast16_t */
|
||||
#define INT_FAST32_MIN (-0x7fffffff-1) /* int_fast32_t */
|
||||
#define INT_FAST64_MIN (-0x7fffffffffffffffLL-1) /* int_fast64_t */
|
||||
|
||||
/* maximum values of fastest minimum-width signed integer types */
|
||||
#define INT_FAST8_MAX 0x7f /* int_fast8_t */
|
||||
#define INT_FAST16_MAX 0x7fffffff /* int_fast16_t */
|
||||
#define INT_FAST32_MAX 0x7fffffff /* int_fast32_t */
|
||||
#define INT_FAST64_MAX 0x7fffffffffffffffLL /* int_fast64_t */
|
||||
|
||||
/* maximum values of fastest minimum-width unsigned integer types */
|
||||
#define UINT_FAST8_MAX 0xff /* uint_fast8_t */
|
||||
#define UINT_FAST16_MAX 0xffffffffU /* uint_fast16_t */
|
||||
#define UINT_FAST32_MAX 0xffffffffU /* uint_fast32_t */
|
||||
#define UINT_FAST64_MAX 0xffffffffffffffffULL /* uint_fast64_t */
|
||||
|
||||
/* 7.18.2.4 Limits of integer types capable of holding object pointers */
|
||||
|
||||
#define INTPTR_MIN (-0x7fffffff-1) /* intptr_t */
|
||||
#define INTPTR_MAX 0x7fffffff /* intptr_t */
|
||||
#define UINTPTR_MAX 0xffffffffU /* uintptr_t */
|
||||
|
||||
/* 7.18.2.5 Limits of greatest-width integer types */
|
||||
|
||||
#define INTMAX_MIN (-0x7fffffffffffffffLL-1) /* intmax_t */
|
||||
#define INTMAX_MAX 0x7fffffffffffffffLL /* intmax_t */
|
||||
#define UINTMAX_MAX 0xffffffffffffffffULL /* uintmax_t */
|
||||
|
||||
|
||||
/*
|
||||
* 7.18.3 Limits of other integer types
|
||||
*/
|
||||
|
||||
/* limits of ptrdiff_t */
|
||||
#define PTRDIFF_MIN (-0x7fffffff-1) /* ptrdiff_t */
|
||||
#define PTRDIFF_MAX 0x7fffffff /* ptrdiff_t */
|
||||
|
||||
/* limits of sig_atomic_t */
|
||||
#define SIG_ATOMIC_MIN (-0x7fffffff-1) /* sig_atomic_t */
|
||||
#define SIG_ATOMIC_MAX 0x7fffffff /* sig_atomic_t */
|
||||
|
||||
/* limit of size_t */
|
||||
#define SIZE_MAX 0xffffffffU /* size_t */
|
||||
|
||||
#endif /* !_I386_INT_LIMITS_H_ */
|
87
nbsd_include/arch/i386/include/int_mwgwtypes.h
Normal file
87
nbsd_include/arch/i386/include/int_mwgwtypes.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* $NetBSD: int_mwgwtypes.h,v 1.6 2008/04/28 20:23:24 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* 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 _I386_INT_MWGWTYPES_H_
|
||||
#define _I386_INT_MWGWTYPES_H_
|
||||
|
||||
/*
|
||||
* 7.18.1 Integer types
|
||||
*/
|
||||
|
||||
/* 7.18.1.2 Minimum-width integer types */
|
||||
|
||||
typedef signed char int_least8_t;
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef short int int_least16_t;
|
||||
typedef unsigned short int uint_least16_t;
|
||||
typedef int int_least32_t;
|
||||
typedef unsigned int uint_least32_t;
|
||||
#ifdef __COMPILER_INT64__
|
||||
typedef __COMPILER_INT64__ int_least64_t;
|
||||
typedef __COMPILER_UINT64__ uint_least64_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long int int_least64_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long int uint_least64_t;
|
||||
#endif
|
||||
|
||||
/* 7.18.1.3 Fastest minimum-width integer types */
|
||||
|
||||
typedef signed char int_fast8_t;
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef int int_fast16_t;
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef int int_fast32_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
#ifdef __COMPILER_INT64__
|
||||
typedef __COMPILER_INT64__ int_fast64_t;
|
||||
typedef __COMPILER_UINT64__ uint_fast64_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long int int_fast64_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long int uint_fast64_t;
|
||||
#endif
|
||||
|
||||
/* 7.18.1.5 Greatest-width integer types */
|
||||
|
||||
#ifdef __COMPILER_INT64__
|
||||
typedef __COMPILER_INT64__ intmax_t;
|
||||
typedef unsigned __COMPILER_INT64__ uintmax_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long int intmax_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long int uintmax_t;
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_INT_MWGWTYPES_H_ */
|
68
nbsd_include/arch/i386/include/int_types.h
Normal file
68
nbsd_include/arch/i386/include/int_types.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: int_types.h,v 1.10 2005/12/24 20:07:10 perry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 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.
|
||||
*
|
||||
* from: @(#)types.h 7.5 (Berkeley) 3/9/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_INT_TYPES_H_
|
||||
#define _I386_INT_TYPES_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* 7.18.1 Integer types
|
||||
*/
|
||||
|
||||
/* 7.18.1.1 Exact-width integer types */
|
||||
|
||||
typedef signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short int __int16_t;
|
||||
typedef unsigned short int __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
#ifdef __COMPILER_INT64__
|
||||
typedef __COMPILER_INT64__ __int64_t;
|
||||
typedef __COMPILER_UINT64__ __uint64_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long int __int64_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long int __uint64_t;
|
||||
#endif
|
||||
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
|
||||
/* 7.18.1.4 Integer types capable of holding object pointers */
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
#endif /* !_I386_INT_TYPES_H_ */
|
94
nbsd_include/arch/i386/include/limits.h
Normal file
94
nbsd_include/arch/i386/include/limits.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* $NetBSD: limits.h,v 1.22 2010/06/07 13:52:30 tnozaki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)limits.h 7.2 (Berkeley) 6/28/90
|
||||
*/
|
||||
|
||||
#ifndef _I386_LIMITS_H_
|
||||
#define _I386_LIMITS_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
|
||||
#define SCHAR_MAX 0x7f /* max value for a signed char */
|
||||
#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 0xff /* max value for an unsigned char */
|
||||
#define CHAR_MAX 0x7f /* max value for a char */
|
||||
#define CHAR_MIN (-0x7f-1) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 0xffff /* max value for an unsigned short */
|
||||
#define SHRT_MAX 0x7fff /* max value for a short */
|
||||
#define SHRT_MIN (-0x7fff-1) /* min value for a short */
|
||||
|
||||
#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
|
||||
#define INT_MAX 0x7fffffff /* max value for an int */
|
||||
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
|
||||
|
||||
#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
|
||||
#define LONG_MAX 0x7fffffffL /* max value for a long */
|
||||
#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
|
||||
|
||||
#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
|
||||
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
|
||||
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
|
||||
#endif
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
|
||||
|
||||
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
|
||||
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
|
||||
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define LONG_BIT 32
|
||||
#define WORD_BIT 32
|
||||
|
||||
#define DBL_DIG 15
|
||||
#define DBL_MAX 1.7976931348623157E+308
|
||||
#define DBL_MIN 2.2250738585072014E-308
|
||||
|
||||
#define FLT_DIG 6
|
||||
#define FLT_MAX 3.40282347E+38F
|
||||
#define FLT_MIN 1.17549435E-38F
|
||||
#endif
|
||||
|
||||
#endif /* _I386_LIMITS_H_ */
|
3
nbsd_include/arch/i386/include/math.h
Normal file
3
nbsd_include/arch/i386/include/math.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: math.h,v 1.5 2003/10/22 11:54:23 kleink Exp $ */
|
||||
|
||||
#include <x86/math.h>
|
22
nbsd_include/arch/i386/include/mcontext.h
Normal file
22
nbsd_include/arch/i386/include/mcontext.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef _MACHINE_MCONTEXT_H
|
||||
#define _MACHINE_MCONTEXT_H 1
|
||||
|
||||
#include <machine/fpu.h>
|
||||
#include <machine/stackframe.h>
|
||||
|
||||
#define MCF_MAGIC 0xc0ffee
|
||||
|
||||
/* Context to describe processor state */
|
||||
typedef struct __mcontext {
|
||||
int mc_magic;
|
||||
struct stackframe_s mc_p_reg;
|
||||
union fpu_state_u mc_fpu_state;
|
||||
short mc_fpu_flags;
|
||||
} mcontext_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int setmcontext(const mcontext_t *mcp);
|
||||
int getmcontext(mcontext_t *mcp);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACHINE_MCONTEXT_H */
|
199
nbsd_include/arch/i386/include/npx.h
Normal file
199
nbsd_include/arch/i386/include/npx.h
Normal file
|
@ -0,0 +1,199 @@
|
|||
/* $NetBSD: npx.h,v 1.25 2010/07/31 21:47:54 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)npx.h 5.3 (Berkeley) 1/18/91
|
||||
*/
|
||||
|
||||
/*
|
||||
* 287/387 NPX Coprocessor Data Structures and Constants
|
||||
* W. Jolitz 1/90
|
||||
*/
|
||||
|
||||
#ifndef _I386_NPX_H_
|
||||
#define _I386_NPX_H_
|
||||
|
||||
#ifndef __minix
|
||||
/* Environment information of floating point unit */
|
||||
struct env87 {
|
||||
long en_cw; /* control word (16bits) */
|
||||
long en_sw; /* status word (16bits) */
|
||||
long en_tw; /* tag word (16bits) */
|
||||
long en_fip; /* floating point instruction pointer */
|
||||
uint16_t en_fcs; /* floating code segment selector */
|
||||
uint16_t en_opcode; /* opcode last executed (11 bits ) */
|
||||
long en_foo; /* floating operand offset */
|
||||
long en_fos; /* floating operand segment selector */
|
||||
};
|
||||
|
||||
/* Contents of each floating point accumulator */
|
||||
struct fpacc87 {
|
||||
#ifdef dontdef /* too unportable */
|
||||
uint32_t fp_mantlo; /* mantissa low (31:0) */
|
||||
uint32_t fp_manthi; /* mantissa high (63:32) */
|
||||
int fp_exp:15; /* exponent */
|
||||
int fp_sgn:1; /* mantissa sign */
|
||||
#else
|
||||
uint8_t fp_bytes[10];
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Floating point context */
|
||||
struct save87 {
|
||||
struct env87 sv_env; /* floating point control/status */
|
||||
struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */
|
||||
#ifndef dontdef
|
||||
uint32_t sv_ex_sw; /* status word for last exception (was pad) */
|
||||
uint32_t sv_ex_tw; /* tag word for last exception (was pad) */
|
||||
uint8_t sv_pad[8 * 2 - 2 * 4]; /* bogus historical padding */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Environment of FPU/MMX/SSE/SSE2. */
|
||||
struct envxmm {
|
||||
/*0*/ uint16_t en_cw; /* FPU Control Word */
|
||||
uint16_t en_sw; /* FPU Status Word */
|
||||
uint8_t en_tw; /* FPU Tag Word (abridged) */
|
||||
uint8_t en_rsvd0;
|
||||
uint16_t en_opcode; /* FPU Opcode */
|
||||
uint32_t en_fip; /* FPU Instruction Pointer */
|
||||
uint16_t en_fcs; /* FPU IP selector */
|
||||
uint16_t en_rsvd1;
|
||||
/*16*/ uint32_t en_foo; /* FPU Data pointer */
|
||||
uint16_t en_fos; /* FPU Data pointer selector */
|
||||
uint16_t en_rsvd2;
|
||||
uint32_t en_mxcsr; /* MXCSR Register State */
|
||||
uint32_t en_rsvd3;
|
||||
};
|
||||
|
||||
/* FPU regsters in the extended save format. */
|
||||
struct fpaccxmm {
|
||||
uint8_t fp_bytes[10];
|
||||
uint8_t fp_rsvd[6];
|
||||
};
|
||||
|
||||
/* SSE/SSE2 registers. */
|
||||
struct xmmreg {
|
||||
uint8_t sse_bytes[16];
|
||||
};
|
||||
|
||||
/* FPU/MMX/SSE/SSE2 context */
|
||||
struct savexmm {
|
||||
struct envxmm sv_env; /* control/status context */
|
||||
struct fpaccxmm sv_ac[8]; /* ST/MM regs */
|
||||
struct xmmreg sv_xmmregs[8]; /* XMM regs */
|
||||
uint8_t sv_rsvd[16 * 14];
|
||||
/* 512-bytes --- end of hardware portion of save area */
|
||||
uint32_t sv_ex_sw; /* saved SW from last exception */
|
||||
uint32_t sv_ex_tw; /* saved TW from last exception */
|
||||
} __aligned(16);
|
||||
|
||||
union savefpu {
|
||||
struct save87 sv_87;
|
||||
struct savexmm sv_xmm;
|
||||
};
|
||||
#endif /* !__minix */
|
||||
|
||||
/*
|
||||
* The i387 defaults to Intel extended precision mode and round to nearest,
|
||||
* with all exceptions masked.
|
||||
*/
|
||||
#define __INITIAL_NPXCW__ 0x037f
|
||||
/* NetBSD uses IEEE double precision. */
|
||||
#define __NetBSD_NPXCW__ 0x127f
|
||||
/* FreeBSD leaves some exceptions unmasked as well. */
|
||||
#define __FreeBSD_NPXCW__ 0x1272
|
||||
/* iBCS2 goes a bit further and leaves the underflow exception unmasked. */
|
||||
#define __iBCS2_NPXCW__ 0x0262
|
||||
/* Linux just uses the default control word. */
|
||||
#define __Linux_NPXCW__ 0x037f
|
||||
/* SVR4 uses the same control word as iBCS2. */
|
||||
#define __SVR4_NPXCW__ 0x0262
|
||||
|
||||
/*
|
||||
* The default MXCSR value at reset is 0x1f80, IA-32 Instruction
|
||||
* Set Reference, pg. 3-369.
|
||||
*/
|
||||
#define __INITIAL_MXCSR__ 0x1f80
|
||||
|
||||
|
||||
/*
|
||||
* 80387 control word bits
|
||||
*/
|
||||
#define EN_SW_INVOP 0x0001 /* Invalid operation */
|
||||
#define EN_SW_DENORM 0x0002 /* Denormalized operand */
|
||||
#define EN_SW_ZERODIV 0x0004 /* Divide by zero */
|
||||
#define EN_SW_OVERFLOW 0x0008 /* Overflow */
|
||||
#define EN_SW_UNDERFLOW 0x0010 /* Underflow */
|
||||
#define EN_SW_PRECLOSS 0x0020 /* Loss of precision */
|
||||
#define EN_SW_DATACHAIN 0x0080 /* Data chain exception */
|
||||
#define EN_SW_CTL_PREC 0x0300 /* Precision control */
|
||||
#define EN_SW_CTL_ROUND 0x0c00 /* Rounding control */
|
||||
#define EN_SW_CTL_INF 0x1000 /* Infinity control */
|
||||
|
||||
/*
|
||||
* The standard control word from finit is 0x37F, giving:
|
||||
* round to nearest
|
||||
* 64-bit precision
|
||||
* all exceptions masked.
|
||||
*
|
||||
* Now we want:
|
||||
* affine mode (if we decide to support 287's)
|
||||
* round to nearest
|
||||
* 53-bit precision
|
||||
* all exceptions masked.
|
||||
*
|
||||
* 64-bit precision often gives bad results with high level languages
|
||||
* because it makes the results of calculations depend on whether
|
||||
* intermediate values are stored in memory or in FPU registers.
|
||||
*
|
||||
* The iBCS control word has underflow, overflow, zero divide, and invalid
|
||||
* operation exceptions unmasked. But that causes an unexpected exception
|
||||
* in the test program 'paranoia' and makes denormals useless (DBL_MIN / 2
|
||||
* underflows). It doesn't make a lot of sense to trap underflow without
|
||||
* trapping denormals.
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
void probeintr(void);
|
||||
void probetrap(void);
|
||||
int npx586bug1(int, int);
|
||||
void npxinit(struct cpu_info *);
|
||||
void process_xmm_to_s87(const struct savexmm *, struct save87 *);
|
||||
void process_s87_to_xmm(const struct save87 *, struct savexmm *);
|
||||
struct lwp;
|
||||
int npxtrap(struct lwp *);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_NPX_H_ */
|
90
nbsd_include/arch/i386/include/param.h
Normal file
90
nbsd_include/arch/i386/include/param.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* $NetBSD: param.h,v 1.72 2010/02/08 19:02:29 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)param.h 5.8 (Berkeley) 6/28/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_PARAM_H_
|
||||
#define _I386_PARAM_H_
|
||||
|
||||
/*
|
||||
* Machine dependent constants for Intel 386.
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <machine/cpu.h>
|
||||
#endif
|
||||
|
||||
#ifndef _MINIX
|
||||
#define _MACHINE i386
|
||||
#define MACHINE "i386"
|
||||
#define _MACHINE_ARCH i386
|
||||
#define MACHINE_ARCH "i386"
|
||||
#define MID_MACHINE MID_I386
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value
|
||||
* for all data types (int, long, ...). The result is u_int and
|
||||
* must be cast to any desired pointer type.
|
||||
*
|
||||
* ALIGNED_POINTER is a boolean macro that checks whether an address
|
||||
* is valid to fetch data elements of type t from on this architecture.
|
||||
* This does not reflect the optimal alignment, just the possibility
|
||||
* (within reasonable limits).
|
||||
*
|
||||
*/
|
||||
#define ALIGNBYTES (sizeof(int) - 1)
|
||||
#define ALIGN(p) (((u_int)(u_long)(p) + ALIGNBYTES) &~ \
|
||||
ALIGNBYTES)
|
||||
#define ALIGNED_POINTER(p,t) 1
|
||||
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
#define NBPG (1 << PGSHIFT) /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
|
||||
|
||||
/*
|
||||
* Mach derived conversion macros
|
||||
*/
|
||||
#define x86_round_pdr(x) \
|
||||
((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
|
||||
#define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
|
||||
#define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
|
||||
#define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
|
||||
#define x86_round_page(x) ((((paddr_t)(x)) + PGOFSET) & ~PGOFSET)
|
||||
#define x86_trunc_page(x) ((paddr_t)(x) & ~PGOFSET)
|
||||
#define x86_btop(x) ((paddr_t)(x) >> PGSHIFT)
|
||||
#define x86_ptob(x) ((paddr_t)(x) << PGSHIFT)
|
||||
|
||||
#endif /* _I386_PARAM_H_ */
|
137
nbsd_include/arch/i386/include/profile.h
Normal file
137
nbsd_include/arch/i386/include/profile.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
/* $NetBSD: profile.h,v 1.33 2007/12/20 23:46:13 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 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.
|
||||
*
|
||||
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_multiprocessor.h"
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/lock.h>
|
||||
#endif
|
||||
|
||||
#define _MCOUNT_DECL static __inline void _mcount
|
||||
|
||||
#ifdef __ELF__
|
||||
#define MCOUNT_ENTRY "__mcount"
|
||||
#define MCOUNT_COMPAT __weak_alias(mcount, __mcount)
|
||||
#else
|
||||
#define MCOUNT_ENTRY "mcount"
|
||||
#define MCOUNT_COMPAT /* nothing */
|
||||
#endif
|
||||
|
||||
#define MCOUNT \
|
||||
MCOUNT_COMPAT \
|
||||
extern void mcount(void) __asm(MCOUNT_ENTRY) \
|
||||
__attribute__((__no_instrument_function__)); \
|
||||
void \
|
||||
mcount(void) \
|
||||
{ \
|
||||
int selfpc, frompcindex; \
|
||||
int eax, ecx, edx; \
|
||||
\
|
||||
__asm volatile("movl %%eax,%0" : "=g" (eax)); \
|
||||
__asm volatile("movl %%ecx,%0" : "=g" (ecx)); \
|
||||
__asm volatile("movl %%edx,%0" : "=g" (edx)); \
|
||||
/* \
|
||||
* find the return address for mcount, \
|
||||
* and the return address for mcount's caller. \
|
||||
* \
|
||||
* selfpc = pc pushed by mcount call \
|
||||
*/ \
|
||||
__asm volatile("movl 4(%%ebp),%0" : "=r" (selfpc)); \
|
||||
/* \
|
||||
* frompcindex = pc pushed by call into self. \
|
||||
*/ \
|
||||
__asm volatile("movl (%%ebp),%0;movl 4(%0),%0" \
|
||||
: "=r" (frompcindex)); \
|
||||
_mcount((u_long)frompcindex, (u_long)selfpc); \
|
||||
\
|
||||
__asm volatile("movl %0,%%edx" : : "g" (edx)); \
|
||||
__asm volatile("movl %0,%%ecx" : : "g" (ecx)); \
|
||||
__asm volatile("movl %0,%%eax" : : "g" (eax)); \
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifdef MULTIPROCESSOR
|
||||
__cpu_simple_lock_t __mcount_lock;
|
||||
|
||||
static inline void
|
||||
MCOUNT_ENTER_MP(void)
|
||||
{
|
||||
__cpu_simple_lock(&__mcount_lock);
|
||||
__insn_barrier();
|
||||
}
|
||||
|
||||
static inline void
|
||||
MCOUNT_EXIT_MP(void)
|
||||
{
|
||||
__insn_barrier();
|
||||
__mcount_lock = __SIMPLELOCK_UNLOCKED;
|
||||
}
|
||||
#else
|
||||
#define MCOUNT_ENTER_MP()
|
||||
#define MCOUNT_EXIT_MP()
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
mcount_disable_intr(void)
|
||||
{
|
||||
__asm volatile("cli");
|
||||
}
|
||||
|
||||
static inline u_long
|
||||
mcount_read_psl(void)
|
||||
{
|
||||
u_long ef;
|
||||
|
||||
__asm volatile("pushfl; popl %0" : "=r" (ef));
|
||||
return (ef);
|
||||
}
|
||||
|
||||
static inline void
|
||||
mcount_write_psl(u_long ef)
|
||||
{
|
||||
__asm volatile("pushl %0; popfl" : : "r" (ef));
|
||||
}
|
||||
|
||||
#define MCOUNT_ENTER \
|
||||
s = (int)mcount_read_psl(); \
|
||||
mcount_disable_intr(); \
|
||||
MCOUNT_ENTER_MP();
|
||||
|
||||
#define MCOUNT_EXIT \
|
||||
MCOUNT_EXIT_MP(); \
|
||||
mcount_write_psl(s);
|
||||
|
||||
#endif /* _KERNEL */
|
7
nbsd_include/arch/i386/include/setjmp.h
Normal file
7
nbsd_include/arch/i386/include/setjmp.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: setjmp.h,v 1.2 1998/09/14 21:31:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* machine/setjmp.h: machine dependent setjmp-related information.
|
||||
*/
|
||||
|
||||
#define _JBLEN 13 /* size, in longs, of a jmp_buf */
|
64
nbsd_include/arch/i386/include/signal.h
Normal file
64
nbsd_include/arch/i386/include/signal.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef _I386_SIGNAL_H_
|
||||
#define _I386_SIGNAL_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
/* The following structure should match the stackframe_s structure used
|
||||
* by the kernel's context switching code. Floating point registers should
|
||||
* be added in a different struct.
|
||||
*/
|
||||
|
||||
#include <machine/stackframe.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
typedef struct stackframe_s sigregs;
|
||||
struct sigframe { /* stack frame created for signalled process */
|
||||
void (*sf_retadr)(void);
|
||||
int sf_signo;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
int sf_fp;
|
||||
void (*sf_retadr2)(void);
|
||||
struct sigcontext *sf_scpcopy;
|
||||
};
|
||||
|
||||
struct sigcontext {
|
||||
int sc_flags; /* sigstack state to restore (including
|
||||
* MF_FPU_INITIALIZED)
|
||||
*/
|
||||
long sc_mask; /* signal mask to restore */
|
||||
sigregs sc_regs; /* register set to restore */
|
||||
union fpu_state_u sc_fpu_state;
|
||||
};
|
||||
|
||||
#if _WORD_SIZE == 4
|
||||
#define sc_gs sc_regs.gs
|
||||
#define sc_fs sc_regs.fs
|
||||
#endif /* _WORD_SIZE == 4 */
|
||||
#define sc_es sc_regs.es
|
||||
#define sc_ds sc_regs.ds
|
||||
#define sc_di sc_regs.di
|
||||
#define sc_si sc_regs.si
|
||||
#define sc_fp sc_regs.bp
|
||||
#define sc_st sc_regs.st /* stack top -- used in kernel */
|
||||
#define sc_bx sc_regs.bx
|
||||
#define sc_dx sc_regs.dx
|
||||
#define sc_cx sc_regs.cx
|
||||
#define sc_retreg sc_regs.retreg
|
||||
#define sc_retadr sc_regs.retadr /* return address to caller of
|
||||
save -- used in kernel */
|
||||
#define sc_pc sc_regs.pc
|
||||
#define sc_cs sc_regs.cs
|
||||
#define sc_psw sc_regs.psw
|
||||
#define sc_sp sc_regs.sp
|
||||
#define sc_ss sc_regs.ss
|
||||
|
||||
#ifdef _MINIX
|
||||
__BEGIN_DECLS
|
||||
int sigreturn(struct sigcontext *_scp);
|
||||
__END_DECLS
|
||||
#endif /* _MINIX */
|
||||
|
||||
#endif /* !_I386_SIGNAL_H_ */
|
86
nbsd_include/arch/i386/include/stdarg.h
Normal file
86
nbsd_include/arch/i386/include/stdarg.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* $NetBSD: stdarg.h,v 1.23 2009/08/18 17:40:39 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. 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.
|
||||
*
|
||||
* @(#)stdarg.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _I386_STDARG_H_
|
||||
#define _I386_STDARG_H_
|
||||
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
typedef _BSD_VA_LIST_ va_list;
|
||||
|
||||
#ifdef __lint__
|
||||
#define __builtin_next_arg(t) ((t) ? 0 : 0)
|
||||
#define __builtin_stdarg_start(a, l) ((a) = ((l) ? 0 : 0))
|
||||
#define __builtin_va_arg(a, t) ((a) ? 0 : 0)
|
||||
#define __builtin_va_end /* nothing */
|
||||
#define __builtin_va_copy(d, s) ((d) = (s))
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 1)
|
||||
#define va_start(ap, last) __builtin_va_start((ap), (last))
|
||||
#define va_arg __builtin_va_arg
|
||||
#define va_end __builtin_va_end
|
||||
#define __va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
#elif __GNUC_PREREQ__(2, 96)
|
||||
#define va_start(ap, last) __builtin_stdarg_start((ap), (last))
|
||||
#define va_arg __builtin_va_arg
|
||||
#define va_end __builtin_va_end
|
||||
#define __va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
#elif defined(__PCC__)
|
||||
#define va_start(ap, last) __builtin_stdarg_start((ap), (last))
|
||||
#define va_arg __builtin_va_arg
|
||||
#define va_end __builtin_va_end
|
||||
#define __va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
#else
|
||||
#define __va_size(type) \
|
||||
(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
|
||||
|
||||
#define va_start(ap, last) \
|
||||
((ap) = (va_list)__builtin_next_arg(last))
|
||||
|
||||
#define va_arg(ap, type) \
|
||||
(*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type)))
|
||||
|
||||
#define va_end(ap)
|
||||
|
||||
#define __va_copy(dest, src) ((dest) = (src))
|
||||
#endif
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && \
|
||||
(defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
|
||||
defined(_NETBSD_SOURCE))
|
||||
#define va_copy(dest, src) __va_copy((dest), (src))
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_STDARG_H_ */
|
120
nbsd_include/arch/i386/include/types.h
Normal file
120
nbsd_include/arch/i386/include/types.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
/* $NetBSD: types.h,v 1.70 2010/12/22 04:15:02 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 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 7.5 (Berkeley) 3/9/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_MACHTYPES_H_
|
||||
#define _I386_MACHTYPES_H_
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_xen.h"
|
||||
#endif
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <machine/int_types.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
typedef struct label_t {
|
||||
int val[6];
|
||||
} label_t;
|
||||
#endif
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#if defined(_KERNEL)
|
||||
|
||||
/*
|
||||
* XXX JYM for now, in kernel paddr_t can be 32 or 64 bits, depending
|
||||
* on PAE. Revisit when paddr_t becomes 64 bits for !PAE systems.
|
||||
*/
|
||||
#ifdef PAE
|
||||
typedef __uint64_t paddr_t;
|
||||
typedef __uint64_t psize_t;
|
||||
#define PRIxPADDR "llx"
|
||||
#define PRIxPSIZE "llx"
|
||||
#define PRIuPSIZE "llu"
|
||||
#else /* PAE */
|
||||
typedef unsigned long paddr_t;
|
||||
typedef unsigned long psize_t;
|
||||
#define PRIxPADDR "lx"
|
||||
#define PRIxPSIZE "lx"
|
||||
#define PRIuPSIZE "lu"
|
||||
#endif /* PAE */
|
||||
|
||||
#else /* _KERNEL */
|
||||
/* paddr_t is always 64 bits for userland */
|
||||
typedef __uint64_t paddr_t;
|
||||
typedef __uint64_t psize_t;
|
||||
#define PRIxPADDR "llx"
|
||||
#define PRIxPSIZE "llx"
|
||||
#define PRIuPSIZE "llu"
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
typedef unsigned long vaddr_t;
|
||||
typedef unsigned long vsize_t;
|
||||
#define PRIxVADDR "lx"
|
||||
#define PRIxVSIZE "lx"
|
||||
#define PRIuVSIZE "lu"
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
typedef int pmc_evid_t;
|
||||
typedef __uint64_t pmc_ctr_t;
|
||||
typedef int register_t;
|
||||
#define PRIxREGISTER "x"
|
||||
|
||||
typedef volatile unsigned char __cpu_simple_lock_t;
|
||||
|
||||
/* __cpu_simple_lock_t used to be a full word. */
|
||||
#define __CPU_SIMPLE_LOCK_PAD
|
||||
|
||||
#define __SIMPLELOCK_LOCKED 1
|
||||
#define __SIMPLELOCK_UNLOCKED 0
|
||||
|
||||
/* The x86 does not have strict alignment requirements. */
|
||||
#define __NO_STRICT_ALIGNMENT
|
||||
|
||||
#define __HAVE_DEVICE_REGISTER
|
||||
#define __HAVE_CPU_DATA_FIRST
|
||||
#define __HAVE_CPU_COUNTER
|
||||
#define __HAVE_MD_CPU_OFFLINE
|
||||
#define __HAVE_SYSCALL_INTERN
|
||||
#define __HAVE_MINIMAL_EMUL
|
||||
#define __HAVE_OLD_DISKLABEL
|
||||
#define __HAVE_ATOMIC64_OPS
|
||||
#define __HAVE_ATOMIC_AS_MEMBAR
|
||||
#define __HAVE_CPU_LWP_SETPRIVATE
|
||||
#define __HAVE_INTR_CONTROL
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#define __HAVE_RAS
|
||||
#endif
|
||||
|
||||
#endif /* _I386_MACHTYPES_H_ */
|
52
nbsd_include/arch/i386/include/vmparam.h
Normal file
52
nbsd_include/arch/i386/include/vmparam.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: vmparam.h,v 1.72 2010/11/14 13:33:21 uebayasi Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)vmparam.h 5.9 (Berkeley) 5/12/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_VMPARAM_H_
|
||||
#define _I386_VMPARAM_H_
|
||||
|
||||
/*
|
||||
* Machine dependent constants for 386.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Page size on the IA-32 is not variable in the traditional sense.
|
||||
* We override the PAGE_* definitions to compile-time constants.
|
||||
*/
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_MASK (PAGE_SIZE - 1)
|
||||
|
||||
#endif /* _I386_VMPARAM_H_ */
|
47
nbsd_include/arch/i386/include/wchar_limits.h
Normal file
47
nbsd_include/arch/i386/include/wchar_limits.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: wchar_limits.h,v 1.2 2008/04/28 20:23:24 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* 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 _I386_WCHAR_LIMITS_H_
|
||||
#define _I386_WCHAR_LIMITS_H_
|
||||
|
||||
/*
|
||||
* 7.18.3 Limits of other integer types
|
||||
*/
|
||||
|
||||
/* limits of wchar_t */
|
||||
#define WCHAR_MIN (-0x7fffffff-1) /* wchar_t */
|
||||
#define WCHAR_MAX 0x7fffffff /* wchar_t */
|
||||
|
||||
/* limits of wint_t */
|
||||
#define WINT_MIN (-0x7fffffff-1) /* wint_t */
|
||||
#define WINT_MAX 0x7fffffff /* wint_t */
|
||||
|
||||
#endif /* !_I386_WCHAR_LIMITS_H_ */
|
10
nbsd_include/arch/x86/include/Makefile
Normal file
10
nbsd_include/arch/x86/include/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: Makefile,v 1.13 2008/05/11 15:32:20 ad Exp $
|
||||
|
||||
INCSDIR=/usr/netbsd/include/x86
|
||||
|
||||
INCS= float.h \
|
||||
ieee.h \
|
||||
ieeefp.h \
|
||||
math.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
27
nbsd_include/arch/x86/include/float.h
Normal file
27
nbsd_include/arch/x86/include/float.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* $NetBSD: float.h,v 1.5 2003/10/23 23:26:06 kleink Exp $ */
|
||||
|
||||
#ifndef _X86_FLOAT_H_
|
||||
#define _X86_FLOAT_H_
|
||||
|
||||
#define LDBL_MANT_DIG 64
|
||||
#define LDBL_EPSILON 1.0842021724855044340E-19L
|
||||
#define LDBL_DIG 18
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.3621031431120935063E-4932L
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.1897314953572317650E+4932L
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
|
||||
#include <sys/float_ieee754.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||
!defined(_XOPEN_SOURCE) || \
|
||||
((__STDC_VERSION__ - 0) >= 199901L) || \
|
||||
((_POSIX_C_SOURCE - 0) >= 200112L) || \
|
||||
((_XOPEN_SOURCE - 0) >= 600) || \
|
||||
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define DECIMAL_DIG 21
|
||||
#endif /* !defined(_ANSI_SOURCE) && ... */
|
||||
|
||||
#endif /* _X86_FLOAT_H_ */
|
117
nbsd_include/arch/x86/include/ieee.h
Normal file
117
nbsd_include/arch/x86/include/ieee.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* $NetBSD: ieee.h,v 1.11 2010/09/15 16:11:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||
* floating point. It does *not* define (yet?) any of the rounding
|
||||
* mode bits, exceptions, and so forth.
|
||||
*/
|
||||
|
||||
#include <sys/ieee754.h>
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 32
|
||||
#define EXT_FRACLBITS 32
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)(u).extu_ext.ext_fracl; \
|
||||
(a)[1] = (uint32_t)(u).extu_ext.ext_frach; \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* struct ieee_ext is the raw storage layout of the 80-bit
|
||||
* extended-precision type as implemented by the FPU. Per the
|
||||
* respective ABI specifications, it is followed by a tail padding of
|
||||
*
|
||||
* amd64: 48 bits,
|
||||
* i386: 16 bits.
|
||||
*/
|
||||
struct ieee_ext {
|
||||
u_int ext_fracl:EXT_FRACLBITS;
|
||||
u_int ext_frach:EXT_FRACHBITS;
|
||||
#if 0
|
||||
u_int ext_int:1;
|
||||
#endif
|
||||
u_int ext_exp:EXT_EXPBITS;
|
||||
u_int ext_sign:1;
|
||||
};
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
|
||||
* high fraction; if the bit is set, it is a `quiet NaN'.
|
||||
*/
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#define EXT_EXP_INF 0x7fff
|
||||
#define EXT_EXP_NAN 0x7fff
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#define EXT_QUIETNAN (1 << 30)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define EXT_EXP_BIAS 16383
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
|
||||
#define LDBL_NBIT 0x80000000
|
||||
#define mask_nbit_l(u) ((u).extu_frach &= ~LDBL_NBIT)
|
29
nbsd_include/arch/x86/include/ieeefp.h
Normal file
29
nbsd_include/arch/x86/include/ieeefp.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.3 2010/07/31 21:47:54 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin, Apr 6, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#ifndef _X86_IEEEFP_H_
|
||||
#define _X86_IEEEFP_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <machine/fenv.h>
|
||||
|
||||
typedef int fp_except;
|
||||
#define FP_X_INV FE_INVALID /* invalid operation exception */
|
||||
#define FP_X_DNML FE_DENORMAL /* denormalization exception */
|
||||
#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
|
||||
#define FP_X_OFL FE_OVERFLOW /* overflow exception */
|
||||
#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
|
||||
#define FP_X_IMP FE_INEXACT /* imprecise (loss of precision) */
|
||||
|
||||
typedef enum {
|
||||
FP_RN=FE_TONEAREST, /* round to nearest representable number */
|
||||
FP_RM=FE_DOWNWARD, /* round toward negative infinity */
|
||||
FP_RP=FE_UPWARD, /* round toward positive infinity */
|
||||
FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */
|
||||
} fp_rnd;
|
||||
|
||||
#endif /* _X86_IEEEFP_H_ */
|
4
nbsd_include/arch/x86/include/math.h
Normal file
4
nbsd_include/arch/x86/include/math.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: math.h,v 1.2 2003/10/28 00:55:28 kleink Exp $ */
|
||||
|
||||
#define __HAVE_LONG_DOUBLE
|
||||
#define __HAVE_NANF
|
12
nbsd_include/minix/Makefile
Normal file
12
nbsd_include/minix/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
|||
NOOBJ= # defined
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
INCSDIR= /usr/netbsd/include/minix
|
||||
|
||||
INCS+= paths.h types.h
|
||||
|
||||
.include "${MINIXSRCDIR}/common/include/sys/Makefile.mount.inc"
|
||||
.include "${MINIXSRCDIR}/common/include/Makefile.termios.inc"
|
||||
|
||||
.include <bsd.kinc.mk>
|
7
nbsd_include/minix/paths.h
Normal file
7
nbsd_include/minix/paths.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef _MINIX_PATHS_H_
|
||||
#define _MINIX_PATHS_H_
|
||||
|
||||
#define _PATH_SERVICE "/bin/service"
|
||||
#define _PATH_PROC "/proc/"
|
||||
|
||||
#endif /* _MINIX_PATHS_H_ */
|
8
nbsd_include/minix/types.h
Normal file
8
nbsd_include/minix/types.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef _MINIX_TYPES_H_
|
||||
#define _MINIX_TYPES_H_
|
||||
|
||||
/* Dummy file used in legacy (and shared) minix includes. */
|
||||
#include <sys/types.h>
|
||||
#include <sys/sigtypes.h>
|
||||
|
||||
#endif
|
5
nbsd_include/net/Makefile
Normal file
5
nbsd_include/net/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
INCSDIR= /usr/netbsd/include/net
|
||||
|
||||
INCS+= hton.h ethertypes.h if.h if_ether.h netlib.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
313
nbsd_include/net/ethertypes.h
Normal file
313
nbsd_include/net/ethertypes.h
Normal file
|
@ -0,0 +1,313 @@
|
|||
/* $NetBSD: ethertypes.h,v 1.17 2005/12/10 23:21:38 elad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ethernet protocol types.
|
||||
*
|
||||
* According to "assigned numbers", the Ethernet protocol numbers are also
|
||||
* used as ARP protocol type numbers.
|
||||
*
|
||||
* I factor them out here to avoid pulling all the Ethernet header file
|
||||
* into the hardware independent ARP code. -is
|
||||
*
|
||||
* Additional sources of information:
|
||||
* http://www.mit.edu/~map/Ethernet/Ethernet.txt
|
||||
* ftp://venera.isi.edu/in-notes/iana/assignments/ethernet-numbers
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NET_ETHERTYPES_H_
|
||||
#define _NET_ETHERTYPES_H_
|
||||
|
||||
/*
|
||||
* NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields.
|
||||
* However, there are some conflicts.
|
||||
*/
|
||||
|
||||
#define ETHERTYPE_8023 0x0004 /* IEEE 802.3 packet */
|
||||
/* 0x0101 .. 0x1FF Experimental */
|
||||
#define ETHERTYPE_PUP 0x0200 /* Xerox PUP protocol - see 0A00 */
|
||||
#define ETHERTYPE_PUPAT 0x0200 /* PUP Address Translation - see 0A01 */
|
||||
#define ETHERTYPE_SPRITE 0x0500 /* ??? */
|
||||
/* 0x0400 Nixdorf */
|
||||
#define ETHERTYPE_NS 0x0600 /* XNS */
|
||||
#define ETHERTYPE_NSAT 0x0601 /* XNS Address Translation (3Mb only) */
|
||||
#define ETHERTYPE_DLOG1 0x0660 /* DLOG (?) */
|
||||
#define ETHERTYPE_DLOG2 0x0661 /* DLOG (?) */
|
||||
#define ETHERTYPE_IP 0x0800 /* IP protocol */
|
||||
#define ETHERTYPE_X75 0x0801 /* X.75 Internet */
|
||||
#define ETHERTYPE_NBS 0x0802 /* NBS Internet */
|
||||
#define ETHERTYPE_ECMA 0x0803 /* ECMA Internet */
|
||||
#define ETHERTYPE_CHAOS 0x0804 /* CHAOSnet */
|
||||
#define ETHERTYPE_X25 0x0805 /* X.25 Level 3 */
|
||||
#define ETHERTYPE_ARP 0x0806 /* Address resolution protocol */
|
||||
#define ETHERTYPE_NSCOMPAT 0x0807 /* XNS Compatibility */
|
||||
#define ETHERTYPE_FRARP 0x0808 /* Frame Relay ARP (RFC1701) */
|
||||
/* 0x081C Symbolics Private */
|
||||
/* 0x0888 - 0x088A Xyplex */
|
||||
#define ETHERTYPE_UBDEBUG 0x0900 /* Ungermann-Bass network debugger */
|
||||
#define ETHERTYPE_IEEEPUP 0x0A00 /* Xerox IEEE802.3 PUP */
|
||||
#define ETHERTYPE_IEEEPUPAT 0x0A01 /* Xerox IEEE802.3 PUP Address Translation */
|
||||
#define ETHERTYPE_VINES 0x0BAD /* Banyan VINES */
|
||||
#define ETHERTYPE_VINESLOOP 0x0BAE /* Banyan VINES Loopback */
|
||||
#define ETHERTYPE_VINESECHO 0x0BAF /* Banyan VINES Echo */
|
||||
|
||||
/* 0x1000 - 0x100F Berkeley Trailer */
|
||||
/*
|
||||
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
|
||||
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
|
||||
* by an ETHER type (as given above) and then the (variable-length) header.
|
||||
*/
|
||||
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
|
||||
#define ETHERTYPE_NTRAILER 16
|
||||
|
||||
#define ETHERTYPE_DCA 0x1234 /* DCA - Multicast */
|
||||
#define ETHERTYPE_VALID 0x1600 /* VALID system protocol */
|
||||
#define ETHERTYPE_DOGFIGHT 0x1989 /* Artificial Horizons ("Aviator" dogfight simulator [on Sun]) */
|
||||
#define ETHERTYPE_RCL 0x1995 /* Datapoint Corporation (RCL lan protocol) */
|
||||
|
||||
/* The following 3C0x types
|
||||
are unregistered: */
|
||||
#define ETHERTYPE_NBPVCD 0x3C00 /* 3Com NBP virtual circuit datagram (like XNS SPP) not registered */
|
||||
#define ETHERTYPE_NBPSCD 0x3C01 /* 3Com NBP System control datagram not registered */
|
||||
#define ETHERTYPE_NBPCREQ 0x3C02 /* 3Com NBP Connect request (virtual cct) not registered */
|
||||
#define ETHERTYPE_NBPCRSP 0x3C03 /* 3Com NBP Connect repsonse not registered */
|
||||
#define ETHERTYPE_NBPCC 0x3C04 /* 3Com NBP Connect complete not registered */
|
||||
#define ETHERTYPE_NBPCLREQ 0x3C05 /* 3Com NBP Close request (virtual cct) not registered */
|
||||
#define ETHERTYPE_NBPCLRSP 0x3C06 /* 3Com NBP Close response not registered */
|
||||
#define ETHERTYPE_NBPDG 0x3C07 /* 3Com NBP Datagram (like XNS IDP) not registered */
|
||||
#define ETHERTYPE_NBPDGB 0x3C08 /* 3Com NBP Datagram broadcast not registered */
|
||||
#define ETHERTYPE_NBPCLAIM 0x3C09 /* 3Com NBP Claim NetBIOS name not registered */
|
||||
#define ETHERTYPE_NBPDLTE 0x3C0A /* 3Com NBP Delete Netbios name not registered */
|
||||
#define ETHERTYPE_NBPRAS 0x3C0B /* 3Com NBP Remote adaptor status request not registered */
|
||||
#define ETHERTYPE_NBPRAR 0x3C0C /* 3Com NBP Remote adaptor response not registered */
|
||||
#define ETHERTYPE_NBPRST 0x3C0D /* 3Com NBP Reset not registered */
|
||||
|
||||
#define ETHERTYPE_PCS 0x4242 /* PCS Basic Block Protocol */
|
||||
#define ETHERTYPE_IMLBLDIAG 0x424C /* Information Modes Little Big LAN diagnostic */
|
||||
#define ETHERTYPE_DIDDLE 0x4321 /* THD - Diddle */
|
||||
#define ETHERTYPE_IMLBL 0x4C42 /* Information Modes Little Big LAN */
|
||||
#define ETHERTYPE_SIMNET 0x5208 /* BBN Simnet Private */
|
||||
#define ETHERTYPE_DECEXPER 0x6000 /* DEC Unassigned, experimental */
|
||||
#define ETHERTYPE_MOPDL 0x6001 /* DEC MOP dump/load */
|
||||
#define ETHERTYPE_MOPRC 0x6002 /* DEC MOP remote console */
|
||||
#define ETHERTYPE_DECnet 0x6003 /* DEC DECNET Phase IV route */
|
||||
#define ETHERTYPE_DN ETHERTYPE_DECnet /* libpcap, tcpdump */
|
||||
#define ETHERTYPE_LAT 0x6004 /* DEC LAT */
|
||||
#define ETHERTYPE_DECDIAG 0x6005 /* DEC diagnostic protocol (at interface initialization?) */
|
||||
#define ETHERTYPE_DECCUST 0x6006 /* DEC customer protocol */
|
||||
#define ETHERTYPE_SCA 0x6007 /* DEC LAVC, SCA */
|
||||
#define ETHERTYPE_AMBER 0x6008 /* DEC AMBER */
|
||||
#define ETHERTYPE_DECMUMPS 0x6009 /* DEC MUMPS */
|
||||
/* 0x6010 - 0x6014 3Com Corporation */
|
||||
#define ETHERTYPE_TRANSETHER 0x6558 /* Trans Ether Bridging (RFC1701)*/
|
||||
#define ETHERTYPE_RAWFR 0x6559 /* Raw Frame Relay (RFC1701) */
|
||||
#define ETHERTYPE_UBDL 0x7000 /* Ungermann-Bass download */
|
||||
#define ETHERTYPE_UBNIU 0x7001 /* Ungermann-Bass NIUs */
|
||||
#define ETHERTYPE_UBDIAGLOOP 0x7002 /* Ungermann-Bass diagnostic/loopback */
|
||||
#define ETHERTYPE_UBNMC 0x7003 /* Ungermann-Bass ??? (NMC to/from UB Bridge) */
|
||||
#define ETHERTYPE_UBBST 0x7005 /* Ungermann-Bass Bridge Spanning Tree */
|
||||
#define ETHERTYPE_OS9 0x7007 /* OS/9 Microware */
|
||||
#define ETHERTYPE_OS9NET 0x7009 /* OS/9 Net? */
|
||||
/* 0x7020 - 0x7029 LRT (England) (now Sintrom) */
|
||||
#define ETHERTYPE_RACAL 0x7030 /* Racal-Interlan */
|
||||
#define ETHERTYPE_PRIMENTS 0x7031 /* Prime NTS (Network Terminal Service) */
|
||||
#define ETHERTYPE_CABLETRON 0x7034 /* Cabletron */
|
||||
#define ETHERTYPE_CRONUSVLN 0x8003 /* Cronus VLN */
|
||||
#define ETHERTYPE_CRONUS 0x8004 /* Cronus Direct */
|
||||
#define ETHERTYPE_HP 0x8005 /* HP Probe */
|
||||
#define ETHERTYPE_NESTAR 0x8006 /* Nestar */
|
||||
#define ETHERTYPE_ATTSTANFORD 0x8008 /* AT&T/Stanford (local use) */
|
||||
#define ETHERTYPE_EXCELAN 0x8010 /* Excelan */
|
||||
#define ETHERTYPE_SG_DIAG 0x8013 /* SGI diagnostic type */
|
||||
#define ETHERTYPE_SG_NETGAMES 0x8014 /* SGI network games */
|
||||
#define ETHERTYPE_SG_RESV 0x8015 /* SGI reserved type */
|
||||
#define ETHERTYPE_SG_BOUNCE 0x8016 /* SGI bounce server */
|
||||
#define ETHERTYPE_APOLLODOMAIN 0x8019 /* Apollo DOMAIN */
|
||||
#define ETHERTYPE_TYMSHARE 0x802E /* Tymeshare */
|
||||
#define ETHERTYPE_TIGAN 0x802F /* Tigan, Inc. */
|
||||
#define ETHERTYPE_REVARP 0x8035 /* Reverse addr resolution protocol */
|
||||
#define ETHERTYPE_AEONIC 0x8036 /* Aeonic Systems */
|
||||
#define ETHERTYPE_IPXNEW 0x8037 /* IPX (Novell Netware?) */
|
||||
#define ETHERTYPE_LANBRIDGE 0x8038 /* DEC LANBridge */
|
||||
#define ETHERTYPE_DSMD 0x8039 /* DEC DSM/DDP */
|
||||
#define ETHERTYPE_ARGONAUT 0x803A /* DEC Argonaut Console */
|
||||
#define ETHERTYPE_VAXELN 0x803B /* DEC VAXELN */
|
||||
#define ETHERTYPE_DECDNS 0x803C /* DEC DNS Naming Service */
|
||||
#define ETHERTYPE_ENCRYPT 0x803D /* DEC Ethernet Encryption */
|
||||
#define ETHERTYPE_DECDTS 0x803E /* DEC Distributed Time Service */
|
||||
#define ETHERTYPE_DECLTM 0x803F /* DEC LAN Traffic Monitor */
|
||||
#define ETHERTYPE_DECNETBIOS 0x8040 /* DEC PATHWORKS DECnet NETBIOS Emulation */
|
||||
#define ETHERTYPE_DECLAST 0x8041 /* DEC Local Area System Transport */
|
||||
/* 0x8042 DEC Unassigned */
|
||||
#define ETHERTYPE_PLANNING 0x8044 /* Planning Research Corp. */
|
||||
/* 0x8046 - 0x8047 AT&T */
|
||||
#define ETHERTYPE_DECAM 0x8048 /* DEC Availability Manager for Distributed Systems DECamds (but someone at DEC says not) */
|
||||
#define ETHERTYPE_EXPERDATA 0x8049 /* ExperData */
|
||||
#define ETHERTYPE_VEXP 0x805B /* Stanford V Kernel exp. */
|
||||
#define ETHERTYPE_VPROD 0x805C /* Stanford V Kernel prod. */
|
||||
#define ETHERTYPE_ES 0x805D /* Evans & Sutherland */
|
||||
#define ETHERTYPE_LITTLE 0x8060 /* Little Machines */
|
||||
#define ETHERTYPE_COUNTERPOINT 0x8062 /* Counterpoint Computers */
|
||||
/* 0x8065 - 0x8066 Univ. of Mass @ Amherst */
|
||||
#define ETHERTYPE_VEECO 0x8067 /* Veeco Integrated Auto. */
|
||||
#define ETHERTYPE_GENDYN 0x8068 /* General Dynamics */
|
||||
#define ETHERTYPE_ATT 0x8069 /* AT&T */
|
||||
#define ETHERTYPE_AUTOPHON 0x806A /* Autophon */
|
||||
#define ETHERTYPE_COMDESIGN 0x806C /* ComDesign */
|
||||
#define ETHERTYPE_COMPUGRAPHIC 0x806D /* Compugraphic Corporation */
|
||||
/* 0x806E - 0x8077 Landmark Graphics Corp. */
|
||||
#define ETHERTYPE_MATRA 0x807A /* Matra */
|
||||
#define ETHERTYPE_DDE 0x807B /* Dansk Data Elektronik */
|
||||
#define ETHERTYPE_MERIT 0x807C /* Merit Internodal (or Univ of Michigan?) */
|
||||
/* 0x807D - 0x807F Vitalink Communications */
|
||||
#define ETHERTYPE_VLTLMAN 0x8080 /* Vitalink TransLAN III Management */
|
||||
/* 0x8081 - 0x8083 Counterpoint Computers */
|
||||
/* 0x8088 - 0x808A Xyplex */
|
||||
#define ETHERTYPE_ATALK 0x809B /* AppleTalk */
|
||||
#define ETHERTYPE_AT ETHERTYPE_ATALK /* old NetBSD */
|
||||
#define ETHERTYPE_APPLETALK ETHERTYPE_ATALK /* HP-UX */
|
||||
/* 0x809C - 0x809E Datability */
|
||||
#define ETHERTYPE_SPIDER 0x809F /* Spider Systems Ltd. */
|
||||
/* 0x80A3 Nixdorf */
|
||||
/* 0x80A4 - 0x80B3 Siemens Gammasonics Inc. */
|
||||
/* 0x80C0 - 0x80C3 DCA (Digital Comm. Assoc.) Data Exchange Cluster */
|
||||
/* 0x80C4 - 0x80C5 Banyan Systems */
|
||||
#define ETHERTYPE_PACER 0x80C6 /* Pacer Software */
|
||||
#define ETHERTYPE_APPLITEK 0x80C7 /* Applitek Corporation */
|
||||
/* 0x80C8 - 0x80CC Intergraph Corporation */
|
||||
/* 0x80CD - 0x80CE Harris Corporation */
|
||||
/* 0x80CF - 0x80D2 Taylor Instrument */
|
||||
/* 0x80D3 - 0x80D4 Rosemount Corporation */
|
||||
#define ETHERTYPE_SNA 0x80D5 /* IBM SNA Services over Ethernet */
|
||||
#define ETHERTYPE_VARIAN 0x80DD /* Varian Associates */
|
||||
/* 0x80DE - 0x80DF TRFS (Integrated Solutions Transparent Remote File System) */
|
||||
/* 0x80E0 - 0x80E3 Allen-Bradley */
|
||||
/* 0x80E4 - 0x80F0 Datability */
|
||||
#define ETHERTYPE_RETIX 0x80F2 /* Retix */
|
||||
#define ETHERTYPE_AARP 0x80F3 /* AppleTalk AARP */
|
||||
/* 0x80F4 - 0x80F5 Kinetics */
|
||||
#define ETHERTYPE_APOLLO 0x80F7 /* Apollo Computer */
|
||||
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging (XXX conflicts) */
|
||||
/* 0x80FF - 0x8101 Wellfleet Communications (XXX conflicts) */
|
||||
#define ETHERTYPE_BOFL 0x8102 /* Wellfleet; BOFL (Breath OF Life) pkts [every 5-10 secs.] */
|
||||
#define ETHERTYPE_WELLFLEET 0x8103 /* Wellfleet Communications */
|
||||
/* 0x8107 - 0x8109 Symbolics Private */
|
||||
#define ETHERTYPE_TALARIS 0x812B /* Talaris */
|
||||
#define ETHERTYPE_WATERLOO 0x8130 /* Waterloo Microsystems Inc. (XXX which?) */
|
||||
#define ETHERTYPE_HAYES 0x8130 /* Hayes Microcomputers (XXX which?) */
|
||||
#define ETHERTYPE_VGLAB 0x8131 /* VG Laboratory Systems */
|
||||
/* 0x8132 - 0x8137 Bridge Communications */
|
||||
#define ETHERTYPE_IPX 0x8137 /* Novell (old) NetWare IPX (ECONFIG E option) */
|
||||
#define ETHERTYPE_NOVELL 0x8138 /* Novell, Inc. */
|
||||
/* 0x8139 - 0x813D KTI */
|
||||
#define ETHERTYPE_MUMPS 0x813F /* M/MUMPS data sharing */
|
||||
#define ETHERTYPE_AMOEBA 0x8145 /* Vrije Universiteit (NL) Amoeba 4 RPC (obsolete) */
|
||||
#define ETHERTYPE_FLIP 0x8146 /* Vrije Universiteit (NL) FLIP (Fast Local Internet Protocol) */
|
||||
#define ETHERTYPE_VURESERVED 0x8147 /* Vrije Universiteit (NL) [reserved] */
|
||||
#define ETHERTYPE_LOGICRAFT 0x8148 /* Logicraft */
|
||||
#define ETHERTYPE_NCD 0x8149 /* Network Computing Devices */
|
||||
#define ETHERTYPE_ALPHA 0x814A /* Alpha Micro */
|
||||
#define ETHERTYPE_SNMP 0x814C /* SNMP over Ethernet (see RFC1089) */
|
||||
/* 0x814D - 0x814E BIIN */
|
||||
#define ETHERTYPE_TEC 0x814F /* Technically Elite Concepts */
|
||||
#define ETHERTYPE_RATIONAL 0x8150 /* Rational Corp */
|
||||
/* 0x8151 - 0x8153 Qualcomm */
|
||||
/* 0x815C - 0x815E Computer Protocol Pty Ltd */
|
||||
/* 0x8164 - 0x8166 Charles River Data Systems */
|
||||
#define ETHERTYPE_XTP 0x817D /* Protocol Engines XTP */
|
||||
#define ETHERTYPE_SGITW 0x817E /* SGI/Time Warner prop. */
|
||||
#define ETHERTYPE_HIPPI_FP 0x8180 /* HIPPI-FP encapsulation */
|
||||
#define ETHERTYPE_STP 0x8181 /* Scheduled Transfer STP, HIPPI-ST */
|
||||
/* 0x8182 - 0x8183 Reserved for HIPPI-6400 */
|
||||
/* 0x8184 - 0x818C SGI prop. */
|
||||
#define ETHERTYPE_MOTOROLA 0x818D /* Motorola */
|
||||
#define ETHERTYPE_NETBEUI 0x8191 /* PowerLAN NetBIOS/NetBEUI (PC) */
|
||||
/* 0x819A - 0x81A3 RAD Network Devices */
|
||||
/* 0x81B7 - 0x81B9 Xyplex */
|
||||
/* 0x81CC - 0x81D5 Apricot Computers */
|
||||
/* 0x81D6 - 0x81DD Artisoft Lantastic */
|
||||
/* 0x81E6 - 0x81EF Polygon */
|
||||
/* 0x81F0 - 0x81F2 Comsat Labs */
|
||||
/* 0x81F3 - 0x81F5 SAIC */
|
||||
/* 0x81F6 - 0x81F8 VG Analytical */
|
||||
/* 0x8203 - 0x8205 QNX Software Systems Ltd. */
|
||||
/* 0x8221 - 0x8222 Ascom Banking Systems */
|
||||
/* 0x823E - 0x8240 Advanced Encryption Systems */
|
||||
/* 0x8263 - 0x826A Charles River Data Systems */
|
||||
/* 0x827F - 0x8282 Athena Programming */
|
||||
/* 0x829A - 0x829B Inst Ind Info Tech */
|
||||
/* 0x829C - 0x82AB Taurus Controls */
|
||||
/* 0x82AC - 0x8693 Walker Richer & Quinn */
|
||||
#define ETHERTYPE_ACCTON 0x8390 /* Accton Technologies (unregistered) */
|
||||
#define ETHERTYPE_TALARISMC 0x852B /* Talaris multicast */
|
||||
#define ETHERTYPE_KALPANA 0x8582 /* Kalpana */
|
||||
/* 0x8694 - 0x869D Idea Courier */
|
||||
/* 0x869E - 0x86A1 Computer Network Tech */
|
||||
/* 0x86A3 - 0x86AC Gateway Communications */
|
||||
#define ETHERTYPE_SECTRA 0x86DB /* SECTRA */
|
||||
#define ETHERTYPE_IPV6 0x86DD /* IP protocol version 6 */
|
||||
#define ETHERTYPE_DELTACON 0x86DE /* Delta Controls */
|
||||
#define ETHERTYPE_ATOMIC 0x86DF /* ATOMIC */
|
||||
/* 0x86E0 - 0x86EF Landis & Gyr Powers */
|
||||
/* 0x8700 - 0x8710 Motorola */
|
||||
#define ETHERTYPE_RDP 0x8739 /* Control Technology Inc. RDP Without IP */
|
||||
#define ETHERTYPE_MICP 0x873A /* Control Technology Inc. Mcast Industrial Ctrl Proto. */
|
||||
/* 0x873B - 0x873C Control Technology Inc. Proprietary */
|
||||
#define ETHERTYPE_TCPCOMP 0x876B /* TCP/IP Compression (RFC1701) */
|
||||
#define ETHERTYPE_IPAS 0x876C /* IP Autonomous Systems (RFC1701) */
|
||||
#define ETHERTYPE_SECUREDATA 0x876D /* Secure Data (RFC1701) */
|
||||
#define ETHERTYPE_FLOWCONTROL 0x8808 /* 802.3x flow control packet */
|
||||
#define ETHERTYPE_SLOWPROTOCOLS 0x8809 /* Slow protocols */
|
||||
#define ETHERTYPE_PPP 0x880B /* PPP (obsolete by PPPOE) */
|
||||
#define ETHERTYPE_HITACHI 0x8820 /* Hitachi Cable (Optoelectronic Systems Laboratory) */
|
||||
#define ETHERTYPE_MPLS 0x8847 /* MPLS Unicast */
|
||||
#define ETHERTYPE_MPLS_MCAST 0x8848 /* MPLS Multicast */
|
||||
#define ETHERTYPE_AXIS 0x8856 /* Axis Communications AB proprietary bootstrap/config */
|
||||
#define ETHERTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
|
||||
#define ETHERTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
|
||||
#define ETHERTYPE_LANPROBE 0x8888 /* HP LanProbe test? */
|
||||
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
|
||||
#define ETHERTYPE_LOOPBACK 0x9000 /* Loopback */
|
||||
#define ETHERTYPE_LBACK ETHERTYPE_LOOPBACK /* DEC MOP loopback */
|
||||
#define ETHERTYPE_XNSSM 0x9001 /* 3Com (Formerly Bridge Communications), XNS Systems Management */
|
||||
#define ETHERTYPE_TCPSM 0x9002 /* 3Com (Formerly Bridge Communications), TCP/IP Systems Management */
|
||||
#define ETHERTYPE_BCLOOP 0x9003 /* 3Com (Formerly Bridge Communications), loopback detection */
|
||||
#define ETHERTYPE_DEBNI 0xAAAA /* DECNET? Used by VAX 6220 DEBNI */
|
||||
#define ETHERTYPE_SONIX 0xFAF5 /* Sonix Arpeggio */
|
||||
#define ETHERTYPE_VITAL 0xFF00 /* BBN VITAL-LanBridge cache wakeups */
|
||||
/* 0xFF00 - 0xFFOF ISC Bunker Ramo */
|
||||
|
||||
#define ETHERTYPE_MAX 0xFFFF /* Maximum valid ethernet type, reserved */
|
||||
|
||||
#endif /* !_NET_ETHERTYPES_H_ */
|
5
nbsd_include/net/hton.h
Normal file
5
nbsd_include/net/hton.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
* Dummy file for Minix old includes compatibility.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/endian.h>
|
6
nbsd_include/net/if.h
Normal file
6
nbsd_include/net/if.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef _NET_IF_H_
|
||||
#define _NET_IF_H_
|
||||
|
||||
#define IFF_UP 0x0001 /* interface is up */
|
||||
|
||||
#endif /* _NET_IF_H_ */
|
109
nbsd_include/net/if_ether.h
Normal file
109
nbsd_include/net/if_ether.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/* $NetBSD: if_ether.h,v 1.58 2010/05/19 20:41:59 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_ETHER_H_
|
||||
#define _NET_IF_ETHER_H_
|
||||
|
||||
/*
|
||||
* Some basic Ethernet constants.
|
||||
*/
|
||||
#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
|
||||
#define ETHER_TYPE_LEN 2 /* length of the Ethernet type field */
|
||||
#define ETHER_CRC_LEN 4 /* length of the Ethernet CRC */
|
||||
#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
|
||||
#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
|
||||
#define ETHER_MAX_LEN 1518 /* maximum frame length, including CRC */
|
||||
#define ETHER_MAX_LEN_JUMBO 9018 /* maximum jumbo frame len, including CRC */
|
||||
|
||||
/*
|
||||
* Some Ethernet extensions.
|
||||
*/
|
||||
#define ETHER_VLAN_ENCAP_LEN 4 /* length of 802.1Q VLAN encapsulation */
|
||||
#define ETHER_PPPOE_ENCAP_LEN 8 /* length of PPPoE encapsulation */
|
||||
|
||||
/*
|
||||
* Ethernet address - 6 octets
|
||||
* this is only used by the ethers(3) functions.
|
||||
*/
|
||||
struct ether_addr {
|
||||
uint8_t ether_addr_octet[ETHER_ADDR_LEN];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Structure of a 10Mb/s Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
uint8_t ether_dhost[ETHER_ADDR_LEN];
|
||||
uint8_t ether_shost[ETHER_ADDR_LEN];
|
||||
uint16_t ether_type;
|
||||
} __packed;
|
||||
|
||||
#include <net/ethertypes.h>
|
||||
|
||||
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
|
||||
#define ETHER_IS_LOCAL(addr) (*(addr) & 0x02) /* is address local? */
|
||||
|
||||
#define ETHERMTU_JUMBO (ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
|
||||
/*
|
||||
* Compute the maximum frame size based on ethertype (i.e. possible
|
||||
* encapsulation) and whether or not an FCS is present.
|
||||
*/
|
||||
#define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
|
||||
((ifp)->if_mtu + ETHER_HDR_LEN + \
|
||||
((hasfcs) ? ETHER_CRC_LEN : 0) + \
|
||||
(((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0) + \
|
||||
(((etype) == ETHERTYPE_PPPOE) ? ETHER_PPPOE_ENCAP_LEN : 0))
|
||||
|
||||
/*
|
||||
* Ethernet CRC32 polynomials (big- and little-endian verions).
|
||||
*/
|
||||
#define ETHER_CRC_POLY_LE 0xedb88320
|
||||
#define ETHER_CRC_POLY_BE 0x04c11db6
|
||||
|
||||
/*
|
||||
* Prototype ethers(3) functions.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__BEGIN_DECLS
|
||||
char * ether_ntoa(const struct ether_addr *);
|
||||
struct ether_addr *
|
||||
ether_aton(const char *);
|
||||
int ether_ntohost(char *, const struct ether_addr *);
|
||||
int ether_hostton(const char *, struct ether_addr *);
|
||||
int ether_line(const char *, struct ether_addr *, char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_NET_IF_ETHER_H_ */
|
15
nbsd_include/net/netlib.h
Normal file
15
nbsd_include/net/netlib.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
net/netlib.h
|
||||
*/
|
||||
|
||||
#ifndef _NET__NETLIB_H_
|
||||
#define _NET__NETLIB_H_
|
||||
|
||||
#define IPSTAT_DEVICE "/dev/ipstat"
|
||||
#define ETH_DEVICE "/dev/eth"
|
||||
#define IP_DEVICE "/dev/ip"
|
||||
#define TCP_DEVICE "/dev/tcp"
|
||||
#define UDP_DEVICE "/dev/udp"
|
||||
#define UDS_DEVICE "/dev/uds"
|
||||
|
||||
#endif /* _NET__NETLIB_H_ */
|
5
nbsd_include/netinet/Makefile
Normal file
5
nbsd_include/netinet/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
INCSDIR= /usr/netbsd/include/netinet
|
||||
|
||||
INCS+= in.h tcp.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
512
nbsd_include/netinet/in.h
Normal file
512
nbsd_include/netinet/in.h
Normal file
|
@ -0,0 +1,512 @@
|
|||
/* $NetBSD: in.h,v 1.86 2009/09/14 10:36:50 degroote Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Constants and structures defined by the internet system,
|
||||
* Per RFC 790, September 1981, and numerous additions.
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IN_H_
|
||||
#define _NETINET_IN_H_
|
||||
|
||||
#include <machine/int_types.h>
|
||||
|
||||
#ifndef uint8_t
|
||||
typedef __uint8_t uint8_t;
|
||||
#define uint8_t __uint8_t
|
||||
#endif
|
||||
|
||||
#ifndef uint32_t
|
||||
typedef __uint32_t uint32_t;
|
||||
#define uint32_t __uint32_t
|
||||
#endif
|
||||
|
||||
#include <sys/ansi.h>
|
||||
|
||||
#ifndef in_addr_t
|
||||
typedef __in_addr_t in_addr_t;
|
||||
#define in_addr_t __in_addr_t
|
||||
#endif
|
||||
|
||||
#ifndef in_port_t
|
||||
typedef __in_port_t in_port_t;
|
||||
#define in_port_t __in_port_t
|
||||
#endif
|
||||
|
||||
#ifndef sa_family_t
|
||||
typedef __sa_family_t sa_family_t;
|
||||
#define sa_family_t __sa_family_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Protocols
|
||||
*/
|
||||
#define IPPROTO_IP 0 /* dummy for IP */
|
||||
#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
|
||||
#define IPPROTO_ICMP 1 /* control message protocol */
|
||||
#define IPPROTO_IGMP 2 /* group mgmt protocol */
|
||||
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
|
||||
#define IPPROTO_IPV4 4 /* IP header */
|
||||
#define IPPROTO_IPIP 4 /* IP inside IP */
|
||||
#define IPPROTO_TCP 6 /* tcp */
|
||||
#define IPPROTO_EGP 8 /* exterior gateway protocol */
|
||||
#define IPPROTO_PUP 12 /* pup */
|
||||
#define IPPROTO_UDP 17 /* user datagram protocol */
|
||||
#define IPPROTO_IDP 22 /* xns idp */
|
||||
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
|
||||
#define IPPROTO_IPV6 41 /* IP6 header */
|
||||
#define IPPROTO_ROUTING 43 /* IP6 routing header */
|
||||
#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
|
||||
#define IPPROTO_RSVP 46 /* resource reservation */
|
||||
#define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */
|
||||
#define IPPROTO_ESP 50 /* encap. security payload */
|
||||
#define IPPROTO_AH 51 /* authentication header */
|
||||
#define IPPROTO_MOBILE 55 /* IP Mobility RFC 2004 */
|
||||
#define IPPROTO_IPV6_ICMP 58 /* IPv6 ICMP */
|
||||
#define IPPROTO_ICMPV6 58 /* ICMP6 */
|
||||
#define IPPROTO_NONE 59 /* IP6 no next header */
|
||||
#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
|
||||
#define IPPROTO_EON 80 /* ISO cnlp */
|
||||
#define IPPROTO_ETHERIP 97 /* Ethernet-in-IP */
|
||||
#define IPPROTO_ENCAP 98 /* encapsulation header */
|
||||
#define IPPROTO_PIM 103 /* Protocol indep. multicast */
|
||||
#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */
|
||||
#define IPPROTO_VRRP 112 /* VRRP RFC 2338 */
|
||||
#define IPPROTO_CARP 112 /* Common Address Resolution Protocol */
|
||||
#define IPPROTO_PFSYNC 240 /* PFSYNC */
|
||||
#define IPPROTO_RAW 255 /* raw IP packet */
|
||||
#define IPPROTO_MAX 256
|
||||
|
||||
/* last return value of *_input(), meaning "all job for this pkt is done". */
|
||||
#define IPPROTO_DONE 257
|
||||
|
||||
/* sysctl placeholder for (FAST_)IPSEC */
|
||||
#define CTL_IPPROTO_IPSEC 258
|
||||
|
||||
|
||||
/*
|
||||
* Local port number conventions:
|
||||
*
|
||||
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
|
||||
* unless a kernel is compiled with IPNOPRIVPORTS defined.
|
||||
*
|
||||
* When a user does a bind(2) or connect(2) with a port number of zero,
|
||||
* a non-conflicting local port address is chosen.
|
||||
*
|
||||
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
|
||||
* that is settable by sysctl(3); net.inet.ip.anonportmin and
|
||||
* net.inet.ip.anonportmax respectively.
|
||||
*
|
||||
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
|
||||
* default assignment range.
|
||||
*
|
||||
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
|
||||
*
|
||||
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
|
||||
* and exists only for FreeBSD compatibility purposes.
|
||||
*
|
||||
* The value IP_PORTRANGE_LOW changes the range to the "low" are
|
||||
* that is (by convention) restricted to privileged processes.
|
||||
* This convention is based on "vouchsafe" principles only.
|
||||
* It is only secure if you trust the remote host to restrict these ports.
|
||||
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
|
||||
*/
|
||||
|
||||
#define IPPORT_RESERVED 1024
|
||||
#define IPPORT_ANONMIN 49152
|
||||
#define IPPORT_ANONMAX 65535
|
||||
#define IPPORT_RESERVEDMIN 600
|
||||
#define IPPORT_RESERVEDMAX (IPPORT_RESERVED-1)
|
||||
|
||||
/*
|
||||
* Internet address (a structure for historical reasons)
|
||||
*/
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Definitions of bits in internet address integers.
|
||||
* On subnets, the decomposition of addresses to host and net parts
|
||||
* is done according to subnet mask, not the masks here.
|
||||
*
|
||||
* By byte-swapping the constants, we avoid ever having to byte-swap IP
|
||||
* addresses inside the kernel. Unfortunately, user-level programs rely
|
||||
* on these macros not doing byte-swapping.
|
||||
*/
|
||||
#ifdef _KERNEL
|
||||
#define __IPADDR(x) ((uint32_t) htonl((uint32_t)(x)))
|
||||
#else
|
||||
#define __IPADDR(x) ((uint32_t)(x))
|
||||
#endif
|
||||
|
||||
#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \
|
||||
__IPADDR(0x00000000))
|
||||
#define IN_CLASSA_NET __IPADDR(0xff000000)
|
||||
#define IN_CLASSA_NSHIFT 24
|
||||
#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
|
||||
#define IN_CLASSA_MAX 128
|
||||
|
||||
#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
|
||||
__IPADDR(0x80000000))
|
||||
#define IN_CLASSB_NET __IPADDR(0xffff0000)
|
||||
#define IN_CLASSB_NSHIFT 16
|
||||
#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
|
||||
#define IN_CLASSB_MAX 65536
|
||||
|
||||
#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
|
||||
__IPADDR(0xc0000000))
|
||||
#define IN_CLASSC_NET __IPADDR(0xffffff00)
|
||||
#define IN_CLASSC_NSHIFT 8
|
||||
#define IN_CLASSC_HOST __IPADDR(0x000000ff)
|
||||
|
||||
#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
|
||||
__IPADDR(0xe0000000))
|
||||
/* These ones aren't really net and host fields, but routing needn't know. */
|
||||
#define IN_CLASSD_NET __IPADDR(0xf0000000)
|
||||
#define IN_CLASSD_NSHIFT 28
|
||||
#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
|
||||
#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
|
||||
__IPADDR(0xf0000000))
|
||||
#define IN_BADCLASS(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
|
||||
__IPADDR(0xf0000000))
|
||||
|
||||
#define IN_LINKLOCAL(i) (((uint32_t)(i) & __IPADDR(0xffff0000)) == \
|
||||
__IPADDR(0xa9fe0000))
|
||||
|
||||
#define IN_PRIVATE(i) ((((uint32_t)(i) & __IPADDR(0xff000000)) == \
|
||||
__IPADDR(0x0a000000)) || \
|
||||
(((uint32_t)(i) & __IPADDR(0xfff00000)) == \
|
||||
__IPADDR(0xac100000)) || \
|
||||
(((uint32_t)(i) & __IPADDR(0xffff0000)) == \
|
||||
__IPADDR(0xc0a80000)))
|
||||
|
||||
#define IN_LOCAL_GROUP(i) (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
|
||||
__IPADDR(0xe0000000))
|
||||
|
||||
#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
|
||||
|
||||
#define INADDR_ANY __IPADDR(0x00000000)
|
||||
#define INADDR_LOOPBACK __IPADDR(0x7f000001)
|
||||
#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
|
||||
#define INADDR_NONE __IPADDR(0xffffffff) /* -1 return */
|
||||
|
||||
#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */
|
||||
#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */
|
||||
#define INADDR_ALLRTRS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */
|
||||
#define INADDR_CARP_GROUP __IPADDR(0xe0000012) /* 224.0.0.18 */
|
||||
#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */
|
||||
|
||||
#define IN_LOOPBACKNET 127 /* official! */
|
||||
|
||||
/*
|
||||
* Socket address, internet style.
|
||||
*/
|
||||
#ifdef __minix
|
||||
struct sockaddr_in
|
||||
{
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
};
|
||||
#else /* !__minix */
|
||||
struct sockaddr_in {
|
||||
uint8_t sin_len;
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
__int8_t sin_zero[8];
|
||||
};
|
||||
#endif /* !__minix */
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
|
||||
#ifndef __minix
|
||||
/*
|
||||
* Structure used to describe IP options.
|
||||
* Used to store options internally, to pass them to a process,
|
||||
* or to restore options retrieved earlier.
|
||||
* The ip_dst is used for the first-hop gateway when using a source route
|
||||
* (this gets put into the header proper).
|
||||
*/
|
||||
struct ip_opts {
|
||||
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
|
||||
#if defined(__cplusplus)
|
||||
__int8_t Ip_opts[40]; /* actually variable in size */
|
||||
#else
|
||||
__int8_t ip_opts[40]; /* actually variable in size */
|
||||
#endif
|
||||
};
|
||||
#endif /* __minix */
|
||||
|
||||
/*
|
||||
* Options for use with [gs]etsockopt at the IP level.
|
||||
* First word of comment is data type; bool is stored in int.
|
||||
*/
|
||||
#ifndef __minix
|
||||
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
|
||||
#define IP_HDRINCL 2 /* int; header is included with data */
|
||||
#define IP_TOS 3 /* int; IP type of service and preced. */
|
||||
#define IP_TTL 4 /* int; IP time to live */
|
||||
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
|
||||
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
|
||||
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
|
||||
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
|
||||
#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
|
||||
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
|
||||
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
|
||||
#endif /* !__minix */
|
||||
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
|
||||
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
|
||||
#ifndef __minix
|
||||
#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */
|
||||
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
|
||||
#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */
|
||||
#if 1 /*IPSEC*/
|
||||
#define IP_IPSEC_POLICY 22 /* struct; get/set security policy */
|
||||
#endif
|
||||
#define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */
|
||||
#define IP_MINTTL 24 /* minimum TTL for packet or drop */
|
||||
#endif /* !__minix */
|
||||
|
||||
#ifndef __minix
|
||||
/*
|
||||
* Defaults and limits for options
|
||||
*/
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
|
||||
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
||||
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
|
||||
#endif /* !__minix */
|
||||
|
||||
/*
|
||||
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
|
||||
*/
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_interface; /* local IP address of interface */
|
||||
};
|
||||
|
||||
#ifndef __minix
|
||||
/*
|
||||
* Argument for IP_PORTRANGE:
|
||||
* - which range to search when port is unspecified at bind() or connect()
|
||||
*/
|
||||
#define IP_PORTRANGE_DEFAULT 0 /* default range */
|
||||
#define IP_PORTRANGE_HIGH 1 /* same as DEFAULT (FreeBSD compat) */
|
||||
#define IP_PORTRANGE_LOW 2 /* use privileged range */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Definitions for inet sysctl operations.
|
||||
*
|
||||
* Third level is protocol number.
|
||||
* Fourth level is desired variable within that protocol.
|
||||
*/
|
||||
#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
|
||||
|
||||
#define CTL_IPPROTO_NAMES { \
|
||||
{ "ip", CTLTYPE_NODE }, \
|
||||
{ "icmp", CTLTYPE_NODE }, \
|
||||
{ "igmp", CTLTYPE_NODE }, \
|
||||
{ "ggp", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "tcp", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ "egp", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "pup", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "udp", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "idp", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "ipsec", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "pim", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* Names for IP sysctl objects
|
||||
*/
|
||||
#define IPCTL_FORWARDING 1 /* act as router */
|
||||
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
|
||||
#define IPCTL_DEFTTL 3 /* default TTL */
|
||||
#ifdef notyet
|
||||
#define IPCTL_DEFMTU 4 /* default MTU */
|
||||
#endif
|
||||
#define IPCTL_FORWSRCRT 5 /* forward source-routed packets */
|
||||
#define IPCTL_DIRECTEDBCAST 6 /* default broadcast behavior */
|
||||
#define IPCTL_ALLOWSRCRT 7 /* allow/drop all source-routed pkts */
|
||||
#define IPCTL_SUBNETSARELOCAL 8 /* treat subnets as local addresses */
|
||||
#define IPCTL_MTUDISC 9 /* allow path MTU discovery */
|
||||
#define IPCTL_ANONPORTMIN 10 /* minimum ephemeral port */
|
||||
#define IPCTL_ANONPORTMAX 11 /* maximum ephemeral port */
|
||||
#define IPCTL_MTUDISCTIMEOUT 12 /* allow path MTU discovery */
|
||||
#define IPCTL_MAXFLOWS 13 /* maximum ip flows allowed */
|
||||
#define IPCTL_HOSTZEROBROADCAST 14 /* is host zero a broadcast addr? */
|
||||
#define IPCTL_GIF_TTL 15 /* default TTL for gif encap packet */
|
||||
#define IPCTL_LOWPORTMIN 16 /* minimum reserved port */
|
||||
#define IPCTL_LOWPORTMAX 17 /* maximum reserved port */
|
||||
#define IPCTL_MAXFRAGPACKETS 18 /* max packets reassembly queue */
|
||||
#define IPCTL_GRE_TTL 19 /* default TTL for gre encap packet */
|
||||
#define IPCTL_CHECKINTERFACE 20 /* drop pkts in from 'wrong' iface */
|
||||
#define IPCTL_IFQ 21 /* ipintrq node */
|
||||
#define IPCTL_RANDOMID 22 /* use random IP ids (if configured) */
|
||||
#define IPCTL_LOOPBACKCKSUM 23 /* do IP checksum on loopback */
|
||||
#define IPCTL_STATS 24 /* IP statistics */
|
||||
#define IPCTL_MAXID 25
|
||||
|
||||
#define IPCTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "forwarding", CTLTYPE_INT }, \
|
||||
{ "redirect", CTLTYPE_INT }, \
|
||||
{ "ttl", CTLTYPE_INT }, \
|
||||
{ "mtu", CTLTYPE_INT }, \
|
||||
{ "forwsrcrt", CTLTYPE_INT }, \
|
||||
{ "directed-broadcast", CTLTYPE_INT }, \
|
||||
{ "allowsrcrt", CTLTYPE_INT }, \
|
||||
{ "subnetsarelocal", CTLTYPE_INT }, \
|
||||
{ "mtudisc", CTLTYPE_INT }, \
|
||||
{ "anonportmin", CTLTYPE_INT }, \
|
||||
{ "anonportmax", CTLTYPE_INT }, \
|
||||
{ "mtudisctimeout", CTLTYPE_INT }, \
|
||||
{ "maxflows", CTLTYPE_INT }, \
|
||||
{ "hostzerobroadcast", CTLTYPE_INT }, \
|
||||
{ "gifttl", CTLTYPE_INT }, \
|
||||
{ "lowportmin", CTLTYPE_INT }, \
|
||||
{ "lowportmax", CTLTYPE_INT }, \
|
||||
{ "maxfragpackets", CTLTYPE_INT }, \
|
||||
{ "grettl", CTLTYPE_INT }, \
|
||||
{ "checkinterface", CTLTYPE_INT }, \
|
||||
{ "ifq", CTLTYPE_NODE }, \
|
||||
{ "random_id", CTLTYPE_INT }, \
|
||||
{ "do_loopback_cksum", CTLTYPE_INT }, \
|
||||
{ "stats", CTLTYPE_STRUCT }, \
|
||||
}
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
#endif /* __minix */
|
||||
|
||||
/* INET6 stuff */
|
||||
#define __KAME_NETINET_IN_H_INCLUDED_
|
||||
#include <netinet6/in6.h>
|
||||
#undef __KAME_NETINET_IN_H_INCLUDED_
|
||||
|
||||
#endif /* !_NETINET_IN_H_ */
|
119
nbsd_include/netinet/tcp.h
Normal file
119
nbsd_include/netinet/tcp.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/* $NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_H_
|
||||
#define _NETINET_TCP_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
|
||||
typedef u_int32_t tcp_seq;
|
||||
/*
|
||||
* TCP header.
|
||||
* Per RFC 793, September, 1981.
|
||||
* Updated by RFC 3168, September, 2001.
|
||||
*/
|
||||
struct tcphdr {
|
||||
u_int16_t th_sport; /* source port */
|
||||
u_int16_t th_dport; /* destination port */
|
||||
tcp_seq th_seq; /* sequence number */
|
||||
tcp_seq th_ack; /* acknowledgement number */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*LINTED non-portable bitfields*/
|
||||
u_int8_t th_x2:4, /* (unused) */
|
||||
th_off:4; /* data offset */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
/*LINTED non-portable bitfields*/
|
||||
u_int8_t th_off:4, /* data offset */
|
||||
th_x2:4; /* (unused) */
|
||||
#endif
|
||||
u_int8_t th_flags;
|
||||
#define TH_FIN 0x01
|
||||
#define TH_SYN 0x02
|
||||
#define TH_RST 0x04
|
||||
#define TH_PUSH 0x08
|
||||
#define TH_ACK 0x10
|
||||
#define TH_URG 0x20
|
||||
#define TH_ECE 0x40
|
||||
#define TH_CWR 0x80
|
||||
u_int16_t th_win; /* window */
|
||||
u_int16_t th_sum; /* checksum */
|
||||
u_int16_t th_urp; /* urgent pointer */
|
||||
} __packed;
|
||||
|
||||
#define TCPOPT_EOL 0
|
||||
#define TCPOPT_NOP 1
|
||||
#define TCPOPT_MAXSEG 2
|
||||
#define TCPOLEN_MAXSEG 4
|
||||
#define TCPOPT_WINDOW 3
|
||||
#define TCPOLEN_WINDOW 3
|
||||
#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
|
||||
#define TCPOLEN_SACK_PERMITTED 2
|
||||
#define TCPOPT_SACK 5 /* Experimental */
|
||||
#define TCPOPT_TIMESTAMP 8
|
||||
#define TCPOLEN_TIMESTAMP 10
|
||||
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
|
||||
|
||||
#define TCPOPT_TSTAMP_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
|
||||
|
||||
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
|
||||
#define TCPOLEN_SIGNATURE 18
|
||||
#define TCPOLEN_SIGLEN (TCPOLEN_SIGNATURE+2) /* padding */
|
||||
|
||||
#define MAX_TCPOPTLEN 40 /* max # bytes that go in options */
|
||||
|
||||
/*
|
||||
* Default maximum segment size for TCP.
|
||||
* This is defined by RFC 1112 Sec 4.2.2.6.
|
||||
*/
|
||||
#define TCP_MSS 536
|
||||
|
||||
#define TCP_MINMSS 216
|
||||
|
||||
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
|
||||
|
||||
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
|
||||
|
||||
#define TCP_MAXBURST 4 /* maximum segments in a burst */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
/*
|
||||
* User-settable options (used with setsockopt).
|
||||
*/
|
||||
#define TCP_NODELAY 1 /* don't delay send to coalesce packets */
|
||||
|
||||
#endif /* !_NETINET_TCP_H_ */
|
5
nbsd_include/netinet6/Makefile
Normal file
5
nbsd_include/netinet6/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
INCSDIR= /usr/netbsd/include/netinet6
|
||||
|
||||
INCS+= in6.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
808
nbsd_include/netinet6/in6.h
Normal file
808
nbsd_include/netinet6/in6.h
Normal file
|
@ -0,0 +1,808 @@
|
|||
/* $NetBSD: in6.h,v 1.68 2009/09/11 22:06:29 dyoung Exp $ */
|
||||
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* 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 project 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 PROJECT 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 PROJECT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
*/
|
||||
|
||||
#ifndef _NETINET6_IN6_H_
|
||||
#define _NETINET6_IN6_H_
|
||||
|
||||
#ifndef __KAME_NETINET_IN_H_INCLUDED_
|
||||
#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553"
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
/*
|
||||
* Identification of the network protocol stack
|
||||
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
|
||||
* has the table of implementation/integration differences.
|
||||
*/
|
||||
#define __KAME__
|
||||
#define __KAME_VERSION "NetBSD-current"
|
||||
|
||||
/*
|
||||
* Local port number conventions:
|
||||
*
|
||||
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
|
||||
* unless a kernel is compiled with IPNOPRIVPORTS defined.
|
||||
*
|
||||
* When a user does a bind(2) or connect(2) with a port number of zero,
|
||||
* a non-conflicting local port address is chosen.
|
||||
*
|
||||
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
|
||||
* that is settable by sysctl(3); net.inet.ip.anonportmin and
|
||||
* net.inet.ip.anonportmax respectively.
|
||||
*
|
||||
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
|
||||
* default assignment range.
|
||||
*
|
||||
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
|
||||
*
|
||||
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
|
||||
* and exists only for FreeBSD compatibility purposes.
|
||||
*
|
||||
* The value IP_PORTRANGE_LOW changes the range to the "low" are
|
||||
* that is (by convention) restricted to privileged processes.
|
||||
* This convention is based on "vouchsafe" principles only.
|
||||
* It is only secure if you trust the remote host to restrict these ports.
|
||||
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
|
||||
*/
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define IPV6PORT_RESERVED 1024
|
||||
#define IPV6PORT_ANONMIN 49152
|
||||
#define IPV6PORT_ANONMAX 65535
|
||||
#define IPV6PORT_RESERVEDMIN 600
|
||||
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IPv6 address
|
||||
*/
|
||||
struct in6_addr {
|
||||
union {
|
||||
__uint8_t __u6_addr8[16];
|
||||
__uint16_t __u6_addr16[8];
|
||||
uint32_t __u6_addr32[4];
|
||||
} __u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
|
||||
#define s6_addr __u6_addr.__u6_addr8
|
||||
#ifdef _KERNEL /* XXX nonstandard */
|
||||
#define s6_addr8 __u6_addr.__u6_addr8
|
||||
#define s6_addr16 __u6_addr.__u6_addr16
|
||||
#define s6_addr32 __u6_addr.__u6_addr32
|
||||
#endif
|
||||
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
/*
|
||||
* Socket address for IPv6
|
||||
*/
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define SIN6_LEN
|
||||
#endif
|
||||
struct sockaddr_in6 {
|
||||
#ifndef __minix
|
||||
uint8_t sin6_len; /* length of this struct(socklen_t)*/
|
||||
#endif /* !__minix */
|
||||
sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */
|
||||
in_port_t sin6_port; /* Transport layer port */
|
||||
uint32_t sin6_flowinfo; /* IP6 flow information */
|
||||
struct in6_addr sin6_addr; /* IP6 address */
|
||||
uint32_t sin6_scope_id; /* scope zone index */
|
||||
};
|
||||
|
||||
#ifndef __minix
|
||||
/*
|
||||
* Local definition for masks
|
||||
*/
|
||||
#ifdef _KERNEL /* XXX nonstandard */
|
||||
#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
|
||||
#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern const struct sockaddr_in6 sa6_any;
|
||||
|
||||
extern const struct in6_addr in6mask0;
|
||||
extern const struct in6_addr in6mask32;
|
||||
extern const struct in6_addr in6mask64;
|
||||
extern const struct in6_addr in6mask96;
|
||||
extern const struct in6_addr in6mask128;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Macros started with IPV6_ADDR is KAME local
|
||||
*/
|
||||
#ifdef _KERNEL /* XXX nonstandard */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define IPV6_ADDR_INT32_ONE 1
|
||||
#define IPV6_ADDR_INT32_TWO 2
|
||||
#define IPV6_ADDR_INT32_MNL 0xff010000
|
||||
#define IPV6_ADDR_INT32_MLL 0xff020000
|
||||
#define IPV6_ADDR_INT32_SMP 0x0000ffff
|
||||
#define IPV6_ADDR_INT16_ULL 0xfe80
|
||||
#define IPV6_ADDR_INT16_USL 0xfec0
|
||||
#define IPV6_ADDR_INT16_MLL 0xff02
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define IPV6_ADDR_INT32_ONE 0x01000000
|
||||
#define IPV6_ADDR_INT32_TWO 0x02000000
|
||||
#define IPV6_ADDR_INT32_MNL 0x000001ff
|
||||
#define IPV6_ADDR_INT32_MLL 0x000002ff
|
||||
#define IPV6_ADDR_INT32_SMP 0xffff0000
|
||||
#define IPV6_ADDR_INT16_ULL 0x80fe
|
||||
#define IPV6_ADDR_INT16_USL 0xc0fe
|
||||
#define IPV6_ADDR_INT16_MLL 0x02ff
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !__minix */
|
||||
|
||||
/*
|
||||
* Definition of some useful macros to handle IP6 addresses
|
||||
*/
|
||||
#define IN6ADDR_ANY_INIT \
|
||||
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6ADDR_LOOPBACK_INIT \
|
||||
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
|
||||
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
|
||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
||||
|
||||
extern const struct in6_addr in6addr_any;
|
||||
extern const struct in6_addr in6addr_loopback;
|
||||
extern const struct in6_addr in6addr_nodelocal_allnodes;
|
||||
extern const struct in6_addr in6addr_linklocal_allnodes;
|
||||
extern const struct in6_addr in6addr_linklocal_allrouters;
|
||||
|
||||
#define IN6_ARE_ADDR_EQUAL(a, b) \
|
||||
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
|
||||
|
||||
/*
|
||||
* Unspecified
|
||||
*/
|
||||
#define IN6_IS_ADDR_UNSPECIFIED(a) \
|
||||
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[3] == 0)
|
||||
|
||||
/*
|
||||
* Loopback
|
||||
*/
|
||||
#define IN6_IS_ADDR_LOOPBACK(a) \
|
||||
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[3] == ntohl(1))
|
||||
|
||||
/*
|
||||
* IPv4 compatible
|
||||
*/
|
||||
#define IN6_IS_ADDR_V4COMPAT(a) \
|
||||
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[3] != 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[3] != ntohl(1))
|
||||
|
||||
/*
|
||||
* Mapped
|
||||
*/
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
||||
(a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff))
|
||||
|
||||
/*
|
||||
* KAME Scope Values
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL /* XXX nonstandard */
|
||||
#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
|
||||
#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
|
||||
#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
|
||||
#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
|
||||
#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
|
||||
#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
|
||||
#else
|
||||
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
|
||||
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
|
||||
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
|
||||
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
|
||||
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unicast Scope
|
||||
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
|
||||
*/
|
||||
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
||||
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
|
||||
#define IN6_IS_ADDR_SITELOCAL(a) \
|
||||
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
|
||||
|
||||
/*
|
||||
* Multicast
|
||||
*/
|
||||
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
|
||||
|
||||
#ifdef _KERNEL /* XXX nonstandard */
|
||||
#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
||||
#else
|
||||
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Multicast Scope
|
||||
*/
|
||||
#ifdef _KERNEL /* refers nonstandard items */
|
||||
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
|
||||
#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
|
||||
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
|
||||
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
|
||||
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
|
||||
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
|
||||
#else
|
||||
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
|
||||
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
|
||||
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
|
||||
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
|
||||
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL /* nonstandard */
|
||||
/*
|
||||
* KAME Scope
|
||||
*/
|
||||
#define IN6_IS_SCOPE_LINKLOCAL(a) \
|
||||
((IN6_IS_ADDR_LINKLOCAL(a)) || \
|
||||
(IN6_IS_ADDR_MC_LINKLOCAL(a)))
|
||||
|
||||
#define IN6_IS_SCOPE_EMBEDDABLE(__a) \
|
||||
(IN6_IS_SCOPE_LINKLOCAL(__a) || IN6_IS_ADDR_MC_INTFACELOCAL(__a))
|
||||
|
||||
#define IFA6_IS_DEPRECATED(a) \
|
||||
((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
|
||||
(u_int32_t)((time_second - (a)->ia6_updatetime)) > \
|
||||
(a)->ia6_lifetime.ia6t_pltime)
|
||||
#define IFA6_IS_INVALID(a) \
|
||||
((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
|
||||
(u_int32_t)((time_second - (a)->ia6_updatetime)) > \
|
||||
(a)->ia6_lifetime.ia6t_vltime)
|
||||
#endif
|
||||
|
||||
#ifndef __minix
|
||||
/*
|
||||
* Options for use with [gs]etsockopt at the IPV6 level.
|
||||
* First word of comment is data type; bool is stored in int.
|
||||
*/
|
||||
/* no hdrincl */
|
||||
#if 0
|
||||
/* These are deprecated non-standard options which are no longer supported. */
|
||||
#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
|
||||
#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
|
||||
#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
|
||||
#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
|
||||
#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
|
||||
#endif
|
||||
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
|
||||
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
|
||||
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
|
||||
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
|
||||
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
|
||||
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
|
||||
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
|
||||
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
|
||||
#endif
|
||||
/* RFC2292 options */
|
||||
#ifdef _KERNEL
|
||||
#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
|
||||
#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
|
||||
#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
|
||||
#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
|
||||
#define IPV6_2292DSTOPTS 23 /* bool; destination option */
|
||||
#define IPV6_2292RTHDR 24 /* bool; routing header */
|
||||
#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
|
||||
#endif
|
||||
#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
|
||||
#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */
|
||||
|
||||
#if 1 /* IPSEC */
|
||||
#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
|
||||
#endif
|
||||
#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */
|
||||
|
||||
/* new socket options introduced in RFC3542 */
|
||||
#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */
|
||||
|
||||
#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */
|
||||
#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
|
||||
#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
|
||||
#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
|
||||
#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
|
||||
#ifdef _KERNEL
|
||||
#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */
|
||||
#endif
|
||||
#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
|
||||
#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
|
||||
#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt),
|
||||
4 bytes int; MTU notification (cmsg) */
|
||||
|
||||
/* more new socket options introduced in RFC3542 */
|
||||
#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */
|
||||
#define IPV6_HOPLIMIT 47 /* int; send hop limit */
|
||||
#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */
|
||||
#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
|
||||
#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
|
||||
#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */
|
||||
|
||||
#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */
|
||||
#ifdef _KERNEL
|
||||
#define IPV6_OTCLASS 58 /* u_int8_t; send traffic class value */
|
||||
#endif
|
||||
|
||||
#define IPV6_TCLASS 61 /* int; send traffic class value */
|
||||
#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
|
||||
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
||||
|
||||
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */
|
||||
#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */
|
||||
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
|
||||
|
||||
/*
|
||||
* Defaults and limits for options
|
||||
*/
|
||||
#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
|
||||
#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
||||
|
||||
/*
|
||||
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
|
||||
*/
|
||||
struct ipv6_mreq {
|
||||
struct in6_addr ipv6mr_multiaddr;
|
||||
unsigned int ipv6mr_interface;
|
||||
};
|
||||
|
||||
/*
|
||||
* IPV6_PKTINFO: Packet information(RFC2292 sec 5)
|
||||
*/
|
||||
struct in6_pktinfo {
|
||||
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
|
||||
unsigned int ipi6_ifindex; /* send/recv interface index */
|
||||
};
|
||||
|
||||
/*
|
||||
* Control structure for IPV6_RECVPATHMTU socket option.
|
||||
*/
|
||||
struct ip6_mtuinfo {
|
||||
struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */
|
||||
uint32_t ip6m_mtu;
|
||||
};
|
||||
|
||||
/*
|
||||
* Argument for IPV6_PORTRANGE:
|
||||
* - which range to search when port is unspecified at bind() or connect()
|
||||
*/
|
||||
#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
|
||||
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
|
||||
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Definitions for inet6 sysctl operations.
|
||||
*
|
||||
* Third level is protocol number.
|
||||
* Fourth level is desired variable within that protocol.
|
||||
*/
|
||||
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
|
||||
|
||||
#define CTL_IPV6PROTO_NAMES { \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "tcp6", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "udp6", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "ip6", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "ipsec6", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "icmp6", CTLTYPE_NODE }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "pim6", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* Names for IP sysctl objects
|
||||
*/
|
||||
#define IPV6CTL_FORWARDING 1 /* act as router */
|
||||
#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/
|
||||
#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
|
||||
#ifdef notyet
|
||||
#define IPV6CTL_DEFMTU 4 /* default MTU */
|
||||
#endif
|
||||
#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
|
||||
#define IPV6CTL_STATS 6 /* stats */
|
||||
#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
|
||||
#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
|
||||
#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
|
||||
#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
|
||||
#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
|
||||
#define IPV6CTL_ACCEPT_RTADV 12
|
||||
#define IPV6CTL_KEEPFAITH 13
|
||||
#define IPV6CTL_LOG_INTERVAL 14
|
||||
#define IPV6CTL_HDRNESTLIMIT 15
|
||||
#define IPV6CTL_DAD_COUNT 16
|
||||
#define IPV6CTL_AUTO_FLOWLABEL 17
|
||||
#define IPV6CTL_DEFMCASTHLIM 18
|
||||
#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
|
||||
#define IPV6CTL_KAME_VERSION 20
|
||||
#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */
|
||||
#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
|
||||
/* 23: reserved */
|
||||
#define IPV6CTL_V6ONLY 24
|
||||
/* 25 to 27: reserved */
|
||||
#define IPV6CTL_ANONPORTMIN 28 /* minimum ephemeral port */
|
||||
#define IPV6CTL_ANONPORTMAX 29 /* maximum ephemeral port */
|
||||
#define IPV6CTL_LOWPORTMIN 30 /* minimum reserved port */
|
||||
#define IPV6CTL_LOWPORTMAX 31 /* maximum reserved port */
|
||||
/* 32 to 38: reserved */
|
||||
#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
|
||||
/* 40: reserved */
|
||||
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
|
||||
#define IPV6CTL_IFQ 42 /* ip6intrq node */
|
||||
/* New entries should be added here from current IPV6CTL_MAXID value. */
|
||||
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
||||
#define IPV6CTL_MAXID 43
|
||||
|
||||
#define IPV6CTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "forwarding", CTLTYPE_INT }, \
|
||||
{ "redirect", CTLTYPE_INT }, \
|
||||
{ "hlim", CTLTYPE_INT }, \
|
||||
{ "mtu", CTLTYPE_INT }, \
|
||||
{ "forwsrcrt", CTLTYPE_INT }, \
|
||||
{ "stats", CTLTYPE_STRUCT }, \
|
||||
{ 0, 0 }, \
|
||||
{ "mrtproto", CTLTYPE_INT }, \
|
||||
{ "maxfragpackets", CTLTYPE_INT }, \
|
||||
{ "sourcecheck", CTLTYPE_INT }, \
|
||||
{ "sourcecheck_logint", CTLTYPE_INT }, \
|
||||
{ "accept_rtadv", CTLTYPE_INT }, \
|
||||
{ "keepfaith", CTLTYPE_INT }, \
|
||||
{ "log_interval", CTLTYPE_INT }, \
|
||||
{ "hdrnestlimit", CTLTYPE_INT }, \
|
||||
{ "dad_count", CTLTYPE_INT }, \
|
||||
{ "auto_flowlabel", CTLTYPE_INT }, \
|
||||
{ "defmcasthlim", CTLTYPE_INT }, \
|
||||
{ "gifhlim", CTLTYPE_INT }, \
|
||||
{ "kame_version", CTLTYPE_STRING }, \
|
||||
{ "use_deprecated", CTLTYPE_INT }, \
|
||||
{ "rr_prune", CTLTYPE_INT }, \
|
||||
{ 0, 0 }, \
|
||||
{ "v6only", CTLTYPE_INT }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "anonportmin", CTLTYPE_INT }, \
|
||||
{ "anonportmax", CTLTYPE_INT }, \
|
||||
{ "lowportmin", CTLTYPE_INT }, \
|
||||
{ "lowportmax", CTLTYPE_INT }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "maxfrags", CTLTYPE_INT }, \
|
||||
{ "ifq", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
#ifdef _KERNEL
|
||||
struct cmsghdr;
|
||||
|
||||
/*
|
||||
* in6_cksum_phdr:
|
||||
*
|
||||
* Compute significant parts of the IPv6 checksum pseudo-header
|
||||
* for use in a delayed TCP/UDP checksum calculation.
|
||||
*
|
||||
* Args:
|
||||
*
|
||||
* src Source IPv6 address
|
||||
* dst Destination IPv6 address
|
||||
* len htonl(proto-hdr-len)
|
||||
* nxt htonl(next-proto-number)
|
||||
*
|
||||
* NOTE: We expect the src and dst addresses to be 16-bit
|
||||
* aligned!
|
||||
*/
|
||||
static __inline u_int16_t __unused
|
||||
in6_cksum_phdr(const struct in6_addr *src, const struct in6_addr *dst,
|
||||
u_int32_t len, u_int32_t nxt)
|
||||
{
|
||||
u_int32_t sum = 0;
|
||||
const u_int16_t *w;
|
||||
|
||||
/*LINTED*/
|
||||
w = (const u_int16_t *) src;
|
||||
sum += w[0];
|
||||
if (!IN6_IS_SCOPE_LINKLOCAL(src))
|
||||
sum += w[1];
|
||||
sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
|
||||
sum += w[6]; sum += w[7];
|
||||
|
||||
/*LINTED*/
|
||||
w = (const u_int16_t *) dst;
|
||||
sum += w[0];
|
||||
if (!IN6_IS_SCOPE_LINKLOCAL(dst))
|
||||
sum += w[1];
|
||||
sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
|
||||
sum += w[6]; sum += w[7];
|
||||
|
||||
sum += (u_int16_t)(len >> 16) + (u_int16_t)(len /*& 0xffff*/);
|
||||
|
||||
sum += (u_int16_t)(nxt >> 16) + (u_int16_t)(nxt /*& 0xffff*/);
|
||||
|
||||
sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);
|
||||
|
||||
if (sum > 0xffff)
|
||||
sum -= 0xffff;
|
||||
|
||||
return (sum);
|
||||
}
|
||||
|
||||
struct mbuf;
|
||||
struct ifnet;
|
||||
int sockaddr_in6_cmp(const struct sockaddr *, const struct sockaddr *);
|
||||
struct sockaddr *sockaddr_in6_externalize(struct sockaddr *, socklen_t,
|
||||
const struct sockaddr *);
|
||||
int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
|
||||
void in6_delayed_cksum(struct mbuf *);
|
||||
int in6_localaddr(const struct in6_addr *);
|
||||
int in6_addrscope(const struct in6_addr *);
|
||||
struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
|
||||
extern void in6_if_up(struct ifnet *);
|
||||
#ifndef __FreeBSD__
|
||||
extern int in6_src_sysctl(void *, size_t *, void *, size_t);
|
||||
#endif
|
||||
extern void addrsel_policy_init(void);
|
||||
extern u_char ip6_protox[];
|
||||
|
||||
#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
|
||||
#define satocsin6(sa) ((const struct sockaddr_in6 *)(sa))
|
||||
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
|
||||
#define sin6tocsa(sin6) ((const struct sockaddr *)(sin6))
|
||||
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
|
||||
|
||||
static inline void
|
||||
sockaddr_in6_init1(struct sockaddr_in6 *sin6, const struct in6_addr *addr,
|
||||
in_port_t port, uint32_t flowinfo, uint32_t scope_id)
|
||||
{
|
||||
sin6->sin6_port = port;
|
||||
sin6->sin6_flowinfo = flowinfo;
|
||||
sin6->sin6_addr = *addr;
|
||||
sin6->sin6_scope_id = scope_id;
|
||||
}
|
||||
|
||||
static inline void
|
||||
sockaddr_in6_init(struct sockaddr_in6 *sin6, const struct in6_addr *addr,
|
||||
in_port_t port, uint32_t flowinfo, uint32_t scope_id)
|
||||
{
|
||||
sin6->sin6_family = AF_INET6;
|
||||
sin6->sin6_len = sizeof(*sin6);
|
||||
sockaddr_in6_init1(sin6, addr, port, flowinfo, scope_id);
|
||||
}
|
||||
|
||||
static inline struct sockaddr *
|
||||
sockaddr_in6_alloc(const struct in6_addr *addr, in_port_t port,
|
||||
uint32_t flowinfo, uint32_t scope_id, int flags)
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
if ((sa = sockaddr_alloc(AF_INET6, sizeof(struct sockaddr_in6),
|
||||
flags)) == NULL)
|
||||
return NULL;
|
||||
|
||||
sockaddr_in6_init1(satosin6(sa), addr, port, flowinfo, scope_id);
|
||||
|
||||
return sa;
|
||||
}
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
typedef _BSD_SIZE_T_ size_t;
|
||||
#define _SIZE_T
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct cmsghdr;
|
||||
|
||||
void in6_sin6_2_sin(struct sockaddr_in *, struct sockaddr_in6 *);
|
||||
void in6_sin_2_v4mapsin6(struct sockaddr_in *, struct sockaddr_in6 *);
|
||||
void in6_sin6_2_sin_in_sock(struct sockaddr *);
|
||||
void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **);
|
||||
|
||||
extern int inet6_option_space(int);
|
||||
extern int inet6_option_init(void *, struct cmsghdr **, int);
|
||||
extern int inet6_option_append(struct cmsghdr *, const uint8_t *,
|
||||
int, int);
|
||||
extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
|
||||
extern int inet6_option_next(const struct cmsghdr *, uint8_t **);
|
||||
extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int);
|
||||
|
||||
extern size_t inet6_rthdr_space(int, int);
|
||||
extern struct cmsghdr *inet6_rthdr_init(void *, int);
|
||||
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
|
||||
unsigned int);
|
||||
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
|
||||
#if 0 /* not implemented yet */
|
||||
extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
|
||||
#endif
|
||||
extern int inet6_rthdr_segments(const struct cmsghdr *);
|
||||
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
|
||||
extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
|
||||
|
||||
extern int inet6_opt_init(void *, socklen_t);
|
||||
extern int inet6_opt_append(void *, socklen_t, int, uint8_t,
|
||||
socklen_t, uint8_t, void **);
|
||||
extern int inet6_opt_finish(void *, socklen_t, int);
|
||||
extern int inet6_opt_set_val(void *, int, void *, socklen_t);
|
||||
|
||||
extern int inet6_opt_next(void *, socklen_t, int, uint8_t *,
|
||||
socklen_t *, void **);
|
||||
extern int inet6_opt_find(void *, socklen_t, int, uint8_t,
|
||||
socklen_t *, void **);
|
||||
extern int inet6_opt_get_val(void *, int, void *, socklen_t);
|
||||
extern socklen_t inet6_rth_space(int, int);
|
||||
extern void *inet6_rth_init(void *, socklen_t, int, int);
|
||||
extern int inet6_rth_add(void *, const struct in6_addr *);
|
||||
extern int inet6_rth_reverse(const void *, void *);
|
||||
extern int inet6_rth_segments(const void *);
|
||||
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
|
||||
__END_DECLS
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
#endif /* !__minix */
|
||||
|
||||
#endif /* !_NETINET6_IN6_H_ */
|
63
nbsd_include/sys/Makefile
Normal file
63
nbsd_include/sys/Makefile
Normal file
|
@ -0,0 +1,63 @@
|
|||
# $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $
|
||||
|
||||
NETBSDINCSDIR= /usr/netbsd/include
|
||||
INCSDIR= /usr/netbsd/include/sys
|
||||
|
||||
.include <bsd.sys.mk>
|
||||
|
||||
|
||||
# Present only in minix
|
||||
INCS+= ioc_net.h
|
||||
|
||||
INCS+= ansi.h atomic.h \
|
||||
bitops.h bswap.h \
|
||||
cdefs.h cdefs_aout.h ctype_bits.h ctype_inline.h \
|
||||
dirent.h \
|
||||
endian.h errno.h \
|
||||
fcntl.h fd_set.h featuretest.h file.h \
|
||||
float_ieee754.h gcq.h gmon.h hash.h \
|
||||
ieee754.h inttypes.h ioctl.h ipc.h \
|
||||
localedef.h \
|
||||
md4.h md5.h \
|
||||
mman.h mount.h \
|
||||
null.h \
|
||||
param.h poll.h ptrace.h \
|
||||
ptree.h \
|
||||
queue.h \
|
||||
rbtree.h resource.h rmd160.h \
|
||||
select.h sha1.h \
|
||||
sha2.h siginfo.h signal.h sigtypes.h \
|
||||
reboot.h sem.h shm.h socket.h \
|
||||
stat.h statvfs.h \
|
||||
sysctl.h stdint.h \
|
||||
syslimits.h syslog.h \
|
||||
termios.h time.h times.h \
|
||||
tree.h ttycom.h ttydefaults.h \
|
||||
types.h \
|
||||
ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
|
||||
wait.h
|
||||
|
||||
INCSYMLINKS=\
|
||||
${NETBSDINCSDIR}/sys/fcntl.h ${NETBSDINCSDIR}/fcntl.h \
|
||||
${NETBSDINCSDIR}/sys/poll.h ${NETBSDINCSDIR}/poll.h \
|
||||
${NETBSDINCSDIR}/sys/stdint.h ${NETBSDINCSDIR}/stdint.h \
|
||||
${NETBSDINCSDIR}/sys/syslog.h ${NETBSDINCSDIR}/syslog.h \
|
||||
${NETBSDINCSDIR}/sys/termios.h ${NETBSDINCSDIR}/termios.h \
|
||||
${NETBSDINCSDIR}/sys/rmd160.h ${NETBSDINCSDIR}/rmd160.h \
|
||||
${NETBSDINCSDIR}/sys/sha1.h ${NETBSDINCSDIR}/sha1.h \
|
||||
${NETBSDINCSDIR}/sys/sha2.h ${NETBSDINCSDIR}/sha2.h \
|
||||
${NETBSDINCSDIR}/sys/md4.h ${NETBSDINCSDIR}/md4.h \
|
||||
${NETBSDINCSDIR}/sys/md5.h ${NETBSDINCSDIR}/md5.h
|
||||
# sys/exec_elf.h /usr/include/elf.h \
|
||||
|
||||
|
||||
#INCSYMLINKS+= ../soundcard.h ${INCSDIR}/soundcard.h
|
||||
|
||||
namei: namei.src gennameih.awk
|
||||
${TOOL_AWK} -f gennameih.awk < namei.src
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.include "${MINIXSRCDIR}/common/include/sys/Makefile.inc"
|
||||
|
||||
.include <bsd.files.mk>
|
||||
.include <bsd.kinc.mk>
|
69
nbsd_include/sys/ansi.h
Normal file
69
nbsd_include/sys/ansi.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: ansi.h,v 1.13 2010/03/27 22:14:10 tnozaki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jun-ichiro itojun Hagino and by Klaus Klein.
|
||||
*
|
||||
* 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 _SYS_ANSI_H_
|
||||
#define _SYS_ANSI_H_
|
||||
|
||||
#include <machine/ansi.h>
|
||||
|
||||
typedef char * __caddr_t; /* core address */
|
||||
typedef char __gid_t; /* group id */
|
||||
typedef __uint32_t __in_addr_t; /* IP(v4) address */
|
||||
typedef __uint16_t __in_port_t; /* "Internet" port number */
|
||||
typedef unsigned short __mode_t; /* file permissions */
|
||||
typedef long __off_t; /* file offset */
|
||||
typedef int __pid_t; /* process id */
|
||||
typedef __uint8_t __sa_family_t; /* socket address family */
|
||||
typedef __int32_t __socklen_t; /* socket-related datum length */
|
||||
typedef short __uid_t; /* user id */
|
||||
typedef unsigned long __fsblkcnt_t; /* fs block count (statvfs) */
|
||||
typedef unsigned long __fsfilcnt_t; /* fs file count */
|
||||
|
||||
struct __tag_wctrans_t;
|
||||
typedef struct __tag_wctrans_t *__wctrans_t;
|
||||
|
||||
struct __tag_wctype_t;
|
||||
typedef struct __tag_wctype_t *__wctype_t;
|
||||
|
||||
/*
|
||||
* 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 {
|
||||
__int64_t __mbstateL; /* for alignment */
|
||||
char __mbstate8[128];
|
||||
} __mbstate_t;
|
||||
|
||||
#define _BSD_WCTRANS_T_ __wctrans_t /* wctrans_t */
|
||||
#define _BSD_WCTYPE_T_ __wctype_t /* wctype_t */
|
||||
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
|
||||
|
||||
#endif /* !_SYS_ANSI_H_ */
|
154
nbsd_include/sys/atomic.h
Normal file
154
nbsd_include/sys/atomic.h
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* $NetBSD: atomic.h,v 1.11 2009/11/20 02:17:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* 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 _SYS_ATOMIC_H_
|
||||
#define _SYS_ATOMIC_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Atomic ADD
|
||||
*/
|
||||
void atomic_add_32(volatile uint32_t *, int32_t);
|
||||
void atomic_add_int(volatile unsigned int *, int);
|
||||
void atomic_add_long(volatile unsigned long *, long);
|
||||
void atomic_add_ptr(volatile void *, ssize_t);
|
||||
void atomic_add_64(volatile uint64_t *, int64_t);
|
||||
|
||||
uint32_t atomic_add_32_nv(volatile uint32_t *, int32_t);
|
||||
unsigned int atomic_add_int_nv(volatile unsigned int *, int);
|
||||
unsigned long atomic_add_long_nv(volatile unsigned long *, long);
|
||||
void * atomic_add_ptr_nv(volatile void *, ssize_t);
|
||||
uint64_t atomic_add_64_nv(volatile uint64_t *, int64_t);
|
||||
|
||||
/*
|
||||
* Atomic AND
|
||||
*/
|
||||
void atomic_and_32(volatile uint32_t *, uint32_t);
|
||||
void atomic_and_uint(volatile unsigned int *, unsigned int);
|
||||
void atomic_and_ulong(volatile unsigned long *, unsigned long);
|
||||
void atomic_and_64(volatile uint64_t *, uint64_t);
|
||||
|
||||
uint32_t atomic_and_32_nv(volatile uint32_t *, uint32_t);
|
||||
unsigned int atomic_and_uint_nv(volatile unsigned int *, unsigned int);
|
||||
unsigned long atomic_and_ulong_nv(volatile unsigned long *, unsigned long);
|
||||
uint64_t atomic_and_64_nv(volatile uint64_t *, uint64_t);
|
||||
|
||||
/*
|
||||
* Atomic OR
|
||||
*/
|
||||
void atomic_or_32(volatile uint32_t *, uint32_t);
|
||||
void atomic_or_uint(volatile unsigned int *, unsigned int);
|
||||
void atomic_or_ulong(volatile unsigned long *, unsigned long);
|
||||
void atomic_or_64(volatile uint64_t *, uint64_t);
|
||||
|
||||
uint32_t atomic_or_32_nv(volatile uint32_t *, uint32_t);
|
||||
unsigned int atomic_or_uint_nv(volatile unsigned int *, unsigned int);
|
||||
unsigned long atomic_or_ulong_nv(volatile unsigned long *, unsigned long);
|
||||
uint64_t atomic_or_64_nv(volatile uint64_t *, uint64_t);
|
||||
|
||||
/*
|
||||
* Atomic COMPARE-AND-SWAP
|
||||
*/
|
||||
uint32_t atomic_cas_32(volatile uint32_t *, uint32_t, uint32_t);
|
||||
unsigned int atomic_cas_uint(volatile unsigned int *, unsigned int,
|
||||
unsigned int);
|
||||
unsigned long atomic_cas_ulong(volatile unsigned long *, unsigned long,
|
||||
unsigned long);
|
||||
void * atomic_cas_ptr(volatile void *, void *, void *);
|
||||
uint64_t atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t);
|
||||
|
||||
/*
|
||||
* Non-interlocked atomic COMPARE-AND-SWAP.
|
||||
*/
|
||||
uint32_t atomic_cas_32_ni(volatile uint32_t *, uint32_t, uint32_t);
|
||||
unsigned int atomic_cas_uint_ni(volatile unsigned int *, unsigned int,
|
||||
unsigned int);
|
||||
unsigned long atomic_cas_ulong_ni(volatile unsigned long *, unsigned long,
|
||||
unsigned long);
|
||||
void * atomic_cas_ptr_ni(volatile void *, void *, void *);
|
||||
uint64_t atomic_cas_64_ni(volatile uint64_t *, uint64_t, uint64_t);
|
||||
|
||||
/*
|
||||
* Atomic SWAP
|
||||
*/
|
||||
uint32_t atomic_swap_32(volatile uint32_t *, uint32_t);
|
||||
unsigned int atomic_swap_uint(volatile unsigned int *, unsigned int);
|
||||
unsigned long atomic_swap_ulong(volatile unsigned long *, unsigned long);
|
||||
void * atomic_swap_ptr(volatile void *, void *);
|
||||
uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
|
||||
|
||||
/*
|
||||
* Atomic DECREMENT
|
||||
*/
|
||||
void atomic_dec_32(volatile uint32_t *);
|
||||
void atomic_dec_uint(volatile unsigned int *);
|
||||
void atomic_dec_ulong(volatile unsigned long *);
|
||||
void atomic_dec_ptr(volatile void *);
|
||||
void atomic_dec_64(volatile uint64_t *);
|
||||
|
||||
uint32_t atomic_dec_32_nv(volatile uint32_t *);
|
||||
unsigned int atomic_dec_uint_nv(volatile unsigned int *);
|
||||
unsigned long atomic_dec_ulong_nv(volatile unsigned long *);
|
||||
void * atomic_dec_ptr_nv(volatile void *);
|
||||
uint64_t atomic_dec_64_nv(volatile uint64_t *);
|
||||
|
||||
/*
|
||||
* Atomic INCREMENT
|
||||
*/
|
||||
void atomic_inc_32(volatile uint32_t *);
|
||||
void atomic_inc_uint(volatile unsigned int *);
|
||||
void atomic_inc_ulong(volatile unsigned long *);
|
||||
void atomic_inc_ptr(volatile void *);
|
||||
void atomic_inc_64(volatile uint64_t *);
|
||||
|
||||
uint32_t atomic_inc_32_nv(volatile uint32_t *);
|
||||
unsigned int atomic_inc_uint_nv(volatile unsigned int *);
|
||||
unsigned long atomic_inc_ulong_nv(volatile unsigned long *);
|
||||
void * atomic_inc_ptr_nv(volatile void *);
|
||||
uint64_t atomic_inc_64_nv(volatile uint64_t *);
|
||||
|
||||
/*
|
||||
* Memory barrier operations
|
||||
*/
|
||||
void membar_enter(void);
|
||||
void membar_exit(void);
|
||||
void membar_producer(void);
|
||||
void membar_consumer(void);
|
||||
void membar_sync(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ! _SYS_ATOMIC_H_ */
|
294
nbsd_include/sys/bitops.h
Normal file
294
nbsd_include/sys/bitops.h
Normal file
|
@ -0,0 +1,294 @@
|
|||
/* $NetBSD: bitops.h,v 1.7 2010/03/21 14:28:15 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas and Joerg Sonnenberger.
|
||||
*
|
||||
* 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 _SYS_BITOPS_H_
|
||||
#define _SYS_BITOPS_H_
|
||||
|
||||
#include <sys/stdint.h>
|
||||
|
||||
/*
|
||||
* Find First Set functions
|
||||
*/
|
||||
#ifndef ffs32
|
||||
static __inline int __unused
|
||||
ffs32(uint32_t _n)
|
||||
{
|
||||
int _v;
|
||||
|
||||
if (!_n)
|
||||
return 0;
|
||||
|
||||
_v = 1;
|
||||
if ((_n & 0x0000FFFFU) == 0) {
|
||||
_n >>= 16;
|
||||
_v += 16;
|
||||
}
|
||||
if ((_n & 0x000000FFU) == 0) {
|
||||
_n >>= 8;
|
||||
_v += 8;
|
||||
}
|
||||
if ((_n & 0x0000000FU) == 0) {
|
||||
_n >>= 4;
|
||||
_v += 4;
|
||||
}
|
||||
if ((_n & 0x00000003U) == 0) {
|
||||
_n >>= 2;
|
||||
_v += 2;
|
||||
}
|
||||
if ((_n & 0x00000001U) == 0) {
|
||||
_n >>= 1;
|
||||
_v += 1;
|
||||
}
|
||||
return _v;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ffs64
|
||||
static __inline int __unused
|
||||
ffs64(uint64_t _n)
|
||||
{
|
||||
int _v;
|
||||
|
||||
if (!_n)
|
||||
return 0;
|
||||
|
||||
_v = 1;
|
||||
if ((_n & 0x00000000FFFFFFFFULL) == 0) {
|
||||
_n >>= 32;
|
||||
_v += 32;
|
||||
}
|
||||
if ((_n & 0x000000000000FFFFULL) == 0) {
|
||||
_n >>= 16;
|
||||
_v += 16;
|
||||
}
|
||||
if ((_n & 0x00000000000000FFULL) == 0) {
|
||||
_n >>= 8;
|
||||
_v += 8;
|
||||
}
|
||||
if ((_n & 0x000000000000000FULL) == 0) {
|
||||
_n >>= 4;
|
||||
_v += 4;
|
||||
}
|
||||
if ((_n & 0x0000000000000003ULL) == 0) {
|
||||
_n >>= 2;
|
||||
_v += 2;
|
||||
}
|
||||
if ((_n & 0x0000000000000001ULL) == 0) {
|
||||
_n >>= 1;
|
||||
_v += 1;
|
||||
}
|
||||
return _v;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find Last Set functions
|
||||
*/
|
||||
#ifndef fls32
|
||||
static __inline int __unused
|
||||
fls32(uint32_t _n)
|
||||
{
|
||||
int _v;
|
||||
|
||||
if (!_n)
|
||||
return 0;
|
||||
|
||||
_v = 32;
|
||||
if ((_n & 0xFFFF0000U) == 0) {
|
||||
_n <<= 16;
|
||||
_v -= 16;
|
||||
}
|
||||
if ((_n & 0xFF000000U) == 0) {
|
||||
_n <<= 8;
|
||||
_v -= 8;
|
||||
}
|
||||
if ((_n & 0xF0000000U) == 0) {
|
||||
_n <<= 4;
|
||||
_v -= 4;
|
||||
}
|
||||
if ((_n & 0xC0000000U) == 0) {
|
||||
_n <<= 2;
|
||||
_v -= 2;
|
||||
}
|
||||
if ((_n & 0x80000000U) == 0) {
|
||||
_n <<= 1;
|
||||
_v -= 1;
|
||||
}
|
||||
return _v;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef fls64
|
||||
static __inline int __unused
|
||||
fls64(uint64_t _n)
|
||||
{
|
||||
int _v;
|
||||
|
||||
if (!_n)
|
||||
return 0;
|
||||
|
||||
_v = 64;
|
||||
if ((_n & 0xFFFFFFFF00000000ULL) == 0) {
|
||||
_n <<= 32;
|
||||
_v -= 32;
|
||||
}
|
||||
if ((_n & 0xFFFF000000000000ULL) == 0) {
|
||||
_n <<= 16;
|
||||
_v -= 16;
|
||||
}
|
||||
if ((_n & 0xFF00000000000000ULL) == 0) {
|
||||
_n <<= 8;
|
||||
_v -= 8;
|
||||
}
|
||||
if ((_n & 0xF000000000000000ULL) == 0) {
|
||||
_n <<= 4;
|
||||
_v -= 4;
|
||||
}
|
||||
if ((_n & 0xC000000000000000ULL) == 0) {
|
||||
_n <<= 2;
|
||||
_v -= 2;
|
||||
}
|
||||
if ((_n & 0x8000000000000000ULL) == 0) {
|
||||
_n <<= 1;
|
||||
_v -= 1;
|
||||
}
|
||||
return _v;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Integer logarithm, returns -1 on error. Inspired by the linux
|
||||
* version written by David Howells.
|
||||
*/
|
||||
#define _ilog2_helper(_n, _x) ((_n) & (1ULL << (_x))) ? _x :
|
||||
#define ilog2(_n) \
|
||||
( \
|
||||
__builtin_constant_p(_n) ? ( \
|
||||
_ilog2_helper(_n, 63) \
|
||||
_ilog2_helper(_n, 62) \
|
||||
_ilog2_helper(_n, 61) \
|
||||
_ilog2_helper(_n, 60) \
|
||||
_ilog2_helper(_n, 59) \
|
||||
_ilog2_helper(_n, 58) \
|
||||
_ilog2_helper(_n, 57) \
|
||||
_ilog2_helper(_n, 56) \
|
||||
_ilog2_helper(_n, 55) \
|
||||
_ilog2_helper(_n, 54) \
|
||||
_ilog2_helper(_n, 53) \
|
||||
_ilog2_helper(_n, 52) \
|
||||
_ilog2_helper(_n, 51) \
|
||||
_ilog2_helper(_n, 50) \
|
||||
_ilog2_helper(_n, 49) \
|
||||
_ilog2_helper(_n, 48) \
|
||||
_ilog2_helper(_n, 47) \
|
||||
_ilog2_helper(_n, 46) \
|
||||
_ilog2_helper(_n, 45) \
|
||||
_ilog2_helper(_n, 44) \
|
||||
_ilog2_helper(_n, 43) \
|
||||
_ilog2_helper(_n, 42) \
|
||||
_ilog2_helper(_n, 41) \
|
||||
_ilog2_helper(_n, 40) \
|
||||
_ilog2_helper(_n, 39) \
|
||||
_ilog2_helper(_n, 38) \
|
||||
_ilog2_helper(_n, 37) \
|
||||
_ilog2_helper(_n, 36) \
|
||||
_ilog2_helper(_n, 35) \
|
||||
_ilog2_helper(_n, 34) \
|
||||
_ilog2_helper(_n, 33) \
|
||||
_ilog2_helper(_n, 32) \
|
||||
_ilog2_helper(_n, 31) \
|
||||
_ilog2_helper(_n, 30) \
|
||||
_ilog2_helper(_n, 29) \
|
||||
_ilog2_helper(_n, 28) \
|
||||
_ilog2_helper(_n, 27) \
|
||||
_ilog2_helper(_n, 26) \
|
||||
_ilog2_helper(_n, 25) \
|
||||
_ilog2_helper(_n, 24) \
|
||||
_ilog2_helper(_n, 23) \
|
||||
_ilog2_helper(_n, 22) \
|
||||
_ilog2_helper(_n, 21) \
|
||||
_ilog2_helper(_n, 20) \
|
||||
_ilog2_helper(_n, 19) \
|
||||
_ilog2_helper(_n, 18) \
|
||||
_ilog2_helper(_n, 17) \
|
||||
_ilog2_helper(_n, 16) \
|
||||
_ilog2_helper(_n, 15) \
|
||||
_ilog2_helper(_n, 14) \
|
||||
_ilog2_helper(_n, 13) \
|
||||
_ilog2_helper(_n, 12) \
|
||||
_ilog2_helper(_n, 11) \
|
||||
_ilog2_helper(_n, 10) \
|
||||
_ilog2_helper(_n, 9) \
|
||||
_ilog2_helper(_n, 8) \
|
||||
_ilog2_helper(_n, 7) \
|
||||
_ilog2_helper(_n, 6) \
|
||||
_ilog2_helper(_n, 5) \
|
||||
_ilog2_helper(_n, 4) \
|
||||
_ilog2_helper(_n, 3) \
|
||||
_ilog2_helper(_n, 2) \
|
||||
_ilog2_helper(_n, 1) \
|
||||
_ilog2_helper(_n, 0) \
|
||||
-1) : ((sizeof(_n) >= 4 ? fls64(_n) : fls32(_n)) - 1) \
|
||||
)
|
||||
|
||||
static __inline void
|
||||
fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
|
||||
uint8_t *__restrict _s1, uint8_t *__restrict _s2)
|
||||
{
|
||||
uint64_t _mt;
|
||||
int _l;
|
||||
|
||||
_l = fls32(_div - 1);
|
||||
_mt = 0x100000000ULL * ((1ULL << _l) - _div);
|
||||
*_m = (uint32_t)(_mt / _div + 1);
|
||||
*_s1 = (_l > 1) ? 1 : _l;
|
||||
*_s2 = (_l == 0) ? 0 : _l - 1;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static __inline uint32_t
|
||||
fast_divide32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
|
||||
uint8_t _s2)
|
||||
{
|
||||
uint32_t _t;
|
||||
|
||||
_t = (uint32_t)(((uint64_t)_v * _m) >> 32);
|
||||
return (_t + ((_v - _t) >> _s1)) >> _s2;
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
fast_remainder32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
|
||||
uint8_t _s2)
|
||||
{
|
||||
|
||||
return _v - _div * fast_divide32(_v, _div, _m, _s1, _s2);
|
||||
}
|
||||
|
||||
#endif /* _SYS_BITOPS_H_ */
|
79
nbsd_include/sys/bswap.h
Normal file
79
nbsd_include/sys/bswap.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* $NetBSD: bswap.h,v 1.16 2009/08/08 21:23:15 christos Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _SYS_BSWAP_H_
|
||||
#define _SYS_BSWAP_H_
|
||||
|
||||
#ifndef _LOCORE
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <machine/bswap.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/* Always declare the functions in case their address is taken (etc) */
|
||||
#if defined(_KERNEL) || defined(_STANDALONE) || !defined(__BSWAP_RENAME)
|
||||
uint16_t bswap16(uint16_t) __constfunc;
|
||||
uint32_t bswap32(uint32_t) __constfunc;
|
||||
#else
|
||||
uint16_t bswap16(uint16_t) __RENAME(__bswap16) __constfunc;
|
||||
uint32_t bswap32(uint32_t) __RENAME(__bswap32) __constfunc;
|
||||
#endif
|
||||
uint64_t bswap64(uint64_t) __constfunc;
|
||||
__END_DECLS
|
||||
|
||||
#if defined(__GNUC__) && defined(__OPTIMIZE__) && !defined(__lint__)
|
||||
|
||||
/* machine/byte_swap.h might have defined inline versions */
|
||||
#ifndef __BYTE_SWAP_U64_VARIABLE
|
||||
#define __BYTE_SWAP_U64_VARIABLE bswap64
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_SWAP_U32_VARIABLE
|
||||
#define __BYTE_SWAP_U32_VARIABLE bswap32
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_SWAP_U16_VARIABLE
|
||||
#define __BYTE_SWAP_U16_VARIABLE bswap16
|
||||
#endif
|
||||
|
||||
#define __byte_swap_u64_constant(x) \
|
||||
(__CAST(uint64_t, \
|
||||
((((x) & 0xff00000000000000ull) >> 56) | \
|
||||
(((x) & 0x00ff000000000000ull) >> 40) | \
|
||||
(((x) & 0x0000ff0000000000ull) >> 24) | \
|
||||
(((x) & 0x000000ff00000000ull) >> 8) | \
|
||||
(((x) & 0x00000000ff000000ull) << 8) | \
|
||||
(((x) & 0x0000000000ff0000ull) << 24) | \
|
||||
(((x) & 0x000000000000ff00ull) << 40) | \
|
||||
(((x) & 0x00000000000000ffull) << 56))))
|
||||
|
||||
#define __byte_swap_u32_constant(x) \
|
||||
(__CAST(uint32_t, \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))))
|
||||
|
||||
#define __byte_swap_u16_constant(x) \
|
||||
(__CAST(uint16_t, \
|
||||
((((x) & 0xff00) >> 8) | \
|
||||
(((x) & 0x00ff) << 8))))
|
||||
|
||||
#define bswap64(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_u64_constant(x) : __BYTE_SWAP_U64_VARIABLE(x))
|
||||
|
||||
#define bswap32(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_u32_constant(x) : __BYTE_SWAP_U32_VARIABLE(x))
|
||||
|
||||
#define bswap16(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_u16_constant(x) : __BYTE_SWAP_U16_VARIABLE(x))
|
||||
|
||||
#endif /* __GNUC__ && __OPTIMIZE__ */
|
||||
#endif /* !_LOCORE */
|
||||
|
||||
#endif /* !_SYS_BSWAP_H_ */
|
485
nbsd_include/sys/cdefs.h
Normal file
485
nbsd_include/sys/cdefs.h
Normal file
|
@ -0,0 +1,485 @@
|
|||
/* $NetBSD: cdefs.h,v 1.81 2010/12/25 22:30:52 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Berkeley Software Design, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CDEFS_H_
|
||||
#define _SYS_CDEFS_H_
|
||||
|
||||
/*
|
||||
* Macro to test if we're using a GNU C compiler of a specific vintage
|
||||
* or later, for e.g. features that appeared in a particular version
|
||||
* of GNU C. Usage:
|
||||
*
|
||||
* #if __GNUC_PREREQ__(major, minor)
|
||||
* ...cool feature...
|
||||
* #else
|
||||
* ...delete feature...
|
||||
* #endif
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define __GNUC_PREREQ__(x, y) \
|
||||
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
|
||||
(__GNUC__ > (x)))
|
||||
#else
|
||||
#define __GNUC_PREREQ__(x, y) 0
|
||||
#endif
|
||||
|
||||
#include <machine/cdefs.h>
|
||||
#ifdef __ELF__
|
||||
#include <sys/cdefs_elf.h>
|
||||
#else
|
||||
#include <sys/cdefs_aout.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
||||
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
||||
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
|
||||
* in between its arguments. __CONCAT can also concatenate double-quoted
|
||||
* strings produced by the __STRING macro, but this only works with ANSI C.
|
||||
*/
|
||||
|
||||
#define ___STRING(x) __STRING(x)
|
||||
#define ___CONCAT(x,y) __CONCAT(x,y)
|
||||
|
||||
#if __STDC__ || defined(__cplusplus)
|
||||
#define __P(protos) protos /* full-blown ANSI C */
|
||||
#define __CONCAT(x,y) x ## y
|
||||
#define __STRING(x) #x
|
||||
|
||||
#define __const const /* define reserved names to standard */
|
||||
#define __signed signed
|
||||
#define __volatile volatile
|
||||
#if defined(__cplusplus) || defined(__PCC__)
|
||||
#define __inline inline /* convert to C++/C99 keyword */
|
||||
#else
|
||||
#if !defined(__GNUC__) && !defined(__lint__)
|
||||
#define __inline /* delete GCC keyword */
|
||||
#endif /* !__GNUC__ && !__lint__ */
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#else /* !(__STDC__ || __cplusplus) */
|
||||
#define __P(protos) () /* traditional C preprocessor */
|
||||
#define __CONCAT(x,y) x/**/y
|
||||
#define __STRING(x) "x"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __const /* delete pseudo-ANSI C keywords */
|
||||
#define __inline
|
||||
#define __signed
|
||||
#define __volatile
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/*
|
||||
* In non-ANSI C environments, new programs will want ANSI-only C keywords
|
||||
* deleted from the program and old programs will want them left alone.
|
||||
* Programs using the ANSI C keywords const, inline etc. as normal
|
||||
* identifiers should define -DNO_ANSI_KEYWORDS.
|
||||
*/
|
||||
#ifndef NO_ANSI_KEYWORDS
|
||||
#define const __const /* convert ANSI C keywords */
|
||||
#define inline __inline
|
||||
#define signed __signed
|
||||
#define volatile __volatile
|
||||
#endif /* !NO_ANSI_KEYWORDS */
|
||||
#endif /* !(__STDC__ || __cplusplus) */
|
||||
|
||||
/*
|
||||
* Used for internal auditing of the NetBSD source tree.
|
||||
*/
|
||||
#ifdef __AUDIT__
|
||||
#define __aconst __const
|
||||
#else
|
||||
#define __aconst
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following macro is used to remove const cast-away warnings
|
||||
* from gcc -Wcast-qual; it should be used with caution because it
|
||||
* can hide valid errors; in particular most valid uses are in
|
||||
* situations where the API requires it, not to cast away string
|
||||
* constants. We don't use *intptr_t on purpose here and we are
|
||||
* explicit about unsigned long so that we don't have additional
|
||||
* dependencies.
|
||||
*/
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
|
||||
/*
|
||||
* The following macro is used to remove the volatile cast-away warnings
|
||||
* from gcc -Wcast-qual; as above it should be used with caution
|
||||
* because it can hide valid errors or warnings. Valid uses include
|
||||
* making it possible to pass a volatile pointer to memset().
|
||||
* For the same reasons as above, we use unsigned long and not intptr_t.
|
||||
*/
|
||||
#define __UNVOLATILE(a) ((void *)(unsigned long)(volatile void *)(a))
|
||||
|
||||
/*
|
||||
* GCC2 provides __extension__ to suppress warnings for various GNU C
|
||||
* language extensions under "-ansi -pedantic".
|
||||
*/
|
||||
#if !__GNUC_PREREQ__(2, 0)
|
||||
#define __extension__ /* delete __extension__ if non-gcc or gcc1 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GCC1 and some versions of GCC2 declare dead (non-returning) and
|
||||
* pure (no side effects) functions using "volatile" and "const";
|
||||
* unfortunately, these then cause warnings under "-ansi -pedantic".
|
||||
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
|
||||
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
|
||||
* in the distribution version of 2.5.5).
|
||||
*
|
||||
* GCC defines a pure function as depending only on its arguments and
|
||||
* global variables. Typical examples are strlen and sqrt.
|
||||
*
|
||||
* GCC defines a const function as depending only on its arguments.
|
||||
* Therefore calling a const function again with identical arguments
|
||||
* will always produce the same result.
|
||||
*
|
||||
* Rounding modes for floating point operations are considered global
|
||||
* variables and prevent sqrt from being a const function.
|
||||
*
|
||||
* Calls to const functions can be optimised away and moved around
|
||||
* without limitations.
|
||||
*/
|
||||
#if !__GNUC_PREREQ__(2, 0)
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 5)
|
||||
#define __dead __attribute__((__noreturn__))
|
||||
#elif defined(__GNUC__)
|
||||
#define __dead __volatile
|
||||
#else
|
||||
#define __dead
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define __pure __attribute__((__pure__))
|
||||
#elif defined(__GNUC__)
|
||||
#define __pure __const
|
||||
#else
|
||||
#define __pure
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 5)
|
||||
#define __constfunc __attribute__((__const__))
|
||||
#else
|
||||
#define __constfunc
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 0)
|
||||
#define __noinline __attribute__((__noinline__))
|
||||
#else
|
||||
#define __noinline /* nothing */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 7)
|
||||
#define __unused __attribute__((__unused__))
|
||||
#else
|
||||
#define __unused /* delete */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 1)
|
||||
#define __used __attribute__((__used__))
|
||||
#else
|
||||
#define __used __unused
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_EXTERN_C extern "C" {
|
||||
#define __END_EXTERN_C }
|
||||
#define __static_cast(x,y) static_cast<x>(y)
|
||||
#else
|
||||
#define __BEGIN_EXTERN_C
|
||||
#define __END_EXTERN_C
|
||||
#define __static_cast(x,y) (x)y
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 0)
|
||||
# define __dso_public __attribute__((__visibility__("default")))
|
||||
# define __dso_hidden __attribute__((__visibility__("hidden")))
|
||||
# define __BEGIN_PUBLIC_DECLS \
|
||||
_Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
|
||||
# define __END_PUBLIC_DECLS __END_EXTERN_C _Pragma("GCC visibility pop")
|
||||
# define __BEGIN_HIDDEN_DECLS \
|
||||
_Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
|
||||
# define __END_HIDDEN_DECLS __END_EXTERN_C _Pragma("GCC visibility pop")
|
||||
#else
|
||||
# define __dso_public
|
||||
# define __dso_hidden
|
||||
# define __BEGIN_PUBLIC_DECLS __BEGIN_EXTERN_C
|
||||
# define __END_PUBLIC_DECLS __END_EXTERN_C
|
||||
# define __BEGIN_HIDDEN_DECLS __BEGIN_EXTERN_C
|
||||
# define __END_HIDDEN_DECLS __END_EXTERN_C
|
||||
#endif
|
||||
|
||||
#define __BEGIN_DECLS __BEGIN_PUBLIC_DECLS
|
||||
#define __END_DECLS __END_PUBLIC_DECLS
|
||||
|
||||
/*
|
||||
* Non-static C99 inline functions are optional bodies. They don't
|
||||
* create global symbols if not used, but can be replaced if desirable.
|
||||
* This differs from the behavior of GCC before version 4.3. The nearest
|
||||
* equivalent for older GCC is `extern inline'. For newer GCC, use the
|
||||
* gnu_inline attribute additionally to get the old behavior.
|
||||
*
|
||||
* For C99 compilers other than GCC, the C99 behavior is expected.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
|
||||
#define __c99inline extern __attribute__((__gnu_inline__)) __inline
|
||||
#elif defined(__GNUC__)
|
||||
#define __c99inline extern __inline
|
||||
#elif defined(__STDC_VERSION__)
|
||||
#define __c99inline __inline
|
||||
#endif
|
||||
|
||||
#if defined(__lint__)
|
||||
#define __packed __packed
|
||||
#define __aligned(x) /* delete */
|
||||
#define __section(x) /* delete */
|
||||
#elif __GNUC_PREREQ__(2, 7)
|
||||
#define __packed __attribute__((__packed__))
|
||||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
#define __section(x) __attribute__((__section__(x)))
|
||||
#elif defined(__PCC__)
|
||||
#define __packed _Pragma("packed 1")
|
||||
#define __aligned(x) _Pragma("aligned " __STRING(x))
|
||||
#define __section(x) _Pragma("section " ## x)
|
||||
#else
|
||||
#define __packed error: no __packed for this compiler
|
||||
#define __aligned(x) error: no __aligned for this compiler
|
||||
#define __section(x) error: no __section for this compiler
|
||||
#endif
|
||||
|
||||
/*
|
||||
* C99 defines the restrict type qualifier keyword, which was made available
|
||||
* in GCC 2.92.
|
||||
*/
|
||||
#if defined(__lint__)
|
||||
#define __restrict /* delete __restrict when not supported */
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
#define __restrict restrict
|
||||
#elif !__GNUC_PREREQ__(2, 92)
|
||||
#define __restrict /* delete __restrict when not supported */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* C99 defines __func__ predefined identifier, which was made available
|
||||
* in GCC 2.95.
|
||||
*/
|
||||
#if !(__STDC_VERSION__ >= 199901L)
|
||||
#if __GNUC_PREREQ__(2, 6)
|
||||
#define __func__ __PRETTY_FUNCTION__
|
||||
#elif __GNUC_PREREQ__(2, 4)
|
||||
#define __func__ __FUNCTION__
|
||||
#else
|
||||
#define __func__ ""
|
||||
#endif
|
||||
#endif /* !(__STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(NO_KERNEL_RCSIDS)
|
||||
#undef __KERNEL_RCSID
|
||||
#define __KERNEL_RCSID(_n, _s) /* nothing */
|
||||
#endif /* NO_KERNEL_RCSIDS */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#if !defined(_STANDALONE) && !defined(_KERNEL)
|
||||
#if defined(__GNUC__) || defined(__PCC__)
|
||||
#define __RENAME(x) ___RENAME(x)
|
||||
#else
|
||||
#ifdef __lint__
|
||||
#define __RENAME(x) __symbolrename(x)
|
||||
#else
|
||||
#error "No function renaming possible"
|
||||
#endif /* __lint__ */
|
||||
#endif /* __GNUC__ */
|
||||
#else /* _STANDALONE || _KERNEL */
|
||||
#define __RENAME(x) no renaming in kernel or standalone environment
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A barrier to stop the optimizer from moving code or assume live
|
||||
* register values. This is gcc specific, the version is more or less
|
||||
* arbitrary, might work with older compilers.
|
||||
*/
|
||||
#if __GNUC_PREREQ__(2, 95)
|
||||
#define __insn_barrier() __asm __volatile("":::"memory")
|
||||
#else
|
||||
#define __insn_barrier() /* */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GNU C version 2.96 adds explicit branch prediction so that
|
||||
* the CPU back-end can hint the processor and also so that
|
||||
* code blocks can be reordered such that the predicted path
|
||||
* sees a more linear flow, thus improving cache behavior, etc.
|
||||
*
|
||||
* The following two macros provide us with a way to use this
|
||||
* compiler feature. Use __predict_true() if you expect the expression
|
||||
* to evaluate to true, and __predict_false() if you expect the
|
||||
* expression to evaluate to false.
|
||||
*
|
||||
* A few notes about usage:
|
||||
*
|
||||
* * Generally, __predict_false() error condition checks (unless
|
||||
* you have some _strong_ reason to do otherwise, in which case
|
||||
* document it), and/or __predict_true() `no-error' condition
|
||||
* checks, assuming you want to optimize for the no-error case.
|
||||
*
|
||||
* * Other than that, if you don't know the likelihood of a test
|
||||
* succeeding from empirical or other `hard' evidence, don't
|
||||
* make predictions.
|
||||
*
|
||||
* * These are meant to be used in places that are run `a lot'.
|
||||
* It is wasteful to make predictions in code that is run
|
||||
* seldomly (e.g. at subsystem initialization time) as the
|
||||
* basic block reordering that this affects can often generate
|
||||
* larger code.
|
||||
*/
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define __predict_true(exp) __builtin_expect((exp) != 0, 1)
|
||||
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
|
||||
#else
|
||||
#define __predict_true(exp) (exp)
|
||||
#define __predict_false(exp) (exp)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compiler-dependent macros to declare that functions take printf-like
|
||||
* or scanf-like arguments. They are null except for versions of gcc
|
||||
* that are known to support the features properly (old versions of gcc-2
|
||||
* didn't permit keeping the keywords out of the application namespace).
|
||||
*/
|
||||
#if __GNUC_PREREQ__(2, 7)
|
||||
#define __printflike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
|
||||
#define __scanflike(fmtarg, firstvararg) \
|
||||
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
|
||||
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
|
||||
#else
|
||||
#define __printflike(fmtarg, firstvararg) /* nothing */
|
||||
#define __scanflike(fmtarg, firstvararg) /* nothing */
|
||||
#define __format_arg(fmtarg) /* nothing */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for manipulating "link sets". Link sets are arrays of pointers
|
||||
* to objects, which are gathered up by the linker.
|
||||
*
|
||||
* Object format-specific code has provided us with the following macros:
|
||||
*
|
||||
* __link_set_add_text(set, sym)
|
||||
* Add a reference to the .text symbol `sym' to `set'.
|
||||
*
|
||||
* __link_set_add_rodata(set, sym)
|
||||
* Add a reference to the .rodata symbol `sym' to `set'.
|
||||
*
|
||||
* __link_set_add_data(set, sym)
|
||||
* Add a reference to the .data symbol `sym' to `set'.
|
||||
*
|
||||
* __link_set_add_bss(set, sym)
|
||||
* Add a reference to the .bss symbol `sym' to `set'.
|
||||
*
|
||||
* __link_set_decl(set, ptype)
|
||||
* Provide an extern declaration of the set `set', which
|
||||
* contains an array of the pointer type `ptype'. This
|
||||
* macro must be used by any code which wishes to reference
|
||||
* the elements of a link set.
|
||||
*
|
||||
* __link_set_start(set)
|
||||
* This points to the first slot in the link set.
|
||||
*
|
||||
* __link_set_end(set)
|
||||
* This points to the (non-existent) slot after the last
|
||||
* entry in the link set.
|
||||
*
|
||||
* __link_set_count(set)
|
||||
* Count the number of entries in link set `set'.
|
||||
*
|
||||
* In addition, we provide the following macros for accessing link sets:
|
||||
*
|
||||
* __link_set_foreach(pvar, set)
|
||||
* Iterate over the link set `set'. Because a link set is
|
||||
* an array of pointers, pvar must be declared as "type **pvar",
|
||||
* and the actual entry accessed as "*pvar".
|
||||
*
|
||||
* __link_set_entry(set, idx)
|
||||
* Access the link set entry at index `idx' from set `set'.
|
||||
*/
|
||||
#define __link_set_foreach(pvar, set) \
|
||||
for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
|
||||
|
||||
#define __link_set_entry(set, idx) (__link_set_begin(set)[idx])
|
||||
|
||||
/*
|
||||
* Return the number of elements in a statically-allocated array,
|
||||
* __x.
|
||||
*/
|
||||
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
|
||||
|
||||
/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
|
||||
#define __BIT(__n) \
|
||||
(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n)))
|
||||
|
||||
/* __BITS(m, n): bits m through n, m < n. */
|
||||
#define __BITS(__m, __n) \
|
||||
((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
|
||||
|
||||
/* find least significant bit that is set */
|
||||
#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
|
||||
|
||||
#define __PRIuBIT PRIuMAX
|
||||
#define __PRIuBITS __PRIuBIT
|
||||
|
||||
#define __PRIxBIT PRIxMAX
|
||||
#define __PRIxBITS __PRIxBIT
|
||||
|
||||
#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
|
||||
#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
|
||||
#define __SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
|
||||
|
||||
/*
|
||||
* Only to be used in other headers that are included from both c or c++
|
||||
* NOT to be used in code.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define __CAST(__dt, __st) static_cast<__dt>(__st)
|
||||
#else
|
||||
#define __CAST(__dt, __st) ((__dt)(__st))
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_CDEFS_H_ */
|
131
nbsd_include/sys/cdefs_aout.h
Normal file
131
nbsd_include/sys/cdefs_aout.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
/* $NetBSD: cdefs_aout.h,v 1.20 2006/05/18 17:55:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CDEFS_AOUT_H_
|
||||
#define _SYS_CDEFS_AOUT_H_
|
||||
|
||||
#define _C_LABEL(x) __CONCAT(_,x)
|
||||
#define _C_LABEL_STRING(x) "_"x
|
||||
|
||||
#if __STDC__
|
||||
#define ___RENAME(x) __asm(___STRING(_C_LABEL(x)))
|
||||
#else
|
||||
#define ___RENAME(x) ____RENAME(_/**/x)
|
||||
#define ____RENAME(x) __asm(___STRING(x))
|
||||
#endif
|
||||
|
||||
#define __indr_reference(sym,alias) /* nada, since we do weak refs */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if __STDC__
|
||||
#define __strong_alias(alias,sym) \
|
||||
__asm(".global " _C_LABEL_STRING(#alias) "\n" \
|
||||
_C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
|
||||
#define __weak_alias(alias,sym) \
|
||||
__asm(".weak " _C_LABEL_STRING(#alias) "\n" \
|
||||
_C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
|
||||
|
||||
/* Do not use __weak_extern, use __weak_reference instead */
|
||||
#define __weak_extern(sym) \
|
||||
__asm(".weak " _C_LABEL_STRING(#sym));
|
||||
|
||||
#if __GNUC_PREREQ__(4, 0)
|
||||
#define __weak_reference(sym) __attribute__((__weakref__))
|
||||
#else
|
||||
#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))
|
||||
#endif
|
||||
|
||||
#define __warn_references(sym,msg) \
|
||||
__asm(".stabs \"" msg "\",30,0,0,0"); \
|
||||
__asm(".stabs \"_" #sym "\",1,0,0,0");
|
||||
#else /* __STDC__ */
|
||||
#define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
|
||||
#define ___weak_alias(alias,sym) \
|
||||
__asm(".weak alias\nalias = sym");
|
||||
/* Do not use __weak_extern, use __weak_reference instead */
|
||||
#define __weak_extern(sym) ___weak_extern(_/**/sym)
|
||||
#define ___weak_extern(sym) \
|
||||
__asm(".weak sym");
|
||||
|
||||
#if __GNUC_PREREQ__(4, 0)
|
||||
#define __weak_reference(sym) __attribute__((__weakref__))
|
||||
#else
|
||||
#define ___weak_reference(sym) ; __asm(".weak sym");
|
||||
#define __weak_reference(sym) ___weak_reference(_/**/sym)
|
||||
#endif
|
||||
|
||||
#define __warn_references(sym,msg) \
|
||||
__asm(".stabs msg,30,0,0,0"); \
|
||||
__asm(".stabs \"_/**/sym\",1,0,0,0");
|
||||
#endif /* __STDC__ */
|
||||
#else /* __GNUC__ */
|
||||
#define __warn_references(sym,msg)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if defined(__sh__) /* XXX SH COFF */
|
||||
#undef __indr_reference(sym,alias)
|
||||
#undef __warn_references(sym,msg)
|
||||
#define __warn_references(sym,msg)
|
||||
#endif
|
||||
|
||||
#define __IDSTRING(_n,_s) \
|
||||
__asm(".data ; .asciz \"" _s "\" ; .text")
|
||||
|
||||
#undef __KERNEL_RCSID
|
||||
|
||||
#define __RCSID(_s) __IDSTRING(rcsid,_s)
|
||||
#define __SCCSID(_s)
|
||||
#define __SCCSID2(_s)
|
||||
#if 0 /* XXX userland __COPYRIGHTs have \ns in them */
|
||||
#define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
|
||||
#else
|
||||
#define __COPYRIGHT(_s) \
|
||||
static const char copyright[] __attribute__((__unused__)) = _s
|
||||
#endif
|
||||
|
||||
#if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
|
||||
#define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
|
||||
#else
|
||||
#define __KERNEL_RCSID(_n,_s)
|
||||
#endif
|
||||
#define __KERNEL_SCCSID(_n,_s)
|
||||
#define __KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
|
||||
|
||||
#ifndef __lint__
|
||||
#define __link_set_make_entry(set, sym, type) \
|
||||
static void const * const \
|
||||
__link_set_##set##_sym_##sym __used = &sym; \
|
||||
__asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
|
||||
#else
|
||||
#define __link_set_make_entry(set, sym, type) \
|
||||
extern void const * const __link_set_##set##_sym_##sym
|
||||
#endif /* __lint__ */
|
||||
|
||||
#define __link_set_add_text(set, sym) __link_set_make_entry(set, sym, 23)
|
||||
#define __link_set_add_rodata(set, sym) __link_set_make_entry(set, sym, 23)
|
||||
#define __link_set_add_data(set, sym) __link_set_make_entry(set, sym, 25)
|
||||
#define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym, 27)
|
||||
|
||||
#ifdef __minix
|
||||
/* GNU binutils 2.x doesn't support a.out link sets. We need to workaround
|
||||
* this by explicitely creating the N_SETV structure. */
|
||||
#define __link_set_decl(set, ptype)
|
||||
#else
|
||||
#define __link_set_decl(set, ptype) \
|
||||
extern struct { \
|
||||
int __ls_length; \
|
||||
ptype *__ls_items[1]; \
|
||||
} __link_set_##set
|
||||
#endif /* !__minix */
|
||||
|
||||
#define __link_set_start(set) (&(__link_set_##set).__ls_items[0])
|
||||
#define __link_set_end(set) \
|
||||
(&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
|
||||
|
||||
#define __link_set_count(set) ((__link_set_##set).__ls_length)
|
||||
|
||||
#endif /* !_SYS_CDEFS_AOUT_H_ */
|
56
nbsd_include/sys/ctype_bits.h
Normal file
56
nbsd_include/sys/ctype_bits.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: ctype_bits.h,v 1.2 2010/12/14 02:28:57 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. 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.
|
||||
*
|
||||
* @(#)ctype.h 5.3 (Berkeley) 4/3/91
|
||||
* NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CTYPE_BITS_H_
|
||||
#define _SYS_CTYPE_BITS_H_
|
||||
|
||||
#define _CTYPE_U 0x01
|
||||
#define _CTYPE_L 0x02
|
||||
#define _CTYPE_N 0x04
|
||||
#define _CTYPE_S 0x08
|
||||
#define _CTYPE_P 0x10
|
||||
#define _CTYPE_C 0x20
|
||||
#define _CTYPE_X 0x40
|
||||
#define _CTYPE_B 0x80
|
||||
|
||||
extern const unsigned char *_ctype_;
|
||||
extern const short *_tolower_tab_;
|
||||
extern const short *_toupper_tab_;
|
||||
|
||||
#endif /* !_SYS_CTYPE_BITS_H_ */
|
82
nbsd_include/sys/ctype_inline.h
Normal file
82
nbsd_include/sys/ctype_inline.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
/* $NetBSD: ctype_inline.h,v 1.2 2010/12/14 02:28:57 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. 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.
|
||||
*
|
||||
* @(#)ctype.h 5.3 (Berkeley) 4/3/91
|
||||
* NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
|
||||
*/
|
||||
|
||||
#ifndef _CTYPE_INLINE_H_
|
||||
#define _CTYPE_INLINE_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#include <sys/ctype_bits.h>
|
||||
|
||||
#define isdigit(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_N))
|
||||
#define islower(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_L))
|
||||
#define isspace(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_S))
|
||||
#define ispunct(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_P))
|
||||
#define isupper(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_U))
|
||||
#define isalpha(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L)))
|
||||
#define isxdigit(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_N|_CTYPE_X)))
|
||||
#define isalnum(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define isprint(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)))
|
||||
#define isgraph(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define iscntrl(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_C))
|
||||
#define tolower(c) ((int)((_tolower_tab_ + 1)[(c)]))
|
||||
#define toupper(c) ((int)((_toupper_tab_ + 1)[(c)]))
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define isascii(c) ((unsigned)(c) <= 0177)
|
||||
#define toascii(c) ((c) & 0177)
|
||||
#define _tolower(c) ((c) - 'A' + 'a')
|
||||
#define _toupper(c) ((c) - 'a' + 'A')
|
||||
#endif
|
||||
|
||||
#if defined(_ISO_C99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
|
||||
(_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
|
||||
|
||||
/*
|
||||
* isblank() is implemented as C function, due to insufficient bitwidth in
|
||||
* _ctype_. Note that _B does not mean isblank - it means isprint && !isgraph.
|
||||
*/
|
||||
#if 0
|
||||
#define isblank(c) ((int)((_ctype_ + 1)[(c)] & _B))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !_CTYPE_INLINE_H_ */
|
66
nbsd_include/sys/dirent.h
Normal file
66
nbsd_include/sys/dirent.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
#ifndef _SYS_DIRENT_H_
|
||||
#define _SYS_DIRENT_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
/* Redefine d_ino here. */
|
||||
#define d_ino d_fileno
|
||||
|
||||
/*
|
||||
* The dirent structure defines the format of directory entries returned by
|
||||
* the getdents(2) system call.
|
||||
*/
|
||||
|
||||
struct dirent { /* Largest entry (8 slots) */
|
||||
ino_t d_ino; /* I-node number */
|
||||
off_t d_off; /* Offset in directory */
|
||||
unsigned short d_reclen; /* Length of this record */
|
||||
char d_name[1]; /* Null terminated name */
|
||||
};
|
||||
|
||||
#define _DIRENT_NAME_LEN 61 /* Backward compatibility with Minix. */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define MAXNAMLEN _DIRENT_NAME_LEN
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The _DIRENT_ALIGN macro returns the alignment of struct dirent. It
|
||||
* is used to check for bogus pointers and to calculate in advance the
|
||||
* memory required to store a dirent.
|
||||
* Unfortunately Minix doesn't use any standard alignment in dirents
|
||||
* at the moment, so, in order to calculate a safe dirent size, we add
|
||||
* an arbitrary number of bytes to the structure (_DIRENT_PAD), and we
|
||||
* set _DIRENT_ALIGN to zero to pass the pointers checks.
|
||||
* Please, FIXME.
|
||||
*/
|
||||
#define _DIRENT_ALIGN(dp) 0
|
||||
#define _DIRENT_PAD 64
|
||||
/*
|
||||
* The _DIRENT_NAMEOFF macro returns the offset of the d_name field in
|
||||
* struct dirent
|
||||
*/
|
||||
#define _DIRENT_NAMEOFF(dp) \
|
||||
((char *)(void *)&(dp)->d_name - (char *)(void *)dp)
|
||||
/*
|
||||
* The _DIRENT_RECLEN macro gives the minimum record length which will hold
|
||||
* a name of size "namlen".
|
||||
*/
|
||||
#define _DIRENT_RECLEN(dp, namlen) \
|
||||
((_DIRENT_NAMEOFF(dp) + (namlen) + 1 + _DIRENT_PAD + _DIRENT_ALIGN(dp)) & \
|
||||
~_DIRENT_ALIGN(dp))
|
||||
/*
|
||||
* The _DIRENT_SIZE macro returns the minimum record length required for
|
||||
* name name stored in the current record.
|
||||
*/
|
||||
#define _DIRENT_SIZE(dp) _DIRENT_RECLEN(dp, strlen(dp->d_name))
|
||||
/*
|
||||
* The _DIRENT_NEXT macro advances to the next dirent record.
|
||||
*/
|
||||
#define _DIRENT_NEXT(dp) ((void *)((char *)(void *)(dp) + (dp)->d_reclen))
|
||||
/*
|
||||
* The _DIRENT_MINSIZE returns the size of an empty (invalid) record.
|
||||
*/
|
||||
#define _DIRENT_MINSIZE(dp) _DIRENT_RECLEN(dp, 0)
|
||||
|
||||
#endif /* !_SYS_DIRENT_H_ */
|
340
nbsd_include/sys/endian.h
Normal file
340
nbsd_include/sys/endian.h
Normal file
|
@ -0,0 +1,340 @@
|
|||
/* $NetBSD: endian.h,v 1.28 2009/08/08 21:23:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. 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.
|
||||
*
|
||||
* @(#)endian.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ENDIAN_H_
|
||||
#define _SYS_ENDIAN_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
/*
|
||||
* Definitions for byte order, according to byte significance from low
|
||||
* address to high.
|
||||
*/
|
||||
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
|
||||
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
|
||||
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
|
||||
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#ifndef _LOCORE
|
||||
|
||||
/* C-family endian-ness definitions */
|
||||
|
||||
#include <sys/ansi.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef in_addr_t
|
||||
typedef __in_addr_t in_addr_t;
|
||||
#define in_addr_t __in_addr_t
|
||||
#endif
|
||||
|
||||
#ifndef in_port_t
|
||||
typedef __in_port_t in_port_t;
|
||||
#define in_port_t __in_port_t
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
uint32_t htonl(uint32_t) __constfunc;
|
||||
uint16_t htons(uint16_t) __constfunc;
|
||||
uint32_t ntohl(uint32_t) __constfunc;
|
||||
uint16_t ntohs(uint16_t) __constfunc;
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_LOCORE */
|
||||
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
|
||||
|
||||
#include <machine/endian_machdep.h>
|
||||
|
||||
/*
|
||||
* Define the order of 32-bit words in 64-bit words.
|
||||
*/
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define _QUAD_HIGHWORD 1
|
||||
#define _QUAD_LOWWORD 0
|
||||
#endif
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define _QUAD_HIGHWORD 0
|
||||
#define _QUAD_LOWWORD 1
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Traditional names for byteorder. These are defined as the numeric
|
||||
* sequences so that third party code can "#define XXX_ENDIAN" and not
|
||||
* cause errors.
|
||||
*/
|
||||
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
|
||||
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
|
||||
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
|
||||
#define BYTE_ORDER _BYTE_ORDER
|
||||
|
||||
#ifndef _LOCORE
|
||||
|
||||
#include <machine/bswap.h>
|
||||
|
||||
/*
|
||||
* Macros for network/external number representation conversion.
|
||||
*/
|
||||
#if BYTE_ORDER == BIG_ENDIAN && !defined(__lint__)
|
||||
#define ntohl(x) (x)
|
||||
#define ntohs(x) (x)
|
||||
#define htonl(x) (x)
|
||||
#define htons(x) (x)
|
||||
|
||||
#define NTOHL(x) (void) (x)
|
||||
#define NTOHS(x) (void) (x)
|
||||
#define HTONL(x) (void) (x)
|
||||
#define HTONS(x) (void) (x)
|
||||
|
||||
#else /* LITTLE_ENDIAN || !defined(__lint__) */
|
||||
|
||||
#define ntohl(x) bswap32(__CAST(uint32_t, (x)))
|
||||
#define ntohs(x) bswap16(__CAST(uint16_t, (x)))
|
||||
#define htonl(x) bswap32(__CAST(uint32_t, (x)))
|
||||
#define htons(x) bswap16(__CAST(uint16_t, (x)))
|
||||
|
||||
#define NTOHL(x) (x) = ntohl(__CAST(uint32_t, (x)))
|
||||
#define NTOHS(x) (x) = ntohs(__CAST(uint16_t, (x)))
|
||||
#define HTONL(x) (x) = htonl(__CAST(uint32_t, (x)))
|
||||
#define HTONS(x) (x) = htons(__CAST(uint16_t, (x)))
|
||||
#endif /* LITTLE_ENDIAN || !defined(__lint__) */
|
||||
|
||||
/*
|
||||
* Macros to convert to a specific endianness.
|
||||
*/
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
#define htobe16(x) (x)
|
||||
#define htobe32(x) (x)
|
||||
#define htobe64(x) (x)
|
||||
#define htole16(x) bswap16(__CAST(uint16_t, (x)))
|
||||
#define htole32(x) bswap32(__CAST(uint32_t, (x)))
|
||||
#define htole64(x) bswap64(__CAST(uint64_t, (x)))
|
||||
|
||||
#define HTOBE16(x) __CAST(void, (x))
|
||||
#define HTOBE32(x) __CAST(void, (x))
|
||||
#define HTOBE64(x) __CAST(void, (x))
|
||||
#define HTOLE16(x) (x) = bswap16(__CAST(uint16_t, (x)))
|
||||
#define HTOLE32(x) (x) = bswap32(__CAST(uint32_t, (x)))
|
||||
#define HTOLE64(x) (x) = bswap64(__CAST(uint64_t, (x)))
|
||||
|
||||
#else /* LITTLE_ENDIAN */
|
||||
|
||||
#define htobe16(x) bswap16(__CAST(uint16_t, (x)))
|
||||
#define htobe32(x) bswap32(__CAST(uint32_t, (x)))
|
||||
#define htobe64(x) bswap64(__CAST(uint64_t, (x)))
|
||||
#define htole16(x) (x)
|
||||
#define htole32(x) (x)
|
||||
#define htole64(x) (x)
|
||||
|
||||
#define HTOBE16(x) (x) = bswap16(__CAST(uint16_t, (x)))
|
||||
#define HTOBE32(x) (x) = bswap32(__CAST(uint32_t, (x)))
|
||||
#define HTOBE64(x) (x) = bswap64(__CAST(uint64_t, (x)))
|
||||
#define HTOLE16(x) __CAST(void, (x))
|
||||
#define HTOLE32(x) __CAST(void, (x))
|
||||
#define HTOLE64(x) __CAST(void, (x))
|
||||
|
||||
#endif /* LITTLE_ENDIAN */
|
||||
|
||||
#define be16toh(x) htobe16(x)
|
||||
#define be32toh(x) htobe32(x)
|
||||
#define be64toh(x) htobe64(x)
|
||||
#define le16toh(x) htole16(x)
|
||||
#define le32toh(x) htole32(x)
|
||||
#define le64toh(x) htole64(x)
|
||||
|
||||
#define BE16TOH(x) HTOBE16(x)
|
||||
#define BE32TOH(x) HTOBE32(x)
|
||||
#define BE64TOH(x) HTOBE64(x)
|
||||
#define LE16TOH(x) HTOLE16(x)
|
||||
#define LE32TOH(x) HTOLE32(x)
|
||||
#define LE64TOH(x) HTOLE64(x)
|
||||
|
||||
/*
|
||||
* Routines to encode/decode big- and little-endian multi-octet values
|
||||
* to/from an octet stream.
|
||||
*/
|
||||
|
||||
#if __GNUC_PREREQ__(2, 95)
|
||||
|
||||
#define __GEN_ENDIAN_ENC(bits, endian) \
|
||||
static __inline __unused void \
|
||||
endian ## bits ## enc(void *dst, uint ## bits ## _t u) \
|
||||
{ \
|
||||
u = hto ## endian ## bits (u); \
|
||||
__builtin_memcpy(dst, &u, sizeof(u)); \
|
||||
}
|
||||
|
||||
__GEN_ENDIAN_ENC(16, be)
|
||||
__GEN_ENDIAN_ENC(32, be)
|
||||
__GEN_ENDIAN_ENC(64, be)
|
||||
__GEN_ENDIAN_ENC(16, le)
|
||||
__GEN_ENDIAN_ENC(32, le)
|
||||
__GEN_ENDIAN_ENC(64, le)
|
||||
#undef __GEN_ENDIAN_ENC
|
||||
|
||||
#define __GEN_ENDIAN_DEC(bits, endian) \
|
||||
static __inline __unused uint ## bits ## _t \
|
||||
endian ## bits ## dec(const void *buf) \
|
||||
{ \
|
||||
uint ## bits ## _t u; \
|
||||
__builtin_memcpy(&u, buf, sizeof(u)); \
|
||||
return endian ## bits ## toh (u); \
|
||||
}
|
||||
|
||||
__GEN_ENDIAN_DEC(16, be)
|
||||
__GEN_ENDIAN_DEC(32, be)
|
||||
__GEN_ENDIAN_DEC(64, be)
|
||||
__GEN_ENDIAN_DEC(16, le)
|
||||
__GEN_ENDIAN_DEC(32, le)
|
||||
__GEN_ENDIAN_DEC(64, le)
|
||||
#undef __GEN_ENDIAN_DEC
|
||||
|
||||
#else /* !(GCC >= 2.95) */
|
||||
|
||||
static __inline void __unused
|
||||
be16enc(void *buf, uint16_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
p[0] = __CAST(uint8_t, ((__CAST(unsigned, u) >> 8) & 0xff));
|
||||
p[1] = __CAST(uint8_t, (u & 0xff));
|
||||
}
|
||||
|
||||
static __inline void __unused
|
||||
le16enc(void *buf, uint16_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
p[0] = __CAST(uint8_t, (u & 0xff));
|
||||
p[1] = __CAST(uint8_t, ((__CAST(unsigned, u) >> 8) & 0xff));
|
||||
}
|
||||
|
||||
static __inline uint16_t __unused
|
||||
be16dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = __CAST(const uint8_t *, buf);
|
||||
|
||||
return __CAST(uint16_t, ((p[0] << 8) | p[1]));
|
||||
}
|
||||
|
||||
static __inline uint16_t __unused
|
||||
le16dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = __CAST(const uint8_t *, buf);
|
||||
|
||||
return __CAST(uint16_t, ((p[1] << 8) | p[0]));
|
||||
}
|
||||
|
||||
static __inline void __unused
|
||||
be32enc(void *buf, uint32_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
p[0] = __CAST(uint8_t, ((u >> 24) & 0xff));
|
||||
p[1] = __CAST(uint8_t, ((u >> 16) & 0xff));
|
||||
p[2] = __CAST(uint8_t, ((u >> 8) & 0xff));
|
||||
p[3] = __CAST(uint8_t, (u & 0xff));
|
||||
}
|
||||
|
||||
static __inline void __unused
|
||||
le32enc(void *buf, uint32_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
p[0] = __CAST(uint8_t, (u & 0xff));
|
||||
p[1] = __CAST(uint8_t, ((u >> 8) & 0xff));
|
||||
p[2] = __CAST(uint8_t, ((u >> 16) & 0xff));
|
||||
p[3] = __CAST(uint8_t, ((u >> 24) & 0xff));
|
||||
}
|
||||
|
||||
static __inline uint32_t __unused
|
||||
be32dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = __CAST(const uint8_t *, buf);
|
||||
|
||||
return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
|
||||
}
|
||||
|
||||
static __inline uint32_t __unused
|
||||
le32dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = __CAST(const uint8_t *, buf);
|
||||
|
||||
return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
|
||||
}
|
||||
|
||||
static __inline void __unused
|
||||
be64enc(void *buf, uint64_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
be32enc(p, __CAST(uint32_t, (u >> 32)));
|
||||
be32enc(p + 4, __CAST(uint32_t, (u & 0xffffffffULL)));
|
||||
}
|
||||
|
||||
static __inline void __unused
|
||||
le64enc(void *buf, uint64_t u)
|
||||
{
|
||||
uint8_t *p = __CAST(uint8_t *, buf);
|
||||
|
||||
le32enc(p, __CAST(uint32_t, (u & 0xffffffffULL)));
|
||||
le32enc(p + 4, __CAST(uint32_t, (u >> 32)));
|
||||
}
|
||||
|
||||
static __inline uint64_t __unused
|
||||
be64dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = (const uint8_t *)buf;
|
||||
|
||||
return ((__CAST(uint64_t, be32dec(p)) << 32) | be32dec(p + 4));
|
||||
}
|
||||
|
||||
static __inline uint64_t __unused
|
||||
le64dec(const void *buf)
|
||||
{
|
||||
const uint8_t *p = (const uint8_t *)buf;
|
||||
|
||||
return (le32dec(p) | (__CAST(uint64_t, le32dec(p + 4)) << 32));
|
||||
}
|
||||
|
||||
#endif /* GCC >= 2.95 */
|
||||
|
||||
#endif /* !_LOCORE */
|
||||
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
#endif /* !_SYS_ENDIAN_H_ */
|
173
nbsd_include/sys/errno.h
Normal file
173
nbsd_include/sys/errno.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* The <errno.h> header defines the numbers of the various errors that can
|
||||
* occur during program execution. They are visible to user programs and
|
||||
* should be small positive integers. However, they are also used within
|
||||
* MINIX, where they must be negative. For example, the READ system call is
|
||||
* executed internally by calling do_read(). This function returns either a
|
||||
* (negative) error number or a (positive) number of bytes actually read.
|
||||
*
|
||||
* To solve the problem of having the error numbers be negative inside the
|
||||
* the system and positive outside, the following mechanism is used. All the
|
||||
* definitions are are the form:
|
||||
*
|
||||
* <define> EPERM (_SIGN 1 )
|
||||
*
|
||||
* If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is
|
||||
* set to "". Thus when compiling the operating system, the macro _SYSTEM
|
||||
* will be defined, setting EPERM to (- 1), whereas when when this
|
||||
* file is included in an ordinary user program, EPERM has the value ( 1).
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H /* check if <errno.h> is already included */
|
||||
# define _ERRNO_H /* it is not included; note that fact */
|
||||
|
||||
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
|
||||
#ifdef _SYSTEM
|
||||
# define _SIGN -
|
||||
# define OK 0
|
||||
#else
|
||||
# define _SIGN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define EGENERIC (_SIGN 99 ) /* generic error */
|
||||
#define EPERM (_SIGN 1 ) /* operation not permitted */
|
||||
#define ENOENT (_SIGN 2 ) /* no such file or directory */
|
||||
#define ESRCH (_SIGN 3 ) /* no such process */
|
||||
#define EINTR (_SIGN 4 ) /* interrupted function call */
|
||||
#define EIO (_SIGN 5 ) /* input/output error */
|
||||
#define ENXIO (_SIGN 6 ) /* no such device or address */
|
||||
#define E2BIG (_SIGN 7 ) /* arg list too long */
|
||||
#define ENOEXEC (_SIGN 8 ) /* exec format error */
|
||||
#define EBADF (_SIGN 9 ) /* bad file descriptor */
|
||||
#define ECHILD (_SIGN 10 ) /* no child process */
|
||||
#define EAGAIN (_SIGN 11 ) /* resource temporarily unavailable */
|
||||
#define ENOMEM (_SIGN 12 ) /* not enough space */
|
||||
#define EACCES (_SIGN 13 ) /* permission denied */
|
||||
#define EFAULT (_SIGN 14 ) /* bad address */
|
||||
#define ENOTBLK (_SIGN 15 ) /* Extension: not a block special file */
|
||||
#define EBUSY (_SIGN 16 ) /* resource busy */
|
||||
#define EEXIST (_SIGN 17 ) /* file exists */
|
||||
#define EXDEV (_SIGN 18 ) /* improper link */
|
||||
#define ENODEV (_SIGN 19 ) /* no such device */
|
||||
#define ENOTDIR (_SIGN 20 ) /* not a directory */
|
||||
#define EISDIR (_SIGN 21 ) /* is a directory */
|
||||
#define EINVAL (_SIGN 22 ) /* invalid argument */
|
||||
#define ENFILE (_SIGN 23 ) /* too many open files in system */
|
||||
#define EMFILE (_SIGN 24 ) /* too many open files */
|
||||
#define ENOTTY (_SIGN 25 ) /* inappropriate I/O control operation */
|
||||
#define ETXTBSY (_SIGN 26 ) /* no longer used */
|
||||
#define EFBIG (_SIGN 27 ) /* file too large */
|
||||
#define ENOSPC (_SIGN 28 ) /* no space left on device */
|
||||
#define ESPIPE (_SIGN 29 ) /* invalid seek */
|
||||
#define EROFS (_SIGN 30 ) /* read-only file system */
|
||||
#define EMLINK (_SIGN 31 ) /* too many links */
|
||||
#define EPIPE (_SIGN 32 ) /* broken pipe */
|
||||
#define EDOM (_SIGN 33 ) /* domain error (from ANSI C std ) */
|
||||
#define ERANGE (_SIGN 34 ) /* result too large (from ANSI C std ) */
|
||||
#define EDEADLK (_SIGN 35 ) /* resource deadlock avoided */
|
||||
#define ENAMETOOLONG (_SIGN 36 ) /* file name too long */
|
||||
#define ENOLCK (_SIGN 37 ) /* no locks available */
|
||||
#define ENOSYS (_SIGN 38 ) /* function not implemented */
|
||||
#define ENOTEMPTY (_SIGN 39 ) /* directory not empty */
|
||||
#define ELOOP (_SIGN 40 ) /* too many levels of symlinks detected */
|
||||
#define ERESTART (_SIGN 41 ) /* service restarted */
|
||||
#define EIDRM (_SIGN 43 ) /* Identifier removed */
|
||||
#define EILSEQ (_SIGN 44 ) /* illegal byte sequence */
|
||||
#define ENOMSG (_SIGN 45 ) /* No message of desired type */
|
||||
#define EOVERFLOW (_SIGN 46 ) /* Value too large to be stored in data type */
|
||||
|
||||
/* The following errors relate to networking. */
|
||||
#define EPACKSIZE (_SIGN 50 ) /* invalid packet size for some protocol */
|
||||
#define ENOBUFS (_SIGN 51 ) /* not enough buffers left */
|
||||
#define EBADIOCTL (_SIGN 52 ) /* illegal ioctl for device */
|
||||
#define EBADMODE (_SIGN 53 ) /* badmode in ioctl */
|
||||
#define EWOULDBLOCK (_SIGN 54 ) /* call would block on nonblocking socket */
|
||||
#define ENETUNREACH (_SIGN 55 ) /* network unreachable */
|
||||
#define EHOSTUNREACH (_SIGN 56 ) /* host unreachable */
|
||||
#define EISCONN (_SIGN 57 ) /* already connected */
|
||||
#define EADDRINUSE (_SIGN 58 ) /* address in use */
|
||||
#define ECONNREFUSED (_SIGN 59 ) /* connection refused */
|
||||
#define ECONNRESET (_SIGN 60 ) /* connection reset */
|
||||
#define ETIMEDOUT (_SIGN 61 ) /* connection timed out */
|
||||
#define EURG (_SIGN 62 ) /* urgent data present */
|
||||
#define ENOURG (_SIGN 63 ) /* no urgent data present */
|
||||
#define ENOTCONN (_SIGN 64 ) /* no connection (yet or anymore ) */
|
||||
#define ESHUTDOWN (_SIGN 65 ) /* a write call to a shutdown connection */
|
||||
#define ENOCONN (_SIGN 66 ) /* no such connection */
|
||||
#define EAFNOSUPPORT (_SIGN 67 ) /* address family not supported */
|
||||
#define EPROTONOSUPPORT (_SIGN 68 ) /* protocol not supported by AF */
|
||||
#define EPROTOTYPE (_SIGN 69 ) /* Protocol wrong type for socket */
|
||||
#define EINPROGRESS (_SIGN 70 ) /* Operation now in progress */
|
||||
#define EADDRNOTAVAIL (_SIGN 71 ) /* Can't assign requested address */
|
||||
#define EALREADY (_SIGN 72 ) /* Connection already in progress */
|
||||
#define EMSGSIZE (_SIGN 73 ) /* Message too long */
|
||||
#define ENOTSOCK (_SIGN 74 ) /* Socket operation on non-socket */
|
||||
#define ENOPROTOOPT (_SIGN 75 ) /* Protocol not available */
|
||||
#define EOPNOTSUPP (_SIGN 76 ) /* Operation not supported */
|
||||
#define ENOTSUP EOPNOTSUPP /* Not supported */
|
||||
#define ENETDOWN (_SIGN 77 ) /* network is down */
|
||||
#define ECONNABORTED (_SIGN 78 ) /* Software caused connection abort */
|
||||
#define EDESTADDRREQ (_SIGN 79 ) /* Destination address required */
|
||||
#define EHOSTDOWN (_SIGN 80 ) /* Host is down */
|
||||
#define ENETRESET (_SIGN 81 ) /* Network dropped connection on reset */
|
||||
#define ESOCKTNOSUPPORT (_SIGN 82 ) /* Socket type not supported */
|
||||
#define EPFNOSUPPORT (_SIGN 83 ) /* Protocol family not supported */
|
||||
#define ETOOMANYREFS (_SIGN 84 ) /* Too many references: can't splice */
|
||||
|
||||
/* The following are not POSIX errors, but they can still happen.
|
||||
* All of these are generated by the kernel and relate to message passing.
|
||||
*/
|
||||
#define ELOCKED (_SIGN 101 ) /* can't send message due to deadlock */
|
||||
#define EBADCALL (_SIGN 102 ) /* illegal system call number */
|
||||
#define EBADSRCDST (_SIGN 103 ) /* bad source or destination process */
|
||||
#define ECALLDENIED (_SIGN 104 ) /* no permission for system call */
|
||||
#define EDEADSRCDST (_SIGN 105 ) /* source or destination is not alive */
|
||||
#define ENOTREADY (_SIGN 106 ) /* source or destination is not ready */
|
||||
#define EBADREQUEST (_SIGN 107 ) /* destination cannot handle request */
|
||||
#define ETRAPDENIED (_SIGN 110 ) /* IPC trap not allowed */
|
||||
#define EDONTREPLY (_SIGN 201 ) /* pseudo-code: don't send a reply */
|
||||
|
||||
/* The following errors are NetBSD errors. */
|
||||
#define EFTYPE (_SIGN 150 ) /* Inappropriate file type or format */
|
||||
#define EAUTH (_SIGN 151 ) /* Authentication error */
|
||||
#define ENEEDAUTH (_SIGN 152 ) /* Need authenticator */
|
||||
/* Realtime option errors */
|
||||
#define ECANCELED (_SIGN 153 ) /* Operation canceled */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE (_SIGN 160 ) /* Stale NFS file handle */
|
||||
#define EREMOTE (_SIGN 161 ) /* Too many levels of remote in path */
|
||||
#define EBADRPC (_SIGN 162 ) /* RPC struct is bad */
|
||||
#define ERPCMISMATCH (_SIGN 163 ) /* RPC version wrong */
|
||||
#define EPROGUNAVAIL (_SIGN 164 ) /* RPC prog. not avail */
|
||||
#define EPROGMISMATCH (_SIGN 165 ) /* Program version wrong */
|
||||
#define EPROCUNAVAIL (_SIGN 166 ) /* Bad procedure for program */
|
||||
|
||||
/* Realtime, XSI STREAMS option errors */
|
||||
#define EBADMSG (_SIGN 170 ) /* Bad or Corrupt message */
|
||||
|
||||
/* quotas & mush */
|
||||
#define EPROCLIM (_SIGN 175 ) /* Too many processes */
|
||||
#define EUSERS (_SIGN 176 ) /* Too many users */
|
||||
#define EDQUOT (_SIGN 177 ) /* Disc quota exceeded */
|
||||
|
||||
/* Realtime, XSI STREAMS option errors */
|
||||
#define EMULTIHOP (_SIGN 180 ) /* Multihop attempted */
|
||||
#define ENOLINK (_SIGN 181 ) /* Link has been severed */
|
||||
#define EPROTO (_SIGN 182 ) /* Protocol error */
|
||||
|
||||
/* File system extended attribute errors */
|
||||
#define ENOATTR (_SIGN 185 ) /* Attribute not found */
|
||||
|
||||
/* XSI STREAMS option errors */
|
||||
#define ENODATA (_SIGN 190 ) /* No message available */
|
||||
#define ENOSR (_SIGN 191 ) /* No STREAM resources */
|
||||
#define ENOSTR (_SIGN 192 ) /* Not a STREAM */
|
||||
#define ETIME (_SIGN 193 ) /* STREAM ioctl timeout */
|
||||
|
||||
#define ELAST EDONTREPLY /* Must equal largest errno */
|
||||
|
||||
/* Here are the numerical values of the error numbers. */
|
||||
#define _NERROR 201 /* number of errors */
|
||||
#endif /* _ERRNO_H */
|
137
nbsd_include/sys/fcntl.h
Normal file
137
nbsd_include/sys/fcntl.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
#ifndef _SYS_FCNTL_H_
|
||||
#define _SYS_FCNTL_H_
|
||||
|
||||
/*
|
||||
* This file includes the definitions for open and fcntl
|
||||
* described by POSIX for <fcntl.h>.
|
||||
*/
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#include <sys/stat.h>
|
||||
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
|
||||
/*
|
||||
* File status flags: these are used by open(2), fcntl(2).
|
||||
* They are also used (indirectly) in the kernel file structure f_flags,
|
||||
* which is a superset of the open/fcntl flags. Open flags and f_flags
|
||||
* are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
|
||||
* Open/fcntl flags begin with O_; kernel-internal flags begin with F.
|
||||
*/
|
||||
/* open-only flags */
|
||||
#define O_RDONLY 0x00000000 /* open for reading only */
|
||||
#define O_WRONLY 0x00000001 /* open for writing only */
|
||||
#define O_RDWR 0x00000002 /* open for reading and writing */
|
||||
#define O_ACCMODE 0x00000003 /* mask for above modes */
|
||||
|
||||
/* File status flags for open() and fcntl(). POSIX Table 6-5. */
|
||||
#define O_APPEND 02000 /* set append mode */
|
||||
#define O_NONBLOCK 04000 /* no delay */
|
||||
#define O_REOPEN 010000 /* automatically re-open device after driver
|
||||
* restart
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __minix /* NOT SUPPORTED! */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define O_SHLOCK 0x00000010 /* open with shared file lock */
|
||||
#define O_EXLOCK 0x00000020 /* open with exclusive file lock */
|
||||
#define O_ASYNC 0x00000040 /* signal pgrp when data ready */
|
||||
#endif
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || \
|
||||
(defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
#define O_SYNC 0x00000080 /* synchronous writes */
|
||||
#endif
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define O_NOFOLLOW 0x00000100 /* don't follow symlinks on the last */
|
||||
/* path component */
|
||||
#endif
|
||||
#endif /* !__minix */
|
||||
|
||||
/* Oflag values for open(). POSIX Table 6-4. */
|
||||
#define O_CREAT 00100 /* creat file if it doesn't exist */
|
||||
#define O_EXCL 00200 /* exclusive use flag */
|
||||
#define O_NOCTTY 00400 /* do not assign a controlling terminal */
|
||||
#define O_TRUNC 01000 /* truncate flag */
|
||||
|
||||
#ifndef __minix /* NOT SUPPORTED! */
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#define O_DSYNC 0x00010000 /* write: I/O data completion */
|
||||
#define O_RSYNC 0x00020000 /* read: I/O completion as for write */
|
||||
#endif
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define O_ALT_IO 0x00040000 /* use alternate i/o semantics */
|
||||
#define O_DIRECT 0x00080000 /* direct I/O hint */
|
||||
#endif
|
||||
#endif /* !__minix */
|
||||
|
||||
/*
|
||||
* Constants used for fcntl(2)
|
||||
*/
|
||||
|
||||
/* command values */
|
||||
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
|
||||
#define F_DUPFD 0 /* duplicate file descriptor */
|
||||
#define F_GETFD 1 /* get file descriptor flags */
|
||||
#define F_SETFD 2 /* set file descriptor flags */
|
||||
#define F_GETFL 3 /* get file status flags */
|
||||
#define F_SETFL 4 /* set file status flags */
|
||||
#define F_GETLK 5 /* get record locking information */
|
||||
#define F_SETLK 6 /* set record locking information */
|
||||
#define F_SETLKW 7 /* set record locking info; wait if blocked */
|
||||
#define F_FREESP 8 /* free a section of a regular file */
|
||||
|
||||
/* File descriptor flags used for fcntl(). POSIX Table 6-2. */
|
||||
#define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */
|
||||
|
||||
/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
|
||||
#define F_RDLCK 1 /* shared or read lock */
|
||||
#define F_WRLCK 2 /* exclusive or write lock */
|
||||
#define F_UNLCK 3 /* unlock */
|
||||
|
||||
/*
|
||||
* Advisory file segment locking data type -
|
||||
* information passed to system by user
|
||||
*/
|
||||
struct flock {
|
||||
short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
|
||||
short l_whence; /* flag for starting offset */
|
||||
off_t l_start; /* relative offset in bytes */
|
||||
off_t l_len; /* size; if 0, then until EOF */
|
||||
pid_t l_pid; /* process id of the locks' owner */
|
||||
};
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/* lock operations for flock(2) */
|
||||
#define LOCK_SH F_RDLCK /* Shared lock */
|
||||
#define LOCK_EX F_WRLCK /* Exclusive lock */
|
||||
#define LOCK_NB 0x0080 /* Do not block when locking */
|
||||
#define LOCK_UN F_UNLCK /* Unlock */
|
||||
#endif
|
||||
|
||||
/* Always ensure that these are consistent with <stdio.h> and <unistd.h>! */
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int open(const char *, int, ...);
|
||||
int creat(const char *, mode_t);
|
||||
int fcntl(int, int, ...);
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
int flock(int, int);
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_FCNTL_H_ */
|
108
nbsd_include/sys/fd_set.h
Normal file
108
nbsd_include/sys/fd_set.h
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* $NetBSD: fd_set.h,v 1.2 2005/12/11 12:25:20 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 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.
|
||||
*
|
||||
* from: @(#)types.h 8.4 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FD_SET_H_
|
||||
#define _SYS_FD_SET_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <machine/int_types.h>
|
||||
|
||||
/*
|
||||
* Implementation dependent defines, hidden from user space. X/Open does not
|
||||
* specify them.
|
||||
*/
|
||||
#define __NBBY 8 /* number of bits in a byte */
|
||||
typedef __int32_t __fd_mask;
|
||||
|
||||
/* bits per mask */
|
||||
#define __NFDBITS ((unsigned int)sizeof(__fd_mask) * __NBBY)
|
||||
|
||||
#define __howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||
|
||||
/*
|
||||
* Select uses bit masks of file descriptors in longs. These macros
|
||||
* manipulate such bit fields (the filesystem macros use chars).
|
||||
* FD_SETSIZE may be defined by the user, but the default here should
|
||||
* be enough for most uses.
|
||||
*/
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 256
|
||||
#endif
|
||||
|
||||
typedef struct fd_set {
|
||||
__fd_mask fds_bits[__howmany(FD_SETSIZE, __NFDBITS)];
|
||||
} fd_set;
|
||||
|
||||
#define FD_SET(n, p) \
|
||||
((p)->fds_bits[(n)/__NFDBITS] |= (1 << ((n) % __NFDBITS)))
|
||||
#define FD_CLR(n, p) \
|
||||
((p)->fds_bits[(n)/__NFDBITS] &= ~(1 << ((n) % __NFDBITS)))
|
||||
#define FD_ISSET(n, p) \
|
||||
((p)->fds_bits[(n)/__NFDBITS] & (1 << ((n) % __NFDBITS)))
|
||||
#if __GNUC_PREREQ__(2, 95)
|
||||
#define FD_ZERO(p) (void)__builtin_memset((p), 0, sizeof(*(p)))
|
||||
#else
|
||||
#define FD_ZERO(p) do { \
|
||||
fd_set *__fds = (p); \
|
||||
unsigned int __i; \
|
||||
for (__i = 0; __i < __howmany(FD_SETSIZE, __NFDBITS); __i++) \
|
||||
__fds->fds_bits[__i] = 0; \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
#endif /* GCC 2.95 */
|
||||
|
||||
/*
|
||||
* Expose our internals if we are not required to hide them.
|
||||
*/
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
|
||||
#define fd_mask __fd_mask
|
||||
#define NFDBITS __NFDBITS
|
||||
#ifndef howmany
|
||||
#define howmany(a, b) __howmany(a, b)
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 95)
|
||||
#define FD_COPY(f, t) (void)__builtin_memcpy((t), (f), sizeof(*(f)))
|
||||
#else
|
||||
#define FD_COPY(f, t) do { \
|
||||
fd_set *__f = (f), *__t = (t); \
|
||||
unsigned int __i; \
|
||||
for (__i = 0; __i < __howmany(FD_SETSIZE, __NFDBITS); __i++) \
|
||||
__t->fds_bits[__i] = __f->fds_bits[__i]; \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
#endif /* GCC 2.95 */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
#endif /* _SYS_FD_SET_H_ */
|
81
nbsd_include/sys/featuretest.h
Normal file
81
nbsd_include/sys/featuretest.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
/* $NetBSD: featuretest.h,v 1.9 2009/05/04 16:44:14 ginsbach Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998.
|
||||
* Public domain.
|
||||
*
|
||||
* NOTE: Do not protect this header against multiple inclusion. Doing
|
||||
* so can have subtle side-effects due to header file inclusion order
|
||||
* and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead,
|
||||
* protect each CPP macro that we want to supply.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Feature-test macros are defined by several standards, and allow an
|
||||
* application to specify what symbols they want the system headers to
|
||||
* expose, and hence what standard they want them to conform to.
|
||||
* There are two classes of feature-test macros. The first class
|
||||
* specify complete standards, and if one of these is defined, header
|
||||
* files will try to conform to the relevant standard. They are:
|
||||
*
|
||||
* ANSI macros:
|
||||
* _ANSI_SOURCE ANSI C89
|
||||
*
|
||||
* POSIX macros:
|
||||
* _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?)
|
||||
* _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990
|
||||
* _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992
|
||||
* _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993
|
||||
* _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996
|
||||
* _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001
|
||||
* _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008
|
||||
*
|
||||
* X/Open macros:
|
||||
* _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2
|
||||
* _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions
|
||||
* _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5
|
||||
* _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2
|
||||
* _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option
|
||||
* _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option
|
||||
*
|
||||
* NetBSD macros:
|
||||
* _NETBSD_SOURCE == 1 Make all NetBSD features available.
|
||||
*
|
||||
* If more than one of these "major" feature-test macros is defined,
|
||||
* then the set of facilities provided (and namespace used) is the
|
||||
* union of that specified by the relevant standards, and in case of
|
||||
* conflict, the earlier standard in the above list has precedence (so
|
||||
* if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version
|
||||
* of rename() that's used is the POSIX one). If none of the "major"
|
||||
* feature-test macros is defined, _NETBSD_SOURCE is assumed.
|
||||
*
|
||||
* There are also "minor" feature-test macros, which enable extra
|
||||
* functionality in addition to some base standard. They should be
|
||||
* defined along with one of the "major" macros. The "minor" macros
|
||||
* are:
|
||||
*
|
||||
* _REENTRANT
|
||||
* _ISOC99_SOURCE
|
||||
* _LARGEFILE_SOURCE Large File Support
|
||||
* <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html>
|
||||
*/
|
||||
|
||||
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
|
||||
#define _POSIX_C_SOURCE 1L
|
||||
#endif
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||
!defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
|
||||
#define _NETBSD_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* Never define _REENTRANT on Minix */
|
||||
|
||||
#ifdef __minix
|
||||
|
||||
#if ((_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500) && \
|
||||
!defined(_REENTRANT)
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
|
||||
#endif /* __minix */
|
169
nbsd_include/sys/file.h
Normal file
169
nbsd_include/sys/file.h
Normal file
|
@ -0,0 +1,169 @@
|
|||
/* $NetBSD: file.h,v 1.71 2009/12/24 19:01:12 elad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Andrew Doran.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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:
|
||||
* 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.
|
||||
*
|
||||
* @(#)file.h 8.3 (Berkeley) 1/9/95
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FILE_H_
|
||||
#define _SYS_FILE_H_
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/unistd.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/mallocvar.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/condvar.h>
|
||||
|
||||
struct proc;
|
||||
struct lwp;
|
||||
struct uio;
|
||||
struct iovec;
|
||||
struct stat;
|
||||
struct knote;
|
||||
|
||||
/*
|
||||
* Kernel file descriptor. One entry for each open kernel vnode and
|
||||
* socket.
|
||||
*
|
||||
* This structure is exported via the KERN_FILE and KERN_FILE2 sysctl
|
||||
* calls. Only add members to the end, do not delete them.
|
||||
*/
|
||||
struct file {
|
||||
off_t f_offset; /* first, is 64-bit */
|
||||
kauth_cred_t f_cred; /* creds associated with descriptor */
|
||||
const struct fileops {
|
||||
int (*fo_read) (struct file *, off_t *, struct uio *,
|
||||
kauth_cred_t, int);
|
||||
int (*fo_write) (struct file *, off_t *, struct uio *,
|
||||
kauth_cred_t, int);
|
||||
int (*fo_ioctl) (struct file *, u_long, void *);
|
||||
int (*fo_fcntl) (struct file *, u_int, void *);
|
||||
int (*fo_poll) (struct file *, int);
|
||||
int (*fo_stat) (struct file *, struct stat *);
|
||||
int (*fo_close) (struct file *);
|
||||
int (*fo_kqfilter) (struct file *, struct knote *);
|
||||
void (*fo_restart) (struct file *);
|
||||
void (*fo_spare1) (void);
|
||||
void (*fo_spare2) (void);
|
||||
} *f_ops;
|
||||
void *f_data; /* descriptor data, e.g. vnode/socket */
|
||||
LIST_ENTRY(file) f_list; /* list of active files */
|
||||
kmutex_t f_lock; /* lock on structure */
|
||||
int f_flag; /* see fcntl.h */
|
||||
u_int f_marker; /* traversal marker (sysctl) */
|
||||
#define DTYPE_VNODE 1 /* file */
|
||||
#define DTYPE_SOCKET 2 /* communications endpoint */
|
||||
#define DTYPE_PIPE 3 /* pipe */
|
||||
#define DTYPE_KQUEUE 4 /* event queue */
|
||||
#define DTYPE_MISC 5 /* misc file descriptor type */
|
||||
#define DTYPE_CRYPTO 6 /* crypto */
|
||||
#define DTYPE_MQUEUE 7 /* message queue */
|
||||
#define DTYPE_NAMES \
|
||||
"0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue"
|
||||
u_int f_type; /* descriptor type */
|
||||
u_int f_advice; /* access pattern hint; UVM_ADV_* */
|
||||
u_int f_count; /* reference count */
|
||||
u_int f_msgcount; /* references from message queue */
|
||||
u_int f_unpcount; /* deferred close: see uipc_usrreq.c */
|
||||
SLIST_ENTRY(file) f_unplist; /* deferred close: see uipc_usrreq.c */
|
||||
};
|
||||
|
||||
/*
|
||||
* Flags for fo_read and fo_write and do_fileread/write/v
|
||||
*/
|
||||
#define FOF_UPDATE_OFFSET 0x0001 /* update the file offset */
|
||||
#define FOF_IOV_SYSSPACE 0x0100 /* iov structure in kernel memory */
|
||||
|
||||
LIST_HEAD(filelist, file);
|
||||
extern struct filelist filehead; /* head of list of open files */
|
||||
extern u_int maxfiles; /* kernel limit on # of open files */
|
||||
extern u_int nfiles; /* actual number of open files */
|
||||
|
||||
extern const struct fileops vnops; /* vnode operations for files */
|
||||
|
||||
int dofileread(int, struct file *, void *, size_t,
|
||||
off_t *, int, register_t *);
|
||||
int dofilewrite(int, struct file *, const void *,
|
||||
size_t, off_t *, int, register_t *);
|
||||
|
||||
int do_filereadv(int, const struct iovec *, int, off_t *,
|
||||
int, register_t *);
|
||||
int do_filewritev(int, const struct iovec *, int, off_t *,
|
||||
int, register_t *);
|
||||
|
||||
int fsetown(pid_t *, u_long, const void *);
|
||||
int fgetown(pid_t, u_long, void *);
|
||||
void fownsignal(pid_t, int, int, int, void *);
|
||||
|
||||
/* Commonly used fileops */
|
||||
int fnullop_fcntl(struct file *, u_int, void *);
|
||||
int fnullop_poll(struct file *, int);
|
||||
int fnullop_kqfilter(struct file *, struct knote *);
|
||||
int fbadop_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
|
||||
int fbadop_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
|
||||
int fbadop_ioctl(struct file *, u_long, void *);
|
||||
int fbadop_close(struct file *);
|
||||
int fbadop_stat(struct file *, struct stat *);
|
||||
void fnullop_restart(struct file *);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _SYS_FILE_H_ */
|
111
nbsd_include/sys/float_ieee754.h
Normal file
111
nbsd_include/sys/float_ieee754.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
/* $NetBSD: float_ieee754.h,v 1.8 2005/12/11 12:25:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 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.
|
||||
*
|
||||
* @(#)float.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTICE: This is not a standalone file. To use it, #include it in
|
||||
* your port's float.h header.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FLOAT_IEEE754_H_
|
||||
#define _SYS_FLOAT_IEEE754_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#ifndef FLT_ROUNDS
|
||||
__BEGIN_DECLS
|
||||
extern int __flt_rounds(void);
|
||||
__END_DECLS
|
||||
#define FLT_ROUNDS __flt_rounds()
|
||||
#endif
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||
!defined(_XOPEN_SOURCE) || \
|
||||
((__STDC_VERSION__ - 0) >= 199901L) || \
|
||||
((_POSIX_C_SOURCE - 0) >= 200112L) || \
|
||||
((_XOPEN_SOURCE - 0) >= 600) || \
|
||||
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#if __GNUC_PREREQ__(3, 3)
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#endif /* GCC >= 3.3 */
|
||||
#endif /* defined(FLT_EVAL_METHOD) */
|
||||
#endif /* !defined(_ANSI_SOURCE) && ... */
|
||||
|
||||
#define FLT_RADIX 2 /* b */
|
||||
|
||||
#define FLT_MANT_DIG 24 /* p */
|
||||
#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */
|
||||
#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
|
||||
#define FLT_MIN_EXP (-125) /* emin */
|
||||
#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
|
||||
#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
|
||||
#define FLT_MAX_EXP 128 /* emax */
|
||||
#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
|
||||
#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
|
||||
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_EPSILON 2.2204460492503131E-16
|
||||
#define DBL_DIG 15
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN 2.2250738585072014E-308
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX 1.7976931348623157E+308
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
/*
|
||||
* If no extended-precision type is defined by the machine-dependent
|
||||
* header including this, default to `long double' being double-precision.
|
||||
*/
|
||||
#ifndef LDBL_MANT_DIG
|
||||
#define LDBL_MANT_DIG DBL_MANT_DIG
|
||||
#define LDBL_EPSILON DBL_EPSILON
|
||||
#define LDBL_DIG DBL_DIG
|
||||
#define LDBL_MIN_EXP DBL_MIN_EXP
|
||||
#define LDBL_MIN DBL_MIN
|
||||
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
|
||||
#define LDBL_MAX_EXP DBL_MAX_EXP
|
||||
#define LDBL_MAX DBL_MAX
|
||||
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||
!defined(_XOPEN_SOURCE) || \
|
||||
((__STDC_VERSION__ - 0) >= 199901L) || \
|
||||
((_POSIX_C_SOURCE - 0) >= 200112L) || \
|
||||
((_XOPEN_SOURCE - 0) >= 600) || \
|
||||
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define DECIMAL_DIG 17 /* ceil((1+p*log10(b))-(b==10) */
|
||||
#endif /* !defined(_ANSI_SOURCE) && ... */
|
||||
#endif /* LDBL_MANT_DIG */
|
||||
|
||||
#endif /* _SYS_FLOAT_IEEE754_H_ */
|
463
nbsd_include/sys/gcq.h
Normal file
463
nbsd_include/sys/gcq.h
Normal file
|
@ -0,0 +1,463 @@
|
|||
/* $NetBSD: gcq.h,v 1.2 2007/08/19 07:35:32 kiyohara Exp $ */
|
||||
/*
|
||||
* Not (c) 2007 Matthew Orgass
|
||||
* This file is public domain, meaning anyone can make any use of part or all
|
||||
* of this file including copying into other works without credit. Any use,
|
||||
* modified or not, is solely the responsibility of the user. If this file is
|
||||
* part of a collection then use in the collection is governed by the terms of
|
||||
* the collection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic Circular Queues: Pointer arithmetic is used to recover the
|
||||
* enclosing object. Merge operation is provided. Items can be multiply
|
||||
* removed, but queue traversal requires separate knowledge of the queue head.
|
||||
*/
|
||||
|
||||
#ifndef _GCQ_H
|
||||
#define _GCQ_H
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/types.h>
|
||||
#include <sys/null.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#ifdef GCQ_USE_ASSERT
|
||||
#define GCQ_ASSERT(x) assert(x)
|
||||
#else
|
||||
#ifdef _KERNEL
|
||||
#define GCQ_ASSERT(x) KASSERT(x)
|
||||
#else
|
||||
#define GCQ_ASSERT(x) _DIAGASSERT(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct gcq {
|
||||
struct gcq *q_next;
|
||||
struct gcq *q_prev;
|
||||
};
|
||||
|
||||
struct gcq_head {
|
||||
struct gcq hq;
|
||||
};
|
||||
|
||||
#define GCQ_INIT(q) { &(q), &(q) }
|
||||
#define GCQ_INIT_HEAD(head) { GCQ_INIT((head).hq) }
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_init(struct gcq *q)
|
||||
{
|
||||
q->q_next = q->q_prev = q;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, const, warn_unused_result, always_inline))
|
||||
static inline struct gcq *
|
||||
gcq_q(struct gcq *q)
|
||||
{
|
||||
return q;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, const, warn_unused_result, always_inline))
|
||||
static inline struct gcq *
|
||||
gcq_hq(struct gcq_head *head)
|
||||
{
|
||||
return (struct gcq *)head;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, const, warn_unused_result, always_inline))
|
||||
static inline struct gcq_head *
|
||||
gcq_head(struct gcq *q)
|
||||
{
|
||||
return (struct gcq_head *)q;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_init_head(struct gcq_head *head)
|
||||
{
|
||||
gcq_init(gcq_hq(head));
|
||||
}
|
||||
|
||||
__attribute__((nonnull, pure, warn_unused_result, always_inline))
|
||||
static inline bool
|
||||
gcq_onlist(struct gcq *q)
|
||||
{
|
||||
return (q->q_next != q);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, pure, warn_unused_result, always_inline))
|
||||
static inline bool
|
||||
gcq_empty(struct gcq_head *head)
|
||||
{
|
||||
return (!gcq_onlist(gcq_hq(head)));
|
||||
}
|
||||
|
||||
__attribute__((nonnull, pure, warn_unused_result, always_inline))
|
||||
static inline bool
|
||||
gcq_linked(struct gcq *prev, struct gcq *next)
|
||||
{
|
||||
return (prev->q_next == next && next->q_prev == prev);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_insert_after(struct gcq *on, struct gcq *off)
|
||||
{
|
||||
struct gcq *on_next;
|
||||
GCQ_ASSERT(off->q_next == off && off->q_prev == off);
|
||||
on_next = on->q_next;
|
||||
|
||||
off->q_prev = on;
|
||||
off->q_next = on_next;
|
||||
on_next->q_prev = off;
|
||||
on->q_next = off;
|
||||
}
|
||||
|
||||
__attribute__((nonnull)) static inline void
|
||||
gcq_insert_before(struct gcq *on, struct gcq *off)
|
||||
{
|
||||
struct gcq *on_prev;
|
||||
GCQ_ASSERT(off->q_next == off && off->q_prev == off);
|
||||
on_prev = on->q_prev;
|
||||
|
||||
off->q_next = on;
|
||||
off->q_prev = on_prev;
|
||||
on_prev->q_next = off;
|
||||
on->q_prev = off;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_insert_head(struct gcq_head *head, struct gcq *q)
|
||||
{
|
||||
gcq_insert_after(gcq_hq(head), q);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_insert_tail(struct gcq_head *head, struct gcq *q)
|
||||
{
|
||||
gcq_insert_before(gcq_hq(head), q);
|
||||
}
|
||||
|
||||
__attribute__((nonnull)) static inline void
|
||||
gcq_tie(struct gcq *dst, struct gcq *src)
|
||||
{
|
||||
struct gcq *dst_next, *src_prev;
|
||||
dst_next = dst->q_next;
|
||||
src_prev = src->q_prev;
|
||||
|
||||
src_prev->q_next = dst_next;
|
||||
dst_next->q_prev = src_prev;
|
||||
src->q_prev = dst;
|
||||
dst->q_next = src;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_tie_after(struct gcq *dst, struct gcq *src)
|
||||
{
|
||||
GCQ_ASSERT(dst != src && dst->q_prev != src);
|
||||
gcq_tie(dst, src);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_tie_before(struct gcq *dst, struct gcq *src)
|
||||
{
|
||||
gcq_tie_after(dst->q_prev, src);
|
||||
}
|
||||
|
||||
__attribute__((nonnull)) static inline struct gcq *
|
||||
gcq_remove(struct gcq *q)
|
||||
{
|
||||
struct gcq *next, *prev;
|
||||
next = q->q_next;
|
||||
prev = q->q_prev;
|
||||
|
||||
prev->q_next = next;
|
||||
next->q_prev = prev;
|
||||
gcq_init(q);
|
||||
return q;
|
||||
}
|
||||
|
||||
#ifdef GCQ_UNCONDITIONAL_MERGE
|
||||
__attribute__((nonnull)) static inline void
|
||||
gcq_merge(struct gcq *dst, struct gcq *src)
|
||||
{
|
||||
GCQ_ASSERT(dst != src && dst->q_prev != src);
|
||||
gcq_tie(dst, src);
|
||||
gcq_tie(src, src);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_merge_head(struct gcq_head *dst, struct gcq_head *src)
|
||||
{
|
||||
gcq_merge(gcq_hq(dst), gcq_hq(src));
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_merge_tail(struct gcq_head *dst, struct gcq_head *src)
|
||||
{
|
||||
gcq_merge(gcq_hq(dst)->q_prev, gcq_hq(src));
|
||||
}
|
||||
#else
|
||||
__attribute__((nonnull)) static inline void
|
||||
gcq_merge(struct gcq *dst, struct gcq *src)
|
||||
{
|
||||
struct gcq *dst_next, *src_prev, *src_next;
|
||||
GCQ_ASSERT(dst != src && dst->q_prev != src);
|
||||
|
||||
if (gcq_onlist(src)) {
|
||||
dst_next = dst->q_next;
|
||||
src_prev = src->q_prev;
|
||||
src_next = src->q_next;
|
||||
|
||||
dst_next->q_prev = src_prev;
|
||||
src_prev->q_next = dst_next;
|
||||
dst->q_next = src_next;
|
||||
src_next->q_prev = dst;
|
||||
gcq_init(src);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_merge_head(struct gcq_head *dst, struct gcq_head *src)
|
||||
{
|
||||
gcq_merge(gcq_hq(dst), gcq_hq(src));
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_merge_tail(struct gcq_head *dst, struct gcq_head *src)
|
||||
{
|
||||
gcq_merge(gcq_hq(dst)->q_prev, gcq_hq(src));
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((nonnull)) static inline void
|
||||
gcq_clear(struct gcq *q)
|
||||
{
|
||||
struct gcq *nq, *next;
|
||||
nq=q;
|
||||
do {
|
||||
next = nq->q_next;
|
||||
gcq_init(nq);
|
||||
nq = next;
|
||||
} while (next != q);
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline void
|
||||
gcq_remove_all(struct gcq_head *head)
|
||||
{
|
||||
gcq_clear(gcq_hq(head));
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline struct gcq *
|
||||
_gcq_next(struct gcq *current, struct gcq_head *head, struct gcq *start)
|
||||
{
|
||||
struct gcq *q, *hq;
|
||||
hq = gcq_hq(head);
|
||||
q = current->q_next;
|
||||
if (hq != start && q == hq)
|
||||
q = hq->q_next;
|
||||
if (current != start)
|
||||
GCQ_ASSERT(gcq_onlist(current));
|
||||
return q;
|
||||
}
|
||||
|
||||
__attribute__((nonnull, always_inline)) static inline struct gcq *
|
||||
_gcq_prev(struct gcq *current, struct gcq_head *head, struct gcq *start)
|
||||
{
|
||||
struct gcq *q, *hq;
|
||||
hq = gcq_hq(head);
|
||||
q = current->q_prev;
|
||||
if (hq != start && q == hq)
|
||||
q = hq->q_prev;
|
||||
if (current != start)
|
||||
GCQ_ASSERT(gcq_onlist(current));
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
#define GCQ_ITEM(q, type, name) \
|
||||
((type *)(void *)((uint8_t *)gcq_q(q) - offsetof(type, name)))
|
||||
|
||||
|
||||
#define _GCQ_GDQ(var, h, ptr, fn) (gcq_hq(h)->ptr != gcq_hq(h) ? \
|
||||
(var = fn(gcq_hq(h)->ptr), true) : (var = NULL, false))
|
||||
#define _GCQ_GDQ_TYPED(tvar, h, type, name, ptr, fn) \
|
||||
(gcq_hq(h)->ptr != gcq_hq(h) ? (tvar = GCQ_ITEM(fn(gcq_hq(h)->ptr), \
|
||||
type, name), true) : (tvar = NULL, false))
|
||||
#define _GCQ_NP(var, current, head, start, np, fn) \
|
||||
(np(current, head, start) != (start) ? \
|
||||
(var = fn(np(current, head, start)), true) : (var = NULL, false))
|
||||
#define _GCQ_NP_TYPED(tvar, current, head, start, type, name, np, fn) \
|
||||
(np(current, head, start) != (start) ? \
|
||||
(tvar = GCQ_ITEM(fn(np(current, head, start)), type, name), true) : \
|
||||
(tvar = NULL, false))
|
||||
|
||||
#define _GCQ_GDQ_COND(var, h, ptr, rem, cond) \
|
||||
(gcq_hq(h)->ptr != gcq_hq(h) ? (var = gcq_hq(h)->ptr, \
|
||||
((cond) ? (rem, true) : (var = NULL, false))) : \
|
||||
(var = NULL, false))
|
||||
#define _GCQ_GDQ_COND_TYPED(tvar, h, type, name, ptr, rem, cond) \
|
||||
(gcq_hq(h)->ptr != gcq_hq(h) ? (tvar = GCQ_ITEM(gcq_hq(h)->ptr, \
|
||||
type, name), ((cond) ? (rem, true) : (tvar = NULL, false))) : \
|
||||
(tvar = NULL, false))
|
||||
#define _GCQ_NP_COND(var, current, head, start, np, rem, cond) \
|
||||
(np(current, head, start) != (start) ? \
|
||||
(var = fn(np(current, head, start)), ((cond) ? (rem), true) : \
|
||||
(var = NULL, false))) : (var = NULL, false))
|
||||
#define _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name, np, \
|
||||
rem, cond) (np(current, head, start) != (start) ? \
|
||||
(tvar = GCQ_ITEM(fn(np(current, head, start)), type, name), \
|
||||
((cond) ? (rem, true) : (var = NULL, false))) : \
|
||||
(tvar = NULL, false))
|
||||
|
||||
#define GCQ_GOT_FIRST(var, h) _GCQ_GDQ(var, h, q_next, gcq_q)
|
||||
#define GCQ_GOT_LAST(var, h) _GCQ_GDQ(var, h, q_prev, gcq_q)
|
||||
#define GCQ_DEQUEUED_FIRST(var, h) _GCQ_GDQ(var, h, q_next, gcq_remove)
|
||||
#define GCQ_DEQUEUED_LAST(var, h) _GCQ_GDQ(var, h, q_prev, gcq_remove)
|
||||
#define GCQ_GOT_FIRST_TYPED(tvar, h, type, name) \
|
||||
_GCQ_GDQ_TYPED(tvar, h, type, name, q_next, gcq_q)
|
||||
#define GCQ_GOT_LAST_TYPED(tvar, h, type, name) \
|
||||
_GCQ_GDQ_TYPED(tvar, h, type, name, q_prev, gcq_q)
|
||||
#define GCQ_DEQUEUED_FIRST_TYPED(tvar, h, type, name) \
|
||||
_GCQ_GDQ_TYPED(tvar, h, type, name, q_next, gcq_remove)
|
||||
#define GCQ_DEQUEUED_LAST_TYPED(tvar, h, type, name) \
|
||||
_GCQ_GDQ_TYPED(tvar, h, type, name, q_prev, gcq_remove)
|
||||
#define GCQ_GOT_NEXT(var, current, head, start) \
|
||||
_GCQ_NP(var, current, head, start, _gcq_next, gcq_q)
|
||||
#define GCQ_GOT_PREV(var, current, head, start) \
|
||||
_GCQ_NP(var, current, head, start, _gcq_prev, gcq_q)
|
||||
#define GCQ_DEQUEUED_NEXT(var, current, head, start) \
|
||||
_GCQ_NP(var, current, head, start, _gcq_next, gcq_remove)
|
||||
#define GCQ_DEQUEUED_PREV(var, current, head, start) \
|
||||
_GCQ_NP(var, current, head, start, _gcq_prev, gcq_remove)
|
||||
#define GCQ_GOT_NEXT_TYPED(tvar, current, head, start, type, name) \
|
||||
_GCQ_NP_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_next, gcq_q)
|
||||
#define GCQ_GOT_PREV_TYPED(tvar, current, head, start, type, name) \
|
||||
_GCQ_NP_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_prev, gcq_q)
|
||||
#define GCQ_DEQUEUED_NEXT_TYPED(tvar, current, head, start, type, name) \
|
||||
_GCQ_NP_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_next, gcq_remove)
|
||||
#define GCQ_DEQUEUED_PREV_TYPED(tvar, current, head, start, type, name) \
|
||||
_GCQ_NP_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_prev, gcq_remove)
|
||||
|
||||
#define GCQ_GOT_FIRST_COND(var, h, cond) \
|
||||
_GCQ_GDQ_COND(var, h, q_next, ((void)0), cond)
|
||||
#define GCQ_GOT_LAST_COND(var, h, cond) \
|
||||
_GCQ_GDQ_COND(var, h, q_prev, ((void)0), cond)
|
||||
#define GCQ_DEQUEUED_FIRST_COND(var, h, cond) \
|
||||
_GCQ_GDQ_COND(var, h, q_next, gcq_remove(var), cond)
|
||||
#define GCQ_DEQUEUED_LAST_COND(var, h, cond) \
|
||||
_GCQ_GDQ_COND(var, h, q_prev, gcq_remove(var), cond)
|
||||
#define GCQ_GOT_FIRST_COND_TYPED(tvar, h, type, name, cond) \
|
||||
_GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_next, ((void)0), cond)
|
||||
#define GCQ_GOT_LAST_COND_TYPED(tvar, h, type, name, cond) \
|
||||
_GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_prev, ((void)0), cond)
|
||||
#define GCQ_DEQUEUED_FIRST_COND_TYPED(tvar, h, type, name, cond) \
|
||||
_GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_next, \
|
||||
gcq_remove(&(tvar)->name), cond)
|
||||
#define GCQ_DEQUEUED_LAST_COND_TYPED(tvar, h, type, name, cond) \
|
||||
_GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_prev, \
|
||||
gcq_remove(&(tvar)->name), cond)
|
||||
#define GCQ_GOT_NEXT_COND(var, current, head, start, cond) \
|
||||
_GCQ_NP_COND(var, current, head, start, _gcq_next, ((void)0), cond)
|
||||
#define GCQ_GOT_PREV_COND(var, current, head, start, cond) \
|
||||
_GCQ_NP_COND(var, current, head, start, _gcq_prev, ((void)0), cond)
|
||||
#define GCQ_DEQUEUED_NEXT_COND(var, current, head, start, cond) \
|
||||
_GCQ_NP_COND(var, current, head, start, _gcq_next, gcq_remove(var), \
|
||||
cond)
|
||||
#define GCQ_DEQUEUED_PREV_COND(var, current, head, start, cond) \
|
||||
_GCQ_NP_COND(var, current, head, start, _gcq_prev, gcq_remove(var), \
|
||||
cond)
|
||||
#define GCQ_GOT_NEXT_COND_TYPED(tvar, current, head, start, type, name, \
|
||||
cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_next, ((void)0), cond)
|
||||
#define GCQ_GOT_PREV_COND_TYPED(tvar, current, head, start, type, name, \
|
||||
cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name, \
|
||||
_gcq_prev, ((void)0), cond)
|
||||
#define GCQ_DEQUEUED_NEXT_COND_TYPED(tvar, current, head, start, type, \
|
||||
name, cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, \
|
||||
name, _gcq_next, gcq_remove(&(tvar)->name), cond)
|
||||
#define GCQ_DEQUEUED_PREV_COND_TYPED(tvar, current, head, start, type, \
|
||||
name, cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, \
|
||||
name, _gcq_prev, gcq_remove(&(tvar)->name), cond)
|
||||
|
||||
|
||||
#define _GCQ_FOREACH(var, h, tnull, item, ptr) \
|
||||
for ((var)=gcq_hq(h)->ptr; ((var) != gcq_hq(h) && \
|
||||
(GCQ_ASSERT(gcq_onlist(var)), item, true)) || \
|
||||
(tnull, false); (var)=(var)->ptr)
|
||||
#define _GCQ_FOREACH_NVAR(var, nvar, h, tnull, item, ptr, ol, rem, ro) \
|
||||
for ((nvar)=gcq_hq(h)->ptr; (((var)=(nvar), (nvar) != gcq_hq(h)) && \
|
||||
(ol, (nvar)=(nvar)->ptr, rem, item, true)) || (tnull, false); ro)
|
||||
|
||||
#define GCQ_FOREACH(var, h) \
|
||||
_GCQ_FOREACH(var, h, ((void)0), ((void)0), q_next)
|
||||
#define GCQ_FOREACH_REV(var, h) \
|
||||
_GCQ_FOREACH(var, h, ((void)0), ((void)0), q_prev)
|
||||
#define GCQ_FOREACH_NVAR(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_next, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
|
||||
#define GCQ_FOREACH_NVAR_REV(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_prev, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
|
||||
#define GCQ_FOREACH_RO(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_next, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(var, nvar)))
|
||||
#define GCQ_FOREACH_RO_REV(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_prev, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(nvar, var)))
|
||||
#define GCQ_FOREACH_DEQUEUED(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_next, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0)
|
||||
#define GCQ_FOREACH_DEQUEUED_REV(var, nvar, h) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0), \
|
||||
q_prev, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0)
|
||||
|
||||
#define GCQ_FOREACH_TYPED(var, h, tvar, type, name) \
|
||||
_GCQ_FOREACH(var, h, (tvar)=NULL, (tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_next)
|
||||
#define GCQ_FOREACH_TYPED_REV(var, h, tvar, type, name) \
|
||||
_GCQ_FOREACH(var, h, (tvar)=NULL, (tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_prev)
|
||||
#define GCQ_FOREACH_NVAR_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_next, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
|
||||
#define GCQ_FOREACH_NVAR_REV_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_prev, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
|
||||
#define GCQ_FOREACH_RO_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_next, ((void)0), ((void)0), GCQ_ASSERT(gcq_lined(var, nvar)))
|
||||
#define GCQ_FOREACH_RO_REV_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_prev, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(nvar, var)))
|
||||
#define GCQ_FOREACH_DEQUEUED_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_next, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0))
|
||||
#define GCQ_FOREACH_DEQUEUED_REV_TYPED(var, nvar, h, tvar, type, name) \
|
||||
_GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, \
|
||||
(tvar)=GCQ_ITEM(var, type, name), \
|
||||
q_prev, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0))
|
||||
|
||||
#define _GCQ_COND(fe, cond) do { fe { if (cond) break; } } while (0)
|
||||
|
||||
#define GCQ_FIND(var, h, cond) _GCQ_COND(GCQ_FOREACH(var, h), cond)
|
||||
#define GCQ_FIND_REV(var, h, cond) _GCQ_COND(GCQ_FOREACH_REV(var, h), cond)
|
||||
#define GCQ_FIND_TYPED(var, h, tvar, type, name, cond) \
|
||||
_GCQ_COND(GCQ_FOREACH_TYPED(var, h, tvar, type, name), cond)
|
||||
#define GCQ_FIND_TYPED_REV(var, h, tvar, type, name, cond) \
|
||||
_GCQ_COND(GCQ_FOREACH_REV_TYPED(var, h, tvar, type, name), cond)
|
||||
|
||||
#endif /* _GCQ_H */
|
153
nbsd_include/sys/gmon.h
Normal file
153
nbsd_include/sys/gmon.h
Normal file
|
@ -0,0 +1,153 @@
|
|||
/* $NetBSD: gmon.h,v 1.9 2006/10/04 14:22:58 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1992, 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.
|
||||
*
|
||||
* @(#)gmon.h 8.2 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_GMON_H_
|
||||
#define _SYS_GMON_H_
|
||||
|
||||
#include <machine/profile.h>
|
||||
|
||||
/*
|
||||
* Structure prepended to gmon.out profiling data file.
|
||||
*/
|
||||
struct gmonhdr {
|
||||
u_long lpc; /* base pc address of sample buffer */
|
||||
u_long hpc; /* max pc address of sampled buffer */
|
||||
int ncnt; /* size of sample buffer (plus this header) */
|
||||
int version; /* version number */
|
||||
int profrate; /* profiling clock rate */
|
||||
int spare[3]; /* reserved */
|
||||
};
|
||||
#define GMONVERSION 0x00051879
|
||||
|
||||
/*
|
||||
* histogram counters are unsigned shorts (according to the kernel).
|
||||
*/
|
||||
#define HISTCOUNTER unsigned short
|
||||
|
||||
/*
|
||||
* fraction of text space to allocate for histogram counters here, 1/2
|
||||
*/
|
||||
#ifndef HISTFRACTION
|
||||
#define HISTFRACTION 2
|
||||
#endif /* HISTFRACTION */
|
||||
|
||||
/*
|
||||
* Fraction of text space to allocate for from hash buckets.
|
||||
* The value of HASHFRACTION is based on the minimum number of bytes
|
||||
* of separation between two subroutine call points in the object code.
|
||||
* Given MIN_SUBR_SEPARATION bytes of separation the value of
|
||||
* HASHFRACTION is calculated as:
|
||||
*
|
||||
* HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
|
||||
*
|
||||
* For example, on the VAX, the shortest two call sequence is:
|
||||
*
|
||||
* calls $0,(r0)
|
||||
* calls $0,(r0)
|
||||
*
|
||||
* which is separated by only three bytes, thus HASHFRACTION is
|
||||
* calculated as:
|
||||
*
|
||||
* HASHFRACTION = 3 / (2 * 2 - 1) = 1
|
||||
*
|
||||
* Note that the division above rounds down, thus if MIN_SUBR_FRACTION
|
||||
* is less than three, this algorithm will not work!
|
||||
*
|
||||
* In practice, however, call instructions are rarely at a minimal
|
||||
* distance. Hence, we will define HASHFRACTION to be 2 across all
|
||||
* architectures. This saves a reasonable amount of space for
|
||||
* profiling data structures without (in practice) sacrificing
|
||||
* any granularity.
|
||||
*/
|
||||
#define HASHFRACTION 2
|
||||
|
||||
/*
|
||||
* percent of text space to allocate for tostructs with a minimum.
|
||||
*/
|
||||
#define ARCDENSITY 2
|
||||
#define MINARCS 50
|
||||
#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
|
||||
|
||||
struct tostruct {
|
||||
u_long selfpc;
|
||||
long count;
|
||||
u_short link;
|
||||
u_short pad;
|
||||
};
|
||||
|
||||
/*
|
||||
* a raw arc, with pointers to the calling site and
|
||||
* the called site and a count.
|
||||
*/
|
||||
struct rawarc {
|
||||
u_long raw_frompc;
|
||||
u_long raw_selfpc;
|
||||
long raw_count;
|
||||
};
|
||||
|
||||
/*
|
||||
* The profiling data structures are housed in this structure.
|
||||
*/
|
||||
struct gmonparam {
|
||||
int state;
|
||||
u_short *kcount;
|
||||
u_long kcountsize;
|
||||
u_short *froms;
|
||||
u_long fromssize;
|
||||
struct tostruct *tos;
|
||||
u_long tossize;
|
||||
long tolimit;
|
||||
u_long lowpc;
|
||||
u_long highpc;
|
||||
u_long textsize;
|
||||
u_long hashfraction;
|
||||
};
|
||||
extern struct gmonparam _gmonparam;
|
||||
|
||||
/*
|
||||
* Possible states of profiling.
|
||||
*/
|
||||
#define GMON_PROF_ON 0
|
||||
#define GMON_PROF_BUSY 1
|
||||
#define GMON_PROF_ERROR 2
|
||||
#define GMON_PROF_OFF 3
|
||||
|
||||
/*
|
||||
* Sysctl definitions for extracting profiling information from the kernel.
|
||||
*/
|
||||
#define GPROF_STATE 0 /* int: profiling enabling variable */
|
||||
#define GPROF_COUNT 1 /* struct: profile tick count buffer */
|
||||
#define GPROF_FROMS 2 /* struct: from location hash bucket */
|
||||
#define GPROF_TOS 3 /* struct: destination/count structure */
|
||||
#define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */
|
||||
#endif /* !_SYS_GMON_H_ */
|
103
nbsd_include/sys/hash.h
Normal file
103
nbsd_include/sys/hash.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/* $NetBSD: hash.h,v 1.6 2008/04/28 20:24:10 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Luke Mewburn.
|
||||
*
|
||||
* 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 _SYS_HASH_H_
|
||||
#define _SYS_HASH_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef __HAVE_MACHINE_HASH_H
|
||||
#include <machine/hash.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __HAVE_HASH32_BUF /* not overridden by MD hash */
|
||||
|
||||
#define HASH32_BUF_INIT 5381
|
||||
|
||||
/*
|
||||
* uint32_t
|
||||
* hash32_buf(const void *bf, size_t len, uint32_t hash)
|
||||
* return a 32 bit hash of the binary buffer buf (size len),
|
||||
* seeded with an initial hash value of hash (usually HASH32_BUF_INIT).
|
||||
*/
|
||||
static __inline uint32_t
|
||||
hash32_buf(const void *bf, size_t len, uint32_t hash)
|
||||
{
|
||||
const uint8_t *s = bf;
|
||||
|
||||
while (len-- != 0) /* "nemesi": k=257, r=r*257 */
|
||||
hash = hash * 257 + *s++;
|
||||
return (hash * 257);
|
||||
}
|
||||
#endif /* __HAVE_HASH32_BUF */
|
||||
|
||||
|
||||
#ifndef __HAVE_HASH32_STR /* not overridden by MD hash */
|
||||
|
||||
#define HASH32_STR_INIT 5381
|
||||
/*
|
||||
* uint32_t
|
||||
* hash32_str(const void *bf, uint32_t hash)
|
||||
* return a 32 bit hash of NUL terminated ASCII string buf,
|
||||
* seeded with an initial hash value of hash (usually HASH32_STR_INIT).
|
||||
*/
|
||||
static __inline uint32_t
|
||||
hash32_str(const void *bf, uint32_t hash)
|
||||
{
|
||||
const uint8_t *s = bf;
|
||||
uint8_t c;
|
||||
|
||||
while ((c = *s++) != 0)
|
||||
hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */
|
||||
return (hash + (hash >> 5));
|
||||
}
|
||||
|
||||
/*
|
||||
* uint32_t
|
||||
* hash32_strn(const void *bf, size_t len, uint32_t hash)
|
||||
* return a 32 bit hash of NUL terminated ASCII string buf up to
|
||||
* a maximum of len bytes,
|
||||
* seeded with an initial hash value of hash (usually HASH32_STR_INIT).
|
||||
*/
|
||||
static __inline uint32_t
|
||||
hash32_strn(const void *bf, size_t len, uint32_t hash)
|
||||
{
|
||||
const uint8_t *s = bf;
|
||||
uint8_t c;
|
||||
|
||||
while ((c = *s++) != 0 && len-- != 0)
|
||||
hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */
|
||||
return (hash + (hash >> 5));
|
||||
}
|
||||
#endif /* __HAVE_HASH32_STR */
|
||||
|
||||
|
||||
#endif /* !_SYS_HASH_H_ */
|
152
nbsd_include/sys/ieee754.h
Normal file
152
nbsd_include/sys/ieee754.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
/* $NetBSD: ieee754.h,v 1.7 2007/02/02 23:08:22 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
#ifndef _SYS_IEEE754_H_
|
||||
#define _SYS_IEEE754_H_
|
||||
|
||||
/*
|
||||
* NOTICE: This is not a standalone file. To use it, #include it in
|
||||
* your port's ieee.h header.
|
||||
*/
|
||||
|
||||
#include <machine/endian.h>
|
||||
|
||||
/*
|
||||
* <sys/ieee754.h> defines the layout of IEEE 754 floating point types.
|
||||
* Only single-precision and double-precision types are defined here;
|
||||
* extended types, if available, are defined in the machine-dependent
|
||||
* header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define the number of bits in each fraction and exponent.
|
||||
*
|
||||
* k k+1
|
||||
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
|
||||
*
|
||||
* (-exp_bias+1)
|
||||
* as fractions that look like 0.fffff x 2 . This means that
|
||||
*
|
||||
* -126
|
||||
* the number 0.10000 x 2 , for instance, is the same as the normalized
|
||||
*
|
||||
* -127 -128
|
||||
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
|
||||
*
|
||||
* -129
|
||||
* in the fraction; to represent 2 , we need two, and so on. This
|
||||
*
|
||||
* (-exp_bias-fracbits+1)
|
||||
* implies that the smallest denormalized number is 2
|
||||
*
|
||||
* for whichever format we are talking about: for single precision, for
|
||||
*
|
||||
* -126 -149
|
||||
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
|
||||
*
|
||||
* -149 == -127 - 23 + 1.
|
||||
*/
|
||||
#define SNG_EXPBITS 8
|
||||
#define SNG_FRACBITS 23
|
||||
|
||||
struct ieee_single {
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
u_int sng_sign:1;
|
||||
u_int sng_exp:SNG_EXPBITS;
|
||||
u_int sng_frac:SNG_FRACBITS;
|
||||
#else
|
||||
u_int sng_frac:SNG_FRACBITS;
|
||||
u_int sng_exp:SNG_EXPBITS;
|
||||
u_int sng_sign:1;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define DBL_EXPBITS 11
|
||||
#define DBL_FRACHBITS 20
|
||||
#define DBL_FRACLBITS 32
|
||||
#define DBL_FRACBITS (DBL_FRACHBITS + DBL_FRACLBITS)
|
||||
|
||||
struct ieee_double {
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
u_int dbl_sign:1;
|
||||
u_int dbl_exp:DBL_EXPBITS;
|
||||
u_int dbl_frach:DBL_FRACHBITS;
|
||||
u_int dbl_fracl:DBL_FRACLBITS;
|
||||
#else
|
||||
u_int dbl_fracl:DBL_FRACLBITS;
|
||||
u_int dbl_frach:DBL_FRACHBITS;
|
||||
u_int dbl_exp:DBL_EXPBITS;
|
||||
u_int dbl_sign:1;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* At least one `signalling NaN' and one `quiet NaN' value must be
|
||||
* implemented. It is left to the architecture to specify how to
|
||||
* distinguish between these.
|
||||
*/
|
||||
#define SNG_EXP_INFNAN 255
|
||||
#define DBL_EXP_INFNAN 2047
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define SNG_EXP_BIAS 127
|
||||
#define DBL_EXP_BIAS 1023
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_single_u {
|
||||
float sngu_f;
|
||||
struct ieee_single sngu_sng;
|
||||
};
|
||||
|
||||
union ieee_double_u {
|
||||
double dblu_d;
|
||||
struct ieee_double dblu_dbl;
|
||||
};
|
||||
#endif /* _SYS_IEEE754_H_ */
|
45
nbsd_include/sys/inttypes.h
Normal file
45
nbsd_include/sys/inttypes.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: inttypes.h,v 1.5 2008/04/28 20:24:10 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus J. Klein.
|
||||
*
|
||||
* 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 _SYS_INTTYPES_H_
|
||||
#define _SYS_INTTYPES_H_
|
||||
|
||||
/*
|
||||
* 7.8 Format conversion of integer types
|
||||
*/
|
||||
|
||||
#include <sys/stdint.h>
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
|
||||
#include <machine/int_fmtio.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_INTTYPES_H_ */
|
99
nbsd_include/sys/ioc_net.h
Normal file
99
nbsd_include/sys/ioc_net.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/* sys/ioc_net.h - NetBSD-friendly version of Minix net/ioctl.h
|
||||
*/
|
||||
/* net/ioctl.h - Network ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SYS_IOC_NET_H_
|
||||
#define _SYS_IOC_NET_H_
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <sys/ansi.h>
|
||||
#ifndef socklen_t
|
||||
typedef __socklen_t socklen_t;
|
||||
#define socklen_t __socklen_t
|
||||
#endif
|
||||
|
||||
#define MSG_CONTROL_MAX (1024 - sizeof(socklen_t))
|
||||
struct msg_control
|
||||
{
|
||||
char msg_control[MSG_CONTROL_MAX];
|
||||
socklen_t msg_controllen;
|
||||
};
|
||||
|
||||
|
||||
/* Network ioctls. */
|
||||
#define NWIOSETHOPT _IOW('n', 16, struct nwio_ethopt)
|
||||
#define NWIOGETHOPT _IOR('n', 17, struct nwio_ethopt)
|
||||
#define NWIOGETHSTAT _IOR('n', 18, struct nwio_ethstat)
|
||||
|
||||
#define NWIOARPGIP _IORW('n',20, struct nwio_arp)
|
||||
#define NWIOARPGNEXT _IORW('n',21, struct nwio_arp)
|
||||
#define NWIOARPSIP _IOW ('n',22, struct nwio_arp)
|
||||
#define NWIOARPDIP _IOW ('n',23, struct nwio_arp)
|
||||
|
||||
#define NWIOSIPCONF2 _IOW('n', 32, struct nwio_ipconf2)
|
||||
#define NWIOSIPCONF _IOW('n', 32, struct nwio_ipconf)
|
||||
#define NWIOGIPCONF2 _IOR('n', 33, struct nwio_ipconf2)
|
||||
#define NWIOGIPCONF _IOR('n', 33, struct nwio_ipconf)
|
||||
#define NWIOSIPOPT _IOW('n', 34, struct nwio_ipopt)
|
||||
#define NWIOGIPOPT _IOR('n', 35, struct nwio_ipopt)
|
||||
|
||||
#define NWIOGIPOROUTE _IORW('n', 40, struct nwio_route)
|
||||
#define NWIOSIPOROUTE _IOW ('n', 41, struct nwio_route)
|
||||
#define NWIODIPOROUTE _IOW ('n', 42, struct nwio_route)
|
||||
#define NWIOGIPIROUTE _IORW('n', 43, struct nwio_route)
|
||||
#define NWIOSIPIROUTE _IOW ('n', 44, struct nwio_route)
|
||||
#define NWIODIPIROUTE _IOW ('n', 45, struct nwio_route)
|
||||
|
||||
#define NWIOSTCPCONF _IOW('n', 48, struct nwio_tcpconf)
|
||||
#define NWIOGTCPCONF _IOR('n', 49, struct nwio_tcpconf)
|
||||
#define NWIOTCPCONN _IOW('n', 50, struct nwio_tcpcl)
|
||||
#define NWIOTCPLISTEN _IOW('n', 51, struct nwio_tcpcl)
|
||||
#define NWIOTCPATTACH _IOW('n', 52, struct nwio_tcpatt)
|
||||
#define NWIOTCPSHUTDOWN _IO ('n', 53)
|
||||
#define NWIOSTCPOPT _IOW('n', 54, struct nwio_tcpopt)
|
||||
#define NWIOGTCPOPT _IOR('n', 55, struct nwio_tcpopt)
|
||||
#define NWIOTCPPUSH _IO ('n', 56)
|
||||
#define NWIOTCPLISTENQ _IOW('n', 57, int)
|
||||
#define NWIOGTCPCOOKIE _IOR('n', 58, struct tcp_cookie)
|
||||
#define NWIOTCPACCEPTTO _IOW('n', 59, struct tcp_cookie)
|
||||
#define NWIOTCPGERROR _IOR('n', 60, int)
|
||||
|
||||
#define NWIOSUDPOPT _IOW('n', 64, struct nwio_udpopt)
|
||||
#define NWIOGUDPOPT _IOR('n', 65, struct nwio_udpopt)
|
||||
#define NWIOUDPPEEK _IOR('n', 66, struct udp_io_hdr)
|
||||
|
||||
#define NWIOGUDSFADDR _IOR ('n', 67, struct sockaddr_un) /* recvfrom() */
|
||||
#define NWIOSUDSTADDR _IOW ('n', 68, struct sockaddr_un) /* sendto() */
|
||||
#define NWIOSUDSADDR _IOW ('n', 69, struct sockaddr_un) /* bind() */
|
||||
#define NWIOGUDSADDR _IOR ('n', 70, struct sockaddr_un) /* getsockname() */
|
||||
#define NWIOGUDSPADDR _IOR ('n', 71, struct sockaddr_un) /* getpeername() */
|
||||
#define NWIOSUDSTYPE _IOW ('n', 72, int) /* socket() */
|
||||
#define NWIOSUDSBLOG _IOW ('n', 73, int) /* listen() */
|
||||
#define NWIOSUDSCONN _IOW ('n', 74, struct sockaddr_un) /* connect() */
|
||||
#define NWIOSUDSSHUT _IOW ('n', 75, int) /* shutdown() */
|
||||
#define NWIOSUDSPAIR _IOW ('n', 76, dev_t) /* socketpair() */
|
||||
#define NWIOSUDSACCEPT _IOW ('n', 77, struct sockaddr_un) /* accept() */
|
||||
#define NWIOSUDSCTRL _IOW ('n', 78, struct msg_control) /* sendmsg() */
|
||||
#define NWIOGUDSCTRL _IORW('n', 79, struct msg_control) /* recvmsg() */
|
||||
|
||||
#define NWIOSPSIPOPT _IOW('n', 80, struct nwio_psipopt)
|
||||
#define NWIOGPSIPOPT _IOR('n', 81, struct nwio_psipopt)
|
||||
|
||||
/* setsockopt/setsockopt for unix domain sockets */
|
||||
#define NWIOGUDSSOTYPE _IOR('n', 90, int) /* SO_TYPE */
|
||||
#define NWIOGUDSPEERCRED _IOR('n', 91, struct ucred) /* SO_PEERCRED */
|
||||
#define NWIOGUDSSNDBUF _IOR('n', 92, size_t) /* SO_SNDBUF */
|
||||
#define NWIOSUDSSNDBUF _IOW('n', 93, size_t) /* SO_SNDBUF */
|
||||
#define NWIOGUDSRCVBUF _IOR('n', 94, size_t) /* SO_RCVBUF */
|
||||
#define NWIOSUDSRCVBUF _IOW('n', 95, size_t) /* SO_RCVBUF */
|
||||
|
||||
#endif /* _NET__IOCTL_H */
|
||||
|
||||
/*
|
||||
* $PchId: ioctl.h,v 1.2 2003/07/25 14:34:03 philip Exp $
|
||||
*/
|
34
nbsd_include/sys/ioctl.h
Normal file
34
nbsd_include/sys/ioctl.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* sys/ioctl.h - All ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
* This header file includes all other ioctl command code headers.
|
||||
*/
|
||||
|
||||
#ifndef _S_IOCTL_H
|
||||
#define _S_IOCTL_H
|
||||
|
||||
/* A driver that uses ioctls claims a character for its series of commands.
|
||||
* For instance: #define TCGETS _IOR('T', 8, struct termios)
|
||||
* This is a terminal ioctl that uses the character 'T'. The character(s)
|
||||
* used in each header file are shown in the comment following.
|
||||
*/
|
||||
|
||||
#include <sys/ioc_tty.h> /* 'T' 't' 'k' */
|
||||
#include <sys/ioc_net.h> /* 'n' */
|
||||
#include <sys/ioc_disk.h> /* 'd' */
|
||||
#include <sys/ioc_file.h> /* 'f' */
|
||||
#include <sys/ioc_memory.h> /* 'm' */
|
||||
#include <sys/ioc_cmos.h> /* 'c' */
|
||||
#include <sys/ioc_tape.h> /* 'M' */
|
||||
#include <sys/ioc_scsi.h> /* 'S' */
|
||||
#include <sys/ioc_sound.h> /* 's' */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define TIOCDRAIN TCDRAIN
|
||||
#define TIOCGETA TCGETS
|
||||
#define TIOCSETA TCSETS
|
||||
#define TIOCSETAW TCSETSW
|
||||
#define TIOCSETAF TCSETSF
|
||||
#endif
|
||||
|
||||
#endif /* _S_IOCTL_H */
|
51
nbsd_include/sys/ipc.h
Normal file
51
nbsd_include/sys/ipc.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* SVID compatible ipc.h file
|
||||
*/
|
||||
|
||||
#ifndef _SYS_IPC_H_
|
||||
#define _SYS_IPC_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Data structure used to pass permission information to IPC operations. */
|
||||
struct ipc_perm
|
||||
{
|
||||
key_t key; /* Key. */
|
||||
uid_t uid; /* Owner's user ID. */
|
||||
gid_t gid; /* Owner's group ID. */
|
||||
uid_t cuid; /* Creator's user ID. */
|
||||
gid_t cgid; /* Creator's group ID. */
|
||||
unsigned short int mode; /* Reader/write permission. */
|
||||
unsigned short int __seq; /* Sequence number. */
|
||||
};
|
||||
|
||||
/* X/Open required constants (same values as system 5) */
|
||||
#define IPC_CREAT 001000 /* create entry if key does not exist */
|
||||
#define IPC_EXCL 002000 /* fail if key exists */
|
||||
#define IPC_NOWAIT 004000 /* error if request must wait */
|
||||
|
||||
#define IPC_PRIVATE (key_t)0 /* private key */
|
||||
|
||||
#define IPC_RMID 0 /* remove identifier */
|
||||
#define IPC_SET 1 /* set options */
|
||||
#define IPC_STAT 2 /* get options */
|
||||
|
||||
#ifdef __minix
|
||||
#define IPC_INFO 3 /* See ipcs. */
|
||||
#endif /* !__minix */
|
||||
|
||||
/*
|
||||
* Macro to convert between ipc ids and array indices or sequence ids.
|
||||
*/
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define IXSEQ_TO_IPCID(ix,perm) (((perm._seq) << 16) | (ix & 0xffff))
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
key_t ftok(const char *, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_IPC_H_ */
|
100
nbsd_include/sys/localedef.h
Normal file
100
nbsd_include/sys/localedef.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* $NetBSD: localedef.h,v 1.9 2008/05/17 03:49:54 ginsbach Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Winning Strategies, 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Winning Strategies, Inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _SYS_LOCALEDEF_H_
|
||||
#define _SYS_LOCALEDEF_H_
|
||||
|
||||
typedef struct {
|
||||
const char *yesexpr;
|
||||
const char *noexpr;
|
||||
const char *yesstr;
|
||||
const char *nostr;
|
||||
} _MessagesLocale;
|
||||
|
||||
extern const _MessagesLocale *_CurrentMessagesLocale;
|
||||
extern const _MessagesLocale _DefaultMessagesLocale;
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *int_curr_symbol;
|
||||
const char *currency_symbol;
|
||||
const char *mon_decimal_point;
|
||||
const char *mon_thousands_sep;
|
||||
const char *mon_grouping;
|
||||
const char *positive_sign;
|
||||
const char *negative_sign;
|
||||
char int_frac_digits;
|
||||
char frac_digits;
|
||||
char p_cs_precedes;
|
||||
char p_sep_by_space;
|
||||
char n_cs_precedes;
|
||||
char n_sep_by_space;
|
||||
char p_sign_posn;
|
||||
char n_sign_posn;
|
||||
char int_p_cs_precedes;
|
||||
char int_n_cs_precedes;
|
||||
char int_p_sep_by_space;
|
||||
char int_n_sep_by_space;
|
||||
char int_p_sign_posn;
|
||||
char int_n_sign_posn;
|
||||
} _MonetaryLocale;
|
||||
|
||||
extern const _MonetaryLocale *_CurrentMonetaryLocale;
|
||||
extern const _MonetaryLocale _DefaultMonetaryLocale;
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *decimal_point;
|
||||
const char *thousands_sep;
|
||||
const char *grouping;
|
||||
} _NumericLocale;
|
||||
|
||||
extern const _NumericLocale *_CurrentNumericLocale;
|
||||
extern const _NumericLocale _DefaultNumericLocale;
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *abday[7];
|
||||
const char *day[7];
|
||||
const char *abmon[12];
|
||||
const char *mon[12];
|
||||
const char *am_pm[2];
|
||||
const char *d_t_fmt;
|
||||
const char *d_fmt;
|
||||
const char *t_fmt;
|
||||
const char *t_fmt_ampm;
|
||||
} _TimeLocale;
|
||||
|
||||
extern const _TimeLocale *_CurrentTimeLocale;
|
||||
extern const _TimeLocale _DefaultTimeLocale;
|
||||
|
||||
#endif /* !_SYS_LOCALEDEF_H_ */
|
58
nbsd_include/sys/md4.h
Normal file
58
nbsd_include/sys/md4.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: md4.h,v 1.7 2005/12/26 18:41:36 perry Exp $ */
|
||||
|
||||
/*
|
||||
* This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
|
||||
* Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
|
||||
* for portability and formatting.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
* rights reserved.
|
||||
*
|
||||
* License to copy and use this software is granted provided that it
|
||||
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
|
||||
* Algorithm" in all material mentioning or referencing this software
|
||||
* or this function.
|
||||
*
|
||||
* License is also granted to make and use derivative works provided
|
||||
* that such works are identified as "derived from the RSA Data
|
||||
* Security, Inc. MD4 Message-Digest Algorithm" in all material
|
||||
* mentioning or referencing the derived work.
|
||||
*
|
||||
* RSA Data Security, Inc. makes no representations concerning either
|
||||
* the merchantability of this software or the suitability of this
|
||||
* software for any particular purpose. It is provided "as is"
|
||||
* without express or implied warranty of any kind.
|
||||
*
|
||||
* These notices must be retained in any copies of any part of this
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MD4_H_
|
||||
#define _SYS_MD4_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MD4_DIGEST_LENGTH 16
|
||||
|
||||
/* MD4 context. */
|
||||
typedef struct MD4Context {
|
||||
uint32_t state[4]; /* state (ABCD) */
|
||||
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD4_CTX;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void MD4Init(MD4_CTX *);
|
||||
void MD4Update(MD4_CTX *, const unsigned char *, unsigned int);
|
||||
void MD4Final(unsigned char[MD4_DIGEST_LENGTH], MD4_CTX *);
|
||||
#ifndef _KERNEL
|
||||
char *MD4End(MD4_CTX *, char *);
|
||||
char *MD4File(const char *, char *);
|
||||
char *MD4Data(const unsigned char *, unsigned int, char *);
|
||||
#endif /* _KERNEL */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_MD4_H_ */
|
58
nbsd_include/sys/md5.h
Normal file
58
nbsd_include/sys/md5.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: md5.h,v 1.9 2005/12/26 18:41:36 perry Exp $ */
|
||||
|
||||
/*
|
||||
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
|
||||
* Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
|
||||
* for portability and formatting.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
* rights reserved.
|
||||
*
|
||||
* License to copy and use this software is granted provided that it
|
||||
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
* Algorithm" in all material mentioning or referencing this software
|
||||
* or this function.
|
||||
*
|
||||
* License is also granted to make and use derivative works provided
|
||||
* that such works are identified as "derived from the RSA Data
|
||||
* Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
* mentioning or referencing the derived work.
|
||||
*
|
||||
* RSA Data Security, Inc. makes no representations concerning either
|
||||
* the merchantability of this software or the suitability of this
|
||||
* software for any particular purpose. It is provided "as is"
|
||||
* without express or implied warranty of any kind.
|
||||
*
|
||||
* These notices must be retained in any copies of any part of this
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MD5_H_
|
||||
#define _SYS_MD5_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
#define MD5_DIGEST_STRING_LENGTH 33
|
||||
|
||||
/* MD5 context. */
|
||||
typedef struct MD5Context {
|
||||
uint32_t state[4]; /* state (ABCD) */
|
||||
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD5_CTX;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void MD5Init(MD5_CTX *);
|
||||
void MD5Update(MD5_CTX *, const unsigned char *, unsigned int);
|
||||
void MD5Final(unsigned char[MD5_DIGEST_LENGTH], MD5_CTX *);
|
||||
#ifndef _KERNEL
|
||||
char *MD5End(MD5_CTX *, char *);
|
||||
char *MD5File(const char *, char *);
|
||||
char *MD5Data(const unsigned char *, unsigned int, char *);
|
||||
#endif /* _KERNEL */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_MD5_H_ */
|
76
nbsd_include/sys/mman.h
Normal file
76
nbsd_include/sys/mman.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifndef _SYS_MMAN_H_
|
||||
#define _SYS_MMAN_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
typedef _BSD_SIZE_T_ size_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#include <sys/ansi.h>
|
||||
|
||||
#ifndef mode_t
|
||||
typedef __mode_t mode_t;
|
||||
#define mode_t __mode_t
|
||||
#endif
|
||||
|
||||
#ifndef off_t
|
||||
typedef __off_t off_t; /* file offset */
|
||||
#define off_t __off_t
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Protections are chosen from these bits, or-ed together
|
||||
*/
|
||||
#define PROT_NONE 0x00 /* no permissions */
|
||||
#define PROT_READ 0x01 /* pages can be read */
|
||||
#define PROT_WRITE 0x02 /* pages can be written */
|
||||
#define PROT_EXEC 0x04 /* pages can be executed */
|
||||
|
||||
/*
|
||||
* Flags contain sharing type and options.
|
||||
* Sharing types; choose one.
|
||||
*/
|
||||
#define MAP_SHARED 0x0001 /* share changes */
|
||||
#define MAP_PRIVATE 0x0002 /* changes are private */
|
||||
|
||||
/*
|
||||
* Mapping type
|
||||
*/
|
||||
#define MAP_ANON 0x0004 /* anonymous memory */
|
||||
|
||||
/*
|
||||
* Minix specific flags.
|
||||
*/
|
||||
#define MAP_PREALLOC 0x0008 /* not on-demand */
|
||||
#define MAP_CONTIG 0x0010 /* contiguous in physical memory */
|
||||
#define MAP_LOWER16M 0x0020 /* physically below 16MB */
|
||||
#define MAP_ALIGN64K 0x0040 /* physically aligned at 64kB */
|
||||
#define MAP_LOWER1M 0x0080 /* physically below 16MB */
|
||||
#define MAP_ALIGNMENT_64KB MAP_ALIGN64K
|
||||
|
||||
/*
|
||||
* Error indicator returned by mmap(2)
|
||||
*/
|
||||
#define MAP_FAILED ((void *) -1) /* mmap() failed */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
void * mmap(void *, size_t, int, int, int, off_t);
|
||||
int munmap(void *, size_t);
|
||||
|
||||
#ifdef __minix
|
||||
int munmap_text(void *, size_t);
|
||||
void * vm_remap(int d, int s, void *da, void *sa, size_t si);
|
||||
int vm_unmap(int endpt, void *addr);
|
||||
unsigned long vm_getphys(int endpt, void *addr);
|
||||
u8_t vm_getrefcount(int endpt, void *addr);
|
||||
#endif /* __minix */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_MMAN_H_ */
|
7
nbsd_include/sys/mount.h
Normal file
7
nbsd_include/sys/mount.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef _SYS_MOUNT_H
|
||||
#define _SYS_MOUNT_H_
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
#include <minix/mount.h>
|
||||
|
||||
#endif /* !_SYS_MOUNT_H_ */
|
16
nbsd_include/sys/null.h
Normal file
16
nbsd_include/sys/null.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: null.h,v 1.8 2009/10/13 17:19:00 dsl Exp $ */
|
||||
|
||||
#ifndef _SYS_NULL_H_
|
||||
#define _SYS_NULL_H_
|
||||
#ifndef NULL
|
||||
#if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 90)
|
||||
#if !defined(__cplusplus)
|
||||
#define NULL ((void *)0)
|
||||
#else
|
||||
#define NULL 0
|
||||
#endif /* !__cplusplus */
|
||||
#else
|
||||
#define NULL __null
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _SYS_NULL_H_ */
|
182
nbsd_include/sys/param.h
Normal file
182
nbsd_include/sys/param.h
Normal file
|
@ -0,0 +1,182 @@
|
|||
#ifndef _SYS_PARAM_H_
|
||||
#define _SYS_PARAM_H_
|
||||
|
||||
/*
|
||||
* Historic BSD #defines -- probably will remain untouched for all time.
|
||||
*/
|
||||
#define BSD 199506 /* System version (year & month). */
|
||||
#define BSD4_3 1
|
||||
#define BSD4_4 1
|
||||
|
||||
/*
|
||||
* #define __NetBSD_Version__ MMmmrrpp00
|
||||
*
|
||||
* M = major version
|
||||
* m = minor version; a minor number of 99 indicates current.
|
||||
* r = 0 (*)
|
||||
* p = patchlevel
|
||||
*
|
||||
* When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local
|
||||
* needs to be updated and the changes sent back to the groff maintainers.
|
||||
*
|
||||
* (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric
|
||||
* e.g. NetBSD-1.2D = 102040000 ('D' == 4)
|
||||
* NetBSD-2.0H (200080000) was changed on 20041001 to:
|
||||
* 2.99.9 (299000900)
|
||||
*/
|
||||
|
||||
#define __NetBSD_Version__ 599002900 /* NetBSD 5.99.29 */
|
||||
|
||||
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
|
||||
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
|
||||
|
||||
/*
|
||||
* Historical NetBSD #define
|
||||
*
|
||||
* NetBSD 1.4 was the last release for which this value was incremented.
|
||||
* The value is now permanently fixed at 199905. It will never be
|
||||
* changed again.
|
||||
*
|
||||
* New code must use __NetBSD_Version__ instead, and should not even
|
||||
* count on NetBSD being defined.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NetBSD 199905 /* NetBSD version (year & month). */
|
||||
|
||||
#include <sys/null.h>
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <sys/inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Machine-independent constants (some used in following include files).
|
||||
* Redefined constants are from POSIX 1003.1 limits file.
|
||||
*
|
||||
* MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
|
||||
* MAXHOSTNAMELEN should be >= (_POSIX_HOST_NAME_MAX + 1) (see <limits.h>)
|
||||
* MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
|
||||
*/
|
||||
#include <sys/syslimits.h>
|
||||
|
||||
|
||||
#define MAXCOMLEN 16 /* max command name remembered */
|
||||
#define MAXINTERP PATH_MAX /* max interpreter file name length */
|
||||
/* DEPRECATED: use LOGIN_NAME_MAX instead. */
|
||||
#define MAXLOGNAME (LOGIN_NAME_MAX - 1) /* max login name length */
|
||||
#ifndef __minix
|
||||
#define NCARGS ARG_MAX /* max bytes for an exec function */
|
||||
#endif
|
||||
#define NGROUPS NGROUPS_MAX /* max number groups */
|
||||
#define NOGROUP 65535 /* marker for empty group set member */
|
||||
|
||||
#define MAXHOSTNAMELEN 256 /* max hostname size */
|
||||
|
||||
#ifndef NOFILE
|
||||
#define NOFILE OPEN_MAX /* max open files per process */
|
||||
#endif
|
||||
#ifndef MAXUPRC /* max simultaneous processes */
|
||||
#define MAXUPRC CHILD_MAX /* POSIX 1003.1-compliant default */
|
||||
#else
|
||||
#if (MAXUPRC - 0) < CHILD_MAX
|
||||
#error MAXUPRC less than CHILD_MAX. See options(4) for details.
|
||||
#endif /* (MAXUPRC - 0) < CHILD_MAX */
|
||||
#endif /* !defined(MAXUPRC) */
|
||||
|
||||
/* Signals. */
|
||||
#include <sys/signal.h>
|
||||
|
||||
/* Machine type dependent parameters. */
|
||||
#include <machine/param.h>
|
||||
#include <machine/limits.h>
|
||||
|
||||
/* pages ("clicks") to disk blocks */
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
|
||||
/* bytes to pages */
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/* bytes to disk blocks */
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
|
||||
#ifndef COHERENCY_UNIT
|
||||
#define COHERENCY_UNIT 64
|
||||
#endif
|
||||
#ifndef CACHE_LINE_SIZE
|
||||
#define CACHE_LINE_SIZE 64
|
||||
#endif
|
||||
#ifndef MAXCPUS
|
||||
#define MAXCPUS 32
|
||||
#endif
|
||||
#ifndef MAX_LWP_PER_PROC
|
||||
#define MAX_LWP_PER_PROC 8000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous.
|
||||
*/
|
||||
#define NBPW sizeof(int) /* number of bytes per word (integer) */
|
||||
|
||||
#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
|
||||
#define NODEV (dev_t)(-1) /* non-existent device */
|
||||
|
||||
#define CBLOCK 64 /* Clist block size, must be a power of 2. */
|
||||
#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
|
||||
/* Data chars/clist. */
|
||||
#define CBSIZE (CBLOCK - (int)sizeof(struct cblock *) - CBQSIZE)
|
||||
#define CROUND (CBLOCK - 1) /* Clist rounding. */
|
||||
|
||||
/*
|
||||
* File system parameters and macros.
|
||||
*
|
||||
* The file system is made out of blocks of at most MAXBSIZE units, with
|
||||
* smaller units (fragments) only in the last direct block. MAXBSIZE
|
||||
* primarily determines the size of buffers in the buffer pool. It may be
|
||||
* made larger without any effect on existing file systems; however making
|
||||
* it smaller may make some file systems unmountable.
|
||||
*/
|
||||
#ifndef MAXBSIZE /* XXX */
|
||||
#define MAXBSIZE MAXPHYS
|
||||
#endif
|
||||
#define MAXFRAG 8
|
||||
|
||||
/*
|
||||
* MAXPATHLEN defines the longest permissible path length after expanding
|
||||
* symbolic links. It is used to allocate a temporary buffer from the buffer
|
||||
* pool in which to do the name expansion, hence should be a power of two,
|
||||
* and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
|
||||
* maximum number of symbolic links that may be expanded in a path name.
|
||||
* It should be set high enough to allow all legitimate uses, but halt
|
||||
* infinite loops reasonably quickly.
|
||||
*
|
||||
* MAXSYMLINKS should be >= _POSIX_SYMLOOP_MAX (see <limits.h>)
|
||||
*/
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#define MAXSYMLINKS 32
|
||||
|
||||
/* Bit map related macros. */
|
||||
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
|
||||
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
|
||||
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
|
||||
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
||||
|
||||
/* Macros for counting and rounding. */
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
#endif
|
||||
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||
#define rounddown(x,y) (((x)/(y))*(y))
|
||||
#define roundup2(x, m) (((x) + (m) - 1) & ~((m) - 1))
|
||||
#define powerof2(x) ((((x)-1)&(x))==0)
|
||||
|
||||
/* Macros for min/max. */
|
||||
#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b))
|
||||
#define MAX(a,b) ((/*CONSTCOND*/(a)>(b))?(a):(b))
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* !_SYS_PARAM_H_ */
|
67
nbsd_include/sys/poll.h
Normal file
67
nbsd_include/sys/poll.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/* $NetBSD: poll.h,v 1.3 2008/04/29 05:46:08 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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 _NBCOMPAT_POLL_H_
|
||||
#define _NBCOMPAT_POLL_H_
|
||||
|
||||
typedef unsigned int nfds_t;
|
||||
|
||||
#define INFTIM -1
|
||||
|
||||
struct pollfd {
|
||||
int fd; /* file descriptor */
|
||||
short events; /* events to look for */
|
||||
short revents; /* events returned */
|
||||
};
|
||||
|
||||
/*
|
||||
* Testable events (may be specified in events field).
|
||||
*/
|
||||
#define POLLIN 0x0001
|
||||
#define POLLPRI 0x0002
|
||||
#define POLLOUT 0x0004
|
||||
#define POLLRDNORM 0x0040
|
||||
#define POLLWRNORM POLLOUT
|
||||
#define POLLRDBAND 0x0080
|
||||
#define POLLWRBAND 0x0100
|
||||
|
||||
/*
|
||||
* Non-testable events (may not be specified in events field).
|
||||
*/
|
||||
#define POLLERR 0x0008
|
||||
#define POLLHUP 0x0010
|
||||
#define POLLNVAL 0x0020
|
||||
|
||||
__BEGIN_DECLS
|
||||
int poll (struct pollfd *, nfds_t, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_NBCOMPAT_POLL_H_ */
|
58
nbsd_include/sys/ptrace.h
Normal file
58
nbsd_include/sys/ptrace.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* <sys/ptrace.h>
|
||||
* definitions for ptrace(2)
|
||||
*/
|
||||
|
||||
#ifndef _PTRACE_H
|
||||
#define _PTRACE_H
|
||||
|
||||
/* Trace requests. */
|
||||
#define T_STOP -1 /* stop the process */
|
||||
#define T_OK 0 /* enable tracing by parent for this process */
|
||||
#define T_GETINS 1 /* return value from instruction space */
|
||||
#define T_GETDATA 2 /* return value from data space */
|
||||
#define T_GETUSER 3 /* return value from user process table */
|
||||
#define T_SETINS 4 /* set value from instruction space */
|
||||
#define T_SETDATA 5 /* set value from data space */
|
||||
#define T_SETUSER 6 /* set value in user process table */
|
||||
#define T_RESUME 7 /* resume execution */
|
||||
#define T_EXIT 8 /* exit */
|
||||
#define T_STEP 9 /* set trace bit */
|
||||
#define T_SYSCALL 10 /* trace system call */
|
||||
#define T_ATTACH 11 /* attach to a running process */
|
||||
#define T_DETACH 12 /* detach from a traced process */
|
||||
#define T_SETOPT 13 /* set trace options */
|
||||
#define T_GETRANGE 14 /* get range of values */
|
||||
#define T_SETRANGE 15 /* set range of values */
|
||||
|
||||
#define T_READB_INS 100 /* Read a byte from the text segment of an
|
||||
* untraced process (only for root)
|
||||
*/
|
||||
#define T_WRITEB_INS 101 /* Write a byte in the text segment of an
|
||||
* untraced process (only for root)
|
||||
*/
|
||||
|
||||
/* Trace options. */
|
||||
#define TO_TRACEFORK 0x1 /* automatically attach to forked children */
|
||||
#define TO_ALTEXEC 0x2 /* send SIGSTOP on successful exec() */
|
||||
#define TO_NOEXEC 0x4 /* do not send signal on successful exec() */
|
||||
|
||||
/* Trace spaces. */
|
||||
#define TS_INS 0 /* text space */
|
||||
#define TS_DATA 1 /* data space */
|
||||
|
||||
/* Trance range structure. */
|
||||
struct ptrace_range {
|
||||
int pr_space; /* space in traced process */
|
||||
long pr_addr; /* address in traced process */
|
||||
void *pr_ptr; /* buffer in caller process */
|
||||
size_t pr_size; /* size of range, in bytes */
|
||||
};
|
||||
|
||||
/* Function Prototypes. */
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
long ptrace(int _req, pid_t _pid, long _addr, long _data);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _PTRACE_H */
|
188
nbsd_include/sys/ptree.h
Normal file
188
nbsd_include/sys/ptree.h
Normal file
|
@ -0,0 +1,188 @@
|
|||
/* $NetBSD: ptree.h,v 1.3 2008/11/25 15:13:47 ad Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Matt Thomas <matt@3am-software.com>
|
||||
*
|
||||
* 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 _SYS_PTREE_H_
|
||||
#define _SYS_PTREE_H_
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
PT_DESCENDING=-1,
|
||||
PT_ASCENDING=1
|
||||
} pt_direction_t;
|
||||
|
||||
typedef unsigned int pt_slot_t;
|
||||
typedef unsigned int pt_bitoff_t;
|
||||
typedef unsigned int pt_bitlen_t;
|
||||
|
||||
typedef struct pt_node {
|
||||
uintptr_t ptn_slots[2]; /* must be first */
|
||||
#define PT_SLOT_LEFT 0
|
||||
#define PT_SLOT_RIGHT 1
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PT_SLOT_ROOT 0
|
||||
#define PT_SLOT_OTHER 1
|
||||
#define PT_SLOT_ODDMAN 1
|
||||
#define PT_TYPE_LEAF 0x00000000
|
||||
#define PT_TYPE_BRANCH 0x00000001
|
||||
#define PT_TYPE_MASK 0x00000001
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
uint32_t ptn_nodedata;
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PTN_LEAF_POSITION_BITS 8
|
||||
#define PTN_LEAF_POSITION_SHIFT 0
|
||||
#define PTN_BRANCH_POSITION_BITS 8
|
||||
#define PTN_BRANCH_POSITION_SHIFT 8
|
||||
#ifndef PTNOMASK
|
||||
#define PTN_MASK_BITLEN_BITS 15
|
||||
#define PTN_MASK_BITLEN_SHIFT 16
|
||||
#define PTN_MASK_FLAG 0x80000000
|
||||
#endif
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
uint32_t ptn_branchdata;
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PTN_BRANCH_BITOFF_BITS 15
|
||||
#define PTN_BRANCH_BITOFF_SHIFT 0
|
||||
#define PTN_BRANCH_BITLEN_BITS 8
|
||||
#define PTN_BRANCH_BITLEN_SHIFT 16
|
||||
#if 0
|
||||
#define PTN_ORIENTATION_BITS 1
|
||||
#define PTN_ORIENTATION_SHIFT 30
|
||||
#endif
|
||||
#define PTN_BRANCH_UNUSED 0x3f000000
|
||||
#define PTN_XBRANCH_FLAG 0x80000000
|
||||
#endif /* _PT_PRIVATE */
|
||||
} pt_node_t;
|
||||
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PT_NODE(node) ((pt_node_t *)(node & ~PT_TYPE_MASK))
|
||||
#define PT_TYPE(node) ((node) & PT_TYPE_MASK)
|
||||
#define PT_NULL 0
|
||||
#define PT_NULL_P(node) ((node) == PT_NULL)
|
||||
#define PT_LEAF_P(node) (PT_TYPE(node) == PT_TYPE_LEAF)
|
||||
#define PT_BRANCH_P(node) (PT_TYPE(node) == PT_TYPE_BRANCH)
|
||||
#define PTN__TYPELESS(ptn) (((uintptr_t)ptn) & ~PT_TYPE_MASK)
|
||||
#define PTN_LEAF(ptn) (PTN__TYPELESS(ptn) | PT_TYPE_LEAF)
|
||||
#define PTN_BRANCH(ptn) (PTN__TYPELESS(ptn) | PT_TYPE_BRANCH)
|
||||
|
||||
#ifndef PTNOMASK
|
||||
#define PTN_MARK_MASK(ptn) ((ptn)->ptn_nodedata |= PTN_MASK_FLAG)
|
||||
#define PTN_ISMASK_P(ptn) (((ptn)->ptn_nodedata & PTN_MASK_FLAG) != 0)
|
||||
#endif
|
||||
#define PTN_MARK_XBRANCH(ptn) ((ptn)->ptn_branchdata |= PTN_XBRANCH_FLAG)
|
||||
#define PTN_ISXBRANCH_P(ptn) (((ptn)->ptn_branchdata & PTN_XBRANCH_FLAG) != 0)
|
||||
#define PTN_ISROOT_P(pt, ptn) ((ptn) == &(pt)->pt_rootnode)
|
||||
|
||||
#define PTN_BRANCH_SLOT(ptn,slot) ((ptn)->ptn_slots[slot])
|
||||
#define PTN_BRANCH_ROOT_SLOT(ptn) ((ptn)->ptn_slots[PT_SLOT_ROOT])
|
||||
#define PTN_BRANCH_ODDMAN_SLOT(ptn) ((ptn)->ptn_slots[PT_SLOT_ODDMAN])
|
||||
#define PTN_COPY_BRANCH_SLOTS(dst,src) \
|
||||
((dst)->ptn_slots[PT_SLOT_LEFT ] = (src)->ptn_slots[PT_SLOT_LEFT ], \
|
||||
(dst)->ptn_slots[PT_SLOT_RIGHT] = (src)->ptn_slots[PT_SLOT_RIGHT])
|
||||
#define PTN_ISSLOTVALID_P(ptn,slot) ((slot) < (1 << PTN_BRANCH_BITLEN(pt)))
|
||||
|
||||
#define PT__MASK(n) ((1 << n ## _BITS) - 1)
|
||||
#define PT__SHIFT(n) (n ## _SHIFT)
|
||||
#define PTN__EXTRACT(field, b) \
|
||||
(((field) >> PT__SHIFT(b)) & PT__MASK(b))
|
||||
#define PTN__INSERT2(field, v, shift, mask) \
|
||||
((field) = ((field) & ~((mask) << (shift))) | ((v) << (shift)))
|
||||
#define PTN__INSERT(field, b, v) \
|
||||
PTN__INSERT2(field, v, PT__SHIFT(b), PT__MASK(b))
|
||||
|
||||
#define PTN_BRANCH_BITOFF(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_branchdata, PTN_BRANCH_BITOFF)
|
||||
#define PTN_BRANCH_BITLEN(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_branchdata, PTN_BRANCH_BITLEN)
|
||||
#define PTN_SET_BRANCH_BITOFF(ptn,bitoff) \
|
||||
PTN__INSERT((ptn)->ptn_branchdata, PTN_BRANCH_BITOFF, bitoff)
|
||||
#define PTN_SET_BRANCH_BITLEN(ptn,bitlen) \
|
||||
PTN__INSERT((ptn)->ptn_branchdata, PTN_BRANCH_BITLEN, bitlen)
|
||||
|
||||
#define PTN_LEAF_POSITION(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_nodedata, PTN_LEAF_POSITION)
|
||||
#define PTN_BRANCH_POSITION(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_nodedata, PTN_BRANCH_POSITION)
|
||||
#define PTN_SET_LEAF_POSITION(ptn,slot) \
|
||||
PTN__INSERT((ptn)->ptn_nodedata, PTN_LEAF_POSITION, slot)
|
||||
#define PTN_SET_BRANCH_POSITION(ptn,slot) \
|
||||
PTN__INSERT((ptn)->ptn_nodedata, PTN_BRANCH_POSITION, slot)
|
||||
|
||||
#ifndef PTNOMASK
|
||||
#define PTN_MASK_BITLEN(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_nodedata, PTN_MASK_BITLEN)
|
||||
#define PTN_SET_MASK_BITLEN(ptn,masklen) \
|
||||
PTN__INSERT((ptn)->ptn_nodedata, PTN_MASK_BITLEN, masklen)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define PTN_ORIENTATION(ptn) \
|
||||
PTN__EXTRACT((ptn)->ptn_branchdata, PTN_ORIENTATION)
|
||||
#define PTN_SET_ORIENTATION(ptn,slot) \
|
||||
PTN__INSERT((ptn)->ptn_branchdata, PTN_ORIENTATION, slot)
|
||||
#endif
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
typedef struct pt_tree_ops {
|
||||
bool (*ptto_matchnode)(const void *, const void *, pt_bitoff_t,
|
||||
pt_bitoff_t *, pt_slot_t *);
|
||||
bool (*ptto_matchkey)(const void *, const void *, pt_bitoff_t,
|
||||
pt_bitlen_t);
|
||||
pt_slot_t (*ptto_testnode)(const void *, pt_bitoff_t, pt_bitlen_t);
|
||||
pt_slot_t (*ptto_testkey)(const void *, pt_bitoff_t, pt_bitlen_t);
|
||||
} pt_tree_ops_t;
|
||||
|
||||
typedef struct pt_tree {
|
||||
pt_node_t pt_rootnode;
|
||||
#define pt_root pt_rootnode.ptn_slots[PT_SLOT_ROOT]
|
||||
#define pt_oddman pt_rootnode.ptn_slots[PT_SLOT_ODDMAN]
|
||||
const pt_tree_ops_t *pt_ops;
|
||||
size_t pt_node_offset;
|
||||
size_t pt_key_offset;
|
||||
uintptr_t pt_spare[4];
|
||||
} pt_tree_t;
|
||||
|
||||
#define PT_FILTER_MASK 0x00000001 /* node is a mask */
|
||||
typedef bool (*pt_filter_t)(void *, const void *, int);
|
||||
|
||||
void ptree_init(pt_tree_t *, const pt_tree_ops_t *, size_t, size_t);
|
||||
bool ptree_insert_node(pt_tree_t *, void *);
|
||||
bool ptree_insert_mask_node(pt_tree_t *, void *, pt_bitlen_t);
|
||||
void * ptree_find_filtered_node(pt_tree_t *, void *, pt_filter_t, void *);
|
||||
#define ptree_find_node(pt,key) \
|
||||
ptree_find_filtered_node((pt), (key), NULL, NULL)
|
||||
void ptree_remove_node(pt_tree_t *, void *);
|
||||
void * ptree_iterate(pt_tree_t *, const void *, pt_direction_t);
|
||||
|
||||
#endif /* _SYS_PTREE_H_ */
|
739
nbsd_include/sys/queue.h
Normal file
739
nbsd_include/sys/queue.h
Normal file
|
@ -0,0 +1,739 @@
|
|||
/* $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
#include <sys/null.h>
|
||||
|
||||
/*
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* lists, simple queues, tail queues, and circular queues.
|
||||
*
|
||||
* A singly-linked list is headed by a single forward pointer. The
|
||||
* elements are singly linked for minimum space and pointer manipulation
|
||||
* overhead at the expense of O(n) removal for arbitrary elements. New
|
||||
* elements can be added to the list after an existing element or at the
|
||||
* head of the list. Elements being removed from the head of the list
|
||||
* should use the explicit macro for this purpose for optimum
|
||||
* efficiency. A singly-linked list may only be traversed in the forward
|
||||
* direction. Singly-linked lists are ideal for applications with large
|
||||
* datasets and few or no removals or for implementing a LIFO queue.
|
||||
*
|
||||
* A list is headed by a single forward pointer (or an array of forward
|
||||
* pointers for a hash table header). The elements are doubly linked
|
||||
* so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before
|
||||
* or after an existing element or at the head of the list. A list
|
||||
* may only be traversed in the forward direction.
|
||||
*
|
||||
* A simple queue is headed by a pair of pointers, one the head of the
|
||||
* list and the other to the tail of the list. The elements are singly
|
||||
* linked to save space, so elements can only be removed from the
|
||||
* head of the list. New elements can be added to the list after
|
||||
* an existing element, at the head of the list, or at the end of the
|
||||
* list. A simple queue may only be traversed in the forward direction.
|
||||
*
|
||||
* A tail queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or
|
||||
* after an existing element, at the head of the list, or at the end of
|
||||
* the list. A tail queue may be traversed in either direction.
|
||||
*
|
||||
* A circle queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the list.
|
||||
* A circle queue may be traversed in either direction, but has a more
|
||||
* complex end of list detection.
|
||||
*
|
||||
* For details on the use of these macros, see the queue(3) manual page.
|
||||
*/
|
||||
|
||||
/*
|
||||
* List definitions.
|
||||
*/
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* List functions.
|
||||
*/
|
||||
#if defined(_KERNEL) && defined(QUEUEDEBUG)
|
||||
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
|
||||
if ((head)->lh_first && \
|
||||
(head)->lh_first->field.le_prev != &(head)->lh_first) \
|
||||
panic("LIST_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_LIST_OP(elm, field) \
|
||||
if ((elm)->field.le_next && \
|
||||
(elm)->field.le_next->field.le_prev != \
|
||||
&(elm)->field.le_next) \
|
||||
panic("LIST_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
|
||||
if (*(elm)->field.le_prev != (elm)) \
|
||||
panic("LIST_* back %p %s:%d", (elm), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \
|
||||
(elm)->field.le_next = (void *)1L; \
|
||||
(elm)->field.le_prev = (void *)1L;
|
||||
#else
|
||||
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
|
||||
#define QUEUEDEBUG_LIST_OP(elm, field)
|
||||
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
|
||||
#endif
|
||||
|
||||
#define LIST_INIT(head) do { \
|
||||
(head)->lh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP((listelm), field) \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP((listelm), field) \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP((elm), field) \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->lh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.le_next))
|
||||
|
||||
/*
|
||||
* List access methods.
|
||||
*/
|
||||
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_INIT(head) do { \
|
||||
(head)->slh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
while(curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_REMOVE_AFTER(slistelm, field) do { \
|
||||
(slistelm)->field.sle_next = \
|
||||
SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
||||
|
||||
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
#define STAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *stqh_first; /* first element */ \
|
||||
struct type **stqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define STAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).stqh_first }
|
||||
|
||||
#define STAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *stqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue functions.
|
||||
*/
|
||||
#define STAILQ_INIT(head) do { \
|
||||
(head)->stqh_first = NULL; \
|
||||
(head)->stqh_last = &(head)->stqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
(head)->stqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.stqe_next = NULL; \
|
||||
*(head)->stqh_last = (elm); \
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
(listelm)->field.stqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
|
||||
(head)->stqh_last = &(head)->stqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->stqh_first == (elm)) { \
|
||||
STAILQ_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->stqh_first; \
|
||||
while (curelm->field.stqe_next != (elm)) \
|
||||
curelm = curelm->field.stqe_next; \
|
||||
if ((curelm->field.stqe_next = \
|
||||
curelm->field.stqe_next->field.stqe_next) == NULL) \
|
||||
(head)->stqh_last = &(curelm)->field.stqe_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->stqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.stqe_next))
|
||||
|
||||
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = STAILQ_FIRST((head)); \
|
||||
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define STAILQ_CONCAT(head1, head2) do { \
|
||||
if (!STAILQ_EMPTY((head2))) { \
|
||||
*(head1)->stqh_last = (head2)->stqh_first; \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_LAST(head, type, field) \
|
||||
(STAILQ_EMPTY((head)) ? \
|
||||
NULL : \
|
||||
((struct type *)(void *) \
|
||||
((char *)((head)->stqh_last) - offsetof(struct type, field))))
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue access methods.
|
||||
*/
|
||||
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
|
||||
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
|
||||
/*
|
||||
* Simple queue definitions.
|
||||
*/
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple queue functions.
|
||||
*/
|
||||
#define SIMPLEQ_INIT(head) do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->sqh_first == (elm)) { \
|
||||
SIMPLEQ_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->sqh_first; \
|
||||
while (curelm->field.sqe_next != (elm)) \
|
||||
curelm = curelm->field.sqe_next; \
|
||||
if ((curelm->field.sqe_next = \
|
||||
curelm->field.sqe_next->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(curelm)->field.sqe_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->sqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.sqe_next))
|
||||
|
||||
#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
|
||||
for ((var) = ((head)->sqh_first); \
|
||||
(var) && ((next = ((var)->field.sqe_next)), 1); \
|
||||
(var) = (next))
|
||||
|
||||
#define SIMPLEQ_CONCAT(head1, head2) do { \
|
||||
if (!SIMPLEQ_EMPTY((head2))) { \
|
||||
*(head1)->sqh_last = (head2)->sqh_first; \
|
||||
(head1)->sqh_last = (head2)->sqh_last; \
|
||||
SIMPLEQ_INIT((head2)); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_LAST(head, type, field) \
|
||||
(SIMPLEQ_EMPTY((head)) ? \
|
||||
NULL : \
|
||||
((struct type *)(void *) \
|
||||
((char *)((head)->sqh_last) - offsetof(struct type, field))))
|
||||
|
||||
/*
|
||||
* Simple queue access methods.
|
||||
*/
|
||||
#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define _TAILQ_HEAD(name, type, qual) \
|
||||
struct name { \
|
||||
qual type *tqh_first; /* first element */ \
|
||||
qual type *qual *tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define _TAILQ_ENTRY(type, qual) \
|
||||
struct { \
|
||||
qual type *tqe_next; /* next element */ \
|
||||
qual type *qual *tqe_prev; /* address of previous next element */\
|
||||
}
|
||||
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#if defined(_KERNEL) && defined(QUEUEDEBUG)
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
|
||||
if ((head)->tqh_first && \
|
||||
(head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
|
||||
panic("TAILQ_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
|
||||
if (*(head)->tqh_last != NULL) \
|
||||
panic("TAILQ_INSERT_TAIL %p %s:%d", (head), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_TAILQ_OP(elm, field) \
|
||||
if ((elm)->field.tqe_next && \
|
||||
(elm)->field.tqe_next->field.tqe_prev != \
|
||||
&(elm)->field.tqe_next) \
|
||||
panic("TAILQ_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
|
||||
if (*(elm)->field.tqe_prev != (elm)) \
|
||||
panic("TAILQ_* back %p %s:%d", (elm), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \
|
||||
if ((elm)->field.tqe_next == NULL && \
|
||||
(head)->tqh_last != &(elm)->field.tqe_next) \
|
||||
panic("TAILQ_PREREMOVE head %p elm %p %s:%d", \
|
||||
(head), (elm), __FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \
|
||||
(elm)->field.tqe_next = (void *)1L; \
|
||||
(elm)->field.tqe_prev = (void *)1L;
|
||||
#else
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
|
||||
#define QUEUEDEBUG_TAILQ_OP(elm, field)
|
||||
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
|
||||
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
|
||||
#endif
|
||||
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_OP((listelm), field) \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_OP((listelm), field) \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
|
||||
QUEUEDEBUG_TAILQ_OP((elm), field) \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.tqe_next))
|
||||
|
||||
#define TAILQ_FOREACH_SAFE(var, head, field, next) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var) != NULL && ((next) = TAILQ_NEXT(var, field), 1); \
|
||||
(var) = (next))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
|
||||
(var); \
|
||||
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
|
||||
for ((var) = TAILQ_LAST((head), headname); \
|
||||
(var) && ((prev) = TAILQ_PREV((var), headname, field), 1);\
|
||||
(var) = (prev))
|
||||
|
||||
#define TAILQ_CONCAT(head1, head2, field) do { \
|
||||
if (!TAILQ_EMPTY(head2)) { \
|
||||
*(head1)->tqh_last = (head2)->tqh_first; \
|
||||
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
|
||||
(head1)->tqh_last = (head2)->tqh_last; \
|
||||
TAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* Tail queue access methods.
|
||||
*/
|
||||
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
|
||||
|
||||
/*
|
||||
* Circular queue definitions.
|
||||
*/
|
||||
#if defined(_KERNEL) && defined(QUEUEDEBUG)
|
||||
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \
|
||||
if ((head)->cqh_first != (void *)(head) && \
|
||||
(head)->cqh_first->field.cqe_prev != (void *)(head)) \
|
||||
panic("CIRCLEQ head forw %p %s:%d", (head), \
|
||||
__FILE__, __LINE__); \
|
||||
if ((head)->cqh_last != (void *)(head) && \
|
||||
(head)->cqh_last->field.cqe_next != (void *)(head)) \
|
||||
panic("CIRCLEQ head back %p %s:%d", (head), \
|
||||
__FILE__, __LINE__);
|
||||
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \
|
||||
if ((elm)->field.cqe_next == (void *)(head)) { \
|
||||
if ((head)->cqh_last != (elm)) \
|
||||
panic("CIRCLEQ elm last %p %s:%d", (elm), \
|
||||
__FILE__, __LINE__); \
|
||||
} else { \
|
||||
if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \
|
||||
panic("CIRCLEQ elm forw %p %s:%d", (elm), \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
if ((elm)->field.cqe_prev == (void *)(head)) { \
|
||||
if ((head)->cqh_first != (elm)) \
|
||||
panic("CIRCLEQ elm first %p %s:%d", (elm), \
|
||||
__FILE__, __LINE__); \
|
||||
} else { \
|
||||
if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \
|
||||
panic("CIRCLEQ elm prev %p %s:%d", (elm), \
|
||||
__FILE__, __LINE__); \
|
||||
}
|
||||
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \
|
||||
(elm)->field.cqe_next = (void *)1L; \
|
||||
(elm)->field.cqe_prev = (void *)1L;
|
||||
#else
|
||||
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
|
||||
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
|
||||
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
|
||||
#endif
|
||||
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ (void *)&head, (void *)&head }
|
||||
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Circular queue functions.
|
||||
*/
|
||||
#define CIRCLEQ_INIT(head) do { \
|
||||
(head)->cqh_first = (void *)(head); \
|
||||
(head)->cqh_last = (void *)(head); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
|
||||
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == (void *)(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
|
||||
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
|
||||
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == (void *)(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = (void *)(head); \
|
||||
if ((head)->cqh_last == (void *)(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
|
||||
(elm)->field.cqe_next = (void *)(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == (void *)(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) do { \
|
||||
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
|
||||
QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
|
||||
if ((elm)->field.cqe_next == (void *)(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = \
|
||||
(elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == (void *)(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = \
|
||||
(elm)->field.cqe_next; \
|
||||
QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->cqh_first); \
|
||||
(var) != (const void *)(head); \
|
||||
(var) = ((var)->field.cqe_next))
|
||||
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for ((var) = ((head)->cqh_last); \
|
||||
(var) != (const void *)(head); \
|
||||
(var) = ((var)->field.cqe_prev))
|
||||
|
||||
/*
|
||||
* Circular queue access methods.
|
||||
*/
|
||||
#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
|
||||
#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
|
||||
(((elm)->field.cqe_next == (void *)(head)) \
|
||||
? ((head)->cqh_first) \
|
||||
: (elm->field.cqe_next))
|
||||
#define CIRCLEQ_LOOP_PREV(head, elm, field) \
|
||||
(((elm)->field.cqe_prev == (void *)(head)) \
|
||||
? ((head)->cqh_last) \
|
||||
: (elm->field.cqe_prev))
|
||||
|
||||
#endif /* !_SYS_QUEUE_H_ */
|
194
nbsd_include/sys/rbtree.h
Normal file
194
nbsd_include/sys/rbtree.h
Normal file
|
@ -0,0 +1,194 @@
|
|||
/* $NetBSD: rbtree.h,v 1.1 2010/09/25 01:42:40 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Matt Thomas <matt@3am-software.com>.
|
||||
*
|
||||
* 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 _SYS_RBTREE_H_
|
||||
#define _SYS_RBTREE_H_
|
||||
|
||||
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include <sys/queue.h>
|
||||
#include <sys/endian.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef struct rb_node {
|
||||
struct rb_node *rb_nodes[2];
|
||||
#define RB_DIR_LEFT 0
|
||||
#define RB_DIR_RIGHT 1
|
||||
#define RB_DIR_OTHER 1
|
||||
#define rb_left rb_nodes[RB_DIR_LEFT]
|
||||
#define rb_right rb_nodes[RB_DIR_RIGHT]
|
||||
|
||||
/*
|
||||
* rb_info contains the two flags and the parent back pointer.
|
||||
* We put the two flags in the low two bits since we know that
|
||||
* rb_node will have an alignment of 4 or 8 bytes.
|
||||
*/
|
||||
uintptr_t rb_info;
|
||||
#define RB_FLAG_POSITION 0x2
|
||||
#define RB_FLAG_RED 0x1
|
||||
#define RB_FLAG_MASK (RB_FLAG_POSITION|RB_FLAG_RED)
|
||||
#define RB_FATHER(rb) \
|
||||
((struct rb_node *)((rb)->rb_info & ~RB_FLAG_MASK))
|
||||
#define RB_SET_FATHER(rb, father) \
|
||||
((void)((rb)->rb_info = (uintptr_t)(father)|((rb)->rb_info & RB_FLAG_MASK)))
|
||||
|
||||
#define RB_SENTINEL_P(rb) ((rb) == NULL)
|
||||
#define RB_LEFT_SENTINEL_P(rb) RB_SENTINEL_P((rb)->rb_left)
|
||||
#define RB_RIGHT_SENTINEL_P(rb) RB_SENTINEL_P((rb)->rb_right)
|
||||
#define RB_FATHER_SENTINEL_P(rb) RB_SENTINEL_P(RB_FATHER((rb)))
|
||||
#define RB_CHILDLESS_P(rb) \
|
||||
(RB_SENTINEL_P(rb) || (RB_LEFT_SENTINEL_P(rb) && RB_RIGHT_SENTINEL_P(rb)))
|
||||
#define RB_TWOCHILDREN_P(rb) \
|
||||
(!RB_SENTINEL_P(rb) && !RB_LEFT_SENTINEL_P(rb) && !RB_RIGHT_SENTINEL_P(rb))
|
||||
|
||||
#define RB_POSITION(rb) \
|
||||
(((rb)->rb_info & RB_FLAG_POSITION) ? RB_DIR_RIGHT : RB_DIR_LEFT)
|
||||
#define RB_RIGHT_P(rb) (RB_POSITION(rb) == RB_DIR_RIGHT)
|
||||
#define RB_LEFT_P(rb) (RB_POSITION(rb) == RB_DIR_LEFT)
|
||||
#define RB_RED_P(rb) (!RB_SENTINEL_P(rb) && ((rb)->rb_info & RB_FLAG_RED) != 0)
|
||||
#define RB_BLACK_P(rb) (RB_SENTINEL_P(rb) || ((rb)->rb_info & RB_FLAG_RED) == 0)
|
||||
#define RB_MARK_RED(rb) ((void)((rb)->rb_info |= RB_FLAG_RED))
|
||||
#define RB_MARK_BLACK(rb) ((void)((rb)->rb_info &= ~RB_FLAG_RED))
|
||||
#define RB_INVERT_COLOR(rb) ((void)((rb)->rb_info ^= RB_FLAG_RED))
|
||||
#define RB_ROOT_P(rbt, rb) ((rbt)->rbt_root == (rb))
|
||||
#define RB_SET_POSITION(rb, position) \
|
||||
((void)((position) ? ((rb)->rb_info |= RB_FLAG_POSITION) : \
|
||||
((rb)->rb_info &= ~RB_FLAG_POSITION)))
|
||||
#define RB_ZERO_PROPERTIES(rb) ((void)((rb)->rb_info &= ~RB_FLAG_MASK))
|
||||
#define RB_COPY_PROPERTIES(dst, src) \
|
||||
((void)((dst)->rb_info ^= ((dst)->rb_info ^ (src)->rb_info) & RB_FLAG_MASK))
|
||||
#define RB_SWAP_PROPERTIES(a, b) do { \
|
||||
uintptr_t xorinfo = ((a)->rb_info ^ (b)->rb_info) & RB_FLAG_MASK; \
|
||||
(a)->rb_info ^= xorinfo; \
|
||||
(b)->rb_info ^= xorinfo; \
|
||||
} while (/*CONSTCOND*/ 0)
|
||||
#ifdef RBDEBUG
|
||||
TAILQ_ENTRY(rb_node) rb_link;
|
||||
#endif
|
||||
} rb_node_t;
|
||||
|
||||
#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT)
|
||||
#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT)
|
||||
#define RB_TREE_FOREACH(N, T) \
|
||||
for ((N) = RB_TREE_MIN(T); (N); \
|
||||
(N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT))
|
||||
#define RB_TREE_FOREACH_REVERSE(N, T) \
|
||||
for ((N) = RB_TREE_MAX(T); (N); \
|
||||
(N) = rb_tree_iterate((T), (N), RB_DIR_LEFT))
|
||||
|
||||
#ifdef RBDEBUG
|
||||
TAILQ_HEAD(rb_node_qh, rb_node);
|
||||
|
||||
#define RB_TAILQ_REMOVE(a, b, c) TAILQ_REMOVE(a, b, c)
|
||||
#define RB_TAILQ_INIT(a) TAILQ_INIT(a)
|
||||
#define RB_TAILQ_INSERT_HEAD(a, b, c) TAILQ_INSERT_HEAD(a, b, c)
|
||||
#define RB_TAILQ_INSERT_BEFORE(a, b, c) TAILQ_INSERT_BEFORE(a, b, c)
|
||||
#define RB_TAILQ_INSERT_AFTER(a, b, c, d) TAILQ_INSERT_AFTER(a, b, c, d)
|
||||
#else
|
||||
#define RB_TAILQ_REMOVE(a, b, c) do { } while (/*CONSTCOND*/0)
|
||||
#define RB_TAILQ_INIT(a) do { } while (/*CONSTCOND*/0)
|
||||
#define RB_TAILQ_INSERT_HEAD(a, b, c) do { } while (/*CONSTCOND*/0)
|
||||
#define RB_TAILQ_INSERT_BEFORE(a, b, c) do { } while (/*CONSTCOND*/0)
|
||||
#define RB_TAILQ_INSERT_AFTER(a, b, c, d) do { } while (/*CONSTCOND*/0)
|
||||
#endif /* RBDEBUG */
|
||||
|
||||
/*
|
||||
* rbto_compare_nodes_fn:
|
||||
* return a positive value if the first node > the second node.
|
||||
* return a negative value if the first node < the second node.
|
||||
* return 0 if they are considered same.
|
||||
*
|
||||
* rbto_compare_key_fn:
|
||||
* return a positive value if the node > the key.
|
||||
* return a negative value if the node < the key.
|
||||
* return 0 if they are considered same.
|
||||
*/
|
||||
|
||||
typedef signed int (*const rbto_compare_nodes_fn)(void *,
|
||||
const void *, const void *);
|
||||
typedef signed int (*const rbto_compare_key_fn)(void *,
|
||||
const void *, const void *);
|
||||
|
||||
typedef struct {
|
||||
rbto_compare_nodes_fn rbto_compare_nodes;
|
||||
rbto_compare_key_fn rbto_compare_key;
|
||||
size_t rbto_node_offset;
|
||||
void *rbto_context;
|
||||
} rb_tree_ops_t;
|
||||
|
||||
typedef struct rb_tree {
|
||||
struct rb_node *rbt_root;
|
||||
const rb_tree_ops_t *rbt_ops;
|
||||
struct rb_node *rbt_minmax[2];
|
||||
#ifdef RBDEBUG
|
||||
struct rb_node_qh rbt_nodes;
|
||||
#endif
|
||||
#ifdef RBSTATS
|
||||
unsigned int rbt_count;
|
||||
unsigned int rbt_insertions;
|
||||
unsigned int rbt_removals;
|
||||
unsigned int rbt_insertion_rebalance_calls;
|
||||
unsigned int rbt_insertion_rebalance_passes;
|
||||
unsigned int rbt_removal_rebalance_calls;
|
||||
unsigned int rbt_removal_rebalance_passes;
|
||||
#endif
|
||||
} rb_tree_t;
|
||||
|
||||
#ifdef RBSTATS
|
||||
#define RBSTAT_INC(v) ((void)((v)++))
|
||||
#define RBSTAT_DEC(v) ((void)((v)--))
|
||||
#else
|
||||
#define RBSTAT_INC(v) do { } while (/*CONSTCOND*/0)
|
||||
#define RBSTAT_DEC(v) do { } while (/*CONSTCOND*/0)
|
||||
#endif
|
||||
|
||||
void rb_tree_init(rb_tree_t *, const rb_tree_ops_t *);
|
||||
void * rb_tree_insert_node(rb_tree_t *, void *);
|
||||
void * rb_tree_find_node(rb_tree_t *, const void *);
|
||||
void * rb_tree_find_node_geq(rb_tree_t *, const void *);
|
||||
void * rb_tree_find_node_leq(rb_tree_t *, const void *);
|
||||
void rb_tree_remove_node(rb_tree_t *, void *);
|
||||
void * rb_tree_iterate(rb_tree_t *, void *, const unsigned int);
|
||||
#ifdef RBDEBUG
|
||||
void rb_tree_check(const rb_tree_t *, bool);
|
||||
#endif
|
||||
#ifdef RBSTATS
|
||||
void rb_tree_depths(const rb_tree_t *, size_t *);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_RBTREE_H_*/
|
13
nbsd_include/sys/reboot.h
Normal file
13
nbsd_include/sys/reboot.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef _SYS_REBOOT_H_
|
||||
#define _SYS_REBOOT_H_
|
||||
|
||||
/* How to exit the system or stop a server process. */
|
||||
#define RBT_HALT 0 /* shutdown and return to monitor */
|
||||
#define RBT_REBOOT 1 /* reboot the system through the monitor */
|
||||
#define RBT_PANIC 2 /* a server panics */
|
||||
#define RBT_MONITOR 3 /* let the monitor do this */
|
||||
#define RBT_RESET 4 /* hard reset the system */
|
||||
#define RBT_DEFAULT 5 /* return to monitor, reset if not possible */
|
||||
#define RBT_INVALID 6 /* first invalid reboot flag */
|
||||
|
||||
#endif
|
51
nbsd_include/sys/resource.h
Normal file
51
nbsd_include/sys/resource.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef _SYS_RESOURCE_H_
|
||||
#define _SYS_RESOURCE_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* Process priority specifications to get/setpriority.
|
||||
*/
|
||||
#define PRIO_MIN -20
|
||||
#define PRIO_MAX 20
|
||||
|
||||
#define PRIO_PROCESS 0
|
||||
#define PRIO_PGRP 1
|
||||
#define PRIO_USER 2
|
||||
|
||||
/*
|
||||
* Resource limits
|
||||
*/
|
||||
#define RLIMIT_CORE 1
|
||||
#define RLIMIT_CPU 2
|
||||
#define RLIMIT_DATA 3
|
||||
#define RLIMIT_FSIZE 4
|
||||
#define RLIMIT_NOFILE 5
|
||||
#define RLIMIT_STACK 6
|
||||
#define RLIMIT_AS 7
|
||||
#define RLIMIT_VMEM RLIMIT_AS /* common alias */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define RLIM_NLIMITS 8 /* number of resource limits */
|
||||
#endif
|
||||
|
||||
#define RLIM_INFINITY ((rlim_t) -1)
|
||||
#define RLIM_SAVED_CUR RLIM_INFINITY
|
||||
#define RLIM_SAVED_MAX RLIM_INFINITY
|
||||
|
||||
struct rlimit
|
||||
{
|
||||
rlim_t rlim_cur;
|
||||
rlim_t rlim_max;
|
||||
};
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int getpriority(int, int);
|
||||
int getrlimit(int, struct rlimit *);
|
||||
int setpriority(int, int, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_RESOURCE_H_ */
|
56
nbsd_include/sys/rmd160.h
Normal file
56
nbsd_include/sys/rmd160.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: rmd160.h,v 1.2 2008/02/16 17:37:13 apb Exp $ */
|
||||
/* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
|
||||
/* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Markus Friedl. 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 ``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 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 _RMD160_H
|
||||
#define _RMD160_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define RMD160_DIGEST_LENGTH 20
|
||||
#define RMD160_DIGEST_STRING_LENGTH 41
|
||||
|
||||
/* RMD160 context. */
|
||||
typedef struct RMD160Context {
|
||||
uint32_t state[5]; /* state */
|
||||
uint64_t count; /* number of bits, modulo 2^64 */
|
||||
u_char buffer[64]; /* input buffer */
|
||||
} RMD160_CTX;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void RMD160Init(RMD160_CTX *);
|
||||
void RMD160Transform(uint32_t [5], const u_char [64]);
|
||||
void RMD160Update(RMD160_CTX *, const u_char *, uint32_t);
|
||||
void RMD160Final(u_char [RMD160_DIGEST_LENGTH], RMD160_CTX *);
|
||||
#ifndef _KERNEL
|
||||
char *RMD160End(RMD160_CTX *, char *);
|
||||
char *RMD160FileChunk(const char *, char *, off_t, off_t);
|
||||
char *RMD160File(const char *, char *);
|
||||
char *RMD160Data(const u_char *, size_t, char *);
|
||||
#endif /* _KERNEL */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RMD160_H */
|
76
nbsd_include/sys/select.h
Normal file
76
nbsd_include/sys/select.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* $NetBSD: select.h,v 1.36 2009/11/11 09:48:51 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 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.
|
||||
*
|
||||
* @(#)select.h 8.2 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SELECT_H_
|
||||
#define _SYS_SELECT_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/fd_set.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/selinfo.h> /* for struct selinfo */
|
||||
#include <sys/signal.h> /* for sigset_t */
|
||||
|
||||
struct lwp;
|
||||
struct proc;
|
||||
struct timespec;
|
||||
struct cpu_info;
|
||||
struct socket;
|
||||
|
||||
int selcommon(register_t *, int, fd_set *, fd_set *, fd_set *,
|
||||
struct timespec *, sigset_t *);
|
||||
void selrecord(struct lwp *selector, struct selinfo *);
|
||||
void selnotify(struct selinfo *, int, long);
|
||||
void selsysinit(struct cpu_info *);
|
||||
void selinit(struct selinfo *);
|
||||
void seldestroy(struct selinfo *);
|
||||
int pollsock(struct socket *, const struct timespec *, int);
|
||||
|
||||
#else /* _KERNEL */
|
||||
|
||||
#include <sys/sigtypes.h>
|
||||
#include <time.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
int pselect(int, fd_set * __restrict, fd_set * __restrict,
|
||||
fd_set * __restrict, const struct timespec * __restrict,
|
||||
const sigset_t * __restrict) __RENAME(__pselect50);
|
||||
int select(int, fd_set * __restrict, fd_set * __restrict,
|
||||
fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50);
|
||||
#endif /* __LIBC12_SOURCE__ */
|
||||
__END_DECLS
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_SYS_SELECT_H_ */
|
121
nbsd_include/sys/sem.h
Normal file
121
nbsd_include/sys/sem.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/* $NetBSD: sem.h,v 1.29 2009/01/19 19:39:41 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SVID compatible sem.h file
|
||||
*
|
||||
* Author: Daniel Boulet
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SEM_H_
|
||||
#define _SYS_SEM_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
struct semid_ds {
|
||||
struct ipc_perm sem_perm; /* operation permission struct */
|
||||
time_t sem_otime; /* last semop() time */
|
||||
unsigned long int __unused1;
|
||||
time_t sem_ctime; /* last time changed by semctl() */
|
||||
unsigned long int __unused2;
|
||||
unsigned long int sem_nsems; /* number of semaphores in set */
|
||||
unsigned long int __unused3;
|
||||
unsigned long int __unused4;
|
||||
};
|
||||
|
||||
/*
|
||||
* semop's sops parameter structure
|
||||
*/
|
||||
struct sembuf {
|
||||
unsigned short sem_num; /* semaphore # */
|
||||
short sem_op; /* semaphore operation */
|
||||
short sem_flg; /* operation flags */
|
||||
};
|
||||
#define SEM_UNDO 0x1000 /* undo changes on process exit */
|
||||
|
||||
/*
|
||||
* commands for semctl
|
||||
*/
|
||||
#define GETPID 11 /* get sempid */
|
||||
#define GETVAL 12 /* get semval */
|
||||
#define GETALL 13 /* get all semval's */
|
||||
#define GETNCNT 14 /* get semncnt */
|
||||
#define GETZCNT 15 /* get semzcnt */
|
||||
#define SETVAL 16 /* set semval */
|
||||
#define SETALL 17 /* set all semval's */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
|
||||
/* ipcs ctl cmds */
|
||||
# define SEM_STAT 18
|
||||
# define SEM_INFO 19
|
||||
|
||||
/*
|
||||
* semaphore info struct
|
||||
*/
|
||||
struct seminfo {
|
||||
int32_t semmap; /* # of entries in semaphore map */
|
||||
int32_t semmni; /* # of semaphore identifiers */
|
||||
int32_t semmns; /* # of semaphores in system */
|
||||
int32_t semmnu; /* # of undo structures in system */
|
||||
int32_t semmsl; /* max # of semaphores per id */
|
||||
int32_t semopm; /* max # of operations per semop call */
|
||||
int32_t semume; /* max # of undo entries per process */
|
||||
int32_t semusz; /* size in bytes of undo structure */
|
||||
int32_t semvmx; /* semaphore maximum value */
|
||||
int32_t semaem; /* adjust on exit max value */
|
||||
};
|
||||
|
||||
#endif /* __USE_MISC */
|
||||
|
||||
/*
|
||||
* Configuration parameters
|
||||
*/
|
||||
#define SEMMNI 128
|
||||
#define SEMMSL 250
|
||||
#define SEMMNS (SEMMSL*SEMMNI)
|
||||
|
||||
#define SEMOPM 32
|
||||
#define SEMVMX 32767
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int semctl(int, int, int, ...);
|
||||
int semget(key_t, int, int);
|
||||
int semop(int, struct sembuf *, size_t);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_SEM_H_ */
|
37
nbsd_include/sys/sha1.h
Normal file
37
nbsd_include/sys/sha1.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* $NetBSD: sha1.h,v 1.14 2009/11/06 20:31:19 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* SHA-1 in C
|
||||
* By Steve Reid <steve@edmweb.com>
|
||||
* 100% Public Domain
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SHA1_H_
|
||||
#define _SYS_SHA1_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define SHA1_DIGEST_LENGTH 20
|
||||
#define SHA1_DIGEST_STRING_LENGTH 41
|
||||
|
||||
typedef struct {
|
||||
uint32_t state[5];
|
||||
uint32_t count[2];
|
||||
uint8_t buffer[64];
|
||||
} SHA1_CTX;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void SHA1Transform(uint32_t[5], const uint8_t[64]);
|
||||
void SHA1Init(SHA1_CTX *);
|
||||
void SHA1Update(SHA1_CTX *, const uint8_t *, unsigned int);
|
||||
void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX *);
|
||||
#ifndef _KERNEL
|
||||
char *SHA1End(SHA1_CTX *, char *);
|
||||
char *SHA1FileChunk(const char *, char *, off_t, off_t);
|
||||
char *SHA1File(const char *, char *);
|
||||
char *SHA1Data(const uint8_t *, size_t, char *);
|
||||
#endif /* _KERNEL */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_SHA1_H_ */
|
120
nbsd_include/sys/sha2.h
Normal file
120
nbsd_include/sys/sha2.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
/* $NetBSD: sha2.h,v 1.3 2009/05/26 08:04:12 joerg Exp $ */
|
||||
/* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* sha2.h
|
||||
*
|
||||
* Version 1.0.0beta1
|
||||
*
|
||||
* Written by Aaron D. Gifford <me@aarongifford.com>
|
||||
*
|
||||
* Copyright 2000 Aaron D. Gifford. 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 copyright holder nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``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(S) OR CONTRIBUTOR(S) 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 __SHA2_H__
|
||||
#define __SHA2_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*** SHA-224/256/384/512 Various Length Definitions ***********************/
|
||||
#define SHA224_BLOCK_LENGTH 64
|
||||
#define SHA224_DIGEST_LENGTH 28
|
||||
#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
|
||||
#define SHA256_BLOCK_LENGTH 64
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
|
||||
#define SHA384_BLOCK_LENGTH 128
|
||||
#define SHA384_DIGEST_LENGTH 48
|
||||
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
|
||||
#define SHA512_BLOCK_LENGTH 128
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
|
||||
|
||||
|
||||
/*** SHA-256/384/512 Context Structures *******************************/
|
||||
typedef struct _SHA256_CTX {
|
||||
uint32_t state[8];
|
||||
uint64_t bitcount;
|
||||
uint8_t buffer[SHA256_BLOCK_LENGTH];
|
||||
} SHA256_CTX;
|
||||
|
||||
typedef struct _SHA512_CTX {
|
||||
uint64_t state[8];
|
||||
uint64_t bitcount[2];
|
||||
uint8_t buffer[SHA512_BLOCK_LENGTH];
|
||||
} SHA512_CTX;
|
||||
|
||||
typedef SHA256_CTX SHA224_CTX;
|
||||
typedef SHA512_CTX SHA384_CTX;
|
||||
|
||||
|
||||
/*** SHA-256/384/512 Function Prototypes ******************************/
|
||||
__BEGIN_DECLS
|
||||
int SHA224_Init(SHA224_CTX *);
|
||||
int SHA224_Update(SHA224_CTX*, const uint8_t*, size_t);
|
||||
int SHA224_Final(uint8_t[SHA224_DIGEST_LENGTH], SHA224_CTX*);
|
||||
#ifndef _KERNEL
|
||||
char *SHA224_End(SHA224_CTX *, char[SHA224_DIGEST_STRING_LENGTH]);
|
||||
char *SHA224_FileChunk(const char *, char *, off_t, off_t);
|
||||
char *SHA224_File(const char *, char *);
|
||||
char *SHA224_Data(const uint8_t *, size_t, char[SHA224_DIGEST_STRING_LENGTH]);
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
int SHA256_Init(SHA256_CTX *);
|
||||
int SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
|
||||
int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
|
||||
#ifndef _KERNEL
|
||||
char *SHA256_End(SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||
char *SHA256_FileChunk(const char *, char *, off_t, off_t);
|
||||
char *SHA256_File(const char *, char *);
|
||||
char *SHA256_Data(const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
int SHA384_Init(SHA384_CTX*);
|
||||
int SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
|
||||
int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
|
||||
#ifndef _KERNEL
|
||||
char *SHA384_End(SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||
char *SHA384_FileChunk(const char *, char *, off_t, off_t);
|
||||
char *SHA384_File(const char *, char *);
|
||||
char *SHA384_Data(const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
int SHA512_Init(SHA512_CTX*);
|
||||
int SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
|
||||
int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
|
||||
#ifndef _KERNEL
|
||||
char *SHA512_End(SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||
char *SHA512_FileChunk(const char *, char *, off_t, off_t);
|
||||
char *SHA512_File(const char *, char *);
|
||||
char *SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||
#endif /* !_KERNEL */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __SHA2_H__ */
|
148
nbsd_include/sys/shm.h
Normal file
148
nbsd_include/sys/shm.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* $NetBSD: shm.h,v 1.48 2009/01/19 19:39:41 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Adam Glass
|
||||
* 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 Adam Glass.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* As defined+described in "X/Open System Interfaces and Headers"
|
||||
* Issue 4, p. XXX
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SHM_H_
|
||||
#define _SYS_SHM_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#define SHM_RDONLY 010000 /* Attach read-only (else read-write) */
|
||||
#define SHM_RND 020000 /* Round attach address to SHMLBA */
|
||||
|
||||
/* Segment low boundry address multiple */
|
||||
#define SHMLBA getpagesize()
|
||||
#define SHMMNI 4096
|
||||
#define SHMSEG 32 /* max shared segs per process */
|
||||
|
||||
typedef unsigned int shmatt_t;
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm; /* operation permission structure */
|
||||
size_t shm_segsz; /* size of segment in bytes */
|
||||
time_t shm_atime; /* time of last shmat() */
|
||||
time_t shm_dtime; /* time of last shmdt() */
|
||||
time_t shm_ctime; /* time of last change by shmctl() */
|
||||
pid_t shm_cpid; /* process ID of creator */
|
||||
pid_t shm_lpid; /* process ID of last shm operation */
|
||||
shmatt_t shm_nattch; /* number of current attaches */
|
||||
};
|
||||
|
||||
|
||||
/* shm_mode upper byte flags */
|
||||
#define SHM_DEST 01000 /* segment will be destroyed on last detach */
|
||||
#define SHM_LOCKED 02000 /* segment will not be swapped */
|
||||
|
||||
/* ipcs ctl commands */
|
||||
#define SHM_STAT 13
|
||||
#define SHM_INFO 14
|
||||
|
||||
|
||||
#if defined(_NETBSD_SOURCE) || defined(__minix)
|
||||
/*
|
||||
* Permission definitions used in shmflag arguments to shmat(2) and shmget(2).
|
||||
* Provided for source compatibility only; do not use in new code!
|
||||
*/
|
||||
#define SHM_R 0400
|
||||
#define SHM_W 0200
|
||||
|
||||
/*
|
||||
* System 5 style catch-all structure for shared memory constants that
|
||||
* might be of interest to user programs. Do we really want/need this?
|
||||
*/
|
||||
struct shminfo {
|
||||
unsigned long int shmmax; /* max shared memory segment size (bytes) */
|
||||
unsigned long int shmmin; /* min shared memory segment size (bytes) */
|
||||
unsigned long int shmmni; /* max number of shared memory identifiers */
|
||||
unsigned long int shmseg; /* max shared memory segments per process */
|
||||
unsigned long int shmall; /* max amount of shared memory (pages) */
|
||||
};
|
||||
|
||||
#ifdef __minix
|
||||
struct shm_info
|
||||
{
|
||||
int used_ids;
|
||||
unsigned long int shm_tot; /* total allocated shm */
|
||||
unsigned long int shm_rss; /* total resident shm */
|
||||
unsigned long int shm_swp; /* total swapped shm */
|
||||
unsigned long int swap_attempts;
|
||||
unsigned long int swap_successes;
|
||||
};
|
||||
#endif /* __minix */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
__BEGIN_DECLS
|
||||
void *shmat(int, const void *, int);
|
||||
int shmctl(int, int, struct shmid_ds *) __RENAME(__shmctl50);
|
||||
int shmdt(const void *);
|
||||
int shmget(key_t, size_t, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_SHM_H_ */
|
240
nbsd_include/sys/siginfo.h
Normal file
240
nbsd_include/sys/siginfo.h
Normal file
|
@ -0,0 +1,240 @@
|
|||
/* $NetBSD: siginfo.h,v 1.19 2009/03/27 11:05:43 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SIGINFO_H_
|
||||
#define _SYS_SIGINFO_H_
|
||||
|
||||
#include <machine/signal.h> /* XXX: __HAVE_SIGINFO */
|
||||
#ifdef _KERNEL
|
||||
#include <sys/queue.h>
|
||||
#endif
|
||||
|
||||
typedef union sigval {
|
||||
int sival_int;
|
||||
void *sival_ptr;
|
||||
} sigval_t;
|
||||
|
||||
struct _ksiginfo {
|
||||
int _signo;
|
||||
int _code;
|
||||
int _errno;
|
||||
#ifdef _LP64
|
||||
/* In _LP64 the union starts on an 8-byte boundary. */
|
||||
int _pad;
|
||||
#endif
|
||||
union {
|
||||
struct {
|
||||
pid_t _pid;
|
||||
uid_t _uid;
|
||||
sigval_t _value;
|
||||
} _rt;
|
||||
|
||||
struct {
|
||||
pid_t _pid;
|
||||
uid_t _uid;
|
||||
int _status;
|
||||
clock_t _utime;
|
||||
clock_t _stime;
|
||||
} _child;
|
||||
|
||||
struct {
|
||||
void *_addr;
|
||||
int _trap;
|
||||
} _fault;
|
||||
|
||||
struct {
|
||||
long _band;
|
||||
int _fd;
|
||||
} _poll;
|
||||
} _reason;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
typedef struct ksiginfo {
|
||||
u_long ksi_flags; /* 4 or 8 bytes (LP64) */
|
||||
CIRCLEQ_ENTRY(ksiginfo) ksi_list;
|
||||
struct _ksiginfo ksi_info;
|
||||
lwpid_t ksi_lid; /* 0, or directed to LWP */
|
||||
} ksiginfo_t;
|
||||
|
||||
#define KSI_TRAP 0x01 /* signal caused by trap */
|
||||
#define KSI_EMPTY 0x02 /* no additional information */
|
||||
#define KSI_QUEUED 0x04 /* on a sigpend_t queue */
|
||||
#define KSI_FROMPOOL 0x08 /* allocated from the ksiginfo pool */
|
||||
|
||||
/* Macros to initialize a ksiginfo_t. */
|
||||
#define KSI_INIT(ksi) \
|
||||
do { \
|
||||
memset((ksi), 0, sizeof(*(ksi))); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define KSI_INIT_EMPTY(ksi) \
|
||||
do { \
|
||||
KSI_INIT((ksi)); \
|
||||
(ksi)->ksi_flags = KSI_EMPTY; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define KSI_INIT_TRAP(ksi) \
|
||||
do { \
|
||||
KSI_INIT((ksi)); \
|
||||
(ksi)->ksi_flags = KSI_TRAP; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/* Copy the part of ksiginfo_t without the queue pointers */
|
||||
#define KSI_COPY(fksi, tksi) \
|
||||
do { \
|
||||
(tksi)->ksi_info = (fksi)->ksi_info; \
|
||||
(tksi)->ksi_flags = (fksi)->ksi_flags; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
|
||||
/* Predicate macros to test how a ksiginfo_t was generated. */
|
||||
#define KSI_TRAP_P(ksi) (((ksi)->ksi_flags & KSI_TRAP) != 0)
|
||||
#define KSI_EMPTY_P(ksi) (((ksi)->ksi_flags & KSI_EMPTY) != 0)
|
||||
|
||||
/*
|
||||
* Old-style signal handler "code" arguments were only non-zero for
|
||||
* signals caused by traps.
|
||||
*/
|
||||
#define KSI_TRAPCODE(ksi) (KSI_TRAP_P(ksi) ? (ksi)->ksi_trap : 0)
|
||||
#endif /* _KERNEL */
|
||||
|
||||
typedef union siginfo {
|
||||
char si_pad[128]; /* Total size; for future expansion */
|
||||
struct _ksiginfo _info;
|
||||
} siginfo_t;
|
||||
|
||||
/** Field access macros */
|
||||
#define si_signo _info._signo
|
||||
#define si_code _info._code
|
||||
#define si_errno _info._errno
|
||||
|
||||
#define si_value _info._reason._rt._value
|
||||
#define si_pid _info._reason._child._pid
|
||||
#define si_uid _info._reason._child._uid
|
||||
#define si_status _info._reason._child._status
|
||||
#define si_utime _info._reason._child._utime
|
||||
#define si_stime _info._reason._child._stime
|
||||
|
||||
#define si_addr _info._reason._fault._addr
|
||||
#define si_trap _info._reason._fault._trap
|
||||
|
||||
#define si_band _info._reason._poll._band
|
||||
#define si_fd _info._reason._poll._fd
|
||||
|
||||
#ifdef _KERNEL
|
||||
/** Field access macros */
|
||||
#define ksi_signo ksi_info._signo
|
||||
#define ksi_code ksi_info._code
|
||||
#define ksi_errno ksi_info._errno
|
||||
|
||||
#define ksi_value ksi_info._reason._rt._value
|
||||
#define ksi_pid ksi_info._reason._child._pid
|
||||
#define ksi_uid ksi_info._reason._child._uid
|
||||
#define ksi_status ksi_info._reason._child._status
|
||||
#define ksi_utime ksi_info._reason._child._utime
|
||||
#define ksi_stime ksi_info._reason._child._stime
|
||||
|
||||
#define ksi_addr ksi_info._reason._fault._addr
|
||||
#define ksi_trap ksi_info._reason._fault._trap
|
||||
|
||||
#define ksi_band ksi_info._reason._poll._band
|
||||
#define ksi_fd ksi_info._reason._poll._fd
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/** si_code */
|
||||
/* SIGILL */
|
||||
#define ILL_ILLOPC 1 /* Illegal opcode */
|
||||
#define ILL_ILLOPN 2 /* Illegal operand */
|
||||
#define ILL_ILLADR 3 /* Illegal addressing mode */
|
||||
#define ILL_ILLTRP 4 /* Illegal trap */
|
||||
#define ILL_PRVOPC 5 /* Privileged opcode */
|
||||
#define ILL_PRVREG 6 /* Privileged register */
|
||||
#define ILL_COPROC 7 /* Coprocessor error */
|
||||
#define ILL_BADSTK 8 /* Internal stack error */
|
||||
|
||||
/* SIGFPE */
|
||||
#define FPE_INTOVF 1 /* integer divide by zero */
|
||||
#define FPE_INTDIV 2 /* integer overflow */
|
||||
#define FPE_FLTDIV 3 /* floating-point divide by zero */
|
||||
#define FPE_FLTOVF 4 /* floating-point overflow */
|
||||
#define FPE_FLTUND 5 /* floating-point underflow */
|
||||
#define FPE_FLTRES 6 /* floating-point inexact result */
|
||||
#define FPE_FLTINV 7 /* floating-point invalid operation */
|
||||
#define FPE_FLTSUB 8 /* subscript out of range */
|
||||
|
||||
/* SIGSEGV */
|
||||
#define SEGV_MAPERR 1 /* Address not mapped to object */
|
||||
#define SEGV_ACCERR 2 /* Invalid permissions for mapped object*/
|
||||
|
||||
/* SIGBUS */
|
||||
#define BUS_ADRALN 1 /* Invalid address alignment */
|
||||
#define BUS_ADRERR 2 /* Non-existent physical address */
|
||||
#define BUS_OBJERR 3 /* Object specific hardware error */
|
||||
|
||||
/* SIGTRAP */
|
||||
#define TRAP_BRKPT 1 /* Process breakpoint */
|
||||
#define TRAP_TRACE 2 /* Process trace trap */
|
||||
|
||||
/* SIGCHLD */
|
||||
#define CLD_EXITED 1 /* Child has exited */
|
||||
#define CLD_KILLED 2 /* Child has terminated abnormally but */
|
||||
/* did not create a core file */
|
||||
#define CLD_DUMPED 3 /* Child has terminated abnormally and */
|
||||
/* created a core file */
|
||||
#define CLD_TRAPPED 4 /* Traced child has trapped */
|
||||
#define CLD_STOPPED 5 /* Child has stopped */
|
||||
#define CLD_CONTINUED 6 /* Stopped child has continued */
|
||||
|
||||
/* SIGPOLL */
|
||||
#define POLL_IN 1 /* Data input available */
|
||||
#define POLL_OUT 2 /* Output buffers available */
|
||||
#define POLL_MSG 3 /* Input message available */
|
||||
#define POLL_ERR 4 /* I/O Error */
|
||||
#define POLL_PRI 5 /* High priority input available */
|
||||
#define POLL_HUP 6 /* Device disconnected */
|
||||
|
||||
|
||||
/** si_code */
|
||||
#define SI_USER 0 /* Sent by kill(2) */
|
||||
#define SI_QUEUE -1 /* Sent by the sigqueue(2) */
|
||||
#define SI_TIMER -2 /* Generated by expiration of a timer */
|
||||
/* set by timer_settime(2) */
|
||||
#define SI_ASYNCIO -3 /* Generated by completion of an */
|
||||
/* asynchronous I/O signal */
|
||||
#define SI_MESGQ -4 /* Generated by arrival of a message on */
|
||||
/* an empty message queue */
|
||||
#if defined(_KERNEL) || defined(_NETBSD_SOURCE)
|
||||
#define SI_LWP -5 /* Generated by _lwp_kill(2) */
|
||||
#define SI_NOINFO 32767 /* No signal specific info available */
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_SIGINFO_H_ */
|
214
nbsd_include/sys/signal.h
Normal file
214
nbsd_include/sys/signal.h
Normal file
|
@ -0,0 +1,214 @@
|
|||
#ifndef _SYS_SIGNAL_H_
|
||||
#define _SYS_SIGNAL_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/sigtypes.h>
|
||||
|
||||
#define _NSIG 26
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define NSIG _NSIG
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
|
||||
/* Regular signals. */
|
||||
#define SIGHUP 1 /* hangup */
|
||||
#define SIGINT 2 /* interrupt (DEL) */
|
||||
#define SIGQUIT 3 /* quit (ASCII FS) */
|
||||
#define SIGILL 4 /* illegal instruction */
|
||||
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||
#define SIGABRT 6 /* IOT instruction */
|
||||
#define SIGBUS 7 /* bus error */
|
||||
#define SIGFPE 8 /* floating point exception */
|
||||
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
|
||||
#define SIGUSR1 10 /* user defined signal # 1 */
|
||||
#define SIGSEGV 11 /* segmentation violation */
|
||||
#define SIGUSR2 12 /* user defined signal # 2 */
|
||||
#define SIGPIPE 13 /* write on a pipe with no one to read it */
|
||||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
#define SIGEMT 16 /* EMT instruction */
|
||||
#define SIGCHLD 17 /* child process terminated or stopped */
|
||||
#define SIGWINCH 21 /* window size has changed */
|
||||
#define SIGVTALRM 24 /* virtual alarm */
|
||||
#define SIGPROF 25 /* profiler alarm */
|
||||
|
||||
/* POSIX requires the following signals to be defined, even if they are
|
||||
* not supported. Here are the definitions, but they are not supported.
|
||||
*/
|
||||
#define SIGCONT 18 /* continue if stopped */
|
||||
#define SIGSTOP 19 /* stop signal */
|
||||
#define SIGTSTP 20 /* interactive stop signal */
|
||||
#define SIGTTIN 22 /* background process wants to read */
|
||||
#define SIGTTOU 23 /* background process wants to write */
|
||||
|
||||
#define _NSIG 26 /* highest signal number plus one */
|
||||
#define NSIG _NSIG
|
||||
|
||||
#ifdef _MINIX
|
||||
#define SIGIOT SIGABRT /* for people who speak PDP-11 */
|
||||
|
||||
/* MINIX specific signals. These signals are not used by user proceses,
|
||||
* but meant to inform system processes, like the PM, about system events.
|
||||
* The order here determines the order signals are processed by system
|
||||
* processes in user-space. Higher-priority signals should be first.
|
||||
*/
|
||||
/* Signals delivered by a signal manager. */
|
||||
#define SIGSNDELAY 26 /* end of delay for signal delivery */
|
||||
|
||||
#define SIGS_FIRST SIGHUP /* first system signal */
|
||||
#define SIGS_LAST SIGSNDELAY /* last system signal */
|
||||
#define IS_SIGS(signo) (signo>=SIGS_FIRST && signo<=SIGS_LAST)
|
||||
|
||||
/* Signals delivered by the kernel. */
|
||||
#define SIGKMEM 27 /* kernel memory request pending */
|
||||
#define SIGKMESS 28 /* new kernel message */
|
||||
#define SIGKSIGSM 29 /* kernel signal pending for signal manager */
|
||||
#define SIGKSIG 30 /* kernel signal pending */
|
||||
|
||||
#define SIGK_FIRST SIGKMEM /* first kernel signal */
|
||||
#define SIGK_LAST SIGKSIG /* last kernel signal */
|
||||
#define IS_SIGK(signo) (signo>=SIGK_FIRST && signo<=SIGK_LAST)
|
||||
|
||||
/* Termination signals for Minix system processes. */
|
||||
#define SIGS_IS_LETHAL(sig) \
|
||||
(sig == SIGILL || sig == SIGBUS || sig == SIGFPE || sig == SIGSEGV \
|
||||
|| sig == SIGEMT || sig == SIGABRT)
|
||||
#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
|
||||
|| (sig == SIGKILL || sig == SIGPIPE))
|
||||
#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
|
||||
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
typedef void (*__sighandler_t)(int);
|
||||
|
||||
/* Macros used as function pointers. */
|
||||
#define SIG_ERR ((__sighandler_t) -1) /* error return */
|
||||
#define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
|
||||
#define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
|
||||
#define SIG_HOLD ((__sighandler_t) 2) /* block signal */
|
||||
#define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#include <sys/siginfo.h>
|
||||
#endif
|
||||
|
||||
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
#include <sys/ucontext.h>
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
|
||||
|
||||
/*
|
||||
* Signal vector "template" used in sigaction call.
|
||||
*/
|
||||
struct sigaction {
|
||||
union {
|
||||
void (*_sa_handler)(int);
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
void (*_sa_sigaction)(int, siginfo_t *, void *);
|
||||
#endif
|
||||
} _sa_u; /* signal handler */
|
||||
sigset_t sa_mask; /* signal mask to apply */
|
||||
int sa_flags; /* see signal options below */
|
||||
};
|
||||
|
||||
#define sa_handler _sa_u._sa_handler
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#define sa_sigaction _sa_u._sa_sigaction
|
||||
#endif
|
||||
|
||||
#include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */
|
||||
|
||||
/* Fields for sa_flags. */
|
||||
#define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
|
||||
#define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
|
||||
#define SA_NODEFER 0x0004 /* don't block signal while catching it */
|
||||
#define SA_RESTART 0x0008 /* automatic system call restart */
|
||||
#define SA_SIGINFO 0x0010 /* extended signal handling */
|
||||
#define SA_NOCLDWAIT 0x0020 /* don't create zombies */
|
||||
#define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
|
||||
|
||||
/* POSIX requires these values for use with sigprocmask(2). */
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
#define SIG_SETMASK 2 /* for setting the signal mask */
|
||||
#define SIG_INQUIRE 4 /* for internal use only */
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
typedef void (*sig_t)(int); /* type of signal function */
|
||||
#endif
|
||||
|
||||
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Flags used with stack_t/struct sigaltstack.
|
||||
*/
|
||||
#define SS_ONSTACK 1 /* Process is executing on an alternate stack */
|
||||
#define SS_DISABLE 2 /* Alternate stack is disabled */
|
||||
|
||||
#define MINSIGSTKSZ 2048 /* Minimal stack size is 2k */
|
||||
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
|
||||
|
||||
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Structure used in sigstack call.
|
||||
*/
|
||||
struct sigstack {
|
||||
void *ss_sp; /* signal stack pointer */
|
||||
int ss_onstack; /* current status */
|
||||
};
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
|
||||
|
||||
#if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
|
||||
/*
|
||||
* Macro for converting signal number to a mask suitable for
|
||||
* sigblock().
|
||||
*/
|
||||
#define sigmask(n) __sigmask(n)
|
||||
|
||||
#define BADSIG SIG_ERR
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
struct sigevent {
|
||||
int sigev_notify;
|
||||
int sigev_signo;
|
||||
union sigval sigev_value;
|
||||
void (*sigev_notify_function)(union sigval);
|
||||
void /* pthread_attr_t */ *sigev_notify_attributes;
|
||||
};
|
||||
|
||||
#define SIGEV_NONE 0
|
||||
#define SIGEV_SIGNAL 1
|
||||
#define SIGEV_THREAD 2
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define SIGEV_SA 3
|
||||
#endif
|
||||
#endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
|
||||
|
||||
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
|
||||
/*
|
||||
* For historical reasons; programs expect signal's return value to be
|
||||
* defined by <sys/signal.h>.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
void (*signal(int, void (*)(int)))(int);
|
||||
__END_DECLS
|
||||
#endif /* !_SYS_SIGNAL_H_ */
|
||||
|
||||
|
||||
|
||||
|
68
nbsd_include/sys/sigtypes.h
Normal file
68
nbsd_include/sys/sigtypes.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef _SYS_SIGTYPES_H_
|
||||
#define _SYS_SIGTYPES_H_
|
||||
|
||||
/*
|
||||
* This header file defines various signal-related types. We also keep
|
||||
* the macros to manipulate sigset_t here, to encapsulate knowledge of
|
||||
* its internals.
|
||||
*/
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <machine/int_types.h>
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#ifdef _BSD_SIZE_T_
|
||||
typedef _BSD_SIZE_T_ size_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
typedef unsigned long sigset_t;
|
||||
|
||||
/*
|
||||
* Macro for manipulating signal masks.
|
||||
*/
|
||||
#define __sigmask(n) (1 << (((unsigned int)(n) - 1)))
|
||||
#define __sigaddset(s, n) \
|
||||
do { \
|
||||
*(s) = *(unsigned long *)(s) | __sigmask(n); \
|
||||
} while(0)
|
||||
#define __sigdelset(s, n) \
|
||||
do { \
|
||||
*(s) = *(unsigned long *)(s) & ~__sigmask(n); \
|
||||
} while (0)
|
||||
|
||||
#define __sigismember(s, n) (((*(const unsigned long *)(s)) & __sigmask(n)) != 0)
|
||||
#define __sigemptyset(s) (*(unsigned long *)(s) = 0)
|
||||
#define __sigsetequal(s1, s2) (*(unsigned long *)(s1) = *(unsigned long *)(s2))
|
||||
#define __sigfillset(s) (*(long *)(s) = -1L)
|
||||
#define __sigplusset(s, t) \
|
||||
do { \
|
||||
*(t) = *(unsigned long *)(t) | *(unsigned long *)(s); \
|
||||
} while (0)
|
||||
#define __sigminusset(s, t) \
|
||||
do { \
|
||||
*(t) = *(unsigned long *)(t) & ~*(unsigned long *)(s); \
|
||||
} while (0)
|
||||
#define __sigandset(s, t) \
|
||||
do { \
|
||||
*(t) = *(unsigned long *)(t) & *(unsigned long *)(s); \
|
||||
} while (0)
|
||||
|
||||
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
typedef struct
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
sigaltstack
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
{
|
||||
void *ss_sp; /* signal stack base */
|
||||
size_t ss_size; /* signal stack length */
|
||||
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
|
||||
} stack_t;
|
||||
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
|
||||
|
||||
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */
|
||||
#endif /* !_SYS_SIGTYPES_H_ */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue