Libraries updates and cleanup
* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ansi.h,v 1.24 2010/03/27 22:14:09 tnozaki Exp $ */
|
||||
/* $NetBSD: ansi.h,v 1.25 2011/07/17 20:54:41 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -49,23 +49,15 @@
|
||||
* #undef _BSD_SIZE_T_
|
||||
* #endif
|
||||
*/
|
||||
|
||||
#define _BSD_CLOCK_T_ long
|
||||
|
||||
#define _BSD_PTRDIFF_T_ int
|
||||
|
||||
#define _BSD_SIZE_T_ unsigned int
|
||||
#define _BSD_SSIZE_T_ int
|
||||
#define _BSD_TIME_T_ long /* time() */
|
||||
#if __GNUC_PREREQ__(2, 96)
|
||||
#define _BSD_VA_LIST_ __builtin_va_list /* GCC built-in type */
|
||||
#else
|
||||
#define _BSD_VA_LIST_ char * /* va_list */
|
||||
#endif
|
||||
#define _BSD_CLOCK_T_ int /* clock() */
|
||||
#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
|
||||
#define _BSD_SIZE_T_ unsigned int /* sizeof() */
|
||||
#define _BSD_SSIZE_T_ int /* byte count or error */
|
||||
#define _BSD_TIME_T_ int /* time() */
|
||||
#define _BSD_CLOCKID_T_ int /* clockid_t */
|
||||
#define _BSD_TIMER_T_ int /* timer_t */
|
||||
#define _BSD_SUSECONDS_T_ long /* suseconds_t */
|
||||
#define _BSD_USECONDS_T_ long /* useconds_t */
|
||||
#define _BSD_SUSECONDS_T_ int /* suseconds_t */
|
||||
#define _BSD_USECONDS_T_ int /* useconds_t */
|
||||
#define _BSD_WCHAR_T_ int /* wchar_t */
|
||||
#define _BSD_WINT_T_ int /* wint_t */
|
||||
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
/* $NetBSD: cdefs.h,v 1.8 2011/06/16 13:27:59 joerg Exp $ */
|
||||
/* $NetBSD: cdefs.h,v 1.9 2012/01/20 14:08:06 joerg Exp $ */
|
||||
|
||||
#ifndef _I386_CDEFS_H_
|
||||
#define _I386_CDEFS_H_
|
||||
|
||||
#if defined(_STANDALONE)
|
||||
#ifdef __PCC__
|
||||
#define __compactcall
|
||||
#else
|
||||
#define __compactcall __attribute__((__regparm__(3)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __minix
|
||||
#define __ALIGNBYTES (sizeof(int) - 1)
|
||||
|
||||
#if defined(__minix)
|
||||
#ifndef __ELF__
|
||||
#define __LEADING_UNDERSCORE
|
||||
#endif
|
||||
#else /* !__minix */
|
||||
/* No arch-specific cdefs. */
|
||||
#endif
|
||||
|
||||
#endif /* defined(__minix) */
|
||||
#endif /* !_I386_CDEFS_H_ */
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
#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)
|
||||
|
||||
#include <x86/cpu.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: limits.h,v 1.22 2010/06/07 13:52:30 tnozaki Exp $ */
|
||||
/* $NetBSD: limits.h,v 1.23 2012/03/28 17:03:29 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
@@ -38,13 +38,10 @@
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
|
||||
#define UCHAR_MAX 0xff /* max value for an unsigned char */
|
||||
#define SCHAR_MAX 0x7f /* max value for a signed char */
|
||||
#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 0xff /* max value for an unsigned char */
|
||||
#define CHAR_MAX 0x7f /* max value for a char */
|
||||
#define CHAR_MIN (-0x7f-1) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 0xffff /* max value for an unsigned short */
|
||||
#define SHRT_MAX 0x7fff /* max value for a short */
|
||||
#define SHRT_MIN (-0x7fff-1) /* min value for a short */
|
||||
|
||||
@@ -1,6 +1,213 @@
|
||||
/* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Julio M. Merino Vidal.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __MULTIBOOT_H__
|
||||
#define __MULTIBOOT_H__
|
||||
|
||||
#if !defined(_KERNEL) && defined(_STANDALONE)
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Multiboot header structure.
|
||||
*/
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
#define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
|
||||
#define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
|
||||
#define MULTIBOOT_HEADER_HAS_VBE 0x00000004
|
||||
#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
|
||||
|
||||
#if !defined(_LOCORE)
|
||||
struct multiboot_header {
|
||||
uint32_t mh_magic;
|
||||
uint32_t mh_flags;
|
||||
uint32_t mh_checksum;
|
||||
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
|
||||
paddr_t mh_header_addr;
|
||||
paddr_t mh_load_addr;
|
||||
paddr_t mh_load_end_addr;
|
||||
paddr_t mh_bss_end_addr;
|
||||
paddr_t mh_entry_addr;
|
||||
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
|
||||
uint32_t mh_mode_type;
|
||||
uint32_t mh_width;
|
||||
uint32_t mh_height;
|
||||
uint32_t mh_depth;
|
||||
};
|
||||
#endif /* !defined(_LOCORE) */
|
||||
|
||||
/*
|
||||
* Symbols defined in locore.S.
|
||||
*/
|
||||
#if !defined(_LOCORE) && defined(_KERNEL)
|
||||
extern struct multiboot_header *Multiboot_Header;
|
||||
#endif /* !defined(_LOCORE) && defined(_KERNEL) */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Multiboot information structure.
|
||||
*/
|
||||
#define MULTIBOOT_INFO_MAGIC 0x2BADB002
|
||||
#define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
|
||||
#define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
|
||||
#define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
|
||||
#define MULTIBOOT_INFO_HAS_MODS 0x00000008
|
||||
#define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
|
||||
#define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
|
||||
#define MULTIBOOT_INFO_HAS_MMAP 0x00000040
|
||||
#define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
|
||||
#define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
|
||||
#define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
|
||||
#define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
|
||||
#define MULTIBOOT_INFO_HAS_VBE 0x00000800
|
||||
|
||||
#if !defined(_LOCORE)
|
||||
struct multiboot_info {
|
||||
uint32_t mi_flags;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
|
||||
uint32_t mi_mem_lower;
|
||||
uint32_t mi_mem_upper;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
|
||||
uint8_t mi_boot_device_part3;
|
||||
uint8_t mi_boot_device_part2;
|
||||
uint8_t mi_boot_device_part1;
|
||||
uint8_t mi_boot_device_drive;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
|
||||
char * mi_cmdline;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
|
||||
uint32_t mi_mods_count;
|
||||
vaddr_t mi_mods_addr;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
|
||||
uint32_t mi_elfshdr_num;
|
||||
uint32_t mi_elfshdr_size;
|
||||
vaddr_t mi_elfshdr_addr;
|
||||
uint32_t mi_elfshdr_shndx;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
|
||||
uint32_t mi_mmap_length;
|
||||
vaddr_t mi_mmap_addr;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
|
||||
uint32_t mi_drives_length;
|
||||
vaddr_t mi_drives_addr;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
|
||||
void * unused_mi_config_table;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
|
||||
char * mi_loader_name;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
|
||||
void * unused_mi_apm_table;
|
||||
|
||||
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
|
||||
void * unused_mi_vbe_control_info;
|
||||
void * unused_mi_vbe_mode_info;
|
||||
paddr_t unused_mi_vbe_interface_seg;
|
||||
paddr_t unused_mi_vbe_interface_off;
|
||||
uint32_t unused_mi_vbe_interface_len;
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Drive information. This describes an entry in the drives table as
|
||||
* pointed to by mi_drives_addr.
|
||||
*/
|
||||
struct multiboot_drive {
|
||||
uint32_t md_length;
|
||||
uint8_t md_number;
|
||||
uint8_t md_mode;
|
||||
uint16_t md_cylinders;
|
||||
uint8_t md_heads;
|
||||
uint8_t md_sectors;
|
||||
|
||||
/* The variable-sized 'ports' field comes here, so this structure
|
||||
* can be longer. */
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Memory mapping. This describes an entry in the memory mappings table
|
||||
* as pointed to by mi_mmap_addr.
|
||||
*
|
||||
* Be aware that mm_size specifies the size of all other fields *except*
|
||||
* for mm_size. In order to jump between two different entries, you
|
||||
* have to count mm_size + 4 bytes.
|
||||
*/
|
||||
struct multiboot_mmap {
|
||||
uint32_t mm_size;
|
||||
uint64_t mm_base_addr;
|
||||
uint64_t mm_length;
|
||||
uint32_t mm_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Modules. This describes an entry in the modules table as pointed
|
||||
* to by mi_mods_addr.
|
||||
*/
|
||||
|
||||
struct multiboot_module {
|
||||
uint32_t mmo_start;
|
||||
uint32_t mmo_end;
|
||||
char * mmo_string;
|
||||
uint32_t mmo_reserved;
|
||||
};
|
||||
|
||||
#endif /* !defined(_LOCORE) */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Prototypes for public functions defined in multiboot.c.
|
||||
*/
|
||||
#if !defined(_LOCORE) && defined(_KERNEL)
|
||||
void multiboot_pre_reloc(struct multiboot_info *);
|
||||
void multiboot_post_reloc(void);
|
||||
void multiboot_print_info(void);
|
||||
bool multiboot_ksyms_addsyms_elf(void);
|
||||
#endif /* !defined(_LOCORE) */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
#else /* !defined(_KERNEL) && defined(_STANDALONE) */
|
||||
/* LSC FIXME: OLD MINIX DEFINITION: should be removed and replace with
|
||||
definition above... */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
@@ -140,4 +347,5 @@ struct multiboot_mmap_entry
|
||||
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* !defined(_KERNEL) && defined(_STANDALONE) */
|
||||
#endif /* __MULTIBOOT_H__ */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: types.h,v 1.70 2010/12/22 04:15:02 christos Exp $ */
|
||||
/* $NetBSD: types.h,v 1.74 2011/07/06 18:46:04 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -101,7 +101,7 @@ typedef volatile unsigned char __cpu_simple_lock_t;
|
||||
/* The x86 does not have strict alignment requirements. */
|
||||
#define __NO_STRICT_ALIGNMENT
|
||||
|
||||
#define __HAVE_DEVICE_REGISTER
|
||||
#define __HAVE_NEW_STYLE_BUS_H
|
||||
#define __HAVE_CPU_DATA_FIRST
|
||||
#define __HAVE_CPU_COUNTER
|
||||
#define __HAVE_MD_CPU_OFFLINE
|
||||
@@ -112,6 +112,12 @@ typedef volatile unsigned char __cpu_simple_lock_t;
|
||||
#define __HAVE_ATOMIC_AS_MEMBAR
|
||||
#define __HAVE_CPU_LWP_SETPRIVATE
|
||||
#define __HAVE_INTR_CONTROL
|
||||
#define __HAVE_MM_MD_OPEN
|
||||
#define __HAVE___LWP_GETPRIVATE_FAST
|
||||
#if !defined(__minix)
|
||||
#define __HAVE_TLS_VARIANT_II
|
||||
#endif /* !defined(__minix) */
|
||||
#define __HAVE_COMMON___TLS_GET_ADDR
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#define __HAVE_RAS
|
||||
|
||||
@@ -33,11 +33,13 @@ BINMODE=444
|
||||
|
||||
.PATH: ${.CURDIR}/.. ${.CURDIR}/../../lib
|
||||
|
||||
# MINIX LSC seems to be still needed
|
||||
#LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
|
||||
LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start -L${DESTDIR}/${LIBDIR}
|
||||
LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
|
||||
CPPFLAGS+= -I ${.CURDIR}/.. -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
|
||||
CPPFLAGS+= -I ${.OBJDIR}
|
||||
.if defined(__MINIX)
|
||||
CPPFLAGS+=-isystem ${DESTDIR}/usr/include
|
||||
CPPFLAGS+= -D_MINIX
|
||||
.endif # defined(__MINIX)
|
||||
# Make sure we override any optimization options specified by the user
|
||||
COPTS= -Os
|
||||
|
||||
@@ -57,10 +59,6 @@ COPTS+= -ffreestanding
|
||||
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
|
||||
CPPFLAGS+= -nostdinc -D_STANDALONE
|
||||
CPPFLAGS+= -I$S
|
||||
.if defined(__MINIX)
|
||||
CPPFLAGS+= -I${DESTDIR}/usr/include
|
||||
CPPFLAGS+= -I${.CURDIR}/../../../../../../
|
||||
.endif
|
||||
|
||||
CPPFLAGS+= -DSUPPORT_PS2
|
||||
CPPFLAGS+= -DDIRECT_SERIAL
|
||||
@@ -127,8 +125,8 @@ KERN_AS= library
|
||||
.include "${S}/lib/libkern/Makefile.inc"
|
||||
LIBKERN= ${KERNLIB}
|
||||
.else
|
||||
# MINIX
|
||||
LIBKERN= # use MINIX minc
|
||||
# use MINIX minc
|
||||
LIBKERN= ${DESTDIR}/usr/lib/libminc.a
|
||||
.endif
|
||||
|
||||
### find out what to use for libz
|
||||
@@ -153,11 +151,10 @@ vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||
# Anything that calls 'real_to_prot' must have a %pc < 0x10000.
|
||||
# We link the program, find the callers (all in libi386), then
|
||||
# explicitly pull in the required objects before any other library code.
|
||||
# MINIX (LSC adding LDADD still needed?)
|
||||
${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||
${_MKTARGET_LINK}
|
||||
bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \
|
||||
${OBJS} ${LIBLIST} ${LDADD} | ( \
|
||||
${OBJS} ${LIBLIST} | ( \
|
||||
while read symbol file; do \
|
||||
[ -z "$$file" ] && continue; \
|
||||
[ "$$symbol" = real_to_prot ] && break; \
|
||||
@@ -173,7 +170,7 @@ ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||
done; \
|
||||
) )"; \
|
||||
${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 \
|
||||
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST} ${LDADD}
|
||||
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
|
||||
${OBJCOPY} -O binary ${PROG}.syms ${PROG}
|
||||
|
||||
.ifndef __MINIX
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
|
||||
|
||||
# MINIX (LSC this still needed?)
|
||||
# Adding cleaning of specific target? -D_MINIX is not defined at top level ?
|
||||
# LSC FIXME: Why change the name?
|
||||
PROG= boot_monitor
|
||||
CLEANFILES= lib
|
||||
|
||||
CPPFLAGS+= -D_MINIX
|
||||
|
||||
.include <../Makefile.boot>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: boot2.c,v 1.57 2011/12/25 06:09:09 tsutsui Exp $ */
|
||||
/* $NetBSD: boot2.c,v 1.58 2012/08/04 03:51:27 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@@ -122,7 +122,9 @@ void command_dev(char *);
|
||||
void command_consdev(char *);
|
||||
void command_modules(char *);
|
||||
void command_multiboot(char *);
|
||||
#ifdef __minix
|
||||
void command_load_mods(char *);
|
||||
#endif
|
||||
|
||||
const struct bootblk_command commands[] = {
|
||||
{ "help", command_help },
|
||||
@@ -134,7 +136,9 @@ const struct bootblk_command commands[] = {
|
||||
{ "consdev", command_consdev },
|
||||
{ "modules", command_modules },
|
||||
{ "load", module_add },
|
||||
#ifdef __minix
|
||||
{ "load_mods", command_load_mods },
|
||||
#endif
|
||||
{ "multiboot", command_multiboot },
|
||||
{ "vesa", command_vesa },
|
||||
{ "splash", splash_add },
|
||||
@@ -405,7 +409,9 @@ command_help(char *arg)
|
||||
"vesa {modenum|on|off|enabled|disabled|list}\n"
|
||||
"modules {on|off|enabled|disabled}\n"
|
||||
"load {path_to_module}\n"
|
||||
#ifdef __minix
|
||||
"load_mods {path_to_modules}, pattern might be used\n"
|
||||
#endif
|
||||
"multiboot [xdNx:][filename] [<args>]\n"
|
||||
"userconf {command}\n"
|
||||
"rndseed {path_to_rndseed_file}\n"
|
||||
@@ -419,10 +425,15 @@ command_ls(char *arg)
|
||||
const char *save = default_filename;
|
||||
|
||||
default_filename = "/";
|
||||
#ifndef __minix
|
||||
ls(arg);
|
||||
#else
|
||||
ls(arg, NULL);
|
||||
#endif
|
||||
default_filename = save;
|
||||
}
|
||||
|
||||
#ifdef __minix
|
||||
void
|
||||
command_load_mods(char *arg)
|
||||
{
|
||||
@@ -432,6 +443,7 @@ command_load_mods(char *arg)
|
||||
ls(arg, module_add);
|
||||
default_filename = save;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
@@ -449,10 +461,21 @@ void
|
||||
command_boot(char *arg)
|
||||
{
|
||||
char *filename;
|
||||
int howto;
|
||||
int howto, tell;
|
||||
|
||||
if (parseboot(arg, &filename, &howto))
|
||||
bootit(filename, howto, (howto & AB_VERBOSE) != 0);
|
||||
if (!parseboot(arg, &filename, &howto))
|
||||
return;
|
||||
|
||||
tell = ((howto & AB_VERBOSE) != 0);
|
||||
if (filename != NULL) {
|
||||
bootit(filename, howto, tell);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < NUMNAMES; i++) {
|
||||
bootit(names[i][0], howto, tell);
|
||||
bootit(names[i][1], howto, tell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.5 2008/04/05 18:21:34 tsutsui Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.6 2012/01/16 18:46:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
# $NetBSD: Makefile,v 1.14 2010/12/29 17:44:03 jakllsch Exp $
|
||||
|
||||
SUBDIR=
|
||||
#SUBDIR= bootxx_ffsv1 .WAIT bootxx_ffsv2 bootxx_lfsv1 bootxx_lfsv2
|
||||
#SUBDIR+=bootxx_msdos bootxx_ustarfs
|
||||
.if defined(__MINIX)
|
||||
SUBDIR= bootxx_minixfs3
|
||||
.else
|
||||
SUBDIR= bootxx_ffsv1 .WAIT bootxx_ffsv2 bootxx_lfsv1 bootxx_lfsv2
|
||||
SUBDIR+=bootxx_msdos bootxx_ustarfs
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
# Ext2fs doesn't have enough free space (it has only 1KB)
|
||||
# to store this primary bootloader, but we can put it into
|
||||
# an independent small 'boot' partition as NetBSD/hp300 does.
|
||||
#
|
||||
# However MINIX implements a solution using the empty space before subpartition
|
||||
.if !empty(CC:M*pcc)
|
||||
# PCC cannot compile bootxx_ext2fs because it lacks regparm aka compactcall
|
||||
SUBDIR+=bootxx_minixfs3
|
||||
.else
|
||||
SUBDIR+=bootxx_ext2fs bootxx_minixfs3
|
||||
.endif
|
||||
SUBDIR+=bootxx_ext2fs
|
||||
|
||||
LIBOBJ= ${.OBJDIR}
|
||||
.MAKEOVERRIDES+= LIBOBJ
|
||||
|
||||
@@ -38,7 +38,7 @@ BINMODE=444
|
||||
|
||||
.PATH: ${.CURDIR}/.. ${.CURDIR}/../../lib
|
||||
|
||||
LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,start -L${DESTDIR}/${LIBDIR}
|
||||
LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,start
|
||||
CPPFLAGS+= -DBOOTXX
|
||||
# CPPFLAGS+= -D__daddr_t=int32_t
|
||||
CPPFLAGS+= -I ${.CURDIR}/../../lib -I ${.OBJDIR}
|
||||
@@ -50,16 +50,12 @@ CPPFLAGS+= -DXXfs_close=${FS}_close
|
||||
CPPFLAGS+= -DXXfs_read=${FS}_read
|
||||
CPPFLAGS+= -DXXfs_stat=${FS}_stat
|
||||
CPPFLAGS+= -DFS=${FS}
|
||||
# clang generates too big bootxx_xxx
|
||||
.if !empty(CC:M*clang)
|
||||
CPPFLAGS+= -Os
|
||||
.endif
|
||||
# CPPFLAGS+= -DBOOT_MSG_COM0
|
||||
|
||||
# Make sure we override any optimization options specified by the user
|
||||
#.include "${.PARSEDIR}/../Makefile.inc"
|
||||
#COPTS= ${OPT_SIZE.${ACTIVE_CC}}
|
||||
#DBG=
|
||||
.include "${.PARSEDIR}/../Makefile.inc"
|
||||
COPTS= ${OPT_SIZE.${ACTIVE_CC}}
|
||||
DBG=
|
||||
|
||||
CPPFLAGS+= -DNO_LBA_CHECK
|
||||
|
||||
@@ -77,10 +73,6 @@ CPUFLAGS= -march=i386 -mtune=i386
|
||||
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
|
||||
CPPFLAGS+= -nostdinc -D_STANDALONE
|
||||
CPPFLAGS+= -I$S
|
||||
.if defined(__MINIX)
|
||||
CPPFLAGS+= -I${DESTDIR}/usr/include
|
||||
CPPFLAGS+= -I${.CURDIR}/../../../../../../
|
||||
.endif
|
||||
|
||||
CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
|
||||
-DLIBSA_NO_TWIDDLE \
|
||||
@@ -123,6 +115,9 @@ SA_AS= library
|
||||
SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
|
||||
.if defined(__MINIX)
|
||||
SAMISCMAKEFLAGS+="SA_INCLUDE_NET=no"
|
||||
CPPFLAGS+= -isystem ${DESTDIR}/usr/include
|
||||
CPPFLAGS+= -D_MINIX
|
||||
AFLAGS+= -Wa,--divide
|
||||
.endif
|
||||
.include "${S}/lib/libsa/Makefile.inc"
|
||||
LIBSA= ${SALIB}
|
||||
@@ -133,10 +128,11 @@ KERN_AS= library
|
||||
.include "${S}/lib/libkern/Makefile.inc"
|
||||
LIBKERN= ${KERNLIB}
|
||||
.else
|
||||
# MINIX
|
||||
LIBKERN= # use MINIX minc
|
||||
# use MINIX minc
|
||||
LIBKERN= ${DESTDIR}/usr/lib/libminc.a
|
||||
.endif
|
||||
|
||||
|
||||
cleandir distclean: .WAIT cleanlibdir
|
||||
|
||||
cleanlibdir:
|
||||
@@ -149,7 +145,7 @@ CLEANFILES+= ${PROG}.sym ${PROG}.map
|
||||
${PROG}: ${OBJS} ${LIBLIST}
|
||||
${_MKTARGET_LINK}
|
||||
${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \
|
||||
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST} ${LDADD}
|
||||
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}
|
||||
${OBJCOPY} -O binary ${PROG}.sym ${PROG}
|
||||
@ sz=$$(${TOOL_STAT} -f '%z' ${PROG}); \
|
||||
if [ "$$sz" -gt "${BOOTXX_MAXSIZE}" ]; then \
|
||||
|
||||
@@ -130,13 +130,12 @@ boot1(uint32_t biosdev, uint64_t *sector)
|
||||
|
||||
done:
|
||||
/* if we fail here, so will fstat, so keep going */
|
||||
if (fd == -1 || fstat(fd, &sb) == -1) {
|
||||
if (fd == -1 || fstat(fd, &sb) == -1)
|
||||
#ifndef __minix
|
||||
return "Can't open /boot\r\n";
|
||||
#else
|
||||
return "Can't open /boot_monitor\r\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
biosdev = (uint32_t)sb.st_size;
|
||||
#if 0
|
||||
@@ -144,21 +143,19 @@ done:
|
||||
return "/boot too large\r\n";
|
||||
#endif
|
||||
|
||||
if (read(fd, (void *)SECONDARY_LOAD_ADDRESS, biosdev) != biosdev) {
|
||||
if (read(fd, (void *)SECONDARY_LOAD_ADDRESS, biosdev) != biosdev)
|
||||
#ifndef __minix
|
||||
return "/boot load failed\r\n";
|
||||
#else
|
||||
return "/boot_monitor load failed\r\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
if (*(uint32_t *)(SECONDARY_LOAD_ADDRESS + 4) != X86_BOOT_MAGIC_2) {
|
||||
if (*(uint32_t *)(SECONDARY_LOAD_ADDRESS + 4) != X86_BOOT_MAGIC_2)
|
||||
#ifndef __minix
|
||||
return "Invalid /boot file format\r\n";
|
||||
#else
|
||||
return "Invalid /boot_monitor file format\r\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We need to jump to the secondary bootstrap in realmode */
|
||||
return 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ boot_params: /* space for patchable variables */
|
||||
pop %ecx
|
||||
movl $boot_params, %esi
|
||||
orb $X86_BP_FLAGS_LBA64VALID, 4(%esi)
|
||||
lcall $SECONDARY_LOAD_ADDRESS >> 4, $0
|
||||
lcall $SECONDARY_LOAD_ADDRESS/16, $0
|
||||
|
||||
boot_fail:
|
||||
push %ax /* error string from boot1 */
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# $NetBSD: Makefile,v 1.1 2010/09/11 13:06:37 tsutsui Exp $
|
||||
|
||||
FS=ext2fs
|
||||
CLEANFILES= lib
|
||||
CPPFLAGS+= -D_MINIX
|
||||
CFLAGS+= -Os
|
||||
|
||||
.include <../Makefile.bootxx>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
PROG=bootxx_minixfs3
|
||||
FS=minixfs3
|
||||
CLEANFILES= lib
|
||||
|
||||
MINIX3_FIRST_SUBP_OFFSET=32
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ AFLAGS.cdboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
||||
NOMAN= # defined
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.if defined(__MINIX)
|
||||
AFLAGS+= -Wa,--divide
|
||||
.endif
|
||||
|
||||
STRIPFLAG= # nothing
|
||||
|
||||
LIBCRT0= # nothing
|
||||
@@ -41,8 +45,6 @@ BUILDSYMLINKS+= $S/arch/i386/include machine \
|
||||
|
||||
DPSRCS+= machine x86
|
||||
|
||||
AFLAGS+= -Wa,--divide
|
||||
|
||||
CLEANFILES+= ${PROG}.tmp
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: biosdisk.c,v 1.39 2011/09/21 08:57:12 gsutre Exp $ */
|
||||
/* $NetBSD: biosdisk.c,v 1.42 2012/07/03 15:24:37 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1998
|
||||
@@ -316,7 +316,9 @@ read_gpt(struct biosdisk *d)
|
||||
gptsector[0] = GPT_HDR_BLKNO;
|
||||
if (set_geometry(&d->ll, &ed) == 0 && d->ll.flags & BIOSDISK_INT13EXT) {
|
||||
gptsector[1] = ed.totsec - 1;
|
||||
d->ll.secsize = ed.sbytes;
|
||||
/* Sanity check values returned from BIOS */
|
||||
if (ed.sbytes >= 512 && (ed.sbytes & (ed.sbytes - 1)) == 0)
|
||||
d->ll.secsize = ed.sbytes;
|
||||
} else {
|
||||
#ifdef DISK_DEBUG
|
||||
printf("Unable to determine extended disk geometry - "
|
||||
@@ -414,7 +416,7 @@ read_minix_subp(struct biosdisk *d, struct disklabel* dflt_lbl,
|
||||
|
||||
if (readsects(&d->ll, sector, 1, d->buf, 0)) {
|
||||
#ifdef DISK_DEBUG
|
||||
printf("Error reading MFS sector %d\n", sector);
|
||||
printf("Error reading MFS sector %"PRId64"\n", sector);
|
||||
#endif
|
||||
return EIO;
|
||||
}
|
||||
@@ -443,10 +445,11 @@ read_label(struct biosdisk *d)
|
||||
struct disklabel dflt_lbl;
|
||||
struct mbr_partition mbr[MBR_PART_COUNT];
|
||||
struct partition *p;
|
||||
int sector, i;
|
||||
uint32_t sector;
|
||||
int i;
|
||||
int error;
|
||||
int typ;
|
||||
int ext_base, this_ext, next_ext;
|
||||
uint32_t ext_base, this_ext, next_ext;
|
||||
#ifdef COMPAT_386BSD_MBRPART
|
||||
int sector_386bsd = -1;
|
||||
#endif
|
||||
@@ -471,7 +474,7 @@ read_label(struct biosdisk *d)
|
||||
next_ext = 0;
|
||||
if (readsects(&d->ll, this_ext, 1, d->buf, 0)) {
|
||||
#ifdef DISK_DEBUG
|
||||
printf("error reading MBR sector %d\n", this_ext);
|
||||
printf("error reading MBR sector %u\n", this_ext);
|
||||
#endif
|
||||
return EIO;
|
||||
}
|
||||
@@ -484,7 +487,7 @@ read_label(struct biosdisk *d)
|
||||
continue;
|
||||
sector = this_ext + mbr[i].mbrp_start;
|
||||
#ifdef DISK_DEBUG
|
||||
printf("ptn type %d in sector %d\n", typ, sector);
|
||||
printf("ptn type %d in sector %u\n", typ, sector);
|
||||
#endif
|
||||
if (typ == MBR_PTYPE_MINIX_14B) {
|
||||
if (!read_minix_subp(d, &dflt_lbl,
|
||||
|
||||
@@ -45,6 +45,7 @@ ENTRY(conputc)
|
||||
call _C_LABEL(prot_to_real) # enter real mode
|
||||
.code16
|
||||
|
||||
#if defined(__minix)
|
||||
cmp $0x08, %al # backspace?
|
||||
jne print_char
|
||||
|
||||
@@ -65,10 +66,13 @@ ENTRY(conputc)
|
||||
jmp do_int
|
||||
|
||||
print_char:
|
||||
#endif /* defined(__minix) */
|
||||
movw $1,%bx
|
||||
movb $0x0e,%ah # print character
|
||||
movb $0x0e,%ah
|
||||
movb %al, %cl
|
||||
#if defined(__minix)
|
||||
do_int:
|
||||
#endif /* defined(__minix) */
|
||||
int $0x10
|
||||
|
||||
calll _C_LABEL(real_to_prot) # back to protected mode
|
||||
@@ -89,12 +93,12 @@ ENTRY(congetc)
|
||||
|
||||
movb $0x0,%ah
|
||||
int $0x16
|
||||
movw %ax,%bx
|
||||
movb %al,%bl
|
||||
|
||||
calll _C_LABEL(real_to_prot) # back to protected mode
|
||||
.code32
|
||||
|
||||
movw %bx, 28(%esp)
|
||||
movb %bl, 28(%esp)
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: exec.c,v 1.49 2011/11/28 07:56:54 tls Exp $ */
|
||||
/* $NetBSD: exec.c,v 1.50 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@@ -297,11 +297,13 @@ common_load_kernel(const char *file, u_long *basemem, u_long *extmem,
|
||||
|
||||
close(fd);
|
||||
|
||||
/* Now we know the root fs type, load modules for it. */
|
||||
/* If the root fs type is unusual, load its module. */
|
||||
if (fsmod != NULL)
|
||||
module_add(fsmod);
|
||||
#if defined(__minix)
|
||||
if (fsmod !=NULL && fsmod2 != NULL && strcmp(fsmod, fsmod2) != 0)
|
||||
module_add(fsmod2);
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
/*
|
||||
* Gather some information for the kernel. Do this after the
|
||||
|
||||
@@ -91,9 +91,11 @@ struct bootblk_command {
|
||||
void (*c_fn)(char *);
|
||||
};
|
||||
void bootmenu(void);
|
||||
void prompt(int);
|
||||
void docommand(char *);
|
||||
#if defined(__minix)
|
||||
void editline(char *, size_t, char *);
|
||||
void prompt(int);
|
||||
#endif
|
||||
|
||||
/* in "user code": */
|
||||
void command_help(char *);
|
||||
@@ -116,7 +118,9 @@ int coniskey(void);
|
||||
__compactcall void conputc(int);
|
||||
void conclr(void);
|
||||
|
||||
#if defined(__minix)
|
||||
int getchar_ex(void);
|
||||
#endif
|
||||
|
||||
int getextmem2(int *);
|
||||
__compactcall int getextmemps2(void *);
|
||||
|
||||
@@ -69,6 +69,7 @@ prompt(int allowreturn)
|
||||
for (;;) {
|
||||
char *c = input;
|
||||
|
||||
input[0] = '\0';
|
||||
printf("> ");
|
||||
editline(input, sizeof(input), NULL);
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/* $NetBSD: getopt.c,v 1.5 2009/03/14 15:36:08 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* from: netbsd:lib/libc/stdlib/getopt.c */
|
||||
|
||||
#include <lib/libkern/libkern.h>
|
||||
#include <lib/libsa/stand.h>
|
||||
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt, /* character checked for validity */
|
||||
optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *ostr)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
printf("illegal option -- %c\n", optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opterr)
|
||||
printf("option requires an argument -- %c\n",
|
||||
optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
@@ -0,0 +1,641 @@
|
||||
/* $NetBSD: nfs.c,v 1.19 2011/12/25 06:09:09 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993 John Brezak
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _STANDALONE
|
||||
#include <lib/libkern/libkern.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
|
||||
#include "rpcv2.h"
|
||||
#include "nfsv2.h"
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
#include "net.h"
|
||||
#include "netif.h"
|
||||
#include "nfs.h"
|
||||
#include "rpc.h"
|
||||
|
||||
/* Define our own NFS attributes. */
|
||||
struct nfsv2_fattrs {
|
||||
n_long fa_type;
|
||||
n_long fa_mode;
|
||||
n_long fa_nlink;
|
||||
n_long fa_uid;
|
||||
n_long fa_gid;
|
||||
n_long fa_size;
|
||||
n_long fa_blocksize;
|
||||
n_long fa_rdev;
|
||||
n_long fa_blocks;
|
||||
n_long fa_fsid;
|
||||
n_long fa_fileid;
|
||||
struct nfsv2_time fa_atime;
|
||||
struct nfsv2_time fa_mtime;
|
||||
struct nfsv2_time fa_ctime;
|
||||
};
|
||||
|
||||
|
||||
struct nfs_read_args {
|
||||
u_char fh[NFS_FHSIZE];
|
||||
n_long off;
|
||||
n_long len;
|
||||
n_long xxx; /* XXX what's this for? */
|
||||
};
|
||||
|
||||
/* Data part of nfs rpc reply (also the largest thing we receive) */
|
||||
#define NFSREAD_SIZE 1024
|
||||
struct nfs_read_repl {
|
||||
n_long errno;
|
||||
struct nfsv2_fattrs fa;
|
||||
n_long count;
|
||||
u_char data[NFSREAD_SIZE];
|
||||
};
|
||||
|
||||
#ifndef NFS_NOSYMLINK
|
||||
struct nfs_readlnk_repl {
|
||||
n_long errno;
|
||||
n_long len;
|
||||
char path[NFS_MAXPATHLEN];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct nfs_iodesc {
|
||||
struct iodesc *iodesc;
|
||||
off_t off;
|
||||
u_char fh[NFS_FHSIZE];
|
||||
struct nfsv2_fattrs fa; /* all in network order */
|
||||
};
|
||||
|
||||
int nfs_getrootfh(struct iodesc *, char *, u_char *);
|
||||
int nfs_lookupfh(struct nfs_iodesc *, const char *, int,
|
||||
struct nfs_iodesc *);
|
||||
#ifndef NFS_NOSYMLINK
|
||||
int nfs_readlink(struct nfs_iodesc *, char *);
|
||||
#endif
|
||||
ssize_t nfs_readdata(struct nfs_iodesc *, off_t, void *, size_t);
|
||||
|
||||
/*
|
||||
* Fetch the root file handle (call mount daemon)
|
||||
* Return zero or error number.
|
||||
*/
|
||||
int
|
||||
nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
|
||||
{
|
||||
size_t len;
|
||||
struct args {
|
||||
n_long len;
|
||||
char path[FNAME_SIZE];
|
||||
} *args;
|
||||
struct repl {
|
||||
n_long errno;
|
||||
u_char fh[NFS_FHSIZE];
|
||||
} *repl;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct args d;
|
||||
} sdata;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct repl d;
|
||||
} rdata;
|
||||
ssize_t cc;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_getrootfh: %s\n", path);
|
||||
#endif
|
||||
|
||||
args = &sdata.d;
|
||||
repl = &rdata.d;
|
||||
|
||||
memset(args, 0, sizeof(*args));
|
||||
len = strlen(path);
|
||||
if (len > sizeof(args->path))
|
||||
len = sizeof(args->path);
|
||||
args->len = htonl(len);
|
||||
memcpy(args->path, path, len);
|
||||
len = 4 + roundup(len, 4);
|
||||
|
||||
cc = rpc_call(d, RPCPROG_MNT, RPCMNT_VER1, RPCMNT_MOUNT,
|
||||
args, len, repl, sizeof(*repl));
|
||||
if (cc == -1) {
|
||||
/* errno was set by rpc_call */
|
||||
return (errno);
|
||||
}
|
||||
if (cc < 4)
|
||||
return (EBADRPC);
|
||||
if (repl->errno)
|
||||
return (ntohl(repl->errno));
|
||||
memcpy(fhp, repl->fh, sizeof(repl->fh));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup a file. Store handle and attributes.
|
||||
* Return zero or error number.
|
||||
*/
|
||||
int
|
||||
nfs_lookupfh(struct nfs_iodesc *d, const char *name, int len, struct nfs_iodesc *newfd)
|
||||
{
|
||||
int rlen;
|
||||
struct args {
|
||||
u_char fh[NFS_FHSIZE];
|
||||
n_long len;
|
||||
char name[FNAME_SIZE];
|
||||
} *args;
|
||||
struct repl {
|
||||
n_long errno;
|
||||
u_char fh[NFS_FHSIZE];
|
||||
struct nfsv2_fattrs fa;
|
||||
} *repl;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct args d;
|
||||
} sdata;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct repl d;
|
||||
} rdata;
|
||||
ssize_t cc;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("lookupfh: called\n");
|
||||
#endif
|
||||
|
||||
args = &sdata.d;
|
||||
repl = &rdata.d;
|
||||
|
||||
memset(args, 0, sizeof(*args));
|
||||
memcpy(args->fh, d->fh, sizeof(args->fh));
|
||||
if ((size_t)len > sizeof(args->name))
|
||||
len = sizeof(args->name);
|
||||
memcpy(args->name, name, len);
|
||||
args->len = htonl(len);
|
||||
len = 4 + roundup(len, 4);
|
||||
len += NFS_FHSIZE;
|
||||
|
||||
rlen = sizeof(*repl);
|
||||
|
||||
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_LOOKUP,
|
||||
args, len, repl, rlen);
|
||||
if (cc == -1)
|
||||
return (errno); /* XXX - from rpc_call */
|
||||
if (cc < 4)
|
||||
return (EIO);
|
||||
if (repl->errno) {
|
||||
/* saerrno.h now matches NFS error numbers. */
|
||||
return (ntohl(repl->errno));
|
||||
}
|
||||
memcpy(&newfd->fh, repl->fh, sizeof(newfd->fh));
|
||||
memcpy(&newfd->fa, &repl->fa, sizeof(newfd->fa));
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifndef NFS_NOSYMLINK
|
||||
/*
|
||||
* Get the destination of a symbolic link.
|
||||
*/
|
||||
int
|
||||
nfs_readlink(struct nfs_iodesc *d, char *buf)
|
||||
{
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
u_char fh[NFS_FHSIZE];
|
||||
} sdata;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct nfs_readlnk_repl d;
|
||||
} rdata;
|
||||
ssize_t cc;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("readlink: called\n");
|
||||
#endif
|
||||
|
||||
memcpy(sdata.fh, d->fh, NFS_FHSIZE);
|
||||
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READLINK,
|
||||
sdata.fh, NFS_FHSIZE,
|
||||
&rdata.d, sizeof(rdata.d));
|
||||
if (cc == -1)
|
||||
return (errno);
|
||||
|
||||
if (cc < 4)
|
||||
return (EIO);
|
||||
|
||||
if (rdata.d.errno)
|
||||
return (ntohl(rdata.d.errno));
|
||||
|
||||
rdata.d.len = ntohl(rdata.d.len);
|
||||
if (rdata.d.len > NFS_MAXPATHLEN)
|
||||
return (ENAMETOOLONG);
|
||||
|
||||
memcpy(buf, rdata.d.path, rdata.d.len);
|
||||
buf[rdata.d.len] = 0;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read data from a file.
|
||||
* Return transfer count or -1 (and set errno)
|
||||
*/
|
||||
ssize_t
|
||||
nfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len)
|
||||
{
|
||||
struct nfs_read_args *args;
|
||||
struct nfs_read_repl *repl;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct nfs_read_args d;
|
||||
} sdata;
|
||||
struct {
|
||||
n_long h[RPC_HEADER_WORDS];
|
||||
struct nfs_read_repl d;
|
||||
} rdata;
|
||||
ssize_t cc;
|
||||
long x;
|
||||
int hlen, rlen;
|
||||
|
||||
args = &sdata.d;
|
||||
repl = &rdata.d;
|
||||
|
||||
memcpy(args->fh, d->fh, NFS_FHSIZE);
|
||||
args->off = htonl((n_long)off);
|
||||
if (len > NFSREAD_SIZE)
|
||||
len = NFSREAD_SIZE;
|
||||
args->len = htonl((n_long)len);
|
||||
args->xxx = htonl((n_long)0);
|
||||
hlen = sizeof(*repl) - NFSREAD_SIZE;
|
||||
|
||||
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ,
|
||||
args, sizeof(*args),
|
||||
repl, sizeof(*repl));
|
||||
if (cc == -1) {
|
||||
/* errno was already set by rpc_call */
|
||||
return (-1);
|
||||
}
|
||||
if (cc < hlen) {
|
||||
errno = EBADRPC;
|
||||
return (-1);
|
||||
}
|
||||
if (repl->errno) {
|
||||
errno = ntohl(repl->errno);
|
||||
return (-1);
|
||||
}
|
||||
rlen = cc - hlen;
|
||||
x = ntohl(repl->count);
|
||||
if (rlen < x) {
|
||||
printf("nfsread: short packet, %d < %ld\n", rlen, x);
|
||||
errno = EBADRPC;
|
||||
return (-1);
|
||||
}
|
||||
memcpy(addr, repl->data, x);
|
||||
return (x);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a file.
|
||||
* return zero or error number
|
||||
*/
|
||||
__compactcall int
|
||||
nfs_open(const char *path, struct open_file *f)
|
||||
{
|
||||
static struct nfs_iodesc nfs_root_node;
|
||||
struct iodesc *desc;
|
||||
struct nfs_iodesc *currfd;
|
||||
const char *cp;
|
||||
#ifndef NFS_NOSYMLINK
|
||||
struct nfs_iodesc *newfd;
|
||||
struct nfsv2_fattrs *fa;
|
||||
const char *ncp;
|
||||
int c;
|
||||
char namebuf[NFS_MAXPATHLEN + 1];
|
||||
char linkbuf[NFS_MAXPATHLEN + 1];
|
||||
int nlinks = 0;
|
||||
#endif
|
||||
int error;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_open: %s\n", path);
|
||||
#endif
|
||||
if (!rootpath[0]) {
|
||||
printf("no rootpath, no nfs\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
if (!(desc = socktodesc(*(int *)(f->f_devdata))))
|
||||
return (EINVAL);
|
||||
|
||||
/* Bind to a reserved port. */
|
||||
desc->myport = htons(--rpc_port);
|
||||
desc->destip = rootip;
|
||||
if ((error = nfs_getrootfh(desc, rootpath, nfs_root_node.fh)))
|
||||
return (error);
|
||||
nfs_root_node.iodesc = desc;
|
||||
|
||||
#ifndef NFS_NOSYMLINK
|
||||
/* Fake up attributes for the root dir. */
|
||||
fa = &nfs_root_node.fa;
|
||||
fa->fa_type = htonl(NFDIR);
|
||||
fa->fa_mode = htonl(0755);
|
||||
fa->fa_nlink = htonl(2);
|
||||
|
||||
currfd = &nfs_root_node;
|
||||
newfd = 0;
|
||||
|
||||
cp = path;
|
||||
while (*cp) {
|
||||
/*
|
||||
* Remove extra separators
|
||||
*/
|
||||
while (*cp == '/')
|
||||
cp++;
|
||||
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
/*
|
||||
* Check that current node is a directory.
|
||||
*/
|
||||
if (currfd->fa.fa_type != htonl(NFDIR)) {
|
||||
error = ENOTDIR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* allocate file system specific data structure */
|
||||
newfd = alloc(sizeof(*newfd));
|
||||
newfd->iodesc = currfd->iodesc;
|
||||
newfd->off = 0;
|
||||
|
||||
/*
|
||||
* Get next component of path name.
|
||||
*/
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
ncp = cp;
|
||||
while ((c = *cp) != '\0' && c != '/') {
|
||||
if (++len > NFS_MAXNAMLEN) {
|
||||
error = ENOENT;
|
||||
goto out;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
|
||||
/* lookup a file handle */
|
||||
error = nfs_lookupfh(currfd, ncp, cp - ncp, newfd);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Check for symbolic link
|
||||
*/
|
||||
if (newfd->fa.fa_type == htonl(NFLNK)) {
|
||||
int link_len, len;
|
||||
|
||||
error = nfs_readlink(newfd, linkbuf);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
link_len = strlen(linkbuf);
|
||||
len = strlen(cp);
|
||||
|
||||
if (link_len + len > MAXPATHLEN
|
||||
|| ++nlinks > MAXSYMLINKS) {
|
||||
error = ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(&namebuf[link_len], cp, len + 1);
|
||||
memcpy(namebuf, linkbuf, link_len);
|
||||
|
||||
/*
|
||||
* If absolute pathname, restart at root.
|
||||
* If relative pathname, restart at parent directory.
|
||||
*/
|
||||
cp = namebuf;
|
||||
if (*cp == '/') {
|
||||
if (currfd != &nfs_root_node)
|
||||
dealloc(currfd, sizeof(*currfd));
|
||||
currfd = &nfs_root_node;
|
||||
}
|
||||
|
||||
dealloc(newfd, sizeof(*newfd));
|
||||
newfd = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currfd != &nfs_root_node)
|
||||
dealloc(currfd, sizeof(*currfd));
|
||||
currfd = newfd;
|
||||
newfd = 0;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
if (newfd)
|
||||
dealloc(newfd, sizeof(*newfd));
|
||||
#else
|
||||
/* allocate file system specific data structure */
|
||||
currfd = alloc(sizeof(*currfd));
|
||||
currfd->iodesc = desc;
|
||||
currfd->off = 0;
|
||||
|
||||
cp = path;
|
||||
/*
|
||||
* Remove extra separators
|
||||
*/
|
||||
while (*cp == '/')
|
||||
cp++;
|
||||
|
||||
/* XXX: Check for empty path here? */
|
||||
|
||||
error = nfs_lookupfh(&nfs_root_node, cp, strlen(cp), currfd);
|
||||
#endif
|
||||
if (!error) {
|
||||
f->f_fsdata = (void *)currfd;
|
||||
fsmod = "nfs";
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_open: %s lookupfh failed: %s\n",
|
||||
path, strerror(error));
|
||||
#endif
|
||||
#ifndef NFS_NOSYMLINK
|
||||
if (currfd != &nfs_root_node)
|
||||
#endif
|
||||
dealloc(currfd, sizeof(*currfd));
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
__compactcall int
|
||||
nfs_close(struct open_file *f)
|
||||
{
|
||||
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_close: fp=0x%lx\n", (u_long)fp);
|
||||
#endif
|
||||
|
||||
if (fp)
|
||||
dealloc(fp, sizeof(struct nfs_iodesc));
|
||||
f->f_fsdata = (void *)0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* read a portion of a file
|
||||
*/
|
||||
__compactcall int
|
||||
nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
|
||||
/* resid: out */
|
||||
{
|
||||
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
|
||||
ssize_t cc;
|
||||
char *addr = buf;
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_read: size=%lu off=%d\n", (u_long)size,
|
||||
(int)fp->off);
|
||||
#endif
|
||||
while ((int)size > 0) {
|
||||
#if !defined(LIBSA_NO_TWIDDLE)
|
||||
twiddle();
|
||||
#endif
|
||||
cc = nfs_readdata(fp, fp->off, (void *)addr, size);
|
||||
/* XXX maybe should retry on certain errors */
|
||||
if (cc == -1) {
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_read: read: %s", strerror(errno));
|
||||
#endif
|
||||
return (errno); /* XXX - from nfs_readdata */
|
||||
}
|
||||
if (cc == 0) {
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_read: hit EOF unexpectantly");
|
||||
#endif
|
||||
goto ret;
|
||||
}
|
||||
fp->off += cc;
|
||||
addr += cc;
|
||||
size -= cc;
|
||||
}
|
||||
ret:
|
||||
if (resid)
|
||||
*resid = size;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not implemented.
|
||||
*/
|
||||
__compactcall int
|
||||
nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
|
||||
/* resid: out */
|
||||
{
|
||||
|
||||
return (EROFS);
|
||||
}
|
||||
|
||||
__compactcall off_t
|
||||
nfs_seek(struct open_file *f, off_t offset, int where)
|
||||
{
|
||||
struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
|
||||
n_long size = ntohl(d->fa.fa_size);
|
||||
|
||||
switch (where) {
|
||||
case SEEK_SET:
|
||||
d->off = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
d->off += offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
d->off = size - offset;
|
||||
break;
|
||||
default:
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (d->off);
|
||||
}
|
||||
|
||||
/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 */
|
||||
const int nfs_stat_types[8] = {
|
||||
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, 0 };
|
||||
|
||||
__compactcall int
|
||||
nfs_stat(struct open_file *f, struct stat *sb)
|
||||
{
|
||||
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
|
||||
n_long ftype, mode;
|
||||
|
||||
ftype = ntohl(fp->fa.fa_type);
|
||||
mode = ntohl(fp->fa.fa_mode);
|
||||
mode |= nfs_stat_types[ftype & 7];
|
||||
|
||||
sb->st_mode = mode;
|
||||
sb->st_nlink = ntohl(fp->fa.fa_nlink);
|
||||
sb->st_uid = ntohl(fp->fa.fa_uid);
|
||||
sb->st_gid = ntohl(fp->fa.fa_gid);
|
||||
sb->st_size = ntohl(fp->fa.fa_size);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__compactcall void
|
||||
nfs_ls(struct open_file *f, const char *pattern)
|
||||
{
|
||||
printf("Currently ls command is unsupported by nfs\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -25,25 +25,21 @@ BINMODE= 444
|
||||
.PATH: ${.CURDIR}/..
|
||||
|
||||
LDFLAGS+= -nostdlib -Wl,-e,start
|
||||
# MINIX LSC DO we need to remove the includes??
|
||||
CPPFLAGS+= -I. -I${.CURDIR}/../../lib #-I${S}
|
||||
CPPFLAGS+= -I. -I${.CURDIR}/../../lib -I${S}
|
||||
.if defined(__MINIX)
|
||||
CPPFLAGS+= -DLOADADDR=${LOADADDR}
|
||||
AFLAGS+= -Wa,--divide
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "x86_64"
|
||||
LDFLAGS+= -Wl,-m,elf_i386
|
||||
AFLAGS+= -m32
|
||||
.endif
|
||||
|
||||
AFLAGS+= "-Wa,--divide"
|
||||
BUILDSYMLINKS+= $S/arch/i386/include machine \
|
||||
$S/arch/x86/include x86
|
||||
|
||||
# NetBSD can be compiled from a foreign host, MINIX do not. So commented out.
|
||||
# Make sys/ a local thing for benefit of cross-compilers
|
||||
#S= ${.CURDIR}/../../../../..
|
||||
#CPPFLAGS+= -I${S}
|
||||
# And same for machine/; need a bit more work because of symlink
|
||||
#BUILDSYMLINKS+= $S/arch/i386/include machine \
|
||||
# $S/arch/x86/include x86
|
||||
#DPSRCS+= machine x86
|
||||
DPSRCS+= machine x86
|
||||
|
||||
CLEANFILES+= ${PROG}.tmp
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/* $NetBSD: syslog.h,v 1.1 2012/10/10 22:51:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _COMPAT_SYS_SYSLOG_H_
|
||||
#define _COMPAT_SYS_SYSLOG_H_
|
||||
|
||||
struct syslog_data60 {
|
||||
int log_file;
|
||||
int connected;
|
||||
int opened;
|
||||
int log_stat;
|
||||
const char *log_tag;
|
||||
int log_fac;
|
||||
int log_mask;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
void closelog_r(struct syslog_data60 *);
|
||||
void openlog_r(const char *, int, int, struct syslog_data60 *);
|
||||
int setlogmask_r(int, struct syslog_data60 *);
|
||||
void syslog_r(int, struct syslog_data60 *, const char *, ...)
|
||||
__printflike(3, 4);
|
||||
void vsyslog_r(int, struct syslog_data60 *, const char *, __va_list)
|
||||
__printflike(3, 0);
|
||||
void syslogp_r(int, struct syslog_data60 *, const char *, const char *,
|
||||
const char *, ...) __printflike(5, 6);
|
||||
void vsyslogp_r(int, struct syslog_data60 *, const char *, const char *,
|
||||
const char *, __va_list) __printflike(5, 0);
|
||||
|
||||
struct syslog_data;
|
||||
void __closelog_r60(struct syslog_data *);
|
||||
void __openlog_r60(const char *, int, int, struct syslog_data *);
|
||||
int __setlogmask_r60(int, struct syslog_data *);
|
||||
void __syslog_r60(int, struct syslog_data *, const char *, ...)
|
||||
__printflike(3, 4);
|
||||
void __vsyslog_r60(int, struct syslog_data *, const char *, __va_list)
|
||||
__printflike(3, 0);
|
||||
void __syslogp_r60(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, ...) __printflike(5, 6);
|
||||
void __vsyslogp_r60(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, __va_list) __printflike(5, 0);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_SYS_SYSLOG_H_ */
|
||||
@@ -21,9 +21,8 @@ CPPFLAGS= -I${SADIR} ${SACPPFLAGS} ${SAMISCCPPFLAGS} \
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.ifndef __MINIX
|
||||
.PATH.c: ${SADIR} ${.PARSEDIR}/../../../common/lib/libc/string
|
||||
.else
|
||||
.ifdef __MINIX
|
||||
.PATH.c: ${SADIR} ${.PARSEDIR}/../../../common/lib/libc/md
|
||||
.endif
|
||||
|
||||
@@ -87,6 +86,7 @@ SRCS+= ustarfs.c
|
||||
SRCS+= dosfs.c
|
||||
SRCS+= ext2fs.c
|
||||
SRCS+= minixfs3.c
|
||||
SRCS+= fnmatch.c
|
||||
# for historic compatibility ufs == ffsv1
|
||||
SRCS+= ufs.c
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd9660.c,v 1.28 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: cd9660.c,v 1.29 2012/07/23 00:49:20 mhitch Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Wolfgang Solfrank.
|
||||
@@ -318,6 +318,7 @@ cd9660_read(struct open_file *f, void *start, size_t size, size_t *resid)
|
||||
break;
|
||||
bno = fp->off / ISO_DEFAULT_BLOCK_SIZE + fp->bno;
|
||||
if (fp->off & (ISO_DEFAULT_BLOCK_SIZE - 1)
|
||||
|| (fp->off + ISO_DEFAULT_BLOCK_SIZE) > fp->size
|
||||
|| size < ISO_DEFAULT_BLOCK_SIZE)
|
||||
dp = buf;
|
||||
else
|
||||
@@ -336,6 +337,8 @@ cd9660_read(struct open_file *f, void *start, size_t size, size_t *resid)
|
||||
if (nread > off + size)
|
||||
nread = off + size;
|
||||
nread -= off;
|
||||
if (nread > fp->size - fp->off)
|
||||
nread = fp->size - fp->off;
|
||||
memcpy(start, buf + off, nread);
|
||||
start = (char *)start + nread;
|
||||
fp->off += nread;
|
||||
|
||||
@@ -95,12 +95,8 @@ void zmemcpy(unsigned char *, unsigned char *, unsigned int);
|
||||
#ifndef ETHER_CRC_POLY_LE
|
||||
#define ETHER_CRC_POLY_LE 0xedb88320
|
||||
#endif
|
||||
#ifndef __minix
|
||||
uint32_t
|
||||
crc32(uint32_t crc, const uint8_t *const buf, size_t len)
|
||||
#else
|
||||
uLong crc32(uLong crc, const Bytef *buf, uInt len)
|
||||
#endif
|
||||
{
|
||||
uint32_t c, carry;
|
||||
size_t i, j;
|
||||
|
||||
+2
-30
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs.c,v 1.11 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.13 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
@@ -169,34 +169,6 @@ static const char *const typestr[] = {
|
||||
"LNK"
|
||||
};
|
||||
|
||||
static int
|
||||
fn_match(const char *fname, const char *pattern)
|
||||
{
|
||||
char fc, pc;
|
||||
|
||||
do {
|
||||
fc = *fname++;
|
||||
pc = *pattern++;
|
||||
if (!fc && !pc)
|
||||
return 1;
|
||||
if (pc == '?' && fc)
|
||||
pc = fc;
|
||||
} while (fc == pc);
|
||||
|
||||
if (pc != '*')
|
||||
return 0;
|
||||
/*
|
||||
* Too hard (and unnecessary really) too check for "*?name" etc....
|
||||
* "**" will look for a '*' and "*?" a '?'
|
||||
*/
|
||||
pc = *pattern++;
|
||||
if (!pc)
|
||||
return 1;
|
||||
while ((fname = strchr(fname, pc)))
|
||||
if (fn_match(++fname, pattern))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* LIBSA_ENABLE_LS_OP */
|
||||
|
||||
static int read_inode(ino32_t, struct open_file *);
|
||||
@@ -904,7 +876,7 @@ ext2fs_ls(struct open_file *f, const char *pattern,
|
||||
printf("bad dir entry\n");
|
||||
goto out;
|
||||
}
|
||||
if (pattern && !fn_match(dp->e2d_name, pattern))
|
||||
if (pattern && !fnmatch(dp->e2d_name, pattern))
|
||||
continue;
|
||||
n = alloc(sizeof *n + strlen(dp->e2d_name));
|
||||
if (!n) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffsv1.c,v 1.5 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: ffsv1.c,v 1.6 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
#define LIBSA_FFSv1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffsv2.c,v 1.5 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: ffsv2.c,v 1.6 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
#define LIBSA_FFSv2
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/* $NetBSD: fnmatch.c,v 1.1 2012/01/16 18:44:13 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* The Mach Operating System project at Carnegie-Mellon University.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1990, 1991 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Author: David Golub
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
#include <lib/libkern/libkern.h>
|
||||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
int
|
||||
fnmatch(const char *fname, const char *pattern)
|
||||
{
|
||||
char fc, pc;
|
||||
|
||||
do {
|
||||
fc = *fname++;
|
||||
pc = *pattern++;
|
||||
if (!fc && !pc)
|
||||
return 1;
|
||||
if (pc == '?' && fc)
|
||||
pc = fc;
|
||||
} while (fc == pc);
|
||||
|
||||
if (pc != '*')
|
||||
return 0;
|
||||
/*
|
||||
* Too hard (and unnecessary really) too check for "*?name" etc....
|
||||
* "**" will look for a '*' and "*?" a '?'
|
||||
*/
|
||||
pc = *pattern++;
|
||||
if (!pc)
|
||||
return 1;
|
||||
while ((fname = strchr(fname, pc)))
|
||||
if (fnmatch(++fname, pattern))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* LIBSA_ENABLE_LS_OP */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: globals.c,v 1.8 2008/11/19 12:36:41 ad Exp $ */
|
||||
/* $NetBSD: globals.c,v 1.9 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* globals.c:
|
||||
@@ -19,11 +19,7 @@ u_char bcea[6] = BA; /* broadcast ethernet address */
|
||||
char rootpath[FNAME_SIZE]; /* root mount path */
|
||||
char bootfile[FNAME_SIZE]; /* bootp says to boot this */
|
||||
char hostname[FNAME_SIZE]; /* our hostname */
|
||||
#ifdef __minix
|
||||
char *fsmod = NULL;
|
||||
#else
|
||||
char *fsmod = "ffs"; /* guessed file system module name */
|
||||
#endif
|
||||
char *fsmod = NULL; /* file system module name to load */
|
||||
char *fsmod2; /* a requisite module */
|
||||
struct in_addr myip; /* my ip address */
|
||||
struct in_addr rootip; /* root ip address */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfsv1.c,v 1.4 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: lfsv1.c,v 1.5 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
#define LIBSA_LFS
|
||||
#define REQUIRED_LFS_VERSION 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfsv2.c,v 1.4 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: lfsv2.c,v 1.5 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
#define LIBSA_LFS
|
||||
#define REQUIRED_LFS_VERSION 2
|
||||
|
||||
@@ -157,6 +157,7 @@ ls(const char *path, void (*funcp)(char* arg))
|
||||
printf("no ls support for this file system\n");
|
||||
|
||||
out:
|
||||
/* LSC: MINIX Modification for correct glob support, beware! */
|
||||
if (p != NULL)
|
||||
dealloc(p, size + 1);
|
||||
close(fd);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD$ */
|
||||
/* $NetBSD: minixfs3.c,v 1.1 2012/01/16 18:44:13 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012
|
||||
@@ -180,40 +180,12 @@ struct entry_t {
|
||||
char e_name[1];
|
||||
};
|
||||
|
||||
static int
|
||||
fn_match(const char *fname, const char *pattern)
|
||||
{
|
||||
char fc, pc;
|
||||
|
||||
do {
|
||||
fc = *fname++;
|
||||
pc = *pattern++;
|
||||
if (!fc && !pc)
|
||||
return 1;
|
||||
if (pc == '?' && fc)
|
||||
pc = fc;
|
||||
} while (fc == pc);
|
||||
|
||||
if (pc != '*')
|
||||
return 0;
|
||||
/*
|
||||
* Too hard (and unnecessary really) too check for "*?name" etc....
|
||||
* "**" will look for a '*' and "*?" a '?'
|
||||
*/
|
||||
pc = *pattern++;
|
||||
if (!pc)
|
||||
return 1;
|
||||
while ((fname = strchr(fname, pc)))
|
||||
if (fn_match(++fname, pattern))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* LIBSA_ENABLE_LS_OP */
|
||||
|
||||
|
||||
static int read_inode(ino32_t, struct open_file *);
|
||||
static int block_map(struct open_file *, block_t, block_t *);
|
||||
static int buf_read_file(struct open_file *, char **, size_t *);
|
||||
static int buf_read_file(struct open_file *, void *, size_t *);
|
||||
static int search_directory(const char *, int, struct open_file *, ino32_t *);
|
||||
static int read_sblock(struct open_file *, struct mfs_sblock *);
|
||||
|
||||
@@ -375,8 +347,9 @@ block_map(struct open_file *f, block_t file_block, block_t *disk_block_p)
|
||||
* Return the location in the buffer and the amount in the buffer.
|
||||
*/
|
||||
static int
|
||||
buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
|
||||
buf_read_file(struct open_file *f, void *v, size_t *size_p)
|
||||
{
|
||||
char **buf_p = v;
|
||||
struct file *fp = (struct file *)f->f_fsdata;
|
||||
struct mfs_sblock *fs = fp->f_fs;
|
||||
long off;
|
||||
@@ -445,7 +418,7 @@ search_directory(const char *name, int length, struct open_file *f,
|
||||
fp->f_seekp = 0;
|
||||
|
||||
while (fp->f_seekp < (off_t)fp->f_di.mdi_size) {
|
||||
rc = buf_read_file(f, (char**)&dbuf, &buf_size);
|
||||
rc = buf_read_file(f, (void *)&dbuf, &buf_size);
|
||||
if (rc)
|
||||
return rc;
|
||||
if (buf_size == 0)
|
||||
@@ -873,7 +846,7 @@ minixfs3_ls(struct open_file *f, const char *pattern,
|
||||
|
||||
fp->f_seekp = 0;
|
||||
while (fp->f_seekp < (off_t)fp->f_di.mdi_size) {
|
||||
int rc = buf_read_file(f, (char**)&dbuf, &buf_size);
|
||||
int rc = buf_read_file(f, &dbuf, &buf_size);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -892,7 +865,7 @@ minixfs3_ls(struct open_file *f, const char *pattern,
|
||||
if (fs2h32(dp->mfsd_ino) == 0)
|
||||
continue;
|
||||
|
||||
if (pattern && !fn_match(dp->mfsd_name, pattern))
|
||||
if (pattern && !fnmatch(dp->mfsd_name, pattern))
|
||||
continue;
|
||||
|
||||
/* Compute the length of the name,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD$ */
|
||||
/* $NetBSD: minixfs3.h,v 1.1 2012/01/16 18:44:13 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: stand.h,v 1.74 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: stand.h,v 1.76 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
@@ -322,6 +322,8 @@ off_t olseek(int, off_t, int);
|
||||
|
||||
extern const char hexdigits[];
|
||||
|
||||
int fnmatch(const char *, const char *);
|
||||
|
||||
/* XXX: These should be removed eventually. */
|
||||
void bcopy(const void *, void *, size_t);
|
||||
void bzero(void *, size_t);
|
||||
|
||||
+2
-31
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs.c,v 1.56 2011/12/25 06:09:08 tsutsui Exp $ */
|
||||
/* $NetBSD: ufs.c,v 1.58 2012/05/21 21:34:16 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -208,35 +208,6 @@ static const char *const typestr[] = {
|
||||
0,
|
||||
"WHT"
|
||||
};
|
||||
|
||||
static int
|
||||
fn_match(const char *fname, const char *pattern)
|
||||
{
|
||||
char fc, pc;
|
||||
|
||||
do {
|
||||
fc = *fname++;
|
||||
pc = *pattern++;
|
||||
if (!fc && !pc)
|
||||
return 1;
|
||||
if (pc == '?' && fc)
|
||||
pc = fc;
|
||||
} while (fc == pc);
|
||||
|
||||
if (pc != '*')
|
||||
return 0;
|
||||
/*
|
||||
* Too hard (and unnecessary really) too check for "*?name" etc....
|
||||
* "**" will look for a '*' and "*?" a '?'
|
||||
*/
|
||||
pc = *pattern++;
|
||||
if (!pc)
|
||||
return 1;
|
||||
while ((fname = strchr(fname, pc)))
|
||||
if (fn_match(++fname, pattern))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* LIBSA_ENABLE_LS_OP */
|
||||
|
||||
#ifdef LIBSA_LFS
|
||||
@@ -955,7 +926,7 @@ ufs_ls(struct open_file *f, const char *pattern,
|
||||
printf("bad dir entry\n");
|
||||
goto out;
|
||||
}
|
||||
if (pattern && !fn_match(dp->d_name, pattern))
|
||||
if (pattern && !fnmatch(dp->d_name, pattern))
|
||||
continue;
|
||||
n = alloc(sizeof *n + strlen(dp->d_name));
|
||||
if (!n) {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ INCS= ansi.h atomic.h \
|
||||
statvfs.h sysctl.h stdarg.h stdint.h \
|
||||
syslimits.h syslog.h \
|
||||
termios.h time.h times.h \
|
||||
tree.h ttycom.h \
|
||||
tls.h tree.h ttycom.h \
|
||||
ttydefaults.h types.h \
|
||||
ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
|
||||
\
|
||||
|
||||
+14
-8
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ansi.h,v 1.13 2010/03/27 22:14:10 tnozaki Exp $ */
|
||||
/* $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@@ -35,17 +35,17 @@
|
||||
#include <machine/ansi.h>
|
||||
|
||||
typedef char * __caddr_t; /* core address */
|
||||
typedef __uint32_t __gid_t; /* group id */
|
||||
typedef __uint32_t __gid_t; /* group id */
|
||||
typedef __uint32_t __in_addr_t; /* IP(v4) address */
|
||||
typedef __uint16_t __in_port_t; /* "Internet" port number */
|
||||
typedef unsigned short __mode_t; /* file permissions */
|
||||
typedef long __off_t; /* file offset */
|
||||
typedef int __pid_t; /* process id */
|
||||
typedef __uint16_t __mode_t; /* file permissions */
|
||||
typedef __int32_t __off_t; /* file offset */
|
||||
typedef __int32_t __pid_t; /* process id */
|
||||
typedef __uint8_t __sa_family_t; /* socket address family */
|
||||
typedef __int32_t __socklen_t; /* socket-related datum length */
|
||||
typedef __uint32_t __uid_t; /* user id */
|
||||
typedef unsigned long __fsblkcnt_t; /* fs block count (statvfs) */
|
||||
typedef unsigned long __fsfilcnt_t; /* fs file count */
|
||||
typedef __uint32_t __uid_t; /* user id */
|
||||
typedef __uint32_t __fsblkcnt_t; /* fs block count (statvfs) */
|
||||
typedef __uint32_t __fsfilcnt_t; /* fs file count */
|
||||
|
||||
struct __tag_wctrans_t;
|
||||
typedef struct __tag_wctrans_t *__wctrans_t;
|
||||
@@ -66,4 +66,10 @@ typedef union {
|
||||
#define _BSD_WCTYPE_T_ __wctype_t /* wctype_t */
|
||||
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
|
||||
|
||||
#ifdef __lint__
|
||||
typedef char *__va_list;
|
||||
#else
|
||||
typedef __builtin_va_list __va_list;
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_ANSI_H_ */
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bitops.h,v 1.7 2010/03/21 14:28:15 christos Exp $ */
|
||||
/* $NetBSD: bitops.h,v 1.9 2011/07/30 16:35:58 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
|
||||
@@ -255,7 +255,7 @@ fls64(uint64_t _n)
|
||||
_ilog2_helper(_n, 2) \
|
||||
_ilog2_helper(_n, 1) \
|
||||
_ilog2_helper(_n, 0) \
|
||||
-1) : ((sizeof(_n) >= 4 ? fls64(_n) : fls32(_n)) - 1) \
|
||||
-1) : ((sizeof(_n) > 4 ? fls64(_n) : fls32(_n)) - 1) \
|
||||
)
|
||||
|
||||
static __inline void
|
||||
@@ -266,7 +266,7 @@ fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
|
||||
int _l;
|
||||
|
||||
_l = fls32(_div - 1);
|
||||
_mt = 0x100000000ULL * ((1ULL << _l) - _div);
|
||||
_mt = (uint64_t)(0x100000000ULL * ((1ULL << _l) - _div));
|
||||
*_m = (uint32_t)(_mt / _div + 1);
|
||||
*_s1 = (_l > 1) ? 1 : _l;
|
||||
*_s2 = (_l == 0) ? 0 : _l - 1;
|
||||
@@ -274,7 +274,7 @@ fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
|
||||
|
||||
/* ARGSUSED */
|
||||
static __inline uint32_t
|
||||
fast_divide32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
|
||||
fast_divide32(uint32_t _v, uint32_t _div __unused, uint32_t _m, uint8_t _s1,
|
||||
uint8_t _s2)
|
||||
{
|
||||
uint32_t _t;
|
||||
|
||||
+89
-8
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cdefs.h,v 1.81 2010/12/25 22:30:52 joerg Exp $ */
|
||||
/* $NetBSD: cdefs.h,v 1.100 2012/08/24 05:47:51 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -63,6 +63,21 @@
|
||||
#include <sys/cdefs_aout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __strict_weak_alias(alias,sym) \
|
||||
__unused static __typeof__(alias) *__weak_alias_##alias = &sym; \
|
||||
__weak_alias(alias,sym)
|
||||
#else
|
||||
#define __strict_weak_alias(alias,sym) __weak_alias(alias,sym)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Optional marker for size-optimised MD calling convention.
|
||||
*/
|
||||
#ifndef __compactcall
|
||||
#define __compactcall
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
||||
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
||||
@@ -125,6 +140,17 @@
|
||||
#define __aconst
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile Time Assertion.
|
||||
*/
|
||||
#ifdef __COUNTER__
|
||||
#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__)
|
||||
#else
|
||||
#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __LINE__)
|
||||
#endif
|
||||
#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z)
|
||||
#define __CTASSERT1(x, y, z) typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1]
|
||||
|
||||
/*
|
||||
* The following macro is used to remove const cast-away warnings
|
||||
* from gcc -Wcast-qual; it should be used with caution because it
|
||||
@@ -206,6 +232,24 @@
|
||||
#define __noinline /* nothing */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 0)
|
||||
#define __always_inline __attribute__((__always_inline__))
|
||||
#else
|
||||
#define __always_inline /* nothing */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 1)
|
||||
#define __returns_twice __attribute__((__returns_twice__))
|
||||
#else
|
||||
#define __returns_twice /* nothing */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 5)
|
||||
#define __noclone __attribute__((__noclone__))
|
||||
#else
|
||||
#define __noclone /* nothing */
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(2, 7)
|
||||
#define __unused __attribute__((__unused__))
|
||||
#else
|
||||
@@ -218,6 +262,12 @@
|
||||
#define __used __unused
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(3, 1)
|
||||
#define __noprofile __attribute__((__no_instrument_function__))
|
||||
#else
|
||||
#define __noprofile /* nothing */
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_EXTERN_C extern "C" {
|
||||
#define __END_EXTERN_C }
|
||||
@@ -278,6 +328,8 @@
|
||||
#define __packed _Pragma("packed 1")
|
||||
#define __aligned(x) _Pragma("aligned " __STRING(x))
|
||||
#define __section(x) _Pragma("section " ## x)
|
||||
#elif defined(_MSC_VER)
|
||||
#define __packed /* ignore */
|
||||
#else
|
||||
#define __packed error: no __packed for this compiler
|
||||
#define __aligned(x) error: no __aligned for this compiler
|
||||
@@ -292,7 +344,9 @@
|
||||
#define __restrict /* delete __restrict when not supported */
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
#define __restrict restrict
|
||||
#elif !__GNUC_PREREQ__(2, 92)
|
||||
#elif __GNUC_PREREQ__(2, 92)
|
||||
#define __restrict __restrict__
|
||||
#else
|
||||
#define __restrict /* delete __restrict when not supported */
|
||||
#endif
|
||||
|
||||
@@ -320,12 +374,10 @@
|
||||
#if !defined(_STANDALONE) && !defined(_KERNEL)
|
||||
#if defined(__GNUC__) || defined(__PCC__)
|
||||
#define __RENAME(x) ___RENAME(x)
|
||||
#else
|
||||
#ifdef __lint__
|
||||
#elif defined(__lint__)
|
||||
#define __RENAME(x) __symbolrename(x)
|
||||
#else
|
||||
#error "No function renaming possible"
|
||||
#endif /* __lint__ */
|
||||
#endif /* __GNUC__ */
|
||||
#else /* _STANDALONE || _KERNEL */
|
||||
#define __RENAME(x) no renaming in kernel or standalone environment
|
||||
@@ -443,7 +495,7 @@
|
||||
#define __link_set_foreach(pvar, set) \
|
||||
for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
|
||||
|
||||
#define __link_set_entry(set, idx) (__link_set_begin(set)[idx])
|
||||
#define __link_set_entry(set, idx) (__link_set_start(set)[idx])
|
||||
|
||||
/*
|
||||
* Return the number of elements in a statically-allocated array,
|
||||
@@ -482,8 +534,37 @@
|
||||
#define __CAST(__dt, __st) ((__dt)(__st))
|
||||
#endif
|
||||
|
||||
#ifdef _MINIX
|
||||
/* If compiling in Minix tree, Minix ANSI definitions are always useful. */
|
||||
#define __type_mask(t) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
|
||||
(~((1ULL << (sizeof(t) * NBBY)) - 1)) : 0ULL)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
static __inline long long __zeroll(void) { return 0; }
|
||||
static __inline int __negative_p(double x) { return x < 0; }
|
||||
#else
|
||||
#define __zeroll() (0LL)
|
||||
#define __negative_p(x) ((x) < 0)
|
||||
#endif
|
||||
|
||||
#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * NBBY - 1))))
|
||||
#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * NBBY - 1))))
|
||||
#define __type_min_u(t) ((t)0ULL)
|
||||
#define __type_max_u(t) ((t)~0ULL)
|
||||
#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1)
|
||||
#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t))
|
||||
#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t))
|
||||
|
||||
|
||||
#define __type_fit_u(t, a) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
|
||||
(((a) & __type_mask(t)) == 0) : !__negative_p(a))
|
||||
|
||||
#define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \
|
||||
((intmax_t)((a) + __zeroll()) >= (intmax_t)__type_min_s(t)) : \
|
||||
((intmax_t)((a) + __zeroll()) <= (intmax_t)__type_max_s(t)))
|
||||
|
||||
/*
|
||||
* return true if value 'a' fits in type 't'
|
||||
*/
|
||||
#define __type_fit(t, a) (__type_is_signed(t) ? \
|
||||
__type_fit_s(t, a) : __type_fit_u(t, a))
|
||||
|
||||
#endif /* !_SYS_CDEFS_H_ */
|
||||
|
||||
@@ -110,17 +110,11 @@
|
||||
#define __link_set_add_data(set, sym) __link_set_make_entry(set, sym, 25)
|
||||
#define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym, 27)
|
||||
|
||||
#ifdef __minix
|
||||
/* GNU binutils 2.x doesn't support a.out link sets. We need to workaround
|
||||
* this by explicitely creating the N_SETV structure. */
|
||||
#define __link_set_decl(set, ptype)
|
||||
#else
|
||||
#define __link_set_decl(set, ptype) \
|
||||
extern struct { \
|
||||
int __ls_length; \
|
||||
ptype *__ls_items[1]; \
|
||||
} __link_set_##set
|
||||
#endif /* !__minix */
|
||||
|
||||
#define __link_set_start(set) (&(__link_set_##set).__ls_items[0])
|
||||
#define __link_set_end(set) \
|
||||
|
||||
+11
-15
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cdefs_elf.h,v 1.34 2010/12/08 01:18:55 joerg Exp $ */
|
||||
/* $NetBSD: cdefs_elf.h,v 1.40 2012/03/04 16:14:48 tron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@@ -65,21 +65,21 @@
|
||||
__asm(".weak " _C_LABEL_STRING(#sym));
|
||||
|
||||
#if __GNUC_PREREQ__(4, 0)
|
||||
#define __weak_reference(sym) __attribute__((__weakref__))
|
||||
#define __weak_reference(sym) __attribute__((__weakref__(#sym)))
|
||||
#else
|
||||
#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define __warn_references(sym,msg) \
|
||||
static __attribute__((__used__, __section__(".gnu.warning." #sym))) \
|
||||
const char ___CONCAT(__warn_reference_##sym,__COUNTER__)[] = msg;
|
||||
#if __GNUC_PREREQ__(4, 2)
|
||||
#define __weakref_visible static
|
||||
#else
|
||||
#define __weakref_visible extern
|
||||
#endif
|
||||
|
||||
#define __warn_references(sym,msg) \
|
||||
__asm(".pushsection .gnu.warning." #sym "\n" \
|
||||
".ascii \"" msg "\"\n" \
|
||||
".popsection");
|
||||
#endif
|
||||
|
||||
#else /* !__STDC__ */
|
||||
|
||||
@@ -106,11 +106,7 @@
|
||||
|
||||
#endif /* !__STDC__ */
|
||||
|
||||
#if defined(__clang__)
|
||||
#define __SECTIONSTRING(_sec, _str) \
|
||||
static __attribute__((__used__, __section__(#_sec))) const char \
|
||||
___CONCAT(__sectstr,__COUNTER__)[] = _str
|
||||
#elif __STDC__
|
||||
#if __STDC__
|
||||
#define __SECTIONSTRING(_sec, _str) \
|
||||
__asm(".pushsection " #_sec "\n" \
|
||||
".asciz \"" _str "\"\n" \
|
||||
@@ -157,8 +153,8 @@
|
||||
#define __link_set_add_bss2(set, sym, n) __link_set_make_entry2(set, sym, n)
|
||||
|
||||
#define __link_set_decl(set, ptype) \
|
||||
extern ptype * const __start_link_set_##set[]; \
|
||||
extern ptype * const __stop_link_set_##set[] \
|
||||
extern ptype * const __start_link_set_##set[] __dso_hidden; \
|
||||
extern ptype * const __stop_link_set_##set[] __dso_hidden \
|
||||
|
||||
#define __link_set_start(set) (__start_link_set_##set)
|
||||
#define __link_set_end(set) (__stop_link_set_##set)
|
||||
@@ -200,7 +196,7 @@
|
||||
__attribute__((__section__(".data.read_mostly")))
|
||||
|
||||
#define __cacheline_aligned \
|
||||
__attribute__((__aligned__(COHERENCY_UNIT) \
|
||||
__attribute__((__aligned__(COHERENCY_UNIT), \
|
||||
__section__(".data.cacheline_aligned")))
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#include <sys/ctype_bits.h>
|
||||
|
||||
/* LSC: cast to unsigned char in order to prevent char as indice errors. */
|
||||
#define isdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_N))
|
||||
#define islower(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_L))
|
||||
#define isspace(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_S))
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(__minix) && !defined(_STANDALONE)
|
||||
#include <minix/partition.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Each disk has a label which includes information about the hardware
|
||||
* disk geometry, filesystem partitions, and drive specific information.
|
||||
@@ -180,6 +184,10 @@ struct disklabel {
|
||||
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 */
|
||||
#if defined(__minix) && !defined(_STANDALONE)
|
||||
struct partition /* the partition table */
|
||||
d_partitions[MAXPARTITIONS]; /* actually may be more */
|
||||
#else
|
||||
struct partition { /* the partition table */
|
||||
uint32_t p_size; /* number of sectors in partition */
|
||||
uint32_t p_offset; /* starting sector */
|
||||
@@ -199,6 +207,7 @@ struct disklabel {
|
||||
#define p_cpg __partition_u1.cpg
|
||||
#define p_sgs __partition_u1.sgs
|
||||
} d_partitions[MAXPARTITIONS]; /* actually may be more */
|
||||
#endif /* defined(__minix) */
|
||||
};
|
||||
|
||||
#if defined(__HAVE_OLD_DISKLABEL) && !HAVE_NBTOOL_CONFIG_H
|
||||
|
||||
+3
-3
@@ -17,8 +17,8 @@
|
||||
* file is included in an ordinary user program, EPERM has the value ( 1).
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H /* check if <errno.h> is already included */
|
||||
# define _ERRNO_H /* it is not included; note that fact */
|
||||
#ifndef _SYS_ERRNO_H_
|
||||
#define _SYS_ERRNO_H_
|
||||
|
||||
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
|
||||
#ifdef _SYSTEM
|
||||
@@ -173,4 +173,4 @@
|
||||
#define EDEADEPT (_SIGN 302 ) /* specified endpoint is not alive */
|
||||
#define EBADCPU (_SIGN 303 ) /* requested CPU does not work */
|
||||
|
||||
#endif /* _ERRNO_H */
|
||||
#endif /* !_SYS_ERRNO_H_ */
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
/* Never define _REENTRANT on Minix */
|
||||
|
||||
#ifdef __minix
|
||||
#ifndef __minix
|
||||
|
||||
#if ((_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500) && \
|
||||
!defined(_REENTRANT)
|
||||
|
||||
@@ -450,10 +450,15 @@ int getfh(const char *, void *, size_t *)
|
||||
__RENAME(__getfh30);
|
||||
#endif
|
||||
|
||||
#if !defined(__minix)
|
||||
int unmount(const char *, int);
|
||||
#endif /* !defined(__minix) */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
#if !defined(__minix)
|
||||
/* LSC FIXME: we should remove our definition, and make sure all the tools uses the new one*/
|
||||
int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
|
||||
#endif /* !defined(__minix) */
|
||||
int fhopen(const void *, size_t, int) __RENAME(__fhopen40);
|
||||
int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
|
||||
#endif
|
||||
|
||||
+39
-33
@@ -1,4 +1,5 @@
|
||||
/* $NetBSD: ptree.h,v 1.3 2008/11/25 15:13:47 ad Exp $ */
|
||||
/* $NetBSD: ptree.h,v 1.8 2012/10/06 22:15:09 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@@ -27,6 +28,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PTREE_H_
|
||||
#define _SYS_PTREE_H_
|
||||
|
||||
@@ -46,42 +48,42 @@ typedef unsigned int pt_bitlen_t;
|
||||
|
||||
typedef struct pt_node {
|
||||
uintptr_t ptn_slots[2]; /* must be first */
|
||||
#define PT_SLOT_LEFT 0
|
||||
#define PT_SLOT_RIGHT 1
|
||||
#define PT_SLOT_LEFT 0u
|
||||
#define PT_SLOT_RIGHT 1u
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PT_SLOT_ROOT 0
|
||||
#define PT_SLOT_OTHER 1
|
||||
#define PT_SLOT_ODDMAN 1
|
||||
#define PT_TYPE_LEAF 0x00000000
|
||||
#define PT_TYPE_BRANCH 0x00000001
|
||||
#define PT_TYPE_MASK 0x00000001
|
||||
#define PT_SLOT_ROOT 0u
|
||||
#define PT_SLOT_OTHER 1u
|
||||
#define PT_SLOT_ODDMAN 1u
|
||||
#define PT_TYPE_LEAF ((uintptr_t)0x00000000u)
|
||||
#define PT_TYPE_BRANCH ((uintptr_t)0x00000001u)
|
||||
#define PT_TYPE_MASK ((uintptr_t)0x00000001u)
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
uint32_t ptn_nodedata;
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PTN_LEAF_POSITION_BITS 8
|
||||
#define PTN_LEAF_POSITION_SHIFT 0
|
||||
#define PTN_BRANCH_POSITION_BITS 8
|
||||
#define PTN_BRANCH_POSITION_SHIFT 8
|
||||
#define PTN_LEAF_POSITION_BITS 8u
|
||||
#define PTN_LEAF_POSITION_SHIFT 0u
|
||||
#define PTN_BRANCH_POSITION_BITS 8u
|
||||
#define PTN_BRANCH_POSITION_SHIFT 8u
|
||||
#ifndef PTNOMASK
|
||||
#define PTN_MASK_BITLEN_BITS 15
|
||||
#define PTN_MASK_BITLEN_SHIFT 16
|
||||
#define PTN_MASK_FLAG 0x80000000
|
||||
#define PTN_MASK_BITLEN_BITS 15u
|
||||
#define PTN_MASK_BITLEN_SHIFT 16u
|
||||
#define PTN_MASK_FLAG 0x80000000u
|
||||
#endif
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
uint32_t ptn_branchdata;
|
||||
#ifdef _PT_PRIVATE
|
||||
#define PTN_BRANCH_BITOFF_BITS 15
|
||||
#define PTN_BRANCH_BITOFF_SHIFT 0
|
||||
#define PTN_BRANCH_BITLEN_BITS 8
|
||||
#define PTN_BRANCH_BITLEN_SHIFT 16
|
||||
#define PTN_BRANCH_BITOFF_BITS 15u
|
||||
#define PTN_BRANCH_BITOFF_SHIFT 0u
|
||||
#define PTN_BRANCH_BITLEN_BITS 8u
|
||||
#define PTN_BRANCH_BITLEN_SHIFT 16u
|
||||
#if 0
|
||||
#define PTN_ORIENTATION_BITS 1
|
||||
#define PTN_ORIENTATION_SHIFT 30
|
||||
#define PTN_ORIENTATION_BITS 1u
|
||||
#define PTN_ORIENTATION_SHIFT 30u
|
||||
#endif
|
||||
#define PTN_BRANCH_UNUSED 0x3f000000
|
||||
#define PTN_XBRANCH_FLAG 0x80000000
|
||||
#define PTN_BRANCH_UNUSED 0x3f000000u
|
||||
#define PTN_XBRANCH_FLAG 0x80000000u
|
||||
#endif /* _PT_PRIVATE */
|
||||
} pt_node_t;
|
||||
|
||||
@@ -155,12 +157,14 @@ typedef struct pt_node {
|
||||
#endif /* _PT_PRIVATE */
|
||||
|
||||
typedef struct pt_tree_ops {
|
||||
bool (*ptto_matchnode)(const void *, const void *, pt_bitoff_t,
|
||||
pt_bitoff_t *, pt_slot_t *);
|
||||
bool (*ptto_matchkey)(const void *, const void *, pt_bitoff_t,
|
||||
pt_bitlen_t);
|
||||
pt_slot_t (*ptto_testnode)(const void *, pt_bitoff_t, pt_bitlen_t);
|
||||
pt_slot_t (*ptto_testkey)(const void *, pt_bitoff_t, pt_bitlen_t);
|
||||
bool (*ptto_matchnode)(const void *, const void *,
|
||||
pt_bitoff_t, pt_bitoff_t *, pt_slot_t *, void *);
|
||||
bool (*ptto_matchkey)(const void *, const void *,
|
||||
pt_bitoff_t, pt_bitlen_t, void *);
|
||||
pt_slot_t (*ptto_testnode)(const void *,
|
||||
pt_bitoff_t, pt_bitlen_t, void *);
|
||||
pt_slot_t (*ptto_testkey)(const void *,
|
||||
pt_bitoff_t, pt_bitlen_t, void *);
|
||||
} pt_tree_ops_t;
|
||||
|
||||
typedef struct pt_tree {
|
||||
@@ -170,16 +174,18 @@ typedef struct pt_tree {
|
||||
const pt_tree_ops_t *pt_ops;
|
||||
size_t pt_node_offset;
|
||||
size_t pt_key_offset;
|
||||
uintptr_t pt_spare[4];
|
||||
void *pt_context;
|
||||
uintptr_t pt_spare[3];
|
||||
} pt_tree_t;
|
||||
|
||||
#define PT_FILTER_MASK 0x00000001 /* node is a mask */
|
||||
typedef bool (*pt_filter_t)(void *, const void *, int);
|
||||
|
||||
void ptree_init(pt_tree_t *, const pt_tree_ops_t *, size_t, size_t);
|
||||
void ptree_init(pt_tree_t *, const pt_tree_ops_t *, void *, size_t, size_t);
|
||||
bool ptree_insert_node(pt_tree_t *, void *);
|
||||
bool ptree_insert_mask_node(pt_tree_t *, void *, pt_bitlen_t);
|
||||
void * ptree_find_filtered_node(pt_tree_t *, void *, pt_filter_t, void *);
|
||||
bool ptree_mask_node_p(pt_tree_t *, const void *, pt_bitlen_t *);
|
||||
void * ptree_find_filtered_node(pt_tree_t *, const void *, pt_filter_t, void *);
|
||||
#define ptree_find_node(pt,key) \
|
||||
ptree_find_filtered_node((pt), (key), NULL, NULL)
|
||||
void ptree_remove_node(pt_tree_t *, void *);
|
||||
|
||||
+2
-1
@@ -39,10 +39,11 @@
|
||||
#define RBT_HALT 0 /* shutdown and return to monitor */
|
||||
#define RBT_REBOOT 1 /* reboot the system through the monitor */
|
||||
#define RBT_PANIC 2 /* a server panics */
|
||||
#define RBT_MONITOR 3 /* let the monitor do this */
|
||||
#define RBT_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 */
|
||||
|
||||
/*
|
||||
* Arguments to reboot system call. These are passed to the boot program,
|
||||
* and then on to init.
|
||||
|
||||
+66
-5
@@ -1,3 +1,65 @@
|
||||
/* $NetBSD: socket.h,v 1.107 2012/06/22 18:26:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)socket.h 8.6 (Berkeley) 5/3/95
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SOCKET_H_
|
||||
#define _SYS_SOCKET_H_
|
||||
|
||||
@@ -73,7 +135,6 @@ typedef _BSD_SSIZE_T_ ssize_t;
|
||||
/* SO_OSNDTIMEO 0x1005 */
|
||||
/* SO_ORCVTIMEO 0x1006 */
|
||||
#define SO_ERROR 0x1007 /* get error status and clear */
|
||||
#define SO_TYPE 0x1008 /* get socket type */
|
||||
#define SO_OVERFLOWED 0x1009 /* datagrams: return packets dropped */
|
||||
|
||||
|
||||
@@ -238,6 +299,10 @@ struct msghdr {
|
||||
int msg_flags; /* flags on received message */
|
||||
};
|
||||
|
||||
#define MSG_OOB 0x0001 /* process out-of-band data */
|
||||
#define MSG_PEEK 0x0002 /* peek at incoming message */
|
||||
#define MSG_DONTROUTE 0x0004 /* send without using routing tables */
|
||||
#define MSG_EOR 0x0008 /* complete record */
|
||||
/*
|
||||
* Header for ancillary data objects in msg_control buffer.
|
||||
* Used for additional information with/about a datagram
|
||||
@@ -319,9 +384,5 @@ int socket(int, int, int);
|
||||
int socketpair(int, int, int, int *);
|
||||
__END_DECLS
|
||||
|
||||
#define MSG_OOB 0x0001 /* process out-of-band data */
|
||||
#define MSG_PEEK 0x0002 /* peek at incoming message */
|
||||
#define MSG_DONTROUTE 0x0004 /* send without using routing tables */
|
||||
#define MSG_EOR 0x0008 /* complete record */
|
||||
|
||||
#endif /* !_SYS_SOCKET_H_ */
|
||||
|
||||
@@ -220,6 +220,7 @@ struct minix_prev_stat {
|
||||
#define MINIX_ST_BLKSIZE PAGE_SIZE
|
||||
#endif
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
@@ -240,4 +241,5 @@ int mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
|
||||
#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_KERNEL && !_STANDALONE */
|
||||
#endif /* !_SYS_STAT_H_ */
|
||||
|
||||
+34
-37
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syslog.h,v 1.32 2008/10/31 16:12:18 christos Exp $ */
|
||||
/* $NetBSD: syslog.h,v 1.35 2012/10/10 22:51:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1993
|
||||
@@ -170,70 +170,67 @@ CODE facilitynames[] = {
|
||||
/* Used by reentrant functions */
|
||||
|
||||
struct syslog_data {
|
||||
int log_version;
|
||||
int log_file;
|
||||
int connected;
|
||||
int opened;
|
||||
int log_connected;
|
||||
int log_opened;
|
||||
int log_stat;
|
||||
const char *log_tag;
|
||||
char log_hostname[256]; /* MAXHOSTNAMELEN */
|
||||
int log_fac;
|
||||
int log_mask;
|
||||
};
|
||||
|
||||
#define SYSLOG_DATA_INIT { \
|
||||
.log_version = 1, \
|
||||
.log_file = -1, \
|
||||
.log_connected = 0, \
|
||||
.log_opened = 0, \
|
||||
.log_stat = 0, \
|
||||
.log_tag = 0, \
|
||||
.log_hostname = { '\0' }, \
|
||||
.log_fac = LOG_USER, \
|
||||
.log_mask = 0xff, \
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two
|
||||
* places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
|
||||
* of them here we may collide with the utility's includes. It's unreasonable
|
||||
* for utilities to have to include one of them to include syslog.h, so we get
|
||||
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
|
||||
*/
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/ansi.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
void closelog(void);
|
||||
void openlog(const char *, int, int);
|
||||
int setlogmask(int);
|
||||
void syslog(int, const char *, ...)
|
||||
__attribute__((__format__(__printf__,2,3)));
|
||||
void syslog(int, const char *, ...) __printflike(2, 3);
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
void vsyslog(int, const char *, _BSD_VA_LIST_)
|
||||
__attribute__((__format__(__printf__,2,0)));
|
||||
void closelog_r(struct syslog_data *);
|
||||
void openlog_r(const char *, int, int, struct syslog_data *);
|
||||
int setlogmask_r(int, struct syslog_data *);
|
||||
void vsyslog(int, const char *, __va_list) __printflike(2, 0);
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
void closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
|
||||
void openlog_r(const char *, int, int, struct syslog_data *)
|
||||
__RENAME(__openlog_r60);
|
||||
int setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
|
||||
void syslog_r(int, struct syslog_data *, const char *, ...)
|
||||
__attribute__((__format__(__printf__,3,4)));
|
||||
void vsyslog_r(int, struct syslog_data *, const char *, _BSD_VA_LIST_)
|
||||
__attribute__((__format__(__printf__,3,0)));
|
||||
void syslogp(int, const char *, const char *, const char *, ...)
|
||||
__attribute__((__format__(__printf__,4,5)));
|
||||
void vsyslogp(int, const char *, const char *, const char *, _BSD_VA_LIST_)
|
||||
__attribute__((__format__(__printf__,4,0)));
|
||||
void syslogp_r(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, ...)
|
||||
__attribute__((__format__(__printf__,5,6)));
|
||||
void vsyslogp_r(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, _BSD_VA_LIST_)
|
||||
__attribute__((__format__(__printf__,5,0)));
|
||||
__RENAME(__syslog_r60) __printflike(3, 4);
|
||||
void vsyslog_r(int, struct syslog_data *, const char *, __va_list)
|
||||
__RENAME(__vsyslog_r60) __printflike(3, 0);
|
||||
void syslogp_r(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, ...) __RENAME(__syslogp_r60) __printflike(5, 6);
|
||||
void vsyslogp_r(int, struct syslog_data *, const char *, const char *,
|
||||
const char *, __va_list) __RENAME(__vsyslogp_r60) __printflike(5, 0);
|
||||
#endif
|
||||
void syslogp(int, const char *, const char *, const char *, ...)
|
||||
__printflike(4, 5);
|
||||
void vsyslogp(int, const char *, const char *, const char *, __va_list)
|
||||
__printflike(4, 0);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#else /* !_KERNEL */
|
||||
|
||||
void logpri(int);
|
||||
void log(int, const char *, ...)
|
||||
__attribute__((__format__(__printf__,2,3)));
|
||||
void vlog(int, const char *, _BSD_VA_LIST_)
|
||||
__attribute__((__format__(__printf__,2,0)));
|
||||
void addlog(const char *, ...)
|
||||
__attribute__((__format__(__printf__,1,2)));
|
||||
void log(int, const char *, ...) __printflike(2, 3);
|
||||
void vlog(int, const char *, __va_list) __printflike(2, 0);
|
||||
void addlog(const char *, ...) __printflike(1, 2);
|
||||
void logwakeup(void);
|
||||
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/* $NetBSD: tls.h,v 1.1 2011/03/09 23:10:07 joerg Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Joerg Sonnenberger.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE 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_TLS_H_
|
||||
#define _SYS_TLS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <machine/types.h>
|
||||
|
||||
#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
|
||||
|
||||
#if defined(__HAVE_TLS_VARIANT_I) && defined(__HAVE_TLS_VARIANT_II)
|
||||
#error Only one TLS variant can be supported at a time
|
||||
#endif
|
||||
|
||||
struct tls_tcb {
|
||||
#ifdef __HAVE_TLS_VARIANT_I
|
||||
void **tcb_dtv;
|
||||
void *tcb_pthread;
|
||||
#else
|
||||
void *tcb_self;
|
||||
void **tcb_dtv;
|
||||
void *tcb_pthread;
|
||||
#endif
|
||||
};
|
||||
|
||||
__BEGIN_PUBLIC_DECLS
|
||||
struct tls_tcb *_rtld_tls_allocate(void);
|
||||
void _rtld_tls_free(struct tls_tcb *);
|
||||
void _rtld_tls_static_setup(void);
|
||||
__END_PUBLIC_DECLS
|
||||
#endif /* __HAVE_TLS_VARIANT_I || __HAVE_TLS_VARIANT_II */
|
||||
|
||||
#endif /* _SYS_TLS_H_ */
|
||||
+5
-5
@@ -117,11 +117,11 @@ typedef u32_t big_uid_t;
|
||||
|
||||
#ifdef _MINIX
|
||||
/* some Minix specific types that do not conflict with posix */
|
||||
typedef u32_t zone_t; /* zone number */
|
||||
typedef u32_t block_t; /* block number */
|
||||
typedef u32_t bit_t; /* bit number in a bit map */
|
||||
typedef u16_t zone1_t; /* zone number for V1 file systems */
|
||||
typedef u32_t bitchunk_t; /* collection of bits in a bitmap */
|
||||
typedef uint32_t zone_t; /* zone number */
|
||||
typedef uint32_t block_t; /* block number */
|
||||
typedef uint32_t bit_t; /* bit number in a bit map */
|
||||
typedef uint16_t zone1_t; /* zone number for V1 file systems */
|
||||
typedef uint32_t bitchunk_t; /* collection of bits in a bitmap */
|
||||
#endif
|
||||
|
||||
/* ANSI C makes writing down the promotion of unsigned types very messy. When
|
||||
|
||||
@@ -50,6 +50,16 @@ struct ucred
|
||||
gid_t gid;
|
||||
};
|
||||
|
||||
#ifdef __minix
|
||||
/* LSC FIXME: Remove this! Compatibility thing, only used in pfs/uds.c */
|
||||
struct ucred_old
|
||||
{
|
||||
pid_t pid;
|
||||
short uid;
|
||||
char gid;
|
||||
};
|
||||
#endif /* def __minix */
|
||||
|
||||
/* Userland's view of credentials. This should not change */
|
||||
struct uucred {
|
||||
unsigned short cr_unused; /* not used, compat */
|
||||
|
||||
Reference in New Issue
Block a user