.if defined(__MINIX)
SUBDIR+= arch sys minix
-SUBDIR+= net netinet netinet6
+SUBDIR+= net
SUBDIR+= ddekit
.else
SUBDIR+= ../common/include/ppath
+++ /dev/null
-# $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $
-.include <bsd.own.mk>
-
-INCSDIR= /usr/include/arm
-
-INCS= ansi.h asm.h bswap.h byte_swap.h cdefs.h \
- endian.h endian_machdep.h float.h ieee.h \
- ieeefp.h int_const.h int_fmtio.h int_limits.h \
- int_mwgwtypes.h int_types.h limits.h lock.h \
- math.h mcontext.h param.h profile.h \
- setjmp.h signal.h stdarg.h types.h \
- vmparam.h wchar_limits.h \
- archconst.h archtypes.h cpu.h diskparm.h \
- interrupt.h memory.h multiboot.h partition.h \
- stackframe.h vm.h elf.h elf_machdep.h mutex.h \
- disklabel.h ipcconst.h
-
-
-.include <bsd.kinc.mk>
+++ /dev/null
-/* $NetBSD: cdefs.h,v 1.4 2012/01/20 14:08:05 joerg Exp $ */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__)
-#define _ARM_ARCH_6
-#endif
-
-#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5__) || \
- defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5TE__) || \
- defined (__ARM_ARCH_5TEJ__)
-#define _ARM_ARCH_5
-#endif
-
-#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
-#define _ARM_ARCH_4T
-#endif
-
-#define __ALIGNBYTES (sizeof(int) - 1)
-
-#endif /* !_MACHINE_CDEFS_H_ */
+++ /dev/null
-#ifndef _ARM_VMPARAM_H_
-#define _ARM_VMPARAM_H_
-
-/*
- * Machine dependent constants for ARM.
- */
-
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#endif /* _ARM_VMPARAM_H_ */
--- /dev/null
+
+INCSDIR= /usr/include/arm
+
+INCS= archconst.h archtypes.h diskparm.h elf.h interrupt.h \
+ ipcconst.h memory.h multiboot.h partition.h \
+ stackframe.h stdarg.h vm.h
+
+.include <bsd.kinc.mk>
# $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
-SUBDIR= include ../x86/include
+SUBDIR= include
.include <bsd.subdir.mk>
-# $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 \
- archconst.h archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
- interrupt.h memory.h multiboot.h partition.h \
- pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \
- ports.h stackframe.h vm.h elf.h elf_machdep.h mutex.h \
- disklabel.h ipcconst.h
-
+INCS= archconst.h archtypes.h bios.h cmos.h cpu.h \
+ diskparm.h elf.h fpu.h int86.h interrupt.h \
+ ipcconst.h memory.h partition.h \
+ pci_amd.h pci.h pci_intel.h pci_sis.h \
+ pci_via.h ports.h stackframe.h stdarg.h vm.h
.include <bsd.kinc.mk>
+
+++ /dev/null
-.include <bsd.own.mk>
-.PATH: ${NETBSDSRCDIR}/common/include/arch/i386
-
-INCS+= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
- interrupt.h memory.h multiboot.h partition.h \
- pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \
- ports.h stackframe.h vm.h elf.h elf_machdep.h mutex.h \
- disklabel.h
-
+++ /dev/null
-/* $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_ */
+++ /dev/null
-#ifndef _IBM_CPU_H
-#define _IBM_CPU_H 1
-
-#define X86_FLAG_C (1L << 0) /* S Carry */
-#define X86_FLAG_P (1L << 2) /* S Parity */
-#define X86_FLAG_A (1L << 4) /* S Aux. carry */
-#define X86_FLAG_Z (1L << 6) /* S Zero */
-#define X86_FLAG_S (1L << 7) /* S Sign */
-
-#define X86_FLAG_T (1L << 8) /* X Trap */
-#define X86_FLAG_I (1L << 9) /* X Interrupt */
-#define X86_FLAG_D (1L << 10) /* C Direction */
-#define X86_FLAG_O (1L << 11) /* S Overflow */
-
-/* User flags are S (Status) and C (Control) flags. */
-#define X86_FLAGS_USER (X86_FLAG_C | X86_FLAG_P | X86_FLAG_A | X86_FLAG_Z | \
- X86_FLAG_S | X86_FLAG_D | X86_FLAG_O)
-
-#endif
+++ /dev/null
-#ifndef __MULTIBOOT_H__
-#define __MULTIBOOT_H__
-
-#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-
-#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
-
-/* Must pass memory information to OS. */
-#define MULTIBOOT_PAGE_ALIGN 0x00000001
-
-#define MULTIBOOT_MEMORY_INFO 0x00000002
-
-#define MULTIBOOT_VIDEO_MODE 0x00000004
-
-#define MULTIBOOT_AOUT_KLUDGE 0x00010000
-
-/* consts used for Multiboot pre-init */
-
-#define MULTIBOOT_VIDEO_MODE_EGA 1
-
-#define MULTIBOOT_VIDEO_BUFFER 0xB8000
-
-/* Usable lower memory chunk has a upper bound */
-#define MULTIBOOT_LOWER_MEM_MAX 0x7f800
-
-#define MULTIBOOT_CONSOLE_LINES 25
-#define MULTIBOOT_CONSOLE_COLS 80
-
-#define MULTIBOOT_VIDEO_BUFFER_BYTES \
- (MULTIBOOT_CONSOLE_LINES*MULTIBOOT_CONSOLE_COLS*2)
-
-#define MULTIBOOT_STACK_SIZE 4096
-#define MULTIBOOT_PARAM_BUF_SIZE 1024
-
-#define MULTIBOOT_MAX_MODS 20
-
-/* Flags to be set in the ’flags’ member of the multiboot info structure. */
-
-#define MULTIBOOT_INFO_MEMORY 0x00000001
-#define MULTIBOOT_INFO_MEM_MAP 0x00000040
-
-/* Is there a boot device set? */
-#define MULTIBOOT_INFO_BOOTDEV 0x00000002
-
-/* Is the command-line defined? */
-#define MULTIBOOT_INFO_CMDLINE 0x00000004
-
-/* Are there modules to do something with? */
-#define MULTIBOOT_INFO_MODS 0x00000008
-
-#define MULTIBOOT_HIGH_MEM_BASE 0x100000
-
-#ifndef __ASSEMBLY__
-
-#include <sys/types.h>
-/* The symbol table for a.out. */
-struct multiboot_aout_symbol_table
-{
- u32_t tabsize;
- u32_t strsize;
- u32_t addr;
- u32_t reserved;
-};
-/* The section header table for ELF. */
-struct multiboot_elf_section_header_table
-{
- u32_t num;
- u32_t size;
- u32_t addr;
- u32_t shndx;
-};
-
-typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
-typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
-
-struct multiboot_info
-{
- /* Multiboot info version number */
- u32_t flags;
- /* Available memory from BIOS */
- u32_t mem_lower_unused; /* minix uses memmap instead */
- u32_t mem_upper_unused;
- /* "root" partition */
- u32_t boot_device;
- /* Kernel command line */
- u32_t cmdline;
- /* Boot-Module list */
- u32_t mods_count;
- u32_t mods_addr;
- union
- {
- multiboot_aout_symbol_table_t aout_sym;
- multiboot_elf_section_header_table_t elf_sec;
- } u;
- /* Memory Mapping buffer */
- u32_t mmap_length;
- u32_t mmap_addr;
- /* Drive Info buffer */
- u32_t drives_length;
- u32_t drives_addr;
- /* ROM configuration table */
- u32_t config_table;
- /* Boot Loader Name */
- u32_t boot_loader_name;
- /* APM table */
- u32_t apm_table;
- /* Video */
- u32_t vbe_control_info;
- u32_t vbe_mode_info;
- u16_t vbe_mode;
- u16_t vbe_interface_seg;
- u16_t vbe_interface_off;
- u16_t vbe_interface_len;
-};
-typedef struct multiboot_info multiboot_info_t;
-
-struct multiboot_mod_list
-{
- /* Memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
- u32_t mod_start;
- u32_t mod_end;
- /* Module command line */
- u32_t cmdline;
- /* Pad struct to 16 bytes (must be zero) */
- u32_t pad;
-};
-typedef struct multiboot_mod_list multiboot_module_t;
-
-#define MULTIBOOT_MEMORY_AVAILABLE 1
-#define MULTIBOOT_MEMORY_RESERVED 2
-struct multiboot_mmap_entry
-{
- u32_t size;
- u64_t addr;
- u64_t len;
-#define MULTIBOOT_MEMORY_AVAILABLE 1
-#define MULTIBOOT_MEMORY_RESERVED 2
- u32_t type;
-} __attribute__((packed));
-typedef struct multiboot_mmap_entry multiboot_memory_map_t;
-
-#endif /* __ASSEMBLY__ */
-#endif /* __MULTIBOOT_H__ */
+++ /dev/null
-# $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>
INCSDIR= /usr/include/net
-INCS+= hton.h ethertypes.h if.h if_ether.h netlib.h
+INCS+= hton.h if.h netlib.h
SUBDIR+= gen
+++ /dev/null
-/* $NetBSD: in.h,v 1.86 2009/09/14 10:36:50 degroote Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)in.h 8.3 (Berkeley) 1/3/94
- */
-
-/*
- * Constants and structures defined by the internet system,
- * Per RFC 790, September 1981, and numerous additions.
- */
-
-#ifndef _NETINET_IN_H_
-#define _NETINET_IN_H_
-
-#include <machine/int_types.h>
-
-#ifndef uint8_t
-typedef __uint8_t uint8_t;
-#define uint8_t __uint8_t
-#endif
-
-#ifndef uint32_t
-typedef __uint32_t uint32_t;
-#define uint32_t __uint32_t
-#endif
-
-#include <sys/ansi.h>
-
-#ifndef in_addr_t
-typedef __in_addr_t in_addr_t;
-#define in_addr_t __in_addr_t
-#endif
-
-#ifndef in_port_t
-typedef __in_port_t in_port_t;
-#define in_port_t __in_port_t
-#endif
-
-#ifndef sa_family_t
-typedef __sa_family_t sa_family_t;
-#define sa_family_t __sa_family_t
-#endif
-
-/*
- * Protocols
- */
-#define IPPROTO_IP 0 /* dummy for IP */
-#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
-#define IPPROTO_ICMP 1 /* control message protocol */
-#define IPPROTO_IGMP 2 /* group mgmt protocol */
-#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
-#define IPPROTO_IPV4 4 /* IP header */
-#define IPPROTO_IPIP 4 /* IP inside IP */
-#define IPPROTO_TCP 6 /* tcp */
-#define IPPROTO_EGP 8 /* exterior gateway protocol */
-#define IPPROTO_PUP 12 /* pup */
-#define IPPROTO_UDP 17 /* user datagram protocol */
-#define IPPROTO_IDP 22 /* xns idp */
-#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
-#define IPPROTO_IPV6 41 /* IP6 header */
-#define IPPROTO_ROUTING 43 /* IP6 routing header */
-#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
-#define IPPROTO_RSVP 46 /* resource reservation */
-#define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */
-#define IPPROTO_ESP 50 /* encap. security payload */
-#define IPPROTO_AH 51 /* authentication header */
-#define IPPROTO_MOBILE 55 /* IP Mobility RFC 2004 */
-#define IPPROTO_IPV6_ICMP 58 /* IPv6 ICMP */
-#define IPPROTO_ICMPV6 58 /* ICMP6 */
-#define IPPROTO_NONE 59 /* IP6 no next header */
-#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
-#define IPPROTO_EON 80 /* ISO cnlp */
-#define IPPROTO_ETHERIP 97 /* Ethernet-in-IP */
-#define IPPROTO_ENCAP 98 /* encapsulation header */
-#define IPPROTO_PIM 103 /* Protocol indep. multicast */
-#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */
-#define IPPROTO_VRRP 112 /* VRRP RFC 2338 */
-#define IPPROTO_CARP 112 /* Common Address Resolution Protocol */
-#define IPPROTO_PFSYNC 240 /* PFSYNC */
-#define IPPROTO_RAW 255 /* raw IP packet */
-#define IPPROTO_MAX 256
-
-/* last return value of *_input(), meaning "all job for this pkt is done". */
-#define IPPROTO_DONE 257
-
-/* sysctl placeholder for (FAST_)IPSEC */
-#define CTL_IPPROTO_IPSEC 258
-
-
-/*
- * Local port number conventions:
- *
- * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
- * unless a kernel is compiled with IPNOPRIVPORTS defined.
- *
- * When a user does a bind(2) or connect(2) with a port number of zero,
- * a non-conflicting local port address is chosen.
- *
- * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
- * that is settable by sysctl(3); net.inet.ip.anonportmin and
- * net.inet.ip.anonportmax respectively.
- *
- * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
- * default assignment range.
- *
- * The value IP_PORTRANGE_DEFAULT causes the default behavior.
- *
- * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
- * and exists only for FreeBSD compatibility purposes.
- *
- * The value IP_PORTRANGE_LOW changes the range to the "low" are
- * that is (by convention) restricted to privileged processes.
- * This convention is based on "vouchsafe" principles only.
- * It is only secure if you trust the remote host to restrict these ports.
- * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
- */
-
-#define IPPORT_RESERVED 1024
-#define IPPORT_ANONMIN 49152
-#define IPPORT_ANONMAX 65535
-#define IPPORT_RESERVEDMIN 600
-#define IPPORT_RESERVEDMAX (IPPORT_RESERVED-1)
-
-/*
- * Internet address (a structure for historical reasons)
- */
-struct in_addr {
- in_addr_t s_addr;
-} __packed;
-
-/*
- * Definitions of bits in internet address integers.
- * On subnets, the decomposition of addresses to host and net parts
- * is done according to subnet mask, not the masks here.
- *
- * By byte-swapping the constants, we avoid ever having to byte-swap IP
- * addresses inside the kernel. Unfortunately, user-level programs rely
- * on these macros not doing byte-swapping.
- */
-#ifdef _KERNEL
-#define __IPADDR(x) ((uint32_t) htonl((uint32_t)(x)))
-#else
-#define __IPADDR(x) ((uint32_t)(x))
-#endif
-
-#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \
- __IPADDR(0x00000000))
-#define IN_CLASSA_NET __IPADDR(0xff000000)
-#define IN_CLASSA_NSHIFT 24
-#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
-#define IN_CLASSA_MAX 128
-
-#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
- __IPADDR(0x80000000))
-#define IN_CLASSB_NET __IPADDR(0xffff0000)
-#define IN_CLASSB_NSHIFT 16
-#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
-#define IN_CLASSB_MAX 65536
-
-#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
- __IPADDR(0xc0000000))
-#define IN_CLASSC_NET __IPADDR(0xffffff00)
-#define IN_CLASSC_NSHIFT 8
-#define IN_CLASSC_HOST __IPADDR(0x000000ff)
-
-#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
- __IPADDR(0xe0000000))
-/* These ones aren't really net and host fields, but routing needn't know. */
-#define IN_CLASSD_NET __IPADDR(0xf0000000)
-#define IN_CLASSD_NSHIFT 28
-#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
-#define IN_MULTICAST(i) IN_CLASSD(i)
-
-#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
- __IPADDR(0xf0000000))
-#define IN_BADCLASS(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
- __IPADDR(0xf0000000))
-
-#define IN_LINKLOCAL(i) (((uint32_t)(i) & __IPADDR(0xffff0000)) == \
- __IPADDR(0xa9fe0000))
-
-#define IN_PRIVATE(i) ((((uint32_t)(i) & __IPADDR(0xff000000)) == \
- __IPADDR(0x0a000000)) || \
- (((uint32_t)(i) & __IPADDR(0xfff00000)) == \
- __IPADDR(0xac100000)) || \
- (((uint32_t)(i) & __IPADDR(0xffff0000)) == \
- __IPADDR(0xc0a80000)))
-
-#define IN_LOCAL_GROUP(i) (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
- __IPADDR(0xe0000000))
-
-#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
-
-#define INADDR_ANY __IPADDR(0x00000000)
-#define INADDR_LOOPBACK __IPADDR(0x7f000001)
-#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
-#define INADDR_NONE __IPADDR(0xffffffff) /* -1 return */
-
-#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */
-#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */
-#define INADDR_ALLRTRS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */
-#define INADDR_CARP_GROUP __IPADDR(0xe0000012) /* 224.0.0.18 */
-#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */
-
-#define IN_LOOPBACKNET 127 /* official! */
-
-/*
- * Socket address, internet style.
- */
-#ifdef __minix
-struct sockaddr_in
-{
- sa_family_t sin_family;
- in_port_t sin_port;
- struct in_addr sin_addr;
-};
-#else /* !__minix */
-struct sockaddr_in {
- uint8_t sin_len;
- sa_family_t sin_family;
- in_port_t sin_port;
- struct in_addr sin_addr;
- __int8_t sin_zero[8];
-};
-#endif /* !__minix */
-
-#define INET_ADDRSTRLEN 16
-
-#ifndef __minix
-/*
- * Structure used to describe IP options.
- * Used to store options internally, to pass them to a process,
- * or to restore options retrieved earlier.
- * The ip_dst is used for the first-hop gateway when using a source route
- * (this gets put into the header proper).
- */
-struct ip_opts {
- struct in_addr ip_dst; /* first hop, 0 w/o src rt */
-#if defined(__cplusplus)
- __int8_t Ip_opts[40]; /* actually variable in size */
-#else
- __int8_t ip_opts[40]; /* actually variable in size */
-#endif
-};
-#endif /* __minix */
-
-/*
- * Options for use with [gs]etsockopt at the IP level.
- * First word of comment is data type; bool is stored in int.
- */
-#ifndef __minix
-#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
-#define IP_HDRINCL 2 /* int; header is included with data */
-#define IP_TOS 3 /* int; IP type of service and preced. */
-#define IP_TTL 4 /* int; IP time to live */
-#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
-#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
-#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
-#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
-#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
-#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
-#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
-#endif /* !__minix */
-#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
-#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
-#ifndef __minix
-#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */
-#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
-#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */
-#if 1 /*IPSEC*/
-#define IP_IPSEC_POLICY 22 /* struct; get/set security policy */
-#endif
-#define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */
-#define IP_MINTTL 24 /* minimum TTL for packet or drop */
-#endif /* !__minix */
-
-#ifndef __minix
-/*
- * Defaults and limits for options
- */
-#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
-#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
-#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
-#endif /* !__minix */
-
-/*
- * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
- */
-struct ip_mreq {
- struct in_addr imr_multiaddr; /* IP multicast address of group */
- struct in_addr imr_interface; /* local IP address of interface */
-};
-
-#ifndef __minix
-/*
- * Argument for IP_PORTRANGE:
- * - which range to search when port is unspecified at bind() or connect()
- */
-#define IP_PORTRANGE_DEFAULT 0 /* default range */
-#define IP_PORTRANGE_HIGH 1 /* same as DEFAULT (FreeBSD compat) */
-#define IP_PORTRANGE_LOW 2 /* use privileged range */
-
-#if defined(_NETBSD_SOURCE)
-/*
- * Definitions for inet sysctl operations.
- *
- * Third level is protocol number.
- * Fourth level is desired variable within that protocol.
- */
-#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
-
-#define CTL_IPPROTO_NAMES { \
- { "ip", CTLTYPE_NODE }, \
- { "icmp", CTLTYPE_NODE }, \
- { "igmp", CTLTYPE_NODE }, \
- { "ggp", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "tcp", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { "egp", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "pup", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "udp", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "idp", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "ipsec", CTLTYPE_NODE }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "pim", CTLTYPE_NODE }, \
-}
-
-/*
- * Names for IP sysctl objects
- */
-#define IPCTL_FORWARDING 1 /* act as router */
-#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
-#define IPCTL_DEFTTL 3 /* default TTL */
-#ifdef notyet
-#define IPCTL_DEFMTU 4 /* default MTU */
-#endif
-#define IPCTL_FORWSRCRT 5 /* forward source-routed packets */
-#define IPCTL_DIRECTEDBCAST 6 /* default broadcast behavior */
-#define IPCTL_ALLOWSRCRT 7 /* allow/drop all source-routed pkts */
-#define IPCTL_SUBNETSARELOCAL 8 /* treat subnets as local addresses */
-#define IPCTL_MTUDISC 9 /* allow path MTU discovery */
-#define IPCTL_ANONPORTMIN 10 /* minimum ephemeral port */
-#define IPCTL_ANONPORTMAX 11 /* maximum ephemeral port */
-#define IPCTL_MTUDISCTIMEOUT 12 /* allow path MTU discovery */
-#define IPCTL_MAXFLOWS 13 /* maximum ip flows allowed */
-#define IPCTL_HOSTZEROBROADCAST 14 /* is host zero a broadcast addr? */
-#define IPCTL_GIF_TTL 15 /* default TTL for gif encap packet */
-#define IPCTL_LOWPORTMIN 16 /* minimum reserved port */
-#define IPCTL_LOWPORTMAX 17 /* maximum reserved port */
-#define IPCTL_MAXFRAGPACKETS 18 /* max packets reassembly queue */
-#define IPCTL_GRE_TTL 19 /* default TTL for gre encap packet */
-#define IPCTL_CHECKINTERFACE 20 /* drop pkts in from 'wrong' iface */
-#define IPCTL_IFQ 21 /* ipintrq node */
-#define IPCTL_RANDOMID 22 /* use random IP ids (if configured) */
-#define IPCTL_LOOPBACKCKSUM 23 /* do IP checksum on loopback */
-#define IPCTL_STATS 24 /* IP statistics */
-#define IPCTL_MAXID 25
-
-#define IPCTL_NAMES { \
- { 0, 0 }, \
- { "forwarding", CTLTYPE_INT }, \
- { "redirect", CTLTYPE_INT }, \
- { "ttl", CTLTYPE_INT }, \
- { "mtu", CTLTYPE_INT }, \
- { "forwsrcrt", CTLTYPE_INT }, \
- { "directed-broadcast", CTLTYPE_INT }, \
- { "allowsrcrt", CTLTYPE_INT }, \
- { "subnetsarelocal", CTLTYPE_INT }, \
- { "mtudisc", CTLTYPE_INT }, \
- { "anonportmin", CTLTYPE_INT }, \
- { "anonportmax", CTLTYPE_INT }, \
- { "mtudisctimeout", CTLTYPE_INT }, \
- { "maxflows", CTLTYPE_INT }, \
- { "hostzerobroadcast", CTLTYPE_INT }, \
- { "gifttl", CTLTYPE_INT }, \
- { "lowportmin", CTLTYPE_INT }, \
- { "lowportmax", CTLTYPE_INT }, \
- { "maxfragpackets", CTLTYPE_INT }, \
- { "grettl", CTLTYPE_INT }, \
- { "checkinterface", CTLTYPE_INT }, \
- { "ifq", CTLTYPE_NODE }, \
- { "random_id", CTLTYPE_INT }, \
- { "do_loopback_cksum", CTLTYPE_INT }, \
- { "stats", CTLTYPE_STRUCT }, \
-}
-#endif /* _NETBSD_SOURCE */
-#endif /* __minix */
-
-/* INET6 stuff */
-#define __KAME_NETINET_IN_H_INCLUDED_
-#include <netinet6/in6.h>
-#undef __KAME_NETINET_IN_H_INCLUDED_
-
-#endif /* !_NETINET_IN_H_ */
-# $NetBSD: Makefile,v 1.143 2012/02/19 21:06:57 rmind Exp $
-
-.include <bsd.sys.mk>
INCSDIR= /usr/include/sys
-# Present only in minix
-INCS+= ioc_net.h statfs.h
-
-INCS+= ansi.h atomic.h \
- bitops.h bswap.h \
- cdefs.h cdefs_aout.h cdefs_elf.h ctype_bits.h ctype_inline.h \
- dirent.h \
- endian.h errno.h \
- fcntl.h fd_set.h featuretest.h file.h \
- float_ieee754.h gcq.h gmon.h hash.h \
- ieee754.h inttypes.h ioctl.h ipc.h \
- localedef.h lock.h \
- md4.h md5.h \
- mman.h mount.h \
- null.h \
- param.h poll.h ptrace.h \
- ptree.h \
- queue.h \
- rbtree.h resource.h rmd160.h \
- select.h sha1.h \
- sha2.h siginfo.h signal.h sigtypes.h \
- ras.h reboot.h sem.h shm.h socket.h \
- stat.h statvfs.h \
- sysctl.h stdint.h \
- syslimits.h syslog.h \
- termios.h time.h times.h \
- tree.h ttycom.h ttydefaults.h \
- types.h \
- ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
- extattr.h \
- wait.h exec.h
-
-# Present only in minix
-INCS+= ioc_net.h statfs.h
-INCS+= elf64.h elf_common.h elf_generic.h \
- ioc_block.h ioc_fbd.h ioc_file.h ioc_tape.h ioc_disk.h \
- ioc_memory.h ioc_sound.h ioc_tty.h \
- kbdio.h mtio.h svrctl.h video.h vm.h procfs.h elf_core.h exec_elf.h \
- disk.h dkio.h ioccom.h mutex.h iostat.h disklabel.h disklabel_gpt.h \
- bootblock.h dkbad.h
-
-INCSYMLINKS=\
- sys/fcntl.h /usr/include/fcntl.h \
- sys/poll.h /usr/include/poll.h \
- sys/stdint.h /usr/include/stdint.h \
- sys/syslog.h /usr/include/syslog.h \
- sys/termios.h /usr/include/termios.h \
- sys/rmd160.h /usr/include/rmd160.h \
- sys/sha1.h /usr/include/sha1.h \
- sys/sha2.h /usr/include/sha2.h \
- sys/md4.h /usr/include/md4.h \
- sys/md5.h /usr/include/md5.h
-
-#INCSYMLINKS+= ../soundcard.h ${INCSDIR}/soundcard.h
-
-namei: namei.src gennameih.awk
- ${TOOL_AWK} -f gennameih.awk < namei.src
+# Minix specific system headers
+INCS= elf64.h elf_common.h elf_core.h elf_generic.h \
+ ioc_block.h ioc_disk.h ioc_fbd.h ioc_file.h ioc_memory.h ioc_net.h \
+ ioc_sound.h ioc_tape.h ioc_tty.h \
+ kbdio.h \
+ procfs.h statfs.h svrctl.h video.h vm.h
.include <bsd.kinc.mk>
+++ /dev/null
-/* $NetBSD: disklabel.h,v 1.111 2011/11/13 22:19:09 christos Exp $ */
-
-/*
- * Copyright (c) 1987, 1988, 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.
- *
- * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- */
-
-#ifndef _SYS_DISKLABEL_H_
-#define _SYS_DISKLABEL_H_
-
-/*
- * We need <machine/types.h> for __HAVE_OLD_DISKLABEL
- */
-#ifndef _LOCORE
-#include <sys/types.h>
-#endif
-
-/*
- * Each disk has a label which includes information about the hardware
- * disk geometry, filesystem partitions, and drive specific information.
- * The location of the label, as well as the number of partitions the
- * label can describe and the number of the "whole disk" (raw)
- * paritition are machine dependent.
- */
-#if HAVE_NBTOOL_CONFIG_H
-#include <nbinclude/machine/disklabel.h>
-#else
-#include <machine/disklabel.h>
-#endif /* HAVE_NBTOOL_CONFIG_H */
-
-/*
- * The absolute maximum number of disk partitions allowed.
- * This is the maximum value of MAXPARTITIONS for which 'struct disklabel'
- * is <= DEV_BSIZE bytes long. If MAXPARTITIONS is greater than this, beware.
- */
-#define MAXMAXPARTITIONS 22
-#if MAXPARTITIONS > MAXMAXPARTITIONS
-#warning beware: MAXPARTITIONS bigger than MAXMAXPARTITIONS
-#endif
-
-/*
- * Ports can switch their MAXPARTITIONS once, as follows:
- *
- * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
- * - define MAXPARTITIONS as the new number
- * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
- * as appropriate for the port (see the i386 one for an example).
- * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
- */
-
-#if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
- (MAXPARTITIONS < OLDMAXPARTITIONS)
-#error "can only grow disklabel size"
-#endif
-
-
-/*
- * Translate between device numbers and major/disk unit/disk partition.
- */
-#ifndef __HAVE_OLD_DISKLABEL
-#if !HAVE_NBTOOL_CONFIG_H
-#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
-#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
-#define DISKMINOR(unit, part) \
- (((unit) * MAXPARTITIONS) + (part))
-#endif /* !HAVE_NBTOOL_CONFIG_H */
-#endif
-#define MAKEDISKDEV(maj, unit, part) \
- (makedev((maj), DISKMINOR((unit), (part))))
-
-#define DISKMAGIC ((uint32_t)0x82564557) /* The disk magic number */
-
-#ifndef _LOCORE
-struct disklabel {
- uint32_t d_magic; /* the magic number */
- uint16_t d_type; /* drive type */
- uint16_t d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
-
- /*
- * d_packname contains the pack identifier and is returned when
- * the disklabel is read off the disk or in-core copy.
- * d_boot0 and d_boot1 are the (optional) names of the
- * primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /usr/mdec. These are returned when using
- * getdiskbyname(3) to retrieve the values from /etc/disktab.
- */
- union {
- char un_d_packname[16]; /* pack identifier */
- struct {
- char *un_d_boot0; /* primary bootstrap name */
- char *un_d_boot1; /* secondary bootstrap name */
- } un_b;
- uint64_t un_d_pad; /* force 8 byte alignment */
- } d_un;
-#define d_packname d_un.un_d_packname
-#define d_boot0 d_un.un_b.un_d_boot0
-#define d_boot1 d_un.un_b.un_d_boot1
-
- /* disk geometry: */
- uint32_t d_secsize; /* # of bytes per sector */
- uint32_t d_nsectors; /* # of data sectors per track */
- uint32_t d_ntracks; /* # of tracks per cylinder */
- uint32_t d_ncylinders; /* # of data cylinders per unit */
- uint32_t d_secpercyl; /* # of data sectors per cylinder */
- uint32_t d_secperunit; /* # of data sectors per unit */
-
- /*
- * Spares (bad sector replacements) below are not counted in
- * d_nsectors or d_secpercyl. Spare sectors are assumed to
- * be physical sectors which occupy space at the end of each
- * track and/or cylinder.
- */
- uint16_t d_sparespertrack; /* # of spare sectors per track */
- uint16_t d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternative cylinders include maintenance, replacement,
- * configuration description areas, etc.
- */
- uint32_t d_acylinders; /* # of alt. cylinders per unit */
-
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the
- * formatter or controller when formatting. When interleaving is
- * in use, logically adjacent sectors are not physically
- * contiguous, but instead are separated by some number of
- * sectors. It is specified as the ratio of physical sectors
- * traversed per logical sector. Thus an interleave of 1:1
- * implies contiguous layout, while 2:1 implies that logical
- * sector 0 is separated by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N relative to
- * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
- * is the offset of sector 0 on cylinder N relative to sector 0
- * on cylinder N-1.
- */
- uint16_t d_rpm; /* rotational speed */
- uint16_t d_interleave; /* hardware sector interleave */
- uint16_t d_trackskew; /* sector 0 skew, per track */
- uint16_t d_cylskew; /* sector 0 skew, per cylinder */
- uint32_t d_headswitch; /* head switch time, usec */
- uint32_t d_trkseek; /* track-to-track seek, usec */
- uint32_t d_flags; /* generic flags */
-#define NDDATA 5
- uint32_t d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- uint32_t d_spare[NSPARE]; /* reserved for future use */
- uint32_t d_magic2; /* the magic number (again) */
- uint16_t d_checksum; /* xor of data incl. partitions */
-
- /* filesystem and partition information: */
- uint16_t d_npartitions; /* number of partitions in following */
- uint32_t d_bbsize; /* size of boot area at sn0, bytes */
- uint32_t d_sbsize; /* max size of fs superblock, bytes */
-#ifndef __minix
- struct partition { /* the partition table */
- uint32_t p_size; /* number of sectors in partition */
- uint32_t p_offset; /* starting sector */
- union {
- uint32_t fsize; /* FFS, ADOS:
- filesystem basic fragment size */
- uint32_t cdsession; /* ISO9660: session offset */
- } __partition_u2;
-#define p_fsize __partition_u2.fsize
-#define p_cdsession __partition_u2.cdsession
- uint8_t p_fstype; /* filesystem type, see below */
- uint8_t p_frag; /* filesystem fragments per block */
- union {
- uint16_t cpg; /* UFS: FS cylinders per group */
- uint16_t sgs; /* LFS: FS segment shift */
- } __partition_u1;
-#define p_cpg __partition_u1.cpg
-#define p_sgs __partition_u1.sgs
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-#endif
-};
-
-#if defined(__HAVE_OLD_DISKLABEL) && !HAVE_NBTOOL_CONFIG_H
-/*
- * Same as above, but with OLDMAXPARTITIONS partitions. For use in
- * the old DIOC* ioctl calls.
- */
-struct olddisklabel {
- uint32_t d_magic;
- uint16_t d_type;
- uint16_t d_subtype;
- char d_typename[16];
- union {
- char un_d_packname[16];
- struct {
- char *un_d_boot0;
- char *un_d_boot1;
- } un_b;
- } d_un;
- uint32_t d_secsize;
- uint32_t d_nsectors;
- uint32_t d_ntracks;
- uint32_t d_ncylinders;
- uint32_t d_secpercyl;
- uint32_t d_secperunit;
- uint16_t d_sparespertrack;
- uint16_t d_sparespercyl;
- uint32_t d_acylinders;
- uint16_t d_rpm;
- uint16_t d_interleave;
- uint16_t d_trackskew;
- uint16_t d_cylskew;
- uint32_t d_headswitch;
- uint32_t d_trkseek;
- uint32_t d_flags;
- uint32_t d_drivedata[NDDATA];
- uint32_t d_spare[NSPARE];
- uint32_t d_magic2;
- uint16_t d_checksum;
- uint16_t d_npartitions;
- uint32_t d_bbsize;
- uint32_t d_sbsize;
- struct opartition {
- uint32_t p_size;
- uint32_t p_offset;
- union {
- uint32_t fsize;
- uint32_t cdsession;
- } __partition_u2;
- uint8_t p_fstype;
- uint8_t p_frag;
- union {
- uint16_t cpg;
- uint16_t sgs;
- } __partition_u1;
- } d_partitions[OLDMAXPARTITIONS];
-};
-#endif /* __HAVE_OLD_DISKLABEL */
-#else /* _LOCORE */
- /*
- * offsets for asm boot files.
- */
- .set d_secsize,40
- .set d_nsectors,44
- .set d_ntracks,48
- .set d_ncylinders,52
- .set d_secpercyl,56
- .set d_secperunit,60
- .set d_end_,276 /* size of disk label */
-#endif /* _LOCORE */
-
-/*
- * We normally use C99 initialisers (just in case the lists below are out
- * of sequence, or have gaps), but lint doesn't grok them.
- * Maybe some host compilers don't either, but many have for quite some time.
- */
-
-#ifndef lint
-#define ARRAY_INIT(element,value) [element]=value
-#else
-#define ARRAY_INIT(element,value) value
-#endif
-
-/* Use pre-processor magic to get all the parameters one one line... */
-
-/* d_type values: */
-#define DKTYPE_DEFN(x) \
-x(UNKNOWN, 0, "unknown") \
-x(SMD, 1, "SMD") /* SMD, XSMD; VAX hp/up */ \
-x(MSCP, 2, "MSCP") /* MSCP */ \
-x(DEC, 3, "old DEC") /* other DEC (rk, rl) */ \
-x(SCSI, 4, "SCSI") /* SCSI */ \
-x(ESDI, 5, "ESDI") /* ESDI interface */ \
-x(ST506, 6, "ST506") /* ST506 etc. */ \
-x(HPIB, 7, "HP-IB") /* CS/80 on HP-IB */ \
-x(HPFL, 8, "HP-FL") /* HP Fiber-link */ \
-x(TYPE_9, 9, "type 9") \
-x(FLOPPY, 10, "floppy") /* floppy */ \
-x(CCD, 11, "ccd") /* concatenated disk device */ \
-x(VND, 12, "vnd") /* uvnode pseudo-disk */ \
-x(ATAPI, 13, "ATAPI") /* ATAPI */ \
-x(RAID, 14, "RAID") /* RAIDframe */ \
-x(LD, 15, "ld") /* logical disk */ \
-x(JFS2, 16, "jfs") /* IBM JFS2 */ \
-x(CGD, 17, "cgd") /* cryptographic pseudo-disk */ \
-x(VINUM, 18, "vinum") /* vinum volume */ \
-x(FLASH, 19, "flash") /* flash memory devices */ \
-x(DM, 20, "dm") /* device-mapper pseudo-disk devices */\
-x(RUMPD, 21, "rumpd") /* rump virtual disk */ \
-
-#ifndef _LOCORE
-#define DKTYPE_NUMS(tag, number, name) __CONCAT(DTYPE_,tag=number),
-#ifndef DKTYPE_ENUMNAME
-#define DKTYPE_ENUMNAME
-#endif
-enum DKTYPE_ENUMNAME { DKTYPE_DEFN(DKTYPE_NUMS) DKMAXTYPES };
-#undef DKTYPE_NUMS
-#endif
-
-#ifdef DKTYPENAMES
-#define DKTYPE_NAMES(tag, number, name) ARRAY_INIT(number,name),
-static const char *const dktypenames[] = { DKTYPE_DEFN(DKTYPE_NAMES) NULL };
-#undef DKTYPE_NAMES
-#endif
-
-/*
- * Partition type names, numbers, label-names, fsck prog, and mount prog
- */
-#define FSTYPE_DEFN(x) \
-x(UNUSED, 0, "unused", NULL, NULL) /* unused */ \
-x(SWAP, 1, "swap", NULL, NULL) /* swap */ \
-x(V6, 2, "Version 6", NULL, NULL) /* Sixth Edition */ \
-x(V7, 3, "Version 7", "v7fs", "v7fs") /* Seventh Edition */ \
-x(SYSV, 4, "System V", NULL, NULL) /* System V */ \
-x(V71K, 5, "4.1BSD", NULL, NULL) /* V7, 1K blocks (4.1, 2.9) */ \
-x(V8, 6, "Eighth Edition",NULL, NULL) /* Eighth Edition, 4K blocks */ \
-x(BSDFFS, 7, "4.2BSD", "ffs", "ffs") /* 4.2BSD fast file system */ \
-x(MSDOS, 8, "MSDOS", "msdos", "msdos") /* MSDOS file system */ \
-x(BSDLFS, 9, "4.4LFS", "lfs", "lfs") /* 4.4BSD log-structured FS */ \
-x(OTHER, 10, "unknown", NULL, NULL) /* in use, unknown/unsupported */\
-x(HPFS, 11, "HPFS", NULL, NULL) /* OS/2 high-performance FS */ \
-x(ISO9660, 12, "ISO9660", NULL, "cd9660")/* ISO 9660, normally CD-ROM */ \
-x(BOOT, 13, "boot", NULL, NULL) /* bootstrap code in partition */\
-x(ADOS, 14, "ADOS", NULL, "ados") /* AmigaDOS fast file system */ \
-x(HFS, 15, "HFS", NULL, NULL) /* Macintosh HFS */ \
-x(FILECORE,16, "FILECORE", NULL, "filecore")/* Acorn Filecore FS */ \
-x(EX2FS, 17, "Linux Ext2","ext2fs","ext2fs")/* Linux Extended 2 FS */ \
-x(NTFS, 18, "NTFS", NULL, "ntfs") /* Windows/NT file system */ \
-x(RAID, 19, "RAID", NULL, NULL) /* RAIDframe component */ \
-x(CCD, 20, "ccd", NULL, NULL) /* concatenated disk component */\
-x(JFS2, 21, "jfs", NULL, NULL) /* IBM JFS2 */ \
-x(APPLEUFS,22, "Apple UFS", "ffs", "ffs") /* Apple UFS */ \
-/* XXX this is not the same as FreeBSD. How to solve? */ \
-x(VINUM, 23, "vinum", NULL, NULL) /* Vinum */ \
-x(UDF, 24, "UDF", NULL, "udf") /* UDF */ \
-x(SYSVBFS, 25, "SysVBFS", NULL, "sysvbfs")/* System V boot file system */ \
-x(EFS, 26, "EFS", NULL, "efs") /* SGI's Extent Filesystem */ \
-x(NILFS, 27, "NiLFS", NULL, "nilfs") /* NTT's NiLFS(2) */ \
-x(CGD, 28, "cgd", NULL, NULL) /* Cryptographic disk */
-
-
-#ifndef _LOCORE
-#define FS_TYPENUMS(tag, number, name, fsck, mount) __CONCAT(FS_,tag=number),
-#ifndef FSTYPE_ENUMNAME
-#define FSTYPE_ENUMNAME
-#endif
-enum FSTYPE_ENUMNAME { FSTYPE_DEFN(FS_TYPENUMS) FSMAXTYPES };
-#undef FS_TYPENUMS
-#endif
-
-#ifdef FSTYPENAMES
-#define FS_TYPENAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,name),
-static const char *const fstypenames[] = { FSTYPE_DEFN(FS_TYPENAMES) NULL };
-#undef FS_TYPENAMES
-#endif
-
-#ifdef FSCKNAMES
-/* These are the names MOUNT_XXX from <sys/mount.h> */
-#define FS_FSCKNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,fsck),
-static const char *const fscknames[] = { FSTYPE_DEFN(FS_FSCKNAMES) NULL };
-#undef FS_FSCKNAMES
-#define FSMAXNAMES FSMAXTYPES
-#endif
-
-#ifdef MOUNTNAMES
-/* These are the names MOUNT_XXX from <sys/mount.h> */
-#define FS_MOUNTNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,mount),
-static const char *const mountnames[] = { FSTYPE_DEFN(FS_MOUNTNAMES) NULL };
-#undef FS_MOUNTNAMES
-#define FSMAXMOUNTNAMES FSMAXTYPES
-#endif
-
-/*
- * flags shared by various drives:
- */
-#define D_REMOVABLE 0x01 /* removable media */
-#define D_ECC 0x02 /* supports ECC */
-#define D_BADSECT 0x04 /* supports bad sector forw. */
-#define D_RAMDISK 0x08 /* disk emulator */
-#define D_CHAIN 0x10 /* can do back-back transfers */
-#define D_SCSI_MMC 0x20 /* SCSI MMC sessioned media */
-
-/*
- * Drive data for SMD.
- */
-#define d_smdflags d_drivedata[0]
-#define D_SSE 0x1 /* supports skip sectoring */
-#define d_mindist d_drivedata[1]
-#define d_maxdist d_drivedata[2]
-#define d_sdist d_drivedata[3]
-
-/*
- * Drive data for ST506.
- */
-#define d_precompcyl d_drivedata[0]
-#define d_gap3 d_drivedata[1] /* used only when formatting */
-
-/*
- * Drive data for SCSI.
- */
-#define d_blind d_drivedata[0]
-
-#ifndef _LOCORE
-/*
- * Structure used to perform a format or other raw operation,
- * returning data and/or register values. Register identification
- * and format are device- and driver-dependent. Currently unused.
- */
-struct format_op {
- char *df_buf;
- int df_count; /* value-result */
- daddr_t df_startblk;
- int df_reg[8]; /* result */
-};
-
-#ifdef _KERNEL
-/*
- * Structure used internally to retrieve information about a partition
- * on a disk.
- */
-struct partinfo {
- struct disklabel *disklab;
- struct partition *part;
-};
-
-struct disk;
-
-int disk_read_sectors(void (*)(struct buf *), const struct disklabel *,
- struct buf *, unsigned int, int);
-void diskerr(const struct buf *, const char *, const char *, int,
- int, const struct disklabel *);
-u_int dkcksum(struct disklabel *);
-u_int dkcksum_sized(struct disklabel *, size_t);
-int setdisklabel(struct disklabel *, struct disklabel *, u_long,
- struct cpu_disklabel *);
-const char *readdisklabel(dev_t, void (*)(struct buf *),
- struct disklabel *, struct cpu_disklabel *);
-int writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *,
- struct cpu_disklabel *);
-const char *convertdisklabel(struct disklabel *, void (*)(struct buf *),
- struct buf *, uint32_t);
-int bounds_check_with_label(struct disk *, struct buf *, int);
-int bounds_check_with_mediasize(struct buf *, int, uint64_t);
-const char *getfstypename(int);
-#endif
-#endif /* _LOCORE */
-
-#if !defined(_KERNEL) && !defined(_LOCORE)
-
-#include <sys/cdefs.h>
-
-#endif
-
-#endif /* !_SYS_DISKLABEL_H_ */
+++ /dev/null
-/* $NetBSD: exec.h,v 1.133 2011/03/04 22:25:32 joerg 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.
- *
- * 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.
- *
- * @(#)exec.h 8.4 (Berkeley) 2/19/95
- */
-
-/*-
- * 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, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Copyright (c) 1994 Christopher G. Demetriou
- *
- * 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.
- *
- * @(#)exec.h 8.4 (Berkeley) 2/19/95
- */
-
-#ifndef _SYS_EXEC_H_
-#define _SYS_EXEC_H_
-
-struct pathbuf; /* from namei.h */
-
-
-/*
- * The following structure is found at the top of the user stack of each
- * user process. The ps program uses it to locate argv and environment
- * strings. Programs that wish ps to display other information may modify
- * it; normally ps_argvstr points to argv[0], and ps_nargvstr is the same
- * as the program's argc. The fields ps_envstr and ps_nenvstr are the
- * equivalent for the environment.
- */
-struct ps_strings {
- char **ps_argvstr; /* first of 0 or more argument strings */
- int ps_nargvstr; /* the number of argument strings */
- char **ps_envstr; /* first of 0 or more environment strings */
- int ps_nenvstr; /* the number of environment strings */
-};
-
-#ifdef _KERNEL
-struct ps_strings32 {
- uint32_t ps_argvstr; /* first of 0 or more argument strings */
- int32_t ps_nargvstr; /* the number of argument strings */
- uint32_t ps_envstr; /* first of 0 or more environment strings */
- int32_t ps_nenvstr; /* the number of environment strings */
-};
-#endif
-
-/*
- * the following structures allow execve() to put together processes
- * in a more extensible and cleaner way.
- *
- * the exec_package struct defines an executable being execve()'d.
- * it contains the header, the vmspace-building commands, the vnode
- * information, and the arguments associated with the newly-execve'd
- * process.
- *
- * the exec_vmcmd struct defines a command description to be used
- * in creating the new process's vmspace.
- */
-
-#include <sys/uio.h>
-
-struct lwp;
-struct proc;
-struct exec_package;
-struct vnode;
-
-typedef int (*exec_makecmds_fcn)(struct lwp *, struct exec_package *);
-
-struct execsw {
- u_int es_hdrsz; /* size of header for this format */
- exec_makecmds_fcn es_makecmds; /* function to setup vmcmds */
- union { /* probe function */
- int (*elf_probe_func)(struct lwp *,
- struct exec_package *, void *, char *, vaddr_t *);
- int (*ecoff_probe_func)(struct lwp *, struct exec_package *);
- int (*mach_probe_func)(const char **);
- } u;
- struct emul *es_emul; /* os emulation */
- int es_prio; /* entry priority */
- int es_arglen; /* Extra argument size in words */
- /* Copy arguments on the new stack */
- int (*es_copyargs)(struct lwp *, struct exec_package *,
- struct ps_strings *, char **, void *);
- /* Set registers before execution */
- void (*es_setregs)(struct lwp *, struct exec_package *, vaddr_t);
- /* Dump core */
- int (*es_coredump)(struct lwp *, void *);
- int (*es_setup_stack)(struct lwp *, struct exec_package *);
-};
-
-#define EXECSW_PRIO_ANY 0x000 /* default, no preference */
-#define EXECSW_PRIO_FIRST 0x001 /* this should be among first */
-#define EXECSW_PRIO_LAST 0x002 /* this should be among last */
-
-/* exec vmspace-creation command set; see below */
-struct exec_vmcmd_set {
- u_int evs_cnt;
- u_int evs_used;
- struct exec_vmcmd *evs_cmds;
-};
-
-#define EXEC_DEFAULT_VMCMD_SETSIZE 9 /* # of cmds in set to start */
-
-struct exec_package {
- const char *ep_name; /* file's name */
- const char *ep_kname; /* kernel-side copy of file's name */
- char *ep_resolvedname; /* fully resolved path from namei */
- void *ep_hdr; /* file's exec header */
- u_int ep_hdrlen; /* length of ep_hdr */
- u_int ep_hdrvalid; /* bytes of ep_hdr that are valid */
- struct exec_vmcmd_set ep_vmcmds; /* vmcmds used to build vmspace */
- struct vnode *ep_vp; /* executable's vnode */
- struct vattr *ep_vap; /* executable's attributes */
- vaddr_t ep_taddr; /* process's text address */
- vsize_t ep_tsize; /* size of process's text */
- vaddr_t ep_daddr; /* process's data(+bss) address */
- vsize_t ep_dsize; /* size of process's data(+bss) */
- vaddr_t ep_maxsaddr; /* proc's max stack addr ("top") */
- vaddr_t ep_minsaddr; /* proc's min stack addr ("bottom") */
- vsize_t ep_ssize; /* size of process's stack */
- vaddr_t ep_entry; /* process's entry point */
- vaddr_t ep_vm_minaddr; /* bottom of process address space */
- vaddr_t ep_vm_maxaddr; /* top of process address space */
- u_int ep_flags; /* flags; see below. */
- size_t ep_fa_len; /* byte size of ep_fa */
- struct exec_fakearg {
- char *fa_arg;
- size_t fa_len;
- } *ep_fa; /* a fake args vector for scripts */
- int ep_fd; /* a file descriptor we're holding */
- void *ep_emul_arg; /* emulation argument */
- const struct execsw *ep_esch;/* execsw entry */
- struct vnode *ep_emul_root; /* base of emulation filesystem */
- struct vnode *ep_interp; /* vnode of (elf) interpeter */
- uint32_t ep_pax_flags; /* pax flags */
- char *ep_path; /* absolute path of executable */
-};
-#define EXEC_INDIR 0x0001 /* script handling already done */
-#define EXEC_HASFD 0x0002 /* holding a shell script */
-#define EXEC_HASARGL 0x0004 /* has fake args vector */
-#define EXEC_SKIPARG 0x0008 /* don't copy user-supplied argv[0] */
-#define EXEC_DESTR 0x0010 /* destructive ops performed */
-#define EXEC_32 0x0020 /* 32-bit binary emulation */
-#define EXEC_FORCEAUX 0x0040 /* always use ELF AUX vector */
-
-struct exec_vmcmd {
- int (*ev_proc)(struct lwp *, struct exec_vmcmd *);
- /* procedure to run for region of vmspace */
- vsize_t ev_len; /* length of the segment to map */
- vaddr_t ev_addr; /* address in the vmspace to place it at */
- struct vnode *ev_vp; /* vnode pointer for the file w/the data */
- vsize_t ev_offset; /* offset in the file for the data */
- u_int ev_prot; /* protections for segment */
- int ev_flags;
-#define VMCMD_RELATIVE 0x0001 /* ev_addr is relative to base entry */
-#define VMCMD_BASE 0x0002 /* marks a base entry */
-#define VMCMD_FIXED 0x0004 /* entry must be mapped at ev_addr */
-#define VMCMD_STACK 0x0008 /* entry is for a stack */
-};
-
-#ifdef _KERNEL
-/*
- * funtions used either by execve() or the various CPU-dependent execve()
- * hooks.
- */
-void kill_vmcmd (struct exec_vmcmd **);
-int exec_makecmds (struct lwp *, struct exec_package *);
-int exec_runcmds (struct lwp *, struct exec_package *);
-void vmcmdset_extend (struct exec_vmcmd_set *);
-void kill_vmcmds (struct exec_vmcmd_set *);
-int vmcmd_map_pagedvn (struct lwp *, struct exec_vmcmd *);
-int vmcmd_map_readvn (struct lwp *, struct exec_vmcmd *);
-int vmcmd_readvn (struct lwp *, struct exec_vmcmd *);
-int vmcmd_map_zero (struct lwp *, struct exec_vmcmd *);
-int copyargs (struct lwp *, struct exec_package *,
- struct ps_strings *, char **, void *);
-int copyin_psstrings (struct proc *, struct ps_strings *);
-int copy_procargs (struct proc *, int, size_t *,
- int (*)(void *, const void *, size_t, size_t), void *);
-void setregs (struct lwp *, struct exec_package *, vaddr_t);
-int check_veriexec (struct lwp *, struct vnode *,
- struct exec_package *, int);
-int check_exec (struct lwp *, struct exec_package *,
- struct pathbuf *);
-int exec_init (int);
-int exec_read_from (struct lwp *, struct vnode *, u_long off,
- void *, size_t);
-int exec_setup_stack (struct lwp *, struct exec_package *);
-
-int coredump_write (void *, enum uio_seg, const void *, size_t);
-/*
- * Machine dependent functions
- */
-struct core;
-struct core32;
-int cpu_coredump(struct lwp *, void *, struct core *);
-int cpu_coredump32(struct lwp *, void *, struct core32 *);
-
-int exec_add(struct execsw *, int);
-int exec_remove(struct execsw *, int);
-
-void new_vmcmd(struct exec_vmcmd_set *,
- int (*)(struct lwp *, struct exec_vmcmd *),
- vsize_t, vaddr_t, struct vnode *, u_long, u_int, int);
-#define NEW_VMCMD(evsp,lwp,len,addr,vp,offset,prot) \
- new_vmcmd(evsp,lwp,len,addr,vp,offset,prot,0)
-#define NEW_VMCMD2(evsp,lwp,len,addr,vp,offset,prot,flags) \
- new_vmcmd(evsp,lwp,len,addr,vp,offset,prot,flags)
-
-typedef int (*execve_fetch_element_t)(char * const *, size_t, char **);
-int execve1(struct lwp *, const char *, char * const *, char * const *,
- execve_fetch_element_t);
-
-extern int maxexec;
-
-#endif /* _KERNEL */
-
-#endif /* !_SYS_EXEC_H_ */
+++ /dev/null
-/* $NetBSD: exec_elf.h,v 1.117 2011/08/03 00:22:05 enami Exp $ */
-
-/*-
- * Copyright (c) 1994 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SYS_EXEC_ELF_H_
-#define _SYS_EXEC_ELF_H_
-
-/*
- * The current ELF ABI specification is available at:
- * http://www.sco.com/developers/gabi/
- *
- * Current header definitions are in:
- * http://www.sco.com/developers/gabi/latest/ch4.eheader.html
- */
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <sys/types.h>
-#else
-#include <inttypes.h>
-#endif /* _KERNEL || _STANDALONE */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include <nbinclude/machine/elf_machdep.h>
-#else
-#include <machine/elf_machdep.h>
-#endif
-
-typedef uint8_t Elf_Byte;
-
-typedef uint32_t Elf32_Addr;
-#define ELF32_FSZ_ADDR 4
-typedef uint32_t Elf32_Off;
-typedef int32_t Elf32_SOff;
-#define ELF32_FSZ_OFF 4
-typedef int32_t Elf32_Sword;
-#define ELF32_FSZ_SWORD 4
-typedef uint32_t Elf32_Word;
-#define ELF32_FSZ_WORD 4
-typedef uint16_t Elf32_Half;
-#define ELF32_FSZ_HALF 2
-typedef uint64_t Elf32_Lword;
-#define ELF32_FSZ_LWORD 8
-
-typedef uint64_t Elf64_Addr;
-#define ELF64_FSZ_ADDR 8
-typedef uint64_t Elf64_Off;
-typedef int64_t Elf64_SOff;
-#define ELF64_FSZ_OFF 8
-typedef int32_t Elf64_Shalf;
-#define ELF64_FSZ_SHALF 4
-
-typedef int32_t Elf64_Sword;
-#define ELF64_FSZ_SWORD 4
-typedef uint32_t Elf64_Word;
-#define ELF64_FSZ_WORD 4
-
-typedef int64_t Elf64_Sxword;
-#define ELF64_FSZ_SXWORD 8
-typedef uint64_t Elf64_Xword;
-#define ELF64_FSZ_XWORD 8
-typedef uint64_t Elf64_Lword;
-#define ELF64_FSZ_LWORD 8
-typedef uint16_t Elf64_Half;
-#define ELF64_FSZ_HALF 2
-
-/*
- * ELF Header
- */
-#define ELF_NIDENT 16
-
-typedef struct {
- unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
- Elf32_Half e_type; /* file type */
- Elf32_Half e_machine; /* machine type */
- Elf32_Word e_version; /* version number */
- Elf32_Addr e_entry; /* entry point */
- Elf32_Off e_phoff; /* Program hdr offset */
- Elf32_Off e_shoff; /* Section hdr offset */
- Elf32_Word e_flags; /* Processor flags */
- Elf32_Half e_ehsize; /* sizeof ehdr */
- Elf32_Half e_phentsize; /* Program header entry size */
- Elf32_Half e_phnum; /* Number of program headers */
- Elf32_Half e_shentsize; /* Section header entry size */
- Elf32_Half e_shnum; /* Number of section headers */
- Elf32_Half e_shstrndx; /* String table index */
-} Elf32_Ehdr;
-
-typedef struct {
- unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
- Elf64_Half e_type; /* file type */
- Elf64_Half e_machine; /* machine type */
- Elf64_Word e_version; /* version number */
- Elf64_Addr e_entry; /* entry point */
- Elf64_Off e_phoff; /* Program hdr offset */
- Elf64_Off e_shoff; /* Section hdr offset */
- Elf64_Word e_flags; /* Processor flags */
- Elf64_Half e_ehsize; /* sizeof ehdr */
- Elf64_Half e_phentsize; /* Program header entry size */
- Elf64_Half e_phnum; /* Number of program headers */
- Elf64_Half e_shentsize; /* Section header entry size */
- Elf64_Half e_shnum; /* Number of section headers */
- Elf64_Half e_shstrndx; /* String table index */
-} Elf64_Ehdr;
-
-/* e_ident offsets */
-#define EI_MAG0 0 /* '\177' */
-#define EI_MAG1 1 /* 'E' */
-#define EI_MAG2 2 /* 'L' */
-#define EI_MAG3 3 /* 'F' */
-#define EI_CLASS 4 /* File class */
-#define EI_DATA 5 /* Data encoding */
-#define EI_VERSION 6 /* File version */
-#define EI_OSABI 7 /* Operating system/ABI identification */
-#define EI_ABIVERSION 8 /* ABI version */
-#define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/
-#define EI_NIDENT 16 /* First non-ident header byte */
-
-/* e_ident[EI_MAG0,EI_MAG3] */
-#define ELFMAG0 0x7f
-#define ELFMAG1 'E'
-#define ELFMAG2 'L'
-#define ELFMAG3 'F'
-#define ELFMAG "\177ELF"
-#define SELFMAG 4
-
-/* e_ident[EI_CLASS] */
-#define ELFCLASSNONE 0 /* Invalid class */
-#define ELFCLASS32 1 /* 32-bit objects */
-#define ELFCLASS64 2 /* 64-bit objects */
-#define ELFCLASSNUM 3
-
-/* e_ident[EI_DATA] */
-#define ELFDATANONE 0 /* Invalid data encoding */
-#define ELFDATA2LSB 1 /* 2's complement values, LSB first */
-#define ELFDATA2MSB 2 /* 2's complement values, MSB first */
-
-/* e_ident[EI_VERSION] */
-#define EV_NONE 0 /* Invalid version */
-#define EV_CURRENT 1 /* Current version */
-#define EV_NUM 2
-
-/* e_ident[EI_OSABI] */
-#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
-#define ELFOSABI_HPUX 1 /* HP-UX operating system */
-#define ELFOSABI_NETBSD 2 /* NetBSD */
-#define ELFOSABI_LINUX 3 /* GNU/Linux */
-#define ELFOSABI_HURD 4 /* GNU/Hurd */
-#define ELFOSABI_86OPEN 5 /* 86Open */
-#define ELFOSABI_SOLARIS 6 /* Solaris */
-#define ELFOSABI_MONTEREY 7 /* Monterey */
-#define ELFOSABI_IRIX 8 /* IRIX */
-#define ELFOSABI_FREEBSD 9 /* FreeBSD */
-#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
-#define ELFOSABI_MODESTO 11 /* Novell Modesto */
-#define ELFOSABI_OPENBSD 12 /* OpenBSD */
-#define ELFOSABI_OPENVMS 13 /* OpenVMS */
-#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
-#define ELFOSABI_AROS 15 /* Amiga Research OS */
-/* Unofficial OSABIs follow */
-#define ELFOSABI_ARM 97 /* ARM */
-#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
-
-#define ELFOSABI_NONE ELFOSABI_SYSV
-#define ELFOSABI_AIX ELFOSABI_MONTEREY
-
-/* e_type */
-#define ET_NONE 0 /* No file type */
-#define ET_REL 1 /* Relocatable file */
-#define ET_EXEC 2 /* Executable file */
-#define ET_DYN 3 /* Shared object file */
-#define ET_CORE 4 /* Core file */
-#define ET_NUM 5
-
-#define ET_LOOS 0xfe00 /* Operating system specific range */
-#define ET_HIOS 0xfeff
-#define ET_LOPROC 0xff00 /* Processor-specific range */
-#define ET_HIPROC 0xffff
-
-/* e_machine */
-#define EM_NONE 0 /* No machine */
-#define EM_M32 1 /* AT&T WE 32100 */
-#define EM_SPARC 2 /* SPARC */
-#define EM_386 3 /* Intel 80386 */
-#define EM_68K 4 /* Motorola 68000 */
-#define EM_88K 5 /* Motorola 88000 */
-#define EM_486 6 /* Intel 80486 */
-#define EM_860 7 /* Intel 80860 */
-#define EM_MIPS 8 /* MIPS I Architecture */
-#define EM_S370 9 /* Amdahl UTS on System/370 */
-#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */
- /* 11-14 - Reserved */
-#define EM_RS6000 11 /* IBM RS/6000 XXX reserved */
-#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */
-#define EM_NCUBE 16 /* NCube XXX reserved */
-#define EM_VPP500 17 /* Fujitsu VPP500 */
-#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
-#define EM_960 19 /* Intel 80960 */
-#define EM_PPC 20 /* PowerPC */
-#define EM_PPC64 21 /* 64-bit PowerPC */
- /* 22-35 - Reserved */
-#define EM_S390 22 /* System/390 XXX reserved */
-#define EM_V800 36 /* NEC V800 */
-#define EM_FR20 37 /* Fujitsu FR20 */
-#define EM_RH32 38 /* TRW RH-32 */
-#define EM_RCE 39 /* Motorola RCE */
-#define EM_ARM 40 /* Advanced RISC Machines ARM */
-#define EM_ALPHA 41 /* DIGITAL Alpha */
-#define EM_SH 42 /* Hitachi Super-H */
-#define EM_SPARCV9 43 /* SPARC Version 9 */
-#define EM_TRICORE 44 /* Siemens Tricore */
-#define EM_ARC 45 /* Argonaut RISC Core */
-#define EM_H8_300 46 /* Hitachi H8/300 */
-#define EM_H8_300H 47 /* Hitachi H8/300H */
-#define EM_H8S 48 /* Hitachi H8S */
-#define EM_H8_500 49 /* Hitachi H8/500 */
-#define EM_IA_64 50 /* Intel Merced Processor */
-#define EM_MIPS_X 51 /* Stanford MIPS-X */
-#define EM_COLDFIRE 52 /* Motorola Coldfire */
-#define EM_68HC12 53 /* Motorola MC68HC12 */
-#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
-#define EM_PCP 55 /* Siemens PCP */
-#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
-#define EM_NDR1 57 /* Denso NDR1 microprocessor */
-#define EM_STARCORE 58 /* Motorola Star*Core processor */
-#define EM_ME16 59 /* Toyota ME16 processor */
-#define EM_ST100 60 /* STMicroelectronics ST100 processor */
-#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */
-#define EM_X86_64 62 /* AMD x86-64 architecture */
-#define EM_PDSP 63 /* Sony DSP Processor */
-#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
-#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
-#define EM_FX66 66 /* Siemens FX66 microcontroller */
-#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
-#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
-#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
-#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
-#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
-#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
-#define EM_SVX 73 /* Silicon Graphics SVx */
-#define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */
-#define EM_VAX 75 /* Digital VAX */
-#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
-#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */
-#define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */
-#define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */
-#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
-#define EM_HUANY 81 /* Harvard's machine-independent format */
-#define EM_PRISM 82 /* SiTera Prism */
-#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
-#define EM_FR30 84 /* Fujitsu FR30 */
-#define EM_D10V 85 /* Mitsubishi D10V */
-#define EM_D30V 86 /* Mitsubishi D30V */
-#define EM_V850 87 /* NEC v850 */
-#define EM_M32R 88 /* Mitsubishi M32R */
-#define EM_MN10300 89 /* Matsushita MN10300 */
-#define EM_MN10200 90 /* Matsushita MN10200 */
-#define EM_PJ 91 /* picoJava */
-#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
-#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
-#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
-#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
-#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
-#define EM_NS32K 97 /* National Semiconductor 32000 series */
-#define EM_TPC 98 /* Tenor Network TPC processor */
-#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
-#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */
-#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */
-#define EM_MAX 102 /* MAX processor */
-#define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */
-#define EM_F2MC16 104 /* Fujitsu F2MC16 */
-#define EM_MSP430 105 /* Texas Instruments MSP430 */
-#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */
-#define EM_SE_C33 107 /* Seiko Epson S1C33 family */
-#define EM_SEP 108 /* Sharp embedded microprocessor */
-#define EM_ARCA 109 /* Arca RISC microprocessor */
-#define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */
-
-/* Unofficial machine types follow */
-#define EM_AVR32 6317 /* used by NetBSD/avr32 */
-#define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */
-#define EM_NUM 36903
-
-/*
- * Program Header
- */
-typedef struct {
- Elf32_Word p_type; /* entry type */
- Elf32_Off p_offset; /* offset */
- Elf32_Addr p_vaddr; /* virtual address */
- Elf32_Addr p_paddr; /* physical address */
- Elf32_Word p_filesz; /* file size */
- Elf32_Word p_memsz; /* memory size */
- Elf32_Word p_flags; /* flags */
- Elf32_Word p_align; /* memory & file alignment */
-} Elf32_Phdr;
-
-typedef struct {
- Elf64_Word p_type; /* entry type */
- Elf64_Word p_flags; /* flags */
- Elf64_Off p_offset; /* offset */
- Elf64_Addr p_vaddr; /* virtual address */
- Elf64_Addr p_paddr; /* physical address */
- Elf64_Xword p_filesz; /* file size */
- Elf64_Xword p_memsz; /* memory size */
- Elf64_Xword p_align; /* memory & file alignment */
-} Elf64_Phdr;
-
-/* p_type */
-#define PT_NULL 0 /* Program header table entry unused */
-#define PT_LOAD 1 /* Loadable program segment */
-#define PT_DYNAMIC 2 /* Dynamic linking information */
-#define PT_INTERP 3 /* Program interpreter */
-#define PT_NOTE 4 /* Auxiliary information */
-#define PT_SHLIB 5 /* Reserved, unspecified semantics */
-#define PT_PHDR 6 /* Entry for header table itself */
-#define PT_TLS 7 /* TLS initialisation image */
-#define PT_NUM 8
-
-#define PT_LOOS 0x60000000 /* OS-specific range */
-
-/* GNU-specific */
-#define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */
-#define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */
-#define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */
-
-#define PT_HIOS 0x6fffffff
-#define PT_LOPROC 0x70000000 /* Processor-specific range */
-#define PT_HIPROC 0x7fffffff
-
-#define PT_MIPS_REGINFO 0x70000000
-
-/* p_flags */
-#define PF_R 0x4 /* Segment is readable */
-#define PF_W 0x2 /* Segment is writable */
-#define PF_X 0x1 /* Segment is executable */
-
-#define PF_MASKOS 0x0ff00000 /* Operating system specific values */
-#define PF_MASKPROC 0xf0000000 /* Processor-specific values */
-
-/* Extended program header index. */
-#define PN_XNUM 0xffff
-
-/*
- * Section Headers
- */
-typedef struct {
- Elf32_Word sh_name; /* section name (.shstrtab index) */
- Elf32_Word sh_type; /* section type */
- Elf32_Word sh_flags; /* section flags */
- Elf32_Addr sh_addr; /* virtual address */
- Elf32_Off sh_offset; /* file offset */
- Elf32_Word sh_size; /* section size */
- Elf32_Word sh_link; /* link to another */
- Elf32_Word sh_info; /* misc info */
- Elf32_Word sh_addralign; /* memory alignment */
- Elf32_Word sh_entsize; /* table entry size */
-} Elf32_Shdr;
-
-typedef struct {
- Elf64_Word sh_name; /* section name (.shstrtab index) */
- Elf64_Word sh_type; /* section type */
- Elf64_Xword sh_flags; /* section flags */
- Elf64_Addr sh_addr; /* virtual address */
- Elf64_Off sh_offset; /* file offset */
- Elf64_Xword sh_size; /* section size */
- Elf64_Word sh_link; /* link to another */
- Elf64_Word sh_info; /* misc info */
- Elf64_Xword sh_addralign; /* memory alignment */
- Elf64_Xword sh_entsize; /* table entry size */
-} Elf64_Shdr;
-
-/* sh_type */
-#define SHT_NULL 0 /* Section header table entry unused */
-#define SHT_PROGBITS 1 /* Program information */
-#define SHT_SYMTAB 2 /* Symbol table */
-#define SHT_STRTAB 3 /* String table */
-#define SHT_RELA 4 /* Relocation information w/ addend */
-#define SHT_HASH 5 /* Symbol hash table */
-#define SHT_DYNAMIC 6 /* Dynamic linking information */
-#define SHT_NOTE 7 /* Auxiliary information */
-#define SHT_NOBITS 8 /* No space allocated in file image */
-#define SHT_REL 9 /* Relocation information w/o addend */
-#define SHT_SHLIB 10 /* Reserved, unspecified semantics */
-#define SHT_DYNSYM 11 /* Symbol table for dynamic linker */
-#define SHT_INIT_ARRAY 14 /* Initialization function pointers */
-#define SHT_FINI_ARRAY 15 /* Termination function pointers */
-#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */
-#define SHT_GROUP 17 /* Section group */
-#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */
-#define SHT_NUM 19
-
-#define SHT_LOOS 0x60000000 /* Operating system specific range */
-#define SHT_SUNW_move 0x6ffffffa
-#define SHT_SUNW_syminfo 0x6ffffffc
-#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
-#define SHT_GNU_verdef SHT_SUNW_verdef
-#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
-#define SHT_GNU_verneed SHT_SUNW_verneed
-#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
-#define SHT_GNU_versym SHT_SUNW_versym
-#define SHT_HIOS 0x6fffffff
-#define SHT_LOPROC 0x70000000 /* Processor-specific range */
-#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
-#define SHT_HIPROC 0x7fffffff
-#define SHT_LOUSER 0x80000000 /* Application-specific range */
-#define SHT_HIUSER 0xffffffff
-
-/* sh_flags */
-#define SHF_WRITE 0x1 /* Section contains writable data */
-#define SHF_ALLOC 0x2 /* Section occupies memory */
-#define SHF_EXECINSTR 0x4 /* Section contains executable insns */
-
-#define SHF_MASKOS 0x0f000000 /* Operating system specific values */
-#define SHF_MASKPROC 0xf0000000 /* Processor-specific values */
-
-/*
- * Symbol Table
- */
-typedef struct {
- Elf32_Word st_name; /* Symbol name (.strtab index) */
- Elf32_Word st_value; /* value of symbol */
- Elf32_Word st_size; /* size of symbol */
- Elf_Byte st_info; /* type / binding attrs */
- Elf_Byte st_other; /* unused */
- Elf32_Half st_shndx; /* section index of symbol */
-} Elf32_Sym;
-
-typedef struct {
- Elf64_Word st_name; /* Symbol name (.strtab index) */
- Elf_Byte st_info; /* type / binding attrs */
- Elf_Byte st_other; /* unused */
- Elf64_Half st_shndx; /* section index of symbol */
- Elf64_Addr st_value; /* value of symbol */
- Elf64_Xword st_size; /* size of symbol */
-} Elf64_Sym;
-
-/* Symbol Table index of the undefined symbol */
-#define ELF_SYM_UNDEFINED 0
-
-#define STN_UNDEF 0 /* undefined index */
-
-/* st_info: Symbol Bindings */
-#define STB_LOCAL 0 /* local symbol */
-#define STB_GLOBAL 1 /* global symbol */
-#define STB_WEAK 2 /* weakly defined global symbol */
-#define STB_NUM 3
-
-#define STB_LOOS 10 /* Operating system specific range */
-#define STB_HIOS 12
-#define STB_LOPROC 13 /* Processor-specific range */
-#define STB_HIPROC 15
-
-/* st_info: Symbol Types */
-#define STT_NOTYPE 0 /* Type not specified */
-#define STT_OBJECT 1 /* Associated with a data object */
-#define STT_FUNC 2 /* Associated with a function */
-#define STT_SECTION 3 /* Associated with a section */
-#define STT_FILE 4 /* Associated with a file name */
-#define STT_COMMON 5 /* Uninitialised common block */
-#define STT_TLS 6 /* Thread local data object */
-#define STT_NUM 7
-
-#define STT_LOOS 10 /* Operating system specific range */
-#define STT_HIOS 12
-#define STT_LOPROC 13 /* Processor-specific range */
-#define STT_HIPROC 15
-
-/* st_other: Visibility Types */
-#define STV_DEFAULT 0 /* use binding type */
-#define STV_INTERNAL 1 /* not referenced from outside */
-#define STV_HIDDEN 2 /* not visible, may be used via ptr */
-#define STV_PROTECTED 3 /* visible, not preemptible */
-#define STV_EXPORTED 4
-#define STV_SINGLETON 5
-#define STV_ELIMINATE 6
-
-/* st_info/st_other utility macros */
-#define ELF_ST_BIND(info) ((uint32_t)(info) >> 4)
-#define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf)
-#define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \
- ((type) & 0xf)))
-#define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3)
-
-/*
- * Special section indexes
- */
-#define SHN_UNDEF 0 /* Undefined section */
-
-#define SHN_LORESERVE 0xff00 /* Reserved range */
-#define SHN_ABS 0xfff1 /* Absolute symbols */
-#define SHN_COMMON 0xfff2 /* Common symbols */
-#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */
-#define SHN_HIRESERVE 0xffff
-
-#define SHN_LOPROC 0xff00 /* Processor-specific range */
-#define SHN_HIPROC 0xff1f
-#define SHN_LOOS 0xff20 /* Operating system specific range */
-#define SHN_HIOS 0xff3f
-
-#define SHN_MIPS_ACOMMON 0xff00
-#define SHN_MIPS_TEXT 0xff01
-#define SHN_MIPS_DATA 0xff02
-#define SHN_MIPS_SCOMMON 0xff03
-
-/*
- * Relocation Entries
- */
-typedef struct {
- Elf32_Word r_offset; /* where to do it */
- Elf32_Word r_info; /* index & type of relocation */
-} Elf32_Rel;
-
-typedef struct {
- Elf32_Word r_offset; /* where to do it */
- Elf32_Word r_info; /* index & type of relocation */
- Elf32_Sword r_addend; /* adjustment value */
-} Elf32_Rela;
-
-/* r_info utility macros */
-#define ELF32_R_SYM(info) ((info) >> 8)
-#define ELF32_R_TYPE(info) ((info) & 0xff)
-#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
-
-typedef struct {
- Elf64_Addr r_offset; /* where to do it */
- Elf64_Xword r_info; /* index & type of relocation */
-} Elf64_Rel;
-
-typedef struct {
- Elf64_Addr r_offset; /* where to do it */
- Elf64_Xword r_info; /* index & type of relocation */
- Elf64_Sxword r_addend; /* adjustment value */
-} Elf64_Rela;
-
-/* r_info utility macros */
-#define ELF64_R_SYM(info) ((info) >> 32)
-#define ELF64_R_TYPE(info) ((info) & 0xffffffff)
-#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
-
-/*
- * Move entries
- */
-typedef struct {
- Elf32_Lword m_value; /* symbol value */
- Elf32_Word m_info; /* size + index */
- Elf32_Word m_poffset; /* symbol offset */
- Elf32_Half m_repeat; /* repeat count */
- Elf32_Half m_stride; /* stride info */
-} Elf32_Move;
-
-#define ELF32_M_SYM(info) ((info) >> 8)
-#define ELF32_M_SIZE(info) ((info) & 0xff)
-#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
-
-typedef struct {
- Elf64_Lword m_value; /* symbol value */
- Elf64_Xword m_info; /* size + index */
- Elf64_Xword m_poffset; /* symbol offset */
- Elf64_Word m_repeat; /* repeat count */
- Elf64_Word m_stride; /* stride info */
-} Elf64_Move;
-
-#define ELF64_M_SYM(info) ((info) >> 8)
-#define ELF64_M_SIZE(info) ((info) & 0xff)
-#define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
-
-/*
- * Hardware/software capabilities entry
- */
-typedef struct {
- Elf32_Word c_tag; /* entry tag value */
- union {
- Elf32_Addr c_ptr;
- Elf32_Word c_val;
- } c_un;
-} Elf32_Cap;
-
-typedef struct {
- Elf64_Xword c_tag; /* entry tag value */
- union {
- Elf64_Addr c_ptr;
- Elf64_Xword c_val;
- } c_un;
-} Elf64_Cap;
-
-/*
- * Dynamic Section structure array
- */
-typedef struct {
- Elf32_Word d_tag; /* entry tag value */
- union {
- Elf32_Addr d_ptr;
- Elf32_Word d_val;
- } d_un;
-} Elf32_Dyn;
-
-typedef struct {
- Elf64_Xword d_tag; /* entry tag value */
- union {
- Elf64_Addr d_ptr;
- Elf64_Xword d_val;
- } d_un;
-} Elf64_Dyn;
-
-/* d_tag */
-#define DT_NULL 0 /* Marks end of dynamic array */
-#define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */
-#define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */
-#define DT_PLTGOT 3 /* Address of PLT and/or GOT */
-#define DT_HASH 4 /* Address of symbol hash table */
-#define DT_STRTAB 5 /* Address of string table */
-#define DT_SYMTAB 6 /* Address of symbol table */
-#define DT_RELA 7 /* Address of Rela relocation table */
-#define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */
-#define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */
-#define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */
-#define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */
-#define DT_INIT 12 /* Address of initialization function */
-#define DT_FINI 13 /* Address of termination function */
-#define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */
-#define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */
-#define DT_SYMBOLIC 16 /* Start symbol search within local object */
-#define DT_REL 17 /* Address of Rel relocation table */
-#define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */
-#define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */
-#define DT_PLTREL 20 /* Type of PLT relocation entries */
-#define DT_DEBUG 21 /* Used for debugging; unspecified */
-#define DT_TEXTREL 22 /* Relocations might modify non-writable seg */
-#define DT_JMPREL 23 /* Address of relocations associated with PLT */
-#define DT_BIND_NOW 24 /* Process all relocations at load-time */
-#define DT_INIT_ARRAY 25 /* Address of initialization function array */
-#define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */
-#define DT_INIT_ARRAYSZ 27 /* Address of termination function array */
-#define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/
-#define DT_NUM 29
-
-#define DT_LOOS 0x60000000 /* Operating system specific range */
-#define DT_VERSYM 0x6ffffff0 /* Symbol versions */
-#define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */
-#define DT_VERDEF 0x6ffffffc /* Versions defined by file */
-#define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */
-#define DT_VERNEED 0x6ffffffe /* Versions needed by file */
-#define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */
-#define DT_HIOS 0x6fffffff
-#define DT_LOPROC 0x70000000 /* Processor-specific range */
-#define DT_HIPROC 0x7fffffff
-
-/* Flag values for DT_FLAGS_1 (incomplete) */
-#define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */
-#define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */
-#define DF_1_INITFIRST 0x00000020 /* Object's init/fini take priority */
-#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
-
-/*
- * Auxiliary Vectors
- */
-typedef struct {
- Elf32_Word a_type; /* 32-bit id */
- Elf32_Word a_v; /* 32-bit id */
-} Aux32Info;
-
-typedef struct {
- Elf64_Word a_type; /* 32-bit id */
- Elf64_Xword a_v; /* 64-bit id */
-} Aux64Info;
-
-/* a_type */
-#define AT_NULL 0 /* Marks end of array */
-#define AT_IGNORE 1 /* No meaning, a_un is undefined */
-#define AT_EXECFD 2 /* Open file descriptor of object file */
-#define AT_PHDR 3 /* &phdr[0] */
-#define AT_PHENT 4 /* sizeof(phdr[0]) */
-#define AT_PHNUM 5 /* # phdr entries */
-#define AT_PAGESZ 6 /* PAGESIZE */
-#define AT_BASE 7 /* Interpreter base addr */
-#define AT_FLAGS 8 /* Processor flags */
-#define AT_ENTRY 9 /* Entry address of executable */
-#define AT_DCACHEBSIZE 10 /* Data cache block size */
-#define AT_ICACHEBSIZE 11 /* Instruction cache block size */
-#define AT_UCACHEBSIZE 12 /* Unified cache block size */
-
- /* Vendor specific */
-#define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */
-
-#define AT_EUID 2000 /* euid (solaris compatible numbers) */
-#define AT_RUID 2001 /* ruid (solaris compatible numbers) */
-#define AT_EGID 2002 /* egid (solaris compatible numbers) */
-#define AT_RGID 2003 /* rgid (solaris compatible numbers) */
-
- /* Solaris kernel specific */
-#define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */
-#define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */
-#define AT_SUN_LDNAME 2006 /* dynamic linker's name */
-#define AT_SUN_LPGSIZE 2007 /* large pagesize */
-
- /* Other information */
-#define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */
-#define AT_SUN_HWCAP 2009 /* process hardware capabilities */
-#define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */
-#define AT_SUN_CPU 2011 /* CPU name */
- /* ibcs2 emulation band aid */
-#define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */
-#define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */
- /* Executable's fully resolved name */
-#define AT_SUN_EXECNAME 2014
-
-/*
- * Note Headers
- */
-typedef struct {
- Elf32_Word n_namesz;
- Elf32_Word n_descsz;
- Elf32_Word n_type;
-} Elf32_Nhdr;
-
-typedef struct {
- Elf64_Word n_namesz;
- Elf64_Word n_descsz;
- Elf64_Word n_type;
-} Elf64_Nhdr;
-
-#define ELF_NOTE_GNU_NAMESZ 4
-#define ELF_NOTE_GNU_NAME "GNU\0"
-
-/*
- * GNU-specific note type: ABI tag
- * name: GNU\0
- * namesz: 4
- * desc:
- * word[0]: OS tag
- * word[1]: major version
- * word[2]: minor version
- * word[3]: teeny version
- * descsz: 16
- */
-/* GNU-specific note name and description sizes */
-#define ELF_NOTE_TYPE_ABI_TAG 1
-#define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME
-#define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ
-#define ELF_NOTE_ABI_DESCSZ 16
-/* GNU-specific OS/version value stuff */
-#define ELF_NOTE_ABI_OS_LINUX 0
-#define ELF_NOTE_ABI_OS_HURD 1
-#define ELF_NOTE_ABI_OS_SOLARIS 2
-#define ELF_NOTE_ABI_OS_KFREEBSD 3
-#define ELF_NOTE_ABI_OS_KNETBSD 4
-
-/*
- * GNU-specific note type: Hardware capabilities
- * name: GNU\0
- * namesz: 4
- * desc:
- * word[0]: Number of entries
- * word[1]: Bitmask of enabled entries
- * Followed by a byte id, and a NUL terminated string per entry
- * descsz: variable
- */
-#define ELF_NOTE_TYPE_GNU_HWCAP 2
-
-/*
- * GNU-specific note type: Build ID generated by ld
- * name: GNU\0
- * desc:
- * word[0..4] SHA1 [default]
- * or
- * word[0..3] md5 or uuid
- * descsz: 16 or 20
- */
-#define ELF_NOTE_TYPE_GNU_BUILD_ID 3
-
-/* SuSE-specific note type: version
- * name: SuSE\0\0\0\0
- * namesz: 8
- * desc:
- * word[0] = VVTTMMmm
- *
- * V = version of following data
- * T = product type: [box, sles, nld, whatever]
- * M = product major version
- * m = product minor version
- * descsz: 8
- */
-#define ELF_NOTE_TYPE_SUSE_TAG 0x45537553 /* SuSE in LE */
-/* SuSE-specific note name and description sizes */
-#define ELF_NOTE_SUSE_NAMESZ 8
-#define ELF_NOTE_SUSE_DESCSZ 8
-/* SuSE-specific note name */
-#define ELF_NOTE_SUSE_NAME "SuSE\0\0\0\0"
-
-/* NetBSD-specific note type: Emulation name.
- * name: NetBSD\0\0
- * namesz: 8
- * desc:
- * word[0]: MMmmrrpp00
- *
- * M = major version
- * m = minor version
- * r = release ["",A-Z,Z[A-Z] but numeric]
- * p = patchlevel
- * descsz: 4
- */
-#define ELF_NOTE_TYPE_NETBSD_TAG 1
-/* NetBSD-specific note name and description sizes */
-#define ELF_NOTE_NETBSD_NAMESZ 7
-#define ELF_NOTE_NETBSD_DESCSZ 4
-/* NetBSD-specific note name */
-#define ELF_NOTE_NETBSD_NAME "NetBSD\0\0"
-
-/* NetBSD-specific note type: Checksum.
- * There should be 1 NOTE per PT_LOAD section.
- * name: ???
- * namesz: ???
- * desc:
- * a tuple of <phnum>(16),<chk-type>(16),<chk-value>.
- * descsz: ???
- */
-#define ELF_NOTE_TYPE_CHECKSUM_TAG 2
-#define ELF_NOTE_CHECKSUM_CRC32 1
-#define ELF_NOTE_CHECKSUM_MD5 2
-#define ELF_NOTE_CHECKSUM_SHA1 3
-#define ELF_NOTE_CHECKSUM_SHA256 4
-
-/*
- * NetBSD-specific note type: PaX.
- * There should be 1 NOTE per executable.
- * name: PaX\0
- * namesz: 4
- * desc:
- * word[0]: capability bitmask
- * descsz: 4
- */
-#define ELF_NOTE_TYPE_PAX_TAG 3
-#define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */
-#define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */
-#define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */
-#define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Servguard */
-#define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */
-#define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */
-#define ELF_NOTE_PAX_NAMESZ 4
-#define ELF_NOTE_PAX_NAME "PaX\0"
-#define ELF_NOTE_PAX_DESCSZ 4
-
-/*
- * NetBSD-specific core file information.
- *
- * NetBSD ELF core files use notes to provide information about
- * the process's state. The note name is "NetBSD-CORE" for
- * information that is global to the process, and "NetBSD-CORE@nn",
- * where "nn" is the lwpid of the LWP that the information belongs
- * to (such as register state).
- *
- * We use the following note identifiers:
- *
- * ELF_NOTE_NETBSD_CORE_PROCINFO
- * Note is a "netbsd_elfcore_procinfo" structure.
- *
- * We also use ptrace(2) request numbers (the ones that exist in
- * machine-dependent space) to identify register info notes. The
- * info in such notes is in the same format that ptrace(2) would
- * export that information.
- *
- * Please try to keep the members of this structure nicely aligned,
- * and if you add elements, add them to the end and bump the version.
- */
-
-#define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE"
-
-#define ELF_NOTE_NETBSD_CORE_PROCINFO 1
-
-#define NETBSD_ELFCORE_PROCINFO_VERSION 1
-
-struct netbsd_elfcore_procinfo {
- /* Version 1 fields start here. */
- uint32_t cpi_version; /* netbsd_elfcore_procinfo version */
- uint32_t cpi_cpisize; /* sizeof(netbsd_elfcore_procinfo) */
- uint32_t cpi_signo; /* killing signal */
- uint32_t cpi_sigcode; /* signal code */
- uint32_t cpi_sigpend[4]; /* pending signals */
- uint32_t cpi_sigmask[4]; /* blocked signals */
- uint32_t cpi_sigignore[4];/* blocked signals */
- uint32_t cpi_sigcatch[4];/* blocked signals */
- int32_t cpi_pid; /* process ID */
- int32_t cpi_ppid; /* parent process ID */
- int32_t cpi_pgrp; /* process group ID */
- int32_t cpi_sid; /* session ID */
- uint32_t cpi_ruid; /* real user ID */
- uint32_t cpi_euid; /* effective user ID */
- uint32_t cpi_svuid; /* saved user ID */
- uint32_t cpi_rgid; /* real group ID */
- uint32_t cpi_egid; /* effective group ID */
- uint32_t cpi_svgid; /* saved group ID */
- uint32_t cpi_nlwps; /* number of LWPs */
- int8_t cpi_name[32]; /* copy of p->p_comm */
- /* Add version 2 fields below here. */
- int32_t cpi_siglwp; /* LWP target of killing signal */
-};
-
-#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
-#define ELFSIZE ARCH_ELFSIZE
-#endif
-
-#if defined(ELFSIZE)
-#define CONCAT(x,y) __CONCAT(x,y)
-#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
-#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
-#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
-#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
-#endif
-
-#if defined(ELFSIZE) && (ELFSIZE == 32)
-#define Elf_Ehdr Elf32_Ehdr
-#define Elf_Phdr Elf32_Phdr
-#define Elf_Shdr Elf32_Shdr
-#define Elf_Sym Elf32_Sym
-#define Elf_Rel Elf32_Rel
-#define Elf_Rela Elf32_Rela
-#define Elf_Dyn Elf32_Dyn
-#define Elf_Word Elf32_Word
-#define Elf_Sword Elf32_Sword
-#define Elf_Half Elf32_Half
-#define Elf_Addr Elf32_Addr
-#define Elf_Off Elf32_Off
-#define Elf_SOff Elf32_SOff
-#define Elf_Nhdr Elf32_Nhdr
-#define Elf_Verdef Elf32_Verdef
-#define Elf_Verdaux Elf32_Verdaux
-#define Elf_Verneed Elf32_Verneed
-#define Elf_Vernaux Elf32_Vernaux
-#define Elf_Versym Elf32_Versym
-
-#define ELF_R_SYM ELF32_R_SYM
-#define ELF_R_TYPE ELF32_R_TYPE
-#define ELFCLASS ELFCLASS32
-
-#define AuxInfo Aux32Info
-#elif defined(ELFSIZE) && (ELFSIZE == 64)
-#define Elf_Ehdr Elf64_Ehdr
-#define Elf_Phdr Elf64_Phdr
-#define Elf_Shdr Elf64_Shdr
-#define Elf_Sym Elf64_Sym
-#define Elf_Rel Elf64_Rel
-#define Elf_Rela Elf64_Rela
-#define Elf_Dyn Elf64_Dyn
-#define Elf_Word Elf64_Word
-#define Elf_Sword Elf64_Sword
-#define Elf_Half Elf64_Half
-#define Elf_Addr Elf64_Addr
-#define Elf_Off Elf64_Off
-#define Elf_SOff Elf64_SOff
-#define Elf_Nhdr Elf64_Nhdr
-#define Elf_Verdef Elf64_Verdef
-#define Elf_Verdaux Elf64_Verdaux
-#define Elf_Verneed Elf64_Verneed
-#define Elf_Vernaux Elf64_Vernaux
-#define Elf_Versym Elf64_Versym
-
-#define ELF_R_SYM ELF64_R_SYM
-#define ELF_R_TYPE ELF64_R_TYPE
-#define ELFCLASS ELFCLASS64
-
-#define AuxInfo Aux64Info
-#endif
-
-#ifndef Elf_Symindx
-#define Elf_Symindx uint32_t
-#endif
-
-#define ELF32_ST_BIND(info) ELF_ST_BIND(info)
-#define ELF32_ST_TYPE(info) ELF_ST_TYPE(info)
-#define ELF32_ST_INFO(bind,type) ELF_ST_INFO(bind,type)
-#define ELF32_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other)
-
-#define ELF64_ST_BIND(info) ELF_ST_BIND(info)
-#define ELF64_ST_TYPE(info) ELF_ST_TYPE(info)
-#define ELF64_ST_INFO(bind,type) ELF_ST_INFO(bind,type)
-#define ELF64_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other)
-
-typedef struct {
- Elf32_Half si_boundto; /* direct bindings - symbol bound to */
- Elf32_Half si_flags; /* per symbol flags */
-} Elf32_Syminfo;
-
-typedef struct {
- Elf64_Word si_boundto; /* direct bindings - symbol bound to */
- Elf64_Word si_flags; /* per symbol flags */
-} Elf64_Syminfo;
-
-#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association
- to object containing definition */
-#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */
-#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */
-#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be
- lazily-loaded */
-#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to
- object containing definition */
-#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference
- directly bind to this symbol */
-#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */
-#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */
-
-#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */
-#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */
-#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */
-#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */
-#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */
-
-#define SYMINFO_NONE 0 /* Syminfo version */
-#define SYMINFO_CURRENT 1
-#define SYMINFO_NUM 2
-
-/*
- * These constants are used for Elf32_Verdef struct's version number.
- */
-#define VER_DEF_NONE 0
-#define VER_DEF_CURRENT 1
-
-/*
- * These constants are used for Elf32_Verdef struct's vd_ndx.
- */
-#define VER_DEF_IDX(x) VER_NDX(x)
-
-/*
- * These constants are used for Elf32_Verdef struct's vd_flags.
- */
-#define VER_FLG_BASE 0x1
-#define VER_FLG_WEAK 0x2
-
-/*
- * These are used in an Elf32_Versym field.
- */
-#define VER_NDX_LOCAL 0
-#define VER_NDX_GLOBAL 1
-#define VER_NDX_GIVEN 2
-
-/*
- * These constants are used for Elf32_Verneed struct's version number.
- */
-#define VER_NEED_NONE 0
-#define VER_NEED_CURRENT 1
-
-/*
- * These constants are used for Elf32_Vernaux struct's vna_other.
- */
-#define VER_NEED_HIDDEN VER_NDX_HIDDEN
-#define VER_NEED_IDX(x) VER_NDX(x)
-
-/* index */
-#define VER_NDX_HIDDEN 0x8000
-#define VER_NDX(x) ((x) & ~VER_NDX_HIDDEN)
-
-/*
- * GNU Extension hidding symbol
- */
-#define VERSYM_HIDDEN 0x8000
-#define VERSYM_VERSION 0x7fff
-
-#define ELF_VER_CHR '@'
-
-/*
- * These are current size independent.
- */
-
-typedef struct {
- Elf32_Half vd_version; /* version number of structure */
- Elf32_Half vd_flags; /* flags (VER_FLG_*) */
- Elf32_Half vd_ndx; /* version index */
- Elf32_Half vd_cnt; /* number of verdaux entries */
- Elf32_Word vd_hash; /* hash of name */
- Elf32_Word vd_aux; /* offset to verdaux entries */
- Elf32_Word vd_next; /* offset to next verdef */
-} Elf32_Verdef;
-typedef Elf32_Verdef Elf64_Verdef;
-
-typedef struct {
- Elf32_Word vda_name; /* string table offset of name */
- Elf32_Word vda_next; /* offset to verdaux */
-} Elf32_Verdaux;
-typedef Elf32_Verdaux Elf64_Verdaux;
-
-typedef struct {
- Elf32_Half vn_version; /* version number of structure */
- Elf32_Half vn_cnt; /* number of vernaux entries */
- Elf32_Word vn_file; /* string table offset of library name*/
- Elf32_Word vn_aux; /* offset to vernaux entries */
- Elf32_Word vn_next; /* offset to next verneed */
-} Elf32_Verneed;
-typedef Elf32_Verneed Elf64_Verneed;
-
-typedef struct {
- Elf32_Word vna_hash; /* Hash of dependency name */
- Elf32_Half vna_flags; /* flags (VER_FLG_*) */
- Elf32_Half vna_other; /* unused */
- Elf32_Word vna_name; /* string table offset to version name*/
- Elf32_Word vna_next; /* offset to next vernaux */
-} Elf32_Vernaux;
-typedef Elf32_Vernaux Elf64_Vernaux;
-
-typedef struct {
- Elf32_Half vs_vers;
-} Elf32_Versym;
-typedef Elf32_Versym Elf64_Versym;
-
-#ifdef _KERNEL
-
-#define ELF_AUX_ENTRIES 14 /* Max size of aux array passed to loader */
-#define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
-#define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */
-#define ELF64_NO_ADDR (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */
-#define ELF64_LINK_ADDR ((Elf64_Addr)-2) /* advises to use link address */
-
-#if defined(ELFSIZE) && (ELFSIZE == 64)
-#define ELF_NO_ADDR ELF64_NO_ADDR
-#define ELF_LINK_ADDR ELF64_LINK_ADDR
-#elif defined(ELFSIZE) && (ELFSIZE == 32)
-#define ELF_NO_ADDR ELF32_NO_ADDR
-#define ELF_LINK_ADDR ELF32_LINK_ADDR
-#endif
-
-#ifndef ELF32_EHDR_FLAGS_OK
-#define ELF32_EHDR_FLAGS_OK(eh) 1
-#endif
-
-#ifndef ELF64_EHDR_FLAGS_OK
-#define ELF64_EHDR_FLAGS_OK(eh) 1
-#endif
-
-#if defined(ELFSIZE) && (ELFSIZE == 64)
-#define ELF_EHDR_FLAGS_OK(eh) ELF64_EHDR_FLAGS_OK(eh)
-#else
-#define ELF_EHDR_FLAGS_OK(eh) ELF32_EHDR_FLAGS_OK(eh)
-#endif
-
-#if defined(ELFSIZE)
-struct elf_args {
- Elf_Addr arg_entry; /* program entry point */
- Elf_Addr arg_interp; /* Interpreter load address */
- Elf_Addr arg_phaddr; /* program header address */
- Elf_Addr arg_phentsize; /* Size of program header */
- Elf_Addr arg_phnum; /* Number of program headers */
-};
-#endif
-
-#ifdef _KERNEL_OPT
-#include "opt_execfmt.h"
-#endif
-
-struct ps_strings;
-
-#ifdef EXEC_ELF32
-int exec_elf32_makecmds(struct lwp *, struct exec_package *);
-int elf32_copyargs(struct lwp *, struct exec_package *,
- struct ps_strings *, char **, void *);
-
-int coredump_elf32(struct lwp *, void *);
-int coredump_writenote_elf32(struct proc *, void *, Elf32_Nhdr *,
- const char *, void *);
-
-int elf32_check_header(Elf32_Ehdr *, int);
-#endif
-
-#ifdef EXEC_ELF64
-int exec_elf64_makecmds(struct lwp *, struct exec_package *);
-int elf64_copyargs(struct lwp *, struct exec_package *,
- struct ps_strings *, char **, void *);
-
-int coredump_elf64(struct lwp *, void *);
-int coredump_writenote_elf64(struct proc *, void *, Elf64_Nhdr *,
- const char *, void *);
-
-int elf64_check_header(Elf64_Ehdr *, int);
-#endif
-
-#endif /* _KERNEL */
-
-#endif /* !_SYS_EXEC_ELF_H_ */
+++ /dev/null
-/*
- * SVID compatible ipc.h file
- */
-
-#ifndef _SYS_IPC_H_
-#define _SYS_IPC_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-/* Data structure used to pass permission information to IPC operations. */
-struct ipc_perm
-{
- key_t key; /* Key. */
- uid_t uid; /* Owner's user ID. */
- gid_t gid; /* Owner's group ID. */
- uid_t cuid; /* Creator's user ID. */
- gid_t cgid; /* Creator's group ID. */
- unsigned short int mode; /* Reader/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
-
-/* X/Open required constants (same values as system 5) */
-#define IPC_CREAT 001000 /* create entry if key does not exist */
-#define IPC_EXCL 002000 /* fail if key exists */
-#define IPC_NOWAIT 004000 /* error if request must wait */
-
-#define IPC_PRIVATE (key_t)0 /* private key */
-
-#define IPC_RMID 0 /* remove identifier */
-#define IPC_SET 1 /* set options */
-#define IPC_STAT 2 /* get options */
-
-#ifdef __minix
-#define IPC_INFO 3 /* See ipcs. */
-#endif /* !__minix */
-
-/*
- * Macro to convert between ipc ids and array indices or sequence ids.
- */
-#if defined(_NETBSD_SOURCE)
-#define IXSEQ_TO_IPCID(ix,perm) (((perm._seq) << 16) | (ix & 0xffff))
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-key_t ftok(const char *, int);
-__END_DECLS
-
-#endif /* !_SYS_IPC_H_ */
+++ /dev/null
-/* $NetBSD: md4.h,v 1.7 2005/12/26 18:41:36 perry Exp $ */
-
-/*
- * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
- * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
- * for portability and formatting.
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD4 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#ifndef _SYS_MD4_H_
-#define _SYS_MD4_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#define MD4_DIGEST_LENGTH 16
-
-/* MD4 context. */
-typedef struct MD4Context {
- uint32_t state[4]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} MD4_CTX;
-
-__BEGIN_DECLS
-void MD4Init(MD4_CTX *);
-void MD4Update(MD4_CTX *, const unsigned char *, unsigned int);
-void MD4Final(unsigned char[MD4_DIGEST_LENGTH], MD4_CTX *);
-#ifndef _KERNEL
-char *MD4End(MD4_CTX *, char *);
-char *MD4File(const char *, char *);
-char *MD4Data(const unsigned char *, unsigned int, char *);
-#endif /* _KERNEL */
-__END_DECLS
-
-#endif /* _SYS_MD4_H_ */
+++ /dev/null
-/* $NetBSD: md5.h,v 1.9 2005/12/26 18:41:36 perry Exp $ */
-
-/*
- * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
- * for portability and formatting.
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#ifndef _SYS_MD5_H_
-#define _SYS_MD5_H_
-
-#include <sys/types.h>
-
-#define MD5_DIGEST_LENGTH 16
-#define MD5_DIGEST_STRING_LENGTH 33
-
-/* MD5 context. */
-typedef struct MD5Context {
- uint32_t state[4]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-__BEGIN_DECLS
-void MD5Init(MD5_CTX *);
-void MD5Update(MD5_CTX *, const unsigned char *, unsigned int);
-void MD5Final(unsigned char[MD5_DIGEST_LENGTH], MD5_CTX *);
-#ifndef _KERNEL
-char *MD5End(MD5_CTX *, char *);
-char *MD5File(const char *, char *);
-char *MD5Data(const unsigned char *, unsigned int, char *);
-#endif /* _KERNEL */
-__END_DECLS
-
-#endif /* _SYS_MD5_H_ */
+++ /dev/null
-#ifndef _SYS_MOUNT_H
-#define _SYS_MOUNT_H_
-
-/*
- * File system types.
- */
-#define MOUNT_FFS "ffs" /* UNIX "Fast" Filesystem */
-#define MOUNT_UFS MOUNT_FFS /* for compatibility */
-#define MOUNT_NFS "nfs" /* Network Filesystem */
-#define MOUNT_MFS "mfs" /* Memory Filesystem */
-#define MOUNT_MSDOS "msdos" /* MSDOS Filesystem */
-#define MOUNT_LFS "lfs" /* Log-based Filesystem */
-#define MOUNT_FDESC "fdesc" /* File Descriptor Filesystem */
-#define MOUNT_NULL "null" /* Minimal Filesystem Layer */
-#define MOUNT_OVERLAY "overlay" /* Minimal Overlay Filesystem Layer */
-#define MOUNT_UMAP "umap" /* User/Group Identifier Remapping Filesystem */
-#define MOUNT_KERNFS "kernfs" /* Kernel Information Filesystem */
-#define MOUNT_PROCFS "procfs" /* /proc Filesystem */
-#define MOUNT_AFS "afs" /* Andrew Filesystem */
-#define MOUNT_CD9660 "cd9660" /* ISO9660 (aka CDROM) Filesystem */
-#define MOUNT_UNION "union" /* Union (translucent) Filesystem */
-#define MOUNT_ADOSFS "adosfs" /* AmigaDOS Filesystem */
-#define MOUNT_EXT2FS "ext2fs" /* Second Extended Filesystem */
-#define MOUNT_CFS "coda" /* Coda Filesystem */
-#define MOUNT_CODA MOUNT_CFS /* Coda Filesystem */
-#define MOUNT_FILECORE "filecore" /* Acorn Filecore Filesystem */
-#define MOUNT_NTFS "ntfs" /* Windows/NT Filesystem */
-#define MOUNT_SMBFS "smbfs" /* CIFS (SMB) */
-#define MOUNT_PTYFS "ptyfs" /* Pseudo tty filesystem */
-#define MOUNT_TMPFS "tmpfs" /* Efficient memory file-system */
-#define MOUNT_UDF "udf" /* UDF CD/DVD filesystem */
-#define MOUNT_SYSVBFS "sysvbfs" /* System V Boot Filesystem */
-#define MOUNT_PUFFS "puffs" /* Pass-to-Userspace filesystem */
-#define MOUNT_HFS "hfs" /* Apple HFS+ Filesystem */
-#define MOUNT_EFS "efs" /* SGI's Extent Filesystem */
-#define MOUNT_ZFS "zfs" /* Sun ZFS */
-#define MOUNT_NILFS "nilfs" /* NTT's NiLFS(2) logging file system */
-#define MOUNT_RUMPFS "rumpfs" /* rump virtual file system */
-#define MOUNT_V7FS "v7fs" /* 7th Edition of Unix Filesystem */
-
-#include <sys/statvfs.h>
-#include <minix/mount.h>
-
-#endif /* !_SYS_MOUNT_H_ */
+++ /dev/null
-/* $NetBSD: mutex.h,v 1.20 2010/02/08 09:54:27 skrll Exp $ */
-
-/*-
- * Copyright (c) 2002, 2006, 2007, 2008, 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 _SYS_MUTEX_H_
-#define _SYS_MUTEX_H_
-
-/*
- * There are 2 types of mutexes:
- *
- * * Adaptive -- If the lock is already held, the thread attempting
- * to acquire the lock determines if the thread that holds it is
- * currently running. If so, it spins, else it sleeps.
- *
- * * Spin -- If the lock is already held, the thread attempting to
- * acquire the lock spins. The IPL will be raised on entry.
- *
- * Machine dependent code must provide the following:
- *
- * struct mutex
- * The actual mutex structure. This structure is mostly
- * opaque to machine-independent code; most access are done
- * through macros. However, machine-independent code must
- * be able to access the following members:
- *
- * uintptr_t mtx_owner
- * ipl_cookie_t mtx_ipl
- * __cpu_simple_lock_t mtx_lock
- *
- * If an architecture can be considered 'simple' (no interlock required in
- * the MP case, or no MP) it need only define __HAVE_SIMPLE_MUTEXES and
- * provide the following:
- *
- * struct mutex
- *
- * [additionally:]
- * volatile integer mtx_id
- *
- * MUTEX_RECEIVE(mtx)
- * Post a load fence after acquiring the mutex, if necessary.
- *
- * MUTEX_GIVE(mtx)
- * Post a load/store fence after releasing the mutex, if
- * necessary.
- *
- * MUTEX_CAS(ptr, old, new)
- * Perform an atomic "compare and swap" operation and
- * evaluate to true or false according to the success
- *
- * Otherwise, the following must be defined:
- *
- * MUTEX_INITIALIZE_SPIN(mtx, dodebug, minipl)
- * Initialize a spin mutex.
- *
- * MUTEX_INITIALIZE_ADAPTIVE(mtx, dodebug)
- * Initialize an adaptive mutex.
- *
- * MUTEX_DESTROY(mtx)
- * Tear down a mutex.
- *
- * MUTEX_ADAPTIVE_P(mtx)
- * Evaluates to true if the mutex is an adaptive mutex.
- *
- * MUTEX_SPIN_P(mtx)
- * Evaluates to true if the mutex is a spin mutex.
- *
- * MUTEX_OWNER(owner)
- * Returns the owner of the adaptive mutex (LWP address).
- *
- * MUTEX_OWNED(owner)
- * Returns non-zero if an adaptive mutex is currently
- * held by an LWP.
- *
- * MUTEX_HAS_WAITERS(mtx)
- * Returns true if the mutex has waiters.
- *
- * MUTEX_SET_WAITERS(mtx)
- * Mark the mutex has having waiters.
- *
- * MUTEX_ACQUIRE(mtx, owner)
- * Try to acquire an adaptive mutex such that:
- * if (lock held OR waiters)
- * return 0;
- * else
- * return 1;
- * Must be MP/interrupt atomic.
- *
- * MUTEX_RELEASE(mtx)
- * Release the lock and clear the "has waiters" indication.
- * Must be interrupt atomic, need not be MP safe.
- *
- * MUTEX_DEBUG_P(mtx)
- * Evaluates to true if the mutex is initialized with
- * dodebug==true. Only used in the LOCKDEBUG case.
- *
- * Machine dependent code may optionally provide stubs for the following
- * functions to implement the easy (unlocked / no waiters) cases. If
- * these stubs are provided, __HAVE_MUTEX_STUBS should be defined.
- *
- * mutex_enter()
- * mutex_exit()
- *
- * Two additional stubs may be implemented that handle only the spinlock
- * case, primarily for the scheduler. __HAVE_SPIN_MUTEX_STUBS should be
- * defined if these are provided:
- *
- * mutex_spin_enter()
- * mutex_spin_exit()
- */
-
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#if !defined(_KERNEL)
-#include <sys/types.h>
-#include <sys/inttypes.h>
-#endif
-
-typedef enum kmutex_type_t {
- MUTEX_SPIN = 0, /* To get a spin mutex at IPL_NONE */
- MUTEX_ADAPTIVE = 1, /* For porting code written for Solaris */
- MUTEX_DEFAULT = 2, /* The only native, endorsed type */
- MUTEX_DRIVER = 3, /* For porting code written for Solaris */
- MUTEX_NODEBUG = 4 /* Disables LOCKDEBUG; use with care */
-} kmutex_type_t;
-
-typedef struct kmutex kmutex_t;
-
-#if defined(__MUTEX_PRIVATE)
-
-#define MUTEX_THREAD ((uintptr_t)-16L)
-
-#define MUTEX_BIT_SPIN 0x01
-#define MUTEX_BIT_WAITERS 0x02
-
-#if defined(LOCKDEBUG)
-#define MUTEX_BIT_NODEBUG 0x04 /* LOCKDEBUG disabled */
-#else
-#define MUTEX_BIT_NODEBUG 0x00 /* do nothing */
-#endif /* LOCKDEBUG */
-
-#define MUTEX_SPIN_IPL(mtx) ((mtx)->mtx_ipl)
-#define MUTEX_SPIN_OLDSPL(ci) ((ci)->ci_mtx_oldspl)
-
-void mutex_vector_enter(kmutex_t *);
-void mutex_vector_exit(kmutex_t *);
-void mutex_spin_retry(kmutex_t *);
-void mutex_wakeup(kmutex_t *);
-
-#endif /* __MUTEX_PRIVATE */
-
-#ifdef _KERNEL
-#include <sys/intr.h>
-#endif
-
-#include <machine/mutex.h>
-
-/*
- * Return true if no spin mutexes are held by the current CPU.
- */
-#ifndef MUTEX_NO_SPIN_ACTIVE_P
-#define MUTEX_NO_SPIN_ACTIVE_P(ci) ((ci)->ci_mtx_count == 0)
-#endif
-
-#ifdef _KERNEL
-
-void mutex_init(kmutex_t *, kmutex_type_t, int);
-void mutex_destroy(kmutex_t *);
-
-void mutex_enter(kmutex_t *);
-void mutex_exit(kmutex_t *);
-
-void mutex_spin_enter(kmutex_t *);
-void mutex_spin_exit(kmutex_t *);
-
-int mutex_tryenter(kmutex_t *);
-
-int mutex_owned(kmutex_t *);
-lwp_t *mutex_owner(kmutex_t *);
-
-void mutex_obj_init(void);
-kmutex_t *mutex_obj_alloc(kmutex_type_t, int);
-void mutex_obj_hold(kmutex_t *);
-bool mutex_obj_free(kmutex_t *);
-
-#endif /* _KERNEL */
-
-#endif /* _SYS_MUTEX_H_ */
+++ /dev/null
-/* $NetBSD: null.h,v 1.8 2009/10/13 17:19:00 dsl Exp $ */
-
-#ifndef _SYS_NULL_H_
-#define _SYS_NULL_H_
-#ifndef NULL
-#if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 90)
-#if !defined(__cplusplus)
-#define NULL ((void *)0)
-#else
-#define NULL 0
-#endif /* !__cplusplus */
-#else
-#define NULL __null
-#endif
-#endif
-#endif /* _SYS_NULL_H_ */
+++ /dev/null
-/* $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)queue.h 8.5 (Berkeley) 8/20/94
- */
-
-#ifndef _SYS_QUEUE_H_
-#define _SYS_QUEUE_H_
-
-#include <sys/null.h>
-
-/*
- * This file defines five types of data structures: singly-linked lists,
- * lists, simple queues, tail queues, and circular queues.
- *
- * A singly-linked list is headed by a single forward pointer. The
- * elements are singly linked for minimum space and pointer manipulation
- * overhead at the expense of O(n) removal for arbitrary elements. New
- * elements can be added to the list after an existing element or at the
- * head of the list. Elements being removed from the head of the list
- * should use the explicit macro for this purpose for optimum
- * efficiency. A singly-linked list may only be traversed in the forward
- * direction. Singly-linked lists are ideal for applications with large
- * datasets and few or no removals or for implementing a LIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may only be traversed in the forward direction.
- *
- * A simple queue is headed by a pair of pointers, one the head of the
- * list and the other to the tail of the list. The elements are singly
- * linked to save space, so elements can only be removed from the
- * head of the list. New elements can be added to the list after
- * an existing element, at the head of the list, or at the end of the
- * list. A simple queue may only be traversed in the forward direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * A circle queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or after
- * an existing element, at the head of the list, or at the end of the list.
- * A circle queue may be traversed in either direction, but has a more
- * complex end of list detection.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- */
-
-/*
- * List definitions.
- */
-#define LIST_HEAD(name, type) \
-struct name { \
- struct type *lh_first; /* first element */ \
-}
-
-#define LIST_HEAD_INITIALIZER(head) \
- { NULL }
-
-#define LIST_ENTRY(type) \
-struct { \
- struct type *le_next; /* next element */ \
- struct type **le_prev; /* address of previous next element */ \
-}
-
-/*
- * List functions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
- if ((head)->lh_first && \
- (head)->lh_first->field.le_prev != &(head)->lh_first) \
- panic("LIST_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
-#define QUEUEDEBUG_LIST_OP(elm, field) \
- if ((elm)->field.le_next && \
- (elm)->field.le_next->field.le_prev != \
- &(elm)->field.le_next) \
- panic("LIST_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
- if (*(elm)->field.le_prev != (elm)) \
- panic("LIST_* back %p %s:%d", (elm), __FILE__, __LINE__);
-#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \
- (elm)->field.le_next = (void *)1L; \
- (elm)->field.le_prev = (void *)1L;
-#else
-#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
-#define QUEUEDEBUG_LIST_OP(elm, field)
-#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
-#endif
-
-#define LIST_INIT(head) do { \
- (head)->lh_first = NULL; \
-} while (/*CONSTCOND*/0)
-
-#define LIST_INSERT_AFTER(listelm, elm, field) do { \
- QUEUEDEBUG_LIST_OP((listelm), field) \
- if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
- (listelm)->field.le_next->field.le_prev = \
- &(elm)->field.le_next; \
- (listelm)->field.le_next = (elm); \
- (elm)->field.le_prev = &(listelm)->field.le_next; \
-} while (/*CONSTCOND*/0)
-
-#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
- QUEUEDEBUG_LIST_OP((listelm), field) \
- (elm)->field.le_prev = (listelm)->field.le_prev; \
- (elm)->field.le_next = (listelm); \
- *(listelm)->field.le_prev = (elm); \
- (listelm)->field.le_prev = &(elm)->field.le_next; \
-} while (/*CONSTCOND*/0)
-
-#define LIST_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
- if (((elm)->field.le_next = (head)->lh_first) != NULL) \
- (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
- (head)->lh_first = (elm); \
- (elm)->field.le_prev = &(head)->lh_first; \
-} while (/*CONSTCOND*/0)
-
-#define LIST_REMOVE(elm, field) do { \
- QUEUEDEBUG_LIST_OP((elm), field) \
- if ((elm)->field.le_next != NULL) \
- (elm)->field.le_next->field.le_prev = \
- (elm)->field.le_prev; \
- *(elm)->field.le_prev = (elm)->field.le_next; \
- QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
-} while (/*CONSTCOND*/0)
-
-#define LIST_FOREACH(var, head, field) \
- for ((var) = ((head)->lh_first); \
- (var); \
- (var) = ((var)->field.le_next))
-
-#define LIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = LIST_FIRST((head)); \
- (var) && ((tvar) = LIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-/*
- * List access methods.
- */
-#define LIST_EMPTY(head) ((head)->lh_first == NULL)
-#define LIST_FIRST(head) ((head)->lh_first)
-#define LIST_NEXT(elm, field) ((elm)->field.le_next)
-
-
-/*
- * Singly-linked List definitions.
- */
-#define SLIST_HEAD(name, type) \
-struct name { \
- struct type *slh_first; /* first element */ \
-}
-
-#define SLIST_HEAD_INITIALIZER(head) \
- { NULL }
-
-#define SLIST_ENTRY(type) \
-struct { \
- struct type *sle_next; /* next element */ \
-}
-
-/*
- * Singly-linked List functions.
- */
-#define SLIST_INIT(head) do { \
- (head)->slh_first = NULL; \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
- (elm)->field.sle_next = (slistelm)->field.sle_next; \
- (slistelm)->field.sle_next = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_INSERT_HEAD(head, elm, field) do { \
- (elm)->field.sle_next = (head)->slh_first; \
- (head)->slh_first = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_REMOVE_HEAD(head, field) do { \
- (head)->slh_first = (head)->slh_first->field.sle_next; \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_REMOVE(head, elm, type, field) do { \
- if ((head)->slh_first == (elm)) { \
- SLIST_REMOVE_HEAD((head), field); \
- } \
- else { \
- struct type *curelm = (head)->slh_first; \
- while(curelm->field.sle_next != (elm)) \
- curelm = curelm->field.sle_next; \
- curelm->field.sle_next = \
- curelm->field.sle_next->field.sle_next; \
- } \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_REMOVE_AFTER(slistelm, field) do { \
- (slistelm)->field.sle_next = \
- SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \
-} while (/*CONSTCOND*/0)
-
-#define SLIST_FOREACH(var, head, field) \
- for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
-
-#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = SLIST_FIRST((head)); \
- (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-/*
- * Singly-linked List access methods.
- */
-#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
-#define SLIST_FIRST(head) ((head)->slh_first)
-#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
-
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define STAILQ_HEAD(name, type) \
-struct name { \
- struct type *stqh_first; /* first element */ \
- struct type **stqh_last; /* addr of last next element */ \
-}
-
-#define STAILQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).stqh_first }
-
-#define STAILQ_ENTRY(type) \
-struct { \
- struct type *stqe_next; /* next element */ \
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define STAILQ_INIT(head) do { \
- (head)->stqh_first = NULL; \
- (head)->stqh_last = &(head)->stqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_INSERT_HEAD(head, elm, field) do { \
- if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
- (head)->stqh_last = &(elm)->field.stqe_next; \
- (head)->stqh_first = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_INSERT_TAIL(head, elm, field) do { \
- (elm)->field.stqe_next = NULL; \
- *(head)->stqh_last = (elm); \
- (head)->stqh_last = &(elm)->field.stqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
- if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
- (head)->stqh_last = &(elm)->field.stqe_next; \
- (listelm)->field.stqe_next = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_REMOVE_HEAD(head, field) do { \
- if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
- (head)->stqh_last = &(head)->stqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_REMOVE(head, elm, type, field) do { \
- if ((head)->stqh_first == (elm)) { \
- STAILQ_REMOVE_HEAD((head), field); \
- } else { \
- struct type *curelm = (head)->stqh_first; \
- while (curelm->field.stqe_next != (elm)) \
- curelm = curelm->field.stqe_next; \
- if ((curelm->field.stqe_next = \
- curelm->field.stqe_next->field.stqe_next) == NULL) \
- (head)->stqh_last = &(curelm)->field.stqe_next; \
- } \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_FOREACH(var, head, field) \
- for ((var) = ((head)->stqh_first); \
- (var); \
- (var) = ((var)->field.stqe_next))
-
-#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = STAILQ_FIRST((head)); \
- (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define STAILQ_CONCAT(head1, head2) do { \
- if (!STAILQ_EMPTY((head2))) { \
- *(head1)->stqh_last = (head2)->stqh_first; \
- (head1)->stqh_last = (head2)->stqh_last; \
- STAILQ_INIT((head2)); \
- } \
-} while (/*CONSTCOND*/0)
-
-#define STAILQ_LAST(head, type, field) \
- (STAILQ_EMPTY((head)) ? \
- NULL : \
- ((struct type *)(void *) \
- ((char *)((head)->stqh_last) - offsetof(struct type, field))))
-
-/*
- * Singly-linked Tail queue access methods.
- */
-#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
-#define STAILQ_FIRST(head) ((head)->stqh_first)
-#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
-
-
-/*
- * Simple queue definitions.
- */
-#define SIMPLEQ_HEAD(name, type) \
-struct name { \
- struct type *sqh_first; /* first element */ \
- struct type **sqh_last; /* addr of last next element */ \
-}
-
-#define SIMPLEQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).sqh_first }
-
-#define SIMPLEQ_ENTRY(type) \
-struct { \
- struct type *sqe_next; /* next element */ \
-}
-
-/*
- * Simple queue functions.
- */
-#define SIMPLEQ_INIT(head) do { \
- (head)->sqh_first = NULL; \
- (head)->sqh_last = &(head)->sqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
- if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
- (head)->sqh_last = &(elm)->field.sqe_next; \
- (head)->sqh_first = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
- (elm)->field.sqe_next = NULL; \
- *(head)->sqh_last = (elm); \
- (head)->sqh_last = &(elm)->field.sqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
- if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
- (head)->sqh_last = &(elm)->field.sqe_next; \
- (listelm)->field.sqe_next = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
- if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
- (head)->sqh_last = &(head)->sqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
- if ((head)->sqh_first == (elm)) { \
- SIMPLEQ_REMOVE_HEAD((head), field); \
- } else { \
- struct type *curelm = (head)->sqh_first; \
- while (curelm->field.sqe_next != (elm)) \
- curelm = curelm->field.sqe_next; \
- if ((curelm->field.sqe_next = \
- curelm->field.sqe_next->field.sqe_next) == NULL) \
- (head)->sqh_last = &(curelm)->field.sqe_next; \
- } \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_FOREACH(var, head, field) \
- for ((var) = ((head)->sqh_first); \
- (var); \
- (var) = ((var)->field.sqe_next))
-
-#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
- for ((var) = ((head)->sqh_first); \
- (var) && ((next = ((var)->field.sqe_next)), 1); \
- (var) = (next))
-
-#define SIMPLEQ_CONCAT(head1, head2) do { \
- if (!SIMPLEQ_EMPTY((head2))) { \
- *(head1)->sqh_last = (head2)->sqh_first; \
- (head1)->sqh_last = (head2)->sqh_last; \
- SIMPLEQ_INIT((head2)); \
- } \
-} while (/*CONSTCOND*/0)
-
-#define SIMPLEQ_LAST(head, type, field) \
- (SIMPLEQ_EMPTY((head)) ? \
- NULL : \
- ((struct type *)(void *) \
- ((char *)((head)->sqh_last) - offsetof(struct type, field))))
-
-/*
- * Simple queue access methods.
- */
-#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
-#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
-#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
-
-
-/*
- * Tail queue definitions.
- */
-#define _TAILQ_HEAD(name, type, qual) \
-struct name { \
- qual type *tqh_first; /* first element */ \
- qual type *qual *tqh_last; /* addr of last next element */ \
-}
-#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
-
-#define TAILQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).tqh_first }
-
-#define _TAILQ_ENTRY(type, qual) \
-struct { \
- qual type *tqe_next; /* next element */ \
- qual type *qual *tqe_prev; /* address of previous next element */\
-}
-#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
-
-/*
- * Tail queue functions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
- if ((head)->tqh_first && \
- (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
- panic("TAILQ_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
-#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
- if (*(head)->tqh_last != NULL) \
- panic("TAILQ_INSERT_TAIL %p %s:%d", (head), __FILE__, __LINE__);
-#define QUEUEDEBUG_TAILQ_OP(elm, field) \
- if ((elm)->field.tqe_next && \
- (elm)->field.tqe_next->field.tqe_prev != \
- &(elm)->field.tqe_next) \
- panic("TAILQ_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
- if (*(elm)->field.tqe_prev != (elm)) \
- panic("TAILQ_* back %p %s:%d", (elm), __FILE__, __LINE__);
-#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \
- if ((elm)->field.tqe_next == NULL && \
- (head)->tqh_last != &(elm)->field.tqe_next) \
- panic("TAILQ_PREREMOVE head %p elm %p %s:%d", \
- (head), (elm), __FILE__, __LINE__);
-#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \
- (elm)->field.tqe_next = (void *)1L; \
- (elm)->field.tqe_prev = (void *)1L;
-#else
-#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
-#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
-#define QUEUEDEBUG_TAILQ_OP(elm, field)
-#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
-#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
-#endif
-
-#define TAILQ_INIT(head) do { \
- (head)->tqh_first = NULL; \
- (head)->tqh_last = &(head)->tqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
- if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
- (head)->tqh_first->field.tqe_prev = \
- &(elm)->field.tqe_next; \
- else \
- (head)->tqh_last = &(elm)->field.tqe_next; \
- (head)->tqh_first = (elm); \
- (elm)->field.tqe_prev = &(head)->tqh_first; \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_INSERT_TAIL(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
- (elm)->field.tqe_next = NULL; \
- (elm)->field.tqe_prev = (head)->tqh_last; \
- *(head)->tqh_last = (elm); \
- (head)->tqh_last = &(elm)->field.tqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QUEUEDEBUG_TAILQ_OP((listelm), field) \
- if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
- (elm)->field.tqe_next->field.tqe_prev = \
- &(elm)->field.tqe_next; \
- else \
- (head)->tqh_last = &(elm)->field.tqe_next; \
- (listelm)->field.tqe_next = (elm); \
- (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
- QUEUEDEBUG_TAILQ_OP((listelm), field) \
- (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
- (elm)->field.tqe_next = (listelm); \
- *(listelm)->field.tqe_prev = (elm); \
- (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_REMOVE(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
- QUEUEDEBUG_TAILQ_OP((elm), field) \
- if (((elm)->field.tqe_next) != NULL) \
- (elm)->field.tqe_next->field.tqe_prev = \
- (elm)->field.tqe_prev; \
- else \
- (head)->tqh_last = (elm)->field.tqe_prev; \
- *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
- QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
-} while (/*CONSTCOND*/0)
-
-#define TAILQ_FOREACH(var, head, field) \
- for ((var) = ((head)->tqh_first); \
- (var); \
- (var) = ((var)->field.tqe_next))
-
-#define TAILQ_FOREACH_SAFE(var, head, field, next) \
- for ((var) = ((head)->tqh_first); \
- (var) != NULL && ((next) = TAILQ_NEXT(var, field), 1); \
- (var) = (next))
-
-#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
- for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
- (var); \
- (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
-
-#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
- for ((var) = TAILQ_LAST((head), headname); \
- (var) && ((prev) = TAILQ_PREV((var), headname, field), 1);\
- (var) = (prev))
-
-#define TAILQ_CONCAT(head1, head2, field) do { \
- if (!TAILQ_EMPTY(head2)) { \
- *(head1)->tqh_last = (head2)->tqh_first; \
- (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
- (head1)->tqh_last = (head2)->tqh_last; \
- TAILQ_INIT((head2)); \
- } \
-} while (/*CONSTCOND*/0)
-
-/*
- * Tail queue access methods.
- */
-#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
-#define TAILQ_FIRST(head) ((head)->tqh_first)
-#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-
-#define TAILQ_LAST(head, headname) \
- (*(((struct headname *)((head)->tqh_last))->tqh_last))
-#define TAILQ_PREV(elm, headname, field) \
- (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-
-/*
- * Circular queue definitions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \
- if ((head)->cqh_first != (void *)(head) && \
- (head)->cqh_first->field.cqe_prev != (void *)(head)) \
- panic("CIRCLEQ head forw %p %s:%d", (head), \
- __FILE__, __LINE__); \
- if ((head)->cqh_last != (void *)(head) && \
- (head)->cqh_last->field.cqe_next != (void *)(head)) \
- panic("CIRCLEQ head back %p %s:%d", (head), \
- __FILE__, __LINE__);
-#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \
- if ((elm)->field.cqe_next == (void *)(head)) { \
- if ((head)->cqh_last != (elm)) \
- panic("CIRCLEQ elm last %p %s:%d", (elm), \
- __FILE__, __LINE__); \
- } else { \
- if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \
- panic("CIRCLEQ elm forw %p %s:%d", (elm), \
- __FILE__, __LINE__); \
- } \
- if ((elm)->field.cqe_prev == (void *)(head)) { \
- if ((head)->cqh_first != (elm)) \
- panic("CIRCLEQ elm first %p %s:%d", (elm), \
- __FILE__, __LINE__); \
- } else { \
- if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \
- panic("CIRCLEQ elm prev %p %s:%d", (elm), \
- __FILE__, __LINE__); \
- }
-#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \
- (elm)->field.cqe_next = (void *)1L; \
- (elm)->field.cqe_prev = (void *)1L;
-#else
-#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
-#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
-#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
-#endif
-
-#define CIRCLEQ_HEAD(name, type) \
-struct name { \
- struct type *cqh_first; /* first element */ \
- struct type *cqh_last; /* last element */ \
-}
-
-#define CIRCLEQ_HEAD_INITIALIZER(head) \
- { (void *)&head, (void *)&head }
-
-#define CIRCLEQ_ENTRY(type) \
-struct { \
- struct type *cqe_next; /* next element */ \
- struct type *cqe_prev; /* previous element */ \
-}
-
-/*
- * Circular queue functions.
- */
-#define CIRCLEQ_INIT(head) do { \
- (head)->cqh_first = (void *)(head); \
- (head)->cqh_last = (void *)(head); \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
- (elm)->field.cqe_next = (listelm)->field.cqe_next; \
- (elm)->field.cqe_prev = (listelm); \
- if ((listelm)->field.cqe_next == (void *)(head)) \
- (head)->cqh_last = (elm); \
- else \
- (listelm)->field.cqe_next->field.cqe_prev = (elm); \
- (listelm)->field.cqe_next = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
- (elm)->field.cqe_next = (listelm); \
- (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
- if ((listelm)->field.cqe_prev == (void *)(head)) \
- (head)->cqh_first = (elm); \
- else \
- (listelm)->field.cqe_prev->field.cqe_next = (elm); \
- (listelm)->field.cqe_prev = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- (elm)->field.cqe_next = (head)->cqh_first; \
- (elm)->field.cqe_prev = (void *)(head); \
- if ((head)->cqh_last == (void *)(head)) \
- (head)->cqh_last = (elm); \
- else \
- (head)->cqh_first->field.cqe_prev = (elm); \
- (head)->cqh_first = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- (elm)->field.cqe_next = (void *)(head); \
- (elm)->field.cqe_prev = (head)->cqh_last; \
- if ((head)->cqh_first == (void *)(head)) \
- (head)->cqh_first = (elm); \
- else \
- (head)->cqh_last->field.cqe_next = (elm); \
- (head)->cqh_last = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_REMOVE(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
- if ((elm)->field.cqe_next == (void *)(head)) \
- (head)->cqh_last = (elm)->field.cqe_prev; \
- else \
- (elm)->field.cqe_next->field.cqe_prev = \
- (elm)->field.cqe_prev; \
- if ((elm)->field.cqe_prev == (void *)(head)) \
- (head)->cqh_first = (elm)->field.cqe_next; \
- else \
- (elm)->field.cqe_prev->field.cqe_next = \
- (elm)->field.cqe_next; \
- QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
-} while (/*CONSTCOND*/0)
-
-#define CIRCLEQ_FOREACH(var, head, field) \
- for ((var) = ((head)->cqh_first); \
- (var) != (const void *)(head); \
- (var) = ((var)->field.cqe_next))
-
-#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
- for ((var) = ((head)->cqh_last); \
- (var) != (const void *)(head); \
- (var) = ((var)->field.cqe_prev))
-
-/*
- * Circular queue access methods.
- */
-#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
-#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
-#define CIRCLEQ_LAST(head) ((head)->cqh_last)
-#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
-#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
-
-#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
- (((elm)->field.cqe_next == (void *)(head)) \
- ? ((head)->cqh_first) \
- : (elm->field.cqe_next))
-#define CIRCLEQ_LOOP_PREV(head, elm, field) \
- (((elm)->field.cqe_prev == (void *)(head)) \
- ? ((head)->cqh_last) \
- : (elm->field.cqe_prev))
-
-#endif /* !_SYS_QUEUE_H_ */
+++ /dev/null
-#ifndef _SYS_REBOOT_H_
-#define _SYS_REBOOT_H_
-
-/* How to exit the system or stop a server process. */
-#define RBT_HALT 0 /* shutdown and return to monitor */
-#define RBT_REBOOT 1 /* reboot the system through the monitor */
-#define RBT_PANIC 2 /* a server panics */
-#define RBT_POWEROFF 3 /* power off, reset if not possible */
-#define RBT_RESET 4 /* hard reset the system */
-#define RBT_DEFAULT 5 /* return to monitor, reset if not possible */
-#define RBT_INVALID 6 /* first invalid reboot flag */
-
-#endif
+++ /dev/null
-#ifndef _SYS_RESOURCE_H_
-#define _SYS_RESOURCE_H_
-
-#include <sys/featuretest.h>
-#include <sys/time.h>
-
-/*
- * Process priority specifications to get/setpriority.
- */
-#define PRIO_MIN -20
-#define PRIO_MAX 20
-
-#define PRIO_PROCESS 0
-#define PRIO_PGRP 1
-#define PRIO_USER 2
-
-/*
- * Resource limits
- */
-#define RLIMIT_CORE 1
-#define RLIMIT_CPU 2
-#define RLIMIT_DATA 3
-#define RLIMIT_FSIZE 4
-#define RLIMIT_NOFILE 5
-#define RLIMIT_STACK 6
-#define RLIMIT_AS 7
-#define RLIMIT_VMEM RLIMIT_AS /* common alias */
-
-#if defined(_NETBSD_SOURCE)
-#define RLIM_NLIMITS 8 /* number of resource limits */
-#endif
-
-#define RLIM_INFINITY ((rlim_t) -1)
-#define RLIM_SAVED_CUR RLIM_INFINITY
-#define RLIM_SAVED_MAX RLIM_INFINITY
-
-struct rlimit
-{
- rlim_t rlim_cur;
- rlim_t rlim_max;
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int getpriority(int, int);
-int getrlimit(int, struct rlimit *);
-int setpriority(int, int, int);
-__END_DECLS
-
-#endif /* !_SYS_RESOURCE_H_ */
+++ /dev/null
-/* $NetBSD: rmd160.h,v 1.2 2008/02/16 17:37:13 apb Exp $ */
-/* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
-/* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */
-/*
- * Copyright (c) 2001 Markus Friedl. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _RMD160_H
-#define _RMD160_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#define RMD160_DIGEST_LENGTH 20
-#define RMD160_DIGEST_STRING_LENGTH 41
-
-/* RMD160 context. */
-typedef struct RMD160Context {
- uint32_t state[5]; /* state */
- uint64_t count; /* number of bits, modulo 2^64 */
- u_char buffer[64]; /* input buffer */
-} RMD160_CTX;
-
-__BEGIN_DECLS
-void RMD160Init(RMD160_CTX *);
-void RMD160Transform(uint32_t [5], const u_char [64]);
-void RMD160Update(RMD160_CTX *, const u_char *, uint32_t);
-void RMD160Final(u_char [RMD160_DIGEST_LENGTH], RMD160_CTX *);
-#ifndef _KERNEL
-char *RMD160End(RMD160_CTX *, char *);
-char *RMD160FileChunk(const char *, char *, off_t, off_t);
-char *RMD160File(const char *, char *);
-char *RMD160Data(const u_char *, size_t, char *);
-#endif /* _KERNEL */
-__END_DECLS
-
-#endif /* _RMD160_H */
+++ /dev/null
-/* $NetBSD: sha1.h,v 1.14 2009/11/06 20:31:19 joerg Exp $ */
-
-/*
- * SHA-1 in C
- * By Steve Reid <steve@edmweb.com>
- * 100% Public Domain
- */
-
-#ifndef _SYS_SHA1_H_
-#define _SYS_SHA1_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#define SHA1_DIGEST_LENGTH 20
-#define SHA1_DIGEST_STRING_LENGTH 41
-
-typedef struct {
- uint32_t state[5];
- uint32_t count[2];
- uint8_t buffer[64];
-} SHA1_CTX;
-
-__BEGIN_DECLS
-void SHA1Transform(uint32_t[5], const uint8_t[64]);
-void SHA1Init(SHA1_CTX *);
-void SHA1Update(SHA1_CTX *, const uint8_t *, unsigned int);
-void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX *);
-#ifndef _KERNEL
-char *SHA1End(SHA1_CTX *, char *);
-char *SHA1FileChunk(const char *, char *, off_t, off_t);
-char *SHA1File(const char *, char *);
-char *SHA1Data(const uint8_t *, size_t, char *);
-#endif /* _KERNEL */
-__END_DECLS
-
-#endif /* _SYS_SHA1_H_ */
+++ /dev/null
-/* $NetBSD: sha2.h,v 1.3 2009/05/26 08:04:12 joerg Exp $ */
-/* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */
-
-/*
- * sha2.h
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford <me@aarongifford.com>
- *
- * Copyright 2000 Aaron D. Gifford. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holder nor the names of contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef __SHA2_H__
-#define __SHA2_H__
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-/*** SHA-224/256/384/512 Various Length Definitions ***********************/
-#define SHA224_BLOCK_LENGTH 64
-#define SHA224_DIGEST_LENGTH 28
-#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
-#define SHA256_BLOCK_LENGTH 64
-#define SHA256_DIGEST_LENGTH 32
-#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
-#define SHA384_BLOCK_LENGTH 128
-#define SHA384_DIGEST_LENGTH 48
-#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
-#define SHA512_BLOCK_LENGTH 128
-#define SHA512_DIGEST_LENGTH 64
-#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
-
-
-/*** SHA-256/384/512 Context Structures *******************************/
-typedef struct _SHA256_CTX {
- uint32_t state[8];
- uint64_t bitcount;
- uint8_t buffer[SHA256_BLOCK_LENGTH];
-} SHA256_CTX;
-
-typedef struct _SHA512_CTX {
- uint64_t state[8];
- uint64_t bitcount[2];
- uint8_t buffer[SHA512_BLOCK_LENGTH];
-} SHA512_CTX;
-
-typedef SHA256_CTX SHA224_CTX;
-typedef SHA512_CTX SHA384_CTX;
-
-
-/*** SHA-256/384/512 Function Prototypes ******************************/
-__BEGIN_DECLS
-int SHA224_Init(SHA224_CTX *);
-int SHA224_Update(SHA224_CTX*, const uint8_t*, size_t);
-int SHA224_Final(uint8_t[SHA224_DIGEST_LENGTH], SHA224_CTX*);
-#ifndef _KERNEL
-char *SHA224_End(SHA224_CTX *, char[SHA224_DIGEST_STRING_LENGTH]);
-char *SHA224_FileChunk(const char *, char *, off_t, off_t);
-char *SHA224_File(const char *, char *);
-char *SHA224_Data(const uint8_t *, size_t, char[SHA224_DIGEST_STRING_LENGTH]);
-#endif /* !_KERNEL */
-
-int SHA256_Init(SHA256_CTX *);
-int SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
-int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
-#ifndef _KERNEL
-char *SHA256_End(SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
-char *SHA256_FileChunk(const char *, char *, off_t, off_t);
-char *SHA256_File(const char *, char *);
-char *SHA256_Data(const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
-#endif /* !_KERNEL */
-
-int SHA384_Init(SHA384_CTX*);
-int SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
-int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
-#ifndef _KERNEL
-char *SHA384_End(SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
-char *SHA384_FileChunk(const char *, char *, off_t, off_t);
-char *SHA384_File(const char *, char *);
-char *SHA384_Data(const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
-#endif /* !_KERNEL */
-
-int SHA512_Init(SHA512_CTX*);
-int SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
-int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
-#ifndef _KERNEL
-char *SHA512_End(SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
-char *SHA512_FileChunk(const char *, char *, off_t, off_t);
-char *SHA512_File(const char *, char *);
-char *SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
-#endif /* !_KERNEL */
-__END_DECLS
-
-#endif /* __SHA2_H__ */
+++ /dev/null
-#ifndef _SYS_STAT_H_
-#define _SYS_STAT_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h> /* XXX */
-
-#if defined(_NETBSD_SOURCE)
-#include <sys/time.h>
-#endif
-
-struct stat {
- big_dev_t st_dev; /* inode's device */
- big_mode_t st_mode; /* inode protection mode */
- big_ino_t st_ino; /* inode's number */
- big_nlink_t st_nlink; /* number of hard links */
- big_uid_t st_uid; /* user ID of the file's owner */
- big_gid_t st_gid; /* group ID of the file's group */
- big_dev_t st_rdev; /* device type */
-#if defined(_NETBSD_SOURCE)
- struct timespec st_atimespec;/* time of last access */
- struct timespec st_mtimespec;/* time of last data modification */
- struct timespec st_ctimespec;/* time of last file status change */
- struct timespec st_birthtimespec; /* time of creation */
-#else
- time_t st_atime; /* time of last access */
- long st_atimensec; /* nsec of last access */
- time_t st_mtime; /* time of last data modification */
- long st_mtimensec; /* nsec of last data modification */
- time_t st_ctime; /* time of last file status change */
- long st_ctimensec; /* nsec of last file status change */
- time_t st_birthtime; /* time of creation */
- long st_birthtimensec; /* nsec of time of creation */
-#endif
-#ifdef ST_SIZE_OFF_T
- off_t st_size; /* file size, in off_t bytes */
- off_t st_size_rest;
-#else
- big_off_t st_size; /* file size, in bytes */
-#endif
- blkcnt_t st_blocks; /* blocks allocated for file */
- blksize_t st_blksize; /* optimal blocksize for I/O */
- u32_t st_flags; /* user defined flags for file */
- u32_t st_gen; /* file generation number */
- u32_t st_spare[2];
-};
-
-struct minix_prev_stat {
- short st_dev; /* major/minor device number */
- ino_t st_ino; /* i-node number */
- mode_t st_mode; /* file mode, protection bits, etc. */
- nlink_t st_nlink; /* # links; */
- short st_uid; /* uid of the file's owner */
- short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */
- short st_rdev;
- off_t st_size; /* file size */
- time_t st_atime; /* time of last access */
- time_t st_mtime; /* time of last data modification */
- time_t st_ctime; /* time of last file status change */
-};
-
-#if defined(_NETBSD_SOURCE)
-#define st_atime st_atimespec.tv_sec
-#define st_atimensec st_atimespec.tv_nsec
-#define st_mtime st_mtimespec.tv_sec
-#define st_mtimensec st_mtimespec.tv_nsec
-#define st_ctime st_ctimespec.tv_sec
-#define st_ctimensec st_ctimespec.tv_nsec
-#define st_birthtime st_birthtimespec.tv_sec
-#define st_birthtimensec st_birthtimespec.tv_nsec
-#endif
-
-#define S_ISUID 0004000 /* set user id on execution */
-#define S_ISGID 0002000 /* set group id on execution */
-#if defined(_NETBSD_SOURCE)
-#define S_ISTXT 0001000 /* sticky bit */
-#endif
-
-#define S_IRWXU 0000700 /* RWX mask for owner */
-#define S_IRUSR 0000400 /* R for owner */
-#define S_IWUSR 0000200 /* W for owner */
-#define S_IXUSR 0000100 /* X for owner */
-
-#if defined(_NETBSD_SOURCE)
-#define S_IREAD S_IRUSR
-#define S_IWRITE S_IWUSR
-#define S_IEXEC S_IXUSR
-#endif
-
-#define S_IRWXG 0000070 /* RWX mask for group */
-#define S_IRGRP 0000040 /* R for group */
-#define S_IWGRP 0000020 /* W for group */
-#define S_IXGRP 0000010 /* X for group */
-
-#define S_IRWXO 0000007 /* RWX mask for other */
-#define S_IROTH 0000004 /* R for other */
-#define S_IWOTH 0000002 /* W for other */
-#define S_IXOTH 0000001 /* X for other */
-
-#define _S_IFMT 0170000 /* type of file mask */
-#define _S_IFIFO 0010000 /* named pipe (fifo) */
-#define _S_IFCHR 0020000 /* character special */
-#define _S_IFDIR 0040000 /* directory */
-#define _S_IFBLK 0060000 /* block special */
-#define _S_IFREG 0100000 /* regular */
-#define _S_IFLNK 0120000 /* symbolic link */
-#define _S_IFSOCK 0140000 /* socket */
-#define _S_ISVTX 0001000 /* save swapped text even after use */
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define S_IFMT _S_IFMT
-#define S_IFIFO _S_IFIFO
-#define S_IFCHR _S_IFCHR
-#define S_IFDIR _S_IFDIR
-#define S_IFBLK _S_IFBLK
-#define S_IFREG _S_IFREG
-#define S_IFLNK _S_IFLNK
-#define S_ISVTX _S_ISVTX
-#endif
-#if ((_XOPEN_SOURCE - 0) >= 600) || defined(_NETBSD_SOURCE)
-#define S_IFSOCK _S_IFSOCK
-#endif
-
-#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) /* directory */
-#define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) /* char special */
-#define S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK) /* block special */
-#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) /* regular file */
-#define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) /* fifo */
-#if ((_POSIX_C_SOURCE - 0) >= 200112L) || defined(_XOPEN_SOURCE) || \
- defined(_NETBSD_SOURCE)
-#define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) /* symbolic link */
-#endif
-#if ((_POSIX_C_SOURCE - 0) >= 200112L) || ((_XOPEN_SOURCE - 0) >= 600) || \
- defined(_NETBSD_SOURCE)
-#define S_ISSOCK(m) (((m) & _S_IFMT) == _S_IFSOCK) /* socket */
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
- /* 7777 */
-#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
- /* 0666 */
-#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
-
-#define S_BLKSIZE 512 /* block size used in the stat struct */
-
-/*
- * Definitions of flags stored in file flags word.
- *
- * Super-user and owner changeable flags.
- */
-#define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
-#define UF_NODUMP 0x00000001 /* do not dump file */
-#define UF_IMMUTABLE 0x00000002 /* file may not be changed */
-#define UF_APPEND 0x00000004 /* writes to file may only append */
-#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
-
-/*
- * Super-user changeable flags.
- */
-#define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
-#define SF_ARCHIVED 0x00010000 /* file is archived */
-#define SF_IMMUTABLE 0x00020000 /* file may not be changed */
-#define SF_APPEND 0x00040000 /* writes to file may only append */
-
-#endif /* _NETBSD_SOURCE */
-
-#if defined(__minix)
-#include <machine/vmparam.h>
-/* Convenient constant to use when st_blocksize field is required. */
-#define MINIX_ST_BLKSIZE PAGE_SIZE
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int chmod(const char *, mode_t);
-int mkdir(const char *, mode_t);
-int mkfifo(const char *, mode_t);
-#ifndef __LIBC12_SOURCE__
-int stat(const char *, struct stat *) __RENAME(__stat50);
-int fstat(int, struct stat *) __RENAME(__fstat50);
-#endif
-mode_t umask(mode_t);
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int fchmod(int, mode_t);
-#ifndef __LIBC12_SOURCE__
-int lstat(const char *, struct stat *) __RENAME(__lstat50);
-int mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
-#endif
-#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
-__END_DECLS
-
-#endif /* !_SYS_STAT_H_ */
+++ /dev/null
-#ifndef _SYS_SYSLIMITS_H_
-#define _SYS_SYSLIMITS_H_
-
-#include <minix/limits.h>
-#include <sys/featuretest.h>
-
-/* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */
-/* Some of these old names had better be defined when not POSIX. */
-#define _NO_LIMIT 160 /* arbitrary number; limit not enforced */
-
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
- defined(_NETBSD_SOURCE)
-
-#define ARG_MAX 262144 /* # bytes of args + environ for exec() */
-
-#ifndef CHILD_MAX
-#define CHILD_MAX _NO_LIMIT /* max simultaneous processes */
-#endif
-
-#define GID_MAX USHRT_MAX /* max value for a gid_t */
-#define LINK_MAX SHRT_MAX /* # links a file may have */
-#define MAX_CANON 255 /* size of the canonical input queue */
-#define MAX_INPUT 255 /* size of the type-ahead buffer */
-#define NAME_MAX 255 /* system-wide max # chars in a file name */
-#define NGROUPS_MAX 8 /* max. number of supplemental groups */
-#define UID_MAX USHRT_MAX /* max value for a uid_t */
-#ifndef OPEN_MAX
-#define OPEN_MAX __MINIX_OPEN_MAX /* max open files per process */
-#endif
-#define PATH_MAX __MINIX_PATH_MAX /* # chars in a path name */
-#define PIPE_BUF 32768 /* # bytes in atomic write to a pipe */
-
-#define BC_BASE_MAX INT_MAX /* max ibase/obase values in bc(1) */
-#define BC_DIM_MAX 65535 /* max array elements in bc(1) */
-#define BC_SCALE_MAX INT_MAX /* max scale value in bc(1) */
-#define BC_STRING_MAX INT_MAX /* max const string length in bc(1) */
-#define COLL_WEIGHTS_MAX 2 /* max weights for order keyword */
-#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
-#define LINE_MAX 2048 /* max bytes in an input line */
-#define RE_DUP_MAX 255 /* max RE's in interval notation */
-
-/*
- * IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
- defined(_NETBSD_SOURCE)
-#define LOGIN_NAME_MAX 17 /* max login name length incl. NUL */
-#endif
-
-/*
- * X/Open CAE Specification Issue 5 Version 2
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define IOV_MAX 1024 /* max # of iovec's for readv(2) etc. */
-#define NZERO 20 /* default "nice" */
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#endif /* !_ANSI_SOURCE */
-
-#ifdef __minix
-#define STREAM_MAX 8 /* == _POSIX_STREAM_MAX */
-#define TZNAME_MAX 6 /* == _POSIX_TZNAME_MAX */
-#define TIME_MAX LONG_MAX
-#endif
-
-#endif /* !_SYS_SYSLIMITS_H_ */
-
+++ /dev/null
-#ifndef _SYS_TERMIOS_H_
-#define _SYS_TERMIOS_H_
-
-#include <sys/cdefs.h>
-
-#include <minix/termios.h>
-
-__BEGIN_DECLS
-#if defined(_NETBSD_SOURCE)
-void cfmakeraw(struct termios *);
-int cfsetspeed(struct termios *, speed_t);
-#endif /* defined(_NETBSD_SOURCE) */
-__END_DECLS
-
-#endif /* !_SYS_TERMIOS_H_ */
-
-#include <sys/ttydefaults.h>
+++ /dev/null
-#ifndef _SYS_TIMES_H_
-#define _SYS_TIMES_H_
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_CLOCK_T_
-typedef _BSD_CLOCK_T_ clock_t;
-#undef _BSD_CLOCK_T_
-#endif
-
-struct tms {
- clock_t tms_utime; /* User CPU time */
- clock_t tms_stime; /* System CPU time */
- clock_t tms_cutime; /* User CPU time of terminated child procs */
- clock_t tms_cstime; /* System CPU time of terminated child procs */
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-clock_t times(struct tms *);
-__END_DECLS
-
-#endif /* !_SYS_TIMES_H_ */
+++ /dev/null
-#ifndef _SYS_TERMIOS_H_
-#define _SYS_TERMIOS_H_
-
-#include <minix/termios.h>
-
-#endif /* !_SYS_TERMIOS_H_ */
+++ /dev/null
-/*
- * System wide defaults for terminal state.
- */
-#ifndef _SYS_TTYDEFAULTS_H_
-#define _SYS_TTYDEFAULTS_H_
-
-/* NetBSD-like definition of values aready set up in termios.h */
-
-/*
- * Defaults on "first" open.
- */
-#define TTYDEF_IFLAG (BRKINT | ICRNL | IXON | IXANY)
-#define TTYDEF_OFLAG (OPOST | ONLCR )
-#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE)
-#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
-#define TTYDEF_SPEED (B9600)
-
-/*
- * Control Character Defaults
- */
-#define CTRL(x) (x&037)
-#define CEOF CTRL('d')
-#define CEOL _POSIX_VDISABLE
-#define CERASE CTRL('h')
-#define CINTR CTRL('c')
-#define CSTATUS CTRL('t')
-#define CKILL CTRL('u')
-#define CMIN 1
-#define CQUIT 034 /* FS, ^\ */
-#define CSUSP CTRL('z')
-#define CTIME 0
-#define CDSUSP CTRL('y')
-#define CSTART CTRL('q')
-#define CSTOP CTRL('s')
-#define CLNEXT CTRL('v')
-#define CDISCARD CTRL('o')
-#define CWERASE CTRL('w')
-#define CREPRINT CTRL('r')
-#define CEOT CEOF
-/* compat */
-#define CBRK CEOL
-#define CRPRNT CREPRINT
-#define CFLUSH CDISCARD
-
-#endif /* _SYS_TTYDEFAULTS_H_ */
+++ /dev/null
-#ifndef _SYS_UCONTEXT_H_
-#define _SYS_UCONTEXT_H_
-
-#include <sys/sigtypes.h>
-#include <machine/mcontext.h>
-
-typedef struct __ucontext ucontext_t;
-
-struct __ucontext {
- unsigned int uc_flags; /* Properties of ucontext */
- ucontext_t *uc_link; /* Next context to resume when current is finished */
- mcontext_t uc_mcontext; /* Machine state */
- sigset_t uc_sigmask; /* Signals blocked in this context */
- stack_t uc_stack; /* The stack used by this context */
-};
-
-#ifndef _UC_UCONTEXT_ALIGN
-#define _UC_UCONTEXT_ALIGN (~0)
-#endif
-
-#define UCF_SWAPPED 001 /* Context has been swapped in by swapcontext(3) */
-#define UCF_IGNFPU 002 /* Ignore FPU context by get or setcontext(3) */
-#define UCF_IGNSIGM 004 /* Ignore signal mask by get or setcontext(3) */
-
-#define NCARGS 6
-
-#ifdef __minix
-__BEGIN_DECLS
-void resumecontext(ucontext_t *ucp);
-
-/* These functions get and set ucontext structure through PM/kernel. They don't
- * manipulate the stack. */
-int getuctx(ucontext_t *ucp);
-int setuctx(const ucontext_t *ucp);
-__END_DECLS
-#endif /* __minix */
-
-#endif /* !_SYS_UCONTEXT_H_ */
+++ /dev/null
-#ifndef __SYS_UCRED_H
-#define __SYS_UCRED_H
-
-struct ucred_old
-{
- pid_t pid;
- short uid;
- char gid;
-};
-
-struct ucred
-{
- pid_t pid;
- uid_t uid;
- gid_t gid;
-};
-
-/* Userland's view of credentials. This should not change */
-struct uucred {
- unsigned short cr_unused; /* not used, compat */
- uid_t cr_uid; /* effective user id */
- gid_t cr_gid; /* effective group id */
- short cr_ngroups; /* number of groups */
- gid_t cr_groups[NGROUPS_MAX]; /* groups */
-};
-
-#endif
+++ /dev/null
-#ifndef _SYS_UIO_H_
-#define _SYS_UIO_H_
-
-#include <machine/ansi.h>
-#include <sys/featuretest.h>
-
-#ifdef _BSD_SIZE_T_
-typedef _BSD_SIZE_T_ size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_SSIZE_T_
-typedef _BSD_SSIZE_T_ ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-struct iovec {
- void *iov_base; /* Base address. */
- size_t iov_len; /* Length. */
-};
-
-#if defined(_NETBSD_SOURCE)
-/*
- * Limits
- */
-/* Deprecated: use IOV_MAX from <limits.h> instead. */
-#define UIO_MAXIOV 1024 /* max 1K of iov's */
-#endif /* _NETBSD_SOURCE */
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-ssize_t readv(int, const struct iovec *, int);
-ssize_t writev(int, const struct iovec *, int);
-__END_DECLS
-
-#endif /* !_SYS_UIO_H_ */
+++ /dev/null
-#ifndef _SYS_UTSNAME_H_
-#define _SYS_UTSNAME_H_
-
-#include <sys/featuretest.h>
-
-#define _SYS_NMLN 256
-
-#if defined(_NETBSD_SOURCE)
-#define SYS_NMLN _SYS_NMLN
-#endif
-
-struct utsname {
- char sysname[_SYS_NMLN]; /* Name of this OS. */
- char nodename[_SYS_NMLN]; /* Name of this network node. */
- char release[_SYS_NMLN]; /* Release level. */
- char version[_SYS_NMLN]; /* Version level. */
- char machine[_SYS_NMLN]; /* Hardware type. */
- char arch[_SYS_NMLN];
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int uname(struct utsname *);
-#ifdef __minix
-int sysuname(int _req, int _field, char *_value, size_t _len);
-#endif
-__END_DECLS
-
-#ifdef __minix
-/* req: Get or set a string. */
-#define _UTS_GET 0
-#define _UTS_SET 1
-
-/* field: What field to get or set. These values can't be changed lightly. */
-#define _UTS_ARCH 0
-#define _UTS_KERNEL 1
-#define _UTS_MACHINE 2
-#define _UTS_HOSTNAME 3
-#define _UTS_NODENAME 4
-#define _UTS_RELEASE 5
-#define _UTS_VERSION 6
-#define _UTS_SYSNAME 7
-#define _UTS_BUS 8
-#define _UTS_MAX 9 /* Number of strings. */
-#endif /* __minix */
-
-#endif /* !_SYS_UTSNAME_H_ */
HERE=${.CURDIR}/arch/${MACHINE_ARCH}/sys-minix
.PATH: ${HERE}
+ARCHINCLS=${NETBSDSRCDIR}/include/arch/${MACHINE_ARCH}/include/
TMP=ucontextoffsets.h.tmp
-INCLS=../../include
-ARCHINCLS=$(INCLS)/arch/i386/include/
CF=ucontextoffsets.cf
INCS+=ucontextoffsets.h
brksize.S \
ucontext.S
-ucontextoffsets.h: $(CF) $(ARCHINCLS)/stackframe.h $(INCLS)/sys/ucontext.h
+ucontextoffsets.h: ${CF} ${ARCHINCLS}/stackframe.h ${NETBSDSRCDIR}/sys/sys/ucontext.h
${_MKTARGET_CREATE}
cat ${HERE}/$(CF) | \
${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$TMP && \
-# Makefile for the boot stuff.
+# $NetBSD: Makefile,v 1.78 2012/08/17 16:22:27 joerg Exp $
.include <bsd.own.mk>
-SUBDIR = arch/i386/stand/mbr
-SUBDIR+= arch/i386/stand/bootxx
-SUBDIR+= arch/i386/stand/boot
-SUBDIR+= arch/i386/stand/cdboot
-SUBDIR+= ufs
+SUBDIR= arch \
+ net netinet netinet6 \
+ \
+ sys ufs
-.include <bsd.subdir.mk>
+.if !defined(__MINIX)
+# LSC the test is OR, but as it is not relevant to MINIX, we have
+# to completly ignore this.
+
+# interrupt implementation depends on the kernel within the port
+#.if (${MACHINE} != "evbppc")
+.if make(obj) || make(cleandir) || ${MKKMOD} != "no"
+SUBDIR+=modules
+.endif
+#.endif
+.endif # !defined(__MINIX)
+
+# LSC FIXME: Remove this test as soon as we have imported RUMP
+.if !defined(__MINIX)
+.if make(includes) || make(obj) || make(cleandir)
+SUBDIR+= rump
+.endif
+.endif # !defined(__MINIX)
+
+.include <bsd.kinc.mk>
--- /dev/null
+# $NetBSD: Makefile,v 1.41 2011/07/17 20:54:35 joerg Exp $
+
+# For now, we install the machine and arch includes, and symlink 'machine'
+# to the location of the machine includes (usually).
+#
+# Eventually, we should install everything.
+
+.include <bsd.own.mk>
+
+SUBDIR= ${MACHINE}
+ARCHSUBDIR= ${MACHINE_CPU}
+
+.if ${ARCHSUBDIR} == "mips64"
+ARCHSUBDIR= mips
+.endif
+.if ${ARCHSUBDIR} == "powerpc64"
+ARCHSUBDIR= powerpc
+.endif
+
+.if ${MACHINE} != ${ARCHSUBDIR}
+.if exists(${ARCHSUBDIR})
+SUBDIR+= ${ARCHSUBDIR}
+.endif
+.endif
+.if ${MACHINE} == sparc
+SUBDIR+= sparc64
+.endif
+.if (${MACHINE} == hpcmips || ${MACHINE} == hpcsh)
+SUBDIR+= hpc
+.endif
+.if (${MACHINE} == sun2 || ${MACHINE} == sun3)
+SUBDIR+= sun68k
+.endif
+.if defined(XEN_BUILD)
+SUBDIR+= xen
+.endif
+
+#SUBDIR=acorn26 acorn32 algor alpha amiga amigappc arm arc atari \
+# bebox \
+# cats cesfic cobalt \
+# dreamcast \
+# evbarm evbmips evbppc evbsh3 ews4800mips\
+# hp300 hpc hpcarm hpcmips hpcsh \
+# i386 iyonix \
+# luna68k \
+# m68k mac68k macppc mips mipsco mmeye mvme68k \
+# netwinder news68k newsmips next68k \
+# ofppc \
+# pmax powerpc prep \
+# sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
+# rs6000 \
+# vax \
+# x68k x86_64 xen \
+# zaurus
+
+INCSYMLINKS= ${MACHINE} /usr/include/machine
+
+INCSYMLINKS+= machine/float.h /usr/include/float.h
+
+.include <bsd.kinc.mk>
--- /dev/null
+# $NetBSD: Makefile,v 1.8 2008/06/25 03:33:39 matt Exp $
+
+SUBDIR= include .WAIT include/arm26 include/arm32
+
+# install footbridge headers.
+SUBDIR+= footbridge
+
+.include <bsd.kinc.mk>
--- /dev/null
+# $NetBSD: Makefile.inc,v 1.1 2011/04/04 19:43:34 dyoung Exp $
+
+AARM= ${SYSDIR}/arch/arm/arm/*.S
+SARM= ${SYSDIR}/arch/arm/arm/*.[ch] ${SYSDIR}/arch/arm/include/*.h
+SARM+= ${SYSDIR}/arch/arm/arm32/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/at91/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/ep93xx/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/footbridge/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/fpe-arm/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/gemini/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/imx/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/iomd/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/ixp12x0/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/mainbus/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/marvell/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/mpcore/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/ofw/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/omap/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/pic/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/s3c2xx0/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/sa11x0/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/vfp/*.[ch]
+SARM+= ${SYSDIR}/arch/arm/xscale/*.[ch]
--- /dev/null
+# $NetBSD: Makefile,v 1.43 2012/08/15 20:38:49 matt Exp $
+
+INCSDIR= /usr/include/arm
+
+INCS= ansi.h asm.h \
+ bswap.h byte_swap.h \
+ cdefs.h cpu.h \
+ disklabel.h \
+ elf_machdep.h endian.h endian_machdep.h \
+ float.h \
+ ieee.h ieeefp.h \
+ int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
+ \
+ limits.h lock.h \
+ math.h mcontext.h mutex.h \
+ param.h profile.h \
+ \
+ \
+ setjmp.h signal.h \
+ types.h \
+ \
+ wchar_limits.h
+
+.include <bsd.kinc.mk>
-/* $NetBSD: ansi.h,v 1.12 2010/03/27 22:14:09 tnozaki Exp $ */
+/* $NetBSD: ansi.h,v 1.13 2011/07/17 20:54:37 joerg Exp $ */
/*
* Copyright (c) 1990, 1993
* from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
*/
-/* These types are Minix specific. */
-
#ifndef _ANSI_H_
#define _ANSI_H_
#define _BSD_SIZE_T_ unsigned int /* sizeof() */
#define _BSD_SSIZE_T_ int /* byte count or error */
#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 */
--- /dev/null
+# $NetBSD: Makefile,v 1.9 2002/11/26 23:30:12 lukem Exp $
+
+INCSDIR= /usr/include/arm/arm32
+
+INCS= types.h vmparam.h
+
+.include <bsd.kinc.mk>
--- /dev/null
+/* $NetBSD: types.h,v 1.9 2010/07/07 01:20:50 chs Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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 _ARM_ARM32_TYPES_H_
+#define _ARM_ARM32_TYPES_H_
+
+#ifdef _KERNEL
+#define __PROG32 /* indicate 32-bit mode */
+
+#ifdef _KERNEL_OPT
+#include "opt_arm32_pmap.h"
+#endif
+#endif
+
+#include <arm/types.h> /* pull in generic ARM definitions */
+
+#define __HAVE_CPU_LWP_SETPRIVATE
+
+#endif /* _ARM_ARM32_TYPES_H_ */
--- /dev/null
+#ifndef _ARM_ARM32_VMPARAM_H_
+#define _ARM_ARM32_VMPARAM_H_
+
+/*
+ * Virtual Memory parameters common to all arm32 platforms.
+ */
+
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+
+#endif /* _ARM_ARM32_VMPARAM_H_ */
-/* $NetBSD: asm.h,v 1.14 2011/06/30 20:09:20 wiz Exp $ */
+/* $NetBSD: asm.h,v 1.16 2012/09/01 14:46:25 matt Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
#include <arm/cdefs.h>
+#define __BIT(n) (1 << (n))
+#define __BITS(hi,lo) ((~((~0)<<((hi)+1)))&((~0)<<(lo)))
+
#define _C_LABEL(x) x
#define _ASM_LABEL(x) x
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
#endif
#define _END(x) .size x,.-x
-#define _LABEL(x) \
- .globl x; x:
#ifdef GPROF
# define _PROF_PROLOGUE \
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define ASEND(y) _END(_ASM_LABEL(y))
-#define LABEL(y) _LABEL(_C_LABEL(y))
#define ASMSTR .asciz
-/* $NetBSD: byte_swap.h,v 1.8 2008/04/28 20:23:14 martin Exp $ */
+/* $NetBSD: byte_swap.h,v 1.12 2012/09/05 01:03:53 matt Exp $ */
/*-
* Copyright (c) 1997, 1999, 2002 The NetBSD Foundation, Inc.
#ifndef _ARM_BYTE_SWAP_H_
#define _ARM_BYTE_SWAP_H_
+#ifdef _LOCORE
+
+#if defined(_ARM_ARCH_6) || defined(_ARM_ARCH_7)
+
+#define BSWAP16(_src, _dst, _tmp) \
+ rev16 _dst, _src
+#define BSWAP32(_src, _dst, _tmp) \
+ rev _dst, _src
+
+#else
+
+#define BSWAP16(_src, _dst, _tmp) \
+ mov _tmp, _src, ror #8 ;\
+ orr _tmp, _tmp, _tmp, lsr #16 ;\
+ bic _dst, _tmp, _tmp, lsl #16
+
+#define BSWAP32(_src, _dst, _tmp) \
+ eor _tmp, _src, _src, ror #16 ;\
+ bic _tmp, _tmp, #0x00FF0000 ;\
+ mov _dst, _src, ror #8 ;\
+ eor _dst, _dst, _tmp, lsr #8
+
+#endif
+
+
+#else
+
#ifdef __GNUC__
#include <sys/types.h>
__BEGIN_DECLS
static __inline uint32_t
__byte_swap_u32_variable(uint32_t v)
{
-#ifdef _ARM_ARCH_6
- __asm("rev\t%0, %1" : "=r" (v) : "0" (v));
-#else
uint32_t t1;
+#ifdef _ARM_ARCH_6
+ if (!__builtin_constant_p(v)) {
+ __asm("rev\t%0, %1" : "=r" (v) : "0" (v));
+ return v;
+ }
+#endif
+
t1 = v ^ ((v << 16) | (v >> 16));
t1 &= 0xff00ffffU;
v = (v >> 8) | (v << 24);
v ^= (t1 >> 8);
-#endif
+
return (v);
}
{
#ifdef _ARM_ARCH_6
- __asm("rev16\t%0, %1" : "=r" (v) : "0" (v));
-#elif !defined(__thumb__)
- __asm volatile(
- "mov %0, %1, ror #8\n"
- "orr %0, %0, %0, lsr #16\n"
- "bic %0, %0, %0, lsl #16"
- : "=r" (v)
- : "0" (v));
-#else
+ if (!__builtin_constant_p(v)) {
+ __asm("rev16\t%0, %1" : "=r" (v) : "0" (v));
+ return v;
+ }
+#elif !defined(__thumb__) && 0 /* gcc produces decent code for this */
+ if (!__builtin_constant_p(v)) {
+ uint32_t v0 = v;
+ __asm volatile(
+ "mov %0, %1, ror #8\n"
+ "orr %0, %0, %0, lsr #16\n"
+ "bic %0, %0, %0, lsl #16"
+ : "=&r" (v0)
+ : "0" (v0));
+ return v0;
+ }
+#endif
v &= 0xffff;
v = (v >> 8) | (v << 8);
-#endif
return (v);
}
__END_DECLS
#endif
+#endif /* _LOCORE */
#endif /* _ARM_BYTE_SWAP_H_ */
--- /dev/null
+/* $NetBSD: cdefs.h,v 1.7 2012/08/05 04:13:19 matt Exp $ */
+
+#ifndef _MACHINE_CDEFS_H_
+#define _MACHINE_CDEFS_H_
+
+#if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__) || \
+ defined (__ARM_ARCH_7R__) || defined (__ARM_ARCH_7M__) || \
+ defined (__ARM_ARCH_7EM__) /* 7R, 7M, 7EM are for non MMU arms */
+#define _ARM_ARCH_7
+#endif
+
+#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6__) || \
+ defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6K__) || \
+ defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__) || \
+ defined (__ARM_ARCH_6T2__) || defined (__ARM_ARCH_6ZM__)
+#define _ARM_ARCH_6
+#endif
+
+#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5__) || \
+ defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5TE__) || \
+ defined (__ARM_ARCH_5TEJ__)
+#define _ARM_ARCH_5
+#endif
+
+#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
+#define _ARM_ARCH_4T
+#endif
+
+#if defined(_ARM_ARCH_6) || defined (__ARM_ARCH_5TE__) || \
+ defined (__ARM_ARCH_5TEJ__)
+#define _ARM_ARCH_DWORD_OK
+#endif
+
+#ifdef __ARM_EABI__
+#define __ALIGNBYTES (8 - 1)
+#else
+#define __ALIGNBYTES (sizeof(int) - 1)
+#endif
+
+#endif /* !_MACHINE_CDEFS_H_ */
-/* $NetBSD: disklabel.h,v 1.9 2009/11/23 13:40:09 pooka Exp $ */
+/* $NetBSD: disklabel.h,v 1.10 2011/08/30 12:39:53 bouyer Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
#ifndef _ARM_DISKLABEL_H_
#define _ARM_DISKLABEL_H_
+#ifndef LABELUSESMBR
+#define LABELUSESMBR 0 /* no MBR partitionning */
+#endif
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
#define MAXPARTITIONS 8 /* number of partitions */
-/* $NetBSD: elf_machdep.h,v 1.8 2009/05/30 05:56:52 skrll Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.10 2012/08/05 04:12:46 matt Exp $ */
+
+#ifndef _ARM_ELF_MACHDEP_H_
+#define _ARM_ELF_MACHDEP_H_
#if defined(__ARMEB__)
#define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB
#define EF_ARM_OLD_ABI 0x00000100
#define EF_ARM_SOFT_FLOAT 0x00000200
#define EF_ARM_EABIMASK 0xff000000
+#define EF_ARM_EABI_VER1 0x01000000
+#define EF_ARM_EABI_VER2 0x02000000
+#define EF_ARM_EABI_VER3 0x03000000
+#define EF_ARM_EABI_VER4 0x04000000
+#define EF_ARM_EABI_VER5 0x05000000
#define ELF32_MACHDEP_ID_CASES \
case EM_ARM: \
/* Processor specific symbol types */
#define STT_ARM_TFUNC STT_LOPROC
+
+#ifdef _KERNEL
+#ifdef ELFSIZE
+#define ELF_MD_PROBE_FUNC ELFNAME2(arm_netbsd,probe)
+#endif
+
+struct exec_package;
+
+int arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
+ vaddr_t *);
+#endif
+
+#endif /* _ARM_ELF_MACHDEP_H_ */
-/* $NetBSD: limits.h,v 1.10 2010/06/07 13:52:30 tnozaki Exp $ */
+/* $NetBSD: limits.h,v 1.12 2012/03/28 17:03:28 christos Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
#define CHAR_BIT 8 /* number of bits in a char */
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
#define UCHAR_MAX 0xff /* max value for an unsigned char */
-#define CHAR_MAX 0xff /* max value for a char */
-#define CHAR_MIN 0 /* min value for a char */
+#define SCHAR_MAX 0x7f /* max value for a signed char */
+#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
#define USHRT_MAX 0xffff /* max value for an unsigned short */
#define SHRT_MAX 0x7fff /* max value for a short */
#if defined(_NETBSD_SOURCE)
#define SIZE_T_MAX LONG_MAX /* max value for a size_t */
-#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */
+#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-/* $NetBSD: lock.h,v 1.17 2008/04/28 20:23:14 martin Exp $ */
+/* $NetBSD: lock.h,v 1.21 2012/08/31 17:29:08 matt Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
{
*alp = __SIMPLELOCK_UNLOCKED;
+#ifdef _ARM_ARCH_7
+ __asm __volatile("dsb");
+#endif
}
static __inline void __attribute__((__unused__))
__cpu_simple_unlock(__cpu_simple_lock_t *alp)
{
+#ifdef _ARM_ARCH_7
+ __asm __volatile("dmb");
+#endif
*alp = __SIMPLELOCK_UNLOCKED;
+#ifdef _ARM_ARCH_7
+ __asm __volatile("dsb");
+#endif
}
#endif /* _ARM_LOCK_H_ */
-/* $NetBSD: mutex.h,v 1.10 2008/04/28 20:23:14 martin Exp $ */
+/* $NetBSD: mutex.h,v 1.13 2012/09/25 05:24:00 matt Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
/* Spin mutex */
struct {
+ /*
+ * Since the low bit of mtax_owner is used to flag this
+ * mutex as a spin mutex, we can't use the first byte
+ * or the last byte to store the ipl or lock values.
+ */
volatile uint8_t mtxs_dummy;
ipl_cookie_t mtxs_ipl;
__cpu_simple_lock_t mtxs_lock;
*/
#define MUTEX_GIVE(mtx) /* nothing */
-unsigned long _lock_cas(volatile unsigned long *,
- unsigned long, unsigned long);
-
#define MUTEX_CAS(p, o, n) \
- (_lock_cas((volatile unsigned long *)(p), (o), (n)) == (o))
+ (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
+#ifdef MULTIPROCESSOR
+#define MUTEX_SMT_PAUSE() __asm __volatile("wfe")
+#define MUTEX_SMT_WAKE() __asm __volatile("sev")
+#endif
#endif /* __MUTEX_PRIVATE */
-/* $NetBSD: param.h,v 1.13 2010/05/06 19:10:26 joerg Exp $ */
+/* $NetBSD: param.h,v 1.17 2012/08/03 08:11:40 matt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
#define MID_MACHINE MID_ARM6
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
/* ARM-specific macro to align a stack pointer (downwards). */
-#define STACKALIGNBYTES (8 - 1)
-#define STACKALIGN(p) ((u_int)(p) &~ STACKALIGNBYTES)
+#define STACK_ALIGNBYTES (8 - 1)
+#ifdef __ARM_EABI__
+#define ALIGNBYTES32 3
+#else
+#define ALIGNBYTES32 7
+#endif
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define DEV_BSIZE (1 << DEV_BSHIFT)
-/* $NetBSD: setjmp.h,v 1.3 2008/08/29 19:08:29 matt Exp $ */
+/* $NetBSD: setjmp.h,v 1.4 2011/06/30 20:09:20 wiz Exp $ */
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*
* Description of the setjmp buffer
*
- * word 0 magic number (dependant on creator)
+ * word 0 magic number (dependent on creator)
* 1 - 3 f4 fp register 4
* 4 - 6 f5 fp register 5
* 7 - 9 f6 fp register 6
* 22 r12 register 12 (ip)
* 23 r13 register 13 (sp)
* 24 r14 register 14 (lr)
- * 25 signal mask (dependant on magic)
+ * 25 signal mask (dependent on magic)
* 26 (con't)
* 27 (con't)
* 28 (con't)
-/* $NetBSD: types.h,v 1.18 2010/12/22 01:04:23 matt Exp $ */
+/* $NetBSD: types.h,v 1.23 2012/08/12 05:05:47 matt Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
#define PRIuVSIZE "lu"
#endif
-typedef int register_t;
+typedef int register_t, register32_t;
#define PRIxREGISTER "x"
typedef unsigned long pmc_evid_t;
#define __SIMPLELOCK_UNLOCKED 0
#define __HAVE_SYSCALL_INTERN
+#define __HAVE_NEW_STYLE_BUS_H
#define __HAVE_MINIMAL_EMUL
#define __HAVE_CPU_DATA_FIRST
+#define __HAVE___LWP_GETPRIVATE_FAST
+#define __HAVE_COMMON___TLS_GET_ADDR
+#define __HAVE_TLS_VARIANT_I
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+#define PCU_FPU 0
+#define PCU_UNIT_COUNT 1
+#endif
#if defined(_KERNEL)
#define __HAVE_RAS
--- /dev/null
+# $NetBSD: Makefile,v 1.42 2011/09/02 22:12:48 dyoung Exp $
+
+# Makefile for i386 tags file and boot blocks
+
+TI386= ${SYSDIR}/arch/i386/tags
+SI386= ${SYSDIR}/arch/i386/acpi/*.[ch] \
+ ${SYSDIR}/arch/i386/eisa/*.[ch] \
+ ${SYSDIR}/arch/i386/i386/*.[ch] \
+ ${SYSDIR}/arch/i386/include/*.h \
+ ${SYSDIR}/arch/i386/isa/*.[ch] \
+ ${SYSDIR}/arch/i386/mca/*.[ch] \
+ ${SYSDIR}/arch/i386/pci/*.[ch] \
+ ${SYSDIR}/arch/i386/pnpbios/*.[ch] \
+ ${SYSDIR}/external/isc/atheros_hal/dist/*.[ch] \
+ ${SYSDIR}/external/isc/atheros_hal/dist/*/*.[ch] \
+ ${SYSDIR}/external/isc/atheros_hal/ic/*.[ch]
+SI386+= ${SYSDIR}/arch/x86/x86/*.[ch] \
+ ${SYSDIR}/arch/x86/acpi/*.[ch] \
+ ${SYSDIR}/arch/x86/include/*.h \
+ ${SYSDIR}/arch/x86/isa/*.[ch] \
+ ${SYSDIR}/arch/x86/pci/*.[ch] \
+ ${SYSDIR}/arch/xen/include/*.h \
+ ${SYSDIR}/arch/xen/i386/*.[ch] \
+ ${SYSDIR}/arch/xen/x86/*.[ch] \
+ ${SYSDIR}/arch/xen/xen/*.[ch] \
+ ${SYSDIR}/arch/xen/xenbus/*.[ch]
+AI386= ${SYSDIR}/arch/i386/i386/*.S \
+ ${SYSDIR}/../common/lib/libc/arch/i386/*/*.S
+
+# Directories in which to place tags links
+DI386= i386 eisa isa include pci
+
+.if !defined(__MINIX)
+.include "../../kern/Make.tags.inc"
+
+tags:
+ -rm -f ${TI386}
+ -echo ${SI386} | xargs ctags -wadtf ${TI386}
+ -find -H ${SYSDIR}/external/bsd/acpica/dist/ -name '*.[ch]' | \
+ sort -t / -u | xargs ctags -wadtf ${TI386}
+ -${FINDCOMM} | xargs ctags -wadtf ${TI386}
+ egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AI386} | \
+ ${TOOL_SED} -e \
+ "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
+ >> ${TI386}
+ sort -o ${TI386} ${TI386}
+
+links:
+ -for i in ${DI386}; do \
+ (cd $$i && rm -f tags; ln -s ../tags tags); done
+.endif # !defined(__MINIX)
+
+
+SUBDIR= include stand ../x86/include
+
+.include <bsd.subdir.mk>
--- /dev/null
+# $NetBSD: Makefile,v 1.40 2012/08/08 18:37:52 drochner Exp $
+
+INCSDIR= /usr/include/i386
+
+INCS= ansi.h asm.h \
+ bootinfo.h bswap.h byte_swap.h \
+ cdefs.h cpu.h \
+ disklabel.h \
+ elf_machdep.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 mutex.h multiboot.h \
+ npx.h \
+ param.h pio.h profile.h \
+ \
+ rwlock.h \
+ setjmp.h signal.h \
+ \
+ types.h \
+ vmparam.h \
+ wchar_limits.h
+
+.include <bsd.kinc.mk>
-/* $NetBSD: cpu.h,v 1.178 2011/12/30 17:57:49 cherry Exp $ */
+#ifndef _IBM_CPU_H
+#define _IBM_CPU_H 1
-/*-
- * 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.
- *
- * @(#)cpu.h 5.4 (Berkeley) 5/9/91
- */
+#define X86_FLAG_C (1L << 0) /* S Carry */
+#define X86_FLAG_P (1L << 2) /* S Parity */
+#define X86_FLAG_A (1L << 4) /* S Aux. carry */
+#define X86_FLAG_Z (1L << 6) /* S Zero */
+#define X86_FLAG_S (1L << 7) /* S Sign */
-#ifndef _I386_CPU_H_
-#define _I386_CPU_H_
+#define X86_FLAG_T (1L << 8) /* X Trap */
+#define X86_FLAG_I (1L << 9) /* X Interrupt */
+#define X86_FLAG_D (1L << 10) /* C Direction */
+#define X86_FLAG_O (1L << 11) /* S Overflow */
-#include <x86/cpu.h>
+/* User flags are S (Status) and C (Control) flags. */
+#define X86_FLAGS_USER (X86_FLAG_C | X86_FLAG_P | X86_FLAG_A | X86_FLAG_Z | \
+ X86_FLAG_S | X86_FLAG_D | X86_FLAG_O)
-#ifdef _KERNEL
-
-#if defined(__GNUC__) && !defined(_MODULE)
-static struct cpu_info *x86_curcpu(void);
-static lwp_t *x86_curlwp(void);
-
-__inline static struct cpu_info * __unused
-x86_curcpu(void)
-{
- struct cpu_info *ci;
-
- __asm volatile("movl %%fs:%1, %0" :
- "=r" (ci) :
- "m"
- (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self)));
- return ci;
-}
-
-__inline static lwp_t * __attribute__ ((const))
-x86_curlwp(void)
-{
- lwp_t *l;
-
- __asm volatile("movl %%fs:%1, %0" :
- "=r" (l) :
- "m"
- (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
- return l;
-}
-
-__inline static void __unused
-cpu_set_curpri(int pri)
-{
-
- __asm volatile(
- "movl %1, %%fs:%0" :
- "=m" (*(struct cpu_info *)offsetof(struct cpu_info, ci_schedstate.spc_curpriority)) :
- "r" (pri)
- );
-}
#endif
-
-#define CLKF_USERMODE(frame) USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_eflags)
-#define CLKF_PC(frame) ((frame)->cf_if.if_eip)
-#define CLKF_INTR(frame) (curcpu()->ci_idepth > 0)
-#define LWP_PC(l) ((l)->l_md.md_regs->tf_eip)
-
-#ifdef PAE
-void cpu_alloc_l3_page(struct cpu_info *);
-#endif /* PAE */
-
-#endif /* _KERNEL */
-
-#endif /* !_I386_CPU_H_ */
-/* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
-
-/*-
- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Julio M. Merino Vidal.
- *
- * 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.
- */
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Multiboot header structure.
- */
-#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-#define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
-#define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
-#define MULTIBOOT_HEADER_HAS_VBE 0x00000004
-#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
-
-#if !defined(_LOCORE)
-struct multiboot_header {
- uint32_t mh_magic;
- uint32_t mh_flags;
- uint32_t mh_checksum;
-
- /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
- paddr_t mh_header_addr;
- paddr_t mh_load_addr;
- paddr_t mh_load_end_addr;
- paddr_t mh_bss_end_addr;
- paddr_t mh_entry_addr;
-
- /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
- uint32_t mh_mode_type;
- uint32_t mh_width;
- uint32_t mh_height;
- uint32_t mh_depth;
-};
-#endif /* !defined(_LOCORE) */
-
-/*
- * Symbols defined in locore.S.
- */
-#if !defined(_LOCORE) && defined(_KERNEL)
-extern struct multiboot_header *Multiboot_Header;
-#endif /* !defined(_LOCORE) && defined(_KERNEL) */
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Multiboot information structure.
- */
-#define MULTIBOOT_INFO_MAGIC 0x2BADB002
-#define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
-#define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
-#define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
-#define MULTIBOOT_INFO_HAS_MODS 0x00000008
-#define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
-#define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
-#define MULTIBOOT_INFO_HAS_MMAP 0x00000040
-#define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
-#define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
-#define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
-#define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
-#define MULTIBOOT_INFO_HAS_VBE 0x00000800
-
-#if !defined(_LOCORE)
-struct multiboot_info {
- uint32_t mi_flags;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
- uint32_t mi_mem_lower;
- uint32_t mi_mem_upper;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
- uint8_t mi_boot_device_part3;
- uint8_t mi_boot_device_part2;
- uint8_t mi_boot_device_part1;
- uint8_t mi_boot_device_drive;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
- char * mi_cmdline;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
- uint32_t mi_mods_count;
- vaddr_t mi_mods_addr;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
- uint32_t mi_elfshdr_num;
- uint32_t mi_elfshdr_size;
- vaddr_t mi_elfshdr_addr;
- uint32_t mi_elfshdr_shndx;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
- uint32_t mi_mmap_length;
- vaddr_t mi_mmap_addr;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
- uint32_t mi_drives_length;
- vaddr_t mi_drives_addr;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
- void * unused_mi_config_table;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
- char * mi_loader_name;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
- void * unused_mi_apm_table;
-
- /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
- void * unused_mi_vbe_control_info;
- void * unused_mi_vbe_mode_info;
- paddr_t unused_mi_vbe_interface_seg;
- paddr_t unused_mi_vbe_interface_off;
- uint32_t unused_mi_vbe_interface_len;
-};
+#ifndef __MULTIBOOT_H__
+#define __MULTIBOOT_H__
-/* --------------------------------------------------------------------- */
-
-/*
- * Drive information. This describes an entry in the drives table as
- * pointed to by mi_drives_addr.
- */
-struct multiboot_drive {
- uint32_t md_length;
- uint8_t md_number;
- uint8_t md_mode;
- uint16_t md_cylinders;
- uint8_t md_heads;
- uint8_t md_sectors;
-
- /* The variable-sized 'ports' field comes here, so this structure
- * can be longer. */
-};
+#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-/* --------------------------------------------------------------------- */
-
-/*
- * Memory mapping. This describes an entry in the memory mappings table
- * as pointed to by mi_mmap_addr.
- *
- * Be aware that mm_size specifies the size of all other fields *except*
- * for mm_size. In order to jump between two different entries, you
- * have to count mm_size + 4 bytes.
- */
-struct multiboot_mmap {
- uint32_t mm_size;
- uint64_t mm_base_addr;
- uint64_t mm_length;
- uint32_t mm_type;
-};
+#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
-/*
- * Modules. This describes an entry in the modules table as pointed
- * to by mi_mods_addr.
- */
+/* Must pass memory information to OS. */
+#define MULTIBOOT_PAGE_ALIGN 0x00000001
-struct multiboot_module {
- uint32_t mmo_start;
- uint32_t mmo_end;
- char * mmo_string;
- uint32_t mmo_reserved;
-};
+#define MULTIBOOT_MEMORY_INFO 0x00000002
+
+#define MULTIBOOT_VIDEO_MODE 0x00000004
+
+#define MULTIBOOT_AOUT_KLUDGE 0x00010000
+
+/* consts used for Multiboot pre-init */
+
+#define MULTIBOOT_VIDEO_MODE_EGA 1
+
+#define MULTIBOOT_VIDEO_BUFFER 0xB8000
+
+/* Usable lower memory chunk has a upper bound */
+#define MULTIBOOT_LOWER_MEM_MAX 0x7f800
+
+#define MULTIBOOT_CONSOLE_LINES 25
+#define MULTIBOOT_CONSOLE_COLS 80
-#endif /* !defined(_LOCORE) */
+#define MULTIBOOT_VIDEO_BUFFER_BYTES \
+ (MULTIBOOT_CONSOLE_LINES*MULTIBOOT_CONSOLE_COLS*2)
-/* --------------------------------------------------------------------- */
+#define MULTIBOOT_STACK_SIZE 4096
+#define MULTIBOOT_PARAM_BUF_SIZE 1024
-/*
- * Prototypes for public functions defined in multiboot.c.
- */
-#if !defined(_LOCORE) && defined(_KERNEL)
-void multiboot_pre_reloc(struct multiboot_info *);
-void multiboot_post_reloc(void);
-void multiboot_print_info(void);
-bool multiboot_ksyms_addsyms_elf(void);
-#endif /* !defined(_LOCORE) */
+#define MULTIBOOT_MAX_MODS 20
-/* --------------------------------------------------------------------- */
+/* Flags to be set in the ’flags’ member of the multiboot info structure. */
+
+#define MULTIBOOT_INFO_MEMORY 0x00000001
+#define MULTIBOOT_INFO_MEM_MAP 0x00000040
+
+/* Is there a boot device set? */
+#define MULTIBOOT_INFO_BOOTDEV 0x00000002
+
+/* Is the command-line defined? */
+#define MULTIBOOT_INFO_CMDLINE 0x00000004
+
+/* Are there modules to do something with? */
+#define MULTIBOOT_INFO_MODS 0x00000008
+
+#define MULTIBOOT_HIGH_MEM_BASE 0x100000
+
+#ifndef __ASSEMBLY__
+
+#include <sys/types.h>
+/* The symbol table for a.out. */
+struct multiboot_aout_symbol_table
+{
+ u32_t tabsize;
+ u32_t strsize;
+ u32_t addr;
+ u32_t reserved;
+};
+/* The section header table for ELF. */
+struct multiboot_elf_section_header_table
+{
+ u32_t num;
+ u32_t size;
+ u32_t addr;
+ u32_t shndx;
+};
+
+typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
+typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
+
+struct multiboot_info
+{
+ /* Multiboot info version number */
+ u32_t flags;
+ /* Available memory from BIOS */
+ u32_t mem_lower_unused; /* minix uses memmap instead */
+ u32_t mem_upper_unused;
+ /* "root" partition */
+ u32_t boot_device;
+ /* Kernel command line */
+ u32_t cmdline;
+ /* Boot-Module list */
+ u32_t mods_count;
+ u32_t mods_addr;
+ union
+ {
+ multiboot_aout_symbol_table_t aout_sym;
+ multiboot_elf_section_header_table_t elf_sec;
+ } u;
+ /* Memory Mapping buffer */
+ u32_t mmap_length;
+ u32_t mmap_addr;
+ /* Drive Info buffer */
+ u32_t drives_length;
+ u32_t drives_addr;
+ /* ROM configuration table */
+ u32_t config_table;
+ /* Boot Loader Name */
+ u32_t boot_loader_name;
+ /* APM table */
+ u32_t apm_table;
+ /* Video */
+ u32_t vbe_control_info;
+ u32_t vbe_mode_info;
+ u16_t vbe_mode;
+ u16_t vbe_interface_seg;
+ u16_t vbe_interface_off;
+ u16_t vbe_interface_len;
+};
+typedef struct multiboot_info multiboot_info_t;
+
+struct multiboot_mod_list
+{
+ /* Memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
+ u32_t mod_start;
+ u32_t mod_end;
+ /* Module command line */
+ u32_t cmdline;
+ /* Pad struct to 16 bytes (must be zero) */
+ u32_t pad;
+};
+typedef struct multiboot_mod_list multiboot_module_t;
+
+#define MULTIBOOT_MEMORY_AVAILABLE 1
+#define MULTIBOOT_MEMORY_RESERVED 2
+struct multiboot_mmap_entry
+{
+ u32_t size;
+ u64_t addr;
+ u64_t len;
+#define MULTIBOOT_MEMORY_AVAILABLE 1
+#define MULTIBOOT_MEMORY_RESERVED 2
+ u32_t type;
+} __attribute__((packed));
+typedef struct multiboot_mmap_entry multiboot_memory_map_t;
+
+#endif /* __ASSEMBLY__ */
+#endif /* __MULTIBOOT_H__ */
--- /dev/null
+# $NetBSD: Makefile,v 1.27 2012/01/27 08:41:35 jnemeth Exp $
+
+SUBDIR= mbr boot
+SUBDIR+= bootxx cdboot
+
+.include <bsd.subdir.mk>
--- /dev/null
+# $NetBSD: Makefile.booters,v 1.86 2012/08/10 12:18:14 joerg Exp $
+
+.include <bsd.own.mk>
+
+STRIPFLAG=
+BINMODE=444
+
+LIBCRT0= # nothing
+LIBCRTBEGIN= # nothing
+LIBCRTEND= # nothing
+LIBC= # nothing
+
+# Make sure we override any optimization options specified by the
+# user.
+.if ${MACHINE_ARCH} == "x86_64"
+CPUFLAGS= -m32
+.else
+CPUFLAGS= -march=i386 -mtune=i386
+.endif
+COPTS= ${OPT_SIZE.${ACTIVE_CC}}
+
+I386_STAND_DIR?= $S/arch/i386/stand
+
+.PATH: ${I386_STAND_DIR}/lib
+
+ROMSTART= start_rom.o
+GENPROMDIR= ${I386_STAND_DIR}/genprom
+GENPROMOBJDIR!= cd ${GENPROMDIR} && ${PRINTOBJDIR}
+GENPROM= ${GENPROMOBJDIR}/genprom
+
+.PATH: ${I386_STAND_DIR}/lib/crt/dos
+DOSSTART= start_dos.o doscommain.o
+
+.PATH: ${I386_STAND_DIR}/lib/crt/pxe
+PXESTART= start_pxe.o
+
+CPPFLAGS+= -nostdinc -I${.OBJDIR} -I$S -I${I386_STAND_DIR}/lib -I$S/lib/libsa
+CPPFLAGS+= -D_STANDALONE
+LDFLAGS+= -nostdlib
+
+# XXX
+.if ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+=-m32
+LDFLAGS+=-Wl,-m,elf_i386
+LIBKERN_ARCH=i386
+KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
+.endif
+
+CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
+SRCS+= vers.c
+
+CLEANFILES+= machine x86
+
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN:
+ -rm -f machine && ln -s $S/arch/i386/include machine
+ -rm -f x86 && ln -s $S/arch/x86/include x86
+.ifdef LIBOBJ
+ -rm -f lib && ln -s ${LIBOBJ}/lib lib
+ mkdir -p ${LIBOBJ}/lib
+.endif
+.endif
+
+### find out what to use for libkern
+KERN_AS= library
+.include "${S}/lib/libkern/Makefile.inc"
+LIBKERN= ${KERNLIB}
+
+### find out what to use for libz
+Z_AS= library
+.include "${S}/lib/libz/Makefile.inc"
+LIBZ= ${ZLIB}
+
+### find out what to use for libsa
+SA_AS= library
+SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
+.include "${S}/lib/libsa/Makefile.inc"
+LIBSA= ${SALIB}
+
+### find out what to use for libi386
+I386DIR= ${I386_STAND_DIR}/lib
+.include "${I386DIR}/Makefile.inc"
+LIBI386= ${I386LIB}
+
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+ -rm -rf lib
+
+LDFLAGS+=-Wl,-M -Wl,-e,start # -N does not work properly.
+
+LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
+
+vers.c: ${VERSIONFILE} ${SOURCES} ${S}/conf/newvers_stand.sh
+ ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
+
+CLEANFILES+= ${BASE}.sym
+${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
+ ${_MKTARGET_LINK}
+ ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
+ ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
+
+CLEANFILES+= ${BASE}.rom ${BASE}.rom.tmp
+${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
+ ${_MKTARGET_LINK}
+ ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
+ ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
+ ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.rom.tmp
+ ${GENPROM} ${ROM_SIZE} < ${BASE}.rom.tmp > ${BASE}.rom || \
+ ( rm -f ${BASE}.rom && false )
+ rm -f ${BASE}.rom.tmp
+
+CLEANFILES+= ${BASE}.com
+${BASE}.com: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
+ ${_MKTARGET_LINK}
+ ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
+ ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
+ ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.com
+
+CLEANFILES+= ${BASE}.bin
+${BASE}.bin: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
+ ${_MKTARGET_LINK}
+ ${CC} -o ${BASE}.sym ${LDFLAGS} -Wl,-Ttext,${RELOC} \
+ ${STARTFILE} ${OBJS} ${LIBLIST} > ${BASE}.list
+ ${OBJCOPY} -O binary ${BASE}.sym ${BASE}.bin
+
+.include <bsd.prog.mk>
--- /dev/null
+# $NetBSD: Makefile.inc,v 1.10 2012/04/04 10:54:44 joerg Exp $
+
+.include <bsd.own.mk>
+
+BINDIR= /usr/mdec
+
+OPT_SIZE.gcc= -Os -ffreestanding -fomit-frame-pointer
+OPT_SIZE.clang= -Oz -ffreestanding -fomit-frame-pointer -DNDEBUG \
+ -fno-stack-protector -mno-sse \
+ -mstack-alignment=4 \
+ -mllvm -inline-threshold=3 -mllvm -enable-load-pre=false
.PATH: ${.CURDIR}/..
LDFLAGS+= -nostdlib -Wl,-e,start
-#CPPFLAGS+= -I. -I${.CURDIR}/../lib -I${S}
-CPPFLAGS+= -I. -I${.CURDIR}/../lib
+CPPFLAGS+= -I. -I${.CURDIR}/../lib -I${S}
CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
CPPFLAGS+= -DDISABLE_KEYPRESS
AFLAGS+= -m32
.endif
-.if defined(_NetBSD_)
-# NetBSD can be compiled from a foreign host, MINIX do not. So commented out.
-# Make sys/ a local thing for benefit of cross-compilers
-CPPFLAGS+= -I${S}
-# And same for machine/; need a bit more work because of symlink
BUILDSYMLINKS+= $S/arch/i386/include machine \
$S/arch/x86/include x86
DPSRCS+= machine x86
-.endif
AFLAGS+= -Wa,--divide
I386MISCCPPFLAGS=${I386MISCCPPFLAGS:Q} \
${I386MISCMAKEFLAGS}
-# LSC Fro now
-NOGCCERROR:= yes
-
${I386LIB}: .NOTMAIN __always_make_i386lib
@echo making sure the i386 library is up to date...
@${I386MAKE} libi386.a
--- /dev/null
+# $NetBSD: Makefile,v 1.17 2012/08/29 17:13:22 drochner Exp $
+
+INCSDIR=/usr/include/x86
+
+INCS= \
+ bootinfo.h \
+ cpu.h \
+ float.h \
+ ieee.h ieeefp.h \
+ math.h mutex.h \
+ pio.h \
+ rwlock.h \
+
+
+.include <bsd.kinc.mk>
--- /dev/null
+# $NetBSD: Makefile,v 1.31 2012/09/27 18:28:56 alnsn Exp $
+
+#LSC: radix.h and route.h are used in libsa but not installed
+
+INCSDIR= /usr/include/net
+
+INCS= ethertypes.h \
+ if_ether.h \
+ \
+ \
+ \
+
+
+#SUBDIR= agr npf
+
+.include <bsd.kinc.mk>
+
+#.PATH: ${NETBSDSRCDIR}/sys/dist/pf/net
-/* $NetBSD: ethertypes.h,v 1.17 2005/12/10 23:21:38 elad Exp $ */
+/* $NetBSD: ethertypes.h,v 1.18 2012/09/23 01:14:19 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
#define ETHERTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
#define ETHERTYPE_LANPROBE 0x8888 /* HP LanProbe test? */
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
+#define ETHERTYPE_AOE 0x88a2 /* ATA over Ethernet */
+#define ETHERTYPE_FCOE 0x8906 /* Fibre Channel over Ethernet */
#define ETHERTYPE_LOOPBACK 0x9000 /* Loopback */
#define ETHERTYPE_LBACK ETHERTYPE_LOOPBACK /* DEC MOP loopback */
#define ETHERTYPE_XNSSM 0x9001 /* 3Com (Formerly Bridge Communications), XNS Systems Management */
-/* $NetBSD: route.h,v 1.80 2011/11/11 15:09:32 gdt Exp $ */
+/* $NetBSD: route.h,v 1.81 2012/02/18 23:47:48 rmind Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
sockaddr_free(rt->_rt_key);
rt->_rt_key = sockaddr_dup(key, flags);
out:
- KASSERT(rt->_rt_key != NULL);
rt->rt_nodes->rn_key = (const char *)rt->_rt_key;
return rt->_rt_key;
}
/*
* Socket address, internet style.
*/
+#ifdef __minix
+struct sockaddr_in
+{
+ sa_family_t sin_family;
+ in_port_t sin_port;
+ struct in_addr sin_addr;
+};
+#else /* !__minix */
struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
struct in_addr sin_addr;
__int8_t sin_zero[8];
};
+#endif /* !__minix */
#define INET_ADDRSTRLEN 16
+#ifndef __minix
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
__int8_t ip_opts[40]; /* actually variable in size */
#endif
};
+#endif /* __minix */
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
+#ifndef __minix
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
+#endif /* !__minix */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
+#ifndef __minix
#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */
#endif
#define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */
#define IP_MINTTL 24 /* minimum TTL for packet or drop */
+#endif /* !__minix */
+#ifndef __minix
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
+#endif /* !__minix */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
struct in_addr imr_interface; /* local IP address of interface */
};
+#ifndef __minix
/*
* Argument for IP_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
{ "stats", CTLTYPE_STRUCT }, \
}
#endif /* _NETBSD_SOURCE */
+#endif /* __minix */
/* INET6 stuff */
#define __KAME_NETINET_IN_H_INCLUDED_
#include <netinet6/in6.h>
#undef __KAME_NETINET_IN_H_INCLUDED_
+#ifndef __minix
#ifdef _KERNEL
/*
* in_cksum_phdr:
return sa;
}
#endif /* _KERNEL */
+#endif /* __minix */
#endif /* !_NETINET_IN_H_ */
-/* $NetBSD: in6.h,v 1.68 2009/09/11 22:06:29 dyoung Exp $ */
+/* $NetBSD: in6.h,v 1.70 2012/06/22 14:54:35 christos Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
#if defined(_NETBSD_SOURCE)
+#define IPV6_PORTALGO 17 /* int; port selection algo (rfc6056) */
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
#endif
/* RFC2292 options */
/* 40: reserved */
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
#define IPV6CTL_IFQ 42 /* ip6intrq node */
+#define IPV6CTL_RTADV_MAXROUTES 43 /* maximum number of routes */
+ /* via router advertisement */
+#define IPV6CTL_RTADV_NUMROUTES 44 /* current number of routes */
+ /* via router advertisement */
/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
-#define IPV6CTL_MAXID 43
+#define IPV6CTL_MAXID 45
#define IPV6CTL_NAMES { \
{ 0, 0 }, \
{ 0, 0 }, \
{ "maxfrags", CTLTYPE_INT }, \
{ "ifq", CTLTYPE_NODE }, \
+ { "rtadv_maxroutes", CTLTYPE_INT }, \
+ { "rtadv_numroutes", CTLTYPE_INT }, \
}
#endif /* _NETBSD_SOURCE */
--- /dev/null
+# $NetBSD: Makefile,v 1.143 2012/02/19 21:06:57 rmind Exp $
+
+.include <bsd.sys.mk>
+
+INCSDIR= /usr/include/sys
+
+INCS= ansi.h atomic.h \
+ bitops.h bootblock.h bswap.h \
+ cdefs.h cdefs_aout.h \
+ cdefs_elf.h condvar.h \
+ ctype_bits.h ctype_inline.h \
+ \
+ dirent.h \
+ disk.h disklabel.h disklabel_gpt.h \
+ dkbad.h dkio.h \
+ endian.h errno.h exec.h \
+ exec_elf.h extattr.h \
+ fcntl.h fd_set.h featuretest.h file.h \
+ float_ieee754.h fstypes.h gcq.h gmon.h hash.h \
+ ieee754.h inttypes.h ioccom.h ioctl.h iostat.h ipc.h \
+ \
+ lwp.h \
+ localedef.h lock.h \
+ md4.h md5.h \
+ mman.h mount.h mtio.h mutex.h \
+ null.h \
+ param.h poll.h \
+ ptrace.h ptree.h \
+ queue.h \
+ ras.h rbtree.h reboot.h resource.h rmd160.h \
+ rwlock.h \
+ select.h sem.h sha1.h \
+ sha2.h shm.h siginfo.h signal.h sigtypes.h \
+ socket.h specificdata.h \
+ stat.h \
+ statvfs.h sysctl.h stdarg.h stdint.h \
+ syslimits.h syslog.h \
+ termios.h time.h times.h \
+ tree.h ttycom.h \
+ ttydefaults.h types.h \
+ ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
+ \
+ wait.h
+
+INCSYMLINKS=\
+ sys/exec_elf.h /usr/include/elf.h \
+ sys/fcntl.h /usr/include/fcntl.h \
+ sys/poll.h /usr/include/poll.h \
+ sys/stdarg.h /usr/include/stdarg.h \
+ sys/stdint.h /usr/include/stdint.h \
+ sys/syslog.h /usr/include/syslog.h \
+ sys/termios.h /usr/include/termios.h \
+ sys/rmd160.h /usr/include/rmd160.h \
+ sys/sha1.h /usr/include/sha1.h \
+ sys/sha2.h /usr/include/sha2.h \
+ sys/md4.h /usr/include/md4.h \
+ sys/md5.h /usr/include/md5.h
+
+#INCSYMLINKS+= ../soundcard.h ${INCSDIR}/soundcard.h
+
+namei: namei.src gennameih.awk
+ ${TOOL_AWK} -f gennameih.awk < namei.src
+
+.include <bsd.kinc.mk>
-/* $NetBSD: bootblock.h,v 1.52 2011/01/06 01:08:48 jakllsch Exp $ */
+/* $NetBSD: bootblock.h,v 1.54 2012/07/02 22:42:18 abs Exp $ */
/*-
* Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
uint32_t pmLgDataStart; /* first logical block of data area */
uint32_t pmDataCnt; /* number of blocks in data area */
uint32_t pmPartStatus; /* partition status information */
+/*
+ * Partition Status Information from Apple Tech Note 1189
+ */
+#define APPLE_PS_VALID 0x00000001 /* Entry is valid */
+#define APPLE_PS_ALLOCATED 0x00000002 /* Entry is allocated */
+#define APPLE_PS_IN_USE 0x00000004 /* Entry in use */
+#define APPLE_PS_BOOT_INFO 0x00000008 /* Entry contains boot info */
+#define APPLE_PS_READABLE 0x00000010 /* Entry is readable */
+#define APPLE_PS_WRITABLE 0x00000020 /* Entry is writable */
+#define APPLE_PS_BOOT_CODE_PIC 0x00000040 /* Boot code has position
+ * independent code */
+#define APPLE_PS_CC_DRVR 0x00000100 /* Partition contains chain-
+ * compatible driver */
+#define APPLE_PS_RL_DRVR 0x00000200 /* Partition contains real
+ * driver */
+#define APPLE_PS_CH_DRVR 0x00000400 /* Partition contains chain
+ * driver */
+#define APPLE_PS_AUTO_MOUNT 0x40000000 /* Mount automatically at
+ * startup */
+#define APPLE_PS_STARTUP 0x80000000 /* Is the startup partition */
uint32_t pmLgBootStart; /* first logical block of boot code */
uint32_t pmBootSize; /* size of boot code, in bytes */
uint32_t pmBootLoad; /* boot code load address */
uint8_t bb_mbone; /* must be one */
uint16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
uint16_t bb_lbn_low; /* lbn (low word) of bootstrap */
- uint8_t pad1[332];
+ uint8_t pad1[460];
+ /* disklabel offset is 64 from base, or 56 from start of pad1 */
/* The rest of these fields are identification area and describe
* the secondary block for uVAX VMB.
/* The rest is unused.
*/
- uint8_t pad2[148];
+ uint8_t pad2[20];
} __packed;
#define VAX_BOOT_MAGIC1 0x18 /* size of BB info? */
-/* $NetBSD: disk.h,v 1.55 2011/11/13 22:07:00 christos Exp $ */
+/* $NetBSD: disk.h,v 1.57 2012/06/10 17:05:18 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
#define DKW_PTYPE_EFS "efs"
#define DKW_PTYPE_NILFS "nilfs"
#define DKW_PTYPE_CGD "cgd"
+#define DKW_PTYPE_MINIXFS3 "minixfs3"
/*
* Disk geometry dictionary.
void dkwedge_delall(struct disk *);
int dkwedge_list(struct disk *, struct dkwedge_list *, struct lwp *);
void dkwedge_discover(struct disk *);
-void dkwedge_set_bootwedge(device_t, daddr_t, uint64_t);
int dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);
device_t dkwedge_find_by_wname(const char *);
void dkwedge_print_wnames(void);
+device_t dkwedge_find_partition(device_t, daddr_t, uint64_t);
#endif
#endif /* _SYS_DISK_H_ */
-/* $NetBSD: disklabel_gpt.h,v 1.7 2008/11/12 22:50:22 thorpej Exp $ */
+/* $NetBSD: disklabel_gpt.h,v 1.9 2011/08/16 14:04:26 jakllsch Exp $ */
/*
* Copyright (c) 2002 Marcel Moolenaar
uint16_t ent_name[36]; /* partition name in UNICODE-16 */
};
-#define GPT_ENT_ATTR_PLATFORM (1ULL << 0) /* required for platform
- to function */
+#define GPT_ENT_ATTR_REQUIRED_PARTITION (1ULL << 0)
+ /* required for platform to function */
+#define GPT_ENT_ATTR_NO_BLOCK_IO_PROTOCOL (1ULL << 1)
+ /* UEFI won't recognize file system */
+#define GPT_ENT_ATTR_LEGACY_BIOS_BOOTABLE (1ULL << 2)
+ /* legacy BIOS boot partition */
/*
* Partition types defined by the EFI specification:
{0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_VINUM \
{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#ifdef __minix
+/* LSC These are not present in NetBSD header */
#define GPT_ENT_TYPE_FREEBSD_ZFS \
{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_BOOT \
{0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
+#endif
/*
* The following are unused but documented here to avoid reuse.
*
#define GPT_ENT_TYPE_MS_LDM_DATA \
{0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}
-#define GPT_ENT_TYPE_LINUX_DATA_OLD GPT_ENT_TYPE_MS_BASIC_DATA
-#define GPT_ENT_TYPE_LINUX_DATA \
- {0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}}
+#define GPT_ENT_TYPE_LINUX_DATA GPT_ENT_TYPE_MS_BASIC_DATA
#define GPT_ENT_TYPE_LINUX_RAID \
{0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}
#define GPT_ENT_TYPE_LINUX_SWAP \
/*
* Used by GRUB 2.
*/
-#define GPT_ENT_TYPE_BIOS \
+#define GPT_ENT_TYPE_BIOS \
{0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
#endif /* _SYS_DISKLABEL_GPT_H_ */
-/* $NetBSD: exec.h,v 1.133 2011/03/04 22:25:32 joerg Exp $ */
+/* $NetBSD: exec.h,v 1.139 2012/08/05 01:43:59 matt Exp $ */
/*-
* Copyright (c) 1992, 1993
struct vnode *ep_interp; /* vnode of (elf) interpeter */
uint32_t ep_pax_flags; /* pax flags */
char *ep_path; /* absolute path of executable */
+ void (*ep_emul_arg_free)(void *);
+ /* free ep_emul_arg */
};
#define EXEC_INDIR 0x0001 /* script handling already done */
#define EXEC_HASFD 0x0002 /* holding a shell script */
int exec_setup_stack (struct lwp *, struct exec_package *);
int coredump_write (void *, enum uio_seg, const void *, size_t);
+
+void exec_free_emul_arg (struct exec_package *);
+
+
/*
* Machine dependent functions
*/
int execve1(struct lwp *, const char *, char * const *, char * const *,
execve_fetch_element_t);
+struct posix_spawn_file_actions;
+struct posix_spawnattr;
+int check_posix_spawn (struct lwp *);
+void posix_spawn_fa_free(struct posix_spawn_file_actions *, size_t);
+int do_posix_spawn(struct lwp *, pid_t *, bool*, const char *,
+ struct posix_spawn_file_actions *, struct posix_spawnattr *,
+ char *const *argv, char *const *, execve_fetch_element_t);
+
extern int maxexec;
#endif /* _KERNEL */
--- /dev/null
+/* $NetBSD: exec_elf.h,v 1.126 2012/08/05 01:43:59 matt Exp $ */
+
+/*-
+ * Copyright (c) 1994 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_EXEC_ELF_H_
+#define _SYS_EXEC_ELF_H_
+
+/*
+ * The current ELF ABI specification is available at:
+ * http://www.sco.com/developers/gabi/
+ *
+ * Current header definitions are in:
+ * http://www.sco.com/developers/gabi/latest/ch4.eheader.html
+ */
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <inttypes.h>
+#endif /* _KERNEL || _STANDALONE */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include <nbinclude/machine/elf_machdep.h>
+#else
+#include <machine/elf_machdep.h>
+#endif
+
+typedef uint8_t Elf_Byte;
+
+typedef uint32_t Elf32_Addr;
+#define ELF32_FSZ_ADDR 4
+typedef uint32_t Elf32_Off;
+typedef int32_t Elf32_SOff;
+#define ELF32_FSZ_OFF 4
+typedef int32_t Elf32_Sword;
+#define ELF32_FSZ_SWORD 4
+typedef uint32_t Elf32_Word;
+#define ELF32_FSZ_WORD 4
+typedef uint16_t Elf32_Half;
+#define ELF32_FSZ_HALF 2
+typedef uint64_t Elf32_Lword;
+#define ELF32_FSZ_LWORD 8
+
+typedef uint64_t Elf64_Addr;
+#define ELF64_FSZ_ADDR 8
+typedef uint64_t Elf64_Off;
+typedef int64_t Elf64_SOff;
+#define ELF64_FSZ_OFF 8
+typedef int32_t Elf64_Shalf;
+#define ELF64_FSZ_SHALF 4
+
+typedef int32_t Elf64_Sword;
+#define ELF64_FSZ_SWORD 4
+typedef uint32_t Elf64_Word;
+#define ELF64_FSZ_WORD 4
+
+typedef int64_t Elf64_Sxword;
+#define ELF64_FSZ_SXWORD 8
+typedef uint64_t Elf64_Xword;
+#define ELF64_FSZ_XWORD 8
+typedef uint64_t Elf64_Lword;
+#define ELF64_FSZ_LWORD 8
+typedef uint16_t Elf64_Half;
+#define ELF64_FSZ_HALF 2
+
+/*
+ * ELF Header
+ */
+#define ELF_NIDENT 16
+
+typedef struct {
+ unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
+ Elf32_Half e_type; /* file type */
+ Elf32_Half e_machine; /* machine type */
+ Elf32_Word e_version; /* version number */
+ Elf32_Addr e_entry; /* entry point */
+ Elf32_Off e_phoff; /* Program hdr offset */
+ Elf32_Off e_shoff; /* Section hdr offset */
+ Elf32_Word e_flags; /* Processor flags */
+ Elf32_Half e_ehsize; /* sizeof ehdr */
+ Elf32_Half e_phentsize; /* Program header entry size */
+ Elf32_Half e_phnum; /* Number of program headers */
+ Elf32_Half e_shentsize; /* Section header entry size */
+ Elf32_Half e_shnum; /* Number of section headers */
+ Elf32_Half e_shstrndx; /* String table index */
+} Elf32_Ehdr;
+
+typedef struct {
+ unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
+ Elf64_Half e_type; /* file type */
+ Elf64_Half e_machine; /* machine type */
+ Elf64_Word e_version; /* version number */
+ Elf64_Addr e_entry; /* entry point */
+ Elf64_Off e_phoff; /* Program hdr offset */
+ Elf64_Off e_shoff; /* Section hdr offset */
+ Elf64_Word e_flags; /* Processor flags */
+ Elf64_Half e_ehsize; /* sizeof ehdr */
+ Elf64_Half e_phentsize; /* Program header entry size */
+ Elf64_Half e_phnum; /* Number of program headers */
+ Elf64_Half e_shentsize; /* Section header entry size */
+ Elf64_Half e_shnum; /* Number of section headers */
+ Elf64_Half e_shstrndx; /* String table index */
+} Elf64_Ehdr;
+
+/* e_ident offsets */
+#define EI_MAG0 0 /* '\177' */
+#define EI_MAG1 1 /* 'E' */
+#define EI_MAG2 2 /* 'L' */
+#define EI_MAG3 3 /* 'F' */
+#define EI_CLASS 4 /* File class */
+#define EI_DATA 5 /* Data encoding */
+#define EI_VERSION 6 /* File version */
+#define EI_OSABI 7 /* Operating system/ABI identification */
+#define EI_ABIVERSION 8 /* ABI version */
+#define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/
+#define EI_NIDENT 16 /* First non-ident header byte */
+
+/* e_ident[EI_MAG0,EI_MAG3] */
+#define ELFMAG0 0x7f
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+#define ELFMAG "\177ELF"
+#define SELFMAG 4
+
+/* e_ident[EI_CLASS] */
+#define ELFCLASSNONE 0 /* Invalid class */
+#define ELFCLASS32 1 /* 32-bit objects */
+#define ELFCLASS64 2 /* 64-bit objects */
+#define ELFCLASSNUM 3
+
+/* e_ident[EI_DATA] */
+#define ELFDATANONE 0 /* Invalid data encoding */
+#define ELFDATA2LSB 1 /* 2's complement values, LSB first */
+#define ELFDATA2MSB 2 /* 2's complement values, MSB first */
+
+/* e_ident[EI_VERSION] */
+#define EV_NONE 0 /* Invalid version */
+#define EV_CURRENT 1 /* Current version */
+#define EV_NUM 2
+
+/* e_ident[EI_OSABI] */
+#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
+#define ELFOSABI_HPUX 1 /* HP-UX operating system */
+#define ELFOSABI_NETBSD 2 /* NetBSD */
+#define ELFOSABI_LINUX 3 /* GNU/Linux */
+#define ELFOSABI_HURD 4 /* GNU/Hurd */
+#define ELFOSABI_86OPEN 5 /* 86Open */
+#define ELFOSABI_SOLARIS 6 /* Solaris */
+#define ELFOSABI_MONTEREY 7 /* Monterey */
+#define ELFOSABI_IRIX 8 /* IRIX */
+#define ELFOSABI_FREEBSD 9 /* FreeBSD */
+#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
+#define ELFOSABI_MODESTO 11 /* Novell Modesto */
+#define ELFOSABI_OPENBSD 12 /* OpenBSD */
+#define ELFOSABI_OPENVMS 13 /* OpenVMS */
+#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
+#define ELFOSABI_AROS 15 /* Amiga Research OS */
+/* Unofficial OSABIs follow */
+#define ELFOSABI_ARM 97 /* ARM */
+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+
+#define ELFOSABI_NONE ELFOSABI_SYSV
+#define ELFOSABI_AIX ELFOSABI_MONTEREY
+
+/* e_type */
+#define ET_NONE 0 /* No file type */
+#define ET_REL 1 /* Relocatable file */
+#define ET_EXEC 2 /* Executable file */
+#define ET_DYN 3 /* Shared object file */
+#define ET_CORE 4 /* Core file */
+#define ET_NUM 5
+
+#define ET_LOOS 0xfe00 /* Operating system specific range */
+#define ET_HIOS 0xfeff
+#define ET_LOPROC 0xff00 /* Processor-specific range */
+#define ET_HIPROC 0xffff
+
+/* e_machine */
+#define EM_NONE 0 /* No machine */
+#define EM_M32 1 /* AT&T WE 32100 */
+#define EM_SPARC 2 /* SPARC */
+#define EM_386 3 /* Intel 80386 */
+#define EM_68K 4 /* Motorola 68000 */
+#define EM_88K 5 /* Motorola 88000 */
+#define EM_486 6 /* Intel 80486 */
+#define EM_860 7 /* Intel 80860 */
+#define EM_MIPS 8 /* MIPS I Architecture */
+#define EM_S370 9 /* Amdahl UTS on System/370 */
+#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */
+ /* 11-14 - Reserved */
+#define EM_RS6000 11 /* IBM RS/6000 XXX reserved */
+#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */
+#define EM_NCUBE 16 /* NCube XXX reserved */
+#define EM_VPP500 17 /* Fujitsu VPP500 */
+#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
+#define EM_960 19 /* Intel 80960 */
+#define EM_PPC 20 /* PowerPC */
+#define EM_PPC64 21 /* 64-bit PowerPC */
+ /* 22-35 - Reserved */
+#define EM_S390 22 /* System/390 XXX reserved */
+#define EM_V800 36 /* NEC V800 */
+#define EM_FR20 37 /* Fujitsu FR20 */
+#define EM_RH32 38 /* TRW RH-32 */
+#define EM_RCE 39 /* Motorola RCE */
+#define EM_ARM 40 /* Advanced RISC Machines ARM */
+#define EM_ALPHA 41 /* DIGITAL Alpha */
+#define EM_SH 42 /* Hitachi Super-H */
+#define EM_SPARCV9 43 /* SPARC Version 9 */
+#define EM_TRICORE 44 /* Siemens Tricore */
+#define EM_ARC 45 /* Argonaut RISC Core */
+#define EM_H8_300 46 /* Hitachi H8/300 */
+#define EM_H8_300H 47 /* Hitachi H8/300H */
+#define EM_H8S 48 /* Hitachi H8S */
+#define EM_H8_500 49 /* Hitachi H8/500 */
+#define EM_IA_64 50 /* Intel Merced Processor */
+#define EM_MIPS_X 51 /* Stanford MIPS-X */
+#define EM_COLDFIRE 52 /* Motorola Coldfire */
+#define EM_68HC12 53 /* Motorola MC68HC12 */
+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
+#define EM_PCP 55 /* Siemens PCP */
+#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
+#define EM_NDR1 57 /* Denso NDR1 microprocessor */
+#define EM_STARCORE 58 /* Motorola Star*Core processor */
+#define EM_ME16 59 /* Toyota ME16 processor */
+#define EM_ST100 60 /* STMicroelectronics ST100 processor */
+#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */
+#define EM_X86_64 62 /* AMD x86-64 architecture */
+#define EM_PDSP 63 /* Sony DSP Processor */
+#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
+#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
+#define EM_FX66 66 /* Siemens FX66 microcontroller */
+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
+#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
+#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
+#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
+#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
+#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
+#define EM_SVX 73 /* Silicon Graphics SVx */
+#define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */
+#define EM_VAX 75 /* Digital VAX */
+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */
+#define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */
+#define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */
+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY 81 /* Harvard's machine-independent format */
+#define EM_PRISM 82 /* SiTera Prism */
+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
+#define EM_FR30 84 /* Fujitsu FR30 */
+#define EM_D10V 85 /* Mitsubishi D10V */
+#define EM_D30V 86 /* Mitsubishi D30V */
+#define EM_V850 87 /* NEC v850 */
+#define EM_M32R 88 /* Mitsubishi M32R */
+#define EM_MN10300 89 /* Matsushita MN10300 */
+#define EM_MN10200 90 /* Matsushita MN10200 */
+#define EM_PJ 91 /* picoJava */
+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
+#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
+#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
+#define EM_NS32K 97 /* National Semiconductor 32000 series */
+#define EM_TPC 98 /* Tenor Network TPC processor */
+#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
+#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */
+#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */
+#define EM_MAX 102 /* MAX processor */
+#define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */
+#define EM_F2MC16 104 /* Fujitsu F2MC16 */
+#define EM_MSP430 105 /* Texas Instruments MSP430 */
+#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */
+#define EM_SE_C33 107 /* Seiko Epson S1C33 family */
+#define EM_SEP 108 /* Sharp embedded microprocessor */
+#define EM_ARCA 109 /* Arca RISC microprocessor */
+#define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */
+
+/* Unofficial machine types follow */
+#define EM_AVR32 6317 /* used by NetBSD/avr32 */
+#define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */
+#define EM_NUM 36903
+
+/*
+ * Program Header
+ */
+typedef struct {
+ Elf32_Word p_type; /* entry type */
+ Elf32_Off p_offset; /* offset */
+ Elf32_Addr p_vaddr; /* virtual address */
+ Elf32_Addr p_paddr; /* physical address */
+ Elf32_Word p_filesz; /* file size */
+ Elf32_Word p_memsz; /* memory size */
+ Elf32_Word p_flags; /* flags */
+ Elf32_Word p_align; /* memory & file alignment */
+} Elf32_Phdr;
+
+typedef struct {
+ Elf64_Word p_type; /* entry type */
+ Elf64_Word p_flags; /* flags */
+ Elf64_Off p_offset; /* offset */
+ Elf64_Addr p_vaddr; /* virtual address */
+ Elf64_Addr p_paddr; /* physical address */
+ Elf64_Xword p_filesz; /* file size */
+ Elf64_Xword p_memsz; /* memory size */
+ Elf64_Xword p_align; /* memory & file alignment */
+} Elf64_Phdr;
+
+/* p_type */
+#define PT_NULL 0 /* Program header table entry unused */
+#define PT_LOAD 1 /* Loadable program segment */
+#define PT_DYNAMIC 2 /* Dynamic linking information */
+#define PT_INTERP 3 /* Program interpreter */
+#define PT_NOTE 4 /* Auxiliary information */
+#define PT_SHLIB 5 /* Reserved, unspecified semantics */
+#define PT_PHDR 6 /* Entry for header table itself */
+#define PT_TLS 7 /* TLS initialisation image */
+#define PT_NUM 8
+
+#define PT_LOOS 0x60000000 /* OS-specific range */
+
+/* GNU-specific */
+#define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */
+#define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */
+#define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */
+
+#define PT_HIOS 0x6fffffff
+#define PT_LOPROC 0x70000000 /* Processor-specific range */
+#define PT_HIPROC 0x7fffffff
+
+#define PT_MIPS_REGINFO 0x70000000
+
+/* p_flags */
+#define PF_R 0x4 /* Segment is readable */
+#define PF_W 0x2 /* Segment is writable */
+#define PF_X 0x1 /* Segment is executable */
+
+#define PF_MASKOS 0x0ff00000 /* Operating system specific values */
+#define PF_MASKPROC 0xf0000000 /* Processor-specific values */
+
+/* Extended program header index. */
+#define PN_XNUM 0xffff
+
+/*
+ * Section Headers
+ */
+typedef struct {
+ Elf32_Word sh_name; /* section name (.shstrtab index) */
+ Elf32_Word sh_type; /* section type */
+ Elf32_Word sh_flags; /* section flags */
+ Elf32_Addr sh_addr; /* virtual address */
+ Elf32_Off sh_offset; /* file offset */
+ Elf32_Word sh_size; /* section size */
+ Elf32_Word sh_link; /* link to another */
+ Elf32_Word sh_info; /* misc info */
+ Elf32_Word sh_addralign; /* memory alignment */
+ Elf32_Word sh_entsize; /* table entry size */
+} Elf32_Shdr;
+
+typedef struct {
+ Elf64_Word sh_name; /* section name (.shstrtab index) */
+ Elf64_Word sh_type; /* section type */
+ Elf64_Xword sh_flags; /* section flags */
+ Elf64_Addr sh_addr; /* virtual address */
+ Elf64_Off sh_offset; /* file offset */
+ Elf64_Xword sh_size; /* section size */
+ Elf64_Word sh_link; /* link to another */
+ Elf64_Word sh_info; /* misc info */
+ Elf64_Xword sh_addralign; /* memory alignment */
+ Elf64_Xword sh_entsize; /* table entry size */
+} Elf64_Shdr;
+
+/* sh_type */
+#define SHT_NULL 0 /* Section header table entry unused */
+#define SHT_PROGBITS 1 /* Program information */
+#define SHT_SYMTAB 2 /* Symbol table */
+#define SHT_STRTAB 3 /* String table */
+#define SHT_RELA 4 /* Relocation information w/ addend */
+#define SHT_HASH 5 /* Symbol hash table */
+#define SHT_DYNAMIC 6 /* Dynamic linking information */
+#define SHT_NOTE 7 /* Auxiliary information */
+#define SHT_NOBITS 8 /* No space allocated in file image */
+#define SHT_REL 9 /* Relocation information w/o addend */
+#define SHT_SHLIB 10 /* Reserved, unspecified semantics */
+#define SHT_DYNSYM 11 /* Symbol table for dynamic linker */
+#define SHT_INIT_ARRAY 14 /* Initialization function pointers */
+#define SHT_FINI_ARRAY 15 /* Termination function pointers */
+#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */
+#define SHT_GROUP 17 /* Section group */
+#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */
+#define SHT_NUM 19
+
+#define SHT_LOOS 0x60000000 /* Operating system specific range */
+#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
+#define SHT_SUNW_move 0x6ffffffa
+#define SHT_SUNW_syminfo 0x6ffffffc
+#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
+#define SHT_GNU_verdef SHT_SUNW_verdef
+#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
+#define SHT_GNU_verneed SHT_SUNW_verneed
+#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
+#define SHT_GNU_versym SHT_SUNW_versym
+#define SHT_HIOS 0x6fffffff
+#define SHT_LOPROC 0x70000000 /* Processor-specific range */
+#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
+#define SHT_HIPROC 0x7fffffff
+#define SHT_LOUSER 0x80000000 /* Application-specific range */
+#define SHT_HIUSER 0xffffffff
+
+/* sh_flags */
+#define SHF_WRITE 0x00000001 /* Contains writable data */
+#define SHF_ALLOC 0x00000002 /* Occupies memory */
+#define SHF_EXECINSTR 0x00000004 /* Contains executable insns */
+#define SHF_MERGE 0x00000010 /* Might be merged */
+#define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */
+#define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */
+#define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */
+#define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */
+#define SHF_GROUP 0x00000200 /* Is member of a group */
+#define SHF_TLS 0x00000400 /* Holds thread-local data */
+#define SHF_MASKOS 0x0ff00000 /* Operating system specific values */
+#define SHF_MASKPROC 0xf0000000 /* Processor-specific values */
+#define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */
+#define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc
+ (Solaris).*/
+/*
+ * Symbol Table
+ */
+typedef struct {
+ Elf32_Word st_name; /* Symbol name (.strtab index) */
+ Elf32_Word st_value; /* value of symbol */
+ Elf32_Word st_size; /* size of symbol */
+ Elf_Byte st_info; /* type / binding attrs */
+ Elf_Byte st_other; /* unused */
+ Elf32_Half st_shndx; /* section index of symbol */
+} Elf32_Sym;
+
+typedef struct {
+ Elf64_Word st_name; /* Symbol name (.strtab index) */
+ Elf_Byte st_info; /* type / binding attrs */
+ Elf_Byte st_other; /* unused */
+ Elf64_Half st_shndx; /* section index of symbol */
+ Elf64_Addr st_value; /* value of symbol */
+ Elf64_Xword st_size; /* size of symbol */
+} Elf64_Sym;
+
+/* Symbol Table index of the undefined symbol */
+#define ELF_SYM_UNDEFINED 0
+
+#define STN_UNDEF 0 /* undefined index */
+
+/* st_info: Symbol Bindings */
+#define STB_LOCAL 0 /* local symbol */
+#define STB_GLOBAL 1 /* global symbol */
+#define STB_WEAK 2 /* weakly defined global symbol */
+#define STB_NUM 3
+
+#define STB_LOOS 10 /* Operating system specific range */
+#define STB_HIOS 12
+#define STB_LOPROC 13 /* Processor-specific range */
+#define STB_HIPROC 15
+
+/* st_info: Symbol Types */
+#define STT_NOTYPE 0 /* Type not specified */
+#define STT_OBJECT 1 /* Associated with a data object */
+#define STT_FUNC 2 /* Associated with a function */
+#define STT_SECTION 3 /* Associated with a section */
+#define STT_FILE 4 /* Associated with a file name */
+#define STT_COMMON 5 /* Uninitialised common block */
+#define STT_TLS 6 /* Thread local data object */
+#define STT_NUM 7
+
+#define STT_LOOS 10 /* Operating system specific range */
+#define STT_HIOS 12
+#define STT_LOPROC 13 /* Processor-specific range */
+#define STT_HIPROC 15
+
+/* st_other: Visibility Types */
+#define STV_DEFAULT 0 /* use binding type */
+#define STV_INTERNAL 1 /* not referenced from outside */
+#define STV_HIDDEN 2 /* not visible, may be used via ptr */
+#define STV_PROTECTED 3 /* visible, not preemptible */
+#define STV_EXPORTED 4
+#define STV_SINGLETON 5
+#define STV_ELIMINATE 6
+
+/* st_info/st_other utility macros */
+#define ELF_ST_BIND(info) ((uint32_t)(info) >> 4)
+#define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf)
+#define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \
+ ((type) & 0xf)))
+#define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3)
+
+/*
+ * Special section indexes
+ */
+#define SHN_UNDEF 0 /* Undefined section */
+
+#define SHN_LORESERVE 0xff00 /* Reserved range */
+#define SHN_ABS 0xfff1 /* Absolute symbols */
+#define SHN_COMMON 0xfff2 /* Common symbols */
+#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */
+#define SHN_HIRESERVE 0xffff
+
+#define SHN_LOPROC 0xff00 /* Processor-specific range */
+#define SHN_HIPROC 0xff1f
+#define SHN_LOOS 0xff20 /* Operating system specific range */
+#define SHN_HIOS 0xff3f
+
+#define SHN_MIPS_ACOMMON 0xff00
+#define SHN_MIPS_TEXT 0xff01
+#define SHN_MIPS_DATA 0xff02
+#define SHN_MIPS_SCOMMON 0xff03
+
+/*
+ * Relocation Entries
+ */
+typedef struct {
+ Elf32_Word r_offset; /* where to do it */
+ Elf32_Word r_info; /* index & type of relocation */
+} Elf32_Rel;
+
+typedef struct {
+ Elf32_Word r_offset; /* where to do it */
+ Elf32_Word r_info; /* index & type of relocation */
+ Elf32_Sword r_addend; /* adjustment value */
+} Elf32_Rela;
+
+/* r_info utility macros */
+#define ELF32_R_SYM(info) ((info) >> 8)
+#define ELF32_R_TYPE(info) ((info) & 0xff)
+#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
+
+typedef struct {
+ Elf64_Addr r_offset; /* where to do it */
+ Elf64_Xword r_info; /* index & type of relocation */
+} Elf64_Rel;
+
+typedef struct {
+ Elf64_Addr r_offset; /* where to do it */
+ Elf64_Xword r_info; /* index & type of relocation */
+ Elf64_Sxword r_addend; /* adjustment value */
+} Elf64_Rela;
+
+/* r_info utility macros */
+#define ELF64_R_SYM(info) ((info) >> 32)
+#define ELF64_R_TYPE(info) ((info) & 0xffffffff)
+#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
+
+/*
+ * Move entries
+ */
+typedef struct {
+ Elf32_Lword m_value; /* symbol value */
+ Elf32_Word m_info; /* size + index */
+ Elf32_Word m_poffset; /* symbol offset */
+ Elf32_Half m_repeat; /* repeat count */
+ Elf32_Half m_stride; /* stride info */
+} Elf32_Move;
+
+#define ELF32_M_SYM(info) ((info) >> 8)
+#define ELF32_M_SIZE(info) ((info) & 0xff)
+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
+
+typedef struct {
+ Elf64_Lword m_value; /* symbol value */
+ Elf64_Xword m_info; /* size + index */
+ Elf64_Xword m_poffset; /* symbol offset */
+ Elf64_Word m_repeat; /* repeat count */
+ Elf64_Word m_stride; /* stride info */
+} Elf64_Move;
+
+#define ELF64_M_SYM(info) ((info) >> 8)
+#define ELF64_M_SIZE(info) ((info) & 0xff)
+#define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
+
+/*
+ * Hardware/software capabilities entry
+ */
+typedef struct {
+ Elf32_Word c_tag; /* entry tag value */
+ union {
+ Elf32_Addr c_ptr;
+ Elf32_Word c_val;
+ } c_un;
+} Elf32_Cap;
+
+typedef struct {
+ Elf64_Xword c_tag; /* entry tag value */
+ union {
+ Elf64_Addr c_ptr;
+ Elf64_Xword c_val;
+ } c_un;
+} Elf64_Cap;
+
+/*
+ * Dynamic Section structure array
+ */
+typedef struct {
+ Elf32_Word d_tag; /* entry tag value */
+ union {
+ Elf32_Addr d_ptr;
+ Elf32_Word d_val;
+ } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+ Elf64_Xword d_tag; /* entry tag value */
+ union {
+ Elf64_Addr d_ptr;
+ Elf64_Xword d_val;
+ } d_un;
+} Elf64_Dyn;
+
+/* d_tag */
+#define DT_NULL 0 /* Marks end of dynamic array */
+#define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */
+#define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */
+#define DT_PLTGOT 3 /* Address of PLT and/or GOT */
+#define DT_HASH 4 /* Address of symbol hash table */
+#define DT_STRTAB 5 /* Address of string table */
+#define DT_SYMTAB 6 /* Address of symbol table */
+#define DT_RELA 7 /* Address of Rela relocation table */
+#define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */
+#define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */
+#define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */
+#define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */
+#define DT_INIT 12 /* Address of initialization function */
+#define DT_FINI 13 /* Address of termination function */
+#define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */
+#define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */
+#define DT_SYMBOLIC 16 /* Start symbol search within local object */
+#define DT_REL 17 /* Address of Rel relocation table */
+#define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */
+#define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */
+#define DT_PLTREL 20 /* Type of PLT relocation entries */
+#define DT_DEBUG 21 /* Used for debugging; unspecified */
+#define DT_TEXTREL 22 /* Relocations might modify non-writable seg */
+#define DT_JMPREL 23 /* Address of relocations associated with PLT */
+#define DT_BIND_NOW 24 /* Process all relocations at load-time */
+#define DT_INIT_ARRAY 25 /* Address of initialization function array */
+#define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */
+#define DT_INIT_ARRAYSZ 27 /* Address of termination function array */
+#define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/
+#define DT_NUM 29
+
+#define DT_LOOS 0x60000000 /* Operating system specific range */
+#define DT_VERSYM 0x6ffffff0 /* Symbol versions */
+#define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */
+#define DT_VERDEF 0x6ffffffc /* Versions defined by file */
+#define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */
+#define DT_VERNEED 0x6ffffffe /* Versions needed by file */
+#define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */
+#define DT_HIOS 0x6fffffff
+#define DT_LOPROC 0x70000000 /* Processor-specific range */
+#define DT_HIPROC 0x7fffffff
+
+/* Flag values for DT_FLAGS_1 (incomplete) */
+#define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */
+#define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */
+#define DF_1_INITFIRST 0x00000020 /* Object's init/fini take priority */
+#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
+
+/*
+ * Auxiliary Vectors
+ */
+typedef struct {
+ Elf32_Word a_type; /* 32-bit id */
+ Elf32_Word a_v; /* 32-bit id */
+} Aux32Info;
+
+typedef struct {
+ Elf64_Word a_type; /* 32-bit id */
+ Elf64_Xword a_v; /* 64-bit id */
+} Aux64Info;
+
+/* a_type */
+#define AT_NULL 0 /* Marks end of array */
+#define AT_IGNORE 1 /* No meaning, a_un is undefined */
+#define AT_EXECFD 2 /* Open file descriptor of object file */
+#define AT_PHDR 3 /* &phdr[0] */
+#define AT_PHENT 4 /* sizeof(phdr[0]) */
+#define AT_PHNUM 5 /* # phdr entries */
+#define AT_PAGESZ 6 /* PAGESIZE */
+#define AT_BASE 7 /* Interpreter base addr */
+#define AT_FLAGS 8 /* Processor flags */
+#define AT_ENTRY 9 /* Entry address of executable */
+#define AT_DCACHEBSIZE 10 /* Data cache block size */
+#define AT_ICACHEBSIZE 11 /* Instruction cache block size */
+#define AT_UCACHEBSIZE 12 /* Unified cache block size */
+#define AT_STACKBASE 13 /* Base address of the main thread */
+
+ /* Vendor specific */
+#define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */
+
+#define AT_EUID 2000 /* euid (solaris compatible numbers) */
+#define AT_RUID 2001 /* ruid (solaris compatible numbers) */
+#define AT_EGID 2002 /* egid (solaris compatible numbers) */
+#define AT_RGID 2003 /* rgid (solaris compatible numbers) */
+
+ /* Solaris kernel specific */
+#define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */
+#define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */
+#define AT_SUN_LDNAME 2006 /* dynamic linker's name */
+#define AT_SUN_LPGSIZE 2007 /* large pagesize */
+
+ /* Other information */
+#define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */
+#define AT_SUN_HWCAP 2009 /* process hardware capabilities */
+#define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */
+#define AT_SUN_CPU 2011 /* CPU name */
+ /* ibcs2 emulation band aid */
+#define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */
+#define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */
+ /* Executable's fully resolved name */
+#define AT_SUN_EXECNAME 2014
+
+/*
+ * Note Headers
+ */
+typedef struct {
+ Elf32_Word n_namesz;
+ Elf32_Word n_descsz;
+ Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+ Elf64_Word n_namesz;
+ Elf64_Word n_descsz;
+ Elf64_Word n_type;
+} Elf64_Nhdr;
+
+#define ELF_NOTE_GNU_NAMESZ 4
+#define ELF_NOTE_GNU_NAME "GNU\0"
+
+/*
+ * GNU-specific note type: ABI tag
+ * name: GNU\0
+ * namesz: 4
+ * desc:
+ * word[0]: OS tag
+ * word[1]: major version
+ * word[2]: minor version
+ * word[3]: teeny version
+ * descsz: 16
+ */
+/* GNU-specific note name and description sizes */
+#define ELF_NOTE_TYPE_ABI_TAG 1
+#define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME
+#define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ
+#define ELF_NOTE_ABI_DESCSZ 16
+/* GNU-specific OS/version value stuff */
+#define ELF_NOTE_ABI_OS_LINUX 0
+#define ELF_NOTE_ABI_OS_HURD 1
+#define ELF_NOTE_ABI_OS_SOLARIS 2
+#define ELF_NOTE_ABI_OS_KFREEBSD 3
+#define ELF_NOTE_ABI_OS_KNETBSD 4
+
+/*
+ * GNU-specific note type: Hardware capabilities
+ * name: GNU\0
+ * namesz: 4
+ * desc:
+ * word[0]: Number of entries
+ * word[1]: Bitmask of enabled entries
+ * Followed by a byte id, and a NUL terminated string per entry
+ * descsz: variable
+ */
+#define ELF_NOTE_TYPE_GNU_HWCAP 2
+
+/*
+ * GNU-specific note type: Build ID generated by ld
+ * name: GNU\0
+ * desc:
+ * word[0..4] SHA1 [default]
+ * or
+ * word[0..3] md5 or uuid
+ * descsz: 16 or 20
+ */
+#define ELF_NOTE_TYPE_GNU_BUILD_ID 3
+
+/* SuSE-specific note type: ABI
+ * name: SuSE\0
+ * namesz: 5
+ * desc:
+ * half[0] = MMmm
+ *
+ * M = product major version
+ * m = product minor version
+ * descsz: 2
+ */
+#define ELF_NOTE_TYPE_SUSE_TAG 1
+/* SuSE-specific note name and description sizes */
+#define ELF_NOTE_SUSE_NAMESZ 5
+#define ELF_NOTE_SUSE_DESCSZ 2
+/* SuSE-specific note name */
+#define ELF_NOTE_SUSE_NAME "SuSE\0"
+
+/* SuSE-specific note type: version
+ * name: SuSE\0\0\0\0
+ * namesz: 8
+ * desc:
+ * word[0] = VVTTMMmm
+ *
+ * V = version of following data
+ * T = product type: [box, sles, nld, whatever]
+ * M = product major version
+ * m = product minor version
+ * descsz: 8
+ */
+#define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */
+/* SuSE-specific note name and description sizes */
+#define ELF_NOTE_SUSE_VERSION_NAMESZ 8
+#define ELF_NOTE_SUSE_VERSION_DESCSZ 8
+/* SuSE-specific note name */
+#define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0"
+
+/* NetBSD-specific note type: Emulation name.
+ * name: NetBSD\0\0
+ * namesz: 8
+ * desc:
+ * word[0]: MMmmrrpp00
+ *
+ * M = major version
+ * m = minor version
+ * r = release ["",A-Z,Z[A-Z] but numeric]
+ * p = patchlevel
+ * descsz: 4
+ */
+#define ELF_NOTE_TYPE_NETBSD_TAG 1
+/* NetBSD-specific note name and description sizes */
+#define ELF_NOTE_NETBSD_NAMESZ 7
+#define ELF_NOTE_NETBSD_DESCSZ 4
+/* NetBSD-specific note name */
+#define ELF_NOTE_NETBSD_NAME "NetBSD\0\0"
+
+/* NetBSD-specific note type: Checksum.
+ * There should be 1 NOTE per PT_LOAD section.
+ * name: ???
+ * namesz: ???
+ * desc:
+ * a tuple of <phnum>(16),<chk-type>(16),<chk-value>.
+ * descsz: ???
+ */
+#define ELF_NOTE_TYPE_CHECKSUM_TAG 2
+#define ELF_NOTE_CHECKSUM_CRC32 1
+#define ELF_NOTE_CHECKSUM_MD5 2
+#define ELF_NOTE_CHECKSUM_SHA1 3
+#define ELF_NOTE_CHECKSUM_SHA256 4
+
+/*
+ * NetBSD-specific note type: PaX.
+ * There should be 1 NOTE per executable.
+ * name: PaX\0
+ * namesz: 4
+ * desc:
+ * word[0]: capability bitmask
+ * descsz: 4
+ */
+#define ELF_NOTE_TYPE_PAX_TAG 3
+#define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */
+#define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */
+#define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */
+#define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Servguard */
+#define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */
+#define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */
+#define ELF_NOTE_PAX_NAMESZ 4
+#define ELF_NOTE_PAX_NAME "PaX\0"
+#define ELF_NOTE_PAX_DESCSZ 4
+
+/*
+ * NetBSD-specific core file information.
+ *
+ * NetBSD ELF core files use notes to provide information about
+ * the process's state. The note name is "NetBSD-CORE" for
+ * information that is global to the process, and "NetBSD-CORE@nn",
+ * where "nn" is the lwpid of the LWP that the information belongs
+ * to (such as register state).
+ *
+ * We use the following note identifiers:
+ *
+ * ELF_NOTE_NETBSD_CORE_PROCINFO
+ * Note is a "netbsd_elfcore_procinfo" structure.
+ *
+ * We also use ptrace(2) request numbers (the ones that exist in
+ * machine-dependent space) to identify register info notes. The
+ * info in such notes is in the same format that ptrace(2) would
+ * export that information.
+ *
+ * Please try to keep the members of this structure nicely aligned,
+ * and if you add elements, add them to the end and bump the version.
+ */
+
+#define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE"
+
+#define ELF_NOTE_NETBSD_CORE_PROCINFO 1
+
+#define NETBSD_ELFCORE_PROCINFO_VERSION 1
+
+struct netbsd_elfcore_procinfo {
+ /* Version 1 fields start here. */
+ uint32_t cpi_version; /* our version */
+ uint32_t cpi_cpisize; /* sizeof(this struct) */
+ uint32_t cpi_signo; /* killing signal */
+ uint32_t cpi_sigcode; /* signal code */
+ uint32_t cpi_sigpend[4]; /* pending signals */
+ uint32_t cpi_sigmask[4]; /* blocked signals */
+ uint32_t cpi_sigignore[4]; /* ignored signals */
+ uint32_t cpi_sigcatch[4]; /* caught signals */
+ int32_t cpi_pid; /* process ID */
+ int32_t cpi_ppid; /* parent process ID */
+ int32_t cpi_pgrp; /* process group ID */
+ int32_t cpi_sid; /* session ID */
+ uint32_t cpi_ruid; /* real user ID */
+ uint32_t cpi_euid; /* effective user ID */
+ uint32_t cpi_svuid; /* saved user ID */
+ uint32_t cpi_rgid; /* real group ID */
+ uint32_t cpi_egid; /* effective group ID */
+ uint32_t cpi_svgid; /* saved group ID */
+ uint32_t cpi_nlwps; /* number of LWPs */
+ int8_t cpi_name[32]; /* copy of p->p_comm */
+ /* Add version 2 fields below here. */
+ int32_t cpi_siglwp; /* LWP target of killing signal */
+};
+
+#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
+#define ELFSIZE ARCH_ELFSIZE
+#endif
+
+#if defined(ELFSIZE)
+#define CONCAT(x,y) __CONCAT(x,y)
+#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
+#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
+#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
+#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
+#endif
+
+#if defined(ELFSIZE) && (ELFSIZE == 32)
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Phdr Elf32_Phdr
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Rel Elf32_Rel
+#define Elf_Rela Elf32_Rela
+#define Elf_Dyn Elf32_Dyn
+#define Elf_Word Elf32_Word
+#define Elf_Sword Elf32_Sword
+#define Elf_Half Elf32_Half
+#define Elf_Addr Elf32_Addr
+#define Elf_Off Elf32_Off
+#define Elf_SOff Elf32_SOff
+#define Elf_Nhdr Elf32_Nhdr
+#define Elf_Verdef Elf32_Verdef
+#define Elf_Verdaux Elf32_Verdaux
+#define Elf_Verneed Elf32_Verneed
+#define Elf_Vernaux Elf32_Vernaux
+#define Elf_Versym Elf32_Versym
+
+#define ELF_R_SYM ELF32_R_SYM
+#define ELF_R_TYPE ELF32_R_TYPE
+#define ELFCLASS ELFCLASS32
+
+#define AuxInfo Aux32Info
+#elif defined(ELFSIZE) && (ELFSIZE == 64)
+#define Elf_Ehdr Elf64_Ehdr
+#define Elf_Phdr Elf64_Phdr
+#define Elf_Shdr Elf64_Shdr
+#define Elf_Sym Elf64_Sym
+#define Elf_Rel Elf64_Rel
+#define Elf_Rela Elf64_Rela
+#define Elf_Dyn Elf64_Dyn
+#define Elf_Word Elf64_Word
+#define Elf_Sword Elf64_Sword
+#define Elf_Half Elf64_Half
+#define Elf_Addr Elf64_Addr
+#define Elf_Off Elf64_Off
+#define Elf_SOff Elf64_SOff
+#define Elf_Nhdr Elf64_Nhdr
+#define Elf_Verdef Elf64_Verdef
+#define Elf_Verdaux Elf64_Verdaux
+#define Elf_Verneed Elf64_Verneed
+#define Elf_Vernaux Elf64_Vernaux
+#define Elf_Versym Elf64_Versym
+
+#define ELF_R_SYM ELF64_R_SYM
+#define ELF_R_TYPE ELF64_R_TYPE
+#define ELFCLASS ELFCLASS64
+
+#define AuxInfo Aux64Info
+#endif
+
+#ifndef Elf_Symindx
+#define Elf_Symindx uint32_t
+#endif
+
+#define ELF32_ST_BIND(info) ELF_ST_BIND(info)
+#define ELF32_ST_TYPE(info) ELF_ST_TYPE(info)
+#define ELF32_ST_INFO(bind,type) ELF_ST_INFO(bind,type)
+#define ELF32_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other)
+
+#define ELF64_ST_BIND(info) ELF_ST_BIND(info)
+#define ELF64_ST_TYPE(info) ELF_ST_TYPE(info)
+#define ELF64_ST_INFO(bind,type) ELF_ST_INFO(bind,type)
+#define ELF64_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other)
+
+typedef struct {
+ Elf32_Half si_boundto; /* direct bindings - symbol bound to */
+ Elf32_Half si_flags; /* per symbol flags */
+} Elf32_Syminfo;
+
+typedef struct {
+ Elf64_Word si_boundto; /* direct bindings - symbol bound to */
+ Elf64_Word si_flags; /* per symbol flags */
+} Elf64_Syminfo;
+
+#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association
+ to object containing definition */
+#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */
+#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be
+ lazily-loaded */
+#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to
+ object containing definition */
+#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference
+ directly bind to this symbol */
+#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */
+#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */
+
+#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */
+#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */
+#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */
+#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */
+#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */
+
+#define SYMINFO_NONE 0 /* Syminfo version */
+#define SYMINFO_CURRENT 1
+#define SYMINFO_NUM 2
+
+/*
+ * These constants are used for Elf32_Verdef struct's version number.
+ */
+#define VER_DEF_NONE 0
+#define VER_DEF_CURRENT 1
+
+/*
+ * These constants are used for Elf32_Verdef struct's vd_ndx.
+ */
+#define VER_DEF_IDX(x) VER_NDX(x)
+
+/*
+ * These constants are used for Elf32_Verdef struct's vd_flags.
+ */
+#define VER_FLG_BASE 0x1
+#define VER_FLG_WEAK 0x2
+
+/*
+ * These are used in an Elf32_Versym field.
+ */
+#define VER_NDX_LOCAL 0
+#define VER_NDX_GLOBAL 1
+#define VER_NDX_GIVEN 2
+
+/*
+ * These constants are used for Elf32_Verneed struct's version number.
+ */
+#define VER_NEED_NONE 0
+#define VER_NEED_CURRENT 1
+
+/*
+ * These constants are used for Elf32_Vernaux struct's vna_other.
+ */
+#define VER_NEED_HIDDEN VER_NDX_HIDDEN
+#define VER_NEED_IDX(x) VER_NDX(x)
+
+/* index */
+#define VER_NDX_HIDDEN 0x8000
+#define VER_NDX(x) ((x) & ~VER_NDX_HIDDEN)
+
+/*
+ * GNU Extension hidding symbol
+ */
+#define VERSYM_HIDDEN 0x8000
+#define VERSYM_VERSION 0x7fff
+
+#define ELF_VER_CHR '@'
+
+/*
+ * These are current size independent.
+ */
+
+typedef struct {
+ Elf32_Half vd_version; /* version number of structure */
+ Elf32_Half vd_flags; /* flags (VER_FLG_*) */
+ Elf32_Half vd_ndx; /* version index */
+ Elf32_Half vd_cnt; /* number of verdaux entries */
+ Elf32_Word vd_hash; /* hash of name */
+ Elf32_Word vd_aux; /* offset to verdaux entries */
+ Elf32_Word vd_next; /* offset to next verdef */
+} Elf32_Verdef;
+typedef Elf32_Verdef Elf64_Verdef;
+
+typedef struct {
+ Elf32_Word vda_name; /* string table offset of name */
+ Elf32_Word vda_next; /* offset to verdaux */
+} Elf32_Verdaux;
+typedef Elf32_Verdaux Elf64_Verdaux;
+
+typedef struct {
+ Elf32_Half vn_version; /* version number of structure */
+ Elf32_Half vn_cnt; /* number of vernaux entries */
+ Elf32_Word vn_file; /* string table offset of library name*/
+ Elf32_Word vn_aux; /* offset to vernaux entries */
+ Elf32_Word vn_next; /* offset to next verneed */
+} Elf32_Verneed;
+typedef Elf32_Verneed Elf64_Verneed;
+
+typedef struct {
+ Elf32_Word vna_hash; /* Hash of dependency name */
+ Elf32_Half vna_flags; /* flags (VER_FLG_*) */
+ Elf32_Half vna_other; /* unused */
+ Elf32_Word vna_name; /* string table offset to version name*/
+ Elf32_Word vna_next; /* offset to next vernaux */
+} Elf32_Vernaux;
+typedef Elf32_Vernaux Elf64_Vernaux;
+
+typedef struct {
+ Elf32_Half vs_vers;
+} Elf32_Versym;
+typedef Elf32_Versym Elf64_Versym;
+
+#ifdef _KERNEL
+
+#define ELF_AUX_ENTRIES 15 /* Max size of aux array passed to loader */
+#define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
+#define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */
+#define ELF64_NO_ADDR (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */
+#define ELF64_LINK_ADDR ((Elf64_Addr)-2) /* advises to use link address */
+
+#if defined(ELFSIZE) && (ELFSIZE == 64)
+#define ELF_NO_ADDR ELF64_NO_ADDR
+#define ELF_LINK_ADDR ELF64_LINK_ADDR
+#elif defined(ELFSIZE) && (ELFSIZE == 32)
+#define ELF_NO_ADDR ELF32_NO_ADDR
+#define ELF_LINK_ADDR ELF32_LINK_ADDR
+#endif
+
+#ifndef ELF32_EHDR_FLAGS_OK
+#define ELF32_EHDR_FLAGS_OK(eh) 1
+#endif
+
+#ifndef ELF64_EHDR_FLAGS_OK
+#define ELF64_EHDR_FLAGS_OK(eh) 1
+#endif
+
+#if defined(ELFSIZE) && (ELFSIZE == 64)
+#define ELF_EHDR_FLAGS_OK(eh) ELF64_EHDR_FLAGS_OK(eh)
+#else
+#define ELF_EHDR_FLAGS_OK(eh) ELF32_EHDR_FLAGS_OK(eh)
+#endif
+
+#if defined(ELFSIZE)
+struct elf_args {
+ Elf_Addr arg_entry; /* program entry point */
+ Elf_Addr arg_interp; /* Interpreter load address */
+ Elf_Addr arg_phaddr; /* program header address */
+ Elf_Addr arg_phentsize; /* Size of program header */
+ Elf_Addr arg_phnum; /* Number of program headers */
+};
+#endif
+
+#ifdef _KERNEL_OPT
+#include "opt_execfmt.h"
+#endif
+
+struct ps_strings;
+
+#ifdef EXEC_ELF32
+int exec_elf32_makecmds(struct lwp *, struct exec_package *);
+int elf32_copyargs(struct lwp *, struct exec_package *,
+ struct ps_strings *, char **, void *);
+
+int coredump_elf32(struct lwp *, void *);
+int coredump_writenote_elf32(struct proc *, void *, Elf32_Nhdr *,
+ const char *, void *);
+
+int elf32_check_header(Elf32_Ehdr *, int);
+#endif
+
+#ifdef EXEC_ELF64
+int exec_elf64_makecmds(struct lwp *, struct exec_package *);
+int elf64_copyargs(struct lwp *, struct exec_package *,
+ struct ps_strings *, char **, void *);
+
+int coredump_elf64(struct lwp *, void *);
+int coredump_writenote_elf64(struct proc *, void *, Elf64_Nhdr *,
+ const char *, void *);
+
+int elf64_check_header(Elf64_Ehdr *, int);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EXEC_ELF_H_ */
-/* $NetBSD: extattr.h,v 1.7 2011/08/03 04:11:17 manu Exp $ */
+/* $NetBSD: extattr.h,v 1.9 2012/03/13 18:41:02 elad Exp $ */
/*-
* Copyright (c) 1999-2001 Robert N. M. Watson
#ifdef _KERNEL
-#include <sys/syslimits.h>
+#include <sys/param.h>
/* VOP_LISTEXTATTR flags */
#define EXTATTR_LIST_LENPREFIX 1 /* names with length prefix */
-#define EXTATTR_MAXNAMELEN NAME_MAX
+#define EXTATTR_MAXNAMELEN KERNEL_NAME_MAX
struct lwp;
struct vnode;
-int extattr_check_cred(struct vnode *, int, kauth_cred_t,
- struct lwp *, int);
+int extattr_check_cred(struct vnode *, const char *, kauth_cred_t, int);
#else
+/* $NetBSD: fcntl.h,v 1.42 2012/01/25 00:28:35 christos Exp $ */
+
+/*-
+ * Copyright (c) 1983, 1990, 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.
+ *
+ * @(#)fcntl.h 8.3 (Berkeley) 1/21/94
+ */
+
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
/*
* This file includes the definitions for open and fcntl
- * described by POSIX for <fcntl.h>.
+ * described by POSIX for <fcntl.h>; it also includes
+ * related kernel definitions.
*/
+
+#ifndef _KERNEL
#include <sys/featuretest.h>
#include <sys/types.h>
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#include <sys/stat.h>
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#endif /* !_KERNEL */
/*
* File status flags: these are used by open(2), fcntl(2).
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
+/*
+ * posix_advise advisories.
+ */
+
+#define POSIX_FADV_NORMAL 0 /* default advice / no advice */
+#define POSIX_FADV_RANDOM 1 /* random access */
+#define POSIX_FADV_SEQUENTIAL 2 /* sequential access(lower to higher) */
+#define POSIX_FADV_WILLNEED 3 /* be needed in near future */
+#define POSIX_FADV_DONTNEED 4 /* not be needed in near future */
+#define POSIX_FADV_NOREUSE 5 /* be accessed once */
+
+/*
+ * Constants for X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if defined(_INCOMPLETE_XOPEN_C063) || defined(_KERNEL)
+#define AT_FDCWD -100 /* Use cwd for relative link target */
+#define AT_EACCESS 0x100 /* Use euig/egid for access checks */
+#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symlinks */
+#define AT_SYMLINK_FOLLOW 0x400 /* Follow symlinks */
+#define AT_REMOVEDIR 0x800 /* Remove directory only */
+#endif
+
+
+#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
int flock(int, int);
#endif /* _NETBSD_SOURCE */
__END_DECLS
+#endif /* _KERNEL */
#endif /* !_SYS_FCNTL_H_ */
-/* $NetBSD: float_ieee754.h,v 1.8 2005/12/11 12:25:20 christos Exp $ */
+/* $NetBSD: float_ieee754.h,v 1.10 2011/10/01 17:39:14 christos Exp $ */
/*
* Copyright (c) 1992, 1993
#include <sys/cdefs.h>
#include <sys/featuretest.h>
+/*
+ * feature macro to test for IEEE754
+ */
+#define _FLOAT_IEEE754 1
+
#ifndef FLT_ROUNDS
__BEGIN_DECLS
extern int __flt_rounds(void);
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
#ifndef FLT_EVAL_METHOD
#if __GNUC_PREREQ__(3, 3)
-#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif /* GCC >= 3.3 */
#endif /* defined(FLT_EVAL_METHOD) */
#endif /* !defined(_ANSI_SOURCE) && ... */
+#if __GNUC_PREREQ__(3, 3)
+/*
+ * GCC 3,3 and later provide builtins for the FLT, DBL, and LDBL constants.
+ */
+#define FLT_RADIX __FLT_RADIX__
+
+#define FLT_MANT_DIG __FLT_MANT_DIG__
+#define FLT_EPSILON __FLT_EPSILON__
+#define FLT_DIG __FLT_DIG__
+#define FLT_MIN_EXP __FLT_MIN_EXP__
+#define FLT_MIN __FLT_MIN__
+#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
+#define FLT_MAX_EXP __FLT_MAX_EXP__
+#define FLT_MAX __FLT_MAX__
+#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
+
+#define DBL_MANT_DIG __DBL_MANT_DIG__
+#define DBL_EPSILON __DBL_EPSILON__
+#define DBL_DIG __DBL_DIG__
+#define DBL_MIN_EXP __DBL_MIN_EXP__
+#define DBL_MIN __DBL_MIN__
+#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+#define DBL_MAX_EXP __DBL_MAX_EXP__
+#define DBL_MAX __DBL_MAX__
+#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+#else /* GCC < 3.3 */
#define FLT_RADIX 2 /* b */
#define FLT_MANT_DIG 24 /* p */
-#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */
#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
#define FLT_MIN_EXP (-125) /* emin */
-#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
#define FLT_MAX_EXP 128 /* emax */
-#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
+#if __STDC_VERSION__ >= 199901L
+#define FLT_EPSILON 0x1.0p-23F
+#define FLT_MIN 0x1.0p-126F
+#define FLT_MAX 0x1.fffffep+127F
+#else
+#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */
+#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
+#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
+#endif
#define DBL_MANT_DIG 53
-#define DBL_EPSILON 2.2204460492503131E-16
#define DBL_DIG 15
#define DBL_MIN_EXP (-1021)
-#define DBL_MIN 2.2250738585072014E-308
#define DBL_MIN_10_EXP (-307)
#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.7976931348623157E+308
#define DBL_MAX_10_EXP 308
+#if __STDC_VERSION__ >= 199901L
+#define DBL_EPSILON 0x1.0p-52
+#define DBL_MIN 0x1.0p-1022
+#define DBL_MAX 0x1.fffffffffffffp+1023
+#else
+#define DBL_EPSILON 2.2204460492503131E-16
+#define DBL_MIN 2.2250738585072014E-308
+#define DBL_MAX 1.7976931348623157E+308
+#endif
+#endif /* GCC < 3.3 */
/*
* If no extended-precision type is defined by the machine-dependent
* header including this, default to `long double' being double-precision.
((_POSIX_C_SOURCE - 0) >= 200112L) || \
((_XOPEN_SOURCE - 0) >= 600) || \
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-#define DECIMAL_DIG 17 /* ceil((1+p*log10(b))-(b==10) */
+#if __GNUC_PREREQ__(3, 3)
+#define DECIMAL_DIG __DECIMAL_DIG__
+#else
+#define DECIMAL_DIG 17 /* ceil((1+p*log10(b))-(b==10) */
+#endif
#endif /* !defined(_ANSI_SOURCE) && ... */
#endif /* LDBL_MANT_DIG */
--- /dev/null
+/* $NetBSD: fstypes.h,v 1.30 2011/11/18 21:17:45 christos Exp $ */
+
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)mount.h 8.21 (Berkeley) 5/20/95
+ */
+
+#ifndef _SYS_FSTYPES_H_
+#define _SYS_FSTYPES_H_
+
+typedef struct { int32_t __fsid_val[2]; } fsid_t; /* file system id type */
+
+#if defined(_KERNEL)
+/*
+ * File identifier.
+ * These are unique per filesystem on a single machine.
+ */
+struct fid {
+ unsigned short fid_len; /* length of data in bytes */
+ unsigned short fid_reserved; /* compat: historic align */
+ char fid_data[0]; /* data (variable length) */
+};
+
+/*
+ * Generic file handle
+ */
+struct fhandle {
+ fsid_t fh_fsid; /* File system id of mount point */
+ struct fid fh_fid; /* File sys specific id */
+};
+typedef struct fhandle fhandle_t;
+
+/*
+ * FHANDLE_SIZE_MAX: arbitrary value to prevent unreasonable allocation.
+ *
+ * FHANDLE_SIZE_MIN: chosen for compatibility. smaller handles are zero-padded.
+ */
+
+#define FHANDLE_SIZE_COMPAT 28
+#define FHANDLE_SIZE_MAX 1024
+#define FHANDLE_SIZE_MIN FHANDLE_SIZE_COMPAT
+
+#define FHANDLE_FSID(fh) (&(fh)->fh_fsid)
+#define FHANDLE_FILEID(fh) (&(fh)->fh_fid)
+#define FHANDLE_SIZE_FROM_FILEID_SIZE(fidsize) \
+ MAX(FHANDLE_SIZE_MIN, (offsetof(fhandle_t, fh_fid) + (fidsize)))
+#define FHANDLE_SIZE(fh) \
+ FHANDLE_SIZE_FROM_FILEID_SIZE(FHANDLE_FILEID(fh)->fid_len)
+#endif /* defined(_KERNEL) */
+
+/*
+ * Mount flags. XXX BEWARE: these are not in numerical order!
+ *
+ * Unmount uses MNT_FORCE flag.
+ *
+ * Note that all mount flags are listed here. if you need to add one, take
+ * one of the __MNT_UNUSED flags.
+ */
+
+#define __MNT_UNUSED1 0x00200000
+#define __MNT_UNUSED2 0x00800000
+
+#define MNT_RDONLY 0x00000001 /* read only filesystem */
+#define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
+#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
+#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
+#define MNT_NODEV 0x00000010 /* don't interpret special files */
+#define MNT_UNION 0x00000020 /* union with underlying filesystem */
+#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
+#define MNT_NOCOREDUMP 0x00008000 /* don't write core dumps to this FS */
+#define MNT_RELATIME 0x00020000 /* only update access time if mod/ch */
+#define MNT_IGNORE 0x00100000 /* don't show entry in df */
+#define MNT_EXTATTR 0x01000000 /* enable extended attributes */
+#define MNT_LOG 0x02000000 /* Use logging */
+#define MNT_NOATIME 0x04000000 /* Never update access times in fs */
+#define MNT_SYMPERM 0x20000000 /* recognize symlink permission */
+#define MNT_NODEVMTIME 0x40000000 /* Never update mod times for devs */
+#define MNT_SOFTDEP 0x80000000 /* Use soft dependencies */
+
+#define __MNT_BASIC_FLAGS \
+ { MNT_ASYNC, 0, "asynchronous" }, \
+ { MNT_EXTATTR, 0, "extattr" }, \
+ { MNT_IGNORE, 0, "hidden" }, \
+ { MNT_LOG, 0, "log" }, \
+ { MNT_NOATIME, 0, "noatime" }, \
+ { MNT_NOCOREDUMP, 0, "nocoredump" }, \
+ { MNT_NODEV, 0, "nodev" }, \
+ { MNT_NODEVMTIME, 0, "nodevmtime" }, \
+ { MNT_NOEXEC, 0, "noexec" }, \
+ { MNT_NOSUID, 0, "nosuid" }, \
+ { MNT_RDONLY, 0, "read-only" }, \
+ { MNT_RELATIME, 0, "relatime" }, \
+ { MNT_SOFTDEP, 0, "soft dependencies" }, \
+ { MNT_SYMPERM, 0, "symperm" }, \
+ { MNT_SYNCHRONOUS, 0, "synchronous" }, \
+ { MNT_UNION, 0, "union" }, \
+
+#define MNT_BASIC_FLAGS (MNT_ASYNC | MNT_EXTATTR | MNT_LOG | MNT_NOATIME | \
+ MNT_NOCOREDUMP | MNT_NODEV | MNT_NODEVMTIME | MNT_NOEXEC | MNT_NOSUID | \
+ MNT_RDONLY | MNT_RELATIME | MNT_SOFTDEP | MNT_SYMPERM | \
+ MNT_SYNCHRONOUS | MNT_UNION)
+/*
+ * exported mount flags.
+ */
+#define MNT_EXRDONLY 0x00000080 /* exported read only */
+#define MNT_EXPORTED 0x00000100 /* file system is exported */
+#define MNT_DEFEXPORTED 0x00000200 /* exported to the world */
+#define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */
+#define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */
+#define MNT_EXNORESPORT 0x08000000 /* don't enforce reserved ports (NFS) */
+#define MNT_EXPUBLIC 0x10000000 /* public export (WebNFS) */
+
+#define __MNT_EXPORTED_FLAGS \
+ { MNT_EXRDONLY, 1, "exported read-only" }, \
+ { MNT_EXPORTED, 0, "NFS exported" }, \
+ { MNT_DEFEXPORTED, 1, "exported to the world" }, \
+ { MNT_EXPORTANON, 1, "anon uid mapping" }, \
+ { MNT_EXKERB, 1, "kerberos uid mapping" }, \
+ { MNT_EXNORESPORT, 0, "non-reserved ports" }, \
+ { MNT_EXPUBLIC, 0, "WebNFS exports" },
+
+/*
+ * Flags set by internal operations.
+ */
+#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
+#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
+#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
+
+#define __MNT_INTERNAL_FLAGS \
+ { MNT_LOCAL, 0, "local" }, \
+ { MNT_QUOTA, 0, "with quotas" }, \
+ { MNT_ROOTFS, 1, "root file system" },
+
+/*
+ * Mask of flags that are visible to statvfs()
+ */
+#define MNT_VISFLAGMASK ( \
+ MNT_RDONLY | \
+ MNT_SYNCHRONOUS | \
+ MNT_NOEXEC | \
+ MNT_NOSUID | \
+ MNT_NODEV | \
+ MNT_UNION | \
+ MNT_ASYNC | \
+ MNT_NOCOREDUMP | \
+ MNT_IGNORE | \
+ MNT_NOATIME | \
+ MNT_SYMPERM | \
+ MNT_NODEVMTIME | \
+ MNT_SOFTDEP | \
+ MNT_EXRDONLY | \
+ MNT_EXPORTED | \
+ MNT_DEFEXPORTED | \
+ MNT_EXPORTANON | \
+ MNT_EXKERB | \
+ MNT_EXNORESPORT | \
+ MNT_EXPUBLIC | \
+ MNT_LOCAL | \
+ MNT_QUOTA | \
+ MNT_ROOTFS | \
+ MNT_LOG | \
+ MNT_EXTATTR)
+
+/*
+ * External filesystem control flags.
+ */
+#define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
+#define MNT_RELOAD 0x00040000 /* reload filesystem data */
+#define MNT_FORCE 0x00080000 /* force unmount or readonly change */
+#define MNT_GETARGS 0x00400000 /* retrieve file system specific args */
+
+#define MNT_OP_FLAGS (MNT_UPDATE|MNT_RELOAD|MNT_FORCE|MNT_GETARGS)
+
+#define __MNT_EXTERNAL_FLAGS \
+ { MNT_UPDATE, 1, "being updated" }, \
+ { MNT_RELOAD, 1, "reload filesystem data" }, \
+ { MNT_FORCE, 1, "force unmount or readonly change" }, \
+ { MNT_GETARGS, 1, "retrieve mount arguments" },
+
+/*
+ * Internal filesystem control flags.
+ * These are set in struct mount mnt_iflag.
+ *
+ * IMNT_UNMOUNT locks the mount entry so that name lookup cannot proceed
+ * past the mount point. This keeps the subtree stable during mounts
+ * and unmounts.
+ */
+#define IMNT_GONE 0x00000001 /* filesystem is gone.. */
+#define IMNT_UNMOUNT 0x00000002 /* unmount in progress */
+#define IMNT_WANTRDWR 0x00000004 /* upgrade to read/write requested */
+#define IMNT_DTYPE 0x00000040 /* returns d_type fields */
+#define IMNT_HAS_TRANS 0x00000080 /* supports transactions */
+#define IMNT_MPSAFE 0x00000100 /* file system code MP safe */
+#define IMNT_CAN_RWTORO 0x00000200 /* can downgrade fs to from rw to r/o */
+
+#define __MNT_FLAGS \
+ __MNT_BASIC_FLAGS \
+ __MNT_EXPORTED_FLAGS \
+ __MNT_INTERNAL_FLAGS \
+ __MNT_EXTERNAL_FLAGS
+
+#define __MNT_FLAG_BITS \
+ "\20" \
+ "\40MNT_SOFTDEP" \
+ "\37MNT_NODEVMTIME" \
+ "\36MNT_SYMPERM" \
+ "\35MNT_EXPUBLIC" \
+ "\34MNT_EXNORESPORT" \
+ "\33MNT_NOATIME" \
+ "\32MNT_LOG" \
+ "\31MNT_EXTATTR" \
+ "\30MNT_UNUSED" \
+ "\27MNT_GETARGS" \
+ "\26MNT_UNUSED" \
+ "\25MNT_IGNORE" \
+ "\24MNT_FORCE" \
+ "\23MNT_RELOAD" \
+ "\22MNT_RELATIME" \
+ "\21MNT_UPDATE" \
+ "\20MNT_NOCOREDUMP" \
+ "\17MNT_ROOTFS" \
+ "\16MNT_QUOTA" \
+ "\15MNT_LOCAL" \
+ "\14MNT_EXKERB" \
+ "\13MNT_EXPORTANON" \
+ "\12MNT_DEFEXPORTED" \
+ "\11MNT_EXPORTED" \
+ "\10MNT_EXRDONLY" \
+ "\07MNT_ASYNC" \
+ "\06MNT_UNION" \
+ "\05MNT_NODEV" \
+ "\04MNT_NOSUID" \
+ "\03MNT_NOEXEC" \
+ "\02MNT_SYNCHRONOUS" \
+ "\01MNT_RDONLY"
+
+#define __IMNT_FLAG_BITS \
+ "\20" \
+ "\12IMNT_CAN_RWTORO" \
+ "\11IMNT_MPSAFE" \
+ "\10IMNT_HAS_TRANS" \
+ "\07IMNT_DTYPE" \
+ "\03IMNT_WANTRDWR" \
+ "\02IMNT_UNMOUNT" \
+ "\01IMNT_GONE"
+
+/*
+ * Flags for various system call interfaces.
+ *
+ * waitfor flags to vfs_sync() and getvfsstat()
+ */
+#define MNT_WAIT 1 /* synchronously wait for I/O to complete */
+#define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */
+#define MNT_LAZY 3 /* push data not written by filesystem syncer */
+#endif /* _SYS_FSTYPES_H_ */
-/* $NetBSD: gmon.h,v 1.9 2006/10/04 14:22:58 christos Exp $ */
+/* $NetBSD: gmon.h,v 1.10 2012/03/09 15:38:03 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1992, 1993
*/
#define ARCDENSITY 2
#define MINARCS 50
-#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
+#define MAXARCS ((1 << (unsigned int)(8 * sizeof(HISTCOUNTER))) - 2)
struct tostruct {
u_long selfpc;
-/* $NetBSD: hash.h,v 1.6 2008/04/28 20:24:10 martin Exp $ */
+/* $NetBSD: hash.h,v 1.7 2012/07/08 01:24:08 rmind Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
#define _SYS_HASH_H_
#include <sys/types.h>
+
#ifdef __HAVE_MACHINE_HASH_H
#include <machine/hash.h>
#endif
-
#ifndef __HAVE_HASH32_BUF /* not overridden by MD hash */
#define HASH32_BUF_INIT 5381
}
#endif /* __HAVE_HASH32_STR */
+__BEGIN_DECLS
+uint32_t murmurhash2(const void *, size_t, uint32_t);
+__END_DECLS
#endif /* !_SYS_HASH_H_ */
-/* $NetBSD: ieee754.h,v 1.7 2007/02/02 23:08:22 christos Exp $ */
+/* $NetBSD: ieee754.h,v 1.8 2012/08/08 16:56:53 matt Exp $ */
/*
* Copyright (c) 1992, 1993
struct ieee_single sngu_sng;
};
+#define sngu_sign sngu_sng.sng_sign
+#define sngu_exp sngu_sng.sng_exp
+#define sngu_frac sngu_sng.sng_frac
+
union ieee_double_u {
double dblu_d;
struct ieee_double dblu_dbl;
};
+
+#define dblu_sign dblu_dbl.dbl_sign
+#define dblu_exp dblu_dbl.dbl_exp
+#define dblu_frach dblu_dbl.dbl_frach
+#define dblu_fracl dblu_dbl.dbl_fracl
#endif /* _SYS_IEEE754_H_ */
--- /dev/null
+/* $NetBSD: ipc.h,v 1.33 2012/03/13 18:41:02 elad Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ *
+ * @(#)ipc.h 8.4 (Berkeley) 2/19/95
+ */
+
+/*
+ * SVID compatible ipc.h file
+ */
+
+#ifndef _SYS_IPC_H_
+#define _SYS_IPC_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+/* Data structure used to pass permission information to IPC operations. */
+struct ipc_perm {
+ key_t key; /* Key. */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ uid_t cuid; /* creator user id */
+ gid_t cgid; /* creator group id */
+ unsigned short int mode; /* Reader/write permission. */
+ unsigned short int __seq; /* Sequence number. */
+};
+
+/* X/Open required constants (same values as system 5) */
+#define IPC_CREAT 001000 /* create entry if key does not exist */
+#define IPC_EXCL 002000 /* fail if key exists */
+#define IPC_NOWAIT 004000 /* error if request must wait */
+
+#define IPC_PRIVATE (key_t)0 /* private key */
+
+#define IPC_RMID 0 /* remove identifier */
+#define IPC_SET 1 /* set options */
+#define IPC_STAT 2 /* get options */
+
+#ifdef __minix
+#define IPC_INFO 3 /* See ipcs. */
+#endif /* !__minix */
+
+/*
+ * Macros to convert between ipc ids and array indices or sequence ids.
+ * The first of these is used by ipcs(1), and so is defined outside the
+ * kernel as well.
+ */
+#if defined(_NETBSD_SOURCE)
+#define IXSEQ_TO_IPCID(ix,perm) (((perm._seq) << 16) | (ix & 0xffff))
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+key_t ftok(const char *, int);
+__END_DECLS
+
+#endif /* !_SYS_IPC_H_ */
--- /dev/null
+/* $NetBSD: lwp.h,v 1.165 2012/10/07 20:43:18 matt Exp $ */
+
+/*-
+ * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
+ * The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nathan J. Williams 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 _SYS_LWP_H_
+#define _SYS_LWP_H_
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/queue.h>
+#include <sys/callout.h>
+#include <sys/kcpuset.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/signalvar.h>
+#include <sys/sched.h>
+#include <sys/specificdata.h>
+#include <sys/syncobj.h>
+#include <sys/resource.h>
+
+#if defined(_KERNEL)
+#include <machine/cpu.h> /* curcpu() and cpu_info */
+#endif
+
+#include <machine/proc.h> /* Machine-dependent proc substruct. */
+
+/*
+ * Lightweight process. Field markings and the corresponding locks:
+ *
+ * a: proc_lock
+ * c: condition variable interlock, passed to cv_wait()
+ * l: *l_mutex
+ * p: l_proc->p_lock
+ * s: spc_mutex, which may or may not be referenced by l_mutex
+ * S: l_selcluster->sc_lock
+ * (: unlocked, stable
+ * !: unlocked, may only be reliably accessed by the LWP itself
+ *
+ * Fields are clustered together by usage (to increase the likelyhood
+ * of cache hits) and by size (to reduce dead space in the structure).
+ */
+#if defined(_KERNEL) || defined(_KMEMUSER)
+
+#include <sys/pcu.h>
+
+struct lockdebug;
+struct sysent;
+
+struct lwp {
+ /* Scheduling and overall state. */
+ TAILQ_ENTRY(lwp) l_runq; /* s: run queue */
+ union {
+ void * info; /* s: scheduler-specific structure */
+ u_int timeslice; /* l: time-quantum for SCHED_M2 */
+ } l_sched;
+ struct cpu_info *volatile l_cpu;/* s: CPU we're on if LSONPROC */
+ kmutex_t * volatile l_mutex; /* l: ptr to mutex on sched state */
+ int l_ctxswtch; /* l: performing a context switch */
+ void *l_addr; /* l: PCB address; use lwp_getpcb() */
+ struct mdlwp l_md; /* l: machine-dependent fields. */
+ int l_flag; /* l: misc flag values */
+ int l_stat; /* l: overall LWP status */
+ struct bintime l_rtime; /* l: real time */
+ struct bintime l_stime; /* l: start time (while ONPROC) */
+ u_int l_swtime; /* l: time swapped in or out */
+ u_int l_rticks; /* l: Saved start time of run */
+ u_int l_rticksum; /* l: Sum of ticks spent running */
+ u_int l_slpticks; /* l: Saved start time of sleep */
+ u_int l_slpticksum; /* l: Sum of ticks spent sleeping */
+ int l_biglocks; /* l: biglock count before sleep */
+ int l_class; /* l: scheduling class */
+ int l_kpriority; /* !: has kernel priority boost */
+ pri_t l_kpribase; /* !: kernel priority base level */
+ pri_t l_priority; /* l: scheduler priority */
+ pri_t l_inheritedprio;/* l: inherited priority */
+ SLIST_HEAD(, turnstile) l_pi_lenders; /* l: ts lending us priority */
+ uint64_t l_ncsw; /* l: total context switches */
+ uint64_t l_nivcsw; /* l: involuntary context switches */
+ u_int l_cpticks; /* (: Ticks of CPU time */
+ fixpt_t l_pctcpu; /* p: %cpu during l_swtime */
+ fixpt_t l_estcpu; /* l: cpu time for SCHED_4BSD */
+ psetid_t l_psid; /* l: assigned processor-set ID */
+ struct cpu_info *l_target_cpu; /* l: target CPU to migrate */
+ struct lwpctl *l_lwpctl; /* p: lwpctl block kernel address */
+ struct lcpage *l_lcpage; /* p: lwpctl containing page */
+ kcpuset_t *l_affinity; /* l: CPU set for affinity */
+
+ /* Synchronisation. */
+ struct turnstile *l_ts; /* l: current turnstile */
+ struct syncobj *l_syncobj; /* l: sync object operations set */
+ TAILQ_ENTRY(lwp) l_sleepchain; /* l: sleep queue */
+ wchan_t l_wchan; /* l: sleep address */
+ const char *l_wmesg; /* l: reason for sleep */
+ struct sleepq *l_sleepq; /* l: current sleep queue */
+ int l_sleeperr; /* !: error before unblock */
+ u_int l_slptime; /* l: time since last blocked */
+ callout_t l_timeout_ch; /* !: callout for tsleep */
+ u_int l_emap_gen; /* !: emap generation number */
+ kcondvar_t l_waitcv; /* a: vfork() wait */
+
+#if PCU_UNIT_COUNT > 0
+ struct cpu_info * volatile l_pcu_cpu[PCU_UNIT_COUNT];
+ uint32_t l_pcu_used;
+#endif
+
+ /* Process level and global state, misc. */
+ LIST_ENTRY(lwp) l_list; /* a: entry on list of all LWPs */
+ void *l_ctxlink; /* p: uc_link {get,set}context */
+ struct proc *l_proc; /* p: parent process */
+ LIST_ENTRY(lwp) l_sibling; /* p: entry on proc's list of LWPs */
+ lwpid_t l_waiter; /* p: first LWP waiting on us */
+ lwpid_t l_waitingfor; /* p: specific LWP we are waiting on */
+ int l_prflag; /* p: process level flags */
+ u_int l_refcnt; /* p: reference count on this LWP */
+ lwpid_t l_lid; /* (: LWP identifier; local to proc */
+ char *l_name; /* (: name, optional */
+
+ /* State of select() or poll(). */
+ int l_selflag; /* S: polling state flags */
+ SLIST_HEAD(,selinfo) l_selwait; /* S: descriptors waited on */
+ int l_selret; /* S: return value of select/poll */
+ uintptr_t l_selrec; /* !: argument for selrecord() */
+ struct selcluster *l_selcluster;/* !: associated cluster data */
+ void * l_selbits; /* (: select() bit-field */
+ size_t l_selni; /* (: size of a single bit-field */
+
+ /* Signals. */
+ int l_sigrestore; /* p: need to restore old sig mask */
+ sigset_t l_sigwaitset; /* p: signals being waited for */
+ kcondvar_t l_sigcv; /* p: for sigsuspend() */
+ struct ksiginfo *l_sigwaited; /* p: delivered signals from set */
+ sigpend_t *l_sigpendset; /* p: XXX issignal()/postsig() baton */
+ LIST_ENTRY(lwp) l_sigwaiter; /* p: chain on list of waiting LWPs */
+ stack_t l_sigstk; /* p: sp & on stack state variable */
+ sigset_t l_sigmask; /* p: signal mask */
+ sigpend_t l_sigpend; /* p: signals to this LWP */
+ sigset_t l_sigoldmask; /* p: mask for sigpause */
+
+ /* Private data. */
+ specificdata_reference
+ l_specdataref; /* !: subsystem lwp-specific data */
+ struct timespec l_ktrcsw; /* !: for ktrace CSW trace XXX */
+ void *l_private; /* !: svr4-style lwp-private data */
+ struct lwp *l_switchto; /* !: mi_switch: switch to this LWP */
+ struct kauth_cred *l_cred; /* !: cached credentials */
+ struct filedesc *l_fd; /* !: cached copy of proc::p_fd */
+ void *l_emuldata; /* !: kernel lwp-private data */
+ u_int l_cv_signalled; /* c: restarted by cv_signal() */
+ u_short l_shlocks; /* !: lockdebug: shared locks held */
+ u_short l_exlocks; /* !: lockdebug: excl. locks held */
+ u_short l_unused; /* !: unused */
+ u_short l_blcnt; /* !: count of kernel_lock held */
+ int l_nopreempt; /* !: don't preempt me! */
+ u_int l_dopreempt; /* s: kernel preemption pending */
+ int l_pflag; /* !: LWP private flags */
+ int l_dupfd; /* !: side return from cloning devs XXX */
+ const struct sysent * volatile l_sysent;/* !: currently active syscall */
+ struct rusage l_ru; /* !: accounting information */
+ uint64_t l_pfailtime; /* !: for kernel preemption */
+ uintptr_t l_pfailaddr; /* !: for kernel preemption */
+ uintptr_t l_pfaillock; /* !: for kernel preemption */
+ _TAILQ_HEAD(,struct lockdebug,volatile) l_ld_locks;/* !: locks held by LWP */
+ int l_tcgen; /* !: for timecounter removal */
+
+ /* These are only used by 'options SYSCALL_TIMES'. */
+ uint32_t l_syscall_time; /* !: time epoch for current syscall */
+ uint64_t *l_syscall_counter; /* !: counter for current process */
+
+ struct kdtrace_thread *l_dtrace; /* (: DTrace-specific data. */
+};
+#endif /* _KERNEL || _KMEMUSER */
+
+/*
+ * UAREA_PCB_OFFSET: an offset of PCB structure in the uarea. MD code may
+ * define it in <machine/proc.h>, to indicate a different uarea layout.
+ */
+#ifndef UAREA_PCB_OFFSET
+#define UAREA_PCB_OFFSET 0
+#endif
+
+LIST_HEAD(lwplist, lwp); /* A list of LWPs. */
+
+#ifdef _KERNEL
+extern struct lwplist alllwp; /* List of all LWPs. */
+extern lwp_t lwp0; /* LWP for proc0. */
+extern int maxlwp __read_mostly; /* max number of lwps */
+#ifndef MAXLWP
+#define MAXLWP 2048
+#endif
+#ifndef __HAVE_CPU_MAXLWP
+#define cpu_maxlwp() MAXLWP
+#endif
+#endif
+
+/* These flags are kept in l_flag. */
+#define LW_IDLE 0x00000001 /* Idle lwp. */
+#define LW_LWPCTL 0x00000002 /* Adjust lwpctl in userret */
+#define LW_SINTR 0x00000080 /* Sleep is interruptible. */
+#define LW_SYSTEM 0x00000200 /* Kernel thread */
+#define LW_WSUSPEND 0x00020000 /* Suspend before return to user */
+#define LW_BATCH 0x00040000 /* LWP tends to hog CPU */
+#define LW_WCORE 0x00080000 /* Stop for core dump on return to user */
+#define LW_WEXIT 0x00100000 /* Exit before return to user */
+#define LW_PENDSIG 0x01000000 /* Pending signal for us */
+#define LW_CANCELLED 0x02000000 /* tsleep should not sleep */
+#define LW_WREBOOT 0x08000000 /* System is rebooting, please suspend */
+#define LW_UNPARKED 0x10000000 /* Unpark op pending */
+#define LW_RUMP_CLEAR 0x40000000 /* Clear curlwp in RUMP scheduler */
+#define LW_RUMP_QEXIT 0x80000000 /* LWP should exit ASAP */
+
+/* The second set of flags is kept in l_pflag. */
+#define LP_KTRACTIVE 0x00000001 /* Executing ktrace operation */
+#define LP_KTRCSW 0x00000002 /* ktrace context switch marker */
+#define LP_KTRCSWUSER 0x00000004 /* ktrace context switch marker */
+#define LP_PIDLID 0x00000008 /* free LID from PID space on exit */
+#define LP_OWEUPC 0x00000010 /* Owe user profiling tick */
+#define LP_MPSAFE 0x00000020 /* Starts life without kernel_lock */
+#define LP_INTR 0x00000040 /* Soft interrupt handler */
+#define LP_SYSCTLWRITE 0x00000080 /* sysctl write lock held */
+#define LP_MUSTJOIN 0x00000100 /* Must join kthread on exit */
+#define LP_VFORKWAIT 0x00000200 /* Waiting at vfork() for a child */
+#define LP_TIMEINTR 0x00010000 /* Time this soft interrupt */
+#define LP_RUNNING 0x20000000 /* Active on a CPU */
+#define LP_BOUND 0x80000000 /* Bound to a CPU */
+
+/* The third set is kept in l_prflag. */
+#define LPR_DETACHED 0x00800000 /* Won't be waited for. */
+#define LPR_CRMOD 0x00000100 /* Credentials modified */
+
+/*
+ * Mask indicating that there is "exceptional" work to be done on return to
+ * user.
+ */
+#define LW_USERRET \
+ (LW_WEXIT | LW_PENDSIG | LW_WREBOOT | LW_WSUSPEND | LW_WCORE | LW_LWPCTL)
+
+/*
+ * Status values.
+ *
+ * A note about LSRUN and LSONPROC: LSRUN indicates that a process is
+ * runnable but *not* yet running, i.e. is on a run queue. LSONPROC
+ * indicates that the process is actually executing on a CPU, i.e.
+ * it is no longer on a run queue.
+ */
+#define LSIDL 1 /* Process being created by fork. */
+#define LSRUN 2 /* Currently runnable. */
+#define LSSLEEP 3 /* Sleeping on an address. */
+#define LSSTOP 4 /* Process debugging or suspension. */
+#define LSZOMB 5 /* Awaiting collection by parent. */
+/* unused, for source compatibility with NetBSD 4.0 and earlier. */
+#define LSDEAD 6 /* Process is almost a zombie. */
+#define LSONPROC 7 /* Process is currently on a CPU. */
+#define LSSUSPENDED 8 /* Not running, not signalable. */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+static inline void *
+lwp_getpcb(struct lwp *l)
+{
+
+ return l->l_addr;
+}
+#endif /* _KERNEL || _KMEMUSER */
+
+#ifdef _KERNEL
+#define LWP_CACHE_CREDS(l, p) \
+do { \
+ (void)p; \
+ if (__predict_false((l)->l_prflag & LPR_CRMOD)) \
+ lwp_update_creds(l); \
+} while (/* CONSTCOND */ 0)
+
+void lwpinit(void);
+void lwp0_init(void);
+void lwp_sys_init(void);
+
+void lwp_startup(lwp_t *, lwp_t *);
+void startlwp(void *);
+
+int lwp_locked(lwp_t *, kmutex_t *);
+void lwp_setlock(lwp_t *, kmutex_t *);
+void lwp_unlock_to(lwp_t *, kmutex_t *);
+int lwp_trylock(lwp_t *);
+void lwp_addref(lwp_t *);
+void lwp_delref(lwp_t *);
+void lwp_delref2(lwp_t *);
+void lwp_drainrefs(lwp_t *);
+bool lwp_alive(lwp_t *);
+lwp_t *lwp_find_first(proc_t *);
+
+int lwp_wait(lwp_t *, lwpid_t, lwpid_t *, bool);
+void lwp_continue(lwp_t *);
+void lwp_unsleep(lwp_t *, bool);
+void lwp_unstop(lwp_t *);
+void lwp_exit(lwp_t *);
+void lwp_exit_switchaway(lwp_t *) __dead;
+int lwp_suspend(lwp_t *, lwp_t *);
+int lwp_create1(lwp_t *, const void *, size_t, u_long, lwpid_t *);
+void lwp_update_creds(lwp_t *);
+void lwp_migrate(lwp_t *, struct cpu_info *);
+lwp_t * lwp_find2(pid_t, lwpid_t);
+lwp_t * lwp_find(proc_t *, int);
+void lwp_userret(lwp_t *);
+void lwp_need_userret(lwp_t *);
+void lwp_free(lwp_t *, bool, bool);
+uint64_t lwp_pctr(void);
+int lwp_setprivate(lwp_t *, void *);
+int do_lwp_create(lwp_t *, void *, u_long, lwpid_t *);
+
+void lwpinit_specificdata(void);
+int lwp_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
+void lwp_specific_key_delete(specificdata_key_t);
+void lwp_initspecific(lwp_t *);
+void lwp_finispecific(lwp_t *);
+void *lwp_getspecific(specificdata_key_t);
+#if defined(_LWP_API_PRIVATE)
+void *_lwp_getspecific_by_lwp(lwp_t *, specificdata_key_t);
+#endif
+void lwp_setspecific(specificdata_key_t, void *);
+
+/* Syscalls. */
+int lwp_park(struct timespec *, const void *);
+int lwp_unpark(lwpid_t, const void *);
+
+/* DDB. */
+void lwp_whatis(uintptr_t, void (*)(const char *, ...) __printflike(1, 2));
+
+/*
+ * Lock an LWP. XXX _MODULE
+ */
+static inline void
+lwp_lock(lwp_t *l)
+{
+ kmutex_t *old = l->l_mutex;
+
+ /*
+ * Note: mutex_spin_enter() will have posted a read barrier.
+ * Re-test l->l_mutex. If it has changed, we need to try again.
+ */
+ mutex_spin_enter(old);
+ while (__predict_false(l->l_mutex != old)) {
+ mutex_spin_exit(old);
+ old = l->l_mutex;
+ mutex_spin_enter(old);
+ }
+}
+
+/*
+ * Unlock an LWP. XXX _MODULE
+ */
+static inline void
+lwp_unlock(lwp_t *l)
+{
+ mutex_spin_exit(l->l_mutex);
+}
+
+static inline void
+lwp_changepri(lwp_t *l, pri_t pri)
+{
+ KASSERT(mutex_owned(l->l_mutex));
+
+ if (l->l_priority == pri)
+ return;
+
+ (*l->l_syncobj->sobj_changepri)(l, pri);
+ KASSERT(l->l_priority == pri);
+}
+
+static inline void
+lwp_lendpri(lwp_t *l, pri_t pri)
+{
+ KASSERT(mutex_owned(l->l_mutex));
+
+ if (l->l_inheritedprio == pri)
+ return;
+
+ (*l->l_syncobj->sobj_lendpri)(l, pri);
+ KASSERT(l->l_inheritedprio == pri);
+}
+
+static inline pri_t
+lwp_eprio(lwp_t *l)
+{
+ pri_t pri;
+
+ pri = l->l_priority;
+ if ((l->l_flag & LW_SYSTEM) == 0 && l->l_kpriority && pri < PRI_KERNEL)
+ pri = (pri >> 1) + l->l_kpribase;
+ return MAX(l->l_inheritedprio, pri);
+}
+
+int lwp_create(lwp_t *, struct proc *, vaddr_t, int,
+ void *, size_t, void (*)(void *), void *, lwp_t **, int);
+
+/*
+ * XXX _MODULE
+ * We should provide real stubs for the below that modules can use.
+ */
+
+static inline void
+spc_lock(struct cpu_info *ci)
+{
+ mutex_spin_enter(ci->ci_schedstate.spc_mutex);
+}
+
+static inline void
+spc_unlock(struct cpu_info *ci)
+{
+ mutex_spin_exit(ci->ci_schedstate.spc_mutex);
+}
+
+static inline void
+spc_dlock(struct cpu_info *ci1, struct cpu_info *ci2)
+{
+ struct schedstate_percpu *spc1 = &ci1->ci_schedstate;
+ struct schedstate_percpu *spc2 = &ci2->ci_schedstate;
+
+ KASSERT(ci1 != ci2);
+ if (ci1 < ci2) {
+ mutex_spin_enter(spc1->spc_mutex);
+ mutex_spin_enter(spc2->spc_mutex);
+ } else {
+ mutex_spin_enter(spc2->spc_mutex);
+ mutex_spin_enter(spc1->spc_mutex);
+ }
+}
+
+/*
+ * Allow machine-dependent code to override curlwp in <machine/cpu.h> for
+ * its own convenience. Otherwise, we declare it as appropriate.
+ */
+#if !defined(curlwp)
+#if defined(MULTIPROCESSOR)
+#define curlwp curcpu()->ci_curlwp /* Current running LWP */
+#else
+extern struct lwp *curlwp; /* Current running LWP */
+#endif /* MULTIPROCESSOR */
+#endif /* ! curlwp */
+#define curproc (curlwp->l_proc)
+
+static inline bool
+CURCPU_IDLE_P(void)
+{
+ struct cpu_info *ci = curcpu();
+ return ci->ci_data.cpu_onproc == ci->ci_data.cpu_idlelwp;
+}
+
+/*
+ * Disable and re-enable preemption. Only for low-level kernel
+ * use. Device drivers and anything that could potentially be
+ * compiled as a module should use kpreempt_disable() and
+ * kpreempt_enable().
+ */
+static inline void
+KPREEMPT_DISABLE(lwp_t *l)
+{
+
+ KASSERT(l == curlwp);
+ l->l_nopreempt++;
+ __insn_barrier();
+}
+
+static inline void
+KPREEMPT_ENABLE(lwp_t *l)
+{
+
+ KASSERT(l == curlwp);
+ KASSERT(l->l_nopreempt > 0);
+ __insn_barrier();
+ if (--l->l_nopreempt != 0)
+ return;
+ __insn_barrier();
+ if (__predict_false(l->l_dopreempt))
+ kpreempt(0);
+ __insn_barrier();
+}
+
+/* For lwp::l_dopreempt */
+#define DOPREEMPT_ACTIVE 0x01
+#define DOPREEMPT_COUNTED 0x02
+
+#endif /* _KERNEL */
+
+/* Flags for _lwp_create(), as per Solaris. */
+#define LWP_DETACHED 0x00000040
+#define LWP_SUSPENDED 0x00000080
+
+/* Kernel-internal flags for LWP creation. */
+#define LWP_PIDLID 0x40000000
+#define LWP_VFORK 0x80000000
+
+#endif /* !_SYS_LWP_H_ */
+/* $NetBSD: mman.h,v 1.44 2012/01/05 15:19:52 reinoud Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)mman.h 8.2 (Berkeley) 1/9/95
+ */
+
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_
/*
* Protections are chosen from these bits, or-ed together
*/
-#define PROT_NONE 0x00 /* no permissions */
-#define PROT_READ 0x01 /* pages can be read */
-#define PROT_WRITE 0x02 /* pages can be written */
-#define PROT_EXEC 0x04 /* pages can be executed */
+#define PROT_NONE 0x00 /* no permissions */
+#define PROT_READ 0x01 /* pages can be read */
+#define PROT_WRITE 0x02 /* pages can be written */
+#define PROT_EXEC 0x04 /* pages can be executed */
/*
* Flags contain sharing type and options.
-/* $NetBSD: mount.h,v 1.201 2011/10/12 23:04:22 dholland Exp $ */
+/* $NetBSD: mount.h,v 1.207 2012/02/01 05:34:42 dholland Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
#endif /* _KERNEL */
#endif /* !_STANDALONE */
+#include <sys/statvfs.h>
+#include <minix/mount.h>
#endif /* !_SYS_MOUNT_H_ */
+/* $NetBSD: param.h,v 1.421 2012/10/13 17:54:40 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.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)param.h 8.3 (Berkeley) 4/4/95
+ */
+
#ifndef _SYS_PARAM_H_
#define _SYS_PARAM_H_
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 599002900 /* NetBSD 5.99.29 */
+#define __NetBSD_Version__ 699001300 /* NetBSD 6.99.13 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
#define NetBSD 199905 /* NetBSD version (year & month). */
+/*
+ * There macros determine if we are running in protected mode or not.
+ * _HARDKERNEL: code uses kernel namespace and runs in hw priviledged mode
+ * _SOFTKERNEL: code uses kernel namespace but runs without hw priviledges
+ */
+#if defined(_KERNEL) && !defined(_RUMPKERNEL)
+#define _HARDKERNEL
+#endif
+#if defined(_KERNEL) && defined(_RUMPKERNEL)
+#define _SOFTKERNEL
+#endif
+
#include <sys/null.h>
#ifndef __ASSEMBLER__
*/
#include <sys/syslimits.h>
-
#define MAXCOMLEN 16 /* max command name remembered */
#define MAXINTERP PATH_MAX /* max interpreter file name length */
/* DEPRECATED: use LOGIN_NAME_MAX instead. */
#endif
#define NGROUPS NGROUPS_MAX /* max number groups */
#define NOGROUP 65535 /* marker for empty group set member */
-
#define MAXHOSTNAMELEN 256 /* max hostname size */
#ifndef NOFILE
#define MAXPATHLEN PATH_MAX
#define MAXSYMLINKS 32
+/*
+ * This is the maximum individual filename component length enforced by
+ * namei. Filesystems cannot exceed this limit. The upper bound for that
+ * limit is NAME_MAX. We don't bump it for now, for compatibility with
+ * old binaries during the time where MAXPATHLEN was 511 and NAME_MAX was
+ * 255
+ */
+#define KERNEL_NAME_MAX 255
+
/* Bit map related macros. */
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
-/* $NetBSD: poll.h,v 1.3 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: poll.h,v 1.15 2009/11/11 09:48:51 rmind Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
#define POLLNVAL 0x0020
__BEGIN_DECLS
-int poll (struct pollfd *, nfds_t, int);
+int poll(struct pollfd *, nfds_t, int);
__END_DECLS
#endif /* !_NBCOMPAT_POLL_H_ */
-/* $NetBSD: rbtree.h,v 1.1 2010/09/25 01:42:40 matt Exp $ */
+/* $NetBSD: rbtree.h,v 1.2 2012/02/17 08:20:55 yamt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* return 0 if they are considered same.
*/
-typedef signed int (*const rbto_compare_nodes_fn)(void *,
- const void *, const void *);
-typedef signed int (*const rbto_compare_key_fn)(void *,
- const void *, const void *);
+typedef signed int (*rbto_compare_nodes_fn)(void *, const void *, const void *);
+typedef signed int (*rbto_compare_key_fn)(void *, const void *, const void *);
typedef struct {
rbto_compare_nodes_fn rbto_compare_nodes;
#ifndef _SYS_REBOOT_H_
#define _SYS_REBOOT_H_
+/* LSC FIXME: what about those flags */
+/* How to exit the system or stop a server process. */
+#define RBT_HALT 0 /* shutdown and return to monitor */
+#define RBT_REBOOT 1 /* reboot the system through the monitor */
+#define RBT_PANIC 2 /* a server panics */
+#define RBT_MONITOR 3 /* let the monitor do this */
+#define RBT_RESET 4 /* hard reset the system */
+#define RBT_DEFAULT 5 /* return to monitor, reset if not possible */
+#define RBT_INVALID 6 /* first invalid reboot flag */
/*
* Arguments to reboot system call. These are passed to the boot program,
* and then on to init.
--- /dev/null
+/* $NetBSD: resource.h,v 1.33 2012/06/09 02:31:15 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)resource.h 8.4 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_RESOURCE_H_
+#define _SYS_RESOURCE_H_
+
+#include <sys/featuretest.h>
+#include <sys/time.h>
+
+/*
+ * Process priority specifications to get/setpriority.
+ */
+#define PRIO_MIN -20
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP 1
+#define PRIO_USER 2
+
+/*
+ * Resource limits
+ */
+#define RLIMIT_CORE 1
+#define RLIMIT_CPU 2
+#define RLIMIT_DATA 3
+#define RLIMIT_FSIZE 4
+#define RLIMIT_NOFILE 5
+#define RLIMIT_STACK 6
+#define RLIMIT_AS 7
+#define RLIMIT_VMEM RLIMIT_AS /* common alias */
+
+#if defined(_NETBSD_SOURCE)
+#define RLIM_NLIMITS 8 /* number of resource limits */
+#endif
+
+#define RLIM_INFINITY ((rlim_t) -1)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+struct rlimit
+{
+ rlim_t rlim_cur;
+ rlim_t rlim_max;
+};
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int getpriority(int, int);
+int getrlimit(int, struct rlimit *);
+int setpriority(int, int, int);
+__END_DECLS
+
+#endif /* !_SYS_RESOURCE_H_ */
-/* $NetBSD: siginfo.h,v 1.19 2009/03/27 11:05:43 drochner Exp $ */
+/* $NetBSD: siginfo.h,v 1.22 2011/04/10 14:37:20 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
#ifndef _SYS_SIGINFO_H_
#define _SYS_SIGINFO_H_
-#include <machine/signal.h> /* XXX: __HAVE_SIGINFO */
+#include <machine/signal.h>
#ifdef _KERNEL
#include <sys/queue.h>
#endif
/* SIGFPE */
#define FPE_INTOVF 1 /* integer divide by zero */
#define FPE_INTDIV 2 /* integer overflow */
-#define FPE_FLTDIV 3 /* floating-point divide by zero */
-#define FPE_FLTOVF 4 /* floating-point overflow */
-#define FPE_FLTUND 5 /* floating-point underflow */
-#define FPE_FLTRES 6 /* floating-point inexact result */
-#define FPE_FLTINV 7 /* floating-point invalid operation */
-#define FPE_FLTSUB 8 /* subscript out of range */
+#define FPE_FLTDIV 3 /* Floating point divide by zero */
+#define FPE_FLTOVF 4 /* Floating point overflow */
+#define FPE_FLTUND 5 /* Floating point underflow */
+#define FPE_FLTRES 6 /* Floating point inexact result */
+#define FPE_FLTINV 7 /* Invalid Floating point operation */
+#define FPE_FLTSUB 8 /* Subscript out of range */
/* SIGSEGV */
#define SEGV_MAPERR 1 /* Address not mapped to object */
+/* $NetBSD: signal.h,v 1.67 2011/01/10 13:56:44 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 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.
+ *
+ * @(#)signal.h 8.4 (Berkeley) 5/4/95
+ */
+
#ifndef _SYS_SIGNAL_H_
#define _SYS_SIGNAL_H_
#endif
+#ifndef _KERNEL
#include <sys/cdefs.h>
+#endif
typedef void (*__sighandler_t)(int);
void (*signal(int, void (*)(int)))(int);
__END_DECLS
#endif /* !_SYS_SIGNAL_H_ */
-
-
-
-
+/* $NetBSD: sigtypes.h,v 1.10 2012/02/19 21:07:00 rmind Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 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.
+ *
+ * @(#)signal.h 8.4 (Berkeley) 5/4/95
+ */
+
#ifndef _SYS_SIGTYPES_H_
#define _SYS_SIGTYPES_H_
#endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */
+
#endif /* !_SYS_SIGTYPES_H_ */
#endif
#include <sys/uio.h>
+#include <sys/sigtypes.h>
/*
* Socket types.
#define SOCK_RDM 4 /* reliably-delivered message */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
+#define SOCK_CLOEXEC 0x10000000 /* set close on exec on socket */
+#define SOCK_NONBLOCK 0x20000000 /* set non blocking i/o socket */
+#define SOCK_NOSIGPIPE 0x40000000 /* don't send sigpipe */
+#define SOCK_FLAGS_MASK 0xf0000000 /* flags mask */
+
/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
+#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_TYPE 0x0010 /* get socket type */
#define SO_PASSCRED 0x0012
#define SO_PEERCRED 0x0014
+/*
+ * Additional options, not kept in so_options.
+ */
#define SO_SNDBUF 0x1001 /* send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
+#define SO_SNDLOWAT 0x1003 /* send low-water mark */
+#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
+/* SO_OSNDTIMEO 0x1005 */
+/* SO_ORCVTIMEO 0x1006 */
#define SO_ERROR 0x1007 /* get error status and clear */
+#define SO_TYPE 0x1008 /* get socket type */
+#define SO_OVERFLOWED 0x1009 /* datagrams: return packets dropped */
/*
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
-#define PF_ROUTE AF_ROUTE
+#define PF_OROUTE AF_OROUTE
#define PF_LINK AF_LINK
#if defined(_NETBSD_SOURCE)
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */
#endif
#define PF_BLUETOOTH AF_BLUETOOTH
+#define PF_MPLS AF_MPLS
+#define PF_ROUTE AF_ROUTE
#define PF_MAX AF_MAX
+/* $NetBSD: stat.h,v 1.63 2011/09/04 10:02:33 christos 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.
+ *
+ * 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.
+ *
+ * @(#)stat.h 8.12 (Berkeley) 8/17/94
+ */
+
#ifndef _SYS_STAT_H_
#define _SYS_STAT_H_
#include <sys/time.h>
#endif
-
struct stat {
big_dev_t st_dev; /* inode's device */
big_mode_t st_mode; /* inode protection mode */
big_gid_t st_gid; /* group ID of the file's group */
big_dev_t st_rdev; /* device type */
#if defined(_NETBSD_SOURCE)
- struct timespec st_atimespec;/* time of last access */
- struct timespec st_mtimespec;/* time of last data modification */
- struct timespec st_ctimespec;/* time of last file status change */
- struct timespec st_birthtimespec; /* time of creation */
+ struct timespec st_atimespec;/* time of last access */
+ struct timespec st_mtimespec;/* time of last data modification */
+ struct timespec st_ctimespec;/* time of last file status change */
+ struct timespec st_birthtimespec; /* time of creation */
#else
- time_t st_atime; /* time of last access */
- long st_atimensec; /* nsec of last access */
- time_t st_mtime; /* time of last data modification */
- long st_mtimensec; /* nsec of last data modification */
- time_t st_ctime; /* time of last file status change */
- long st_ctimensec; /* nsec of last file status change */
- time_t st_birthtime; /* time of creation */
- long st_birthtimensec; /* nsec of time of creation */
+ time_t st_atime; /* time of last access */
+ long st_atimensec; /* nsec of last access */
+ time_t st_mtime; /* time of last data modification */
+ long st_mtimensec; /* nsec of last data modification */
+ time_t st_ctime; /* time of last file status change */
+ long st_ctimensec; /* nsec of last file status change */
+ time_t st_birthtime; /* time of creation */
+ long st_birthtimensec; /* nsec of time of creation */
#endif
+#ifdef ST_SIZE_OFF_T
+ off_t st_size; /* file size, in off_t bytes */
+ off_t st_size_rest;
+#else
big_off_t st_size; /* file size, in bytes */
+#endif
blkcnt_t st_blocks; /* blocks allocated for file */
blksize_t st_blksize; /* optimal blocksize for I/O */
u32_t st_flags; /* user defined flags for file */
u32_t st_spare[2];
};
-
struct minix_prev_stat {
short st_dev; /* major/minor device number */
ino_t st_ino; /* i-node number */
time_t st_ctime; /* time of last file status change */
};
-
#if defined(_NETBSD_SOURCE)
-/* XXX after updating stat struct we don't want to update all the code */
-#define st_atime st_atimespec.tv_sec
-#define st_mtime st_mtimespec.tv_sec
-#define st_ctime st_ctimespec.tv_sec
-#define st_birthtime st_birthtimespec.tv_sec
-#define st_atimensec st_atimespec.tv_nsec
-#define st_mtimensec st_mtimespec.tv_nsec
-#define st_ctimensec st_ctimespec.tv_nsec
-#define st_birthtimensec st_birthtimespec.tv_nsec
+#define st_atime st_atimespec.tv_sec
+#define st_atimensec st_atimespec.tv_nsec
+#define st_mtime st_mtimespec.tv_sec
+#define st_mtimensec st_mtimespec.tv_nsec
+#define st_ctime st_ctimespec.tv_sec
+#define st_ctimensec st_ctimespec.tv_nsec
+#define st_birthtime st_birthtimespec.tv_sec
+#define st_birthtimensec st_birthtimespec.tv_nsec
#endif
-
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
#if defined(_NETBSD_SOURCE)
#define _S_IFBLK 0060000 /* block special */
#define _S_IFREG 0100000 /* regular */
#define _S_IFLNK 0120000 /* symbolic link */
-#define _S_IFSOCK 0140000 /* socket */
#define _S_ISVTX 0001000 /* save swapped text even after use */
+#define _S_IFSOCK 0140000 /* socket */
+#define _S_IFWHT 0160000 /* whiteout */
+#define _S_ARCH1 0200000 /* Archive state 1, ls -l shows 'a' */
+#define _S_ARCH2 0400000 /* Archive state 2, ls -l shows 'A' */
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#define S_IFMT _S_IFMT
#if ((_XOPEN_SOURCE - 0) >= 600) || defined(_NETBSD_SOURCE)
#define S_IFSOCK _S_IFSOCK
#endif
+#if defined(_NETBSD_SOURCE)
+#define S_IFWHT _S_IFWHT
+
+#define S_ARCH1 _S_ARCH1
+#define S_ARCH2 _S_ARCH2
+#endif
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) /* directory */
#define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) /* char special */
defined(_NETBSD_SOURCE)
#define S_ISSOCK(m) (((m) & _S_IFMT) == _S_IFSOCK) /* socket */
#endif
+#if defined(_NETBSD_SOURCE)
+#define S_ISWHT(m) (((m) & _S_IFMT) == _S_IFWHT) /* whiteout */
+#endif
#if defined(_NETBSD_SOURCE)
#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
#define UF_IMMUTABLE 0x00000002 /* file may not be changed */
#define UF_APPEND 0x00000004 /* writes to file may only append */
#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
-
+/* UF_NOUNLINK 0x00000010 [NOT IMPLEMENTED] */
/*
* Super-user changeable flags.
*/
#include <sys/cdefs.h>
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-
__BEGIN_DECLS
int chmod(const char *, mode_t);
int mkdir(const char *, mode_t);
#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
__END_DECLS
-#endif /* !_KERNEL && !_STANDALONE */
#endif /* !_SYS_STAT_H_ */
+/* $NetBSD: statvfs.h,v 1.17 2011/11/18 21:17:45 christos Exp $ */
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef _SYS_STATVFS_H_
#define _SYS_STATVFS_H_
-#include <stdarg.h>
+/* $NetBSD: stdarg.h,v 1.3 2012/07/19 22:46:41 pooka 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 _SYS_STDARG_H_
+#define _SYS_STDARG_H_
+
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef __lint__
+#define __builtin_next_arg(t) ((t) ? 0 : 0)
+#define __builtin_va_start(a, l) ((a) = (va_list)(void *)&(l))
+#define __builtin_va_arg(a, t) ((a) ? (t) 0 : (t) 0)
+#define __builtin_va_end(a) /* nothing */
+#define __builtin_va_copy(d, s) ((d) = (s))
+#elif !(__GNUC_PREREQ__(4, 5) || \
+ (__GNUC_PREREQ__(4, 4) && __GNUC_PATCHLEVEL__ > 2))
+#define __builtin_va_start(ap, last) __builtin_stdarg_start((ap), (last))
+#endif
+
+#ifndef __VA_LIST_DECLARED
+typedef __va_list va_list;
+#define __VA_LIST_DECLARED
+#endif
+
+#define va_start(ap, last) __builtin_va_start((ap), (last))
+#define va_arg __builtin_va_arg
+#define va_end(ap) __builtin_va_end(ap)
+#define __va_copy(dest, src) __builtin_va_copy((dest), (src))
+
+#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 /* !_SYS_STDARG_H_ */
--- /dev/null
+/* $NetBSD: syslimits.h,v 1.26 2011/09/27 01:51:42 christos Exp $ */
+
+/*
+ * Copyright (c) 1988, 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.
+ *
+ * @(#)syslimits.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSLIMITS_H_
+#define _SYS_SYSLIMITS_H_
+
+#include <minix/limits.h>
+#include <sys/featuretest.h>
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+ defined(_NETBSD_SOURCE)
+#define ARG_MAX (256 * 1024) /* max bytes for an exec function */
+#ifndef CHILD_MAX
+#define CHILD_MAX 160 /* max simultaneous processes */
+#endif
+#define GID_MAX USHRT_MAX /* max value for a gid_t (2^31-2) */
+#define LINK_MAX 32767 /* max file link count */
+#define MAX_CANON 255 /* max bytes in term canon input line */
+#define MAX_INPUT 255 /* max bytes in terminal input */
+#define NAME_MAX 255 /* max bytes in a file name, must be */
+ /* kept in sync with MAXPATHLEN */
+#define NGROUPS_MAX 8 /* max supplemental group id's */
+#define UID_MAX USHRT_MAX /* max value for a uid_t */
+#ifndef OPEN_MAX
+#define OPEN_MAX __MINIX_OPEN_MAX /* max open files per process */
+#endif
+#define PATH_MAX __MINIX_PATH_MAX /* max bytes in pathname */
+#define PIPE_BUF 32768 /* max bytes for atomic pipe writes */
+
+#define BC_BASE_MAX INT_MAX /* max ibase/obase values in bc(1) */
+#define BC_DIM_MAX 65535 /* max array elements in bc(1) */
+#define BC_SCALE_MAX INT_MAX /* max scale value in bc(1) */
+#define BC_STRING_MAX INT_MAX /* max const string length in bc(1) */
+#define COLL_WEIGHTS_MAX 2 /* max weights for order keyword */
+#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
+#define LINE_MAX 2048 /* max bytes in an input line */
+#define RE_DUP_MAX 255 /* max RE's in interval notation */
+
+/*
+ * IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+ defined(_NETBSD_SOURCE)
+#define LOGIN_NAME_MAX 17 /* max login name length incl. NUL */
+#endif
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define IOV_MAX 1024 /* max # of iovec's for readv(2) etc. */
+#define NZERO 20 /* default "nice" */
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#endif /* !_ANSI_SOURCE */
+
+#ifdef __minix
+#define STREAM_MAX 8 /* == _POSIX_STREAM_MAX */
+#define TZNAME_MAX 6 /* == _POSIX_TZNAME_MAX */
+#define TIME_MAX LONG_MAX
+#endif
+
+#endif /* !_SYS_SYSLIMITS_H_ */
+
--- /dev/null
+/* $NetBSD: termios.h,v 1.31 2009/12/26 19:31:34 mrg Exp $ */
+
+/*
+ * Copyright (c) 1988, 1989, 1993, 1994
+ * 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.
+ *
+ * @(#)termios.h 8.3 (Berkeley) 3/28/94
+ */
+
+#ifndef _SYS_TERMIOS_H_
+#define _SYS_TERMIOS_H_
+
+#include <sys/cdefs.h>
+
+#include <minix/termios.h>
+
+__BEGIN_DECLS
+#if defined(_NETBSD_SOURCE)
+void cfmakeraw(struct termios *);
+int cfsetspeed(struct termios *, speed_t);
+#endif /* defined(_NETBSD_SOURCE) */
+__END_DECLS
+
+#endif /* !_SYS_TERMIOS_H_ */
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/ttydefaults.h>
+#endif
+/* $NetBSD: time.h,v 1.65 2011/10/27 16:12:52 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)time.h 8.5 (Berkeley) 5/4/95
+ */
+
#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
} \
} while (/* CONSTCOND */ 0)
-
/*
* hide bintime for _STANDALONE because this header is used for hpcboot.exe,
* which is built with compilers which don't recognize LL suffix.
/*
* Names of the interval timers, and structure
* defining a timer setting.
+ * NB: Must match the CLOCK_ constants below.
*/
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
-#define ITIMER_PROF 2
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
+#define ITIMER_MONOTONIC 3
struct itimerval {
struct timeval it_interval; /* timer interval */
--- /dev/null
+/* $NetBSD: times.h,v 1.13 2005/12/11 12:25:21 christos Exp $ */
+
+/*-
+ * Copyright (c) 1990, 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.
+ *
+ * @(#)times.h 8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_TIMES_H_
+#define _SYS_TIMES_H_
+
+#include <machine/ansi.h>
+
+#ifdef _BSD_CLOCK_T_
+typedef _BSD_CLOCK_T_ clock_t;
+#undef _BSD_CLOCK_T_
+#endif
+
+struct tms {
+ clock_t tms_utime; /* User CPU time */
+ clock_t tms_stime; /* System CPU time */
+ clock_t tms_cutime; /* User CPU time of terminated child procs */
+ clock_t tms_cstime; /* System CPU time of terminated child procs */
+};
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifdef __minix
+clock_t times(struct tms *);
+#else
+#ifndef __LIBC12_SOURCE__
+clock_t times(struct tms *) __RENAME(__times13);
+#endif
+#endif /* __minix */
+__END_DECLS
+#endif
+#endif /* !_SYS_TIMES_H_ */
/* Generates prototypes and inline functions */
+#define SPLAY_PROTOTYPE(name, type, field, cmp) \
+void name##_SPLAY(struct name *, struct type *); \
void name##_SPLAY_MINMAX(struct name *, int); \
struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
+#define RB_PROTOTYPE(name, type, field, cmp) \
+ RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
+ RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
attr struct type *name##_RB_REMOVE(struct name *, struct type *); \
attr struct type *name##_RB_INSERT(struct name *, struct type *); \
--- /dev/null
+/* $NetBSD: ttycom.h,v 1.19 2011/09/24 00:05:39 christos Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ * 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.
+ *
+ * @(#)ttycom.h 8.1 (Berkeley) 3/28/94
+ */
+#include <minix/termios.h>
+
+/* LSC FIXME: Wouldn't it be simpler to use that instead of including here
+ termios? for now disabled, pending investigation. */
+#define _SYS_TTYCOM_H_
+
+#ifndef _SYS_TTYCOM_H_
+#define _SYS_TTYCOM_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * Tty ioctl's except for those supported only for backwards compatibility
+ * with the old tty driver.
+ */
+
+/*
+ * Window/terminal size structure. This information is stored by the kernel
+ * in order to provide a consistent interface, but is not used by the kernel.
+ */
+struct winsize {
+ unsigned short ws_row; /* rows, in characters */
+ unsigned short ws_col; /* columns, in characters */
+ unsigned short ws_xpixel; /* horizontal size, pixels */
+ unsigned short ws_ypixel; /* vertical size, pixels */
+};
+
+/* ptmget, for /dev/ptm pty getting ioctl PTMGET */
+struct ptmget {
+ int cfd;
+ int sfd;
+ char cn[16];
+ char sn[16];
+};
+
+#define _PATH_PTMDEV "/dev/ptm"
+
+#define TIOCM_LE 0001 /* line enable */
+#define TIOCM_DTR 0002 /* data terminal ready */
+#define TIOCM_RTS 0004 /* request to send */
+#define TIOCM_ST 0010 /* secondary transmit */
+#define TIOCM_SR 0020 /* secondary receive */
+#define TIOCM_CTS 0040 /* clear to send */
+#define TIOCM_CAR 0100 /* carrier detect */
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0200 /* ring */
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_DSR 0400 /* data set ready */
+ /* 8-10 compat */
+#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */
+#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */
+ /* 15 unused */
+#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
+ /* 17-18 compat */
+#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */
+#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
+#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
+#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
+#define TIOCGETD _IOR('t', 26, int) /* get line discipline (deprecated) */
+#define TIOCSETD _IOW('t', 27, int) /* set line discipline (deprecated) */
+
+/*
+ * This is the maximum length of a line discipline's name.
+ */
+#define TTLINEDNAMELEN 32
+typedef char linedn_t[TTLINEDNAMELEN];
+#define TIOCGLINED _IOR('t', 66, linedn_t) /* get line discipline (new) */
+#define TIOCSLINED _IOW('t', 67, linedn_t) /* set line discipline (new) */
+ /* 127-124 compat */
+#define TIOCSBRK _IO('t', 123) /* set break bit */
+#define TIOCCBRK _IO('t', 122) /* clear break bit */
+#define TIOCSDTR _IO('t', 121) /* set data terminal ready */
+#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */
+#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
+#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
+ /* 117-116 compat */
+#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
+#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */
+#define TIOCNOTTY _IO('t', 113) /* void tty association */
+#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
+#define TIOCPKT_DATA 0x00 /* data packet */
+#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
+#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
+#define TIOCPKT_STOP 0x04 /* stop output */
+#define TIOCPKT_START 0x08 /* start output */
+#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
+#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
+#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
+#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
+#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
+#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */
+#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */
+#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */
+#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */
+#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */
+#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
+#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
+#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
+#define TIOCSTAT _IOW('t', 101, int) /* generate status message */
+#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
+#define TIOCGSID _IOR('t', 99, int) /* get session id */
+#define TIOCCONS _IOW('t', 98, int) /* become virtual console */
+#define TIOCSCTTY _IO('t', 97) /* become controlling tty */
+#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */
+#define TIOCSIG _IO('t', 95) /* pty: generate signal */
+#define TIOCDRAIN _IO('t', 94) /* wait till output drained */
+#define TIOCGFLAGS _IOR('t', 93, int) /* get device flags */
+#define TIOCSFLAGS _IOW('t', 92, int) /* set device flags */
+#define TIOCFLAG_SOFTCAR 0x01 /* ignore hardware carrier */
+#define TIOCFLAG_CLOCAL 0x02 /* set clocal on open */
+#define TIOCFLAG_CRTSCTS 0x04 /* set crtscts on open */
+#define TIOCFLAG_MDMBUF 0x08 /* set mdmbuf on open */
+#define TIOCFLAG_CDTRCTS 0x10 /* set cdtrcts on open */
+#define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* get timestamp of last
+ * Cd rise, stamp next rise */
+
+#define TIOCRCVFRAME _IOW('t', 69, struct mbuf *)/* data frame received */
+#define TIOCXMTFRAME _IOW('t', 68, struct mbuf *)/* data frame transmit */
+
+#define TIOCPTMGET _IOR('t', 70, struct ptmget) /* get ptys */
+#define TIOCGRANTPT _IO('t', 71) /* grantpt(3) */
+#define TIOCPTSNAME _IOR('t', 72, struct ptmget) /* ptsname(3) */
+
+#define TIOCSQSIZE _IOW('t', 128, int) /* set queue size */
+#define TIOCGQSIZE _IOR('t', 129, int) /* get queue size */
+
+#define TTYDISC 0 /* termios tty line discipline */
+#define TABLDISC 3 /* tablet discipline */
+#define SLIPDISC 4 /* serial IP discipline */
+#define PPPDISC 5 /* ppp discipline */
+#define STRIPDISC 6 /* metricom wireless IP discipline */
+#define HDLCDISC 9 /* HDLC discipline */
+
+#endif /* !_SYS_TTYCOM_H_ */
--- /dev/null
+/* $NetBSD: ttydefaults.h,v 1.16 2008/05/24 14:06:39 yamt Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 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.
+ *
+ * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define _SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define TTYDEF_IFLAG (BRKINT | ICRNL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR )
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE)
+#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
+#define TTYDEF_SPEED (B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x) (x&037)
+#define CEOF CTRL('d')
+#define CEOL _POSIX_VDISABLE
+#define CERASE CTRL('h')
+#define CINTR CTRL('c')
+#define CSTATUS CTRL('t')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034 /* FS, ^\ */
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+/* compat */
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+#endif /* _SYS_TTYDEFAULTS_H_ */
-/* $NetBSD: types.h,v 1.86 2009/03/07 21:59:25 ad Exp $ */
+/* $NetBSD: types.h,v 1.89 2012/03/17 21:30:29 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993, 1994
#include <machine/ansi.h>
#include <machine/int_types.h>
+
#include <sys/ansi.h>
#ifndef int8_t
typedef uint64_t u_longlong_t; /* for XDR */
typedef int64_t blkcnt_t; /* fs block count */
-typedef uint32_t blksize_t; /* fs optimal block size */
+typedef uint32_t blksize_t; /* fs optimal block size */
#ifndef fsblkcnt_t
typedef __fsblkcnt_t fsblkcnt_t; /* fs block count (statvfs) */
typedef int64_t daddr_t; /* disk address */
#endif
-
typedef uint32_t dev_t; /* device number */
typedef uint32_t fixpt_t; /* fixed point number */
typedef int idtype_t; /* type of the id */
typedef uint32_t id_t; /* group id, process id or user id */
-typedef unsigned long ino_t; /* inode number */
+typedef uint32_t ino_t; /* inode number */
typedef long key_t; /* IPC key (for Sys V IPC) */
#ifndef mode_t
#define mode_t __mode_t
#endif
-typedef short nlink_t; /* link count */
+typedef int16_t nlink_t; /* link count */
#ifndef off_t
typedef __off_t off_t; /* file offset */
typedef __pid_t pid_t; /* process id */
#define pid_t __pid_t
#endif
-
typedef int32_t lwpid_t; /* LWP id */
-typedef unsigned long rlim_t; /* resource limit */
+typedef uint32_t rlim_t; /* resource limit */
typedef int32_t segsz_t; /* segment size */
typedef int32_t swblk_t; /* swap offset */
#define uid_t __uid_t
#endif
-
typedef int mqd_t;
typedef unsigned long cpuid_t;
#endif /* defined(_NETBSD_SOURCE) */
#if defined(_NETBSD_SOURCE)
+/* Major, minor numbers, dev_t's. */
typedef int32_t __devmajor_t, __devminor_t;
#define devmajor_t __devmajor_t
#define devminor_t __devminor_t
#define NODEVMAJOR (-1)
-
/* Major, minor numbers, dev_t's. */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#define major(dev) ((devmajor_t)(((dev) >> MAJOR) & 0xff))
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
-
#endif
#ifdef _BSD_CLOCK_T_
#ifdef _NETBSD_SOURCE
#include <sys/fd_set.h>
-#define NBBY __NBBY
+
+#define NBBY 8
typedef struct kauth_cred *kauth_cred_t;
*/
struct lwp;
typedef struct lwp lwp_t;
-struct user;
struct __ucontext;
struct proc;
typedef struct proc proc_t;
--- /dev/null
+/* $NetBSD: ucontext.h,v 1.17 2012/09/12 02:00:54 manu Exp $ */
+
+/*-
+ * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein, and by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_UCONTEXT_H_
+#define _SYS_UCONTEXT_H_
+
+#include <sys/sigtypes.h>
+#include <machine/mcontext.h>
+
+typedef struct __ucontext ucontext_t;
+
+struct __ucontext {
+ unsigned int uc_flags; /* properties */
+ ucontext_t * uc_link; /* context to resume */
+ mcontext_t uc_mcontext; /* machine state */
+ sigset_t uc_sigmask; /* signals blocked in this context */
+ stack_t uc_stack; /* the stack used by this context */
+#if defined(_UC_MACHINE_PAD)
+ long __uc_pad[_UC_MACHINE_PAD];
+#endif
+};
+
+#ifndef _UC_UCONTEXT_ALIGN
+#define _UC_UCONTEXT_ALIGN (~0)
+#endif
+
+#define UCF_SWAPPED 001 /* Context has been swapped in by swapcontext(3) */
+#define UCF_IGNFPU 002 /* Ignore FPU context by get or setcontext(3) */
+#define UCF_IGNSIGM 004 /* Ignore signal mask by get or setcontext(3) */
+
+#define NCARGS 6
+
+#ifdef __minix
+__BEGIN_DECLS
+void resumecontext(ucontext_t *ucp);
+
+/* These functions get and set ucontext structure through PM/kernel. They don't
+ * manipulate the stack. */
+int getuctx(ucontext_t *ucp);
+int setuctx(const ucontext_t *ucp);
+__END_DECLS
+#endif /* __minix */
+
+#endif /* !_SYS_UCONTEXT_H_ */
--- /dev/null
+/* $NetBSD: ucred.h,v 1.36 2011/10/12 23:03:36 dholland 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.
+ *
+ * @(#)ucred.h 8.4 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_UCRED_H_
+#define _SYS_UCRED_H_
+
+#ifdef _KERNEL
+#include <sys/syslimits.h>
+#else
+#include <limits.h>
+#endif
+
+/*
+ * Credentials.
+ */
+struct ucred
+{
+ pid_t pid;
+ uid_t uid;
+ gid_t gid;
+};
+
+/* Userland's view of credentials. This should not change */
+struct uucred {
+ unsigned short cr_unused; /* not used, compat */
+ uid_t cr_uid; /* effective user id */
+ gid_t cr_gid; /* effective group id */
+ short cr_ngroups; /* number of groups */
+ gid_t cr_groups[NGROUPS_MAX]; /* groups */
+};
+
+#endif /* !_SYS_UCRED_H_ */
--- /dev/null
+/* $NetBSD: uio.h,v 1.36 2011/07/27 13:20:07 uebayasi Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993, 1994
+ * 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.
+ *
+ * @(#)uio.h 8.5 (Berkeley) 2/22/94
+ */
+
+#ifndef _SYS_UIO_H_
+#define _SYS_UIO_H_
+
+#include <machine/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef _BSD_SIZE_T_
+typedef _BSD_SIZE_T_ size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#ifdef _BSD_SSIZE_T_
+typedef _BSD_SSIZE_T_ ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
+
+struct iovec {
+ void *iov_base; /* Base address. */
+ size_t iov_len; /* Length. */
+};
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Limits
+ */
+/* Deprecated: use IOV_MAX from <limits.h> instead. */
+#define UIO_MAXIOV 1024 /* max 1K of iov's */
+#endif /* _NETBSD_SOURCE */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+ssize_t readv(int, const struct iovec *, int);
+ssize_t writev(int, const struct iovec *, int);
+__END_DECLS
+
+#endif /* !_SYS_UIO_H_ */
--- /dev/null
+/* $NetBSD: utsname.h,v 1.13 2005/12/11 12:25:21 christos Exp $ */
+
+/*-
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chuck Karish of Mindcraft, 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.
+ *
+ * @(#)utsname.h 8.1 (Berkeley) 1/4/94
+ */
+
+#ifndef _SYS_UTSNAME_H_
+#define _SYS_UTSNAME_H_
+
+#include <sys/featuretest.h>
+
+#define _SYS_NMLN 256
+
+#if defined(_NETBSD_SOURCE)
+#define SYS_NMLN _SYS_NMLN
+#endif
+
+struct utsname {
+ char sysname[_SYS_NMLN]; /* Name of this OS. */
+ char nodename[_SYS_NMLN]; /* Name of this network node. */
+ char release[_SYS_NMLN]; /* Release level. */
+ char version[_SYS_NMLN]; /* Version level. */
+ char machine[_SYS_NMLN]; /* Hardware type. */
+ char arch[_SYS_NMLN];
+};
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int uname(struct utsname *);
+#ifdef __minix
+int sysuname(int _req, int _field, char *_value, size_t _len);
+#endif
+__END_DECLS
+
+#ifdef __minix
+/* req: Get or set a string. */
+#define _UTS_GET 0
+#define _UTS_SET 1
+
+/* field: What field to get or set. These values can't be changed lightly. */
+#define _UTS_ARCH 0
+#define _UTS_KERNEL 1
+#define _UTS_MACHINE 2
+#define _UTS_HOSTNAME 3
+#define _UTS_NODENAME 4
+#define _UTS_RELEASE 5
+#define _UTS_VERSION 6
+#define _UTS_SYSNAME 7
+#define _UTS_BUS 8
+#define _UTS_MAX 9 /* Number of strings. */
+#endif /* __minix */
+
+#endif /* !_SYS_UTSNAME_H_ */
+/* $NetBSD: wait.h,v 1.26 2009/01/11 02:45:56 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993, 1994
+ * 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.
+ *
+ * @(#)wait.h 8.2 (Berkeley) 7/10/94
+ */
+
#ifndef _SYS_WAIT_H_
#define _SYS_WAIT_H_