Moving all NetBSD headers back where they belong.
Moving include/sys NetBSD headers to /sys/sys Moving include/arch/*/ NetBSD headers to /sys/arch/*/include Change-Id: Ia1a45d4e83ab806c84093ec2b61bdbea9bed65a0
This commit is contained in:
parent
be89757ef5
commit
f6aac1c3b5
222 changed files with 4556 additions and 5262 deletions
|
@ -58,7 +58,7 @@ SUBDIR+= ../common/include/prop
|
|||
|
||||
.if defined(__MINIX)
|
||||
SUBDIR+= arch sys minix
|
||||
SUBDIR+= net netinet netinet6
|
||||
SUBDIR+= net
|
||||
SUBDIR+= ddekit
|
||||
.else
|
||||
SUBDIR+= ../common/include/ppath
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# $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>
|
|
@ -1,22 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,12 +0,0 @@
|
|||
#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_ */
|
8
include/arch/evbarm/include/Makefile
Normal file
8
include/arch/evbarm/include/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
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>
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
|
||||
|
||||
|
||||
SUBDIR= include ../x86/include
|
||||
SUBDIR= include
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
# $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>
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
.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
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,19 +0,0 @@
|
|||
#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
|
|
@ -1,143 +0,0 @@
|
|||
#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__ */
|
|
@ -1,11 +0,0 @@
|
|||
# $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>
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
|
||||
|
|
|
@ -1,512 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,65 +1,11 @@
|
|||
# $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>
|
||||
|
|
|
@ -1,477 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,298 +0,0 @@
|
|||
/* $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_ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* 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_ */
|
|
@ -1,58 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,58 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,44 +0,0 @@
|
|||
#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_ */
|
|
@ -1,216 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,16 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,744 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,13 +0,0 @@
|
|||
#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
|
|
@ -1,51 +0,0 @@
|
|||
#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_ */
|
|
@ -1,56 +0,0 @@
|
|||
/* $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 */
|
|
@ -1,37 +0,0 @@
|
|||
/* $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_ */
|
|
@ -1,120 +0,0 @@
|
|||
/* $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__ */
|
|
@ -1,193 +0,0 @@
|
|||
#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_ */
|
|
@ -1,68 +0,0 @@
|
|||
#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_ */
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#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>
|
|
@ -1,24 +0,0 @@
|
|||
#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_ */
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef _SYS_TERMIOS_H_
|
||||
#define _SYS_TERMIOS_H_
|
||||
|
||||
#include <minix/termios.h>
|
||||
|
||||
#endif /* !_SYS_TERMIOS_H_ */
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* 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_ */
|
|
@ -1,38 +0,0 @@
|
|||
#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_ */
|
|
@ -1,27 +0,0 @@
|
|||
#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
|
|
@ -1,37 +0,0 @@
|
|||
#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_ */
|
|
@ -1,48 +0,0 @@
|
|||
#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_ */
|
|
@ -2,9 +2,8 @@
|
|||
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
|
||||
|
@ -18,7 +17,7 @@ SRCS+= \
|
|||
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 && \
|
||||
|
|
32
sys/Makefile
32
sys/Makefile
|
@ -1,11 +1,29 @@
|
|||
# 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>
|
||||
|
|
60
sys/arch/Makefile
Normal file
60
sys/arch/Makefile
Normal file
|
@ -0,0 +1,60 @@
|
|||
# $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>
|
8
sys/arch/arm/Makefile
Normal file
8
sys/arch/arm/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
# $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>
|
23
sys/arch/arm/Makefile.inc
Normal file
23
sys/arch/arm/Makefile.inc
Normal file
|
@ -0,0 +1,23 @@
|
|||
# $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]
|
24
sys/arch/arm/include/Makefile
Normal file
24
sys/arch/arm/include/Makefile
Normal file
|
@ -0,0 +1,24 @@
|
|||
# $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>
|
|
@ -1,4 +1,4 @@
|
|||
/* $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
|
||||
|
@ -31,8 +31,6 @@
|
|||
* from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
/* These types are Minix specific. */
|
||||
|
||||
#ifndef _ANSI_H_
|
||||
#define _ANSI_H_
|
||||
|
||||
|
@ -54,11 +52,6 @@
|
|||
#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 */
|
7
sys/arch/arm/include/arm32/Makefile
Normal file
7
sys/arch/arm/include/arm32/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# $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>
|
53
sys/arch/arm/include/arm32/types.h
Normal file
53
sys/arch/arm/include/arm32/types.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $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_ */
|
12
sys/arch/arm/include/arm32/vmparam.h
Normal file
12
sys/arch/arm/include/arm32/vmparam.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#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_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -39,6 +39,9 @@
|
|||
|
||||
#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
|
||||
|
||||
|
@ -70,8 +73,6 @@
|
|||
.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 \
|
||||
|
@ -86,7 +87,6 @@
|
|||
#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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -32,6 +32,33 @@
|
|||
#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
|
||||
|
@ -40,16 +67,20 @@ __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);
|
||||
}
|
||||
|
||||
|
@ -59,18 +90,24 @@ __byte_swap_u16_variable(uint16_t 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);
|
||||
}
|
||||
|
@ -78,5 +115,6 @@ __byte_swap_u16_variable(uint16_t v)
|
|||
__END_DECLS
|
||||
#endif
|
||||
|
||||
#endif /* _LOCORE */
|
||||
|
||||
#endif /* _ARM_BYTE_SWAP_H_ */
|
40
sys/arch/arm/include/cdefs.h
Normal file
40
sys/arch/arm/include/cdefs.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* $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_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -46,6 +46,9 @@
|
|||
#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 */
|
|
@ -1,4 +1,7 @@
|
|||
/* $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
|
||||
|
@ -25,6 +28,11 @@
|
|||
#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: \
|
||||
|
@ -115,3 +123,16 @@
|
|||
|
||||
/* 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_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -38,12 +38,9 @@
|
|||
|
||||
#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 */
|
||||
|
@ -71,7 +68,7 @@
|
|||
#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 */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -98,6 +98,9 @@ __cpu_simple_lock_init(__cpu_simple_lock_t *alp)
|
|||
{
|
||||
|
||||
*alp = __SIMPLELOCK_UNLOCKED;
|
||||
#ifdef _ARM_ARCH_7
|
||||
__asm __volatile("dsb");
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline void __attribute__((__unused__))
|
||||
|
@ -119,7 +122,13 @@ 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_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -61,6 +61,11 @@ struct kmutex {
|
|||
|
||||
/* 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;
|
||||
|
@ -90,11 +95,12 @@ struct kmutex {
|
|||
*/
|
||||
#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 */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -79,23 +79,13 @@
|
|||
|
||||
#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)
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* 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
|
||||
|
@ -31,7 +31,7 @@
|
|||
* 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)
|
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -61,7 +61,7 @@ typedef unsigned long vsize_t;
|
|||
#define PRIuVSIZE "lu"
|
||||
#endif
|
||||
|
||||
typedef int register_t;
|
||||
typedef int register_t, register32_t;
|
||||
#define PRIxREGISTER "x"
|
||||
|
||||
typedef unsigned long pmc_evid_t;
|
||||
|
@ -82,8 +82,17 @@ typedef volatile int __cpu_simple_lock_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
|
56
sys/arch/i386/Makefile
Normal file
56
sys/arch/i386/Makefile
Normal file
|
@ -0,0 +1,56 @@
|
|||
# $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>
|
29
sys/arch/i386/include/Makefile
Normal file
29
sys/arch/i386/include/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
|||
# $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>
|
|
@ -1,95 +1,19 @@
|
|||
/* $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_ */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue