Full switch to clang/ELF. Drop ack. Simplify.

There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
This commit is contained in:
Ben Gras
2012-02-11 19:31:25 +01:00
parent 2487445f5f
commit 2fe8fb192f
5056 changed files with 16216 additions and 133169 deletions

View File

@@ -1,32 +1,98 @@
# $NetBSD: Makefile,v 1.133 2010/07/31 21:47:53 joerg Exp $
# @(#)Makefile 8.2 (Berkeley) 1/4/94
# Doing a make includes builds /usr/include
INCS= alloca.h a.out.h ar.h assert.h configfile.h ctype.h \
dirent.h env.h err.h errno.h fcntl.h fenv.h \
float.h fnmatch.h fts.h getopt.h glob.h grp.h ifaddrs.h \
inttypes.h libgen.h libutil.h limits.h locale.h \
mathconst.h math.h midiparser.h netdb.h pwd.h regex.h \
regexp.h setjmp.h sgtty.h signal.h stdarg.h stddef.h \
stdint.h stdbool.h stdio.h stdlib.h string.h strings.h sysexits.h \
syslog.h tar.h termcap.h time.h timers.h tools.h \
ttyent.h ucontext.h unistd.h utime.h utmp.h wchar.h wctype.h \
tzfile.h util.h fetch.h mpool.h ndbm.h db.h poll.h resolv.h \
memory.h paths.h complex.h
INCS+= arpa/inet.h arpa/nameser.h
INCS+= minix/a.out.h minix/cdrom.h minix/compiler-ack.h minix/dirent.h \
minix/dl_eth.h minix/md5.h minix/sha1.h minix/sha2.h minix/types.h
INCS+= net/hton.h net/if.h net/ioctl.h net/netlib.h
INCS+= net/gen/netdb.h net/gen/resolv.h net/gen/nameser.h
INCS+= netinet/if_ether.h netinet/in.h netinet/tcp.h
NOOBJ= # defined
# Missing: mp.h
.if defined(__MINIX)
# Avoid installing: kvm.h lwp.h sa.h (latter not installed anyway)
INCS= a.out.h aio.h ar.h assert.h atomic.h \
bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
inttypes.h iso646.h langinfo.h libgen.h \
limits.h link.h link_aout.h link_elf.h locale.h \
login_cap.h malloc.h math.h md2.h \
memory.h mntopts.h monetary.h mpool.h mqueue.h \
ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
strings.h stringlist.h struct.h sysexits.h tar.h time.h \
ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
INCS += ufs/chfs/chfs.h ufs/chfs/chfs_args.h ufs/chfs/chfs_inode.h \
ufs/chfs/chfs_pool.h ufs/chfs/debug.h ufs/chfs/ebh.h \
ufs/chfs/ebh_media.h ufs/chfs/ebh_misc.h ufs/chfs/media.h \
ufs/ext2fs/ext2fs.h ufs/ext2fs/ext2fs_dinode.h \
ufs/ext2fs/ext2fs_dir.h ufs/ext2fs/ext2fs_extern.h \
ufs/ffs/ffs_extern.h ufs/ffs/fs.h ufs/lfs/lfs.h \
ufs/lfs/lfs_extern.h ufs/mfs/mfs_extern.h ufs/mfs/mfsnode.h \
ufs/ufs/dinode.h ufs/ufs/dir.h ufs/ufs/dirhash.h \
ufs/ufs/extattr.h ufs/ufs/inode.h ufs/ufs/quota.h \
ufs/ufs/quota1.h ufs/ufs/quota2.h ufs/ufs/ufs_bswap.h \
ufs/ufs/ufs_extern.h ufs/ufs/ufs_quota.h ufs/ufs/ufs_wapbl.h \
ufs/ufs/ufsmount.h \
.else
INCS= a.out.h aio.h ar.h assert.h atomic.h \
bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
inttypes.h iso646.h kvm.h langinfo.h libgen.h \
limits.h link.h link_aout.h link_elf.h locale.h \
login_cap.h lwp.h malloc.h math.h md2.h \
memory.h mntopts.h monetary.h mpool.h mqueue.h \
ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
strings.h stringlist.h struct.h sysexits.h tar.h time.h \
ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
.endif
INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
arpa/telnet.h arpa/tftp.h
INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
protocols/talkd.h protocols/timed.h
INCS+= hesiod.h
INCS+= rpcsvc/yp_prot.h rpcsvc/ypclnt.h
INCS+= ssp/ssp.h ssp/stdio.h ssp/string.h ssp/strings.h ssp/unistd.h
.if (${MACHINE_ARCH} != "vax")
INCS+= ieeefp.h
.endif
.include <bsd.own.mk>
INCSDIR= /usr/include.ack
.include "${MINIXSRCDIR}/common/include/Makefile.inc"
.include "${MINIXSRCDIR}/common/include/Makefile.termios.inc"
INCSDIR= /usr/include
SUBDIR= sys arch
.if defined(__MINIX)
# RPC is not compiled in the libc. This include also needs
# rpcgen, which can be compiled if needed.
.else
SUBDIR= rpc
.endif
.if defined(__MINIX)
SUBDIR+= prop
.else
SUBDIR+= ../common/include/prop
.endif
.if defined(__MINIX)
.include "Makefile.minix.inc"
SUBDIR+= arch/${MACHINE}
SUBDIR+= arch sys minix
SUBDIR+= net netinet netinet6
.endif
.include <bsd.prog.mk>
.include <bsd.subdir.mk>

View File

@@ -0,0 +1,38 @@
.include <bsd.own.mk>
INCS+= env.h fetch.h lib.h libutil.h timers.h
INCS+= minix/acpi.h minix/ansi.h minix/audio_fw.h minix/bitmap.h \
minix/bdev.h minix/blockdriver.h minix/blockdriver_mt.h \
minix/btrace.h \
minix/callnr.h minix/chardriver.h minix/com.h minix/compiler.h \
minix/config.h minix/const.h minix/cpufeature.h minix/crtso.h \
minix/debug.h minix/devio.h minix/devman.h minix/dmap.h \
minix/driver.h minix/drivers.h minix/drvlib.h minix/ds.h \
minix/endpoint.h minix/fslib.h minix/gcov.h minix/hash.h \
minix/hgfs.h minix/ioctl.h minix/input.h minix/ipc.h minix/ipcconst.h \
minix/keymap.h minix/limits.h minix/mthread.h minix/minlib.h \
minix/netdriver.h minix/optset.h minix/partition.h minix/portio.h \
minix/priv.h minix/procfs.h minix/profile.h minix/queryparam.h \
minix/rs.h minix/safecopies.h minix/sched.h minix/sef.h \
minix/sound.h minix/spin.h minix/sys_config.h minix/sysinfo.h \
minix/syslib.h minix/sysutil.h minix/timers.h minix/type.h \
minix/tty.h minix/u64.h minix/usb.h minix/usb_ch9.h minix/vm.h \
minix/vfsif.h minix/vtreefs.h minix/libminixfs.h
INCS+= net/gen/arp_io.h net/gen/dhcp.h net/gen/ether.h \
net/gen/eth_hdr.h net/gen/eth_io.h net/gen/icmp.h \
net/gen/icmp_hdr.h net/gen/if_ether.h net/gen/inet.h \
net/gen/in.h net/gen/ip_hdr.h net/gen/ip_io.h \
net/gen/oneCsum.h net/gen/psip_hdr.h net/gen/psip_io.h \
net/gen/rip.h net/gen/route.h net/gen/socket.h \
net/gen/tcp.h net/gen/tcp_hdr.h net/gen/tcp_io.h \
net/gen/udp.h net/gen/udp_hdr.h net/gen/udp_io.h \
net/gen/udp_io_hdr.h net/gen/vjhc.h
INCS+= ddekit/assert.h ddekit/initcall.h ddekit/memory.h ddekit/pgtab.h \
ddekit/thread.h ddekit/attribs.h ddekit/inline.h ddekit/printf.h \
ddekit/timer.h ddekit/condvar.h ddekit/interrupt.h ddekit/panic.h \
ddekit/resources.h ddekit/types.h ddekit/debug.h ddekit/lock.h \
ddekit/pci.h ddekit/semaphore.h ddekit/usb.h ddekit/minix/pci.h \
ddekit/minix/msg_queue.h ddekit/ddekit.h

View File

@@ -1,11 +1,73 @@
/*
* this files resolves conflicts between the file of the host system and
* the minix specific one. This file is included directly only on Minix
* and it is an error to do so on any other system
/* $NetBSD: a.out.h,v 1.20 2009/08/16 17:12:47 pgoyette 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.
*
* @(#)a.out.h 8.1 (Berkeley) 6/2/93
*/
#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#error "Including Minix specific file in program targeted for other system"
#else
#include <minix/a.out.h>
#endif
/*-
* Copyright (c) 1993 Theo de Raadt. 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, PROUREMENT 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.
*
* @(#)a.out.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _AOUT_H_
#define _AOUT_H_
#ifdef __minix
#include <compat/a.out.h>
#else /* !__minix */
#include <sys/exec_aout.h>
#define _AOUT_INCLUDE_
#include <nlist.h>
#endif /* !__minix */
#endif /* !_AOUT_H_ */

56
include/aio.h Normal file
View File

@@ -0,0 +1,56 @@
/* $NetBSD: aio.h,v 1.7 2009/01/13 15:11:09 christos Exp $ */
/*
* Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD 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 _AIO_H_
#define _AIO_H_
#include <fcntl.h>
#include <signal.h>
#include <time.h>
#include <sys/cdefs.h>
#include <sys/signal.h>
#include <sys/aio.h>
__BEGIN_DECLS
int aio_cancel(int, struct aiocb *);
int aio_error(const struct aiocb *);
int aio_fsync(int, struct aiocb *);
int aio_read(struct aiocb *);
ssize_t aio_return(struct aiocb *);
#ifndef __LIBC12_SOURCE__
int aio_suspend(const struct aiocb * const [], int,
const struct timespec *) __RENAME(__aio_suspend50);
#endif
int aio_write(struct aiocb *);
int lio_listio(int, struct aiocb * const * __restrict,
int, struct sigevent * __restrict);
__END_DECLS
#endif /* _AIO_H_ */

View File

@@ -1,24 +0,0 @@
/* alloca.h - The dreaded alloca() function.
*/
#ifndef _ALLOCA_H
#define _ALLOCA_H
#ifndef _TYPES_H
#include <minix/types.h>
#endif
#if __GNUC__
/* The compiler recognizes this special keyword, and inlines the code. */
#define alloca(size) __builtin_alloca(size)
#endif /* __GCC__ */
#if __ACK__ || __CCC__
_PROTOTYPE(void *alloca, (size_t _size) );
#endif /* __ACK__ || __CCC__ */
#endif /* _ALLOCA_H */

View File

@@ -1,7 +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= ${ARCH}
SUBDIR= ${MACHINE}
ARCHSUBDIR= ${MACHINE_CPU}
INCSYMLINKS= ${MACHINE} /usr/include.ack/machine
.if ${ARCHSUBDIR} == "mips64"
ARCHSUBDIR= mips
.endif
.if ${ARCHSUBDIR} == "powerpc64"
ARCHSUBDIR= powerpc
.endif
.include <bsd.kinc.mk>
.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/include/machine
INCSYMLINKS+= machine/float.h /usr/include/float.h \
machine/stdarg.h /usr/include/stdarg.h
.include <bsd.inc.mk>

View File

@@ -1,7 +1,6 @@
INCSDIR= /usr/include.ack/i386
# $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
INCS+= _align.h asm.h mcontext.h multiboot.h param.h
.include "../../../common/include/arch/i386/Makefile.inc"
SUBDIR= include ../x86/include
.include <bsd.kinc.mk>
.include <bsd.subdir.mk>

View File

@@ -0,0 +1,16 @@
# $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $
.include <bsd.own.mk>
INCSDIR= /usr/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>

View 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_ */

View 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_ */

View 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_ */

View 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_ */

View File

@@ -0,0 +1,16 @@
/* $NetBSD: cdefs.h,v 1.7 2008/10/26 06:57:30 mrg Exp $ */
#ifndef _I386_CDEFS_H_
#define _I386_CDEFS_H_
#ifdef __minix
#ifndef __ELF__
#define __LEADING_UNDERSCORE
#endif
#else /* !__minix */
/* No arch-specific cdefs. */
#endif
#endif /* !_I386_CDEFS_H_ */

View 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_ */

View File

@@ -0,0 +1,3 @@
/* $NetBSD: endian.h,v 1.29 2000/03/17 00:09:20 mycroft Exp $ */
#include <sys/endian.h>

View 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

View 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_ */

View File

@@ -0,0 +1,3 @@
/* $NetBSD: float.h,v 1.12 2003/02/26 21:29:00 fvdl Exp $ */
#include <x86/float.h>

View File

@@ -0,0 +1,3 @@
/* $NetBSD: ieee.h,v 1.2 2003/02/26 21:29:01 fvdl Exp $ */
#include <x86/ieee.h>

View File

@@ -0,0 +1,3 @@
/* $NetBSD: ieeefp.h,v 1.3 2003/02/26 21:29:01 fvdl Exp $ */
#include <x86/ieeefp.h>

View 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_ */

View 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_ */

View 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_ */

View 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_ */

View File

@@ -1,10 +1,9 @@
/* $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.
*
* 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:
@@ -29,45 +28,41 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)asm.h 5.5 (Berkeley) 5/7/91
* from: @(#)types.h 7.5 (Berkeley) 3/9/91
*/
#ifndef _I386_ASM_H_
#define _I386_ASM_H_
#ifndef _I386_INT_TYPES_H_
#define _I386_INT_TYPES_H_
#ifdef __ELF__
# define _C_LABEL(x) x
#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
# ifdef __STDC__
# define _C_LABEL(x) _ ## x
# else
# define _C_LABEL(x) _/**/x
# endif
#endif
#define _ASM_LABEL(x) x
/* allow overriding entrypoint alignment */
#if !defined(_ALIGN_TEXT)
# define _ALIGN_TEXT .balign 16
/* LONGLONG */
typedef long long int __int64_t;
/* LONGLONG */
typedef unsigned long long int __uint64_t;
#endif
#ifdef __ACK__
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; x:
#else
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
#endif
#define _LABEL(x) \
.globl x; x:
#define __BIT_TYPES_DEFINED__
#define ENTRY(y) _ENTRY(_C_LABEL(y))
#define NENTRY(y) _ENTRY(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y))
#define LABEL(y) _LABEL(_C_LABEL(y))
#define END(y) .size y, . - y
/* 7.18.1.4 Integer types capable of holding object pointers */
#define IMPORT(sym) \
.extern _C_LABEL(sym)
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
#endif /* !_I386_ASM_H_ */
#endif /* !_I386_INT_TYPES_H_ */

View 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_ */

View File

@@ -0,0 +1,3 @@
/* $NetBSD: math.h,v 1.5 2003/10/22 11:54:23 kleink Exp $ */
#include <x86/math.h>

View File

@@ -10,14 +10,13 @@
typedef struct __mcontext {
int mc_magic;
struct stackframe_s mc_p_reg;
#if (_MINIX_CHIP == _CHIP_INTEL)
union fpu_state_u mc_fpu_state;
#endif
short mc_fpu_flags;
} mcontext_t;
_PROTOTYPE( int setmcontext, (const mcontext_t *mcp) );
_PROTOTYPE( int getmcontext, (mcontext_t *mcp) );
__BEGIN_DECLS
int setmcontext(const mcontext_t *mcp);
int getmcontext(mcontext_t *mcp);
__END_DECLS
#endif /* _MACHINE_MCONTEXT_H */

View 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_ */

View File

@@ -1,3 +1,5 @@
/* $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.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* 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.
*
@@ -29,14 +31,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
* $FreeBSD$
* @(#)param.h 5.8 (Berkeley) 6/28/91
*/
#include <machine/_align.h>
#ifndef _I386_INCLUDE_PARAM_H_
#define _I386_INCLUDE_PARAM_H_
#ifndef _I386_PARAM_H_
#define _I386_PARAM_H_
/*
* Machine dependent constants for Intel 386.
@@ -44,67 +43,52 @@
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is unsigned int
* and must be cast to any desired pointer type.
*/
#ifndef _ALIGNBYTES
#define _ALIGNBYTES (sizeof(int) - 1)
#endif
#ifndef _ALIGN
#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#endif
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
/*
* 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).
* (within reasonable limits).
*
*/
#define ALIGNED_POINTER(p, t) 1
#define ALIGNBYTES (sizeof(int) - 1)
#define ALIGN(p) (((u_int)(u_long)(p) + ALIGNBYTES) &~ \
ALIGNBYTES)
#define ALIGNED_POINTER(p,t) 1
#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
#define PAGE_MASK (PAGE_SIZE-1)
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
#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)))
#ifdef PAE
#define NPGPTD 4
#define PDRSHIFT 21 /* LOG2(NBPDR) */
#define NPGPTD_SHIFT 9
#else
#define NPGPTD 1
#define PDRSHIFT 22 /* LOG2(NBPDR) */
#define NPGPTD_SHIFT 10
#ifndef MAXPHYS
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
#endif
#define NBPTD (NPGPTD<<PAGE_SHIFT)
#define NPDEPTD (NBPTD/(sizeof (pd_entry_t)))
#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
#define PDRMASK (NBPDR-1)
#define MAXPAGESIZES 2 /* maximum number of supported page sizes */
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define DEV_BSIZE (1 << DEV_BSHIFT)
/*
* Mach derived conversion macros
*/
#define trunc_page(x) ((x) & ~PAGE_MASK)
#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK)
#define trunc_4mpage(x) ((x) & ~PDRMASK)
#define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK)
#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)
#define atop(x) ((x) >> PAGE_SHIFT)
#define ptoa(x) ((x) << PAGE_SHIFT)
#ifdef __minix
/* Minix expect to find in this file PAGE_* defines. */
#include <machine/vmparam.h>
#define i386_btop(x) ((x) >> PAGE_SHIFT)
#define i386_ptob(x) ((x) << PAGE_SHIFT)
#define trunc_page(x) x86_trunc_page(x)
#define round_page(x) x86_round_page(x)
#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
#endif
#define trunc_page_ps(va, ps) ((va) & ~(ps - 1))
#define round_page_ps(va, ps) (((va) + (ps - 1)) & ~(ps - 1))
#define _minix_aligned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a))
#endif /* !_I386_INCLUDE_PARAM_H_ */
#endif /* _I386_PARAM_H_ */

View 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 */

View 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 */

View File

@@ -1,58 +1,38 @@
#ifndef _SIGCONTEXT_H
#define _SIGCONTEXT_H
#ifndef _I386_SIGNAL_H_
#define _I386_SIGNAL_H_
/* The sigcontext structure is used by the sigreturn(2) system call.
* sigreturn() is seldom called by user programs, but it is used internally
* by the signal catching mechanism.
*/
#include <sys/featuretest.h>
#ifndef _MINIX_ANSI_H
#include <minix/ansi.h>
#endif
#ifndef _MINIX_SYS_CONFIG_H
#include <minix/sys_config.h>
#endif
#if !defined(_MINIX_CHIP)
#include "error, configuration is not known"
#endif
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.
*/
#if (_MINIX_CHIP == _CHIP_INTEL)
#include <machine/stackframe.h>
#include <machine/fpu.h>
typedef struct stackframe_s sigregs;
struct sigframe { /* stack frame created for signalled process */
_PROTOTYPE( void (*sf_retadr), (void) );
void (*sf_retadr)(void);
int sf_signo;
int sf_code;
struct sigcontext *sf_scp;
int sf_fp;
_PROTOTYPE( void (*sf_retadr2), (void) );
void (*sf_retadr2)(void);
struct sigcontext *sf_scpcopy;
};
#else
#include "error, _MINIX_CHIP is not supported"
#endif /* _MINIX_CHIP == _CHIP_INTEL */
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 */
#if (_MINIX_CHIP == _CHIP_INTEL)
union fpu_state_u sc_fpu_state;
#endif
};
#if (_MINIX_CHIP == _CHIP_INTEL)
#if _WORD_SIZE == 4
#define sc_gs sc_regs.gs
#define sc_fs sc_regs.fs
@@ -74,8 +54,11 @@ struct sigcontext {
#define sc_psw sc_regs.psw
#define sc_sp sc_regs.sp
#define sc_ss sc_regs.ss
#endif /* _MINIX_CHIP == _CHIP_INTEL */
_PROTOTYPE( int sigreturn, (struct sigcontext *_scp) );
#ifdef _MINIX
__BEGIN_DECLS
int sigreturn(struct sigcontext *_scp);
__END_DECLS
#endif /* _MINIX */
#endif /* _SIGCONTEXT_H */
#endif /* !_I386_SIGNAL_H_ */

View 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_ */

View 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_ */

View File

@@ -1,3 +1,5 @@
/* $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.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* 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.
*
@@ -29,19 +31,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
* $FreeBSD$
* @(#)vmparam.h 5.9 (Berkeley) 5/12/91
*/
#ifndef _I386_INCLUDE__ALIGN_H_
#define _I386_INCLUDE__ALIGN_H_
#ifndef _I386_VMPARAM_H_
#define _I386_VMPARAM_H_
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is unsigned int
* and must be cast to any desired pointer type.
* Machine dependent constants for 386.
*/
#define _ALIGNBYTES (sizeof(int) - 1)
#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#endif /* !_I386_INCLUDE__ALIGN_H_ */
/*
* 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_ */

View 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_ */

View File

@@ -0,0 +1,11 @@
# $NetBSD: Makefile,v 1.13 2008/05/11 15:32:20 ad Exp $
INCSDIR=/usr/include/x86
INCS= float.h \
ieee.h \
ieeefp.h \
math.h \
mutex.h
.include <bsd.kinc.mk>

View 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_ */

View 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)

View 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_ */

View 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

View File

@@ -0,0 +1,80 @@
/* $NetBSD: mutex.h,v 1.6 2009/04/24 17:49:51 ad Exp $ */
/*-
* Copyright (c) 2002, 2006, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe and 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.
*/
#ifndef _X86_MUTEX_H_
#define _X86_MUTEX_H_
struct kmutex {
union {
volatile uintptr_t mtxa_owner;
#ifdef __MUTEX_PRIVATE
struct {
volatile uint8_t mtxs_dummy;
ipl_cookie_t mtxs_ipl;
__cpu_simple_lock_t mtxs_lock;
volatile uint8_t mtxs_unused;
} s;
#endif
} u;
};
#ifdef __MUTEX_PRIVATE
#define mtx_owner u.mtxa_owner
#define mtx_ipl u.s.mtxs_ipl
#define mtx_lock u.s.mtxs_lock
#define __HAVE_MUTEX_STUBS 1
#define __HAVE_SPIN_MUTEX_STUBS 1
#define __HAVE_SIMPLE_MUTEXES 1
/*
* MUTEX_RECEIVE: technically, no memory barrier is required
* as 'ret' implies a load fence. However we need this to
* handle a bug with some Opteron revisions. See patch.c,
* lock_stubs.S.
*/
#define MUTEX_RECEIVE(mtx) membar_consumer()
/*
* MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it.
*/
#define MUTEX_GIVE(mtx) /* nothing */
#define MUTEX_CAS(p, o, n) \
(_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
unsigned long _atomic_cas_ulong(volatile unsigned long *,
unsigned long, unsigned long);
#endif /* __MUTEX_PRIVATE */
#endif /* _X86_MUTEX_H_ */

107
include/arpa/ftp.h Normal file
View File

@@ -0,0 +1,107 @@
/* $NetBSD: ftp.h,v 1.6 2003/08/07 09:44:12 agc Exp $ */
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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.
*
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_FTP_H_
#define _ARPA_FTP_H_
/* Definitions for FTP; see RFC-765. */
/*
* Reply codes.
*/
#define PRELIM 1 /* positive preliminary */
#define COMPLETE 2 /* positive completion */
#define CONTINUE 3 /* positive intermediate */
#define TRANSIENT 4 /* transient negative completion */
#define ERROR 5 /* permanent negative completion */
/*
* Type codes
*/
#define TYPE_A 1 /* ASCII */
#define TYPE_E 2 /* EBCDIC */
#define TYPE_I 3 /* image */
#define TYPE_L 4 /* local byte size */
#ifdef FTP_NAMES
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
#endif
/*
* Form codes
*/
#define FORM_N 1 /* non-print */
#define FORM_T 2 /* telnet format effectors */
#define FORM_C 3 /* carriage control (ASA) */
#ifdef FTP_NAMES
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
#endif
/*
* Structure codes
*/
#define STRU_F 1 /* file (no record structure) */
#define STRU_R 2 /* record structure */
#define STRU_P 3 /* page structure */
#ifdef FTP_NAMES
char *strunames[] = {"0", "File", "Record", "Page" };
#endif
/*
* Mode types
*/
#define MODE_S 1 /* stream */
#define MODE_B 2 /* block */
#define MODE_C 3 /* compressed */
#ifdef FTP_NAMES
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
#endif
/*
* Record Tokens
*/
#define REC_ESC '\377' /* Record-mode Escape */
#define REC_EOR '\001' /* Record-mode End-of-Record */
#define REC_EOF '\002' /* Record-mode End-of-File */
/*
* Block Header
*/
#define BLK_EOR 0x80 /* Block is End-of-Record */
#define BLK_EOF 0x40 /* Block is End-of-File */
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
#define BLK_RESTART 0x10 /* Block is Restart Marker */
#define BLK_BYTECOUNT 2 /* Bytes in this block */
#endif /* _ARPA_FTP_H_ */

View File

@@ -1,46 +1,105 @@
/* $NetBSD: inet.h,v 1.24 2008/06/21 20:12:49 christos Exp $ */
/*
arpa/inet.h
*/
* ++Copyright++ 1983, 1993
* -
* Copyright (c) 1983, 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#ifndef _ARPA__INET_H
#define _ARPA__INET_H
/*%
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
*/
#include <stdint.h>
#ifndef _ARPA_INET_H_
#define _ARPA_INET_H_
/* Open Group Base Specifications Issue 6 (not complete): */
/* External definitions for functions in inet(3) */
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
/* Has to match corresponding declaration in <netinet/in.h> */
typedef uint32_t in_addr_t;
#endif /* _IN_ADDR_T */
#include <sys/ansi.h>
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/types.h>
#ifndef _STRUCT_IN_ADDR
#define _STRUCT_IN_ADDR
/* Has to match corresponding declaration in <netinet/in.h> */
struct in_addr
{
in_addr_t s_addr;
};
#include <netinet/in.h>
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
defined(_NETBSD_SOURCE)
#ifndef socklen_t
typedef __socklen_t socklen_t;
#define socklen_t __socklen_t
#endif
#endif /* _POSIX_C_SOURCE >= 200112 || XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
_PROTOTYPE( uint32_t htonl, (uint32_t _hostval) );
_PROTOTYPE( uint16_t htons, (uint16_t _hostval) );
_PROTOTYPE( char *inet_ntoa, (struct in_addr _in) );
_PROTOTYPE( uint32_t ntohl, (uint32_t _netval) );
_PROTOTYPE( uint16_t ntohs, (uint16_t _netval) );
_PROTOTYPE( char *inet_ntop, (int af, const void *src, char *dst,
uint32_t size) );
_PROTOTYPE( int inet_pton, (int af, const char *src, void *dst) );
#ifdef _MINIX
/* Additional functions */
_PROTOTYPE( int inet_aton, (const char *_cp, struct in_addr *_pin) );
__BEGIN_DECLS
in_addr_t inet_addr(const char *);
in_addr_t inet_lnaof(struct in_addr);
struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
in_addr_t inet_netof(struct in_addr);
in_addr_t inet_network(const char *);
char *inet_ntoa(struct in_addr);
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
defined(_NETBSD_SOURCE)
const char *inet_ntop(int, const void * __restrict,
char * __restrict, socklen_t);
int inet_pton(int, const char * __restrict,
void * __restrict);
#endif
#ifdef _POSIX_SOURCE
in_addr_t inet_addr(const char *cp);
#if defined(_NETBSD_SOURCE)
int inet_aton(const char *, struct in_addr *);
char * inet_neta(u_long, char *, size_t);
char *inet_net_ntop(int, const void *, int, char *, size_t);
int inet_net_pton(int, const char *, void *, size_t);
char *inet_cidr_ntop(int, const void *, int, char *, size_t);
int inet_cidr_pton(int, const char *, void *, int *);
u_int inet_nsap_addr(const char *, u_char *, int);
char *inet_nsap_ntoa(int, const u_char *, char *);
#endif
__END_DECLS
#endif /* _ARPA__INET_H */
#endif /* _ARPA_INET_H_ */

View File

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

View File

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

354
include/arpa/telnet.h Normal file
View File

@@ -0,0 +1,354 @@
/* $NetBSD: telnet.h,v 1.12 2006/01/24 17:13:59 christos Exp $ */
/*
* Copyright (c) 1983, 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.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
#ifndef _ARPA_TELNET_H_
#define _ARPA_TELNET_H_
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
const char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0
};
#else
extern const char *telcmds[];
#endif
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
/* telnet options */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_TN3270E 40 /* RFC2355 - TN3270 Enhancements */
#define TELOPT_CHARSET 42 /* RFC2066 - Charset */
#define TELOPT_COMPORT 44 /* RFC2217 - Com Port Control */
#define TELOPT_KERMIT 47 /* RFC2840 - Kermit */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_KERMIT
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#define NTELOPTS (1+TELOPT_LAST)
#ifdef TELOPTS
const char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON", "TN3270E", "CHARSET", "COM-PORT",
"KERMIT",
0
};
#else
extern const char *telopts[NTELOPTS+1];
#endif
/* sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define SLC_MCL 19
#define SLC_MCR 20
#define SLC_MCWL 21
#define SLC_MCWR 22
#define SLC_MCBOL 23
#define SLC_MCEOL 24
#define SLC_INSRT 25
#define SLC_OVER 26
#define SLC_ECR 27
#define SLC_EWR 28
#define SLC_EBOL 29
#define SLC_EEOL 30
#define NSLC 30
/*
* For backwards compatibility, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
"MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
"MCEOL", "INSRT", "OVER", "ECR", "EWR", \
"EBOL", "EEOL", \
0
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
/*
* AUTHENTICATION suboptions
*/
/*
* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
/*
* should we be encrypting? (not yet formally standardized)
*/
#define AUTH_ENCRYPT_OFF 0
#define AUTH_ENCRYPT_ON 4
#define AUTH_ENCRYPT_MASK 4
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_SRA 6
#define AUTHTYPE_CNT 7
#define AUTHTYPE_TEST 99
#ifdef AUTH_NAMES
const char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
0
};
#else
extern const char *authtype_names[];
#endif
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#ifdef ENCRYPT_NAMES
const char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0
};
const char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64",
0
};
#else
extern const char *encrypt_names[];
extern const char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#endif /* _ARPA_TELNET_H_ */

84
include/arpa/tftp.h Normal file
View File

@@ -0,0 +1,84 @@
/* $NetBSD: tftp.h,v 1.8 2003/08/07 09:44:12 agc Exp $ */
/*
* Copyright (c) 1983, 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.
*
* @(#)tftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_TFTP_H_
#define _ARPA_TFTP_H_
/*
* Trivial File Transfer Protocol (IEN-133)
*/
#define SEGSIZE 512 /* data segment size */
#define MAXSEGSIZE 65464 /* maximum negotiated data segment size */
#define PKTSIZE SEGSIZE + 4
#define MAXPKTSIZE MAXSEGSIZE + 4
/*
* Packet types.
*/
#define RRQ 01 /* read request */
#define WRQ 02 /* write request */
#define DATA 03 /* data packet */
#define ACK 04 /* acknowledgement */
#define ERROR 05 /* error code */
#define OACK 06 /* option acknowledgement */
struct tftphdr {
short th_opcode; /* packet type */
union {
unsigned short tu_block; /* block # */
short tu_code; /* error code */
char tu_stuff[1]; /* request packet stuff */
} th_u;
char th_data[1]; /* data or error string */
};
#define th_block th_u.tu_block
#define th_code th_u.tu_code
#define th_stuff th_u.tu_stuff
#define th_msg th_data
/*
* Error codes.
*/
#define EUNDEF 0 /* not defined */
#define ENOTFOUND 1 /* file not found */
#define EACCESS 2 /* access violation */
#define ENOSPACE 3 /* disk full or allocation exceeded */
#define EBADOP 4 /* illegal TFTP operation */
#define EBADID 5 /* unknown transfer ID */
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
#define EOPTNEG 8 /* option negotiation failed */
#endif /* _ARPA_TFTP_H_ */

View File

@@ -1,46 +1,106 @@
/* The <assert.h> header contains a macro called "assert" that allows
* programmers to put assertions in the code. These assertions can be verified
* at run time. If an assertion fails, an error message is printed and the
* program aborts.
* Assertion checking can be disabled by adding the statement
/* $NetBSD: assert.h,v 1.20 2008/11/02 14:27:44 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* #define NDEBUG
* 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.
*
* to the program before the
* 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.
*
* #include <assert.h>
*
* statement.
* @(#)assert.h 8.2 (Berkeley) 1/21/94
*/
/*
* Unlike other ANSI header files, <assert.h> may usefully be included
* multiple times, with and without NDEBUG defined.
*/
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/null.h>
#undef assert
#ifndef _MINIX_ANSI_H
#include <minix/ansi.h>
#endif
#if TIME_ASSERTS
#define _ASSERT_EVALUATE(st) do { TIME_BLOCK(st); } while(0)
#else
#define _ASSERT_EVALUATE(st) do { st } while(0)
#endif
#ifdef NDEBUG
/* Debugging disabled -- do not evaluate assertions. */
#define assert(expr) ((void) 0)
#else
/* Debugging enabled -- verify assertions at run time. */
#ifdef _ANSI
#define __makestr(x) # x
#define __xstr(x) __makestr(x)
# ifndef __lint__
# define assert(e) (__static_cast(void,0))
# else /* !__lint__ */
# define assert(e)
# endif /* __lint__ */
#else /* !NDEBUG */
# if __STDC__
# define assert(e) \
((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__, \
__assert_function__, #e))
# else /* PCC */
# define assert(e) \
((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__, \
__assert_function__, "e"))
# endif /* !__STDC__ */
#endif /* NDEBUG */
_PROTOTYPE( void __bad_assertion, (const char *_mess) );
#define assert(expr) do { int _av; \
_ASSERT_EVALUATE(_av = !!(expr);); \
if(!_av) { \
__bad_assertion("Assertion \"" #expr "\" failed, file " __xstr(__FILE__) ", line " __xstr(__LINE__) "\n"); \
} } while(0)
#undef _DIAGASSERT
#if !defined(_DIAGNOSTIC)
# if !defined(__lint__)
# define _DIAGASSERT(e) (__static_cast(void,0))
# else /* !__lint__ */
# define _DIAGASSERT(e)
# endif /* __lint__ */
#else /* _DIAGNOSTIC */
# if __STDC__
# define _DIAGASSERT(e) \
((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
__assert_function__, #e))
# else /* !__STDC__ */
# define _DIAGASSERT(e) \
((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
__assert_function__, "e"))
# endif
#endif /* _DIAGNOSTIC */
#if defined(__lint__)
#define __assert_function__ (__static_cast(const void *,0))
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __assert_function__ __func__
#elif __GNUC_PREREQ__(2, 6)
#define __assert_function__ __PRETTY_FUNCTION__
#else
#define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__, __LINE__)))
#endif /* _ANSI */
#define __assert_function__ (__static_cast(const void *,0))
#endif
#ifndef __ASSERT_DECLARED
#define __ASSERT_DECLARED
__BEGIN_DECLS
void __assert(const char *, int, const char *);
void __assert13(const char *, int, const char *, const char *);
void __diagassert(const char *, int, const char *);
void __diagassert13(const char *, int, const char *, const char *);
__END_DECLS
#endif /* __ASSERT_DECLARED */

29
include/atomic.h Normal file
View File

@@ -0,0 +1,29 @@
/* $NetBSD: atomic.h,v 1.1 2008/05/28 12:28:12 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/atomic.h>

134
include/bitstring.h Normal file
View File

@@ -0,0 +1,134 @@
/* $NetBSD: bitstring.h,v 1.9 2010/05/06 18:54:22 christos Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Paul Vixie.
*
* 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.
*
* @(#)bitstring.h 8.1 (Berkeley) 7/19/93
*/
#ifndef _BITSTRING_H_
#define _BITSTRING_H_
/* modified for SV/AT and bitstring bugfix by M.R.Murphy, 11oct91
* bitstr_size changed gratuitously, but shorter
* bit_alloc spelling error fixed
* the following were efficient, but didn't work, they've been made to
* work, but are no longer as efficient :-)
* bit_nclear, bit_nset, bit_ffc, bit_ffs
*/
/*
* The comment above may or may not bear any resemblance to reality.
* This code has been maintained in a confusing way, with little
* information available on the provenance of much of it. "At least it
* works."
* /s/ Perry E. Metzger, 2 Feb 98
*/
typedef unsigned char bitstr_t;
/* internal macros */
/* byte of the bitstring bit is in */
#define _bit_byte(bit) \
(uint32_t)((bit) >> 3)
/* mask for the bit within its byte */
#define _bit_mask(bit) \
(uint32_t)((1 << (uint32_t)((bit)&0x7)))
/* external macros */
/* bytes in a bitstring of nbits bits */
#define bitstr_size(nbits) \
(size_t)((uint32_t)((nbits) + 7) >> 3)
/* allocate a bitstring */
#define bit_alloc(nbits) \
calloc(bitstr_size(nbits), sizeof(bitstr_t))
/* allocate a bitstring on the stack */
#define bit_decl(name, nbits) \
((name)[bitstr_size(nbits)])
/* is bit N of bitstring name set? */
#define bit_test(name, bit) \
/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] & _bit_mask(bit))
/* set bit N of bitstring name */
#define bit_set(name, bit) \
/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] |= _bit_mask(bit))
/* clear bit N of bitstring name */
#define bit_clear(name, bit) \
/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] &= ~_bit_mask(bit))
/* clear bits start ... stop in bitstring */
#define bit_nclear(name, start, stop) do { \
bitstr_t *_name = name; \
int _start = start, _stop = stop; \
while (_start <= _stop) { \
bit_clear(_name, _start); \
_start++; \
} \
} while(/*CONSTCOND*/0)
/* set bits start ... stop in bitstring */
#define bit_nset(name, start, stop) do { \
bitstr_t *_name = name; \
int _start = start, _stop = stop; \
while (_start <= _stop) { \
bit_set(_name, _start); \
_start++; \
} \
} while(/*CONSTCOND*/0)
/* find first bit clear in name */
#define bit_ffc(name, nbits, value) do { \
bitstr_t *_name = name; \
int _bit, _nbits = nbits, _value = -1; \
for (_bit = 0; _bit < _nbits; ++_bit) \
if (!bit_test(_name, _bit)) { \
_value = _bit; \
break; \
} \
*(value) = _value; \
} while(/*CONSTCOND*/0)
/* find first bit set in name */
#define bit_ffs(name, nbits, value) do { \
bitstr_t *_name = name; \
int _bit, _nbits = nbits, _value = -1; \
for (_bit = 0; _bit < _nbits; ++_bit) \
if (bit_test(_name, _bit)) { \
_value = _bit; \
break; \
} \
*(value) = _value; \
} while(/*CONSTCOND*/0)
#endif /* !_BITSTRING_H_ */

57
include/bm.h Normal file
View File

@@ -0,0 +1,57 @@
/* $NetBSD: bm.h,v 1.5 2005/02/03 04:39:32 perry Exp $ */
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Andrew Hume of AT&T Bell Laboratories.
*
* 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.
*
* @(#)bm.h 8.6 (Berkeley) 6/21/94
*/
#ifndef _BM_H_
#define _BM_H_
typedef struct {
u_char *pat; /* pattern */
size_t patlen; /* pattern length */
size_t *delta; /* skip delta */
int rarec; /* rare character */
size_t rareoff; /* rare offset */
size_t md2; /* mini delta */
} bm_pat;
#include <sys/cdefs.h>
__BEGIN_DECLS
bm_pat *bm_comp(u_char const *, size_t, u_char const *);
u_char *bm_exec(bm_pat *, u_char *, size_t);
void bm_free(bm_pat *);
__END_DECLS
#endif /* !_BM_H_ */

56
include/cdbr.h Normal file
View File

@@ -0,0 +1,56 @@
/* $NetBSD: cdbr.h,v 1.1 2010/04/25 00:54:45 joerg Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS 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 _CDBR_H
#define _CDBR_H
#include <sys/cdefs.h>
#include <inttypes.h>
#include <stddef.h>
#define CDBR_DEFAULT 0
struct cdbr;
__BEGIN_DECLS
struct cdbr *cdbr_open(const char *, int);
uint32_t cdbr_entries(struct cdbr *);
int cdbr_get(struct cdbr *, uint32_t, const void **, size_t *);
int cdbr_find(struct cdbr *, const void *, size_t,
const void **, size_t *);
void cdbr_close(struct cdbr *);
__END_DECLS
#endif /* _CDBR_H */

58
include/cdbw.h Normal file
View File

@@ -0,0 +1,58 @@
/* $NetBSD: cdbw.h,v 1.1 2010/04/25 00:54:45 joerg Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS 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 _CDBW_H
#define _CDBW_H
#include <sys/cdefs.h>
#include <inttypes.h>
#include <stddef.h>
struct cdbw;
__BEGIN_DECLS
struct cdbw *cdbw_open(void);
int cdbw_put(struct cdbw *, const void *, size_t,
const void *, size_t);
int cdbw_put_data(struct cdbw *, const void *, size_t,
uint32_t *);
int cdbw_put_key(struct cdbw *, const void *, size_t,
uint32_t);
int cdbw_output(struct cdbw *, int, const char[16],
uint32_t (*)(void));
void cdbw_close(struct cdbw *);
__END_DECLS
#endif /* _CDBW_H */

View File

@@ -1,6 +1,12 @@
/* $NetBSD: complex.h,v 1.1 2007/08/20 16:01:29 drochner Exp $ */
/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
#if __STDC_VERSION__ >= 199901L
/*
* Written by Matthias Drochner.
* Public domain.
*/
#ifndef _COMPLEX_H
#define _COMPLEX_H
#define complex _Complex
#define _Complex_I 1.0fi
@@ -10,60 +16,106 @@
__BEGIN_DECLS
double creal(double complex);
double cimag(double complex);
double complex conj(double complex);
float crealf(float complex);
float cimagf(float complex);
float complex conjf(float complex);
/* 7.3.5 Trigonometric functions */
/* 7.3.5.1 The cacos functions */
double complex cacos(double complex);
float complex cacosf(float complex);
#ifndef __minix
/* 7.3.5.2 The casin functions */
double complex casin(double complex);
float complex casinf(float complex);
/* 7.3.5.1 The catan functions */
double complex catan(double complex);
float complex catanf(float complex);
/* 7.3.5.1 The ccos functions */
double complex ccos(double complex);
float complex ccosf(float complex);
/* 7.3.5.1 The csin functions */
double complex csin(double complex);
float complex csinf(float complex);
/* 7.3.5.1 The ctan functions */
double complex ctan(double complex);
float complex ctanf(float complex);
/* 7.3.6 Hyperbolic functions */
/* 7.3.6.1 The cacosh functions */
double complex cacosh(double complex);
float complex cacoshf(float complex);
/* 7.3.6.2 The casinh functions */
double complex casinh(double complex);
float complex casinhf(float complex);
/* 7.3.6.3 The catanh functions */
double complex catanh(double complex);
float complex catanhf(float complex);
/* 7.3.6.4 The ccosh functions */
double complex ccosh(double complex);
float complex ccoshf(float complex);
/* 7.3.6.5 The csinh functions */
double complex csinh(double complex);
float complex csinhf(float complex);
/* 7.3.6.6 The ctanh functions */
double complex ctanh(double complex);
float complex ctanhf(float complex);
/* 7.3.7 Exponential and logarithmic functions */
/* 7.3.7.1 The cexp functions */
double complex cexp(double complex);
float complex cexpf(float complex);
/* 7.3.7.2 The clog functions */
double complex clog(double complex);
float complex clogf(float complex);
/* 7.3.8 Power and absolute-value functions */
/* 7.3.8.1 The cabs functions */
#ifndef __LIBM0_SOURCE__
/* avoid conflict with historical cabs(struct complex) */
double cabs(double complex) __RENAME(__c99_cabs);
float cabsf(float complex) __RENAME(__c99_cabsf);
#endif
#endif
/* 7.3.8.2 The cpow functions */
double complex cpow(double complex, double complex);
float complex cpowf(float complex, float complex);
/* 7.3.8.3 The csqrt functions */
double complex csqrt(double complex);
float complex csqrtf(float complex);
/* 7.3.9 Manipulation functions */
/* 7.3.9.1 The carg functions */
double carg(double complex);
float cargf(float complex);
double complex csqrt(double complex);
double complex cexp(double complex);
double complex clog(double complex);
double complex cpow(double complex, double complex);
/* 7.3.9.2 The cimag functions */
double cimag(double complex);
float cimagf(float complex);
long double cimagl(long double complex);
double complex csin(double complex);
double complex ccos(double complex);
double complex ctan(double complex);
double complex csinh(double complex);
double complex ccosh(double complex);
double complex ctanh(double complex);
/* 7.3.9.3 The conj functions */
double complex conj(double complex);
float complex conjf(float complex);
long double complex conjl(long double complex);
double complex casin(double complex);
double complex cacos(double complex);
double complex catan(double complex);
double complex casinh(double complex);
double complex cacosh(double complex);
double complex catanh(double complex);
/* 7.3.9.4 The cproj functions */
double complex cproj(double complex);
float complex cprojf(float complex);
long double complex cprojl(long double complex);
float complex csqrtf(float complex);
float complex cexpf(float complex);
float complex clogf(float complex);
float complex cpowf(float complex, float complex);
float complex csinf(float complex);
float complex ccosf(float complex);
float complex ctanf(float complex);
float complex csinhf(float complex);
float complex ccoshf(float complex);
float complex ctanhf(float complex);
float complex casinf(float complex);
float complex cacosf(float complex);
float complex catanf(float complex);
float complex casinhf(float complex);
float complex cacoshf(float complex);
float complex catanhf(float complex);
/* 7.3.9.5 The creal functions */
double creal(double complex);
float crealf(float complex);
long double creall(long double complex);
__END_DECLS
#endif
#endif /* ! _COMPLEX_H */

View File

@@ -1,44 +0,0 @@
/* configfile.h - Generic configuration file format.
* Author: Kees J. Bot
* 5 Jun 1999
*/
#ifndef _CONFIGFILE_H
#define _CONFIGFILE_H
/* Data can only be modified inside the library. */
#ifndef _c
#define _c const
#endif
typedef _c struct config { /* Contents of a generic configuration file. */
_c struct config *next; /* Next configuration file thing. */
_c struct config *list; /* For a { sublist }. */
const char *file; /* File and line where this is found. */
unsigned line;
int flags; /* Special flags. */
char word[1]; /* Payload. */
} config_t;
#define CFG_CLONG 0x0001 /* strtol(word, &end, 0) is valid. */
#define CFG_OLONG 0x0002 /* strtol(word, &end, 010). */
#define CFG_DLONG 0x0004 /* strtol(word, &end, 10). */
#define CFG_XLONG 0x0008 /* strtol(word, &end, 0x10). */
#define CFG_CULONG 0x0010 /* strtoul(word, &end, 0). */
#define CFG_OULONG 0x0020 /* strtoul(word, &end, 010). */
#define CFG_DULONG 0x0040 /* strtoul(word, &end, 10). */
#define CFG_XULONG 0x0080 /* strtoul(word, &end, 0x10). */
#define CFG_STRING 0x0100 /* The word is enclosed in quotes. */
#define CFG_SUBLIST 0x0200 /* This is a sublist, so no word. */
#define CFG_ESCAPED 0x0400 /* Escapes are still marked with \. */
config_t *config_read(const char *_file, int flags, config_t *_cfg);
void config_delete(config_t *_cfg);
int config_renewed(config_t *_cfg);
size_t config_length(config_t *_cfg);
#define config_issub(cfg) (!!((cfg)->flags & CFG_SUBLIST))
#define config_isatom(cfg) (!config_issub(cfg))
#define config_isstring(cfg) (!!((cfg)->flags & CFG_STRING))
#undef _c
#endif /* _CONFIGFILE_H */

58
include/cpio.h Normal file
View File

@@ -0,0 +1,58 @@
/* $NetBSD: cpio.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by J.T. Conklin.
*
* 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 _CPIO_H_
#define _CPIO_H_
#define C_IRUSR 0000400
#define C_IWUSR 0000200
#define C_IXUSR 0000100
#define C_IRGRP 0000040
#define C_IWGRP 0000020
#define C_IXGRP 0000010
#define C_IROTH 0000004
#define C_IWOTH 0000002
#define C_IXOTH 0000001
#define C_ISUID 0004000
#define C_ISGID 0002000
#define C_ISVTX 0001000
#define C_ISDIR 0040000
#define C_ISFIFO 0010000
#define C_ISREG 0100000
#define C_ISBLK 0060000
#define C_ISCHR 0020000
#define C_ISCTG 0110000
#define C_ISLNK 0120000
#define C_ISSOCK 0140000
#define MAGIC "070707"
#endif /* _CPIO_H_ */

View File

@@ -1,57 +1,77 @@
/* The <ctype.h> header file defines some macros used to identify characters.
* It works by using a table stored in chartab.c. When a character is presented
* to one of these macros, the character is used as an index into the table
* (__ctype) to retrieve a byte. The relevant bit is then extracted.
/* $NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki 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
*/
#ifndef _CTYPE_H
#define _CTYPE_H
#ifndef _CTYPE_H_
#define _CTYPE_H_
#include <minix/ansi.h>
#include <sys/cdefs.h>
#include <sys/featuretest.h>
extern char __ctype[]; /* property array defined in chartab.c */
__BEGIN_DECLS
int isalnum(int);
int isalpha(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int tolower(int);
int toupper(int);
#define _U 0x01 /* this bit is for upper-case letters [A-Z] */
#define _L 0x02 /* this bit is for lower-case letters [a-z] */
#define _N 0x04 /* this bit is for numbers [0-9] */
#define _S 0x08 /* this bit is for white space \t \n \f etc */
#define _P 0x10 /* this bit is for punctuation characters */
#define _C 0x20 /* this bit is for control characters */
#define _X 0x40 /* this bit is for hex digits [a-f] and [A-F]*/
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
int isascii(int);
int toascii(int);
int _tolower(int);
int _toupper(int);
#endif
/* Function Prototypes (have to go before the macros). */
_PROTOTYPE( int isalnum, (int _c) ); /* alphanumeric [a-z], [A-Z], [0-9] */
_PROTOTYPE( int isalpha, (int _c) ); /* alphabetic */
_PROTOTYPE( int isblank, (int _c) ); /* blank space */
_PROTOTYPE( int iscntrl, (int _c) ); /* control characters */
_PROTOTYPE( int isdigit, (int _c) ); /* digit [0-9] */
_PROTOTYPE( int isgraph, (int _c) ); /* graphic character */
_PROTOTYPE( int islower, (int _c) ); /* lower-case letter [a-z] */
_PROTOTYPE( int isprint, (int _c) ); /* printable character */
_PROTOTYPE( int ispunct, (int _c) ); /* punctuation mark */
_PROTOTYPE( int isspace, (int _c) ); /* white space sp, \f, \n, \r, \t, \v*/
_PROTOTYPE( int isupper, (int _c) ); /* upper-case letter [A-Z] */
_PROTOTYPE( int isxdigit,(int _c) ); /* hex digit [0-9], [a-f], [A-F] */
_PROTOTYPE( int tolower, (int _c) ); /* convert to lower-case */
_PROTOTYPE( int toupper, (int _c) ); /* convert to upper-case */
_PROTOTYPE( int toascii, (int _c) ); /* convert to 7-bit ASCII */
#if defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
(_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
int isblank(int);
#endif
__END_DECLS
/* Macros for identifying character classes. */
#define isalnum(c) ((__ctype+1)[(unsigned char)(c)]&(_U|_L|_N))
#define isalpha(c) ((__ctype+1)[(unsigned char)(c)]&(_U|_L))
#define iscntrl(c) ((__ctype+1)[(unsigned char)(c)]&_C)
#define isgraph(c) ((__ctype+1)[(unsigned char)(c)]&(_P|_U|_L|_N))
#define ispunct(c) ((__ctype+1)[(unsigned char)(c)]&_P)
#define isspace(c) ((__ctype+1)[(unsigned char)(c)]&_S)
#define isxdigit(c) ((__ctype+1)[(unsigned char)(c)]&(_N|_X))
#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE)
#include <sys/ctype_inline.h>
#endif
#define isdigit(c) ((unsigned) ((c)-'0') < 10)
#define islower(c) ((unsigned) ((c)-'a') < 26)
#define isupper(c) ((unsigned) ((c)-'A') < 26)
#define isprint(c) ((unsigned) ((c)-' ') < 95)
#define isascii(c) ((unsigned) (c) < 128)
#define isblank(c) ((c) == ' ' || (c) == '\t')
#define toascii(c) ((c) & 0x7f)
#endif /* _CTYPE_H */
#endif /* !_CTYPE_H_ */

View File

@@ -36,12 +36,9 @@
#include <sys/types.h>
#include <sys/cdefs.h>
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#define RET_ERROR -1 /* Return values. */
#define RET_SUCCESS 0
#define RET_SPECIAL 1
@@ -217,20 +214,8 @@ DB *dbopen(const char *, int, mode_t, DBTYPE, const void *);
#ifdef __DBINTERFACE_PRIVATE
#ifndef __minix
#define _DBMASK(a) (~((1ULL << (sizeof(a) * NBBY)) - 1))
#define _DBFIT(a, t) assert(((a) & _DBMASK(t)) == 0)
#else
#define NBBY 8
#define _DBMASK(a) (~((1UL << (sizeof(a) * NBBY)) - 1))
/* When compiled with ack, 1 << 32 does not evalute to 0.
* So we need a seperate check for the case when sizeof(t)
* is 4.
*/
#define _DBMASK32 0xffffffff
#define _DBFIT(a, t) \
assert((sizeof(t) == 4) ||((sizeof(t) < 4) && (((a) & _DBMASK(t)) == 0)))
#endif
#define _DBFIT(a, t) _DIAGASSERT(((a) & _DBMASK(t)) == 0)
DB *__bt_open(const char *, int, mode_t, const BTREEINFO *, int);
DB *__hash_open(const char *, int, mode_t, const HASHINFO *, int);

23
include/ddekit/assert.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef _ddekit_assert_h
#define _ddekit_assert_h
#include <ddekit/ddekit.h>
#include <ddekit/printf.h>
#include <ddekit/panic.h>
/** \file ddekit/assert.h */
/** Assert that an expression is true and panic if not.
* \ingroup DDEKit_util
*/
#define ddekit_assert(expr) do \
{ \
if (!(expr)) { \
ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \
ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \
ddekit_printf(" Function: %s()\n", __FUNCTION__); \
ddekit_panic("Assertion failed."); \
}} while (0);
#define Assert ddekit_assert
#endif

16
include/ddekit/attribs.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef _DDEKIT_ATTRIBS_H
#define _DDEKIT_ATTRIBS_H
#ifdef __ACK__
#else
#define DDEKIT_USED __attribute__((used))
#define DDEKIT_CONSTRUCTOR __attribute__((constructor))
#define DDEKIT_PUBLIC PUBLIC
#define DDEKIT_PRIVATE static
#endif
#endif

32
include/ddekit/condvar.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef _ddekit_condvar_h
#define _ddekit_condvar_h
/** \file ddekit/condvar.h */
#include <ddekit/ddekit.h>
#include <ddekit/lock.h>
struct ddekit_condvar;
typedef struct ddekit_condvar ddekit_condvar_t;
/* Initialize conditional variable. */
_PROTOTYPE( ddekit_condvar_t * ddekit_condvar_init, (void));
/* Uninitialize conditional variable. */
_PROTOTYPE( void ddekit_condvar_deinit, (ddekit_condvar_t *cvp));
/* Wait on a conditional variable. */
_PROTOTYPE( void ddekit_condvar_waiti, (ddekit_condvar_t *cvp,
ddekit_lock_t *mp));
/* Wait on a conditional variable at most until a timeout expires. (UNIMPL) */
_PROTOTYPE( int ddekit_condvar_wait_timed, (ddekit_condvar_t *cvp,
ddekit_lock_t *mp, int timo));
/* Send signal to the next one waiting for condvar. */
_PROTOTYPE( void ddekit_condvar_signal, (ddekit_condvar_t *cvp));
/* Send signal to all threads waiting for condvar. */
_PROTOTYPE( void ddekit_condvar_broadcast, (ddekit_condvar_t *cvp));
#endif

7
include/ddekit/ddekit.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef _DDEKIT_DDEKIT_H
#define _DDEKIT_DDEKIT_H
#include <minix/ansi.h>
_PROTOTYPE( void ddekit_init, (void) );
#endif

41
include/ddekit/debug.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef DDEKIT_DEBUG_H
#define DDEKIT_DEBUG_H
#include <ddekit/ddekit.h>
#include <ddekit/printf.h>
#define DDEBUG_QUIET 0
#define DDEBUG_ERR 1
#define DDEBUG_WARN 2
#define DDEBUG_INFO 3
#define DDEBUG_VERBOSE 4
#define DDEBUG_MEM DDEBUG_INFO
#define DDEBUG_MSG_ERR(fmt, ...)
#define DDEBUG_MSG_WARN(fmt, ...)
#define DDEBUG_MSG_INFO(fmt, ...)
#define DDEBUG_MSG_VERBOSE(fmt, ...)
#if DDEBUG >= DDEBUG_ERR
#undef DDEBUG_MSG_ERR
#define DDEBUG_MSG_ERR(fmt, ...) ddekit_printf("%s : "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_WARN
#undef DDEBUG_MSG_WARN
#define DDEBUG_MSG_WARN(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_INFO
#undef DDEBUG_MSG_INFO
#define DDEBUG_MSG_INFO(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_VERBOSE
#undef DDEBUG_MSG_VERBOSE
#define DDEBUG_MSG_VERBOSE(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#endif

30
include/ddekit/initcall.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef _DDEKIT_INITCALL_H
#define _DDEKIT_INITCALL_H
#include <ddekit/ddekit.h>
#include <ddekit/attribs.h>
typedef void (*ddekit_initcall_t)(void);
struct __ddekit_initcall_s {
ddekit_initcall_t func;
int prio;
struct __ddekit_initcall_s *next;
};
void __ddekit_add_initcall(struct __ddekit_initcall_s *dis);
/* Define a function to be a DDEKit initcall.
* This is the right place to place Linux' module_init functions & Co.
*/
#define DDEKIT_INITCALL(fn) DDEKIT_CTOR(fn, 1)
#define DDEKIT_CTOR(fn, prio) \
static void __attribute__((used)) __attribute__((constructor))\
__ddekit_initcall_##fn() { \
static struct __ddekit_initcall_s dis = {(ddekit_initcall_t)fn, prio, 0}; \
__ddekit_add_initcall(&dis); }
/* Runs all registered initcalls. */
_PROTOTYPE (void ddekit_do_initcalls, (void));
#endif

2
include/ddekit/inline.h Normal file
View File

@@ -0,0 +1,2 @@
#define DDEKIT_INLINE __inline__ __attribute__((always_inline))

View File

@@ -0,0 +1,48 @@
/*-
* Copyright (c) 2006 TU Dresden, All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS 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 _DDEKIT_INTERUPT_H
#define _DDEKIT_INTERUPT_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
/** Attach to an interrupt */
_PROTOTYPE( ddekit_thread_t *ddekit_interrupt_attach,
( int irq, int shared, void(*thread_init)(void *),
void(*handler)(void *), void *priv) );
/* Detach from a previously attached interrupt. */
_PROTOTYPE( void ddekit_interrupt_detach, (int irq));
/* Block interrupt. */
_PROTOTYPE( void ddekit_interrupt_disable, (int irq));
/* Enable interrupt */
_PROTOTYPE( void ddekit_interrupt_enable, (int irq));
#endif

33
include/ddekit/lock.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef _DDEKIT_LOCK_H
#define _DDEKIT_LOCK_H
#include <ddekit/ddekit.h>
struct ddekit_lock;
typedef struct ddekit_lock *ddekit_lock_t;
/* Initialize a DDEKit unlocked lock. */
#define ddekit_lock_init ddekit_lock_init_unlocked
/* Initialize a DDEKit unlocked lock. */
_PROTOTYPE( void ddekit_lock_init_unlocked, (ddekit_lock_t *mtx));
/* Initialize a DDEKit locked lock. */
_PROTOTYPE( void ddekit_lock_init_locked, (ddekit_lock_t *mtx));
/* Uninitialize a DDEKit lock. */
_PROTOTYPE( void ddekit_lock_deinit, (ddekit_lock_t *mtx));
/* Acquire a lock. */
_PROTOTYPE( void ddekit_lock_lock, (ddekit_lock_t *mtx));
/* Acquire a lock, non-blocking. */
_PROTOTYPE( int ddekit_lock_try_lock, (ddekit_lock_t *mtx));
/* Unlock function. */
_PROTOTYPE( void ddekit_lock_unlock, (ddekit_lock_t *mtx));
/* Get lock owner. */
_PROTOTYPE( int ddekit_lock_owner, (ddekit_lock_t *mtx));
#endif

146
include/ddekit/memory.h Normal file
View File

@@ -0,0 +1,146 @@
/*-
* Copyright (c) 2006 Thomas Friebel <tf13@os.inf.tu-dresden.de>
* Copyright (c) 2006 Christian Helmuth <ch12@os.inf.tu-dresden.de>
* Copyright (c) 2010 Dirk Vogt <dvogt@few.vu.nl>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS 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 _DDEKIT_MEMORY_H
#define _DDEKIT_MEMORY_H
#include <ddekit/ddekit.h>
/*******************
** Slab facility **
*******************/
struct ddekit_slab;
/* Store user pointer in slab cache */
_PROTOTYPE( void ddekit_slab_set_data, (struct ddekit_slab * slab,
void *data));
/* Read user pointer from slab cache */
_PROTOTYPE( void *ddekit_slab_get_data,(struct ddekit_slab * slab));
/* Allocate slab in slab cache */
_PROTOTYPE( void *ddekit_slab_alloc, (struct ddekit_slab * slab));
/* Allocate slab in slab cache */
_PROTOTYPE( void ddekit_slab_free, (struct ddekit_slab * slab, void *objp));
/*
* Setup page cache for all slabs
*
* pages: maximal number of memory pages
*
* If 'pages' is too low, memory pages may be given back to the memory server
* (dm_phys) and just to be allocated again later. This hits performance (but
* saves memory). Increase 'pages' to avoid this thrashing-like effect.
*
* If the maximal number of unused pages is exceeded, subsequent deallocation
* will be freed at the memory server. This page cache caches pages from all
* slabs.
*/
_PROTOTYPE( void ddekit_slab_setup_page_cache, (unsigned pages));
/*
* Destroy slab cache
*
* slab: pointer to slab cache structure
*/
_PROTOTYPE( void ddekit_slab_destroy, (struct ddekit_slab * slab));
/**
* Initialize slab cache
*
* \param size size of cache objects
* \param contiguous make this slab use physically contiguous memory
*
* \return pointer to new slab cache or 0 on error
*/
_PROTOTYPE( struct ddekit_slab * ddekit_slab_init,(unsigned size, int contiguous));
/**********************
** Memory allocator **
**********************/
/*
* Allocate large memory block
*
* \param size block size
* \return pointer to new memory block
*
* Allocations via this allocator may be slow (because memory servers are
* involved) and should be used only for large (i.e., > page size) blocks. If
* allocations/deallocations are relatively dynamic this may not be what you
* want.
*
* Allocated blocks have valid virt->phys mappings and are physically
* contiguous.
*/
_PROTOTYPE( void *ddekit_large_malloc, (int size));
/**
* Free large memory block
*
* \param p pointer to memory block
*/
_PROTOTYPE( void ddekit_large_free, (void *p));
/** FIXME
* contig_malloc() is the lowest-level allocator interface one could implement.
* we should consider to provide vmalloc() too. */
_PROTOTYPE( void *ddekit_contig_malloc,
(unsigned long size, unsigned long low,
unsigned long high, unsigned long alignment,
unsigned long boundary));
/*****************************
** Simple memory allocator **
*****************************/
/**
* Allocate memory block via simple allocator
*
* \param size block size
* \return pointer to new memory block
*
* The blocks allocated via this allocator CANNOT be used for DMA or other
* device operations, i.e., there exists no virt->phys mapping.
*/
_PROTOTYPE( void *ddekit_simple_malloc, (unsigned size));
/**
* Free memory block via simple allocator
*
* \param p pointer to memory block
*/
_PROTOTYPE( void ddekit_simple_free, (void *p));
#endif

View File

@@ -0,0 +1,22 @@
#ifndef DDEKIT_SRC_MSG_QUEUE_H
#define DDEKIT_SRC_MSG_QUEUE_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
#include <minix/ipc.h>
struct ddekit_minix_msg_q;
_PROTOTYPE( void ddekit_minix_queue_msg, (message *m));
_PROTOTYPE( void ddekit_minix_rcv,
(struct ddekit_minix_msg_q * mq, message *m));
_PROTOTYPE( struct ddekit_minix_msg_q *ddekit_minix_create_msg_q,
(unsigned from, unsigned to));
_PROTOTYPE( void ddekit_minix_destroy_msg_q,
(struct ddekit_minix_msg_q *mq));
#endif /* DDEKIT_SRC_MSG_QUEUE_H */

View File

@@ -0,0 +1,4 @@
#ifndef DDEKIT_MINIX_PCI
#define DDEKIT_MINIX_PCI
void ddekit_pci_init_only_one(int skip);
#endif

18
include/ddekit/panic.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef _DDEKIT_PANIC_H
#define _DDEKIT_PANIC_H
#include <ddekit/ddekit.h>
#include <stdarg.h>
/** \defgroup DDEKit_util */
/** Panic - print error message and enter the kernel debugger.
* \ingroup DDEKit_util
*/
_PROTOTYPE (void ddekit_panic, (char *fmt, ...));
/** Print a debug message.
* \ingroup DDEKit_util
*/
_PROTOTYPE (void ddekit_debug, (char *fmt, ...));
#endif

217
include/ddekit/pci.h Normal file
View File

@@ -0,0 +1,217 @@
#ifndef _DDEKIT_PCI_H
#define _DDEKIT_PCI_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/** \defgroup DDEKit_pci */
/** Our version of PCI_ANY_ID */
#define DDEKIT_PCI_ANY_ID (~0)
/** Copy of L4IO_PCIDEV_RES */
#define DDEKIT_PCIDEV_RES 12
struct ddekit_pci_dev;
/** PCI resource descriptor. Copied from generic_io.
*
* XXX!
*/
typedef struct ddekit_pci_resource {
unsigned long start;
unsigned long end;
unsigned long flags;
} ddekit_pci_res_t;
_PROTOTYPE( void ddekit_pci_init, (void));
_PROTOTYPE( int ddekit_pci_get_device,(int nr, int *bus,
int *slot, int *func));
_PROTOTYPE( int ddekit_pci_read, (int bus, int slot, int func,
int pos, int len, ddekit_uint32_t *val));
_PROTOTYPE( int ddekit_pci_write, (int bus, int slot, int func,
int pos, int len, ddekit_uint32_t val));
/** Read byte from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_readb, (int bus, int slot,
int func, int pos, ddekit_uint8_t *val));
/** Read word from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_readw, (int bus, int slot,
int func, int pos, ddekit_uint16_t *val));
/** Read dword from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_readl, (int bus, int slot,
int func, int pos, ddekit_uint32_t *val));
/** Write byte to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_writeb, (int bus, int slot,
int func, int pos, ddekit_uint8_t val));
/** Write word to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_writew, (int bus, int slot,
int func, int pos, ddekit_uint16_t val));
/** Write word to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
_PROTOTYPE( int ddekit_pci_writel, (int bus, int slot,
int func, int pos, ddekit_uint32_t val));
/** Find a PCI device.
*
* \ingroup DDEKit_pci
*
* \param bus pointer to bus number or \ref DDEKIT_PCI_ANY_ID
* \param slot pointer to slot number (devfn >> DEVFN_SLOTSHIFT) or \ref DDEKIT_PCI_ANY_ID
* \param func pointer to func number (devfc & DEVFN_FUNCMASK) or \ref DDEKIT_PCI_ANY_ID
* \param start search device list only behind this device (excluding it!), NULL
* searches whole device list
*
* \retval bus bus number
* \retval slot slot number
* \retval func function number
*
* \return device a valid PCI device
* \return NULL if no device found
*/
_PROTOTYPE( struct ddekit_pci_dev * ddekit_pci_find_device,
(int *bus, int *slot, int *func, struct ddekit_pci_dev *start));
/** Enable PCI device
* \ingroup DDEKit_pci
*/
_PROTOTYPE( int ddekit_pci_enable_device, (struct ddekit_pci_dev *dev));
/** Disable PCI device
* \ingroup DDEKit_pci
*/
_PROTOTYPE( int ddekit_pci_disable_device, (struct ddekit_pci_dev *dev));
/** Enable bus-mastering for device.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( void ddekit_pci_set_master, (struct ddekit_pci_dev *dev));
/** Get device vendor ID.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned short ddekit_pci_get_vendor,
(struct ddekit_pci_dev *dev));
/** Get device ID.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned short ddekit_pci_get_device_id,
(struct ddekit_pci_dev *dev));
/** Get device subvendor ID.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned short ddekit_pci_get_sub_vendor,
(struct ddekit_pci_dev *dev));
/** Get subdevice ID.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned short ddekit_pci_get_sub_device,
(struct ddekit_pci_dev *dev));
/** Get device class ID.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned ddekit_pci_get_dev_class,
(struct ddekit_pci_dev *dev));
/** Get device's IRQ number.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( unsigned long ddekit_pci_get_irq,
(struct ddekit_pci_dev *dev));
/** Get device name.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( char *ddekit_pci_get_name, (struct ddekit_pci_dev *dev));
/** Get device's slot name.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( char *ddekit_pci_get_slot_name, (struct ddekit_pci_dev *dev));
/** Get one of the device's resources.
* \ingroup DDEKit_pci
*/
_PROTOTYPE( ddekit_pci_res_t *ddekit_pci_get_resource,
(struct ddekit_pci_dev *dev, unsigned int idx));
_PROTOTYPE( int ddekit_pci_irq_enable, (int bus, int slot,
int func, int pin, int *irq));
#endif

92
include/ddekit/pgtab.h Normal file
View File

@@ -0,0 +1,92 @@
/*
* \brief Virtual page-table facility
* \author Thomas Friebel <tf13@os.inf.tu-dresden.de>
* \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
* \date 2006-11-03
*/
#ifndef _DDEKIT_PGTAB_H
#define _DDEKIT_PGTAB_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/* FIXME Region types may be defined by pgtab users. Do we really need them
* here? */
enum ddekit_pgtab_type
{
PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG
};
/**
* Set virtual->physical mapping for VM region
*
* \param virt virtual start address for region
* \param phys physical start address for region
* \param pages number of pages in region
* \param type pgtab type for region
*/
_PROTOTYPE( void ddekit_pgtab_set_region,
(void *virt, ddekit_addr_t phys, int pages, int type));
/**
* Set virtual->physical mapping for VM region given a specific size in bytes.
*
* Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle
* with the underlying mechanism and therefore can use this function that takes care
* of translating a size to an amount of pages.
*/
_PROTOTYPE( void ddekit_pgtab_set_region_with_size,
(void *virt, ddekit_addr_t phys, int size, int type));
/**
* Clear virtual->physical mapping for VM region
*
* \param virt virtual start address for region
* \param type pgtab type for region
*/
_PROTOTYPE( void ddekit_pgtab_clear_region,
(void *virt, int type));
/**
* Get physical address for virtual address
*
* \param virt virtual address
*
* \return physical address
*/
_PROTOTYPE( ddekit_addr_t ddekit_pgtab_get_physaddr, (const void *virt));
/**
* Get virtual address for physical address
*
* \param physical physical address
*
* \return virtual address
*/
_PROTOTYPE( ddekit_addr_t ddekit_pgtab_get_virtaddr,
(const ddekit_addr_t physical));
/**
* Get type of VM region.
*
* \param virt virtual address
* \return VM region type
*/
_PROTOTYPE( int ddekit_pgtab_get_type, (const void *virt));
/**
* Get size of VM region.
*
* \param virt virtual address
*
* \return VM region size (in bytes)
*/
_PROTOTYPE( int ddekit_pgtab_get_size, (const void *virt));
#endif

34
include/ddekit/printf.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef _DDEKIT_PRINTF_H
#define _DDEKIT_PRINTF_H
#include <ddekit/ddekit.h>
#include <stdarg.h>
/** Print message.
* \ingroup DDEKit_util
*/
_PROTOTYPE( int ddekit_print,(const char *));
/** Print message with format.
* \ingroup DDEKit_util
*/
_PROTOTYPE( int ddekit_printf,(const char *fmt, ...));
/** Print message with format list.
* \ingroup DDEKit_util
*/
_PROTOTYPE( int ddekit_vprintf, (const char *fmt, va_list va));
/** Log function and message.
* \ingroup DDEKit_util
*/
#define ddekit_log(doit, msg...) \
do { \
if (doit) { \
ddekit_printf("%s(): ", __func__); \
ddekit_printf(msg); \
ddekit_printf("\n"); \
} \
} while(0);
#endif

View File

@@ -0,0 +1,80 @@
#ifndef _DDEKIT_RESOURCES_H
#define _DDEKIT_RESOURCES_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/*
* request/release an isa DMA-channel
*/
_PROTOTYPE( int ddekit_request_dma, (int nr));
_PROTOTYPE( int ddekit_release_dma, (int nr));
/*
* request/release an io-port range starting at addr start, lenght of count
*/
_PROTOTYPE( int ddekit_request_io, (ddekit_addr_t start, ddekit_addr_t count));
_PROTOTYPE( int ddekit_release_io, (ddekit_addr_t start, ddekit_addr_t count));
/*
* request an IO-Memory mapping from address start to vaddr of the length count
*/
_PROTOTYPE( int ddekit_request_mem,
(ddekit_addr_t start, ddekit_addr_t count, ddekit_addr_t *vaddr));
_PROTOTYPE( int ddekit_release_mem, (ddekit_addr_t start, ddekit_addr_t count));
/**
* Read I/O port (byte)
*
* \param port port to read
*
* \return value read from port
*/
_PROTOTYPE( unsigned char dde_kit_inb, (ddekit_addr_t port));
/**
* Read I/O port (2-byte)
*
* \param port port to read
*
* \return value read from port
*/
_PROTOTYPE( unsigned short dde_kit_inw, (ddekit_addr_t port));
/**
* Read I/O port (4-byte)
*
* \param port port to read
*
* \return value read from port
*/
_PROTOTYPE( unsigned long dde_kit_inl, (ddekit_addr_t port));
/**
* Write I/O port (byte)
*
* \param port port to write
* \param val value to write
*/
_PROTOTYPE( void dde_kit_outb, (ddekit_addr_t port, unsigned char val));
/**
* Write I/O port (2-byte)
*
* \param port port to write
* \param val value to write
*/
_PROTOTYPE( void dde_kit_outw, (ddekit_addr_t port, unsigned short val));
/**
* Write I/O port (4-byte)
*
* \param port port to write
* \param val value to write
*/
_PROTOTYPE( void dde_kit_outl, (ddekit_addr_t port, unsigned long val));
#endif

View File

@@ -0,0 +1,53 @@
#ifndef _DDEKIT_SEMAPHORE_H
#define _DDEKIT_SEMAPHORE_H
#include <ddekit/ddekit.h>
/** \defgroup DDEKit_synchronization */
struct ddekit_sem;
typedef struct ddekit_sem ddekit_sem_t;
/** Initialize DDEKit semaphore.
*
* \ingroup DDEKit_synchronization
*
* \param value initial semaphore counter
*/
_PROTOTYPE( ddekit_sem_t *ddekit_sem_init, (int value));
/** Uninitialize semaphore.
*
* \ingroup DDEKit_synchronization
*/
_PROTOTYPE( void ddekit_sem_deinit, (ddekit_sem_t *sem));
/** Semaphore down method. */
_PROTOTYPE( void ddekit_sem_down, (ddekit_sem_t *sem));
/** Semaphore down method, non-blocking.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
_PROTOTYPE( int ddekit_sem_down_try, (ddekit_sem_t *sem));
/** Semaphore down with timeout.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
_PROTOTYPE( int ddekit_sem_down_timed, (ddekit_sem_t *sem, int timo));
/** Semaphore up method.
*
* \ingroup DDEKit_synchronization
*/
_PROTOTYPE( void ddekit_sem_up, (ddekit_sem_t *sem));
#endif

164
include/ddekit/thread.h Normal file
View File

@@ -0,0 +1,164 @@
#ifndef _DDEKIT_THREAD_H
#define _DDEKIT_THREAD_H
/** \defgroup DDEKit_threads */
#include <ddekit/ddekit.h>
#include <ddekit/lock.h>
struct ddekit_thread;
typedef struct ddekit_thread ddekit_thread_t;
/** Create thread
*
* \ingroup DDEKit_threads
*
* Create a new thread running the specified thread function with the specified
* arguments. The thread is assigned the given internal name.
*
* Additionally, DDEKit threads possess a thread-local storage area where they
* may store arbitrary data.
*
* \param fun thread function
* \param arg optional argument to thread function, set to NULL if not needed
* \param name internal thread name
*/
_PROTOTYPE( ddekit_thread_t *ddekit_thread_create,
(void (*fun)(void *), void *arg, const char *name));
/** Reference to own DDEKit thread id.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( ddekit_thread_t *ddekit_thread_myself, (void));
/** Initialize thread with given name.
*
* \ingroup DDEKit_threads
*
* This function may be used by threads that were not created using
* \ref ddekit_thread_create. This enables such threads to be handled as if they
* were DDEKit threads.
*/
_PROTOTYPE( ddekit_thread_t *ddekit_thread_setup_myself, (const char *name));
/** Get TLS data for a specific thread.
*
* \ingroup DDEKit_threads
*
* \return Pointer to TLS data of this thread.
*/
_PROTOTYPE( void *ddekit_thread_get_data, (ddekit_thread_t *thread));
/** Get TLS data for current thread.
*
* \ingroup DDEKit_threads
*
* Same as calling \ref ddekit_thread_get_data with \ref ddekit_thread_myself
* as parameter.
*
* \return Pointer to TLS data of current thread.
*/
_PROTOTYPE( void *ddekit_thread_get_my_data, (void));
/** Set TLS data for specific thread.
*
* \ingroup DDEKit_threads
*
* \param thread DDEKit thread
* \param data pointer to thread data
*/
_PROTOTYPE( void ddekit_thread_set_data, (ddekit_thread_t *thread,
void *data));
/** Set TLS data for current thread.
*
* \ingroup DDEKit_threads
*
* \param data pointer to thread data
*/
_PROTOTYPE( void ddekit_thread_set_my_data, (void *data));
/** Sleep for some miliseconds.
*
* \ingroup DDEKit_threads
*
* \param msecs time to sleep in ms.
*/
_PROTOTYPE( void ddekit_thread_msleep, (unsigned long msecs));
/** Sleep for some microseconds.
*
* \ingroup DDEKit_threads
*
* \param usecs time to sleep in µs.
*/
_PROTOTYPE( void ddekit_thread_usleep, (unsigned long usecs));
/** Sleep for some nanoseconds.
*
* \ingroup DDEKit_threads
*
* \param usecs time to sleep in ns.
*/
_PROTOTYPE( void ddekit_thread_nsleep, (unsigned long nsecs));
/** Sleep until a lock becomes unlocked.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_thread_sleep, (ddekit_lock_t *lock));
/** Wakeup a waiting thread.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_thread_wakeup, (ddekit_thread_t *thread));
/** Terminate a thread
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_thread_exit, (void) __attribute__((noreturn)));
/** Terminate a thread
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_thread_terminate, (ddekit_thread_t *thread));
/** Get the name, a thread registered with DDEKit.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( const char *ddekit_thread_get_name, (ddekit_thread_t *thread));
/** Get unique ID of a DDEKit thread.
*
* \ingroup DDEKit_threads
*
* DDEKit does not allow direct access to the thread data
* structure, since this struct contains L4-specific data types.
* However, applications might want to get some kind of ID related
* to a ddekit_thread, for instance to use it as a Linux-like PID.
*/
_PROTOTYPE( int ddekit_thread_get_id, (ddekit_thread_t *thread));
/** Hint that this thread is done and may be scheduled somehow.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_thread_schedule, (void));
/** Hint that this thread is done and may be scheduled somehow.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_yield, (void));
/** Initialize DDEKit thread subsystem.
*
* \ingroup DDEKit_threads
*/
_PROTOTYPE( void ddekit_init_threads, (void));
#endif

52
include/ddekit/timer.h Normal file
View File

@@ -0,0 +1,52 @@
#ifndef _DDEKIT_TIMER_H
#define _DDEKIT_TIMER_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
/** \defgroup DDEKit_timer
*
* Timer subsystem
*
* DDEKit provides a generic timer implementation that enables users
* to execute a function with some arguments after a certain period
* of time. DDEKit therefore starts a timer thread that executes these
* functions and keeps track of the currently running timers.
*/
/** Add a timer event. After the absolute timeout has expired, function fn
* is called with args as arguments.
*
* \ingroup DDEKit_timer
*
* \return >=0 valid timer ID
* \return < 0 error
*/
_PROTOTYPE( int ddekit_add_timer,
(void (*fn)(void *), void *args, unsigned long timeout));
/** Delete timer with the corresponding timer id.
*
* \ingroup DDEKit_timer
*/
_PROTOTYPE( int ddekit_del_timer, (int timer));
/** Check whether a timer is pending
*
* \ingroup DDEKit_timer
*
* Linux needs this.
*/
_PROTOTYPE( int ddekit_timer_pending, (int timer));
/** Initialization function, startup timer thread
*
* \ingroup DDEKit_timer
*/
_PROTOTYPE( void ddekit_init_timers, (void));
/** Get the timer thread.
*/
_PROTOTYPE( ddekit_thread_t *ddekit_get_timer_thread, (void));
#endif

22
include/ddekit/types.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* \brief Types for ddekit (x86 version)
* \author Thomas Friebel <tf13@os.inf.tu-dresden.de>
* \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
* \date 2006-11-09
*
* FIXME This is definitely arch-dependent! Move to ARCH-something
*/
#ifndef _DDEKIT_TYPES_H
#define _DDEKIT_TYPES_H
typedef signed char ddekit_int8_t;
typedef unsigned char ddekit_uint8_t;
typedef signed short int ddekit_int16_t;
typedef unsigned short int ddekit_uint16_t;
typedef signed int ddekit_int32_t;
typedef unsigned int ddekit_uint32_t;
typedef unsigned long ddekit_addr_t;
#endif

97
include/ddekit/usb.h Normal file
View File

@@ -0,0 +1,97 @@
#ifndef _DDEKIT_USB_H
#define _DDEKIT_USB_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/** isochronous transfer */
#define DDEKIT_USB_TRANSFER_ISO 0
/** interrupt transfer */
#define DDEKIT_USB_TRANSFER_INT 1
/** control transfer */
#define DDEKIT_USB_TRANSFER_CTL 2
/** bulk transfer */
#define DDEKIT_USB_TRANSFER_BLK 3
#define DDEKIT_USB_IN 1
#define DDEKIT_USB_OUT 0
struct ddekit_usb_dev;
struct ddekit_usb_urb;
struct ddekit_usb_device_id {
ddekit_uint16_t idVendor;
ddekit_uint16_t idProduct;
ddekit_uint32_t bcdDevice;
ddekit_uint8_t bDeviceClass;
ddekit_uint8_t bDeviceSubClass;
ddekit_uint8_t bDeviceProtocol;
ddekit_uint8_t bInterfaceClass;
ddekit_uint8_t bInterfaceSubClass;
ddekit_uint8_t bInterfaceProtocol;
};
struct ddekit_usb_iso_packet_desc {
ddekit_int32_t offset;
ddekit_int32_t length; /* expected length */
ddekit_int32_t actual_length;
ddekit_int32_t status;
};
typedef void (*ddekit_usb_completion_cb)(void* priv);
typedef void (*ddekit_usb_connect_cb)(struct ddekit_usb_dev *dev,
unsigned int interfaces);
typedef void (*ddekit_usb_disconnect_cb)(struct ddekit_usb_dev *dev);
typedef void *(*ddekit_usb_malloc_fn)(unsigned size);
typedef void (*ddekit_usb_free_fn)(void *ptr);
struct ddekit_usb_driver {
ddekit_usb_completion_cb completion;
ddekit_usb_connect_cb connect;
ddekit_usb_disconnect_cb disconnect;
};
struct ddekit_usb_urb {
struct ddekit_usb_dev *dev;
ddekit_int32_t type;
ddekit_int32_t endpoint;
ddekit_int32_t direction;
ddekit_int32_t status;
ddekit_int32_t interval;
ddekit_uint32_t transfer_flags;
ddekit_uint32_t size;
ddekit_uint32_t actual_length;
ddekit_int32_t number_of_packets;
ddekit_int32_t error_count;
ddekit_int32_t start_frame;
char *setup_packet;
char *data;
struct ddekit_usb_iso_packet_desc *iso_desc;
void *priv;
void *ddekit_priv;
};
_PROTOTYPE( int ddekit_usb_dev_set_data,
(struct ddekit_usb_dev *dev, void *data));
_PROTOTYPE( void *ddekit_usb_dev_get_data, (struct ddekit_usb_dev *dev));
_PROTOTYPE( void ddekit_usb_get_device_id, (struct ddekit_usb_dev *dev,
struct ddekit_usb_device_id *id));
_PROTOTYPE( int ddekit_usb_submit_urb, (struct ddekit_usb_urb *d_urb));
_PROTOTYPE( int ddekit_usb_cancle_urb, (struct ddekit_usb_urb *d_urb));
/*
* This one is only implemented for the client side. For the server side is
* has to be implemented in the DDELinux/FBSD part.
*/
_PROTOTYPE( int ddekit_usb_init, (struct ddekit_usb_driver *drv,
ddekit_usb_malloc_fn *_m,
ddekit_usb_free_fn *_f));
#endif

View File

@@ -1,11 +1,118 @@
/*
* this files resolves conflicts between the file of the host system and
* the minix specific one. This file is included directly only on Minix
* and it is an error to do so on any other system
/* $NetBSD: dirent.h,v 1.34 2010/09/26 02:26:59 yamt Exp $ */
/*-
* Copyright (c) 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.
*
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
*/
#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#error "Including Minix specific file in program targeted for other system"
#else
#include <minix/dirent.h>
#ifndef _DIRENT_H_
#define _DIRENT_H_
#include <sys/featuretest.h>
#include <sys/types.h>
/*
* The kernel defines the format of directory entries returned by
* the getdents(2) system call.
*/
#include <sys/dirent.h>
#ifndef __minix
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#define d_ino d_fileno /* backward compatibility */
#endif
#endif /* !__minix */
typedef struct _dirdesc DIR;
#if defined(_NETBSD_SOURCE)
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
/* structure describing an open directory. */
struct _dirdesc {
int dd_fd; /* file descriptor associated with directory */
long dd_loc; /* offset in current buffer */
long dd_size; /* amount of data returned by getdents */
char *dd_buf; /* data buffer */
int dd_len; /* size of data buffer */
off_t dd_seek; /* magic cookie returned by getdents */
void *dd_internal; /* state for seekdir/telldir */
int dd_flags; /* flags for readdir */
void *dd_lock; /* lock for concurrent access */
};
#define dirfd(dirp) ((dirp)->dd_fd)
/* flags for __opendir2() */
#define DTF_HIDEW 0x0001 /* hide whiteout entries */
#define DTF_NODUP 0x0002 /* don't return duplicate names */
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
#define __DTF_READALL 0x0008 /* everything has been read */
#define __DTF_RETRY_ON_BADCOOKIE 0x0001 /* retry on EINVAL
(only valid with __DTF_READALL) */
#include <sys/null.h>
#endif
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
int closedir(DIR *);
void rewinddir(DIR *);
#ifndef __LIBC12_SOURCE__
DIR *opendir(const char *) __RENAME(__opendir30);
struct dirent *readdir(DIR *) __RENAME(__readdir30);
int readdir_r(DIR * __restrict, struct dirent * __restrict,
struct dirent ** __restrict) __RENAME(__readdir_r30);
#endif
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
void seekdir(DIR *, long);
long telldir(DIR *);
#endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */
#if defined(_NETBSD_SOURCE)
#ifndef __LIBC12_SOURCE__
DIR *fdopendir(int);
DIR *__opendir2(const char *, int) __RENAME(__opendir230);
int scandir(const char *, struct dirent ***,
int (*)(const struct dirent *), int (*)(const void *, const void *))
__RENAME(__scandir30);
int getdents(int, char *, size_t) __RENAME(__getdents30);
int alphasort(const void *, const void *) __RENAME(__alphasort30);
#endif
#endif /* defined(_NETBSD_SOURCE) */
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_DIRENT_H_ */

49
include/disktab.h Normal file
View File

@@ -0,0 +1,49 @@
/* $NetBSD: disktab.h,v 1.10 2005/02/03 04:39:32 perry Exp $ */
/*
* Copyright (c) 1983, 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.
*
* @(#)disktab.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _DISKTAB_H_
#define _DISKTAB_H_
#include <sys/cdefs.h>
/*
* Disk description table, see disktab(5)
*/
#define _PATH_DISKTAB "/etc/disktab"
__BEGIN_DECLS
int setdisktab(const char *);
struct disklabel *getdiskbyname(const char *);
__END_DECLS
#endif /* !_DISKTAB_H_ */

113
include/dlfcn.h Normal file
View File

@@ -0,0 +1,113 @@
/* $NetBSD: dlfcn.h,v 1.22 2010/12/24 12:41:42 skrll Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Paul Kranenburg.
*
* 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 _DLFCN_H_
#define _DLFCN_H_
#include <sys/featuretest.h>
#include <sys/cdefs.h>
#if defined(_NETBSD_SOURCE)
typedef struct _dl_info {
const char *dli_fname; /* File defining the symbol */
void *dli_fbase; /* Base address */
const char *dli_sname; /* Symbol name */
const void *dli_saddr; /* Symbol address */
} Dl_info;
#endif /* defined(_NETBSD_SOURCE) */
/*
* User interface to the run-time linker.
*/
__BEGIN_DECLS
void *dlopen(const char *, int);
int dlclose(void *);
void *dlsym(void * __restrict, const char * __restrict);
#if defined(_NETBSD_SOURCE)
int dladdr(const void * __restrict, Dl_info * __restrict);
int dlctl(void *, int, void *);
int dlinfo(void *, int, void *);
#endif
__aconst char *dlerror(void);
__END_DECLS
/* Values for dlopen `mode'. */
#define RTLD_LAZY 1
#define RTLD_NOW 2
#define RTLD_GLOBAL 0x100 /* Allow global searches in object */
#define RTLD_LOCAL 0x200
#define RTLD_NODELETE 0x01000 /* Do not remove members. */
#define RTLD_NOLOAD 0x02000 /* Do not load if not already loaded. */
#if defined(_NETBSD_SOURCE)
#define DL_LAZY RTLD_LAZY /* Compat */
#endif
/*
* Special handle arguments for dlsym().
*/
#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
#define RTLD_SELF ((void *) -3) /* Search the caller itself. */
/*
* dlctl() commands
*/
#if defined(_NETBSD_SOURCE)
#define DL_GETERRNO 1
#define DL_GETSYMBOL 2
#if 0
#define DL_SETSRCHPATH x
#define DL_GETLIST x
#define DL_GETREFCNT x
#define DL_GETLOADADDR x
#endif /* 0 */
#endif /* defined(_NETBSD_SOURCE) */
/*
* dlinfo() commands
*
* From Solaris: http://docs.sun.com/app/docs/doc/816-5168/dlinfo-3c?a=view
*/
#if defined(_NETBSD_SOURCE)
#define RTLD_DI_LINKMAP 3
#if 0
#define RTLD_DI_ARGSINFO 1
#define RTLD_DI_CONFIGADDR 2
#define RTLD_DI_LMID 4
#define RTLD_DI_SERINFO 5
#define RTLD_DI_SERINFOSIZE 6
#define RTLD_DI_ORIGIN 7
#define RTLD_DI_GETSIGNAL 8
#define RTLD_DI_SETSIGNAL 9
#endif
#endif /* _NETBSD_SOURCE */
#endif /* !defined(_DLFCN_H_) */

9
include/env.h Normal file
View File

@@ -0,0 +1,9 @@
#ifdef __NBSD_LIBC
#include <minix/ansi.h>
#endif
_PROTOTYPE( int env_parse, (char *env, char *fmt, int field,
long *param, long min, long max) );
_PROTOTYPE( void env_panic, (char *env) );
_PROTOTYPE( int env_prefix, (char *env, char *prefix) );
_PROTOTYPE( int env_memory_parse, (struct memory *chunks, int nchunks) );

View File

@@ -1,4 +1,4 @@
/* $NetBSD: err.h,v 1.14 2005/02/03 04:39:32 perry Exp $ */
/* $NetBSD: err.h,v 1.15 2010/02/25 18:37:12 joerg Exp $ */
/*-
* Copyright (c) 1993
@@ -41,30 +41,26 @@
* for utilities to have to include one of them to include err.h, so we get
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
*/
#ifdef __minix
#include <minix/ansi.h>
#else
#include <machine/ansi.h>
#endif
#include <sys/cdefs.h>
__BEGIN_DECLS
__dead void err(int, const char *, ...)
__attribute__((__noreturn__, __format__(__printf__, 2, 3)));
__printflike(2, 3) __dead;
__dead void verr(int, const char *, _BSD_VA_LIST_)
__attribute__((__noreturn__, __format__(__printf__, 2, 0)));
__printflike(2, 0) __dead;
__dead void errx(int, const char *, ...)
__attribute__((__noreturn__, __format__(__printf__, 2, 3)));
__printflike(2, 3) __dead;
__dead void verrx(int, const char *, _BSD_VA_LIST_)
__attribute__((__noreturn__, __format__(__printf__, 2, 0)));
__printflike(2, 0) __dead;
void warn(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
__printflike(1, 2);
void vwarn(const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__, 1, 0)));
__printflike(1, 0);
void warnx(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
__printflike(1, 2);
void vwarnx(const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__, 1, 0)));
__printflike(1, 0);
__END_DECLS
#endif /* !_ERR_H_ */

View File

@@ -1,135 +1,66 @@
/* 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.
/* $NetBSD: errno.h,v 1.11 2008/03/03 06:57:48 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* 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:
* 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.
*
* #define EPERM (_SIGN 1)
* 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 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).
* from: @(#)errno.h 8.5 (Berkeley) 1/21/94
*/
#ifndef _ERRNO_H /* check if <errno.h> is already included */
#define _ERRNO_H /* it is not included; note that fact */
#ifndef _ERRNO_H_
#define _ERRNO_H_
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
# define _SIGN -
# define OK 0
#else
# define _SIGN
#include <sys/cdefs.h>
#include <sys/errno.h>
#include <sys/featuretest.h>
__BEGIN_DECLS
/* note: this appears in both errno.h and signal.h */
#ifndef __errno
int *__errno(void);
#define __errno __errno
#endif
extern int errno; /* place where the error numbers go */
#ifndef errno
#define errno (*__errno())
#endif
/* Here are the numerical values of the error numbers. */
#define _NERROR 70 /* number of errors */
#if defined(_NETBSD_SOURCE)
#ifndef __LIBC12_SOURCE__
extern const int sys_nerr __RENAME(__sys_nerr14);
extern const char *const *sys_errlist __RENAME(__sys_errlist14);
#endif
#endif
__END_DECLS
#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 EFTYPE (_SIGN 45) /* wrong file format or type */
#define EOVERFLOW (_SIGN 46) /* value too large to store 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 EPFNOSUPPORT (_SIGN 78) /* Protocol family not supported */
#define EDESTADDRREQ (_SIGN 79) /* Destination address required */
#define EHOSTDOWN (_SIGN 80) /* Host down */
/* 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 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 are non-POSIX server responses */
#define EBADEPT (_SIGN 301) /* specified endpoint is bad */
#define EDEADEPT (_SIGN 302) /* specified endpoint is not alive */
#define EBADCPU (_SIGN 1000) /* requested CPU does not work */
#endif /* _ERRNO_H */
#endif /* !_ERRNO_H_ */

View File

@@ -1,79 +0,0 @@
/* The <fcntl.h> header is needed by the open() and fcntl() system calls,
* which have a variety of parameters and flags. They are described here.
* The formats of the calls to each of these are:
*
* open(path, oflag [,mode]) open a file
* fcntl(fd, cmd [,arg]) get or set file attributes
*
*/
#ifndef _FCNTL_H
#define _FCNTL_H
#ifndef _TYPES_H
#include <minix/types.h>
#endif
/* 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 */
/* L_type values for record locking with fcntl(). POSIX Table 6-3. */
#define F_RDLCK 1 /* shared or read lock */
#define F_WRLCK 2 /* exclusive or write lock */
#define F_UNLCK 3 /* unlock */
/* 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 */
/* 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
*/
/* File access modes for open() and fcntl(). POSIX Table 6-6. */
#define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */
#define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */
#define O_RDWR 2 /* open(name, O_RDWR) opens read/write */
/* Mask for use with file access modes. POSIX Table 6-7. */
#define O_ACCMODE 03 /* mask for file access modes */
/* Struct used for locking. POSIX Table 6-8. */
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 */
};
/* Function Prototypes. */
_PROTOTYPE( int creat, (const char *_path, mode_t _mode) );
_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
_PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
/* For locking files. */
#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 */
_PROTOTYPE( int flock, (int fd, int mode) );
#endif /* _FCNTL_H */

View File

@@ -1,21 +1,62 @@
#ifndef _FENV_H
#define _FENV_H
#include <stdint.h>
#define FE_TONEAREST 1
#define FE_DOWNWARD 2
#define FE_UPWARD 3
#define FE_TOWARDZERO 4
typedef struct
{
u16_t cw;
u16_t sw;
} fenv_t;
int feholdexcept(fenv_t *envp);
int fegetround(void);
int fesetround(int round);
/* $NetBSD: fenv.h,v 1.2 2010/08/02 17:49:04 joerg Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#if !defined(__i386__) && !defined(__amd64__)
#error "fenv.h is currently not supported for this architecture"
#endif
#ifndef _FENV_H_
#define _FENV_H_
#include <machine/fenv.h>
__BEGIN_DECLS
/* Function prototypes */
int feclearexcept(int);
int fegetexceptflag(fexcept_t *, int);
int feraiseexcept(int);
int fesetexceptflag(const fexcept_t *, int);
int fetestexcept(int);
int fegetround(void);
int fesetround(int);
int fegetenv(fenv_t *);
int feholdexcept(fenv_t *);
int fesetenv(const fenv_t *);
int feupdateenv(const fenv_t *);
#if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
int feenableexcept(int mask);
int fedisableexcept(int mask);
int fegetexcept(void);
#endif /* _NETBDS_SOURCE || _GNU_SOURCE */
__END_DECLS
#endif /* ! _FENV_H_ */

187
include/fetch.h Normal file
View File

@@ -0,0 +1,187 @@
/* $NetBSD: fetch.h,v 1.16 2010/01/22 13:21:09 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* 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
* in this position and unchanged.
* 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. 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.
*
* $FreeBSD: fetch.h,v 1.26 2004/09/21 18:35:20 des Exp $
*/
#ifndef _FETCH_H_INCLUDED
#define _FETCH_H_INCLUDED
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#define _LIBFETCH_VER "libfetch/2.0"
#define URL_HOSTLEN 255
#define URL_SCHEMELEN 16
#define URL_USERLEN 256
#define URL_PWDLEN 256
typedef struct fetchIO fetchIO;
struct url {
char scheme[URL_SCHEMELEN + 1];
char user[URL_USERLEN + 1];
char pwd[URL_PWDLEN + 1];
char host[URL_HOSTLEN + 1];
int port;
char *doc;
off_t offset;
size_t length;
time_t last_modified;
};
struct url_stat {
off_t size;
time_t atime;
time_t mtime;
};
struct url_list {
size_t length;
size_t alloc_size;
struct url *urls;
};
/* Recognized schemes */
#define SCHEME_FTP "ftp"
#define SCHEME_HTTP "http"
#define SCHEME_HTTPS "https"
#define SCHEME_FILE "file"
/* Error codes */
#define FETCH_ABORT 1
#define FETCH_AUTH 2
#define FETCH_DOWN 3
#define FETCH_EXISTS 4
#define FETCH_FULL 5
#define FETCH_INFO 6
#define FETCH_MEMORY 7
#define FETCH_MOVED 8
#define FETCH_NETWORK 9
#define FETCH_OK 10
#define FETCH_PROTO 11
#define FETCH_RESOLV 12
#define FETCH_SERVER 13
#define FETCH_TEMP 14
#define FETCH_TIMEOUT 15
#define FETCH_UNAVAIL 16
#define FETCH_UNKNOWN 17
#define FETCH_URL 18
#define FETCH_VERBOSE 19
#define FETCH_UNCHANGED 20
#if defined(__cplusplus)
extern "C" {
#endif
void fetchIO_close(fetchIO *);
ssize_t fetchIO_read(fetchIO *, void *, size_t);
ssize_t fetchIO_write(fetchIO *, const void *, size_t);
/* fetchIO-specific functions */
fetchIO *fetchXGetFile(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetFile(struct url *, const char *);
fetchIO *fetchPutFile(struct url *, const char *);
int fetchStatFile(struct url *, struct url_stat *, const char *);
int fetchListFile(struct url_list *, struct url *, const char *,
const char *);
/* HTTP-specific functions */
fetchIO *fetchXGetHTTP(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetHTTP(struct url *, const char *);
fetchIO *fetchPutHTTP(struct url *, const char *);
int fetchStatHTTP(struct url *, struct url_stat *, const char *);
int fetchListHTTP(struct url_list *, struct url *, const char *,
const char *);
/* FTP-specific functions */
fetchIO *fetchXGetFTP(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetFTP(struct url *, const char *);
fetchIO *fetchPutFTP(struct url *, const char *);
int fetchStatFTP(struct url *, struct url_stat *, const char *);
int fetchListFTP(struct url_list *, struct url *, const char *,
const char *);
/* Generic functions */
fetchIO *fetchXGetURL(const char *, struct url_stat *, const char *);
fetchIO *fetchGetURL(const char *, const char *);
fetchIO *fetchPutURL(const char *, const char *);
int fetchStatURL(const char *, struct url_stat *, const char *);
int fetchListURL(struct url_list *, const char *, const char *,
const char *);
fetchIO *fetchXGet(struct url *, struct url_stat *, const char *);
fetchIO *fetchGet(struct url *, const char *);
fetchIO *fetchPut(struct url *, const char *);
int fetchStat(struct url *, struct url_stat *, const char *);
int fetchList(struct url_list *, struct url *, const char *,
const char *);
/* URL parsing */
struct url *fetchMakeURL(const char *, const char *, int,
const char *, const char *, const char *);
struct url *fetchParseURL(const char *);
struct url *fetchCopyURL(const struct url *);
char *fetchStringifyURL(const struct url *);
void fetchFreeURL(struct url *);
/* URL listening */
void fetchInitURLList(struct url_list *);
int fetchAppendURLList(struct url_list *, const struct url_list *);
void fetchFreeURLList(struct url_list *);
char *fetchUnquotePath(struct url *);
char *fetchUnquoteFilename(struct url *);
/* Connection caching */
void fetchConnectionCacheInit(int, int);
void fetchConnectionCacheClose(void);
/* Authentication */
typedef int (*auth_t)(struct url *);
extern auth_t fetchAuthMethod;
/* Last error code */
extern int fetchLastErrCode;
#define MAXERRSTRING 256
extern char fetchLastErrString[MAXERRSTRING];
/* I/O timeout */
extern int fetchTimeout;
/* Restart interrupted syscalls */
extern volatile int fetchRestartCalls;
/* Extra verbosity */
extern int fetchDebug;
#if defined(__cplusplus)
}
#endif
#endif

View File

@@ -1,42 +0,0 @@
/* The <float.h> header defines some implementation limits for (IEEE) floating
* point. Application programs can use it to find out how big and small
* floating-point numbers can be, what epsilon to use for iteration, etc.
*/
#ifndef _FLOAT_H
#define _FLOAT_H
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07F
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38F
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38F
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.7976931348623157e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_DIG 15
#define LDBL_EPSILON 2.2204460492503131e-16L
#define LDBL_MANT_DIG 53
#define LDBL_MAX 1.7976931348623157e+308L
#define LDBL_MAX_10_EXP 308
#define LDBL_MAX_EXP 1024
#define LDBL_MIN 2.2250738585072014e-308L
#define LDBL_MIN_10_EXP -307
#define LDBL_MIN_EXP -1021
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#endif /* _FLOAT_H */

81
include/fmtmsg.h Normal file
View File

@@ -0,0 +1,81 @@
/* $NetBSD: fmtmsg.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
/*-
* Copyright (c) 1999 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 _FMTMSG_H_
#define _FMTMSG_H_
/* Major Classifications: identifies the source of the condition. */
#define MM_HARD 0x01L /* Hardware */
#define MM_SOFT 0x02L /* Software */
#define MM_FIRM 0x03L /* Firmware */
/* Message Source Subclassifications: type of software. */
#define MM_APPL 0x04L /* Application */
#define MM_UTIL 0x08L /* Utility */
#define MM_OPSYS 0x0cL /* Operating system */
/* Display Subclassifications: where to display the message. */
#define MM_PRINT 0x10L /* Display on standard error */
#define MM_CONSOLE 0x20L /* Display on system console */
/* Status subclassifications: whether the application will recover. */
#define MM_RECOVER 0x40L /* Recoverable */
#define MM_NRECOV 0x80L /* Non-recoverable */
/* Severity: seriousness of the condition. */
#define MM_NOSEV 0 /* No severity level provided */
#define MM_HALT 1 /* Error causing application to halt */
#define MM_ERROR 2 /* Encountered a non-fatal fault */
#define MM_WARNING 3 /* Unusual non-error condition */
#define MM_INFO 4 /* Informative message */
/* `Null' values for message components. */
#define MM_NULLMC 0L /* `Null' classsification component */
#define MM_NULLLBL (char *)0 /* `Null' label component */
#define MM_NULLSEV 0 /* `Null' severity component */
#define MM_NULLTXT (char *)0 /* `Null' text component */
#define MM_NULLACT (char *)0 /* `Null' action component */
#define MM_NULLTAG (char *)0 /* `Null' tag component */
/* Return values for fmtmsg(). */
#define MM_OK 0 /* Function succeeded */
#define MM_NOTOK (-1) /* Function failed completely */
#define MM_NOMSG 0x01 /* Unable to perform MM_PRINT */
#define MM_NOCON 0x02 /* Unable to perform MM_CONSOLE */
#include <sys/cdefs.h>
__BEGIN_DECLS
int fmtmsg(long, const char *, int, const char *, const char *,
const char *);
__END_DECLS
#endif /* !_FMTMSG_H_ */

View File

@@ -1,5 +1,4 @@
/* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
/* $NetBSD: fnmatch.h,v 1.12 2005/02/03 04:39:32 perry Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -35,19 +34,23 @@
#ifndef _FNMATCH_H_
#define _FNMATCH_H_
#include <sys/featuretest.h>
#define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOSYS 2 /* Function not supported (unused). */
#define FNM_NOSYS 2 /* Function not implemented. */
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
#if defined(_NETBSD_SOURCE)
#define FNM_CASEFOLD 0x08 /* Pattern is matched case-insensitive */
#define FNM_LEADING_DIR 0x10 /* Ignore /<tail> after Imatch. */
#endif
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
#define FNM_IGNORECASE FNM_CASEFOLD
#define FNM_FILE_NAME FNM_PATHNAME
#include <sys/cdefs.h>
__BEGIN_DECLS
int fnmatch(const char *, const char *, int);
__END_DECLS
#endif /* !_FNMATCH_H_ */

78
include/fstab.h Normal file
View File

@@ -0,0 +1,78 @@
/* $NetBSD: fstab.h,v 1.11 2005/02/03 04:39:32 perry Exp $ */
/*
* Copyright (c) 1980, 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.
*
* @(#)fstab.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _FSTAB_H_
#define _FSTAB_H_
#include <sys/cdefs.h>
/*
* File system table, see fstab(5).
*
* Used by dump, mount, umount, swapon, fsck, df, ...
*
* For ufs fs_spec field is the block special name. Programs that want to
* use the character special name must create that name by prepending a 'r'
* after the right most slash. Quota files are always named "quotas", so
* if type is "rq", then use concatenation of fs_file and "quotas" to locate
* quota file.
*/
#define _PATH_FSTAB "/etc/fstab"
#define FSTAB "/etc/fstab" /* deprecated */
#define FSTAB_RW "rw" /* read/write device */
#define FSTAB_RQ "rq" /* read/write with quotas */
#define FSTAB_RO "ro" /* read-only device */
#define FSTAB_SW "sw" /* swap device */
#define FSTAB_DP "dp" /* dump device */
#define FSTAB_XX "xx" /* ignore totally */
struct fstab {
__aconst char *fs_spec; /* block special device name */
__aconst char *fs_file; /* file system path prefix */
__aconst char *fs_vfstype; /* File system type, ufs, nfs */
__aconst char *fs_mntops; /* Mount options ala -o */
__aconst char *fs_type; /* FSTAB_* from fs_mntops */
int fs_freq; /* dump frequency, in days */
int fs_passno; /* pass number on parallel fsck */
};
__BEGIN_DECLS
struct fstab *getfsent(void);
struct fstab *getfsspec(const char *);
struct fstab *getfsfile(const char *);
int setfsent(void);
void endfsent(void);
__END_DECLS
#endif /* !_FSTAB_H_ */

View File

@@ -1,3 +1,5 @@
/* $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -10,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 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.
*
@@ -31,12 +29,33 @@
* SUCH DAMAGE.
*
* @(#)fts.h 8.3 (Berkeley) 8/14/94
* $FreeBSD: src/include/fts.h,v 1.11 2005/01/07 00:06:20 pjd Exp $
*/
#ifndef _FTS_H_
#define _FTS_H_
#ifndef __fts_stat_t
#define __fts_stat_t struct stat
#endif
#ifndef __fts_nlink_t
#define __fts_nlink_t nlink_t
#endif
#ifndef __fts_ino_t
#define __fts_ino_t ino_t
#endif
#ifndef __fts_length_t
#define __fts_length_t unsigned int
#endif
#ifndef __fts_number_t
#define __fts_number_t int64_t
#endif
#ifndef __fts_dev_t
#define __fts_dev_t dev_t
#endif
#ifndef __fts_level_t
#define __fts_level_t int
#endif
typedef struct {
struct _ftsent *fts_cur; /* current node */
struct _ftsent *fts_child; /* linked list of children */
@@ -44,10 +63,10 @@ typedef struct {
dev_t fts_dev; /* starting device # */
char *fts_path; /* path for this descent */
int fts_rfd; /* fd for root */
int fts_pathlen; /* sizeof(path) */
int fts_nitems; /* elements in the sort array */
unsigned int fts_pathlen; /* sizeof(path) */
unsigned int fts_nitems; /* elements in the sort array */
int (*fts_compar) /* compare function */
(const struct _ftsent * const *, const struct _ftsent * const *);
(const struct _ftsent **, const struct _ftsent **);
#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
#define FTS_LOGICAL 0x002 /* logical walk */
@@ -56,44 +75,36 @@ typedef struct {
#define FTS_PHYSICAL 0x010 /* physical walk */
#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
#define FTS_XDEV 0x040 /* don't cross devices */
#ifndef __minix
#define FTS_WHITEOUT 0x080 /* return whiteout information */
#endif
#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
#define FTS_NAMEONLY 0x100 /* (private) child names only */
#define FTS_STOP 0x200 /* (private) unrecoverable error */
int fts_options; /* fts_open options, global flags */
void *fts_clientptr; /* thunk for sort function */
} FTS;
typedef struct _ftsent {
struct _ftsent *fts_cycle; /* cycle node */
struct _ftsent *fts_parent; /* parent directory */
struct _ftsent *fts_link; /* next file in directory */
union {
struct {
long __fts_number; /* local numeric value */
void *__fts_pointer; /* local address value */
} __struct_ftsent;
#if 0
int64_t __fts_bignum;
#endif
} __union_ftsent;
#define fts_number __union_ftsent.__struct_ftsent.__fts_number
#define fts_pointer __union_ftsent.__struct_ftsent.__fts_pointer
#define fts_bignum __union_ftsent.__fts_bignum
__fts_number_t fts_number; /* local numeric value */
void *fts_pointer; /* local address value */
char *fts_accpath; /* access path */
char *fts_path; /* root path */
int fts_errno; /* errno for this node */
int fts_symfd; /* fd for symlink */
u_short fts_pathlen; /* strlen(fts_path) */
u_short fts_namelen; /* strlen(fts_name) */
__fts_length_t fts_pathlen; /* strlen(fts_path) */
__fts_length_t fts_namelen; /* strlen(fts_name) */
ino_t fts_ino; /* inode */
dev_t fts_dev; /* device */
nlink_t fts_nlink; /* link count */
__fts_ino_t fts_ino; /* inode */
__fts_dev_t fts_dev; /* device */
__fts_nlink_t fts_nlink; /* link count */
#define FTS_ROOTPARENTLEVEL -1
#define FTS_ROOTLEVEL 0
short fts_level; /* depth (-1 to N) */
__fts_level_t fts_level; /* depth (-1 to N) */
#define FTS_D 1 /* preorder directory */
#define FTS_DC 2 /* directory that causes cycles */
@@ -109,34 +120,34 @@ typedef struct _ftsent {
#define FTS_SL 12 /* symbolic link */
#define FTS_SLNONE 13 /* symbolic link without target */
#define FTS_W 14 /* whiteout object */
u_short fts_info; /* user flags for FTSENT structure */
unsigned short fts_info; /* user flags for FTSENT structure */
#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
#define FTS_ISW 0x04 /* this is a whiteout object */
u_short fts_flags; /* private flags for FTSENT structure */
unsigned short fts_flags; /* private flags for FTSENT structure */
#define FTS_AGAIN 1 /* read node again */
#define FTS_FOLLOW 2 /* follow symbolic link */
#define FTS_NOINSTR 3 /* no instructions */
#define FTS_SKIP 4 /* discard node */
u_short fts_instr; /* fts_set() instructions */
unsigned short fts_instr; /* fts_set() instructions */
struct stat *fts_statp; /* stat(2) information */
char *fts_name; /* file name */
FTS *fts_fts; /* back pointer to main FTS */
__fts_stat_t *fts_statp; /* stat(2) information */
char fts_name[1]; /* file name */
} FTSENT;
FTSENT *fts_children(FTS *, int);
int fts_close(FTS *);
void *fts_get_clientptr(FTS *);
#define fts_get_clientptr(fts) ((fts)->fts_clientptr)
FTS *fts_get_stream(FTSENT *);
#define fts_get_stream(ftsent) ((ftsent)->fts_fts)
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifndef __LIBC12_SOURCE__
FTSENT *fts_children(FTS *, int) __RENAME(__fts_children60);
int fts_close(FTS *) __RENAME(__fts_close60);
FTS *fts_open(char * const *, int,
int (*)(const FTSENT * const *, const FTSENT * const *));
FTSENT *fts_read(FTS *);
int fts_set(FTS *, FTSENT *, int);
void fts_set_clientptr(FTS *, void *);
int (*)(const FTSENT **, const FTSENT **)) __RENAME(__fts_open60);
FTSENT *fts_read(FTS *) __RENAME(__fts_read60);
int fts_set(FTS *, FTSENT *, int) __RENAME(__fts_set60);
#endif
__END_DECLS
#endif /* !_FTS_H_ */

62
include/ftw.h Normal file
View File

@@ -0,0 +1,62 @@
/* $NetBSD: ftw.h,v 1.1 2005/12/30 23:07:33 agc Exp $ */
/* From OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Sponsored in part by the Defense Advanced Research Projects
* Agency (DARPA) and Air Force Research Laboratory, Air Force
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
#ifndef _FTW_H
#define _FTW_H
#include <sys/types.h>
#include <sys/stat.h>
/*
* Valid flags for the 3rd argument to the function that is passed as the
* second argument to ftw(3) and nftw(3). Say it three times fast!
*/
#define FTW_F 0 /* File. */
#define FTW_D 1 /* Directory. */
#define FTW_DNR 2 /* Directory without read permission. */
#define FTW_DP 3 /* Directory with subdirectories visited. */
#define FTW_NS 4 /* Unknown type; stat() failed. */
#define FTW_SL 5 /* Symbolic link. */
#define FTW_SLN 6 /* Sym link that names a nonexistent file. */
/*
* Flags for use as the 4th argument to nftw(3). These may be ORed together.
*/
#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */
#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */
#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */
#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */
struct FTW {
int base;
int level;
};
__BEGIN_DECLS
int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
int nftw(const char *, int (*)(const char *, const struct stat *, int,
struct FTW *), int, int);
__END_DECLS
#endif /* !_FTW_H */

View File

@@ -1,3 +1,5 @@
/* $NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +37,22 @@
#ifndef _GLOB_H_
#define _GLOB_H_
struct stat;
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef __gl_size_t
#define __gl_size_t size_t
#endif
#ifndef __gl_stat_t
#define __gl_stat_t struct stat
#endif
typedef struct {
int gl_pathc; /* Count of total paths so far. */
int gl_matchc; /* Count of paths matching pattern. */
int gl_offs; /* Reserved at beginning of gl_pathv. */
__gl_size_t gl_pathc; /* Count of total paths so far. */
__gl_size_t gl_matchc; /* Count of paths matching pattern. */
__gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */
int gl_flags; /* Copy of flags parameter to glob. */
char **gl_pathv; /* List of paths matching pattern. */
/* Copy of errfunc parameter to glob. */
@@ -53,8 +66,8 @@ typedef struct {
void (*gl_closedir)(void *);
struct dirent *(*gl_readdir)(void *);
void *(*gl_opendir)(const char *);
int (*gl_lstat)(const char *, struct stat *);
int (*gl_stat)(const char *, struct stat *);
int (*gl_lstat)(const char *, __gl_stat_t *);
int (*gl_stat)(const char *, __gl_stat_t *);
} glob_t;
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
@@ -67,23 +80,34 @@ typedef struct {
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
#define GLOB_ABORTED (-2) /* Unignored error. */
#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
#define GLOB_NOSYS (-4) /* Function not supported. */
#define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */
#define GLOB_NOSYS (-4) /* Implementation does not support function. */
#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
#define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */
#define GLOB_ABEND GLOB_ABORTED /* backward compatibility */
/* GLOB_NOESCAPE 0x1000 above */
#define GLOB_PERIOD 0x2000 /* Allow metachars to match leading periods. */
#define GLOB_NO_DOTDIRS 0x4000 /* Make . and .. vanish from wildcards. */
#define GLOB_STAR 0x8000 /* Use glob ** to recurse directories */
#define GLOB_QUOTE 0 /* source compatibility */
#define GLOB_ABEND GLOB_ABORTED /* source compatibility */
#endif
int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree(glob_t *);
__BEGIN_DECLS
#ifndef __LIBC12_SOURCE__
int glob(const char * __restrict, int,
int (*)(const char *, int), glob_t * __restrict) __RENAME(__glob30);
void globfree(glob_t *) __RENAME(__globfree30);
#endif
#ifdef _NETBSD_SOURCE
int glob_pattern_p(const char *, int);
#endif
__END_DECLS
#endif /* !_GLOB_H_ */

View File

@@ -1,29 +1,84 @@
/* The <grp.h> header is used for the getgrid() and getgrnam() calls. */
/* $NetBSD: grp.h,v 1.24 2007/10/19 15:58:52 christos Exp $ */
#ifndef _GRP_H
#define _GRP_H
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)grp.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _TYPES_H
#include <minix/types.h>
#ifndef _GRP_H_
#define _GRP_H_
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/types.h>
#if defined(_NETBSD_SOURCE)
#define _PATH_GROUP "/etc/group"
#endif
struct group {
char *gr_name; /* the name of the group */
char *gr_passwd; /* the group passwd */
gid_t gr_gid; /* the numerical group ID */
char **gr_mem; /* a vector of pointers to the members */
struct group {
__aconst char *gr_name; /* group name */
__aconst char *gr_passwd; /* group password */
gid_t gr_gid; /* group id */
__aconst char *__aconst *gr_mem; /* group members */
};
/* Function Prototypes. */
_PROTOTYPE( struct group *getgrgid, (gid_t _gid) );
_PROTOTYPE( struct group *getgrnam, (const char *_name) );
#ifdef _MINIX
_PROTOTYPE( void endgrent, (void) );
_PROTOTYPE( struct group *getgrent, (void) );
_PROTOTYPE( int setgrent, (void) );
_PROTOTYPE( void setgrfile, (const char *_file) );
_PROTOTYPE( const char *group_from_gid, (gid_t, int) );
__BEGIN_DECLS
struct group *getgrgid(gid_t);
struct group *getgrnam(const char *);
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
defined(_REENTRANT) || defined(_NETBSD_SOURCE)
int getgrgid_r(gid_t, struct group *, char *, size_t,
struct group **);
int getgrnam_r(const char *, struct group *, char *, size_t,
struct group **);
#endif
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
#endif
#if defined(_NETBSD_SOURCE)
void setgrfile(const char *);
int setgroupent(int);
int getgrent_r(struct group *, char *, size_t, struct group **);
const char *group_from_gid(gid_t, int);
int gid_from_group(const char *, gid_t *);
int pwcache_groupdb(int (*)(int), void (*)(void),
struct group * (*)(const char *),
struct group * (*)(gid_t));
#endif
__END_DECLS
#endif /* _GRP_H */
#endif /* !_GRP_H_ */

1477
include/heimdal/config.h Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More