From 1657c5c54c507bfb1ea3c4406026619eb2f46697 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Mon, 3 Oct 2016 12:32:09 +0200
Subject: [PATCH 6/6] WIP remove COMPAT_43

---
 sys/bus/pci/pci_user.c                   |   2 -
 sys/bus/u4b/input/ukbd.c                 |  44 ---
 sys/bus/u4b/input/ukbd/Makefile          |   2 +-
 sys/conf/files                           |   9 -
 sys/conf/options                         |   1 -
 sys/config/LINT64                        |   7 -
 sys/config/VKERNEL64                     |   1 -
 sys/config/X86_64_GENERIC                |   1 -
 sys/dev/drm/radeon/Makefile              |   1 -
 sys/dev/misc/nmdm/Makefile               |   4 -
 sys/dev/misc/nmdm/nmdm.c                 |   4 -
 sys/dev/raid/mps/Makefile                |   2 +-
 sys/dev/raid/mps/mps_user.c              |   2 -
 sys/dev/serial/digi/Makefile             |   4 -
 sys/dev/serial/digi/digi.c               |  17 -
 sys/dev/serial/rp/rp.c                   |  12 -
 sys/dev/serial/si/si_drv.c               |  25 --
 sys/dev/serial/sio/sio.c                 |  17 +-
 sys/emulation/43bsd/43bsd_exit.c         |  73 -----
 sys/emulation/43bsd/43bsd_file.c         | 205 ------------
 sys/emulation/43bsd/43bsd_hostinfo.c     | 331 -------------------
 sys/emulation/43bsd/43bsd_resource.c     |  98 ------
 sys/emulation/43bsd/43bsd_signal.c       | 180 -----------
 sys/emulation/43bsd/43bsd_socket.c       | 537 -------------------------------
 sys/emulation/43bsd/43bsd_socket.h       |  49 ---
 sys/emulation/43bsd/43bsd_stats.c        | 147 ---------
 sys/emulation/43bsd/43bsd_vm.c           | 117 -------
 sys/emulation/43bsd/stat.h               |  61 ----
 sys/kern/init_sysent.c                   |  10 -
 sys/kern/kern_descrip.c                  |   1 -
 sys/kern/kern_exit.c                     |   1 -
 sys/kern/kern_prot.c                     |  13 -
 sys/kern/kern_resource.c                 |   2 -
 sys/kern/makesyscalls.sh                 |  17 +-
 sys/kern/syscalls.c                      |   2 -
 sys/kern/syscalls.master                 |   4 -
 sys/kern/sysv_shm.c                      |   1 -
 sys/kern/tty.c                           |  18 --
 sys/kern/tty_compat.c                    | 468 ---------------------------
 sys/kern/tty_conf.c                      |  10 +-
 sys/kern/tty_pty.c                       |  18 --
 sys/kern/uipc_syscalls.c                 |   1 +
 sys/net/if.c                             |  65 ----
 sys/netinet/tcp_subr.c                   |   1 -
 sys/netinet/tcp_timer.c                  |   2 -
 sys/platform/pc64/x86_64/exception.S     |   2 +-
 sys/platform/pc64/x86_64/machdep.c       |   1 -
 sys/platform/vkernel64/x86_64/cpu_regs.c |   1 -
 sys/sys/ioctl.h                          |   3 +-
 sys/sys/sysproto.h                       |  12 -
 sys/sys/sysunion.h                       |  80 -----
 usr.bin/kdump/mkioctls                   |   1 -
 52 files changed, 8 insertions(+), 2679 deletions(-)
 delete mode 100644 sys/emulation/43bsd/43bsd_exit.c
 delete mode 100644 sys/emulation/43bsd/43bsd_file.c
 delete mode 100644 sys/emulation/43bsd/43bsd_hostinfo.c
 delete mode 100644 sys/emulation/43bsd/43bsd_resource.c
 delete mode 100644 sys/emulation/43bsd/43bsd_signal.c
 delete mode 100644 sys/emulation/43bsd/43bsd_socket.c
 delete mode 100644 sys/emulation/43bsd/43bsd_socket.h
 delete mode 100644 sys/emulation/43bsd/43bsd_stats.c
 delete mode 100644 sys/emulation/43bsd/43bsd_vm.c
 delete mode 100644 sys/emulation/43bsd/stat.h
 delete mode 100644 sys/kern/tty_compat.c

diff --git a/sys/bus/pci/pci_user.c b/sys/bus/pci/pci_user.c
index bc63a3b..2e9450e 100644
--- a/sys/bus/pci/pci_user.c
+++ b/sys/bus/pci/pci_user.c
@@ -26,8 +26,6 @@
  * $FreeBSD: src/sys/dev/pci/pci_user.c,v 1.22.2.4.2.1 2009/04/15 03:14:26 kensmith Exp $
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
diff --git a/sys/bus/u4b/input/ukbd.c b/sys/bus/u4b/input/ukbd.c
index dc1dc69..3344aa1 100644
--- a/sys/bus/u4b/input/ukbd.c
+++ b/sys/bus/u4b/input/ukbd.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD: head/sys/dev/usb/input/ukbd.c 262972 2014-03-10 08:52:30Z hs
  * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf
  */
 
-#include "opt_compat.h"
 #include "opt_kbd.h"
 #include "opt_ukbd.h"
 
@@ -1788,27 +1787,11 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
 {
 	struct ukbd_softc *sc = kbd->kb_data;
 	int i;
-#if 0 /* XXX */
-#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
-    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
-	int ival;
-
-#endif
-#endif
 
 	switch (cmd) {
 	case KDGKBMODE:		/* get keyboard mode */
 		*(int *)arg = sc->sc_mode;
 		break;
-#if 0 /* XXX */
-#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
-    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
-	case _IO('K', 7):
-		ival = IOCPARM_IVAL(arg);
-		arg = (caddr_t)&ival;
-		/* FALLTHROUGH */
-#endif
-#endif
 	case KDSKBMODE:		/* set keyboard mode */
 		switch (*(int *)arg) {
 		case K_XLATE:
@@ -1834,15 +1817,6 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
 	case KDGETLED:			/* get keyboard LED */
 		*(int *)arg = KBD_LED_VAL(kbd);
 		break;
-#if 0 /* XXX */
-#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
-    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
-	case _IO('K', 66):
-		ival = IOCPARM_IVAL(arg);
-		arg = (caddr_t)&ival;
-		/* FALLTHROUGH */
-#endif
-#endif
 	case KDSETLED:			/* set keyboard LED */
 		/* NOTE: lock key state in "sc_state" won't be changed */
 		if (*(int *)arg & ~LOCK_MASK)
@@ -1866,15 +1840,6 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
 	case KDGKBSTATE:		/* get lock key state */
 		*(int *)arg = sc->sc_state & LOCK_MASK;
 		break;
-#if 0 /* XXX */
-#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
-    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
-	case _IO('K', 20):
-		ival = IOCPARM_IVAL(arg);
-		arg = (caddr_t)&ival;
-		/* FALLTHROUGH */
-#endif
-#endif
 	case KDSKBSTATE:		/* set lock key state */
 		if (*(int *)arg & ~LOCK_MASK) {
 			return (EINVAL);
@@ -1903,15 +1868,6 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
 		kbd->kb_delay2 = ((int *)arg)[1];
 		return (0);
 
-#if 0 /* XXX */
-#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
-    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
-	case _IO('K', 67):
-		ival = IOCPARM_IVAL(arg);
-		arg = (caddr_t)&ival;
-		/* FALLTHROUGH */
-#endif
-#endif
 	case KDSETRAD:			/* set keyboard repeat rate (old
 					 * interface) */
 		return (ukbd_set_typematic(kbd, *(int *)arg));
diff --git a/sys/bus/u4b/input/ukbd/Makefile b/sys/bus/u4b/input/ukbd/Makefile
index b645d97..f8e4542 100644
--- a/sys/bus/u4b/input/ukbd/Makefile
+++ b/sys/bus/u4b/input/ukbd/Makefile
@@ -3,7 +3,7 @@
 KMOD=	ukbd
 
 SRCS=	bus_if.h device_if.h usb_if.h \
-	opt_bus.h opt_compat.h opt_kbd.h opt_ukbd.h opt_usb.h \
+	opt_bus.h opt_kbd.h opt_ukbd.h opt_usb.h \
 	ukbd.c
 
 .include <bsd.kmod.mk>
diff --git a/sys/conf/files b/sys/conf/files
index 5217e1e..c7e63fb 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1192,7 +1192,6 @@ kern/sysv_msg.c		standard
 kern/sysv_sem.c		standard
 kern/sysv_shm.c		standard
 kern/tty.c		standard
-kern/tty_compat.c	optional compat_43
 kern/tty_conf.c		standard
 kern/tty_cons.c		standard
 kern/tty_pty.c		optional pty
@@ -2241,14 +2240,6 @@ dev/powermng/lm/lm78.c			optional lm isa
 dev/powermng/lm/lm78_isa.c		optional lm isa
 dev/powermng/uguru/uguru.c		optional uguru isa
 dev/powermng/wbsio/wbsio.c		optional wbsio isa
-emulation/43bsd/43bsd_socket.c		optional compat_43
-emulation/43bsd/43bsd_stats.c		optional compat_43
-emulation/43bsd/43bsd_file.c		optional compat_43
-emulation/43bsd/43bsd_signal.c		optional compat_43
-emulation/43bsd/43bsd_exit.c		optional compat_43
-emulation/43bsd/43bsd_resource.c	optional compat_43
-emulation/43bsd/43bsd_hostinfo.c	optional compat_43
-emulation/43bsd/43bsd_vm.c		optional compat_43
 
 # OS ACPI MI code
 ${OSACPI_MI_DIR}/acpi.c			optional acpi
diff --git a/sys/conf/options b/sys/conf/options
index d9abdcc..e2cffe0 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -74,7 +74,6 @@ ACPI_NO_SEMAPHORES	opt_acpi.h
 ACPI_ENABLE_PCI		opt_acpi.h
 
 # Miscellaneous options.
-COMPAT_43	opt_compat.h
 COMPILING_LINT	opt_lint.h
 DDB
 DDB_TRACE
diff --git a/sys/config/LINT64 b/sys/config/LINT64
index 59a94dd..c957bc2 100644
--- a/sys/config/LINT64
+++ b/sys/config/LINT64
@@ -119,13 +119,6 @@ options 	CPU_DISABLE_AVX
 #####################################################################
 # COMPATIBILITY OPTIONS
 
-#
-# Implement system calls compatible with 4.3BSD and older versions of
-# FreeBSD.  You probably do NOT want to remove this as much current code
-# still relies on the 4.3 emulation.
-#
-options 	COMPAT_43
-
 # Enable NDIS binary driver support
 options 	NDISAPI
 device		ndis
diff --git a/sys/config/VKERNEL64 b/sys/config/VKERNEL64
index e01923b..cec557f 100644
--- a/sys/config/VKERNEL64
+++ b/sys/config/VKERNEL64
@@ -53,7 +53,6 @@ options 	NFS_ROOT		#NFS usable as root device, NFS required
 options 	MSDOSFS			#MSDOS Filesystem
 options 	CD9660			#ISO 9660 Filesystem
 options 	PROCFS			#Process filesystem
-#options 	COMPAT_43		#Compatible with BSD 4.3
 options 	UCONSOLE		#Allow users to grab the console
 options 	KTRACE			#ktrace(1) support
 options 	_KPOSIX_PRIORITY_SCHEDULING
diff --git a/sys/config/X86_64_GENERIC b/sys/config/X86_64_GENERIC
index f92dfc0..c94e874 100644
--- a/sys/config/X86_64_GENERIC
+++ b/sys/config/X86_64_GENERIC
@@ -30,7 +30,6 @@ options 	NFS_ROOT		#NFS usable as root device, NFS required
 options 	MSDOSFS			#MSDOS Filesystem
 options 	CD9660			#ISO 9660 Filesystem
 options 	PROCFS			#Process filesystem
-#options 	COMPAT_43		#Compatible with BSD 4.3
 options 	SCSI_DELAY=5000		#Delay (in ms) before probing SCSI
 options		IFPOLL_ENABLE		# Support mixed interrupt-polling
 					# handling of network device drivers
diff --git a/sys/dev/drm/radeon/Makefile b/sys/dev/drm/radeon/Makefile
index 417901b..462f291 100644
--- a/sys/dev/drm/radeon/Makefile
+++ b/sys/dev/drm/radeon/Makefile
@@ -134,7 +134,6 @@ SRCS	+=								\
 
 SRCS	+=								\
 	opt_acpi.h							\
-	opt_compat.h							\
 	opt_drm.h							\
 	opt_ktr.h							\
 	acpi_if.h							\
diff --git a/sys/dev/misc/nmdm/Makefile b/sys/dev/misc/nmdm/Makefile
index 4d95534..729e06f 100644
--- a/sys/dev/misc/nmdm/Makefile
+++ b/sys/dev/misc/nmdm/Makefile
@@ -2,9 +2,5 @@
 
 KMOD=	nmdm
 SRCS=	nmdm.c
-SRCS+=	opt_compat.h
-
-opt_compat.h:
-	echo "#define COMPAT_43 1" >${.TARGET}
 
 .include <bsd.kmod.mk>
diff --git a/sys/dev/misc/nmdm/nmdm.c b/sys/dev/misc/nmdm/nmdm.c
index 96642a8..cf361a3 100644
--- a/sys/dev/misc/nmdm/nmdm.c
+++ b/sys/dev/misc/nmdm/nmdm.c
@@ -39,12 +39,8 @@
 /*
  * Pseudo-nulmodem Driver
  */
-#include "opt_compat.h"
 #include <sys/param.h>
 #include <sys/systm.h>
-#if defined(COMPAT_43)
-#include <sys/ioctl_compat.h>
-#endif
 #include <sys/proc.h>
 #include <sys/priv.h>
 #include <sys/thread2.h>
diff --git a/sys/dev/raid/mps/Makefile b/sys/dev/raid/mps/Makefile
index a8dc33d..c9a623e 100644
--- a/sys/dev/raid/mps/Makefile
+++ b/sys/dev/raid/mps/Makefile
@@ -3,7 +3,7 @@
 KMOD=	mps
 SRCS=	mps_pci.c mps.c mps_sas.c mps_table.c mps_user.c
 SRCS+=	mps_config.c mps_mapping.c mps_sas_lsi.c
-SRCS+=	opt_cam.h opt_compat.h
+SRCS+=	opt_cam.h
 SRCS+=	device_if.h bus_if.h pci_if.h
 
 #CFLAGS += -DMPS_DEBUG
diff --git a/sys/dev/raid/mps/mps_user.c b/sys/dev/raid/mps/mps_user.c
index 8501f19..ba8e274 100644
--- a/sys/dev/raid/mps/mps_user.c
+++ b/sys/dev/raid/mps/mps_user.c
@@ -59,8 +59,6 @@
  * $FreeBSD: src/sys/dev/mps/mps_user.c,v 1.10 2012/01/26 18:17:21 ken Exp $
  */
 
-#include "opt_compat.h"
-
 /* TODO Move headers to mpsvar */
 #include <sys/types.h>
 #include <sys/param.h>
diff --git a/sys/dev/serial/digi/Makefile b/sys/dev/serial/digi/Makefile
index 10b2c43..fba1e5c 100644
--- a/sys/dev/serial/digi/Makefile
+++ b/sys/dev/serial/digi/Makefile
@@ -1,9 +1,5 @@
 KMOD=	digi
 SRCS=	digi.c digi_pci.c digi_bios.c
 SRCS+=	bus_if.h pci_if.h device_if.h
-SRCS+=	opt_compat.h
-
-opt_compat.h:
-	echo "#define COMPAT_43 1" > ${.TARGET}
 
 .include <bsd.kmod.mk>
diff --git a/sys/dev/serial/digi/digi.c b/sys/dev/serial/digi/digi.c
index 1193a2e..d4688fb 100644
--- a/sys/dev/serial/digi/digi.c
+++ b/sys/dev/serial/digi/digi.c
@@ -37,8 +37,6 @@
  *	Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem.
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
@@ -1090,10 +1088,6 @@ digiioctl(struct dev_ioctl_args *ap)
 	struct digi_softc *sc;
 	struct digi_p *port;
 	struct tty *tp;
-#if defined(COMPAT_43)
-	int oldcmd;
-	struct termios term;
-#endif
 
 	mynor = minor(dev);
 	unit = MINOR_TO_UNIT(mynor);
@@ -1271,17 +1265,6 @@ digiioctl(struct dev_ioctl_args *ap)
 	}
 
 	tp = port->tp;
-#if defined(COMPAT_43)
-	term = tp->t_termios;
-	oldcmd = cmd;
-	error = ttsetcompat(tp, &cmd, data, &term);
-	if (error != 0) {
-		lwkt_reltoken(&tty_token);
-		return (error);
-	}
-	if (cmd != oldcmd)
-		data = (caddr_t) & term;
-#endif
 	if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF) {
 		int cc;
 		struct termios *dt;
diff --git a/sys/dev/serial/rp/rp.c b/sys/dev/serial/rp/rp.c
index b3a23ef..10b9784 100644
--- a/sys/dev/serial/rp/rp.c
+++ b/sys/dev/serial/rp/rp.c
@@ -1288,18 +1288,6 @@ rpioctl(struct dev_ioctl_args *ap)
 
 	tp = rp->rp_tty;
 
-#if defined(COMPAT_43)
-	term = tp->t_termios;
-	oldcmd = cmd;
-	error = ttsetcompat(tp, &cmd, data, &term);
-	if(error != 0) {
-		lwkt_reltoken(&tty_token);
-		return(error);
-	}
-	if(cmd != oldcmd) {
-		data = (caddr_t)&term;
-	}
-#endif
 	if((cmd == TIOCSETA) || (cmd == TIOCSETAW) || (cmd == TIOCSETAF)) {
 		int	cc;
 		struct	termios *dt = (struct termios *)data;
diff --git a/sys/dev/serial/si/si_drv.c b/sys/dev/serial/si/si_drv.c
index cc21700..0129a23 100644
--- a/sys/dev/serial/si/si_drv.c
+++ b/sys/dev/serial/si/si_drv.c
@@ -41,14 +41,10 @@ static const char si_copyright1[] =  "@(#) Copyright (C) Specialix International
 		  si_copyright3[] =  "@(#) Copyright (C) Peter Wemm 2000";
 #endif	/* not lint */
 
-#include "opt_compat.h"
 #include "opt_debug_si.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#if defined(COMPAT_43)
-#include <sys/ioctl_compat.h>
-#endif
 #include <sys/tty.h>
 #include <sys/proc.h>
 #include <sys/priv.h>
@@ -970,10 +966,6 @@ siioctl(struct dev_ioctl_args *ap)
 	int error;
 	int mynor = minor(dev);
 	int blocked = 0;
-#if defined(COMPAT_43)
-	u_long oldcmd;
-	struct termios term;
-#endif
 
 	if (IS_SI_IOCTL(cmd))
 		return(si_Sioctl(dev, cmd, data, ap->a_fflag, ap->a_cred));
@@ -1026,20 +1018,6 @@ siioctl(struct dev_ioctl_args *ap)
 		}
 	}
 	/*
-	 * Do the old-style ioctl compat routines...
-	 */
-#if defined(COMPAT_43)
-	term = tp->t_termios;
-	oldcmd = cmd;
-	error = ttsetcompat(tp, &cmd, data, &term);
-	if (error != 0) {
-		lwkt_reltoken(&tty_token);
-		return (error);
-	}
-	if (cmd != oldcmd)
-		data = (caddr_t)&term;
-#endif
-	/*
 	 * Do the initial / lock state business
 	 */
 	if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF) {
@@ -1074,9 +1052,6 @@ siioctl(struct dev_ioctl_args *ap)
 	case TIOCSETAW:
 	case TIOCSETAF:
 	case TIOCDRAIN:
-#ifdef COMPAT_43
-	case TIOCSETP:
-#endif
 		blocked++;	/* block writes for ttywait() and siparam() */
 		si_write_enable(pp, 0);
 	}
diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c
index ccf1022..e34ba28 100644
--- a/sys/dev/serial/sio/sio.c
+++ b/sys/dev/serial/sio/sio.c
@@ -34,7 +34,6 @@
  */
 
 #include "opt_comconsole.h"
-#include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_sio.h"
 #include "use_pci.h"
@@ -2011,10 +2010,7 @@ sioioctl(struct dev_ioctl_args *ap)
 	int		error;
 	int		mynor;
 	struct tty	*tp;
-#if defined(COMPAT_43)
-	u_long		oldcmd;
-	struct termios	term;
-#endif
+
 	lwkt_gettoken(&tty_token);
 	mynor = minor(dev);
 
@@ -2065,17 +2061,6 @@ sioioctl(struct dev_ioctl_args *ap)
 		}
 	}
 	tp = com->tp;
-#if defined(COMPAT_43)
-	term = tp->t_termios;
-	oldcmd = ap->a_cmd;
-	error = ttsetcompat(tp, &ap->a_cmd, data, &term);
-	if (error != 0) {
-		lwkt_reltoken(&tty_token);
-		return (error);
-	}
-	if (ap->a_cmd != oldcmd)
-		data = (caddr_t)&term;
-#endif
 	if (ap->a_cmd == TIOCSETA || ap->a_cmd == TIOCSETAW ||
 	    ap->a_cmd == TIOCSETAF) {
 		int	cc;
diff --git a/sys/emulation/43bsd/43bsd_exit.c b/sys/emulation/43bsd/43bsd_exit.c
deleted file mode 100644
index ac08a30..0000000
--- a/sys/emulation/43bsd/43bsd_exit.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 43BSD_EXIT.C		- 4.3BSD compatibility exit syscalls
- *
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_exit.c,v 1.2 2006/06/05 07:26:07 dillon Exp $
- *	from: DragonFly kern/kern_exit.c,v 1.26
- *
- * These syscalls used to live in kern/kern_exit.c.  They are modified
- * to use the new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/kern_syscall.h>
-#include <sys/proc.h>
-#include <sys/wait.h>
-
-/*
- * owait()
- *
- * owait_args(int dummy)
- *
- * MPSAFE
- */
-int
-sys_owait(struct owait_args *uap)
-{
-	int error, status;
-	int res = 0;
-
-	error = kern_wait(WAIT_ANY, &status, 0, NULL, &res);
-	uap->sysmsg_fds[0] = res;
-
-	if (error == 0)
-		uap->sysmsg_fds[1] = status;
-	return (error);
-}
diff --git a/sys/emulation/43bsd/43bsd_file.c b/sys/emulation/43bsd/43bsd_file.c
deleted file mode 100644
index d137a1d..0000000
--- a/sys/emulation/43bsd/43bsd_file.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 43BSD_FILE.C		- 4.3BSD compatibility file syscalls
- *
- * Copyright (c) 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * These syscalls used to live in kern/vfs_syscalls.c.  They are modified
- * to use the new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/conf.h>
-#include <sys/dirent.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/kernel.h>
-#include <sys/kern_syscall.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/uio.h>
-#include <sys/namei.h>
-#include <sys/nlookup.h>
-#include <sys/vnode.h>
-
-#include <sys/mplock2.h>
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ocreat(struct ocreat_args *uap)
-{
-	struct nlookupdata nd;
-	int error;
-
-	get_mplock();
-	error = nlookup_init(&nd, uap->path, UIO_USERSPACE, NLC_FOLLOW);
-	if (error == 0) {
-		error = kern_open(&nd, O_WRONLY | O_CREAT | O_TRUNC, 
-				    uap->mode, &uap->sysmsg_iresult);
-	}
-	rel_mplock();
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_oftruncate(struct oftruncate_args *uap)
-{
-	int error;
-
-	get_mplock();
-	error = kern_ftruncate(uap->fd, uap->length);
-	rel_mplock();
-
-	return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_olseek(struct olseek_args *uap)
-{
-	int error;
-
-	error = kern_lseek(uap->fd, uap->offset, uap->whence,
-			   &uap->sysmsg_offset);
-
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_otruncate(struct otruncate_args *uap)
-{
-	struct nlookupdata nd;
-	int error;
-
-	get_mplock();
-	error = nlookup_init(&nd, uap->path, UIO_USERSPACE, NLC_FOLLOW);
-	if (error == 0)
-		error = kern_truncate(&nd, uap->length);
-	nlookup_done(&nd);
-	rel_mplock();
-	return (error);
-}
-
-#define	PADDED_SIZE(x)	\
-	((sizeof(struct odirent) + (x) + 1 + 3) & ~3)
-#define	MAX_NAMELEN	255
-
-struct odirent {
-	uint32_t	od_fileno;
-	uint16_t	od_reclen;
-	uint8_t		od_type;
-	uint8_t		od_namlen;
-	char		od_name[];
-};
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ogetdirentries(struct ogetdirentries_args *uap)
-{
-	int error, bytes_transfered;
-	char *buf, *outbuf;
-	size_t len;
-	struct dirent *ndp;
-	struct odirent *destdp;
-	long base;
-
-	if (uap->count > 16384)
-		len = 16384;
-	else
-		len = uap->count;
-
-	buf = kmalloc(len, M_TEMP, M_WAITOK);
-
-	get_mplock();
-	error = kern_getdirentries(uap->fd, buf, len,
-				   &base, &bytes_transfered, UIO_SYSSPACE);
-	rel_mplock();
-
-	if (error) {
-		kfree(buf, M_TEMP);
-		return(error);
-	}
-
-	ndp = (struct dirent *)buf;
-	outbuf = uap->buf;
-	destdp = kmalloc(PADDED_SIZE(MAX_NAMELEN), M_TEMP, M_WAITOK);
-
-	for (; (char *)ndp < buf + bytes_transfered; ndp = _DIRENT_NEXT(ndp)) {
-		if ((char *)_DIRENT_NEXT(ndp) > buf + bytes_transfered)
-			break;
-		if (ndp->d_namlen > MAX_NAMELEN)
-			continue;
-		destdp->od_fileno = ndp->d_ino;
-#if BYTE_ORDER == LITTLE_ENDIAN
-		destdp->od_type = ndp->d_namlen;
-		destdp->od_namlen = ndp->d_type;
-#else
-		destdp->od_type = ndp->d_type;
-		destdp->od_namlen = ndp->d_namlen;
-#endif
-		destdp->od_reclen = PADDED_SIZE(destdp->od_namlen);
-		if (destdp->od_reclen > len)
-			break; /* XXX can not happen */
-		bcopy(ndp->d_name, destdp->od_name, destdp->od_namlen);
-		bzero(destdp->od_name + destdp->od_namlen,
-		    PADDED_SIZE(destdp->od_namlen) - sizeof(*destdp) -
-		    destdp->od_namlen);
-		error = copyout(destdp, outbuf,
-		    PADDED_SIZE(destdp->od_namlen));
-		if (error)
-			break;
-		outbuf += PADDED_SIZE(destdp->od_namlen);
-		len -= PADDED_SIZE(destdp->od_namlen);
-	}
-
-	kfree(destdp, M_TEMP);
-	kfree(buf, M_TEMP);
-	uap->sysmsg_iresult = (int)(outbuf - uap->buf);
-	return (0);
-}
diff --git a/sys/emulation/43bsd/43bsd_hostinfo.c b/sys/emulation/43bsd/43bsd_hostinfo.c
deleted file mode 100644
index c1ab459..0000000
--- a/sys/emulation/43bsd/43bsd_hostinfo.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * 43BSD_HOSTINFO.C	- 4.3BSD compatibility host info syscalls
- *
- * Copyright (c) 1982, 1986, 1989, 1993
- *      The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_hostinfo.c,v 1.4 2006/09/05 00:55:44 dillon Exp $
- *	from: DragonFly kern/kern_xxx.c,v 1.7
- *	from: DragonFly kern/kern_sysctl.c,v 1.12
- *
- * These syscalls used to live in kern/kern_xxx.c and kern/kern_sysctl.c.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/priv.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm_param.h>
-
-int
-sys_ogethostname(struct gethostname_args *uap)
-{
-	size_t len;
-	char *hostname;
-	int error, name[2];
-
-	name[0] = CTL_KERN;
-	name[1] = KERN_HOSTNAME;
-	len = MIN(uap->len, MAXHOSTNAMELEN);
-	hostname = kmalloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
-
-	error = kernel_sysctl(name, 2, hostname, &len, NULL, 0, NULL);
-
-	if (error == 0)
-		error = copyout(hostname, uap->hostname, len);
-
-	kfree(hostname, M_TEMP);
-	return (error);
-}
-
-int
-sys_osethostname(struct sethostname_args *uap)
-{
-	struct thread *td = curthread;
-	size_t len;
-	char *hostname;
-	int name[2];
-	int error;
-
-	name[0] = CTL_KERN;
-	name[1] = KERN_HOSTNAME;
-	error = priv_check_cred(td->td_ucred, PRIV_SETHOSTNAME, 0);
-	if (error)
-		return (error);
-	len = MIN(uap->len, MAXHOSTNAMELEN);
-	hostname = kmalloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
-
-	error = copyin(uap->hostname, hostname, len);
-	if (error) {
-		kfree(hostname, M_TEMP);
-		return (error);
-	}
-
-	error = kernel_sysctl(name, 2, NULL, 0, hostname, len, NULL);
-
-	kfree(hostname, M_TEMP);
-	return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_ogethostid(struct ogethostid_args *uap)
-{
-	uap->sysmsg_lresult = hostid;
-	return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_osethostid(struct osethostid_args *uap)
-{
-	struct thread *td = curthread;
-	int error;
-
-	error = priv_check(td, PRIV_ROOT);
-	if (error)
-		return (error);
-	hostid = uap->hostid;
-	return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_oquota(struct oquota_args *uap)
-{
-	return (ENOSYS);
-}
-
-#define	KINFO_PROC		(0<<8)
-#define	KINFO_RT		(1<<8)
-#define	KINFO_VNODE		(2<<8)
-#define	KINFO_FILE		(3<<8)
-#define	KINFO_METER		(4<<8)
-#define	KINFO_LOADAVG		(5<<8)
-#define	KINFO_CLOCKRATE		(6<<8)
-
-/* Non-standard BSDI extension - only present on their 4.3 net-2 releases */
-#define	KINFO_BSDI_SYSINFO	(101<<8)
-
-/*
- * XXX this is bloat, but I hope it's better here than on the potentially
- * limited kernel stack...  -Peter
- */
-
-static struct {
-	int	bsdi_machine;		/* "i386" on BSD/386 */
-/*      ^^^ this is an offset to the string, relative to the struct start */
-	char	*pad0;
-	long	pad1;
-	long	pad2;
-	long	pad3;
-	u_long	pad4;
-	u_long	pad5;
-	u_long	pad6;
-
-	int	bsdi_ostype;		/* "BSD/386" on BSD/386 */
-	int	bsdi_osrelease;		/* "1.1" on BSD/386 */
-	long	pad7;
-	long	pad8;
-	char	*pad9;
-
-	long	pad10;
-	long	pad11;
-	int	pad12;
-	long	pad13;
-	quad_t	pad14;
-	long	pad15;
-
-	struct	timeval pad16;
-	/* we dont set this, because BSDI's uname used gethostname() instead */
-	int	bsdi_hostname;		/* hostname on BSD/386 */
-
-	/* the actual string data is appended here */
-
-} bsdi_si;
-/*
- * this data is appended to the end of the bsdi_si structure during copyout.
- * The "char *" offsets are relative to the base of the bsdi_si struct.
- * This contains "FreeBSD\02.0-BUILT-nnnnnn\0i386\0", and these strings
- * should not exceed the length of the buffer here... (or else!! :-)
- */
-static char bsdi_strings[80];	/* It had better be less than this! */
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ogetkerninfo(struct getkerninfo_args *uap)
-{
-	int error, name[6];
-	size_t size;
-	u_int needed = 0;
-
-	switch (uap->op & 0xff00) {
-	case KINFO_RT:
-		name[0] = CTL_NET;
-		name[1] = PF_ROUTE;
-		name[2] = 0;
-		name[3] = (uap->op & 0xff0000) >> 16;
-		name[4] = uap->op & 0xff;
-		name[5] = uap->arg;
-		error = userland_sysctl(name, 6, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_VNODE:
-		name[0] = CTL_KERN;
-		name[1] = KERN_VNODE;
-		error = userland_sysctl(name, 2, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_PROC:
-		name[0] = CTL_KERN;
-		name[1] = KERN_PROC;
-		name[2] = uap->op & 0xff;
-		name[3] = uap->arg;
-		error = userland_sysctl(name, 4, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_FILE:
-		name[0] = CTL_KERN;
-		name[1] = KERN_FILE;
-		error = userland_sysctl(name, 2, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_METER:
-		name[0] = CTL_VM;
-		name[1] = VM_METER;
-		error = userland_sysctl(name, 2, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_LOADAVG:
-		name[0] = CTL_VM;
-		name[1] = VM_LOADAVG;
-		error = userland_sysctl(name, 2, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_CLOCKRATE:
-		name[0] = CTL_KERN;
-		name[1] = KERN_CLOCKRATE;
-		error = userland_sysctl(name, 2, uap->where, uap->size,
-			0, 0, 0, &size);
-		break;
-
-	case KINFO_BSDI_SYSINFO: {
-		/*
-		 * this is pretty crude, but it's just enough for uname()
-		 * from BSDI's 1.x libc to work.
-		 * *size gives the size of the buffer before the call, and
-		 * the amount of data copied after a successful call.
-		 * If successful, the return value is the amount of data
-		 * available, which can be larger than *size.
-		 *
-		 * BSDI's 2.x product apparently fails with ENOMEM if
-		 * *size is too small.
-		 */
-
-		u_int left;
-		char *s;
-
-		bzero((char *)&bsdi_si, sizeof(bsdi_si));
-		bzero(bsdi_strings, sizeof(bsdi_strings));
-
-		s = bsdi_strings;
-
-		bsdi_si.bsdi_ostype = (s - bsdi_strings) + sizeof(bsdi_si);
-		strcpy(s, ostype);
-		s += strlen(s) + 1;
-
-		bsdi_si.bsdi_osrelease = (s - bsdi_strings) + sizeof(bsdi_si);
-		strcpy(s, osrelease);
-		s += strlen(s) + 1;
-
-		bsdi_si.bsdi_machine = (s - bsdi_strings) + sizeof(bsdi_si);
-		strcpy(s, machine);
-		s += strlen(s) + 1;
-
-		needed = sizeof(bsdi_si) + (s - bsdi_strings);
-
-		if (uap->where == NULL || (uap->size == NULL)) {
-			/* process is asking how much buffer to supply.. */
-			size = needed;
-			error = 0;
-			break;
-		}
-
-		if ((error = copyin(uap->size, &size, sizeof(size))) != 0)
-				break;
-
-		/* if too much buffer supplied, trim it down */
-		if (size > needed)
-			size = needed;
-
-		/* how much of the buffer is remaining */
-		left = size;
-
-		if ((error = copyout((char *)&bsdi_si, uap->where, left)) != 0)
-			break;
-
-		/* is there any point in continuing? */
-		if (left > sizeof(bsdi_si)) {
-			left -= sizeof(bsdi_si);
-			error = copyout(&bsdi_strings,
-					uap->where + sizeof(bsdi_si), left);
-		}
-		break;
-	}
-	default:
-		error = EOPNOTSUPP;
-		break;
-	}
-
-	if (error)
-		return (error);
-	uap->sysmsg_iresult = (int)size;
-	if (uap->size)
-		error = copyout(&size, uap->size, sizeof(size));
-	return (error);
-}
diff --git a/sys/emulation/43bsd/43bsd_resource.c b/sys/emulation/43bsd/43bsd_resource.c
deleted file mode 100644
index 93f8920..0000000
--- a/sys/emulation/43bsd/43bsd_resource.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 43BSD_RESOURCE.C	- 4.3BSD compatibility exit syscalls
- *
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_resource.c,v 1.2 2006/06/05 07:26:07 dillon Exp $
- *	from: DragonFly kern/kern_resource.c,v 1.14
- *
- * These syscalls used to live in kern/kern_resource.c.  They are modified
- * to use the new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/kern_syscall.h>
-#include <sys/resourcevar.h>
-
-/*
- * MPSAFE
- */
-int
-sys_ogetrlimit(struct ogetrlimit_args *uap)
-{
-	struct orlimit olim;
-	struct rlimit lim;
-	int error;
-
-	error = kern_getrlimit(uap->which, &lim);
-
-	if (error == 0) {
-		olim.rlim_cur = lim.rlim_cur;
-		if (olim.rlim_cur == -1)
-			olim.rlim_cur = 0x7fffffff;
-		olim.rlim_max = lim.rlim_max;
-		if (olim.rlim_max == -1)
-			olim.rlim_max = 0x7fffffff;
-		error = copyout(&olim, uap->rlp, sizeof(*uap->rlp));
-	}
-	return (error);
-
-}
-
-/*
- * MPSAFE
- */
-int
-sys_osetrlimit(struct osetrlimit_args *uap)
-{
-	struct orlimit olim;
-	struct rlimit lim;
-	int error;
-
-	error = copyin(uap->rlp, &olim, sizeof(olim));
-	if (error)
-		return (error);
-	lim.rlim_cur = olim.rlim_cur;
-	lim.rlim_max = olim.rlim_max;
-
-	error = kern_setrlimit(uap->which, &lim);
-
-	return (error);
-
-}
diff --git a/sys/emulation/43bsd/43bsd_signal.c b/sys/emulation/43bsd/43bsd_signal.c
deleted file mode 100644
index 130bbb1..0000000
--- a/sys/emulation/43bsd/43bsd_signal.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 43BSD_SIGNAL.C	- 4.3BSD compatibility signal syscalls
- *
- * Copyright (c) 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_signal.c,v 1.5 2007/03/12 21:07:42 corecode Exp $
- * 	from: DragonFly kern/kern_sig.c,v 1.22
- *
- * These syscalls used to live in kern/kern_sig.c.  They are modified
- * to use the new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/kern_syscall.h>
-#include <sys/proc.h>
-#include <sys/signal.h>
-#include <sys/signalvar.h>
-
-#include <sys/thread2.h>
-
-#define	ONSIG	32		/* NSIG for osig* syscalls.  XXX. */
-
-#define SIG2OSIG(sig, osig)	osig = (sig).__bits[0]
-#define OSIG2SIG(osig, sig)	SIGEMPTYSET(sig); (sig).__bits[0] = osig
-
-#define SIGSETLO(set1, set2)	((set1).__bits[0] = (set2).__bits[0])
-
-/*
- * These syscalls are unncessary because it is next to impossible to
- * find 4.3BSD binaries built for i386.  The current libc has routines
- * which fake the 4.3BSD family of signal syscalls, so anything built
- * from source won't be using these.
- *
- * This file is provided for educational purposes only.  The osigvec()
- * syscall is probably broken because the current signal code uses
- * a different signal trampoline.
- *
- * MPALMOSTSAFE
- */
-int
-sys_osigvec(struct osigvec_args *uap)
-{
-	struct sigvec vec;
-	struct sigaction nsa, osa;
-	struct sigaction *nsap, *osap;
-	int error;
-
-	if (uap->signum <= 0 || uap->signum >= ONSIG)
-		return (EINVAL);
-	nsap = (uap->nsv != NULL) ? &nsa : NULL;
-	osap = (uap->osv != NULL) ? &osa : NULL;
-	if (nsap) {
-		error = copyin(uap->nsv, &vec, sizeof(vec));
-		if (error)
-			return (error);
-		nsap->sa_handler = vec.sv_handler;
-		OSIG2SIG(vec.sv_mask, nsap->sa_mask);
-		nsap->sa_flags = vec.sv_flags;
-		nsap->sa_flags ^= SA_RESTART;	/* opposite of SV_INTERRUPT */
-	}
-
-	error = kern_sigaction(uap->signum, nsap, osap);
-
-	if (osap && !error) {
-		vec.sv_handler = osap->sa_handler;
-		SIG2OSIG(osap->sa_mask, vec.sv_mask);
-		vec.sv_flags = osap->sa_flags;
-		vec.sv_flags &= ~SA_NOCLDWAIT;
-		vec.sv_flags ^= SA_RESTART;
-		error = copyout(&vec, uap->osv, sizeof(vec));
-	}
-	return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_osigblock(struct osigblock_args *uap)
-{
-	struct lwp *lp = curthread->td_lwp;
-	sigset_t set;
-
-	OSIG2SIG(uap->mask, set);
-	SIG_CANTMASK(set);
-	crit_enter();
-	SIG2OSIG(lp->lwp_sigmask, uap->sysmsg_iresult);
-	SIGSETOR(lp->lwp_sigmask, set);
-	crit_exit();
-	return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_osigsetmask(struct osigsetmask_args *uap)
-{
-	struct lwp *lp = curthread->td_lwp;
-	sigset_t set;
-
-	OSIG2SIG(uap->mask, set);
-	SIG_CANTMASK(set);
-	crit_enter();
-	SIG2OSIG(lp->lwp_sigmask, uap->sysmsg_iresult);
-	SIGSETLO(lp->lwp_sigmask, set);
-	crit_exit();
-	return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-sys_osigstack(struct osigstack_args *uap)
-{
-	struct lwp *lp = curthread->td_lwp;
-	struct sigstack ss;
-	int error = 0;
-
-	ss.ss_sp = lp->lwp_sigstk.ss_sp;
-	ss.ss_onstack = lp->lwp_sigstk.ss_flags & SS_ONSTACK;
-	if (uap->oss && (error = copyout(&ss, uap->oss,
-					 sizeof(struct sigstack)))) {
-		return (error);
-	}
-	if (uap->nss && (error = copyin(uap->nss, &ss, sizeof(ss))) == 0) {
-		lp->lwp_sigstk.ss_sp = ss.ss_sp;
-		lp->lwp_sigstk.ss_size = 0;
-		lp->lwp_sigstk.ss_flags |= ss.ss_onstack & SS_ONSTACK;
-		lp->lwp_flags |= LWP_ALTSTACK;
-	}
-	return (error);
-}
-
-int
-sys_okillpg(struct okillpg_args *uap)
-{
-	int error;
-
-	error = kern_kill(uap->signum, -uap->pgid, -1);
-
-	return (error);
-}
diff --git a/sys/emulation/43bsd/43bsd_socket.c b/sys/emulation/43bsd/43bsd_socket.c
deleted file mode 100644
index b60c9d6..0000000
--- a/sys/emulation/43bsd/43bsd_socket.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * 43BSD_SOCKET.C	- 4.3BSD compatibility socket syscalls
- *
- * Copyright (c) 1982, 1986, 1989, 1990, 1993
- *      The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The original versions of these syscalls used to live in
- * kern/uipc_syscalls.c.  These are heavily modified to use the
- * new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/sysproto.h>
-#include <sys/kern_syscall.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/uio.h>
-
-#include <sys/mplock2.h>
-
-#include "43bsd_socket.h"
-
-/*
- * System call interface to the socket abstraction.
- */
-
-static int
-compat_43_getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len)
-{
-	struct sockaddr *sa;
-	int error;
-
-	*namp = NULL;
-	if (len > SOCK_MAXADDRLEN)
-		return ENAMETOOLONG;
-	if (len < offsetof(struct sockaddr, sa_data[0]))
-		return EDOM;
-	sa = kmalloc(len, M_SONAME, M_WAITOK);
-	error = copyin(uaddr, sa, len);
-	if (error) {
-		kfree(sa, M_SONAME);
-	} else {
-		/*
-		 * Convert to the 4.4BSD sockaddr structure.
-		 */
-		sa->sa_family = sa->sa_len;
-		sa->sa_len = len;
-		*namp = sa;
-	}
-	return error;
-}
-
-static int
-compat_43_copyout_sockaddr(struct sockaddr *sa, caddr_t uaddr, int sa_len)
-{
-	int error;
-
-	((struct osockaddr *)sa)->sa_family = sa->sa_family;
-	error = copyout(sa, uaddr, sa_len);
-
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_oaccept(struct accept_args *uap)
-{
-	struct sockaddr *sa = NULL;
-	int sa_len;
-	int error;
-
-	if (uap->name) {
-		error = copyin(uap->anamelen, &sa_len, sizeof(sa_len));
-		if (error)
-			return (error);
-
-		get_mplock();
-		error = kern_accept(uap->s, 0, &sa, &sa_len,
-				    &uap->sysmsg_iresult, 0);
-		rel_mplock();
-
-		if (error) {
-			/*
-			 * return a namelen of zero for older code which
-			 * might ignore the return value from accept.
-			 */
-			sa_len = 0;
-			copyout(&sa_len, uap->anamelen, sizeof(*uap->anamelen));
-		} else {
-			compat_43_copyout_sockaddr(sa, uap->name, sa_len);
-			if (error == 0) {
-				error = copyout(&sa_len, uap->anamelen,
-				    sizeof(*uap->anamelen));
-			}
-		}
-		if (sa)
-			kfree(sa, M_SONAME);
-	} else {
-		get_mplock();
-		error = kern_accept(uap->s, 0, NULL, 0, &uap->sysmsg_iresult, 0);
-		rel_mplock();
-	}
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ogetsockname(struct getsockname_args *uap)
-{
-	struct sockaddr *sa = NULL;
-	int error, sa_len;
-
-	error = copyin(uap->alen, &sa_len, sizeof(sa_len));
-	if (error)
-		return (error);
-
-	get_mplock();
-	error = kern_getsockname(uap->fdes, &sa, &sa_len);
-	rel_mplock();
-
-	if (error == 0)
-		error = compat_43_copyout_sockaddr(sa, uap->asa, sa_len);
-	if (error == 0) {
-		error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
-	}
-	if (sa)
-		kfree(sa, M_SONAME);
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ogetpeername(struct ogetpeername_args *uap)
-{
-	struct sockaddr *sa = NULL;
-	int error, sa_len;
-
-	error = copyin(uap->alen, &sa_len, sizeof(sa_len));
-	if (error)
-		return (error);
-
-	get_mplock();
-	error = kern_getpeername(uap->fdes, &sa, &sa_len);
-	rel_mplock();
-
-	if (error == 0) {
-		error = compat_43_copyout_sockaddr(sa, uap->asa, sa_len);
-	}
-	if (error == 0)
-		error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
-	if (sa)
-		kfree(sa, M_SONAME);
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_osend(struct osend_args *uap)
-{
-	struct thread *td = curthread;
-	struct uio auio;
-	struct iovec aiov;
-	int error;
-
-	aiov.iov_base = uap->buf;
-	aiov.iov_len = uap->len;
-	auio.uio_iov = &aiov;
-	auio.uio_iovcnt = 1;
-	auio.uio_offset = 0;
-	auio.uio_resid = uap->len;
-	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_rw = UIO_WRITE;
-	auio.uio_td = td;
-
-	get_mplock();
-	error = kern_sendmsg(uap->s, NULL, &auio, NULL, uap->flags,
-			     &uap->sysmsg_szresult);
-	rel_mplock();
-
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_osendmsg(struct osendmsg_args *uap)
-{
-	struct thread *td = curthread;
-	struct msghdr msg;
-	struct uio auio;
-	struct iovec aiov[UIO_SMALLIOV], *iov = NULL;
-	struct sockaddr *sa = NULL;
-	struct mbuf *control = NULL;
-	struct cmsghdr *cm;
-	int error;
-
-	error = copyin(uap->msg, (caddr_t)&msg, sizeof (msg));
-	if (error)
-		return (error);
-
-	/*
-	 * Conditionally copyin msg.msg_name.
-	 */
-	if (msg.msg_name) {
-		error = compat_43_getsockaddr(&sa, msg.msg_name,
-		    msg.msg_namelen);
-		if (error)
-			return (error);
-	}
-
-	/*
-	 * Populate auio.
-	 */
-	error = iovec_copyin(msg.msg_iov, &iov, aiov, msg.msg_iovlen,
-			     &auio.uio_resid);
-	if (error)
-		goto cleanup2;
-	auio.uio_iov = iov;
-	auio.uio_iovcnt = msg.msg_iovlen;
-	auio.uio_offset = 0;
-	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_rw = UIO_WRITE;
-	auio.uio_td = td;
-
-	/*
-	 * Conditionally copyin msg.msg_control.
-	 */
-	if (msg.msg_control) {
-		if (msg.msg_controllen < 0 || msg.msg_controllen > MLEN) {
-			error = EINVAL;
-			goto cleanup;
-		}
-		control = m_get(M_WAITOK, MT_CONTROL);
-		if (control == NULL) {
-			error = ENOBUFS;
-			goto cleanup;
-		}
-		control->m_len = msg.msg_controllen;
-		error = copyin(msg.msg_control, mtod(control, caddr_t),
-		    msg.msg_controllen);
-		if (error) {
-			m_free(control);
-			goto cleanup;
-		}
-		/*
-		 * In 4.3BSD, the only type of ancillary data was
-		 * access rights and this data did not use a header
-		 * to identify it's type.  Thus, we must prepend the
-		 * control data with the proper cmsghdr structure
-		 * so that the kernel recognizes it as access rights.
-		 */
-		M_PREPEND(control, sizeof(*cm), M_WAITOK);
-		if (control == NULL) {
-			error = ENOBUFS;
-			goto cleanup;
-		}
-		cm = mtod(control, struct cmsghdr *);
-		cm->cmsg_len = control->m_len;
-		cm->cmsg_level = SOL_SOCKET;
-		cm->cmsg_type = SCM_RIGHTS;
-	}
-
-	get_mplock();
-	error = kern_sendmsg(uap->s, sa, &auio, control, uap->flags,
-			     &uap->sysmsg_szresult);
-	rel_mplock();
-
-cleanup:
-	iovec_free(&iov, aiov);
-cleanup2:
-	if (sa)
-		kfree(sa, M_SONAME);
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_orecv(struct orecv_args *uap)
-{
-	struct thread *td = curthread;
-	struct uio auio;
-	struct iovec aiov;
-	int error;
-
-	aiov.iov_base = uap->buf;
-	aiov.iov_len = uap->len;
-	auio.uio_iov = &aiov;
-	auio.uio_iovcnt = 1;
-	auio.uio_offset = 0;
-	auio.uio_resid = uap->len;
-	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_rw = UIO_READ;
-	auio.uio_td = td;
-
-	get_mplock();
-	error = kern_recvmsg(uap->s, NULL, &auio, NULL, &uap->flags,
-			     &uap->sysmsg_szresult);
-	rel_mplock();
-
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_orecvfrom(struct recvfrom_args *uap)
-{
-	struct thread *td = curthread;
-	struct uio auio;
-	struct iovec aiov;
-	struct sockaddr *sa = NULL;
-	int error, fromlen;
-
-	if (uap->from && uap->fromlenaddr) {
-		error = copyin(uap->fromlenaddr, &fromlen, sizeof(fromlen));
-		if (error)
-			return (error);
-		if (fromlen < 0)
-			return (EINVAL);
-	} else {
-		fromlen = 0;
-	}
-	aiov.iov_base = uap->buf;
-	aiov.iov_len = uap->len;
-	auio.uio_iov = &aiov;
-	auio.uio_iovcnt = 1;
-	auio.uio_offset = 0;
-	auio.uio_resid = uap->len;
-	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_rw = UIO_READ;
-	auio.uio_td = td;
-
-	get_mplock();
-	error = kern_recvmsg(uap->s, uap->from ? &sa : NULL, &auio, NULL,
-			     &uap->flags, &uap->sysmsg_szresult);
-	rel_mplock();
-
-	if (error == 0 && uap->from) {
-		if (sa != NULL) {
-			fromlen = MIN(fromlen, sa->sa_len);
-			error = compat_43_copyout_sockaddr(sa, uap->from,
-							   fromlen);
-		} else
-			fromlen = 0;
-		if (error == 0)
-			/*
-			 * Old recvfrom didn't signal an error if this
-			 * next copyout failed.
-			 */
-			copyout(&fromlen, uap->fromlenaddr, sizeof(fromlen));
-	}
-	if (sa)
-		kfree(sa, M_SONAME);
-
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_orecvmsg(struct orecvmsg_args *uap)
-{
-	struct thread *td = curthread;
-	struct msghdr msg;
-	struct uio auio;
-	struct iovec aiov[UIO_SMALLIOV], *iov = NULL;
-	struct mbuf *m, *control = NULL;
-	struct sockaddr *sa = NULL;
-	caddr_t ctlbuf;
-	socklen_t *ufromlenp, *ucontrollenp;
-	int error, fromlen, controllen, len, flags, *uflagsp;
-
-	/*
-	 * This copyin handles everything except the iovec.
-	 */
-	error = copyin(uap->msg, &msg, sizeof(struct omsghdr));
-	if (error)
-		return (error);
-
-	if (msg.msg_name && msg.msg_namelen < 0)
-		return (EINVAL);
-	if (msg.msg_control && msg.msg_controllen < 0)
-		return (EINVAL);
-
-	ufromlenp = (socklen_t *)((caddr_t)uap->msg + offsetof(struct msghdr,
-	    msg_namelen));
-	ucontrollenp = (socklen_t *)((caddr_t)uap->msg + offsetof(struct msghdr,
-	    msg_controllen));
-	uflagsp = (int *)((caddr_t)uap->msg + offsetof(struct msghdr,
-	    msg_flags));
-
-	/*
-	 * Populate auio.
-	 */
-	error = iovec_copyin(msg.msg_iov, &iov, aiov, msg.msg_iovlen,
-			     &auio.uio_resid);
-	if (error)
-		return (error);
-	auio.uio_iov = iov;
-	auio.uio_iovcnt = msg.msg_iovlen;
-	auio.uio_offset = 0;
-	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_rw = UIO_READ;
-	auio.uio_td = td;
-
-	flags = msg.msg_flags;
-
-	get_mplock();
-	error = kern_recvmsg(uap->s, (msg.msg_name ? &sa : NULL), &auio,
-			     (msg.msg_control ? &control : NULL), &flags,
-			     &uap->sysmsg_szresult);
-	rel_mplock();
-
-	/*
-	 * Copyout msg.msg_name and msg.msg_namelen.
-	 */
-	if (error == 0 && msg.msg_name) {
-		if (sa != NULL) {
-			fromlen = MIN(msg.msg_namelen, sa->sa_len);
-			error = compat_43_copyout_sockaddr(sa, msg.msg_name,
-							   fromlen);
-		} else
-			fromlen = 0;
-		if (error == 0)
-			/*
-			 * Old recvfrom didn't signal an error if this
-			 * next copyout failed.
-			 */
-			copyout(&fromlen, ufromlenp, sizeof(*ufromlenp));
-	}
-
-	/*
-	 * Copyout msg.msg_control and msg.msg_controllen.
-	 */
-	if (error == 0 && msg.msg_control) {
-		/*
-		 * If we receive access rights, trim the cmsghdr; anything
-		 * else is tossed.
-		 */
-		if (mtod((struct mbuf *)msg.msg_control,
-		    struct cmsghdr *)->cmsg_level != SOL_SOCKET ||
-		    mtod((struct mbuf *)msg.msg_control,
-		    struct cmsghdr *)->cmsg_type != SCM_RIGHTS) {
-			int temp = 0;
-			error = copyout(&temp, ucontrollenp,
-			    sizeof(*ucontrollenp));
-			goto cleanup;
-		}
-		((struct mbuf *)msg.msg_control)->m_len -=
-		    sizeof(struct cmsghdr);
-		((struct mbuf *)msg.msg_control)->m_data +=
-		    sizeof(struct cmsghdr);
-
-		len = msg.msg_controllen;
-		m = control;
-		ctlbuf = (caddr_t)msg.msg_control;
-
-		while(m && len > 0) {
-			unsigned int tocopy;
-
-			if (len >= m->m_len) {
-				tocopy = m->m_len;
-			} else {
-				msg.msg_flags |= MSG_CTRUNC;
-				tocopy = len;
-			}
-
-			error = copyout(mtod(m, caddr_t), ctlbuf,
-			    tocopy);
-			if (error)
-				goto cleanup;
-
-			ctlbuf += tocopy;
-			len -= tocopy;
-			m = m->m_next;
-		}
-		controllen = ctlbuf - (caddr_t)msg.msg_control;
-		error = copyout(&controllen, ucontrollenp,
-		    sizeof(*ucontrollenp));
-	}
-
-	if (error == 0)
-		error = copyout(&flags, uflagsp, sizeof(*uflagsp));
-
-cleanup:
-	if (sa)
-		kfree(sa, M_SONAME);
-	iovec_free(&iov, aiov);
-	if (control)
-		m_freem(control);
-	return (error);
-}
-
diff --git a/sys/emulation/43bsd/43bsd_socket.h b/sys/emulation/43bsd/43bsd_socket.h
deleted file mode 100644
index f7db45b..0000000
--- a/sys/emulation/43bsd/43bsd_socket.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 43BSD_SOCKET.H	- 4.3BSD compatibility structures for the socket code
- *
- * Copyright (c) 1982, 1986, 1989, 1990, 1993
- *      The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_socket.h,v 1.2 2003/09/19 08:02:27 daver Exp $
- *	from: DragonFly sys/socket.h,v 1.3
- *
- * These are the 4.3BSD compatibility structures from sys/socket.h.
- */
-
-struct osockaddr {
-	u_short	sa_family;		/* address family */
-	char	sa_data[14];		/* up to 14 bytes of direct address */
-};
-
-struct omsghdr {
-	caddr_t	msg_name;		/* optional address */
-	int	msg_namelen;		/* size of address */
-	struct	iovec *msg_iov;		/* scatter/gather array */
-	int	msg_iovlen;		/* # elements in msg_iov */
-	caddr_t	msg_accrights;		/* access rights sent/received */
-	int	msg_accrightslen;
-};
diff --git a/sys/emulation/43bsd/43bsd_stats.c b/sys/emulation/43bsd/43bsd_stats.c
deleted file mode 100644
index 245d336..0000000
--- a/sys/emulation/43bsd/43bsd_stats.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 43BSD_STATS.C	- 4.3BSD compatibility stats syscalls
- *
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_stats.c,v 1.5 2006/06/05 07:26:07 dillon Exp $
- * 	from: DragonFly kern/kern_descrip.c,v 1.16
- *	from: DragonFly kern/vfs_syscalls.c,v 1.21
- *
- * These syscalls used to live in kern/kern_descrip.c and
- * kern/vfs_syscalls.c.  They are modified * to use the new split syscalls.
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/stat.h>
-#include <sys/kern_syscall.h>
-#include <sys/namei.h>
-#include <sys/nlookup.h>
-
-#include <sys/mplock2.h>
-
-#include <emulation/43bsd/stat.h>
-
-static int
-compat_43_copyout_stat(struct stat *st, struct ostat *uaddr)
-{
-	struct ostat ost;
-	int error;
-
-	ost.st_dev = st->st_dev;
-	ost.st_ino = st->st_ino;
-	ost.st_mode = st->st_mode;
-	ost.st_nlink = st->st_nlink;
-	ost.st_uid = st->st_uid;
-	ost.st_gid = st->st_gid;
-	ost.st_rdev = st->st_rdev;
-	if (st->st_size < (quad_t)1 << 32)
-		ost.st_size = st->st_size;
-	else
-		ost.st_size = -2;
-	ost.st_atime = st->st_atime;
-	ost.st_mtime = st->st_mtime;
-	ost.st_ctime = st->st_ctime;
-	ost.st_blksize = st->st_blksize;
-	ost.st_blocks = st->st_blocks;
-	ost.st_flags = st->st_flags;
-	ost.st_gen = st->st_gen;
-
-	error = copyout(&ost, uaddr, sizeof(ost));
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ofstat(struct ofstat_args *uap)
-{
-	struct stat st;
-	int error;
-
-	error = kern_fstat(uap->fd, &st);
-
-	if (error == 0)
-		error = compat_43_copyout_stat(&st, uap->sb);
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_ostat(struct ostat_args *uap)
-{
-	struct nlookupdata nd;
-	struct stat st;
-	int error;
-
-	get_mplock();
-	error = nlookup_init(&nd, uap->path, UIO_USERSPACE, NLC_FOLLOW);
-	if (error == 0) {
-		error = kern_stat(&nd, &st);
-		if (error == 0)
-			error = compat_43_copyout_stat(&st, uap->ub);
-		nlookup_done(&nd);
-	}
-	rel_mplock();
-	return (error);
-}
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_olstat(struct olstat_args *uap)
-{
-	struct nlookupdata nd;
-	struct stat st;
-	int error;
-
-	get_mplock();
-	error = nlookup_init(&nd, uap->path, UIO_USERSPACE, 0);
-	if (error == 0) {
-		error = kern_stat(&nd, &st);
-		if (error == 0)
-			error = compat_43_copyout_stat(&st, uap->ub);
-		nlookup_done(&nd);
-	}
-	rel_mplock();
-	return (error);
-}
diff --git a/sys/emulation/43bsd/43bsd_vm.c b/sys/emulation/43bsd/43bsd_vm.c
deleted file mode 100644
index 0abcfa3..0000000
--- a/sys/emulation/43bsd/43bsd_vm.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * (MPSAFE)
- *
- * 43BSD_VM.C		- 4.3BSD compatibility virtual memory syscalls
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/43bsd_vm.c,v 1.4 2006/09/17 21:07:25 dillon Exp $
- *	from: DragonFly vm/vm_unix.c,v 1.3
- *	from: DragonFly vm/vm_mmap.c,v 1.15
- */
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/sysproto.h>
-#include <sys/kern_syscall.h>
-#include <sys/mman.h>
-#include <sys/proc.h>
-
-#include <sys/thread.h>
-#include <sys/thread2.h>
-
-/*
- * No requirements
- */
-int
-sys_ovadvise(struct ovadvise_args *uap)
-{
-	return (EINVAL);
-}
-
-/*
- * No requirements
- */
-int
-sys_ogetpagesize(struct getpagesize_args *uap)
-{
-	uap->sysmsg_iresult = PAGE_SIZE;
-	return (0);
-}
-
-/*
- * No requirements
- */
-int
-sys_ommap(struct ommap_args *uap)
-{
-	static const char cvtbsdprot[8] = {
-		0,
-		PROT_EXEC,
-		PROT_WRITE,
-		PROT_EXEC | PROT_WRITE,
-		PROT_READ,
-		PROT_EXEC | PROT_READ,
-		PROT_WRITE | PROT_READ,
-		PROT_EXEC | PROT_WRITE | PROT_READ,
-	};
-	int error, flags, prot;
-
-#define	OMAP_ANON	0x0002
-#define	OMAP_COPY	0x0020
-#define	OMAP_SHARED	0x0010
-#define	OMAP_FIXED	0x0100
-#define	OMAP_INHERIT	0x0800
-
-	prot = cvtbsdprot[uap->prot & 0x7];
-	flags = 0;
-	if (uap->flags & OMAP_ANON)
-		flags |= MAP_ANON;
-	if (uap->flags & OMAP_COPY)
-		flags |= MAP_COPY;
-	if (uap->flags & OMAP_SHARED)
-		flags |= MAP_SHARED;
-	else
-		flags |= MAP_PRIVATE;
-	if (uap->flags & OMAP_FIXED)
-		flags |= MAP_FIXED;
-	if (uap->flags & OMAP_INHERIT)
-		flags |= MAP_INHERIT;
-
-	error = kern_mmap(curproc->p_vmspace, uap->addr, uap->len,
-			  prot, flags, uap->fd, uap->pos,
-			  &uap->sysmsg_resultp);
-
-	return (error);
-}
diff --git a/sys/emulation/43bsd/stat.h b/sys/emulation/43bsd/stat.h
deleted file mode 100644
index 9cae008..0000000
--- a/sys/emulation/43bsd/stat.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
- * Copyright (c) 1982, 1986, 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/emulation/43bsd/stat.h,v 1.3 2005/08/02 13:03:54 joerg Exp $
- */
-
-#ifndef _EMULATION_43BSD_STAT_H_
-#define	_EMULATION_43BSD_STAT_H_
-
-#include <sys/types.h>
-
-struct ostat {
-	u_int16_t st_dev;		/* inode's device */
-	u_int32_t st_ino;		/* inode's number */
-	mode_t	  st_mode;		/* inode protection mode */
-	u_int16_t st_nlink;		/* number of hard links */
-	u_int16_t st_uid;		/* user ID of the file's owner */
-	u_int16_t st_gid;		/* group ID of the file's group */
-	u_int16_t st_rdev;		/* device type */
-	int32_t	  st_size;		/* file size, in bytes */
-	struct	timespec st_atimespec;	/* time of last access */
-	struct	timespec st_mtimespec;	/* time of last data modification */
-	struct	timespec st_ctimespec;	/* time of last file status change */
-	int32_t	  st_blksize;		/* optimal blocksize for I/O */
-	int32_t	  st_blocks;		/* blocks allocated for file */
-	u_int32_t st_flags;		/* user defined flags for file */
-	u_int32_t st_gen;		/* file generation number */
-};
-
-#endif /* !_EMULATION_43BSD_STAT_H_ */
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index 4519a12..0da44a4 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -5,26 +5,16 @@
  *               by running make sysent in the same directory.
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/statvfs.h>
-#include <emulation/43bsd/stat.h>
 
 #define AS(name) ((sizeof(struct name) - sizeof(struct sysmsg)) / sizeof(register_t))
-
-#ifdef COMPAT_43
-#define compat(n, name) n, (sy_call_t *)__CONCAT(sys_,__CONCAT(o,name))
-#else
 #define compat(n, name) 0, (sy_call_t *)sys_nosys
-#endif
 
 /* The casts are bogus but will do for now. */
 struct sysent sysent[] = {
-#ifdef COMPAT_43
-#endif
 	{ 0, (sy_call_t *)sys_nosys },			/* 0 = syscall */
 	{ AS(exit_args), (sy_call_t *)sys_exit },	/* 1 = exit */
 	{ 0, (sy_call_t *)sys_fork },			/* 2 = fork */
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 85964a9..d3bea26 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -68,7 +68,6 @@
  * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.19 2004/02/28 00:43:31 tegge Exp $
  */
 
-#include "opt_compat.h"
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 9dee510..8cd0107 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -35,7 +35,6 @@
  * $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.11 2003/01/13 22:51:16 dillon Exp $
  */
 
-#include "opt_compat.h"
 #include "opt_ktrace.h"
 
 #include <sys/param.h>
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index ba5b3ce..a835084 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -39,8 +39,6 @@
  * System calls related to processes and protection
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/acct.h>
 #include <sys/systm.h>
@@ -67,11 +65,6 @@ sys_getpid(struct getpid_args *uap)
 	struct proc *p = curproc;
 
 	uap->sysmsg_fds[0] = p->p_pid;
-#if defined(COMPAT_43)
-	lwkt_gettoken_shared(&p->p_token);
-	uap->sysmsg_fds[1] = p->p_pptr->p_pid;
-	lwkt_reltoken(&p->p_token);
-#endif
 	return (0);
 }
 
@@ -177,9 +170,6 @@ sys_getuid(struct getuid_args *uap)
 	struct ucred *cred = curthread->td_ucred;
 
 	uap->sysmsg_fds[0] = cred->cr_ruid;
-#if defined(COMPAT_43)
-	uap->sysmsg_fds[1] = cred->cr_uid;
-#endif
 	return (0);
 }
 
@@ -204,9 +194,6 @@ sys_getgid(struct getgid_args *uap)
 	struct ucred *cred = curthread->td_ucred;
 
 	uap->sysmsg_fds[0] = cred->cr_rgid;
-#if defined(COMPAT_43)
-	uap->sysmsg_fds[1] = cred->cr_groups[0];
-#endif
 	return (0);
 }
 
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index bd6bc90..1012cfb 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -35,8 +35,6 @@
  * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/sysproto.h>
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh
index dfd1472..431862e 100644
--- a/sys/kern/makesyscalls.sh
+++ b/sys/kern/makesyscalls.sh
@@ -4,9 +4,6 @@
 
 set -e
 
-# name of compat option:
-compat=COMPAT_43
-
 # output files:
 sysnames="syscalls.c"
 sysproto="../sys/sysproto.h"
@@ -96,8 +93,6 @@ s/\$//g
 		printf "#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n" > sysarg
 		printf "\t\t0 : sizeof(register_t) - sizeof(t))\n\n" > sysarg
 
-		printf "\n#ifdef %s\n\n", compat > syscompat
-
 		printf "/*\n * System call names.\n *\n" > sysnames
 		printf " * DO NOT EDIT-- To regenerate this file, edit syscalls.master followed\n" > sysnames
 		printf " *               by running make sysent in the same directory.\n" > sysnames
@@ -333,9 +328,6 @@ s/\$//g
 		ncompat++
 		parseline()
 		if (argc != 0 && $2 != "CPT_NOA") {
-			printf("#ifdef %s\n", compat) > sysun
-			printf("\tstruct\t%s %s;\n", argalias, usefuncname) > sysun
-			printf("#endif\n") > sysun
 			printf("struct\t%s {\n", argalias) > syscompat
 			printf("#ifdef _KERNEL\n") > syscompat
 			printf("\tstruct sysmsg sysmsg;\n") > syscompat
@@ -411,17 +403,10 @@ s/\$//g
 	}
 	END {
 		printf "\n#define AS(name) ((sizeof(struct name) - sizeof(struct sysmsg)) / sizeof(register_t))\n" > sysinc
-		if (ncompat != 0) {
-			printf "#include \"opt_compat.h\"\n\n" > syssw
-			printf "\n#ifdef %s\n", compat > sysinc
-			printf "#define compat(n, name) n, (sy_call_t *)__CONCAT(sys_,__CONCAT(o,name))\n" > sysinc
-			printf "#else\n" > sysinc
+		if (ncompat != 0)
 			printf "#define compat(n, name) 0, (sy_call_t *)sys_nosys\n" > sysinc
-			printf "#endif\n" > sysinc
-		}
 
 		printf("\n#endif /* _KERNEL */\n") > syscompatdcl
-		printf("\n#endif /* %s */\n\n", compat) > syscompatdcl
 
 		printf("\n") > sysmk
 		printf("};\n") > sysent
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index 6837ea7..ca458fa 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -6,8 +6,6 @@
  */
 
 const char *syscallnames[] = {
-#ifdef COMPAT_43
-#endif
 	"syscall",			/* 0 = syscall */
 	"exit",			/* 1 = exit */
 	"fork",			/* 2 = fork */
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index b445225..4647cc4 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -33,10 +33,6 @@
 #include <sys/sysproto.h>
 #include <sys/statvfs.h>
 
-#ifdef COMPAT_43
-#include <emulation/43bsd/stat.h>
-#endif
-
 ; Reserved/unimplemented system calls in the range 0-150 inclusive
 ; are reserved for use in future Berkeley releases.
 ; Additional system calls implemented in vendor and other
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index f5f2d8a..bff0495 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -28,7 +28,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "opt_compat.h"
 #include "opt_sysvipc.h"
 
 #include <sys/param.h>
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index b4d0966..8c2ec29 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -71,15 +71,11 @@
  *	  only when _all_ openers leave open().
  */
 
-#include "opt_compat.h"
 #include "opt_uconsole.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/filio.h>
-#if defined(COMPAT_43)
-#include <sys/ioctl_compat.h>
-#endif
 #include <sys/proc.h>
 #include <sys/priv.h>
 #define	TTYDEFCHARS
@@ -880,16 +876,6 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag)
 	case  TIOCSTI:
 	case  TIOCSTOP:
 	case  TIOCSWINSZ:
-#if defined(COMPAT_43)
-	case  TIOCLBIC:
-	case  TIOCLBIS:
-	case  TIOCLSET:
-	case  TIOCSETC:
-	case OTIOCSETD:
-	case  TIOCSETN:
-	case  TIOCSETP:
-	case  TIOCSLTC:
-#endif
 		while (isbackground(p, tp) && !(p->p_flags & P_PPWAIT) &&
 		    !SIGISMEMBER(p->p_sigignore, SIGTTOU) &&
 		    !SIGISMEMBER(lp->lwp_sigmask, SIGTTOU)) {
@@ -1282,11 +1268,7 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag)
 	default:
 		lwkt_reltoken(&p->p_token);
 		lwkt_reltoken(&tty_token);
-#if defined(COMPAT_43)
-		return (ttcompat(tp, cmd, data, flag));
-#else
 		return (ENOIOCTL);
-#endif
 	}
 	lwkt_reltoken(&p->p_token);
 	lwkt_reltoken(&tty_token);
diff --git a/sys/kern/tty_compat.c b/sys/kern/tty_compat.c
deleted file mode 100644
index 191aa12..0000000
--- a/sys/kern/tty_compat.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)tty_compat.c	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/kern/tty_compat.c,v 1.29 1999/08/28 00:46:20 peter Exp $
- */
-
-/*
- * mapping routines for old line discipline (yuck)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl_compat.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-
-static int ttcompatgetflags	(struct tty	*tp);
-static void ttcompatsetflags	(struct tty	*tp, struct termios *t);
-static void ttcompatsetlflags	(struct tty	*tp, struct termios *t);
-static int ttcompatspeedtab	(int speed, struct speedtab *table);
-
-static int ttydebug = 0;
-SYSCTL_INT(_debug, OID_AUTO, ttydebug, CTLFLAG_RW, &ttydebug, 0,
-    "tty debugging");
-
-static struct speedtab compatspeeds[] = {
-#define MAX_SPEED	17
-	{ 115200, 17 },
-	{ 57600, 16 },
-	{ 38400, 15 },
-	{ 19200, 14 },
-	{ 9600,	13 },
-	{ 4800,	12 },
-	{ 2400,	11 },
-	{ 1800,	10 },
-	{ 1200,	9 },
-	{ 600,	8 },
-	{ 300,	7 },
-	{ 200,	6 },
-	{ 150,	5 },
-	{ 134,	4 },
-	{ 110,	3 },
-	{ 75,	2 },
-	{ 50,	1 },
-	{ 0,	0 },
-	{ -1,	-1 },
-};
-static int compatspcodes[] = {
-	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200,
-	1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
-};
-
-static int
-ttcompatspeedtab(int speed, struct speedtab *table)
-{
-	if (speed == 0)
-		return (0); /* hangup */
-	for ( ; table->sp_speed > 0; table++)
-		if (table->sp_speed <= speed) /* nearest one, rounded down */
-			return (table->sp_code);
-	return (1); /* 50, min and not hangup */
-}
-
-int
-ttsetcompat(struct tty *tp, u_long *com, caddr_t data, struct termios *term)
-{
-	switch (*com) {
-	case TIOCSETP:
-	case TIOCSETN: {
-		struct sgttyb *sg = (struct sgttyb *)data;
-		int speed;
-
-		if ((speed = sg->sg_ispeed) > MAX_SPEED || speed < 0)
-			return(EINVAL);
-		else if (speed != ttcompatspeedtab(tp->t_ispeed, compatspeeds))
-			term->c_ispeed = compatspcodes[speed];
-		else
-			term->c_ispeed = tp->t_ispeed;
-		if ((speed = sg->sg_ospeed) > MAX_SPEED || speed < 0)
-			return(EINVAL);
-		else if (speed != ttcompatspeedtab(tp->t_ospeed, compatspeeds))
-			term->c_ospeed = compatspcodes[speed];
-		else
-			term->c_ospeed = tp->t_ospeed;
-		term->c_cc[VERASE] = sg->sg_erase;
-		term->c_cc[VKILL] = sg->sg_kill;
-		tp->t_flags = (tp->t_flags&0xffff0000) | (sg->sg_flags&0xffff);
-		ttcompatsetflags(tp, term);
-		*com = (*com == TIOCSETP) ? TIOCSETAF : TIOCSETA;
-		break;
-	}
-	case TIOCSETC: {
-		struct tchars *tc = (struct tchars *)data;
-		cc_t *cc;
-
-		cc = term->c_cc;
-		cc[VINTR] = tc->t_intrc;
-		cc[VQUIT] = tc->t_quitc;
-		cc[VSTART] = tc->t_startc;
-		cc[VSTOP] = tc->t_stopc;
-		cc[VEOF] = tc->t_eofc;
-		cc[VEOL] = tc->t_brkc;
-		if (tc->t_brkc == -1)
-			cc[VEOL2] = _POSIX_VDISABLE;
-		*com = TIOCSETA;
-		break;
-	}
-	case TIOCSLTC: {
-		struct ltchars *ltc = (struct ltchars *)data;
-		cc_t *cc;
-
-		cc = term->c_cc;
-		cc[VSUSP] = ltc->t_suspc;
-		cc[VDSUSP] = ltc->t_dsuspc;
-		cc[VREPRINT] = ltc->t_rprntc;
-		cc[VDISCARD] = ltc->t_flushc;
-		cc[VWERASE] = ltc->t_werasc;
-		cc[VLNEXT] = ltc->t_lnextc;
-		*com = TIOCSETA;
-		break;
-	}
-	case TIOCLBIS:
-	case TIOCLBIC:
-	case TIOCLSET:
-		if (*com == TIOCLSET)
-			tp->t_flags = (tp->t_flags&0xffff) | *(int *)data<<16;
-		else {
-			tp->t_flags =
-			 (ttcompatgetflags(tp)&0xffff0000)|(tp->t_flags&0xffff);
-			if (*com == TIOCLBIS)
-				tp->t_flags |= *(int *)data<<16;
-			else
-				tp->t_flags &= ~(*(int *)data<<16);
-		}
-		ttcompatsetlflags(tp, term);
-		*com = TIOCSETA;
-		break;
-	}
-	return 0;
-}
-
-/*ARGSUSED*/
-int
-ttcompat(struct tty *tp, u_long com, caddr_t data, int flag)
-{
-	switch (com) {
-	case TIOCSETP:
-	case TIOCSETN:
-	case TIOCSETC:
-	case TIOCSLTC:
-	case TIOCLBIS:
-	case TIOCLBIC:
-	case TIOCLSET: {
-		struct termios term;
-		int error;
-
-		term = tp->t_termios;
-		if ((error = ttsetcompat(tp, &com, data, &term)) != 0)
-			return error;
-		return ttioctl(tp, com, &term, flag);
-	}
-	case TIOCGETP: {
-		struct sgttyb *sg = (struct sgttyb *)data;
-		cc_t *cc = tp->t_cc;
-
-		sg->sg_ospeed = ttcompatspeedtab(tp->t_ospeed, compatspeeds);
-		if (tp->t_ispeed == 0)
-			sg->sg_ispeed = sg->sg_ospeed;
-		else
-			sg->sg_ispeed = ttcompatspeedtab(tp->t_ispeed, compatspeeds);
-		sg->sg_erase = cc[VERASE];
-		sg->sg_kill = cc[VKILL];
-		sg->sg_flags = tp->t_flags = ttcompatgetflags(tp);
-		break;
-	}
-	case TIOCGETC: {
-		struct tchars *tc = (struct tchars *)data;
-		cc_t *cc = tp->t_cc;
-
-		tc->t_intrc = cc[VINTR];
-		tc->t_quitc = cc[VQUIT];
-		tc->t_startc = cc[VSTART];
-		tc->t_stopc = cc[VSTOP];
-		tc->t_eofc = cc[VEOF];
-		tc->t_brkc = cc[VEOL];
-		break;
-	}
-	case TIOCGLTC: {
-		struct ltchars *ltc = (struct ltchars *)data;
-		cc_t *cc = tp->t_cc;
-
-		ltc->t_suspc = cc[VSUSP];
-		ltc->t_dsuspc = cc[VDSUSP];
-		ltc->t_rprntc = cc[VREPRINT];
-		ltc->t_flushc = cc[VDISCARD];
-		ltc->t_werasc = cc[VWERASE];
-		ltc->t_lnextc = cc[VLNEXT];
-		break;
-	}
-	case TIOCLGET:
-		tp->t_flags =
-		 (ttcompatgetflags(tp) & 0xffff0000UL)
-		   | (tp->t_flags & 0xffff);
-		*(int *)data = tp->t_flags>>16;
-		if (ttydebug)
-			kprintf("CLGET: returning %x\n", *(int *)data);
-		break;
-
-	case OTIOCGETD:
-		*(int *)data = tp->t_line ? tp->t_line : 2;
-		break;
-
-	case OTIOCSETD: {
-		int ldisczero = 0;
-
-		return (ttioctl(tp, TIOCSETD,
-			*(int *)data == 2 ? (caddr_t)&ldisczero : data, flag));
-	    }
-
-	case OTIOCCONS:
-		*(int *)data = 1;
-		return (ttioctl(tp, TIOCCONS, data, flag));
-
-	default:
-		return (ENOIOCTL);
-	}
-	return (0);
-}
-
-static int
-ttcompatgetflags(struct tty *tp)
-{
-	tcflag_t iflag	= tp->t_iflag;
-	tcflag_t lflag	= tp->t_lflag;
-	tcflag_t oflag	= tp->t_oflag;
-	tcflag_t cflag	= tp->t_cflag;
-	int flags = 0;
-
-	if (iflag&IXOFF)
-		flags |= TANDEM;
-	if (iflag&ICRNL || oflag&ONLCR)
-		flags |= CRMOD;
-	if ((cflag&CSIZE) == CS8) {
-		flags |= PASS8;
-		if (iflag&ISTRIP)
-			flags |= ANYP;
-	}
-	else if (cflag&PARENB) {
-		if (iflag&INPCK) {
-			if (cflag&PARODD)
-				flags |= ODDP;
-			else
-				flags |= EVENP;
-		} else
-			flags |= EVENP | ODDP;
-	}
-
-	if ((lflag&ICANON) == 0) {
-		/* fudge */
-		if (iflag&(INPCK|ISTRIP|IXON) || lflag&(IEXTEN|ISIG)
-		    || (cflag&(CSIZE|PARENB)) != CS8)
-			flags |= CBREAK;
-		else
-			flags |= RAW;
-	}
-	if (!(flags&RAW) && !(oflag&OPOST) && (cflag&(CSIZE|PARENB)) == CS8)
-		flags |= LITOUT;
-	if (cflag&MDMBUF)
-		flags |= MDMBUF;
-	if ((cflag&HUPCL) == 0)
-		flags |= NOHANG;
-	if (oflag&OXTABS)
-		flags |= XTABS;
-	if (lflag&ECHOE)
-		flags |= CRTERA|CRTBS;
-	if (lflag&ECHOKE)
-		flags |= CRTKIL|CRTBS;
-	if (lflag&ECHOPRT)
-		flags |= PRTERA;
-	if (lflag&ECHOCTL)
-		flags |= CTLECH;
-	if ((iflag&IXANY) == 0)
-		flags |= DECCTQ;
-	flags |= lflag&(ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH);
-	if (ttydebug)
-		kprintf("getflags: %x\n", flags);
-	return (flags);
-}
-
-static void
-ttcompatsetflags(struct tty *tp, struct termios *t)
-{
-	int flags = tp->t_flags;
-	tcflag_t iflag	= t->c_iflag;
-	tcflag_t oflag	= t->c_oflag;
-	tcflag_t lflag	= t->c_lflag;
-	tcflag_t cflag	= t->c_cflag;
-
-	if (flags & RAW) {
-		iflag = IGNBRK;
-		lflag &= ~(ECHOCTL|ISIG|ICANON|IEXTEN);
-	} else {
-		iflag &= ~(PARMRK|IGNPAR|IGNCR|INLCR);
-		iflag |= BRKINT|IXON|IMAXBEL;
-		lflag |= ISIG|IEXTEN|ECHOCTL;	/* XXX was echoctl on ? */
-		if (flags & XTABS)
-			oflag |= OXTABS;
-		else
-			oflag &= ~OXTABS;
-		if (flags & CBREAK)
-			lflag &= ~ICANON;
-		else
-			lflag |= ICANON;
-		if (flags&CRMOD) {
-			iflag |= ICRNL;
-			oflag |= ONLCR;
-		} else {
-			iflag &= ~ICRNL;
-			oflag &= ~ONLCR;
-		}
-	}
-	if (flags&ECHO)
-		lflag |= ECHO;
-	else
-		lflag &= ~ECHO;
-
-	cflag &= ~(CSIZE|PARENB);
-	if (flags&(RAW|LITOUT|PASS8)) {
-		cflag |= CS8;
-		if (!(flags&(RAW|PASS8))
-		    || (flags&(RAW|PASS8|ANYP)) == (PASS8|ANYP))
-			iflag |= ISTRIP;
-		else
-			iflag &= ~ISTRIP;
-		if (flags&(RAW|LITOUT))
-			oflag &= ~OPOST;
-		else
-			oflag |= OPOST;
-	} else {
-		cflag |= CS7|PARENB;
-		iflag |= ISTRIP;
-		oflag |= OPOST;
-	}
-	/* XXX don't set INPCK if RAW or PASS8? */
-	if ((flags&(EVENP|ODDP)) == EVENP) {
-		iflag |= INPCK;
-		cflag &= ~PARODD;
-	} else if ((flags&(EVENP|ODDP)) == ODDP) {
-		iflag |= INPCK;
-		cflag |= PARODD;
-	} else
-		iflag &= ~INPCK;
-	if (flags&TANDEM)
-		iflag |= IXOFF;
-	else
-		iflag &= ~IXOFF;
-	if ((flags&DECCTQ) == 0)
-		iflag |= IXANY;
-	else
-		iflag &= ~IXANY;
-	t->c_iflag = iflag;
-	t->c_oflag = oflag;
-	t->c_lflag = lflag;
-	t->c_cflag = cflag;
-}
-
-static void
-ttcompatsetlflags(struct tty *tp, struct termios *t)
-{
-	int flags = tp->t_flags;
-	tcflag_t iflag	= t->c_iflag;
-	tcflag_t oflag	= t->c_oflag;
-	tcflag_t lflag	= t->c_lflag;
-	tcflag_t cflag	= t->c_cflag;
-
-	iflag &= ~(PARMRK|IGNPAR|IGNCR|INLCR);
-	if (flags&CRTERA)
-		lflag |= ECHOE;
-	else
-		lflag &= ~ECHOE;
-	if (flags&CRTKIL)
-		lflag |= ECHOKE;
-	else
-		lflag &= ~ECHOKE;
-	if (flags&PRTERA)
-		lflag |= ECHOPRT;
-	else
-		lflag &= ~ECHOPRT;
-	if (flags&CTLECH)
-		lflag |= ECHOCTL;
-	else
-		lflag &= ~ECHOCTL;
-	if (flags&TANDEM)
-		iflag |= IXOFF;
-	else
-		iflag &= ~IXOFF;
-	if ((flags&DECCTQ) == 0)
-		iflag |= IXANY;
-	else
-		iflag &= ~IXANY;
-	if (flags & MDMBUF)
-		cflag |= MDMBUF;
-	else
-		cflag &= ~MDMBUF;
-	if (flags&NOHANG)
-		cflag &= ~HUPCL;
-	else
-		cflag |= HUPCL;
-	lflag &= ~(TOSTOP|FLUSHO|PENDIN|NOFLSH);
-	lflag |= flags&(TOSTOP|FLUSHO|PENDIN|NOFLSH);
-
-	/*
-	 * The next if-else statement is copied from above so don't bother
-	 * checking it separately.  We could avoid fiddlling with the
-	 * character size if the mode is already RAW or if neither the
-	 * LITOUT bit or the PASS8 bit is being changed, but the delta of
-	 * the change is not available here and skipping the RAW case would
-	 * make the code different from above.
-	 */
-	cflag &= ~(CSIZE|PARENB);
-	if (flags&(RAW|LITOUT|PASS8)) {
-		cflag |= CS8;
-		if (!(flags&(RAW|PASS8))
-		    || (flags&(RAW|PASS8|ANYP)) == (PASS8|ANYP))
-			iflag |= ISTRIP;
-		else
-			iflag &= ~ISTRIP;
-		if (flags&(RAW|LITOUT))
-			oflag &= ~OPOST;
-		else
-			oflag |= OPOST;
-	} else {
-		cflag |= CS7|PARENB;
-		iflag |= ISTRIP;
-		oflag |= OPOST;
-	}
-	t->c_iflag = iflag;
-	t->c_oflag = oflag;
-	t->c_lflag = lflag;
-	t->c_cflag = cflag;
-}
diff --git a/sys/kern/tty_conf.c b/sys/kern/tty_conf.c
index 26d29ed..11c86e5 100644
--- a/sys/kern/tty_conf.c
+++ b/sys/kern/tty_conf.c
@@ -37,8 +37,6 @@
  * $FreeBSD: src/sys/kern/tty_conf.c,v 1.16.2.1 2002/03/11 01:14:55 dd Exp $
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/tty.h>
@@ -69,13 +67,7 @@ struct	linesw linesw[MAXLDISC] =
 	{ ttyopen,	ttylclose,	ttread,		ttwrite,
 	  l_nullioctl,	ttyinput,	ttstart,	ttymodem },
 	NODISC(1),		/* 1- defunct */
-	  			/* 2- NTTYDISC */
-#ifdef COMPAT_43
-	{ ttyopen,	ttylclose,	ttread,		ttwrite,
-	  l_nullioctl,	ttyinput,	ttstart,	ttymodem },
-#else
-	NODISC(2),
-#endif
+	NODISC(2),	  	/* 2- NTTYDISC */
 	NODISC(3),		/* loadable */
 	NODISC(4),		/* SLIPDISC */
 	NODISC(5),		/* PPPDISC */
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index b372b31..6ac4341 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -45,13 +45,8 @@
  * (Actually two drivers, requiring two dev_ops structures)
  */
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
-#if defined(COMPAT_43)
-#include <sys/ioctl_compat.h>
-#endif
 #include <sys/proc.h>
 #include <sys/priv.h>
 #include <sys/tty.h>
@@ -1142,10 +1137,6 @@ ptyioctl(struct dev_ioctl_args *ap)
 		}
 
 		switch (ap->a_cmd) {
-#ifdef COMPAT_43
-		case TIOCSETP:
-		case TIOCSETN:
-#endif
 		case TIOCSETD:
 		case TIOCSETA:
 		case TIOCSETAW:
@@ -1221,15 +1212,6 @@ ptyioctl(struct dev_ioctl_args *ap)
 		case TIOCSETA:
 		case TIOCSETAW:
 		case TIOCSETAF:
-#ifdef COMPAT_43
-		case TIOCSETP:
-		case TIOCSETN:
-		case TIOCSETC:
-		case TIOCSLTC:
-		case TIOCLBIS:
-		case TIOCLBIC:
-		case TIOCLSET:
-#endif
 			pti->pt_send |= TIOCPKT_IOCTL;
 			ptcwakeup(tp, FREAD);
 		default:
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index dae04de..3f67314 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1456,6 +1456,7 @@ getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len)
 	} else {
 #if BYTE_ORDER != BIG_ENDIAN
 		/*
+		 * XXX
 		 * The bind(), connect(), and sendto() syscalls were not
 		 * versioned for COMPAT_43.  Thus, this check must stay.
 		 */
diff --git a/sys/net/if.c b/sys/net/if.c
index b8456b9..8b793fe 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -30,7 +30,6 @@
  * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $
  */
 
-#include "opt_compat.h"
 #include "opt_inet6.h"
 #include "opt_inet.h"
 #include "opt_ifpoll.h"
@@ -87,10 +86,6 @@
 #endif
 #endif
 
-#if defined(COMPAT_43)
-#include <emulation/43bsd/43bsd_socket.h>
-#endif /* COMPAT_43 */
-
 struct netmsg_ifaddr {
 	struct netmsg_base base;
 	struct ifaddr	*ifa;
@@ -1785,9 +1780,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred)
 	int error;
 	short oif_flags;
 	int new_flags;
-#ifdef COMPAT_43
-	int ocmd;
-#endif
 	size_t namelen, onamelen;
 	char new_name[IFNAMSIZ];
 	struct ifaddr *ifa;
@@ -2134,55 +2126,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred)
 			error = EOPNOTSUPP;
 			break;
 		}
-#ifndef COMPAT_43
-		error = so_pru_control_direct(so, cmd, data, ifp);
-#else
-		ocmd = cmd;
-
-		switch (cmd) {
-		case SIOCSIFDSTADDR:
-		case SIOCSIFADDR:
-		case SIOCSIFBRDADDR:
-		case SIOCSIFNETMASK:
-#if BYTE_ORDER != BIG_ENDIAN
-			if (ifr->ifr_addr.sa_family == 0 &&
-			    ifr->ifr_addr.sa_len < 16) {
-				ifr->ifr_addr.sa_family = ifr->ifr_addr.sa_len;
-				ifr->ifr_addr.sa_len = 16;
-			}
-#else
-			if (ifr->ifr_addr.sa_len == 0)
-				ifr->ifr_addr.sa_len = 16;
-#endif
-			break;
-		case OSIOCGIFADDR:
-			cmd = SIOCGIFADDR;
-			break;
-		case OSIOCGIFDSTADDR:
-			cmd = SIOCGIFDSTADDR;
-			break;
-		case OSIOCGIFBRDADDR:
-			cmd = SIOCGIFBRDADDR;
-			break;
-		case OSIOCGIFNETMASK:
-			cmd = SIOCGIFNETMASK;
-			break;
-		default:
-			break;
-		}
-
 		error = so_pru_control_direct(so, cmd, data, ifp);
 
-		switch (ocmd) {
-		case OSIOCGIFADDR:
-		case OSIOCGIFDSTADDR:
-		case OSIOCGIFBRDADDR:
-		case OSIOCGIFNETMASK:
-			*(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family;
-			break;
-		}
-#endif /* COMPAT_43 */
-
 		if ((oif_flags ^ ifp->if_flags) & IFF_UP) {
 #ifdef INET6
 			DELAY(100);/* XXX: temporary workaround for fxp issue*/
@@ -2324,16 +2269,6 @@ ifconf(u_long cmd, caddr_t data, struct ucred *cred)
 			 * the userland, which could block.
 			 */
 			IFAREF(ifa);
-#ifdef COMPAT_43
-			if (cmd == OSIOCGIFCONF) {
-				struct osockaddr *osa =
-					 (struct osockaddr *)&ifr.ifr_addr;
-				ifr.ifr_addr = *sa;
-				osa->sa_family = sa->sa_family;
-				error = copyout(&ifr, ifrp, sizeof ifr);
-				ifrp++;
-			} else
-#endif
 			if (sa->sa_len <= sizeof(*sa)) {
 				ifr.ifr_addr = *sa;
 				error = copyout(&ifr, ifrp, sizeof ifr);
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 4eb5246..acbbfa0 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -63,7 +63,6 @@
  * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.31 2003/01/24 05:11:34 sam Exp $
  */
 
-#include "opt_compat.h"
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 92d88b7..d5e2db5 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -61,10 +61,8 @@
  *
  *	@(#)tcp_timer.c	8.2 (Berkeley) 5/24/95
  * $FreeBSD: src/sys/netinet/tcp_timer.c,v 1.34.2.14 2003/02/03 02:33:41 hsu Exp $
- * $DragonFly: src/sys/netinet/tcp_timer.c,v 1.17 2008/03/30 20:39:01 dillon Exp $
  */
 
-#include "opt_compat.h"
 #include "opt_inet6.h"
 #include "opt_tcpdebug.h"
 
diff --git a/sys/platform/pc64/x86_64/exception.S b/sys/platform/pc64/x86_64/exception.S
index df0b7c0..717abf0 100644
--- a/sys/platform/pc64/x86_64/exception.S
+++ b/sys/platform/pc64/x86_64/exception.S
@@ -36,8 +36,8 @@
 
 #if 0 /* JG */
 #include "opt_atpic.h"
-#endif
 #include "opt_compat.h"
+#endif
 
 #include <machine/asmacros.h>
 #include <machine/psl.h>
diff --git a/sys/platform/pc64/x86_64/machdep.c b/sys/platform/pc64/x86_64/machdep.c
index 69b407b..a7232d2 100644
--- a/sys/platform/pc64/x86_64/machdep.c
+++ b/sys/platform/pc64/x86_64/machdep.c
@@ -42,7 +42,6 @@
 
 //#include "use_npx.h"
 #include "use_isa.h"
-#include "opt_compat.h"
 #include "opt_cpu.h"
 #include "opt_ddb.h"
 #include "opt_directio.h"
diff --git a/sys/platform/vkernel64/x86_64/cpu_regs.c b/sys/platform/vkernel64/x86_64/cpu_regs.c
index f91c272..550e78c 100644
--- a/sys/platform/vkernel64/x86_64/cpu_regs.c
+++ b/sys/platform/vkernel64/x86_64/cpu_regs.c
@@ -39,7 +39,6 @@
  * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $
  */
 
-#include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_directio.h"
 #include "opt_inet.h"
diff --git a/sys/sys/ioctl.h b/sys/sys/ioctl.h
index 5f44bd8..964607d 100644
--- a/sys/sys/ioctl.h
+++ b/sys/sys/ioctl.h
@@ -70,8 +70,7 @@ struct ttysize {
  * Compatibility with old terminal driver
  *
  * Source level -> #define USE_OLD_TTY
- * Kernel level -> options COMPAT_43
  */
-#if defined(USE_OLD_TTY) || defined(COMPAT_43)
+#if defined(USE_OLD_TTY)
 #include <sys/ioctl_compat.h>
 #endif
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index bda2af3..d71e0b4 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -23,8 +23,6 @@
 #define	PAD_(t)	(sizeof(register_t) <= sizeof(t) ? \
 		0 : sizeof(register_t) - sizeof(t))
 
-#ifdef COMPAT_43
-#endif
 struct	nosys_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2333,11 +2331,6 @@ struct	ppoll_args {
 	const struct timespec *	ts;	char ts_[PAD_(const struct timespec *)];
 	const sigset_t *	sigmask;	char sigmask_[PAD_(const sigset_t *)];
 };
-
-#ifdef COMPAT_43
-
-#ifdef COMPAT_43
-#endif
 struct	ocreat_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2572,13 +2565,8 @@ int	sys_ogetdirentries (struct ogetdirentries_args *);
 
 #endif /* _KERNEL */
 
-#endif /* COMPAT_43 */
-
-
 #ifdef _KERNEL
 
-#ifdef COMPAT_43
-#endif
 int	sys_nosys (struct nosys_args *);
 int	sys_exit (struct exit_args *);
 int	sys_fork (struct fork_args *);
diff --git a/sys/sys/sysunion.h b/sys/sys/sysunion.h
index 56035a6..4169515 100644
--- a/sys/sys/sysunion.h
+++ b/sys/sys/sysunion.h
@@ -10,8 +10,6 @@ union sysunion {
 	struct	lwkt_msg lmsg;
 	struct	sysmsg sysmsg;
 #endif
-#ifdef COMPAT_43
-#endif
 	struct	nosys_args nosys;
 	struct	exit_args exit;
 	struct	fork_args fork;
@@ -20,9 +18,6 @@ union sysunion {
 	struct	open_args open;
 	struct	close_args close;
 	struct	wait_args wait4;
-#ifdef COMPAT_43
-	struct	ocreat_args sys_ocreat;
-#endif
 	struct	link_args link;
 	struct	unlink_args unlink;
 	struct	chdir_args chdir;
@@ -32,9 +27,6 @@ union sysunion {
 	struct	chown_args chown;
 	struct	obreak_args obreak;
 	struct	getfsstat_args getfsstat;
-#ifdef COMPAT_43
-	struct	olseek_args sys_olseek;
-#endif
 	struct	getpid_args getpid;
 	struct	mount_args mount;
 	struct	unmount_args unmount;
@@ -53,13 +45,7 @@ union sysunion {
 	struct	fchflags_args fchflags;
 	struct	sync_args sync;
 	struct	kill_args kill;
-#ifdef COMPAT_43
-	struct	ostat_args sys_ostat;
-#endif
 	struct	getppid_args getppid;
-#ifdef COMPAT_43
-	struct	olstat_args sys_olstat;
-#endif
 	struct	dup_args dup;
 	struct	pipe_args pipe;
 	struct	getegid_args getegid;
@@ -78,23 +64,11 @@ union sysunion {
 	struct	execve_args execve;
 	struct	umask_args umask;
 	struct	chroot_args chroot;
-#ifdef COMPAT_43
-	struct	ofstat_args sys_ofstat;
-#endif
-#ifdef COMPAT_43
-	struct	getkerninfo_args getkerninfo;
-#endif
 	struct	getpagesize_args getpagesize;
 	struct	msync_args msync;
 	struct	vfork_args vfork;
 	struct	sbrk_args sbrk;
 	struct	sstk_args sstk;
-#ifdef COMPAT_43
-	struct	ommap_args sys_ommap;
-#endif
-#ifdef COMPAT_43
-	struct	ovadvise_args vadvise;
-#endif
 	struct	munmap_args munmap;
 	struct	mprotect_args mprotect;
 	struct	madvise_args madvise;
@@ -107,12 +81,6 @@ union sysunion {
 	struct	owait_args sys_owait;
 	struct	swapon_args swapon;
 	struct	getitimer_args getitimer;
-#ifdef COMPAT_43
-	struct	gethostname_args gethostname;
-#endif
-#ifdef COMPAT_43
-	struct	sethostname_args sethostname;
-#endif
 	struct	getdtablesize_args getdtablesize;
 	struct	dup2_args dup2;
 	struct	fcntl_args fcntl;
@@ -122,33 +90,9 @@ union sysunion {
 	struct	socket_args socket;
 	struct	connect_args connect;
 	struct	getpriority_args getpriority;
-#ifdef COMPAT_43
-	struct	osend_args sys_osend;
-#endif
-#ifdef COMPAT_43
-	struct	orecv_args sys_orecv;
-#endif
 	struct	bind_args bind;
 	struct	setsockopt_args setsockopt;
 	struct	listen_args listen;
-#ifdef COMPAT_43
-	struct	osigvec_args sys_osigvec;
-#endif
-#ifdef COMPAT_43
-	struct	osigblock_args sys_osigblock;
-#endif
-#ifdef COMPAT_43
-	struct	osigsetmask_args sys_osigsetmask;
-#endif
-#ifdef COMPAT_43
-	struct	osigstack_args sys_osigstack;
-#endif
-#ifdef COMPAT_43
-	struct	orecvmsg_args sys_orecvmsg;
-#endif
-#ifdef COMPAT_43
-	struct	osendmsg_args sys_osendmsg;
-#endif
 	struct	gettimeofday_args gettimeofday;
 	struct	getrusage_args getrusage;
 	struct	getsockopt_args getsockopt;
@@ -160,12 +104,6 @@ union sysunion {
 	struct	setreuid_args setreuid;
 	struct	setregid_args setregid;
 	struct	rename_args rename;
-#ifdef COMPAT_43
-	struct	otruncate_args sys_otruncate;
-#endif
-#ifdef COMPAT_43
-	struct	oftruncate_args sys_oftruncate;
-#endif
 	struct	flock_args flock;
 	struct	mkfifo_args mkfifo;
 	struct	sendto_args sendto;
@@ -175,29 +113,11 @@ union sysunion {
 	struct	rmdir_args rmdir;
 	struct	utimes_args utimes;
 	struct	adjtime_args adjtime;
-#ifdef COMPAT_43
-	struct	ogetpeername_args sys_ogetpeername;
-#endif
 	struct	ogethostid_args sys_ogethostid;
-#ifdef COMPAT_43
-	struct	osethostid_args sys_osethostid;
-#endif
-#ifdef COMPAT_43
-	struct	ogetrlimit_args sys_ogetrlimit;
-#endif
-#ifdef COMPAT_43
-	struct	osetrlimit_args sys_osetrlimit;
-#endif
-#ifdef COMPAT_43
-	struct	okillpg_args sys_okillpg;
-#endif
 	struct	setsid_args setsid;
 	struct	quotactl_args quotactl;
 	struct	oquota_args sys_oquota;
 	struct	nfssvc_args nfssvc;
-#ifdef COMPAT_43
-	struct	ogetdirentries_args sys_ogetdirentries;
-#endif
 	struct	statfs_args statfs;
 	struct	fstatfs_args fstatfs;
 	struct	getfh_args getfh;
diff --git a/usr.bin/kdump/mkioctls b/usr.bin/kdump/mkioctls
index bdce54e..120adfa 100644
--- a/usr.bin/kdump/mkioctls
+++ b/usr.bin/kdump/mkioctls
@@ -38,7 +38,6 @@ awk -v x="$ioctl_includes" 'BEGIN {print x}' |
 	awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" '
 BEGIN {
 	print "/* XXX obnoxious prerequisites. */"
-	print "#define COMPAT_43"
 	print "#define _KERNEL_STRUCTURES"
 	print "#include <sys/tty.h>"
 	print "#include <net/if_arp.h>"
-- 
2.9.2

