summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1996-03-18 21:42:32 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1996-03-18 21:42:32 +0000
commit8759b73be49c3cd01d0d099cd6e7600fc6943c25 (patch)
tree8585ffdf923513033d1078ecd95f703b3705fba7
parent68dd1de4eca2964c80624468edee8904201dd30c (diff)
Notes
-rw-r--r--eBones/README.PATCH60
-rw-r--r--eBones/usr.sbin/fix_kdb_keys/Makefile10
-rw-r--r--eBones/usr.sbin/fix_kdb_keys/fix_kdb_keys.c191
-rw-r--r--etc/pccard.conf.sample267
-rw-r--r--etc/rc.pccard20
-rw-r--r--gnu/usr.bin/perl/lib/gethostname.pl36
-rw-r--r--gnu/usr.bin/sort/config.h123
-rw-r--r--gnu/usr.bin/sort/error.h44
-rw-r--r--gnu/usr.bin/sort/xstrtod.c48
-rw-r--r--gnu/usr.bin/sort/xstrtod.h15
-rw-r--r--lib/libc/gen/msgctl.3201
-rw-r--r--lib/libc/gen/msgget.3126
-rw-r--r--lib/libc/gen/msgrcv.3181
-rw-r--r--lib/libc/gen/msgsnd.3145
-rw-r--r--lib/libdisk/libdisk.3315
-rw-r--r--share/doc/handbook/uart.sgml1108
-rw-r--r--share/examples/find_interface/find_interface.c111
-rw-r--r--share/man/man4/intro.4175
-rw-r--r--share/man/man4/man4.i386/lp.4233
-rw-r--r--share/man/man4/man4.i386/mtio.4228
-rw-r--r--share/man/man5/hosts.equiv.5124
-rw-r--r--share/syscons/keymaps/it.iso.kbd112
-rw-r--r--sys/i386/eisa/3c5x9.c309
-rw-r--r--sys/i386/include/laptops.h104
-rw-r--r--usr.bin/locate/locate/locate.updatedb.858
-rw-r--r--usr.bin/locate/locate/updatedb.sh79
-rw-r--r--usr.bin/talk/get_iface.c99
-rw-r--r--usr.sbin/qcamcontrol/Makefile3
-rw-r--r--usr.sbin/qcamcontrol/qcamcontrol.164
-rw-r--r--usr.sbin/qcamcontrol/qcamtime/Makefile8
-rw-r--r--usr.sbin/qcamcontrol/qcamtime/qcamtime.c111
-rw-r--r--usr.sbin/tzsetup/tzsetup.843
32 files changed, 4751 insertions, 0 deletions
diff --git a/eBones/README.PATCH b/eBones/README.PATCH
new file mode 100644
index 000000000000..33cb15f09b1b
--- /dev/null
+++ b/eBones/README.PATCH
@@ -0,0 +1,60 @@
+READ THIS ENTIRE FILE BEFORE PROCEEDING!
+
+This distribution contains a "diff" file suitable for using with the
+"patch" program to update your Kerberos (version 4) source tree. The
+gist of the patch is to replace calls to des_random_key() with calls
+to des_new_random_key().
+
+The primary difference is that des_random_key() uses a seeding
+technique which is predictable and therefore
+vulnerable. des_new_random_key() uses a feedback mechanism based on
+the Data Encryption Standard (DES) and is seeded with a secret (and
+therefore unknown to an attacker) value. This value is the database
+master key, which is a convenient secret value.
+
+This patch assumes that you have the new_rnd_key.c key module (which
+contains the definition and code for des_new_random_key()). It has
+been part of the standard Version 4 distribution since 1992 and is
+used in the admin server (our primary error at MIT was not upgrading
+all of Kerberos to use this newer generator. This patch finishes the
+job).
+
+In addition to the patch file for the Kerberos distribution this
+distribution also contains a program for changing critical system keys
+(namely the "krbtgt" and "changepw.kerberos" keys). When you
+originally built your Kerberos database these keys were chosen at
+random, using the vulnerable version of the kerberos random number
+generator. Therefore it is possible for an attacker to mount an attack
+to guess these values. If an attacker can determine the key for the
+"krbtgt" ticket, they can construct tickets claiming to be any
+kerberos principal. Similarly if an attacker can obtain the
+"changepw.kerberos" key, they can change anyone's password.
+
+The enclosed "fix_kdb_keys.c" (part of the patch file) program, which
+you run on the KDC server, will change these critical keys to new
+values using the newer random number generator. IMPORTANT: When you
+run fix_kdb_keys, all outstanding ticket granting tickets will
+immediately become invalid. This will be disruptive to your user
+community. We recommend that you either do this late at night or early
+in the morning before most users have logged in. Alternatively
+pre-announce a definitive time when you will run the program and
+inform your users that they will have to get new tickets at that time
+(using either "kinit" or simply by logging out and then in again).
+
+NOTE: The only client program modified is "ksrvutil" which is used to
+generate new server keys. All other client/server programs are
+unaffected. End users do *not* need to obtain new versions of programs
+that use Kerberos. This is because most random number generation in
+the Kerberos system is done on the KDC system. By fixing kerberos.c
+you have repaired most of the damage.
+
+To install this patch copy patch_krb to the toplevel of your Kerberos
+source tree. Then type:
+
+patch -p0 <patch_krb
+
+This will install changes to various kerberos modules to upgrade them
+to use des_new_random_key(). It also will install a new program,
+"fix_kdb_keys.c." After the patch is complete type "make world" at the
+toplevel of your Kerberos source tree. This will, among other things,
+build the fix_kdb_keys program.
diff --git a/eBones/usr.sbin/fix_kdb_keys/Makefile b/eBones/usr.sbin/fix_kdb_keys/Makefile
new file mode 100644
index 000000000000..6cbdd167e83d
--- /dev/null
+++ b/eBones/usr.sbin/fix_kdb_keys/Makefile
@@ -0,0 +1,10 @@
+# From: @(#)Makefile 5.2 (Berkeley) 3/5/91
+# $Id: Makefile,v 1.7 1995/09/26 06:20:18 mark Exp $
+
+PROG= fix_kdb_keys
+CFLAGS+=-DKERBEROS -DDEBUG
+DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
+NOMAN= YES
+
+.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/fix_kdb_keys/fix_kdb_keys.c b/eBones/usr.sbin/fix_kdb_keys/fix_kdb_keys.c
new file mode 100644
index 000000000000..3719e784c854
--- /dev/null
+++ b/eBones/usr.sbin/fix_kdb_keys/fix_kdb_keys.c
@@ -0,0 +1,191 @@
+/*
+ * $Source: /afs/net/project/krb4/src/admin/RCS/kdb_edit.c,v $
+ * $Author: tytso $
+ *
+ * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
+ * of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ *
+ * This routine changes the Kerberos encryption keys for principals,
+ * i.e., users or services.
+ */
+
+/*
+ * exit returns 0 ==> success -1 ==> error
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+
+#ifdef NEED_TIME_H
+#include <time.h>
+#endif
+#include <sys/time.h>
+
+#include <des.h>
+#include <krb.h>
+#include <krb_db.h>
+/* MKEYFILE is now defined in kdc.h */
+#include <kdc.h>
+
+char prog[32];
+char *progname = prog;
+int nflag = 0;
+int debug = 0;
+extern int krb_debug;
+
+Principal principal_data;
+
+static C_Block master_key;
+static Key_schedule master_key_schedule;
+static long master_key_version;
+
+static char realm[REALM_SZ];
+
+void fatal_error(), cleanup();
+void Usage();
+void change_principal();
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int i;
+
+ prog[sizeof prog - 1] = '\0'; /* make sure terminated */
+ strncpy(prog, argv[0], sizeof prog - 1); /* salt away invoking
+ * program */
+
+ /* Assume a long is four bytes */
+ if (sizeof(long) != 4) {
+ fprintf(stderr, "%s: size of long is %d.\n", prog, sizeof(long));
+ exit(-1);
+ }
+ while (--argc > 0 && (*++argv)[0] == '-')
+ for (i = 1; argv[0][i] != '\0'; i++) {
+ switch (argv[0][i]) {
+
+ /* debug flag */
+ case 'd':
+ debug = 1;
+ continue;
+
+ /* debug flag */
+ case 'l':
+ krb_debug |= 1;
+ continue;
+
+ case 'n': /* read MKEYFILE for master key */
+ nflag = 1;
+ continue;
+
+ default:
+ fprintf(stderr, "%s: illegal flag \"%c\"\n", progname, argv[0][i]);
+ Usage(); /* Give message and die */
+ }
+ };
+
+ if (krb_get_lrealm(realm, 1)) {
+ fprintf(stderr, "Couldn't get local realm information.\n");
+ fatal_error();
+ }
+
+ kerb_init();
+ if (argc > 0) {
+ if (kerb_db_set_name(*argv) != 0) {
+ fprintf(stderr, "Could not open altername database name\n");
+ fatal_error();
+ }
+ }
+
+ if (kdb_get_master_key ((nflag == 0),
+ master_key, master_key_schedule) != 0) {
+ fprintf (stderr, "Couldn't read master key.\n");
+ fatal_error();
+ }
+
+ if ((master_key_version = kdb_verify_master_key(master_key,
+ master_key_schedule,
+ stdout)) < 0)
+ fatal_error();
+
+ des_init_random_number_generator(master_key);
+
+ change_principal("krbtgt", realm);
+ change_principal("changepw", KRB_MASTER);
+
+ cleanup();
+
+ printf("\nKerberos database updated successfully. Note that all\n");
+ printf("existing ticket-granting tickets have been invalidated.\n\n");
+
+ return(0);
+}
+
+void change_principal(input_name, input_instance)
+ char *input_name;
+ char *input_instance;
+{
+ int n, more;
+ C_Block new_key;
+
+ n = kerb_get_principal(input_name, input_instance, &principal_data,
+ 1, &more);
+ if (!n) {
+ fprintf(stderr, "Can't find principal database for %s.%s.\n",
+ input_name, input_instance);
+ fatal_error();
+ }
+ if (more) {
+ fprintf(stderr, "More than one entry for %s.%s.\n", input_name,
+ input_instance);
+ fatal_error();
+ }
+
+ des_new_random_key(new_key);
+
+ /* seal it under the kerberos master key */
+ kdb_encrypt_key (new_key, new_key,
+ master_key, master_key_schedule,
+ ENCRYPT);
+ memcpy(&principal_data.key_low, new_key, 4);
+ memcpy(&principal_data.key_high, ((long *) new_key) + 1, 4);
+ memset(new_key, 0, sizeof(new_key));
+
+ principal_data.key_version++;
+
+ if (kerb_put_principal(&principal_data, 1)) {
+ fprintf(stderr, "\nError updating Kerberos database");
+ fatal_error();
+ }
+
+ memset(&principal_data.key_low, 0, 4);
+ memset(&principal_data.key_high, 0, 4);
+}
+
+void fatal_error()
+{
+ cleanup();
+ exit(1);
+}
+
+void cleanup()
+{
+
+ memset(master_key, 0, sizeof(master_key));
+ memset(master_key_schedule, 0, sizeof(master_key_schedule));
+ memset(&principal_data, 0, sizeof(principal_data));
+}
+
+void Usage()
+{
+ fprintf(stderr, "Usage: %s [-n]\n", progname);
+ exit(1);
+}
diff --git a/etc/pccard.conf.sample b/etc/pccard.conf.sample
new file mode 100644
index 000000000000..a9f9d09ce5fc
--- /dev/null
+++ b/etc/pccard.conf.sample
@@ -0,0 +1,267 @@
+# Sample PCCARD configuration file
+#
+# Removing all IRQ conflicts from this file can't be done because of some
+# IRQ-selfish PC-cards. So if you want to use some of these cards in
+# your machine, you will be forced to modify their IRQ parameters from
+# the following list.
+#
+# IRQ == 0 means "allocate free IRQ from IRQ pool"
+# IRQ == 16 means "do not use IRQ (e.g. PIO mode)"
+#
+# $Id: pccard.conf.sample,v 1.1 1996/03/12 15:39:21 nate Exp $
+
+# Generally available IO ports
+io 0x240-0x360
+# Generally available IRQs (Built-in sound-card owners remove 5)
+irq 3 5 10 11 13 15
+# Available memory slots
+memory 0xd4000 96k
+
+#IBM PCMCIA Ethernet I/II
+card "IBM Corp." "Ethernet"
+ config 0x1 "ed0" 11
+ ether 0xff0
+ insert echo IBM PCMCIA Ethernet inserted
+ insert /etc/pccard_ether ed0
+ remove echo IBM PCMCIA Ethernet removed
+ remove /sbin/ifconfig ed0 delete
+
+# Melco LPC-T (PIO mode)
+card "PCMCIA" "UE2212"
+ config 0x1 "ed0" 11 0x10
+ ether 0xff0
+ insert echo UE2212 inserted
+ insert /etc/pccard_ether ed0
+ remove echo UE2212 card removed
+ remove /sbin/ifconfig ed0 delete
+
+# Accton EN2212
+# Very slow! (PIO mode)
+card "ACCTON" "EN2212"
+ config 0x1 "ed0" 11 0x10
+ ether 0xff0
+ insert echo Accton EN2212 inserted
+ insert /etc/pccard_ether ed0
+ remove echo Accton EN2212 removed
+ remove /sbin/ifconfig ed0 delete
+
+# 3Com Etherlink III 3C589B, 3C589C
+card "3Com Corporation" "3C589"
+ config 0x1 "nep0" 11
+ insert echo 3Com Etherlink III inserted
+ insert /etc/pccard_ether nep0
+# insert /etc/pccard_ether nep0 link0
+ remove echo 3Com Etherlink III removed
+ remove /sbin/ifconfig nep0 delete
+
+# Farallon EtherMac
+card "Farallon" "ENet"
+ config 0x1 "nep0" 11
+ insert echo Farallon EtherMac inserted
+ insert /etc/pccard_ether nep0
+# insert /etc/pccard_ether nep0 link0
+ remove echo Farallon EtherMac removed
+ remove /sbin/ifconfig nep0 delete
+
+# Fujitsu MBH10302
+card "PCMCIA MBH10302" "01"
+ config 0x14 "fe0" 10
+ insert echo Fujitsu MBH10302 inserted
+ insert /etc/pccard_ether fe0
+ remove echo Fujitsu MBH10302 removed
+ remove /sbin/ifconfig fe0 delete
+
+# NextCom J Link NC5310
+card "NextComK.K." "NC5310 Ver1.0 "
+ config 0x14 "fe0" 10
+ insert echo NextCom J Link NC5310 inserted
+ insert /etc/pccard_ether fe0
+ remove echo NextCom J Link NC5310 removed
+ remove /sbin/ifconfig fe0 delete
+
+# HITACHI HT-4840-11
+card "HITACHI" "HT-4840-11"
+ config 0x1a "fe0" 15
+ insert echo HT-4840-11 inserted
+ insert /etc/pccard_ether fe0
+ remove echo HT-4840-11 removed
+ remove /sbin/ifconfig fe0 delete
+
+# AIWA PV-JF288
+card "AIWA CO.,LTD." "PV-JF288 "
+ config 0x23 "sio2" 10
+ insert echo AIWA PV-JF288 inserted
+ remove echo AIWA PV-JF288 removed
+
+# Megahertz XJ1144
+card "MEGAHERTZ" "XJ1144"
+ config 0x23 "sio2" 10
+ insert echo Megahertz XJ1144 inserted
+ remove echo Megahertz XJ1144 removed
+
+# Megahertz XJ2144 (US)
+card "MEGAHERTZ" "XJ2144"
+ config 0x23 "sio2" 10
+ insert echo Megahertz XJ2144 inserted
+ remove echo Megahertz XJ2144 removed
+
+# Megahertz XJ2144 (JP)
+card "MEGAHERTZ" "XJ2144-81"
+ config 0x23 "sio2" 10
+ insert echo Megahertz XJ2144 inserted
+ remove echo Megahertz XJ2144 removed
+
+# Megahertz XJ2288
+card "MEGAHERTZ" "XJ2288"
+ config 0x23 "sio2" 10
+ insert echo Megahertz XJ2288 inserted
+ remove echo Megahertz XJ2288 removed
+
+# Omron ME2814 FAX/DATA MODEM
+card "OMRON" "ME2814 FAX/DATA MOD"
+ config 0x23 "sio2" 3
+ insert echo OMRON ME2814 Modem inserted
+ remove echo OMRON ME2814 Modem removed
+
+# TDK 14.4 FAX/Data Modem
+card "TDK" "DF1414 DATA/FAX MOD"
+ config 0x23 "sio2" 10
+ insert echo TDK DF1414 inserted
+ remove echo TDK DF1414 removed
+
+# TDK 14.4 FAX/Data Modem
+card "TDK" "DF1414EX DATA/FAX M"
+ config 0x23 "sio2" 10
+ insert echo TDK DF1414 inserted
+ remove echo TDK DF1414 removed
+
+# Panasonic Modem Card TO-706C
+card "Panasonic" "TO-706C"
+ config 0x23 "sio2" 10
+ insert echo Panasonic TO-706C inserted
+ remove echo Panasonic TO-706C removed
+
+# Panasonic Modem Card TO-706C
+card "Panasonic" "TO-CAF288"
+ config 0x23 "sio2" 10
+ insert echo Panasonic TO-CAF288 inserted
+ remove echo Panasonic TO-CAF288 removed
+
+# NewMedia 14.4K FAX/Data Modem
+card "CIRRUS LOGIC" "FAX MODEM"
+ config 0x23 "sio2" 10
+ insert echo Newmedia 14.4 Modem inserted
+ remove echo Newmedia 14.4 Modem removed
+
+# Omron MD24XCA FAX/Data Modem
+card "OMRON Corp." "MD24XCA"
+ config 0x23 "sio2" 16
+ reset 10000
+ insert echo OMRON MD24XCA Modem inserted
+ remove echo OMRON MD24XCA Modem removed
+
+# Hayes OPTIMA 288 FAX/Data Modem
+# currently does not work on my machine
+card "Hayes" "OPTIMA 288 + FAX fo"
+ config 0x24 "sio2" 5
+ reset 10000
+ insert echo Optima 288 inserted
+ remove echo Optima 288 removed
+
+# PREMAX FM288 FAX/Data Modem
+card "PREMAX" "FM288 "
+ config 0x23 "sio2" 10
+ insert echo PREMAX FM288 Modem inserted
+ remove echo PREMAX FM288 Modem removed
+
+# Novalink NovaModem 144
+card "NovaLink Tech." "NovaModem 144 "
+ config 0x23 "sio2" 10
+ insert echo NovaModem 144 Modem inserted
+ remove echo NovaModem 144 Modem removed
+
+# US Robotics Sportster PCMCIA V.34
+# US Robotics COURIER PCMCIA V.34
+card "USRobotics" "PCMCIA 28800 Data/F"
+ config 0x3 "sio2" 3
+ insert echo USRobotics PCMCIA Modem inserted
+ remove echo USRobotics PCMCIA Modem removed
+
+# Xircom CreditCard Ethernet+Modem (Modem only !!!)
+card "Xircom" "CreditCard Ethernet"
+ config 0x23 "sio2" 3
+ insert echo Xircom CreditCard Modem inserted
+ remove echo Xircom CreditCard Modem removed
+
+# GATEWAY 2000 FAX/Data Modem (14.4K)
+card "GATEWAY2000" "CC3144"
+ config 0x22 "sio3" 7
+ insert echo GATEWAY2000 FAX/Data Modem inserted
+ remove echo GATEWAY2000 FAX/Data Modem removed
+
+# IBM Push/Pop Modem (14.4K)
+card "IBM" "Push/Pop Modem(14.4"
+ config 0x22 "sio2" 5
+ insert echo IBM Push/Pop Modem inserted
+ remove echo IBM Push/Pop Modem removed
+
+
+# BUG Linkboy D64K (ISDN)
+card "BUG Inc." "Linkboy D64K"
+ config 0x23 "sio2" 3
+ insert echo BUG Linkboy D64K inserted
+ remove echo BUG Linkboy D64K removed
+
+# NTT DoCoMo DATA/FAX Adapter
+card "NTT DoCoMo" "PCMCIA DATA/FAX ADA"
+ config 0x22 "sio3" 10 0x82
+ insert echo NTT DoCoMo DATA/FAX Adapter inserted
+ remove echo NTT DoCoMo DATA/FAX Adapter removed
+
+# Panasonic FM-RADIO card
+card "Panasonic" "CF-JVR101"
+ config 0x22 "sio3" 16
+ insert echo Panasonic FM radio card inserted
+ remove echo Panasonic FM radio card removed
+
+# SunDisk Flash ATA
+# (OEM: Epson Flash Packer)
+card "SunDisk" "SDP5"
+ config 0x3 "wdc1" 7
+ insert echo Sundisk Flash ATA inserted
+ remove echo Sundisk Flash ATA removed
+
+card "SunDisk" "SDP"
+ config 0x3 "wdc1" 7
+ insert echo SunDisk Flash ATA Inserted
+ remove echo SunDisk Flash ATA Removed
+
+# Midori Elec Fast Flash
+card "Midori Elec." "FAST FLASH"
+ config 0x3 "wdc1" 9
+ insert echo Midori Elec Fast FLASH inserted
+ remove echo Midori Elec Fast FLASH removed
+
+# Maxtor 131MB Type III HDD
+card "Maxtor" "MXL131"
+ config 0x03 "wdc1" 10
+ insert echo Maxtor 131MB HDD inserted
+ remove echo Maxtor 131MB HDD removed
+
+# Adaptec SlimSCSI
+card "Adaptec, Inc." "APA-1460 SCSI Host "
+ config 0x9 "aic0" 10
+ insert echo Adaptec Slim SCSI inserted
+ remove echo Adaptec Slim SCSI removed
+
+# NewMedia Bustoaster SCSI
+card "New Media" "SCSI"
+ config 0x22 "aic0" 10
+ insert echo New Media Bus Toaster inserted
+ remove echo New Media Bus Toaster removed
+
+# REX5535AC, REX5535X SCSI
+card "PCMCIA SCSI MBH1040" "01"
+ config 0x3a "spc0" 11
+ insert echo REX-5535 SCSI card inserted
+ remove echo REX-5535 SCSI card removed
diff --git a/etc/rc.pccard b/etc/rc.pccard
new file mode 100644
index 000000000000..597e89450ef6
--- /dev/null
+++ b/etc/rc.pccard
@@ -0,0 +1,20 @@
+#!/bin/sh -
+#
+# PC-card startup script
+# HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
+#
+
+if [ "x$apm_enable" = "xYES" ] ; then
+ echo "Enable APM BIOS."
+ /usr/sbin/apmconf -e
+fi
+
+if [ "x$pccard_enable" != "xNO" ] ; then
+ if [ "x$pccard_mem" != "xDEFAULT" ] ; then
+ /usr/sbin/pccardc pccardmem $pccard_mem
+ else
+ /usr/sbin/pccardc pccardmem 0xd0000
+ fi
+ echo -n "Enable PC-card."
+ /usr/sbin/pccardd 2>&1 > /var/log/pccardd.debug &
+fi
diff --git a/gnu/usr.bin/perl/lib/gethostname.pl b/gnu/usr.bin/perl/lib/gethostname.pl
new file mode 100644
index 000000000000..2342bad7d7b9
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/gethostname.pl
@@ -0,0 +1,36 @@
+#
+# Simple package to get the hostname via __sysctl(2).
+#
+# Written 13-Feb-96 by Jörg Wunsch, interface business GmbH Dresden.
+# Placed in the public domain.
+#
+# $Id: gethostname.pl,v 1.1 1996/02/13 13:17:49 joerg Exp $
+#
+
+package gethostname;
+
+require "sys/syscall.ph";
+require "sys/sysctl.ph";
+
+#
+# usage:
+#
+# require "gethostname.pl";
+# printf "This machine is named \"%s\".\n", &gethostname;
+#
+
+sub main'gethostname {
+ # get hostname via sysctl(2)
+ local($name, $oldval, $oldlen, $len);
+ $name = pack("LL", &CTL_KERN, &KERN_HOSTNAME);
+ # 64-byte string to get the hostname
+ $oldval = " " x 64;
+ $oldlen = pack("L", length($oldval));
+ syscall(&SYS___sysctl, $name, 2, $oldval, $oldlen, 0, 0) != -1 ||
+ die "Cannot get hostname via sysctl(2), errno = $!\n";
+
+ ($len) = unpack("L", $oldlen);
+ return substr($oldval, 0, $len - 1);
+}
+
+1;
diff --git a/gnu/usr.bin/sort/config.h b/gnu/usr.bin/sort/config.h
new file mode 100644
index 000000000000..27f201bb570e
--- /dev/null
+++ b/gnu/usr.bin/sort/config.h
@@ -0,0 +1,123 @@
+/* config.h. Generated automatically by configure. */
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define if using alloca.c. */
+/* #undef C_ALLOCA */
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define if you have alloca, as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if the `long double' type works. */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define if your struct stat has st_blksize. */
+#define HAVE_ST_BLKSIZE 1
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define if the system does not provide POSIX.1 features except
+ with this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to 1 if ANSI function prototypes are usable. */
+#define PROTOTYPES 1
+
+/* Define to 1 if GNU regex should be used instead of GNU rx. */
+/* #undef WITH_REGEX */
+
+/* Define if you have the isascii function. */
+#define HAVE_ISASCII 1
+
+/* Define if you have the strchr function. */
+#define HAVE_STRCHR 1
+
+/* Define if you have the strerror function. */
+#define HAVE_STRERROR 1
+
+/* Define if you have the strrchr function. */
+#define HAVE_STRRCHR 1
+
+/* Define if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
diff --git a/gnu/usr.bin/sort/error.h b/gnu/usr.bin/sort/error.h
new file mode 100644
index 000000000000..481c54d2e11b
--- /dev/null
+++ b/gnu/usr.bin/sort/error.h
@@ -0,0 +1,44 @@
+/* error.h -- declaration for error-reporting function
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _error_h_
+#define _error_h_
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+
+#if __STDC__
+void error (int, int, const char *, ...) \
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+#else
+void error ();
+#endif
+
+/* This variable is incremented each time `error' is called. */
+extern unsigned int error_message_count;
+
+#endif /* _error_h_ */
diff --git a/gnu/usr.bin/sort/xstrtod.c b/gnu/usr.bin/sort/xstrtod.c
new file mode 100644
index 000000000000..838c5c463213
--- /dev/null
+++ b/gnu/usr.bin/sort/xstrtod.c
@@ -0,0 +1,48 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#else
+double strtod ();
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <limits.h>
+#include <ctype.h>
+#include "xstrtod.h"
+
+int
+xstrtod (str, ptr, result)
+ const char *str;
+ const char **ptr;
+ double *result;
+{
+ double val;
+ char *terminator;
+ int fail;
+
+ fail = 0;
+ errno = 0;
+ val = strtod (str, &terminator);
+
+ /* Having a non-zero terminator is an error only when PTR is NULL. */
+ if (terminator == str || (ptr == NULL && *terminator != '\0'))
+ fail = 1;
+ else
+ {
+ /* Allow underflow (in which case strtod returns zero),
+ but flag overflow as an error. */
+ if (val != 0.0 && errno == ERANGE)
+ fail = 1;
+ }
+
+ if (ptr != NULL)
+ *ptr = terminator;
+
+ *result = val;
+ return fail;
+}
+
diff --git a/gnu/usr.bin/sort/xstrtod.h b/gnu/usr.bin/sort/xstrtod.h
new file mode 100644
index 000000000000..15b85f446fa4
--- /dev/null
+++ b/gnu/usr.bin/sort/xstrtod.h
@@ -0,0 +1,15 @@
+#ifndef XSTRTOD_H
+#define XSTRTOD_H 1
+
+#ifndef __P
+# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+# define __P(args) args
+# else
+# define __P(args) ()
+# endif /* GCC. */
+#endif /* Not __P. */
+
+int
+ xstrtod __P ((const char *str, const char **ptr, double *result));
+
+#endif /* XSTRTOD_H */
diff --git a/lib/libc/gen/msgctl.3 b/lib/libc/gen/msgctl.3
new file mode 100644
index 000000000000..27da57c10765
--- /dev/null
+++ b/lib/libc/gen/msgctl.3
@@ -0,0 +1,201 @@
+.\" $NetBSD: msgctl.2,v 1.1 1995/10/16 23:49:15 jtc Exp $
+.\"
+.\" Copyright (c) 1995 Frank van der Linden
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Frank van der Linden
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"/
+.Dd August 17, 1995
+.Dt MSGCTL 3
+.Os NetBSD
+.Sh NAME
+.Nm msgctl
+.Nd message control operations
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/ipc.h>
+.Fd #include <sys/msg.h>
+.Ft int
+.Fn msgctl "int msqid" "int cmd" "struct msqid_ds *buf"
+.Sh DESCRIPTION
+The
+.Fn msgctl
+system call performs some control operations on the message queue specified
+by
+.Fa msqid .
+
+Each message queue has a data structure associated with it, parts of which
+may be altered by
+.Fn msgctl
+and parts of which determine the actions of
+.Fn msgctl .
+The data structure is defined in
+.Aq Pa sys/msg.h
+and contains (amongst others) the following members:
+.Bd -literal
+struct msqid_ds {
+ struct ipc_perm msg_perm; /* msg queue permission bits */
+ u_long msg_cbytes; /* # of bytes in use on the queue */
+ u_long msg_qnum; /* # of msgs in the queue */
+ u_long msg_qbytes; /* max # of bytes on the queue */
+ pid_t msg_lspid; /* pid of last msgsnd() */
+ pid_t msg_lrpid; /* pid of last msgrcv() */
+ time_t msg_stime; /* time of last msgsnd() */
+ time_t msg_rtime; /* time of last msgrcv() */
+ time_t msg_ctime; /* time of last msgctl() */
+};
+.Ed
+
+The
+.Bf -literal
+ipc_perm
+.Ef
+structure used inside the
+.Bf -literal
+shmid_ds
+.Ef
+structure is defined in
+.Aq Pa sys/ipc.h
+and looks like this:
+.Bd -literal
+struct ipc_perm {
+ ushort cuid; /* creator user id */
+ ushort cgid; /* creator group id */
+ ushort uid; /* user id */
+ ushort gid; /* group id */
+ ushort mode; /* permission (9 bits, see chmod(2)) */
+ ushort seq; /* sequence # (to generate unique id) */
+ key_t key; /* user specified msg/sem/shm key */
+};
+.Ed
+
+The operation to be performed by
+.Fn msgctl
+is specified in
+.Fa cmd
+and is one of:
+.Bl -tag -width IPC_RMIDX
+.It Dv IPC_STAT
+Gather information about the message queue and place it in the
+structure pointed to by
+.Fa buf .
+.It Dv IPC_SET
+Set the value of the
+.Va msg_perm.uid ,
+.Va msg_perm.gid ,
+.Va msg_perm.mode
+and
+.Va msg_qbytes
+fields in the structure associated with
+.Fa msqid .
+The values are taken from the corresponding fields in the structure
+pointed to by
+.Fa buf .
+This operation can only be executed by the super-user, or a process that
+has an effective user id equal to either
+.Va msg_perm.cuid
+or
+.Va msg_perm.uid
+in the data structure associated with the message queue.
+The value of
+.Va msg_qbytes
+can only be increased by the super-user. Values for
+.Va msg_qbytes
+that exceed the system limit (MSGMNB from
+.Aq Pa sys/msg.h )
+are silently truncated to that limit.
+
+.It Dv IPC_RMID
+Remove the message queue specified by
+.Fa msqid
+and destroy the data associated with it. Only the super-user or a process
+with an effective uid equal to the
+.Va msg_perm.cuid
+or
+.Va msg_perm.uid
+values in the data structure associated with the queue can do this.
+.El
+
+The permission to read from or write to a message queue (see
+.Xr msgsnd 3
+and
+.Xr msgrcv 3 )
+is determined by the
+.Va msg_perm.mode
+field in the same way as is
+done with files (see
+.Xr chmod 2 ),
+but the effective uid can match either the
+.Va msg_perm.cuid
+field or the
+.Va msg_perm.uid
+field, and the
+effective gid can match either
+.Va msg_perm.cgid
+or
+.Va msg_perm.gid .
+.Sh RETURN VALUES
+Upon successful completion, a value of 0 is returned. Otherwise, -1 is
+returned and the global variable
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+.Fn msgctl
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+.Fa cmd
+is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
+the effective uid match either the
+.Va msg_perm.uid
+or
+.Va msg_perm.cuid
+fields of the data structure associated with the message queue.
+
+An attempt is made to increase the value of
+.Va msg_qbytes
+through IPC_SET
+but the caller is not the super-user.
+.It Bq Er EACCESS
+The command is IPC_STAT
+and the caller has no read permission for this message queue.
+.It Bq Er EINVAL
+.Fa msqid
+is not a valid message queue identifier.
+
+.Va cmd
+is not a valid command.
+.It Bq Er EFAULT
+.Fa buf
+specifies an invalid address.
+.El
+.Sh SEE ALSO
+.Xr msgsnd 3 ,
+.Xr msgrcv 3 ,
+.Xr msgget 3
+.Sh HISTORY
+Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libc/gen/msgget.3 b/lib/libc/gen/msgget.3
new file mode 100644
index 000000000000..41a720234f5b
--- /dev/null
+++ b/lib/libc/gen/msgget.3
@@ -0,0 +1,126 @@
+.\" $NetBSD: msgget.2,v 1.1 1995/10/16 23:49:19 jtc Exp $
+.\"
+.\" Copyright (c) 1995 Frank van der Linden
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Frank van der Linden
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"/
+.Dd August 17, 1995
+.Dt MSGGET 3
+.Os NetBSD
+.Sh NAME
+.Nm msgget
+.Nd get message queue
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/ipc.h>
+.Fd #include <sys/msg.h>
+.Ft int
+.Fn msgget "key_t key" "int msgflg"
+.Sh DESCRIPTION
+.Fn msgget
+returns the message queue identifier associated with
+.Fa key .
+A message queue identifier is a unique integer greater than zero.
+
+A message queue is created if either
+.Fa key
+is equal to IPC_PRIVATE, or
+.Fa key
+does not have a message queue identifier associated with it, and the IPC_CREAT
+bit is set in
+.Fa msgflg.
+
+If a new message queue is created, the data structure associated with it (the
+.Va msqid_ds
+structure, see
+.Xr msgctl 3 )
+is initialized as follows:
+.Bl -bullet
+.It
+.Va msg_perm.cuid
+and
+.Va msg_perm.uid
+are set to the effective uid of the calling process.
+.It
+.Va msg_perm.gid
+and
+.Va msg_perm.cgid
+are set to the effective gid of the calling process.
+.It
+.Va msg_perm.mode
+is set to the lower 9 bits of
+.Fa msgflg .
+.It
+.Va msg_cbytes ,
+.Va msg_qnum ,
+.Va msg_lspid ,
+.Va msg_lrpid ,
+.Va msg_rtime ,
+and
+.Va msg_stime
+are set to 0
+.It
+.Va msg_qbytes
+is set to the system wide maximum value for the number of bytes in a queue
+(MSGMNB).
+.It
+.Va msg_ctime
+is set to the current time.
+.El
+.Sh RETURN VALUES
+Upon successful completion a positive message queue identifier is returned.
+Otherwise, -1 is returned and the global variable
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACESS
+A message queue is already associated with
+.Fa key
+and the caller has no permission to access it.
+.It Bq Er EEXIST
+Both IPC_CREAT and IPC_EXCL are set in
+.Fa msgflg ,
+and a message queue is already associated with
+.Fa key .
+.It Bq Er ENOSPC
+A new message queue could not be created because the system limit for
+the number of message queues has been reached.
+.It Bq Er ENOENT
+IPC_CREAT was not set in
+.Fa msgflg
+and no message queue associated with
+.Fa key
+was found.
+.El
+.Sh SEE ALSO
+.Xr msgctl 3 ,
+.Xr msgrcv 3 ,
+.Xr msgsnd 3
+.Sh HISTORY
+Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libc/gen/msgrcv.3 b/lib/libc/gen/msgrcv.3
new file mode 100644
index 000000000000..db61fabbdbe3
--- /dev/null
+++ b/lib/libc/gen/msgrcv.3
@@ -0,0 +1,181 @@
+.\" $NetBSD: msgrcv.2,v 1.1 1995/10/16 23:49:20 jtc Exp $
+.\"
+.\" Copyright (c) 1995 Frank van der Linden
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Frank van der Linden
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"/
+.Dd August 17, 1995
+.Dt MSGRCV 3
+.Os NetBSD
+.Sh NAME
+.Nm msgrcv
+.Nd receive a message from a message queue
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/ipc.h>
+.Fd #include <sys/msg.h>
+.Ft int
+.Fn msgrcv "int msqid" "void *msgp" "size_t msgsz" "long msgtyp" "int msgflg"
+.Sh DESCRIPTION
+The
+.Fn msgrcv
+function receives a message from the message queue specified in
+.Fa msqid ,
+and places it into the structure pointed to by
+.Fa msgp .
+This structure should consist of the following members:
+.Bd -literal
+ long mtype; /* message type */
+ char mtext[1]; /* body of message */
+.Ed
+
+.Va mtype
+is an integer greater than 0 that can be used for selecting messages,
+.Va mtext
+is an array of bytes, with a size up to that of the system limit (MSGMAX).
+
+The value of
+.Fa msgtyp
+has one of the following meanings:
+.Bl -bullet
+.It
+.Fa msgtyp
+is greater than 0. The first message of type
+.Fa msgtyp
+will be received.
+.It
+.Fa msgtyp
+is equal to 0. The first message on the queue will be received.
+.It
+.Fa msgtyp
+is less than 0. The first message of the lowest message type that is
+less than or equal to the absolute value of
+.Fa msgtyp
+will be received.
+.El
+
+.Fa msgsz
+specifies the maximum length of the requested message. If the received
+message has a length greater than
+.Fa msgsz
+it will be silently truncated if the MSG_NOERROR flag is set in
+.Fa msgflg ,
+otherwise an error will be returned.
+
+If no matching message is present on the message queue specified by
+.Fa msqid ,
+the behavior of
+.Fn msgrcv
+depends on whether the IPC_NOWAIT flag is set in
+.Fa msgflg
+or not. If IPC_NOWAIT is set,
+.Fn msgrcv
+will immediately return a value of -1, and set
+.Va errno
+to EAGAIN. If IPC_NOWAIT is not set, the calling process will be blocked
+until:
+.Bl -bullet
+.It
+A message of the requested type becomes available on the message queue.
+.It
+The message queue is removed, in which case -1 will be returned, and
+.Va errno
+set to EINVAL.
+.It
+A signal is received and caught. -1 is returned, and
+.Va errno
+set to EINTR.
+.El
+
+If a message is successfully received, the data structure associated with
+.Fa msqid
+is updated as follows:
+.Bl -bullet
+.It
+.Va msg_cbytes
+is decremented by the size of the message.
+.It
+.Va msg_lrpid
+is set to the pid of the caller.
+.It
+.Va msg_lrtime
+is set to the current time.
+.It
+.Va msg_qnum
+is decremented by 1.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn msgrcv
+returns the number of bytes received into the
+.Va mtext
+field of the structure pointed to by
+.Fa msgp .
+Otherwise, -1 is returned, and
+.Va errno
+set to indicate the error.
+.Sh ERRORS
+.Fn msgrcv
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa msqid
+is not a valid message queue identifier
+
+The message queue was removed while
+.Fn msgrcv
+was waiting for a message of the requested type to become available on it.
+
+.Fa msgsz
+is less than 0.
+.It Bq Er E2BIG
+A matching message was received, but its size was greater than
+.Fa msgsz
+and the MSG_NOERROR flag was not set in
+.Fa msgflg .
+.It Bq Er EACCESS
+The calling process does not have read access to the message queue.
+.It Bq Er EFAULT
+.Fa msgp
+points to an invalid address.
+.It Bq Er EINTR
+The system call was interrupted by the delivery of a signal.
+.It Bq Er EAGAIN
+There is no message of the requested type available on the message queue,
+and IPC_NOWAIT is set in
+.Fa msgflg .
+.Sh SEE ALSO
+.Xr msgsnd 3 ,
+.Xr msgctl 3 ,
+.Xr msgget 3
+.Sh BUGS
+NetBSD and FreeBSD do not define the EIDRM error value, which should be used in
+the case of a removed message queue, nor the ENOMSG value, which
+should be used when no suitable message is available and IPC_NOWAIT
+is set.
+.Sh HISTORY
+Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libc/gen/msgsnd.3 b/lib/libc/gen/msgsnd.3
new file mode 100644
index 000000000000..b97a313590a9
--- /dev/null
+++ b/lib/libc/gen/msgsnd.3
@@ -0,0 +1,145 @@
+.\" $NetBSD: msgsnd.2,v 1.1 1995/10/16 23:49:24 jtc Exp $
+.\"
+.\" Copyright (c) 1995 Frank van der Linden
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Frank van der Linden
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"/
+.Dd August 17, 1995
+.Dt MSGSND 3
+.Os NetBSD
+.Sh NAME
+.Nm msgsnd
+.Nd send a message to a message queue
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/ipc.h>
+.Fd #include <sys/msg.h>
+.Ft int
+.Fn msgsnd "int msqid" "void *msgp" "size_t msgsz" "int msgflg"
+.Sh DESCRIPTION
+The
+.Fn msgsnd
+function sends a message from the message queue specified in
+.Fa msqid .
+.Fa msgp
+points to a structure containing the message. This structure should
+consist of the following members:
+.Bd -literal
+ long mtype; /* message type */
+ char mtext[1]; /* body of message */
+.Ed
+
+.Va mtype
+is an integer greater than 0 that can be used for selecting messages (see
+.Xr msgrcv 3 ) ,
+.Va mtext
+is an array of bytes, with a size up to that of the system limit (MSGMAX).
+
+If the number of bytes already on the message queue plus
+.Fa msgsz
+is bigger than the maximum number of bytes on the message queue (
+.Va msg_qbytes ,
+see
+.Xr msgctl 3 ) ,
+or the number of messages on all queues system-wide is already equal to
+the system limit,
+.Fa msgflg
+determines the action of
+.Fn msgsnd .
+If
+.Fa msgflg
+has IPC_NOWAIT mask set in it, the call will return immediately. If
+.Fa msgflg
+does not have IPC_NOWAIT set in it, the call will block until:
+.Bl -bullet
+.It
+The condition which caused the call to block does no longer exist.
+The message will be sent.
+.It
+The message queue is removed, in which case -1 will be returned, and
+.Va errno
+is set to EINVAL.
+.It
+The caller catches a signal. The call returns with
+.Va errno
+set to EINTR.
+.El
+
+After a successful call, the data structure associated with the message
+queue is updated in the following way:
+.Bl -bullet
+.It
+.Va msg_cbytes
+is incremented by the size of the message.
+.It
+.Va msg_qnum
+is incremented by 1.
+.It
+.Va msg_lspid
+is set to the pid of the calling process.
+.It
+.Va msg_stime
+is set to the current time.
+.El
+.Sh RETURN VALUES
+Upon successful completion, 0 is returned. Otherwise, -1 is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+.Fn msgsnd
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa msqid
+is not a valid message queue identifier
+
+The message queue was removed while
+.Fn msgsnd
+was waiting for a resource to become available in order to deliver the
+message.
+
+.Fa msgsz
+is less than 0, or greater than
+.Va msg_qbytes .
+.It Bq Er EACCESS
+The calling process does not have write access to the message queue.
+.It Bq Er EAGAIN
+There was no space for this message either on the queue, or in the whole
+system, and IPC_NOWAIT was set in
+.Fa msgflg .
+.It Bq Er EFAULT
+.Fa msgp
+points to an invalid address.
+.It Bq Er EINTR
+The system call was interrupted by the delivery of a signal.
+.El
+.Sh BUGS
+NetBSD and FreeBSD do not define the EIDRM error value, which should be used
+in the case of a removed message queue.
+.Sh HISTORY
+Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libdisk/libdisk.3 b/lib/libdisk/libdisk.3
new file mode 100644
index 000000000000..cf8b05bc5c7b
--- /dev/null
+++ b/lib/libdisk/libdisk.3
@@ -0,0 +1,315 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $Id$
+.\" "
+.Dd March 15, 1996
+.Dt LIBDISK 3
+.Os
+.Sh NAME
+.Nm Open_Disk ,
+.Nm Clone_Disk ,
+.Nm Free_Disk ,
+.Nm Debug_Disk ,
+.Nm Set_Bios_Geom ,
+.Nm Delete_Chunk ,
+.Nm Collapse_Disk ,
+.Nm Collapse_Chunk ,
+.Nm Create_Chunk ,
+.Nm All_FreeBSD ,
+.Nm CheckRules ,
+.Nm Disk_Names ,
+.Nm Set_Boot_Mgr ,
+.Nm Set_Boot_Blocks ,
+.Nm Write_Disk ,
+.Nm Cyl_Aligned ,
+.Nm Next_Cyl_Aligned ,
+.Nm Prev_Cyl_Aligned ,
+.Nm Track_Aligned ,
+.Nm Next_Track_Aligned ,
+.Nm Prev_Track_Aligned ,
+.Nm Create_Chunk_DWIM ,
+.Nm MakeDev ,
+.Nm MakeDevDisk ,
+.Nm ShowChunkFlags ,
+.Nm ChunkCanBeRoot ,
+.Nd library interface to slice and partition labels
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <libdisk.h>
+.Ft struct disk *
+.Fn Open_Disk "char *devname"
+.Ft struct disk *
+.Fn Clone_Disk "struct disk *disk"
+.Ft void
+.Fn Free_Disk "struct disk *disk"
+.Ft void
+.Fn Debug_Disk "struct disk *disk"
+.Ft void
+.Fn Set_Bios_Geom "struct disk *disk" "u_long cyl" "u_long heads" "u_long sects"
+.Ft int
+.Fn Delete_Chunk "struct disk *disk" "struct chunk *"
+.Ft void
+.Fn Collapse_Disk "struct disk *disk"
+.Ft int
+.Fn Collapse_Chunk "struct disk *disk" "struct chunk *chunk"
+.Ft int
+.Fn Create_Chunk "struct disk *disk" "u_long offset" "u_long size" "chunk_e type" "int subtype" "u_long flags"
+.Ft void
+.Fn All_FreeBSD "struct disk *d" "int force_all"
+.Ft char *
+.Fn CheckRules "struct disk *"
+.Ft char **
+.Fn Disk_Names "void"
+.Ft void
+.Fn Set_Boot_Mgr "struct disk *d" "u_char *bootmgr"
+.Ft void
+.Fn Set_Boot_Blocks "struct disk *d" "u_char *boot1" "u_char *boot2"
+.Ft int
+.Fn Write_Disk "struct disk *d"
+.Ft int
+.Fn Cyl_Aligned "struct disk *d" "u_long offset"
+.Ft u_long
+.Fn Next_Cyl_Aligned "struct disk *d" "u_long offset"
+.Ft u_long
+.Fn Prev_Cyl_Aligned "struct disk *d" "u_long offset"
+.Ft int
+.Fn Track_Aligned "struct disk *d" "u_long offset"
+.Ft u_long
+.Fn Next_Track_Aligned "struct disk *d" "u_long offset"
+.Ft u_long
+.Fn Prev_Track_Aligned "struct disk *d" "u_long offset"
+.Ft struct chunk *
+.Fn Create_Chunk_DWIM "struct disk *d" "struct chunk *parent" "u_long size" "chunk_e type" "int subtype" "u_long flags"
+.Ft int
+.Fn MakeDev "struct chunk *c" "char *path"
+.Ft int
+.Fn MakeDevDisk "struct disk *d,char *path"
+.Ft char *
+.Fn ShowChunkFlags "struct chunk *c"
+.Ft char *
+.Fn ChunkCanBeRoot "struct chunk *c"
+.Sh DESCRIPTION
+.Nm Libdisk
+provides an interface to the low-level disk slice and partition labels.
+Most functions operate with arguments of the types
+.Ql struct disk ,
+or
+.Ql struct chunk .
+.Pp
+While both types are mostly opaque to the programmer, the internal
+structure is mentioned below for the sake of completeness.
+.Bd -literal -offset indent
+struct disk {
+ char *name;
+ u_long flags;
+ u_long bios_cyl;
+ u_long bios_hd;
+ u_long bios_sect;
+ u_char *bootmgr;
+ u_char *boot1;
+ u_char *boot2;
+ struct chunk *chunks;
+};
+.Ed
+The only flag value by now is
+.Ql DISK_ON_TRACK ,
+meaning that this disk is handled by the On-Track Disk Manager.
+.Pp
+.Bd -literal -offset indent
+struct chunk {
+ struct chunk *next;
+ struct chunk *part;
+ struct disk *disk;
+ long offset;
+ u_long size;
+ u_long end;
+ char *name;
+ char *oname;
+ chunk_e type;
+ int subtype;
+ u_long flags;
+ void (*private_free)(void*);
+ void *(*private_clone)(void*);
+ void *private;
+};
+.Ed
+The
+.Ql type
+field can be one of the following values:
+.Ql whole, unknown, fat, freebsd, extended, part, unused .
+.Pp
+These are the valid
+.Ql flag
+values for a
+.Ql struct chunk .
+.Bl -tag -offset indent -width CHUNK_BSD_COMPATXX
+.It CHUNK_PAST_1024
+This chunk cannot be booted from because it extends past cylinder 1024.
+.It CHUNK_BSD_COMPAT
+This chunk is in the BSD-compatibility, and has a short name too, i.e.
+.Ql wd0s4f -> wd0f .
+.It CHUNK_BAD144
+This chunk has bad144 mapping.
+.It CHUNK_ALIGN
+This chunk should be aligned.
+.It CHUNK_IS_ROOT
+This
+.Ql part
+is a rootfs, allocate partition
+.Sq a .
+.It CHUNK_ACTIVE
+This is the active slice in the MBR.
+.It CHUNK_FORCE_ALL
+Force a dedicated disk for FreeBSD, bypassing all BIOS geometry
+considerations.
+.El
+.Pp
+The
+.Ql private ,
+.Ql private_free ,
+and
+.Ql private_clone
+fields are for data private to the application, and the management
+thereof. If the functions are not provided, no storage management is
+done, cloning will just copy the pointer and freeing will just forget
+it.
+.Pp
+.Fn Open_Disk
+will open the named disk, and return populated tree.
+.Pp
+.Fn Clone_Disk
+clones a copy of a tree. Useful for
+.Dq Undo
+functionality.
+.Pp
+.Fn Free_Disk
+frees a tree made with
+.Fn Open_Disk
+or
+.Fn Clone_Disk .
+.Pp
+.Fn Debug_Disk
+prints the content of the tree to stdout.
+.Pp
+.Fn Set_Bios_Geom
+sets the geometry the bios uses.
+.Pp
+.Fn Delete_Chunk
+frees a chunk of disk_space.
+.Pp
+.Fn Collapse_Disk,
+and
+.Fn Collapse_Chunk
+are experimental, do not use.
+.Pp
+.Fn Create_Chunk
+creates a chunk with the specified paramters.
+.Pp
+.Fn All_FreeBSD
+makes one FreeBSD chunk covering the entire disk; if
+.Ql force_all
+is set, bypass all BIOS geometry considerations.
+.Pp
+.Fn CheckRules
+returns
+.Ql char*
+to warnings about broken design rules in this disklayout.
+.Pp
+.Fn Disk_Names
+returns
+.Ql char**
+with all disk's names (wd0, wd1 ...). You must free each pointer, as
+well as the array by hand.
+.Pp
+.Fn Set_Boot_Mgr
+sets this boot-manager for use on this disk. Gets written when
+.Fn Write_Disk
+is called.
+.Pp
+.Fn Set_Boot_Blocks
+sets the boot-blocks for use on this disk. Gets written when
+.Fn Write_Disk
+is called.
+.Pp
+.Fn Write_Disk
+writes all the MBRs, disklabels, bootblocks and boot managers.
+.Pp
+.Fn Cyl_Aligned
+checks if
+.Ql offset
+is aligned on a cylinder according to the BIOS.
+geometry.
+.Pp
+.Fn Next_Cyl_Aligned
+rounds
+.Ql offset
+up to next cylinder according to the BIOS geometry.
+.Pp
+.Fn Prev_Cyl_Aligned
+rounds
+.Ql offset
+down to previous cylinder according to the BIOS geometry.
+.Pp
+.Fn Track_Aligned
+checks if
+.Ql offset
+is aligned on a track according to the BIOS geometry.
+.Pp
+.Fn Next_Track_Aligned
+rounds
+.Ql offset
+up to next track according to the BIOS geometry.
+.Pp
+.Fn Prev_Track_Aligned
+checks if
+.Ql offset
+is aligned on a track according to the BIOS geometry.
+.Pp
+.Fn Create_Chunk_DWIM
+creates a partition inside the given parent of the given size, and
+returns a pointer to it. The first unused chunk big enough is used.
+.Pp
+.Fn MakeDev
+makes the device nodes for this chunk.
+.Pp
+.Fn MakeDevDisk
+makes the device nodes for all chunks on this disk.
+.Pp
+.Fn ShowChunkFlags
+returns a string to show flags.
+.Pp
+.Fn ChunkCanBeRoot
+returns NULL if chunk can be
+.Ql / .
+.Sh AUTHOR
+.Nm Libdisk
+has been written by Poul-Henning Kamp.
+.Pp
+This man page by
+.ie t J\(:org Wunsch.
+.el Joerg Wunsch.
diff --git a/share/doc/handbook/uart.sgml b/share/doc/handbook/uart.sgml
new file mode 100644
index 000000000000..74ce20ba379f
--- /dev/null
+++ b/share/doc/handbook/uart.sgml
@@ -0,0 +1,1108 @@
+<!-- $Id: uart.sgml,v 1.1 1996/02/16 13:28:22 jkh Exp $ -->
+<!-- The FreeBSD Documentation Project -->
+
+<!--
+<!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN" [
+
+<!ENTITY % authors SYSTEM "authors.sgml">
+%authors;
+
+]>
+-->
+<sect2><heading>The UART: What it is and how it works<label id="uart"></heading>
+
+<p><em>Copyright &copy; 1996 &a.uhclem;, All Rights Reserved.<newline>
+13 January 1996.</em>
+
+<!-- Version 1(2) 13-Jan-96 -->
+
+ The Universal Asynchronous Receiver/Transmitter (UART) controller
+ is the key component of the serial communications subsystem of a
+ computer. The UART takes bytes of data and transmits the individual
+ bits in a sequential fashion. At the destination, a second UART
+ re-assembles the bits into complete bytes.
+
+ Serial transmission is commonly used with modems and for
+ non-networked communication between computers, terminals
+ and other devices.
+
+ There are two primary forms of serial transmission: Synchronous and
+ Asynchronous. Depending on the modes that are supported by the
+ hardware, the name of the communication sub-system will usually
+ include a "A" if it supports Asynchronous communications, and a
+ "S" if it supports Synchronous communications. Both forms are
+ described below.
+
+ Some common acryonyms are:
+<quote>UART Universal Asynchronous Receiver/Transmitter</quote>
+<quote>USART Universal Synchronous-Asynchronous Receiver/Transmitter</quote>
+
+
+<sect3><heading>Synchronous Serial Transmission</heading>
+
+ <p>Synchronous serial transmission requires that the sender and
+ receiver share a clock with one another, or that the sender provide
+ a strobe or other timing signal so that the receiver knows when to
+ "read" the next bit of the data. In most forms of serial
+ Synchronous communication, if there is no data available at a given
+ instant to transmit, a fill character must be sent instead so that
+ data is always being transmitted. Synchronous communication is
+ usually more efficient because only data bits are transmitted
+ between sender and receiver, and synchronous communication can be
+ more more costly if extra wiring and circuits are required to
+ share a clock signal between the sender and receiver.
+
+ A form of Synchronous transmission is used with printers and
+ fixed disk devices in that the data is sent on one set of wires
+ while a clock or strobe is sent on a different wire. Printers and
+ fixed disk devices are not normally serial devices because most
+ fixed disk interface standards send an entire word of data for each
+ clock or strobe signal by using a separate wire for each bit of the
+ word. In the PC industry, these are known as Parallel devices.
+
+ The standard serial communications hardware in the PC does not
+ support Synchronous operations. This mode is described here for
+ comparison purposes only.
+
+
+<sect3><heading>Asynchronous Serial Transmission</heading>
+
+ <p>Asynchronous transmission allows data to be transmitted without
+ the sender having to send a clock signal to the receiver. Instead,
+ the sender and receiver must agree on timing parameters in advance
+ and special bits are added to each word which are used to
+ synchronize the sending and receiving units.
+
+ When a word is given to the UART for Asynchronous transmissions,
+ a bit called the "Start Bit" is added to the beginning of each word
+ that is to be transmitted. The Start Bit is used to alert the
+ receiver that a word of data is about to be sent, and to force the
+ clock in the receiver into synchronization with the clock in the
+ transmitter. These two clocks must be accurate enough to not
+ have the frequency drift by more than 10% during the transmission
+ of the remaining bits in the word. (This requirement was set in
+ the days of mechanical teleprinters and is easily met by modern
+ electronic equipment.)
+
+ After the Start Bit, the individual bits of the word of data are
+ sent, with the Least Significant Bit (LSB) being sent first. Each
+ bit in the transmission is transmitted for exactly the same
+ amount of time as all of the other bits, and the receiver "looks"
+ at the wire at approximately halfway through the period assigned
+ to each bit to determine if the bit is a "1" or a "0". For example,
+ if it takes two seconds to send each bit, the receiver will examine
+ the signal to determine if it is a "1" or a "0" after one second
+ has passed, then it will wait two seconds and then examine the value
+ of the next bit, and so on.
+
+ The sender does not know when the receiver has "looked" at the
+ value of the bit. The sender only knows when the clock says to
+ begin transmitting the next bit of the word.
+
+ When the entire data word has been sent, the transmitter may add
+ a Parity Bit that the transmitter generates. The Parity Bit may
+ be used by the receiver to perform simple error checking. Then at
+ least one Stop Bit is sent by the transmitter.
+
+ When the receiver has received all of the bits in the data word,
+ it may check for the Parity Bits (both sender and receiver must
+ agree on whether a Parity Bit is to be used), and then the receiver
+ looks for a Stop Bit. If the Stop Bit does not appear when it is
+ supposed to, the UART considers the entire word to be garbled and
+ will report a Framing Error to the host processor when the data
+ word is read. The usual cause of a Framing Error is that the sender
+ and receiver clocks were not running at the same speed, or that
+ the signal was interrupted.
+
+ Regardless of whether the data was received correctly or not, the
+ UART automatically discards the Start, Parity and Stop bits. If the
+ sender and receiver are configured identically, these bits are not
+ passed to the host.
+
+ If another word is ready for transmission, the Start Bit for the new
+ word can be sent as soon as the Stop Bit for the previous
+ word has been sent.
+
+ Because asynchronous data is "self synchronizing", if there is no
+ data to transmit, the transmission line can be idle.
+
+
+<sect3><heading>Other UART Functions</heading>
+
+ <p>In addition to the basic job of converting data from parallel to
+ serial for transmission and from serial to parallel on reception,
+ a UART will usually provide additional circuits for signals that
+ can be used to indicate the state of the transmission media, and
+ to regulate the flow of data in the event that the remote device
+ is not prepared to accept more data. For example, when the
+ device connected to the UART is a modem, the modem may report the
+ presence of a carrier on the phone line while the computer may be
+ able to instruct the modem to reset itself or to not take calls
+ by asserting or deasserting one more more of these extra signals.
+ The function of each of these additional signals is defined in
+ the EIA RS232-C standard.
+
+
+<sect3><heading>The RS232-C and V.24 Standards</heading>
+
+ <p>In most computer systems, the UART is connected to circuitry that
+ generates signals that comply with the EIA RS232-C specification.
+ There is also a CCITT standard named V.24 that mirrors the
+ specifications included in RS232-C.
+
+<sect4><heading>RS232-C Bit Assignments (Marks and Spaces)</heading>
+
+ <p>In RS232-C, a value of "1" is called a "Mark" and a value of "0"
+ is called a "Space". When a communication line is idle, the line
+ is said to be "Marking", or transmitting continuous "1" values.
+
+ The Start bit always has a value of "0" (a Space). The Stop Bit
+ always has a value of "1" (a Mark). This means that there will
+ always be a Mark (1) to Space (0) transition on the line at the
+ start of every word, even when multiple word are
+ transmitted back to back. This guarantees that sender and
+ receiver can resynchronize their clocks regardless of the content
+ of the data bits that are being transmitted.
+
+ The idle time between Stop and Start bits does not have
+ to be an exact multiple (including zero) of the bit rate of the
+ communication link, but most UARTs are designed this way for
+ simplicity.
+
+ In RS232-C, the "Marking" signal (a "1") is represented by a voltage
+ between -2 VDC and -12 VDC, and a "Spacing" signal (a "0") is
+ represented by a voltage between 0 and +12 VDC. The transmitter
+ is supposed to send +12 VDC or -12 VDC, and the receiver is supposed
+ to allow for some voltage loss in long cables. Some transmitters
+ in low power devices (like portable computers) sometimes use only
+ +5 VDC and -5 VDC, but these values are still acceptable to a
+ RS232-C receiver, provided that the cable lengths are short.
+
+
+<sect4><heading>RS232-C Break Signal</heading>
+
+ <p>RS232-C also specifies a signal called a "Break", which is caused
+ by sending continuous Spacing values (no Start or Stop bits). When
+ there is no electricity present on the data circuit, the line is
+ considered to be sending "Break".
+
+ The "Break" signal must be of a duration longer than the time
+ it takes to send a complete byte plus Start, Stop and Parity bits.
+ Most UARTs can distinguish between a Framing Error and a
+ Break, but if the UART cannot do this, the Framing Error detection
+ can be used to identify Breaks.
+
+ In the days of teleprinters, when numerous printers around the
+ country were wired in series (such as news services), any unit
+ could cause a "Break" by temporarily opening the entire circuit
+ so that no current flowed. This was used to allow a location with
+ urgent news to interrupt some other location that was currently
+ sending information.
+
+ In modern systems there are two types of Break signals. If the
+ Break is longer than 1.6 seconds, it is considered a "Modem Break",
+ and some modems can be programmed to terminate the conversation and
+ go on-hook or enter the modems' command mode when the modem detects
+ this signal. If the Break is smaller than 1.6 seconds, it signifies
+ a Data Break and it is up to the remote computer to respond to
+ this signal. Sometimes this form of Break is used as an Attention
+ or Interrupt signal and sometimes is accepted as a substitute for
+ the ASCII CONTROL-C character.
+
+ Marks and Spaces are also equivalent to "Holes" and "No Holes"
+ in paper tape systems.
+
+ Note that Breaks cannot be generated from paper tape or from any
+ other byte value, since bytes are always sent with Start and Stop
+ bit. The UART is usually capable of generating the continuous
+ Spacing signal in response to a special command from the host
+ processor.
+
+<sect4><heading>RS232-C DTE and DCE Devices</heading>
+
+ <p>The RS232-C specification defines two types of equipment: the Data
+ Terminal Equipment (DTE) and the Data Carrier Equipment (DCE).
+ Usually, the DTE device is the terminal (or computer), and the DCE
+ is a modem. Across the phone line at the other end of a
+ conversation, the receiving modem is also a DCE device and the
+ computer that is connected to that modem is a DTE device. The DCE
+ device receives signals on the pins that the DTE device transmits on,
+ and vice versa.
+
+ When two devices that are both DTE or both DCE must be connected
+ together without a modem or a similar media translater between them,
+ a NULL modem must be used. The NULL modem electrically re-arranges
+ the cabling so that the transmitter output is connected to the
+ receiver input on the other device, and vice versa. Similar
+ translations are performed on all of the control signals so that
+ each device will see what it thinks are DCE (or DTE) signals from
+ the other device.
+
+ The number of signals generated by the DTE and DCE devices are
+ not symmetrical. The DTE device generates fewer signals for
+ the DCE device than the DTE device receives from the DCE.
+
+<sect4><heading>RS232-C Pin Assignments</heading>
+
+ <p>The EIA RS232-C specification (and the ITU equivalent, V.24) calls
+ for a twenty-five pin connector (usually a DB25) and defines the
+ purpose of most of the pins in that connector.
+
+ In the IBM Personal Computer and similar systems, a subset of
+ RS232-C signals are provided via nine pin connectors (DB9).
+ The signals that are not included on the PC connector deal mainly
+ with synchronous operation, and this transmission mode is not
+ supported by the UART that IBM selected for use in the IBM PC.
+
+ Depending on the computer manufacturer, a DB25, a DB9, or
+ both types of connector may be used for RS232-C communications.
+ (The IBM PC also uses a DB25 connector for the parallel printer
+ interface which causes some confusion.)
+
+ Below is a table of the RS232-C signal assignments in the DB25
+ and DB9 connectors.
+
+<verb>
+DB25 DB9 EIA CCITT Common Signal Description
+RS232-C IBM PC Circuit Circuit Name Source
+Pin Pin Symbol Symbol
+
+1 - AA 101 PG/FG --- Frame/Protective Ground
+2 3 BA 103 TD DTE Transmit Data
+3 2 BB 104 RD DCE Receive Data
+4 7 CA 105 RTS DTE Request to Send
+5 8 CB 106 CTS DCE Clear to Send
+6 6 CC 107 DSR DCE Data Set Ready
+7 5 AV 102 SG/GND --- Signal Ground
+8 1 CF 109 DCD/CD DCE Data Carrier Detect
+9 - - - - - Reserved for Test
+10 - - - - - Reserved for Test
+11 - - - - - Unassigned
+12 - CI 122 SRLSD DCE Sec. Recv. Line Signal Detector
+13 - SCB 121 SCTS DCE Secondary Clear To Send
+14 - SBA 118 STD DTE Secondary Transmit Data
+15 - DB 114 TSET DCE Trans. Sig. Element Timing
+16 - SBB 119 SRD DCE Secondary Received Data
+17 - DD 115 RSET DCE Receiver Signal Element Timing
+18 - - 141 LOOP DTE Local Loopback
+19 - SCA 120 SRS DTE Secondary Request to Send
+20 4 CD 108.2 DTR DTE Data Terminal Ready
+21 - - - RDL DTE Remote Digital Loopback
+22 9 CE 125 RI DCE Ring Indicator
+23 - CH 111 DSRS DTE Data Signal Rate Selector
+24 - DA 113 TSET DTE Trans. Sig. Element Timing
+25 - - 142 - DCE Test Mode
+</verb>
+
+
+ <sect3><heading>Bits, Baud and Symbols</heading>
+
+ <p>Baud is a measurment of transmission speed in asynchronous
+ communication. Because of advances in modem communication
+ technology, this term is frequently misused when describing
+ the data rates in newer devices.
+
+ Traditionally, a Baud Rate represents the number of bits that are
+ actually being sent over the media, not the amount of data
+ that is actually moved from one DTE device to the other. The
+ Baud count includes the overhead bits Start, Stop and Parity
+ that are generated by the sending UART and removed by the
+ receiving UART. This means that seven-bit words of data
+ actually take 10 bits to be completely transmitted.
+ Therefore, a modem capable of moving 300 bits per second from one
+ place to another can normally only move 30 7-bit words if
+ Parity is used and one Start and Stop bit are present.
+
+ If 8-bit data words are used and Parity bits are also used, the
+ data rate falls to 27.27 words per second, because it now
+ takes 11 bits to send the eight-bit words, and the modem still
+ only sends 300 bits per second.
+
+ The formula for converting bytes per second into a baud rate
+ and vice versa was simple until error-correcting modems
+ came along. These modems receive the serial stream of bits
+ from the UART in the host computer (even when internal modems
+ are used the data is still frequently serialized) and converts
+ the bits back into bytes. These bytes are then combined into
+ packets and sent over the phone line using a Synchronous
+ transmission method. This means that the Stop, Start, and Parity
+ bits added by the UART in the DTE (the computer) were removed by
+ the modem before transmission by the sending modem. When these
+ bytes are received by the remote modem, the remote modem adds
+ Start, Stop and Parity bits to the words, converts them to a
+ serial format and then sends them to the receiving UART in the remote
+ computer, who then strips the Start, Stop and Parity bits.
+
+ The reason all these extra conversions are done is so that the
+ two modems can perform error correction, which means that the
+ receiving modem is able to ask the sending modem to resend a
+ block of data that was not received with the correct checksum.
+ This checking is handled by the modems, and the DTE devices are
+ usually unaware that the process is occurring.
+
+ By striping the Start, Stop and Parity bits, the additional bits of
+ data that the two modems must share between themselves to perform
+ error-correction are mostly concealed from the effective
+ transmission rate seen by the sending and receiving DTE equipment.
+ For example, if a modem sends ten 7-bit words to another modem
+ without including the Start, Stop and Parity bits, the sending
+ modem will be able to add 30 bits of its own information that
+ the receiving modem can use to do error-correction without
+ impacting the transmission speed of the real data.
+
+ The use of the term Baud is further confused by modems that perform
+ compression. A single 8-bit word passed over the telephone
+ line might represent a dozen words that were transmitted to
+ the sending modem. The receiving modem will expand the data back
+ to its original content and pass that data to the receiving DTE.
+
+ Modern modems also include buffers that allow the rate that
+ bits move across the phone line (DCE to DCE) to be a different speed
+ than the speed that the bits move between the DTE and DCE on both
+ ends of the conversation. Normally the speed between the DTE and
+ DCE is higher than the DCE to DCE speed because of the use of
+ compression by the modems.
+
+ Because the number of bits needed to describe a byte varied
+ during the trip between the two machines plus the differing
+ bits-per-seconds speeds that are used present on the DTE-DCE and
+ DCE-DCE links, the usage of the term Baud to describe the
+ overall communication speed causes problems and can misrepresent
+ the true transmission speed. So Bits Per Second (bps) is the correct
+ term to use to describe the transmission rate seen at the
+ DCE to DCE interface and Baud or Bits Per Second are acceptable
+ terms to use when a connection is made between two systems with a
+ wired connection, or if a modem is in use that is not performing
+ error-correction or compression.
+
+ Modern high speed modems (2400, 9600, 14,400, and 19,200bps) in
+ reality still operate at or below 2400 baud, or more accurately,
+ 2400 Symbols per second. High speed modem are able to encode more
+ bits of data into each Symbol using a technique called Constellation
+ Stuffing, which is why the effective bits per second rate of the
+ modem is higher, but the modem continues to operate within the
+ limited audio bandwidth that the telephone system provides.
+ Modems operating at 28,800 and higher speeds have variable Symbol
+ rates, but the technique is the same.
+
+ <sect3><heading>The IBM Personal Computer UART</heading>
+
+ <p>Starting with the original IBM Personal Computer, IBM selected
+ the National Semiconductor INS8250 UART for use in the IBM PC
+ Parallel/Serial Adapter. Subsequent generations of compatible
+ computers from IBM and other vendors continued to use the INS8250
+ or improved versions of the National Semiconductor UART family.
+
+
+<sect4><heading>National Semiconductor UART Family Tree</heading>
+
+ <p>There have been several versions and subsequent generations of
+ the INS8250 UART. Each major version is described below.
+
+<verb>
+ INS8250 -> INS8250B
+ \
+ \
+ \-> INS8250A -> INS82C50A
+ \
+ \
+ \-> NS16450 -> NS16C450
+ \
+ \
+ \-> NS16550 -> NS16550A -> PC16550D
+</verb>
+
+<descrip>
+ <tag>INS8250</tag>This part was used in the original IBM PC and
+ IBM PC/XT. The original name for this part was the INS8250 ACE
+ (Asynchronous Communications Element) and it is made from NMOS
+ technology.
+
+ The 8250 uses eight I/O ports and has a one-byte send and
+ a one-byte receive buffer. This original UART has several
+ race conditions and other flaws. The original IBM BIOS
+ includes code to work around these flaws, but this made
+ the BIOS dependent on the flaws being present, so subsequent
+ parts like the 8250A, 16450 or 16550 could not be used in
+ the original IBM PC or IBM PC/XT.
+
+ <tag>INS8250-B</tag>This is the slower speed of the INS8250 made
+ from NMOS technology. It contains the same problems as the original
+ INS8250.
+
+ <tag>INS8250A</tag>An improved version of the INS8250 using XMOS
+ technology with various functional flaws corrected. The INS8250A
+ was used initially in PC clone computers by vendors who used
+ "clean" BIOS designs. Because of the corrections in the chip, this
+ part could not be used with a BIOS compatible with the INS8250
+ or INS8250B.
+
+ <tag>INS82C50A</tag>This is a CMOS version (low power consumption)
+ of the INS8250A and has similar functional characteristics.
+
+ <tag>NS16450</tag>Same as NS8250A with improvements so it can be
+ used with faster CPU bus designs. IBM used this part in the IBM AT
+ and updated the IBM BIOS to no longer rely on the bugs in the
+ INS8250.
+
+ <tag>NS16C450</tag>This is a CMOS version (low power consumption)
+ of the NS16450.
+
+ <tag>NS16550</tag>Same as NS16450 with a 16-byte send and receive
+ buffer but the buffer design was flawed and could not be reliably
+ be used.
+
+ <tag>NS16550A</tag>Same as NS16550 with the buffer flaws corrected.
+ The 16550A and its successors have become the most popular UART
+ design in the PC industry, mainly due it its ability to reliably
+ handle higher data rates on operating systems with sluggish interrupt
+ response times.
+
+ <tag>NS16C552</tag>This component consists of two NS16C550A CMOS
+ UARTs in a single package.
+
+ <tag>PC16550D</tag>Same as NS16550A with subtle flaws corrected. This
+ is revision D of the 16550 family and is the latest design available
+ from National Semiconductor.
+</descrip>
+
+<sect4><heading>The NS16550AF and the PC16550D are the same thing</heading>
+
+ <p>National reorganized their part numbering system a few years ago,
+ and the NS16550AFN no longer exists by that name. (If you
+ have a NS16550AFN, look at the date code on the part, which is a
+ four digit number that usually starts with a nine. The first two
+ digits of the number are the year, and the last two digits are the
+ week in that year when the part was packaged. If you have a
+ NS16550AFN, it is probably a few years old.)
+
+ The new numbers are like PC16550DV, with minor differences in the
+ suffix letters depending on the package material and its shape.
+ (A description of the numbering system can be found below.)
+
+ It is important to understand that in some stores, you may pay
+ &dollar;15(US) for a NS16550AFN made in 1990 and in the next bin are the
+ new PC16550DN parts with minor fixes that National has made since the
+ AFN part was in production, the PC16550DN was probably made in the
+ past six months and it costs half (as low as &dollar;5(US) in volume) as
+ much as the NS16550AFN because they are readily available.
+
+ As the supply of NS16550AFN chips continues to shrink, the price will
+ probably continue to increase until more people discover and accept
+ that the PC16550DN really has the same function as the old part
+ number.
+
+<sect4><heading>National Semiconductor Part Numbering System</heading>
+
+ <p>The older NS<em>nnnnnrqp</em> part numbers are now of the
+ format PC<em>nnnnnrgp</em>.
+
+ The "<em>r</em>" is the revision field. The current revision of
+ the 16550 from National Semiconductor is "D".
+
+ The "<em>p</em>" is the package-type field. The types are:
+<verb> "F" QFP (quad flat pack) L lead type
+ "N" DIP (dual inline package) through hole straight lead type
+ "V" LPCC (lead plastic chip carrier) J lead type</verb>
+
+ The "<em>g</em>" is the product grade field. If an "I" preceeds
+ the package-type letter, it indicates an "industrial" grade part,
+ which has higher specs than a standard part but not as high as
+ Miltary Specification (Milspec) component. This is an optional field.
+
+ So what we used to call a NS16550AFN (DIP Package) is now called a
+ PC16550DN or PC16550DIN.
+
+
+ <sect3><heading>Other Vendors and Similar UARTs</heading>
+
+ <p>Over the years, the 8250, 8250A, 16450 and 16550 have been licensed
+ or copied by other chip vendors. In the case of the 8250, 8250A
+ and 16450, the exact circuit (the "megacell") was licensed to many
+ vendors, including Western Digital and Intel. Other vendors
+ reverse-engineered the part or produced emulations that had similar
+ behavior.
+
+ In internal modems, the modem designer will frequently emulate the
+ 8250A/16450 with the modem microprocessor, and the emulated UART will
+ frequently have a hidden buffer consisting of several hundred bytes.
+ Because of the suze of the buffer, these emulations can be as
+ reliable as a 16550A in their ability to handle high speed data.
+ However, most operating systems will still report that
+ the UART is only a 8250A or 16450, and may not make effective use
+ of the extra buffering present in the emulated UART unless special
+ drivers are used.
+
+ Some modem makers are driven by market forces to abandon a design
+ that has hundreds of bytes of buffer and instead use a 16550A UART
+ so that the product will compare favorably in market comparisons
+ even though the effective performance may be lowered by this action.
+
+ A common misconception is that all parts with "16550A" written on
+ them are identical in performance. There are differences, and in
+ some cases, outright flaws in most of these 16550A clones.
+
+ When the NS16550 was developed, the National Semiconductor obtained
+ several patents on the design and they also limited licensing, making
+ it harder for other vendors to provide a chip with similar features.
+ Because of the patents, reverse-engineered designs and emulations
+ had to avoid infringing the claims covered by the patents.
+ Subsequently, these copies almost never perform exactly the same as
+ the NS16550A or PC16550D, which are the parts most computer and
+ modem makers want to buy but are sometimes unwilling to pay the
+ price required to get the genuine part.
+
+ Some of the differences in the clone 16550A parts are unimportant,
+ while others can prevent the device from being used at all with a
+ given operating system or driver. These differences may show up
+ when using other drivers, or when particular combinations of events
+ occur that were not well tested or considered in the Windows driver.
+ This is because most modem vendors and 16550-clone makers use the
+ Microsoft drivers from Windows for Workgroups 3.11 and the Microsoft
+ MSD utility as the primary tests for compatibility with the
+ NS16550A. This over-simplistic criteria means that if a different
+ operating system is used, problems could appear due to subtle
+ differences between the clones and genuine components.
+
+ National Semiconductor has made available a program named COMTEST
+ that performs compatibility tests independent of any OS drivers.
+ It should be remembered that the purpose of this type of program is
+ to demonstrate the flaws in the products of the competition, so the
+ program will report major as well as extremely subtle differences in
+ behavior in the part being tested.
+
+ In a series of tests performed by the author of this document in
+ 1994, components made by National Semiconductor, TI, StarTech, and
+ CMD as well as megacells and emulations embedded in internal modems
+ were tested with COMTEST. A difference count for some of these
+ components is listed below. Because these tests were performed in
+ 1994, they may not reflect the current performance of the given
+ product from a vendor.
+
+ It should be noted that COMTEST normally aborts when an excessive
+ number or certain types of problems have been detected. As part of
+ this testing, COMTEST was modified so that it would not abort no
+ matter how many differences were encountered.
+
+
+<verb>Vendor Part number Errors aka "differences" reported
+National (PC16550DV) 0 *
+
+National (NS16550AFN) 0
+
+National (NS16C552V) 0 *
+
+TI (TL16550AFN) 3
+
+CMD (16C550PE) 19
+
+StarTech (ST16C550J) 23
+
+Rockwell reference modem
+ with internal 16550 or an
+ emulation (RC144DPi/C3000-25) 117
+
+Sierra modem with an internal
+ 16550 (SC11951/SC11351) 91</verb>
+
+ <p>It is important to understand that a simple count of differences
+ from COMTEST does not reveal a lot about what differences are
+ important and which are not. For example, about half of the
+ differences reported in the two modems listed above that have
+ internal UARTs were caused by the clone UARTs not supporting
+ five- and six-bit character modes. The real 16550, 16450, and
+ 8250 UARTs all support these modes and COMTEST checks the
+ functionality of these modes so over fifty differences are
+ reported. However, almost no modern modem supports five- or
+ six-bit characters, particularly those with error-correction
+ and compression capabilities. This means that the differences
+ related to five- and six-bit character modes can be discounted.
+
+ Many of the differences COMTEST reports have to do with timing. In
+ many of the clone designs, when the host reads from one port, the
+ status bits in some other port may not update in the same amount
+ of time (some faster, some slower) as a <em>real</em> NS16550AFN
+ and COMTEST looks for these differences. This means that the number
+ of differences can be misleading in that one device may only have
+ one or two differences but they are extremely serious, and some
+ other device that updates the status registers faster or slower
+ than the reference part (that would probably never affect the
+ operation of a properly written driver) could have dozens of
+ differences reported.
+
+ * To date, the author of this document has not found any non-National
+ parts that report zero differences using the COMTEST program. It
+ should also be noted that National has had five versions of the
+ 16550 over the years and the newest parts behave a bit differently
+ than the classic NS16550AFN that is considered the benchmark for
+ functionality. COMTEST appears to turn a blind eye to the
+ differences within the National product line and reports no errors
+ on the National parts (except for the original 16550) even when
+ there are official erattas that describe bugs in the A, B and C
+ revisions of the parts, so this bias in COMTEST must be taken into
+ account.
+
+ COMTEST can be used as a screening tool to alert the administrator
+ to the presence of potentially incompatible components
+ that might cause problems or have to be handled as a special case.
+
+ If you run COMTEST on a 16550 that is in a modem or a modem is
+ attached to the serial port, you need to first issue a ATE0&amp;W
+ command to the modem so that the modem will not echo any of the test
+ characters. If you forget to do this, COMTEST will report at least
+ this one difference:
+ <quote>Error (6)...Timeout interrupt failed: IIR = c1 LSR = 61</quote>
+
+
+ <sect3><heading>8250/16450/16550 Registers</heading>
+
+ <p>The 8250/16450/16550 UART occupies eight contiguous I/O port
+ addresses. In the IBM PC, there are two defined locations for
+ these eight ports and they are known collectively as COM1 and COM2.
+ The makers of PC-clones and add-on cards have created two additional
+ areas known as COM3 and COM4, but these extra COM ports conflict
+ with other hardware on some systems. The most common conflict is
+ with video adapters that provide IBM 8514 emulation.
+
+<verb>
+COM1 is located from 0x3f8 to 0x3ff and normally uses IRQ 4
+COM2 is located from 0x2f8 to 0x2ff and normally uses IRQ 3
+COM3 is located from 0x3e8 to 0x3ef and has no standardized IRQ
+COM4 is located from 0x2e8 to 0x2ef and has no standardized IRQ
+</verb>
+<p>A description of the I/O ports of the 8250/16450/16550 UART is
+provided below.
+
+<verb>
+I/O Access Description
+Port Allowed
+
++0x00 write Transmit Holding Register (THR)
+ (DLAB==0) Information written to this port are treated
+ as data words and will be transmitted by the
+ UART.
+
++0x00 read Receive Buffer Register (RBR)
+ (DLAB==0) Any data words received by the UART from the
+ serial link are accessed by the host by
+ reading this port.
+
+
++0x00 write/read Divisor Latch LSB (DLL)
+ (DLAB==1) This value will be divided from the master
+ input clock (in the IBM PC, the master
+ clock is 1.8432MHz) and the resulting clock
+ will determine the baud rate of the UART.
+ This register holds bits 0 thru 7 of the
+ divisor.
+
+
++0x01 write/read Divisor Latch MSB (DLH)
+ (DLAB==1) This value will be divided from the master
+ input clock (in the IBM PC, the master
+ clock is 1.8432MHz) and the resulting clock
+ will determine the baud rate of the UART.
+ This register holds bits 8 thru 15 of the
+ divisor.
+
+
++0x01 write/read Interrupt Enable Register (IER)
+ (DLAB==0) The 8250/16450/16550 UART classifies events into
+ one of four categories. Each category can be
+ configured to generate an interrupt when any of
+ the events occurs. The 8250/16450/16550 UART
+ generates a single external interrupt signal
+ regardless of how many events in the enabled
+ categories have occurred. It is up to the host
+ processor to respond to the interrupt and then
+ poll the enabled interrupt categories (usually
+ all categories have interrupts enabled) to
+ determine the true cause(s) of the interrupt.
+
+ Bit 7 Reserved, always 0.
+
+ Bit 6 Reserved, always 0.
+
+ Bit 5 Reserved, always 0.
+
+ Bit 4 Reserved, always 0.
+
+ Bit 3 Enable Modem Status Interrupt (EDSSI)
+ Setting this bit to "1" allows the UART
+ to generate an interrupt when a
+ change occurs on one or more of the
+ status lines.
+
+ Bit 2 Enable Receiver Line Status
+ Interrupt (ELSI)
+ Setting this bit to "1" causes the UART
+ to generate an interrupt when the
+ an error (or a BREAK signal) has been
+ detected in the incoming data.
+
+ Bit 1 Enable Transmitter Holding Register
+ Empty Interrupt (ETBEI)
+ Setting this bit to "1" causes the UART
+ to generate an interrupt when the
+ UART has room for one or more
+ additional characters that are to
+ be transmitted.
+
+ Bit 0 Enable Received Data Available
+ Interrupt (ERBFI)
+ Setting this bit to "1" causes the UART
+ to generate an interrupt when the UART
+ has received enough characters to exceed
+ the trigger level of the FIFO, or the
+ FIFO timer has expired (stale data), or
+ a single character has been received
+ when the FIFO is disabled.
+
+
++0x02 write FIFO Control Register (FCR)
+ (This port does not exist on the 8250 and 16450
+ UART.)
+
+ Bit 7 Receiver Trigger Bit #1
+ Bit 6 Receiver Trigger Bit #0
+ These two bits control at what point the
+ receiver is to generate an interrupt when
+ the FIFO is active.
+
+ 7 6 How many words are received
+ before an interrupt is generated.
+ 0 0 1
+
+ 0 1 4
+
+ 1 0 8
+
+ 1 1 14
+
+ Bit 5 Reserved, always 0.
+
+ Bit 4 Reserved, always 0.
+
+ Bit 3 DMA Mode Select
+ If Bit 0 is set to "1" (FIFOs enabled),
+ setting this bit changes the operation
+ of the -RXRDY and -TXRDY signals from
+ Mode 0 to Mode 1.
+
+ Bit 2 Transmit FIFO Reset
+ When a "1" is written to this bit,
+ the contents of the FIFO are discarded.
+ Any word currently being transmitted
+ will be sent intact. This function is
+ useful in aborting transfers.
+
+ Bit 1 Receiver FIFO Reset
+ When a "1" is written to this bit,
+ the contents of the FIFO are discarded.
+ Any word currently being assembled
+ in the shift register will be received
+ intact.
+
+ Bit 0 16550 FIFO Enable
+ When set, both the transmit and receive
+ FIFOs are enabled. Any contents in the
+ holding register, shift registers or
+ FIFOs are lost when FIFOs are enabled or
+ disabled.
+
+
++0x02 read Interrupt Identification Register (IIR)
+
+ Bit 7 FIFOs enabled.
+ On the 8250/16450 UART, this bit is zero.
+
+ Bit 6 FIFOs enabled.
+ On the 8250/16450 UART, this bit is zero.
+
+ Bit 5 Reserved, always 0.
+
+ Bit 4 Reserved, always 0.
+
+ Bit 3 Interrupt ID Bit #2
+ On the 8250/16450 UART, this bit is zero.
+ Bit 2 Interrupt ID Bit #1
+ Bit 1 Interrupt ID Bit #0
+ These three bits combine to report
+ the category of event that caused the
+ interrupt that is in progress. These
+ categories have priorities, so if
+ multiple categories of events occur at
+ the same time, the UART will report the
+ more important events first and the host
+ must resolve the events in the order they
+ are reported. All events that caused the
+ current interrupt must be resolved before
+ any new interrupts will be generated.
+ (This is a limitation of the PC
+ architecture.)
+
+ 2 1 0 Priority Description
+
+ 0 1 1 First Receiver Error
+ (OE, PE, BI or FE)
+
+ 0 1 0 Second Received Data
+ Available
+
+ 1 1 0 Second Trigger level
+ identification
+ (Stale data in
+ receive buffer)
+
+ 0 0 1 Third Transmitter has
+ room for more
+ words (THRE)
+
+ 0 0 0 Fourth Modem Status
+ Change (-CTS,
+ -DSR, -RI, or
+ -DCD)
+
+ Bit 0 Interrupt Pending Bit
+ If this bit is set to "0", then at least
+ one interrupt is pending.
+
+
++0x03 write/read Line Control Register (LCR)
+
+ Bit 7 Divisor Latch Access Bit (DLAB)
+ When set, access to the data
+ transmit/receive register (THR/RBR) and
+ the Interrupt Enable Register (IER) is
+ disabled. Any access to these ports is
+ now redirected to the Divisor Latch
+ Registers. Setting this bit, loading
+ the Divisor Registers, and clearing
+ DLAB should be done with interrupts
+ disabled.
+
+ Bit 6 Set Break
+ When set to "1", the transmitter begins
+ to transmit continuous Spacing until
+ this bit is set to "0". This overrides
+ any bits of characters that are being
+ transmitted.
+
+ Bit 5 Stick Parity
+ When parity is enabled, setting this
+ bit causes parity to always be "1" or
+ "0", based on the value of Bit 4.
+
+ Bit 4 Even Parity Select (EPS)
+ When parity is enabled and Bit 5 is "0",
+ setting this bit causes even parity
+ to be transmitted and expected.
+ Otherwise, odd parity is used.
+
+ Bit 3 Parity Enable (PEN)
+ When set to "1", a parity bit is
+ inserted between the last bit of the
+ data and the Stop Bit. The UART will
+ also expect parity to be present in
+ the received data.
+
+ Bit 2 Number of Stop Bits (STB)
+ If set to "1" and using 5-bit data words,
+ 1.5 Stop Bits are transmitted and
+ expected in each data word. For 6, 7
+ and 8-bit data words, 2 Stop Bits are
+ transmitted and expected. When this bit
+ is set to "0", one Stop Bit is used on
+ each data word.
+
+ Bit 1 Word Length Select Bit #1 (WLSB1)
+ Bit 0 Word Length Select Bit #0 (WLSB0)
+ Together these bits specify the number
+ of bits in each data word.
+
+ 1 0 Word Length
+
+ 0 0 5 Data Bits
+ 0 1 6 Data Bits
+ 1 0 7 Data Bits
+ 1 1 8 Data Bits
+
+
++0x04 write/read Modem Control Register (MCR)
+
+ Bit 7 Reserved, always 0.
+
+ Bit 6 Reserved, always 0.
+
+ Bit 5 Reserved, always 0.
+
+ Bit 4 Loop-Back Enable
+ When set to "1", the UART transmitter
+ and receiver are internally connected
+ together to allow diagnostic operations.
+ In addition, the UART modem control
+ outputs are connected to the UART modem
+ control inputs. CTS is connected to RTS,
+ DTR is connected to DSR, OUT1 is
+ connected to RI, and OUT 2 is connected
+ to DCD.
+
+ Bit 3 OUT 2
+ An auxillary output that the host
+ processor may set high or low.
+ In the IBM PC serial adapter (and most
+ clones), OUT 2 is used to tri-state
+ (disable) the interrupt signal from the
+ 8250/16450/16550 UART.
+
+ Bit 2 OUT 1
+ An auxillary output that the host
+ processor may set high or low.
+ This output is not used on the IBM PC
+ serial adapter.
+
+ Bit 1 Request to Send (RTS)
+ When set to "1", the output of the UART
+ -RTS line is Low (Active).
+
+ Bit 0 Data Terminal Ready (DTR)
+ When set to "1", the output of the UART
+ -DTR line is Low (Active).
+
+
++0x05 write/read Line Status Register (LSR)
+
+ Bit 7 Error in Receiver FIFO
+ On the 8250/16450 UART, this bit is zero.
+ This bit is set to "1" when any of
+ the bytes in the FIFO have one or more
+ of the following error conditions: PE,
+ FE, or BI.
+
+ Bit 6 Transmitter Empty (TEMT)
+ When set to "1", there are no words
+ remaining in the transmit FIFO or the
+ transmit shift register. The
+ transmitter is completely idle.
+
+ Bit 5 Transmitter Holding Register Empty (THRE)
+ When set to "1", the FIFO (or holding
+ register) now has room for at least one
+ additional word to transmit. The
+ transmitter may still be transmitting
+ when this bit is set to "1".
+
+ Bit 4 Break Interrupt (BI)
+ The receiver has detected a Break signal.
+
+ Bit 3 Framing Error (FE)
+ A Start Bit was detected but the Stop
+ Bit did not appear at the expected time.
+ The received word is probably garbled.
+
+ Bit 2 Parity Error (PE)
+ The parity bit was incorrect for the
+ word received.
+
+ Bit 1 Overrun Error (OE)
+ A new word was received and there
+ was no room in the receive buffer. The
+ newly-arrived word in the shift
+ register is discarded. On 8250/16450
+ UARTs, the word in the holding
+ register is discarded and the newly-
+ arrived word is put in the holding
+ register.
+
+ Bit 0 Data Ready (DR)
+ One or more words are in the
+ receive FIFO that the host may read.
+ A word must be completely received
+ and moved from the shift register into
+ the FIFO (or holding register for
+ 8250/16450 designs) before this bit is
+ set.
+
+
++0x06 write/read Modem Status Register (MSR)
+
+ Bit 7 Data Carrier Detect (DCD)
+ Reflects the state of the DCD line
+ on the UART.
+
+ Bit 6 Ring Indicator (RI)
+ Reflects the state of the RI line on
+ the UART.
+
+ Bit 5 Data Set Ready (DSR)
+ Reflects the state of the DSR line on
+ the UART.
+
+ Bit 4 Clear To Send (CTS)
+ Reflects the state of the CTS line on
+ the UART.
+
+ Bit 3 Delta Data Carrier Detect (DDCD)
+ Set to "1" if the -DCD line has changed
+ state one more more times since the last
+ time the MSR was read by the host.
+
+ Bit 2 Trailing Edge Ring Indicator (TERI)
+ Set to "1" if the -RI line has had a
+ low to high transition since the last
+ time the MSR was read by the host.
+
+ Bit 1 Delta Data Set Ready (DDSR)
+ Set to "1" if the -DSR line has changed
+ state one more more times since the last
+ time the MSR was read by the host.
+
+ Bit 0 Delta Clear To Send (DCTS)
+ Set to "1" if the -CTS line has changed
+ state one more more times since the last
+ time the MSR was read by the host.
+
+
++0x07 write/read Scratch Register (SCR)
+ This register performs no function in the
+ UART. Any value can be written by the host to
+ this location and read by the host later on.
+</verb>
+
+ <sect3><heading>Beyond the 16550A UART</heading>
+
+ <p>Although National Semiconductor has not offered any components
+ compatible with the 16550 that provide additional features,
+ various other vendors have. Some of these components are described
+ below. It should be understood that to effectively utilize these
+ improvements, drivers may have to be provided by the chip vendor
+ since most of the popular operating systems do not support features
+ beyond those provided by the 16550.
+
+<descrip>
+<tag>ST16650</tag>By default this part is similar to the NS16550A, but an
+ extended 32-byte send and receive buffer can be optionally
+ enabled. Made by Startech.
+
+<tag>TIL16660</tag>By default this part behaves similar to the NS16550A,
+ but an extended 64-byte send and receive buffer can be
+ optionally enabled. Made by Texas Instruments.
+
+<tag>Hayes ESP</tag>This proprietary plug-in card contains a 2048-byte
+ send and receive buffer, and supports data rates
+ to 230.4Kbit/sec. Made by Hayes.
+</descrip>
+
+ <p>In addition to these "dumb" UARTs, many vendors produce
+ intelligent serial communication boards. This type of design
+ usually provides a microprocessor that interfaces with several
+ UARTs, processes and buffers the data, and then alerts the main
+ PC processor when necessary. Because the UARTs are not directly
+ accessed by the PC processor in this type of communication system,
+ it is not necessary for the vendor to use UARTs that are compatible
+ with the 8250, 16450, or the 16550 UART. This leaves the
+ designer free to components that may have better performance
+ characteristics.
+
+<!-- 601131 ? -->
+
diff --git a/share/examples/find_interface/find_interface.c b/share/examples/find_interface/find_interface.c
new file mode 100644
index 000000000000..e534314f8674
--- /dev/null
+++ b/share/examples/find_interface/find_interface.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright 1994, 1995 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: find_interface.c,v 1.1 1995/08/14 16:08:39 wollman Exp $
+ */
+
+/*
+ * This is a simple program which demonstrates how to query the kernel
+ * routing mechanism using only a UDP socket. Pass it a hostname on
+ * the command line (sorry, it doesn't parse dotted decimal) and it will
+ * print out an IP address which names the interface over which UDP
+ * packets intended for that destination would be sent.
+ * A more sophisticated program might use the list obtained from SIOCGIFCONF
+ * to match the address with an interface name, but applications programmers
+ * much more often need to know the address of the interface rather than
+ * the name.
+ */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <netdb.h>
+#include <err.h>
+#include <errno.h>
+#include <string.h>
+#include <sysexits.h>
+
+int
+main(int argc, char **argv)
+{
+ struct sockaddr_in local, remote;
+ struct hostent *hp;
+ int s, rv, namelen;
+
+ argc--, argv++;
+
+ if (!*argv) {
+ errx(EX_USAGE, "must supply a hostname");
+ }
+
+ hp = gethostbyname(*argv);
+ if (!hp) {
+ errx(EX_NOHOST, "cannot resolve hostname: %s", *argv);
+ }
+
+ memcpy(&remote.sin_addr, hp->h_addr_list[0], sizeof remote.sin_addr);
+ remote.sin_port = htons(60000);
+ remote.sin_family = AF_INET;
+ remote.sin_len = sizeof remote;
+
+ local.sin_addr.s_addr = htonl(INADDR_ANY);
+ local.sin_port = htons(60000);
+ local.sin_family = AF_INET;
+ local.sin_len = sizeof local;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ err(EX_OSERR, "socket");
+
+ do {
+ rv = bind(s, (struct sockaddr *)&local, sizeof local);
+ local.sin_port = htons(ntohs(local.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0)
+ err(EX_OSERR, "bind");
+
+ do {
+ rv = connect(s, (struct sockaddr *)&remote, sizeof remote);
+ remote.sin_port = htons(ntohs(remote.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0)
+ err(EX_OSERR, "connect");
+
+ namelen = sizeof local;
+ rv = getsockname(s, (struct sockaddr *)&local, &namelen);
+ if (rv < 0)
+ err(EX_OSERR, "getsockname");
+
+ printf("Route to %s is out %s\n", *argv, inet_ntoa(local.sin_addr));
+ return 0;
+}
diff --git a/share/man/man4/intro.4 b/share/man/man4/intro.4
new file mode 100644
index 000000000000..6260982fa750
--- /dev/null
+++ b/share/man/man4/intro.4
@@ -0,0 +1,175 @@
+.\"
+.\" Copyright (c) 1996 David E. O'Brien, Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $Id: intro.4,v 1.1 1996/01/21 14:01:49 joerg Exp $
+.\"
+.Dd January 20, 1996
+.Dt INTRO 4
+.Os FreeBSD 2.1
+.Sh NAME
+.Nm intro
+.Nd introduction to devices and device drivers
+.Sh DESCRIPTION
+This section contains information related to devices, device driver
+and miscellaneous hardware.
+.Ss The device abstraction
+Device is a term used mostly for hardware-related stuff that belongs
+to the system, like disks, printers, or a graphics display with its
+keyboard. There are also so-called
+.Em pseudo-devices
+where a device driver emulates the behaviour of a device in software
+without any particular underlying hardware. A typical example for
+the latter class is
+.Pa /dev/mem ,
+a loophole where the physical memory can be accessed using the regular
+file access semantics.
+.Pp
+The device abstraction generally provides a common set of system calls
+layered on top of them, which are dispatched to the corresponding
+device driver by the upper layers of the kernel. The set of system
+calls available for devices is chosen from
+.Xr open 2 ,
+.Xr close 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr ioctl 2 ,
+.Xr select 2 ,
+and
+.Xr mmap 2 .
+Not all drivers implement all system calls, for example, calling
+.Xr mmap 2
+on a terminal devices is likely to be not useful at all.
+.Ss Accessing Devices
+Most of the devices in a unix-like operating system are accessed
+through so-called
+.Em device nodes ,
+sometimes also called
+.Em special files .
+They are usually located under the directory
+.Pa /dev
+in the file system hierarchy
+.Pq see also Xr hier 7 .
+.Pp
+Until
+.Xr devfs 5
+is fully functional, each device node must be created statically and
+independently of the existence of the associated device driver,
+usually by running
+.Xr MAKEDEV 8 .
+.Pp
+Note that this could lead to an inconsistent state, where either there
+are device nodes that do not have a configured driver associated with
+them, or there may be drivers that have successfully probed for their
+devices, but cannot be accessed since the corresponding device node is
+still missing. In the first case, any attempt to reference the device
+through the device node will result in an error, returned by the upper
+layers of the kernel, usually
+.Ql ENXIO .
+In the second case, the device node needs to be created before the
+driver and its device will be usable.
+.Pp
+Some devices come in two flavors:
+.Em block
+and
+.Em character
+devices, or by a better name, buffered and unbuffered
+.Pq raw
+devices. The traditional names are reflected by the letters
+.Ql b
+and
+.Ql c
+as the file type identification in the output of
+.Ql ls -l .
+Buffered devices are being accessed through the buffer cache of the
+operating system, and they are solely intended to layer a file system
+on top of them. They are normally implemented for disks and disk-like
+devices only, for historical reasons also for tape devices.
+.Pp
+Raw devices are available for all drivers, including those that also
+implement a buffered device. For the latter group of devices, the
+differentiation is conventionally done by prepending the latter
+.Ql r
+to the path name of the device node, for example
+.Pa /dev/rsd0
+denotes the raw device for the first SCSI disk, while
+.Pa /dev/sd0
+is the corresponding device node for the buffered device.
+.Pp
+Unbuffered devices should be used for all actions that are not related
+to file system operations, even if the device in question is a disk
+device. This includes making backups of entire disk partitions, or
+to
+.Em raw
+floppy disks
+.Pq i.e. those used like tapes .
+.Pp
+Access restrictions to device nodes are usually subject of the regular
+file permissions of the device node entry, instead of being implied
+directly by the drivers in the kernel.
+.Ss Drivers without device nodes
+Drivers for network devices do not use device nodes in order to be
+accessed. Their selection is based on other decisions inside the
+kernel, and instead of calling
+.Xr open 2 ,
+use of a network device is generally introduced by using the system
+call
+.Xr socket 2 .
+.Ss Configuring a driver into the kernel
+For each kernel, there is a configuration file that is used as a base
+to select the facilities and drivers for that kernel, and to tune
+several options. See
+.Xr config 8
+for a detailed description of the files involved. The individual
+manual pages in this section provide a sample line for the
+configuration file in their synopsis portion. See also the sample
+config file
+.Pa /sys/i386/conf/LINT
+.Po
+for the
+.Em i386
+architecture
+.Pc .
+.Sh SEE ALSO
+.Xr open 2 ,
+.Xr close 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr ioctl 2 ,
+.Xr select 2 ,
+.Xr mmap 2 ,
+.Xr socket 2 ,
+.Xr hier 7 ,
+.Xr config 8 ,
+.Xr MAKEDEV 8 ,
+.Xr devfs 5 Pq not yet existent .
+.Sh AUTHORS
+This man page has been written by
+.if t J\(:org Wunsch
+.if n Joerg Wunsch
+with initial input by David E. O'Brien.
+.Sh HISTORY
+.Nm intro
+appeared in FreeBSD 2.1.
+
diff --git a/share/man/man4/man4.i386/lp.4 b/share/man/man4/man4.i386/lp.4
new file mode 100644
index 000000000000..b2de78b062b3
--- /dev/null
+++ b/share/man/man4/man4.i386/lp.4
@@ -0,0 +1,233 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 A.R.Gordon, andrew.gordon@net-tel.co.uk
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"
+.Dd March 4, 1996
+.Os
+.Dt LP 4
+.Sh NAME
+.Nm lp
+.Nd printer port Internet Protocol driver
+.Sh SYNOPSIS
+.Nm ifconfig lp0
+.Ar myaddress hisaddress
+.Op Fl link0
+.Cd "device lpt0 at isa? port? tty irq 7 vector lptintr"
+.Sh DESCRIPTION
+The
+.Nm
+driver allows a PC parallel printer port to be used as a
+point-to-point network interface between two similarly configured systems.
+Data is transferred 4 bits at a time, using the printer status lines for
+input: hence there is no requirement for special bidirectional hardware
+and any standard AT-compatible printer port with working interrupts may be used.
+.Pp
+The
+.Nm
+driver is implemented as an integral part of the
+.Nm lpt
+driver, and will automatically be present in a kernel configured with
+Internet support and at least one
+.Nm lpt
+device. During the boot process, for each
+.Nm lpt
+printer device which is probed and has an interrupt assigned, a corresponding
+.Nm
+network device is created. Available devices are announced with a message
+such as:
+.Dl lp0: TCP/IP capable interface
+.Pp
+Initially, the
+.Nm lpt
+device is active for printing and the network interface is inactive; however,
+once the corresponding
+.Nm
+device has been configured 'up' with
+.Nm ifconfig
+printing is disabled until the network interface is configured 'down'.
+.Pp
+The communication protocol is selected by the
+.Cm link0
+flag:
+.Bl -tag -width Fl
+.It Fl link0
+(default) Use FreeBSD mode (LPIP). This is the simpler of the two modes
+and therefore slightly more efficient.
+.It Cm link0
+Use Crynwr/Linux compatible mode (CLPIP). This mode has a simulated ethernet
+packet header, and is easier to interface to other types of equipment.
+.El
+.Pp
+The interface MTU defaults to 1500, but may be set to any value. Both ends
+of the link must be configured with the same MTU.
+.Ss Cable Connections
+The cable connecting the two parallel ports should be wired as follows:
+.Bd -literal
+ Pin Pin Description
+ 2 15 Data0 -> ERROR*
+ 3 13 Data1 -> SLCT
+ 4 12 Data2 -> PE
+ 5 10 Data3 -> ACK*
+ 6 11 Data4 -> BUSY
+ 15 2 ERROR* -> Data0
+ 13 3 SLCT -> Data1
+ 12 4 PE -> Data2
+ 10 5 ACK* -> Data3
+ 11 6 BUSY -> Data4
+ 18-25 18-25 Ground
+.Ed
+.Pp
+Cables with this wiring are widely available as 'Laplink' cables, and
+are often coloured yellow.
+.Pp
+The connections are symmetric, and provide 5 lines in each direction (four
+data plus one handshake). The two modes use the same wiring, but make a
+different choice of which line to use as handshake.
+.Ss FreeBSD LPIP mode
+The signal lines are used as follows:
+.Bl -tag -width dataxxxx(Pinxx)
+.It Em Data0 (Pin 2)
+Data out, bit 0.
+.It Em Data1 (Pin 3)
+Data out, bit 1.
+.It Em Data2 (Pin 4)
+Data out, bit 2.
+.It Em Data3 (Pin 5)
+Handshake out.
+.It Em Data4 (Pin 6)
+Data out, bit 3.
+.It Em ERROR* (pin 15)
+Data in, bit 0.
+.It Em SLCT (pin 13)
+Data in, bit 1.
+.It Em PE (pin 12)
+Data in, bit 2.
+.It Em BUSY (pin 11)
+Data in, bit 3.
+.It Em ACK* (pin 10)
+Handshake in.
+.El
+.Pp
+When idle, all data lines are at zero. Each byte is signalled in four steps:
+sender writes the 4 most significant bits and raises the handshake line;
+receiver reads the 4 bits and raises its handshake to acknowledge;
+sender places the 4 least significant bits on the data lines and lowers
+the handshake; receiver reads the data and lowers its handshake.
+.Pp
+The packet format has a two-byte header, comprising the fixed values 0x08,
+0x00, immediately followed by the IP header and data.
+.Pp
+The start of a packet is indicated by simply signalling the first byte
+of the header. The end of the packet is indicated by inverting
+the data lines (ie. writing the ones-complement of the previous nibble
+to be transmitted) without changing the state of the handshake.
+.Pp
+Note that the end-of-packet marker assumes that the handshake signal and
+the data-out bits can be written in a single instruction - otherwise
+certain byte values in the packet data would falsely be interpreted
+as end-of-packet. This is not a problem for the PC printer port,
+but requires care when implementing this protocol on other equipment.
+
+.Ss Crynwr/Linux CLPIP mode
+The signal lines are used as follows:
+.Bl -tag -width dataxxxx(Pinxx)
+.It Em Data0 (Pin 2)
+Data out, bit 0.
+.It Em Data1 (Pin 3)
+Data out, bit 1.
+.It Em Data2 (Pin 4)
+Data out, bit 2.
+.It Em Data3 (Pin 5)
+Data out, bit 3.
+.It Em Data4 (Pin 6)
+Handshake out.
+.It Em ERROR* (pin 15)
+Data in, bit 0.
+.It Em SLCT (pin 13)
+Data in, bit 1.
+.It Em PE (pin 12)
+Data in, bit 2.
+.It Em ACK* (pin 10)
+Data in, bit 3.
+.It Em BUSY (pin 11)
+Handshake in.
+.El
+.Pp
+When idle, all data lines are at zero. Each byte is signalled in four steps:
+sender writes the 4 least significant bits and raises the handshake line;
+receiver reads the 4 bits and raises its handshake to acknowledge;
+sender places the 4 most significant bits on the data lines and lowers
+the handshake; receiver reads the data and lowers its handshake.
+[Note that this is the opposite nibble order to LPIP mode].
+.Pp
+Packet format is:
+.Bd -literal
+Length (least significant byte)
+Length (most significant byte)
+12 bytes of supposed MAC addresses (ignored by FreeBSD).
+Fixed byte 0x08
+Fixed byte 0x00
+<IP datagram>
+Checksum byte.
+.Ed
+.Pp
+The length includes the 14 header bytes, but not the length bytes themselves
+nor the checksum byte.
+.Pp
+The checksum is a simple arithmetic sum of all the bytes (again, including
+the header but not checksum or length bytes). FreeBSD calculates
+outgoing checksums, but does not validate incoming ones.
+.Pp
+The start of packet has to be signalled specially, since the line chosen
+for handshake-in cannot be used to generate an interrupt. The sender
+writes the value 0x08 to the data lines, and waits for the receiver
+to respond by writing 0x01 to its data lines. The sender then starts
+signalling the first byte of the packet (the length byte).
+.Pp
+End of packet is deduced from the packet length and is not signalled
+specially (although the data lines are restored to the zero, idle
+state to avoid spuriously indicating the start of the next packet).
+.Sh SEE ALSO
+.Xr lpt 4
+.Sh BUGS
+Busy-waiting loops are used while handshaking bytes, (and worse still when
+waiting for the receiving system to respond to an interrupt for the start
+of a packet). Hence a fast system talking to a slow one will consume
+excessive amounts of CPU. This is unavoidable in the case of CLPIP mode
+due to the choice of handshake lines; it could theoretically be improved
+in the case of LPIP mode.
+.Pp
+Polling timeouts are controlled by counting loop iterations rather than
+timers, and so are dependent on CPU speed. This is somewhat stabilised
+by the need to perform (slow) ISA bus cycles to actually read the port.
+
diff --git a/share/man/man4/man4.i386/mtio.4 b/share/man/man4/man4.i386/mtio.4
new file mode 100644
index 000000000000..76b43129c0eb
--- /dev/null
+++ b/share/man/man4/man4.i386/mtio.4
@@ -0,0 +1,228 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Copyright (c) 1983, 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. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)mtio.4 8.1 (Berkeley) 6/5/93
+.\"
+.Dd February 11, 1996
+.Dt MTIO 4 i386
+.Os FreeBSD 2.2
+.Sh NAME
+.Nm mtio
+.Nd
+.Tn FreeBSD
+magtape interface
+.Sh DESCRIPTION
+The special files
+named
+.Pa /dev/[nr]st*
+refer to SCSI tape drives,
+which may be attached to the system.
+.Pa /dev/[nr]st*.ctl
+are control devices that can be used to issue ioctls to the SCSI
+tape driver to set parameters that are required to last beyond the
+unmounting of a tape.
+.Pp
+.Pp
+The rewind devices automatically rewind
+when the last requested read, write or seek has finished, or the end of the tape
+has been reached. The letter
+.Ql n
+is usually prepended to
+the name of the no-rewind devices.
+.Pp
+Tapes can be written with either fixed length records or variable length
+records. See
+.Xr st 4
+for more information. Two end-of-file markers mark the end of a tape, and
+one end-of-file marker marks the end of a tape file.
+If the tape is not to be rewound it is positioned with the
+head in between the two tape marks, where the next write
+will over write the second end-of-file marker.
+.Pp
+All of the magtape devices may be manipulated with the
+.Xr mt 1
+command.
+.Pp
+A number of
+.Xr ioctl 2
+operations are available
+on raw magnetic tape.
+The following definitions are from
+.Aq Pa sys/mtio.h :
+.Bd -literal
+/*
+ * Structures and definitions for mag tape io control commands
+ */
+
+/* structure for MTIOCTOP - mag tape op command */
+struct mtop {
+ short mt_op; /* operations defined below */
+ daddr_t mt_count; /* how many of them */
+};
+
+/* operations */
+#define MTWEOF 0 /* write an end-of-file record */
+#define MTFSF 1 /* forward space file */
+#define MTBSF 2 /* backward space file */
+#define MTFSR 3 /* forward space record */
+#define MTBSR 4 /* backward space record */
+#define MTREW 5 /* rewind */
+#define MTOFFL 6 /* rewind and put the drive offline */
+#define MTNOP 7 /* no operation, sets status only */
+#define MTCACHE 8 /* enable controller cache */
+#define MTNOCACHE 9 /* disable controller cache */
+
+#if defined(__FreeBSD__)
+/* Set block size for device. If device is a variable size dev */
+/* a non zero parameter will change the device to a fixed block size */
+/* device with block size set to that of the parameter passed in. */
+/* Resetting the block size to 0 will restore the device to a variable */
+/* block size device. */
+
+#define MTSETBSIZ 10
+
+/* Set density values for device. They are defined in the SCSI II spec */
+/* and range from 0 to 0x17. Sets the value for the opened mode only */
+
+#define MTSETDNSTY 11
+
+#define MTERASE 12 /* erase to EOM */
+#define MTEOD 13 /* Space to EOM */
+#define MTCOMP 14 /* select compression mode 0=off, 1=def */
+#define MTRETENS 15 /* re-tension tape */
+
+#endif
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget {
+ short mt_type; /* type of magtape device */
+/* the following two registers are grossly device dependent */
+ short mt_dsreg; /* ``drive status'' register */
+ short mt_erreg; /* ``error'' register */
+/* end device-dependent registers */
+ short mt_resid; /* residual count */
+#if defined (__FreeBSD__)
+ daddr_t mt_blksiz; /* presently operating blocksize */
+ daddr_t mt_density; /* presently operating density */
+ daddr_t mt_comp; /* presently operating compression */
+ daddr_t mt_blksiz0; /* blocksize for mode 0 */
+ daddr_t mt_blksiz1; /* blocksize for mode 1 */
+ daddr_t mt_blksiz2; /* blocksize for mode 2 */
+ daddr_t mt_blksiz3; /* blocksize for mode 3 */
+ daddr_t mt_density0; /* density for mode 0 */
+ daddr_t mt_density1; /* density for mode 1 */
+ daddr_t mt_density2; /* density for mode 2 */
+ daddr_t mt_density3; /* density for mode 3 */
+/* the following are not yet implemented */
+ u_char mt_comp0; /* compression type for mode 0 */
+ u_char mt_comp1; /* compression type for mode 1 */
+ u_char mt_comp2; /* compression type for mode 2 */
+ u_char mt_comp3; /* compression type for mode 3 */
+#endif
+ daddr_t mt_fileno; /* file number of current position */
+ daddr_t mt_blkno; /* block number of current position */
+/* end not yet implemented */
+};
+
+/*
+ * Constants for mt_type byte. These are the same
+ * for controllers compatible with the types listed.
+ */
+#define MT_ISTS 0x01 /* TS-11 */
+#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
+#define MT_ISTM 0x03 /* TM11/TE10 Unibus */
+#define MT_ISMT 0x04 /* TM78/TU78 Massbus */
+#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
+#define MT_ISCPC 0x06 /* SUN */
+#define MT_ISAR 0x07 /* SUN */
+#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
+#define MT_ISCY 0x09 /* CCI Cipher */
+#define MT_ISCT 0x0a /* HP 1/4 tape */
+#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */
+#define MT_ISEXABYTE 0x0c /* Exabyte */
+#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */
+#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */
+#define MT_ISVIPER1 0x0e /* Archive Viper-150 */
+#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */
+#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */
+#define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */
+#define MT_ISTK50 0x12 /* DEC SCSI TK50 */
+#define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */
+
+/* mag tape io control commands */
+#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
+#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
+#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
+#define MTIOCEEOT _IO('m', 4) /* enable EOT error */
+
+#ifndef KERNEL
+#define DEFTAPE "/dev/nrst0"
+#endif
+
+#ifdef KERNEL
+/*
+ * minor device number
+ */
+
+#define T_UNIT 003 /* unit selection */
+#define T_NOREWIND 004 /* no rewind on close */
+#define T_DENSEL 030 /* density select */
+#define T_800BPI 000 /* select 800 bpi */
+#define T_1600BPI 010 /* select 1600 bpi */
+#define T_6250BPI 020 /* select 6250 bpi */
+#define T_BADBPI 030 /* undefined selection */
+#endif
+#endif /* _SYS_MTIO_H_ */
+.Ed
+.Pp
+.Sh FILES
+.Bl -tag -width /dev/[nr]st* -compact
+.It Pa /dev/[nr]st*
+.El
+.Sh SEE ALSO
+.Xr mt 1 ,
+.Xr tar 1 ,
+.Xr st 4
+.Sh HISTORY
+The
+.Nm mtio
+manual appeared in
+.Bx 4.2 .
+An i386 version first appeared in FreeBSD 2.2.
+.Sh BUGS
+The status should be returned in a device independent format.
+.Pp
+The special file naming should be redone in a more consistent and
+understandable manner.
diff --git a/share/man/man5/hosts.equiv.5 b/share/man/man5/hosts.equiv.5
new file mode 100644
index 000000000000..44efb6899313
--- /dev/null
+++ b/share/man/man5/hosts.equiv.5
@@ -0,0 +1,124 @@
+.\" Copyright (c) 1983, 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. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd Feb 1996
+.Dt HOSTS.EQUIV 5
+.Os FreeBSD
+.Sh NAME
+.Nm hosts.equiv ,
+.Nm .rhosts
+.Nd trusted remote host name and user data base
+.Sh DESCRIPTION
+The
+.Nm hosts.equiv
+and
+.Nm .rhosts
+files contains information regarding
+trusted hosts and users on the network.
+For each host a single line should be present
+with the following information:
+
+simple
+.Bd -unfilled -offset indent
+hostname [username]
+.Ed
+
+or the more verbose
+.Bd -unfilled -offset indent
+[+-][hostname|@netgroup] [[+-][username|@netgroup]]
+.Ed
+.Pp
+A ``@'' indicates a host by netgroup or user by netgroup. A single
+``+'' match all hosts or users. A host name with leading ``-'' will reject
+all matching hosts and all their users. A user name with leading ``-''
+will reject all matching users from matching hosts.
+.Pp
+Items are separated by any number of blanks and/or
+tab characters. A ``#'' indicates the beginning of
+a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+Host names are specified in the conventional
+``.'' (dot) notation using the
+.Xr inet_addr 3
+routine
+from the Internet address manipulation library,
+.Xr inet 3 .
+Host names may contain any printable
+character other than a field delimiter, newline,
+or comment character.
+.Pp
+For security reasons, a users
+.Nm .rhosts
+file will be ignored if it is not a regular file, or if it
+is not owned by the user, or
+if is is writable by anyone other than the user.
+.Sh EXAMPLES
+.Pp
+.Dl bar.com foo
+.Pp
+Trust user ``foo'' from host ``bar.com''.
+.Pp
+.Dl +@allclient
+.Pp
+Trust all hosts from netgroup ``allclient''.
+.Pp
+.Dl +@allclient -@dau
+.Pp
+Trust all hosts from netgroup ``allclient'' and their users
+except users from netgroup ``dau''.
+.Sh FILES
+.Bl -tag -width /etc/hosts.equivxxx -compact
+.It Pa /etc/hosts.equiv
+The
+.Nm hosts.equiv
+file resides in
+.Pa /etc .
+.It Pa $HOME/.rhosts
+.Nm .rhosts
+file resides in
+.Pa $HOME .
+.El
+.Sh SEE ALSO
+.Xr rcp 1 ,
+.Xr rsh 1 ,
+.Xr rlogin 1 ,
+.Xr gethostbyname 3 ,
+.Xr innetgr 3 ,
+.Xr ruserok 3 ,
+.Xr inet 3 ,
+.Xr ifconfig 8 ,
+.Xr named 8 ,
+.Xr yp 4 .
+.Sh BUGS
+This man page is incomplete. For more information read
+the source in lib/libc/net/rcmd.c or the sunos man page.
+
diff --git a/share/syscons/keymaps/it.iso.kbd b/share/syscons/keymaps/it.iso.kbd
new file mode 100644
index 000000000000..bbc6e7cc9241
--- /dev/null
+++ b/share/syscons/keymaps/it.iso.kbd
@@ -0,0 +1,112 @@
+# alt
+# scan cntrl alt alt cntrl lock
+# code base shift cntrl shift alt shift cntrl shift state
+# ------------------------------------------------------------------
+ 000 nop nop nop nop nop nop nop nop O
+ 001 esc esc esc esc esc esc debug esc O
+ 002 '1' '!' nop nop '1' '!' nop nop O
+ 003 '2' '"' nul nul '2' '@' nul nul O
+ 004 '3' 156 nop nop '3' 156 nop nop O
+ 005 '4' '$' nop nop '4' '$' nop nop O
+ 006 '5' '%' nop nop '5' '%' nop nop O
+ 007 '6' '&' rs rs '6' '&' rs rs O
+ 008 '7' '/' nop nop '7' '/' nop nop O
+ 009 '8' '(' nop nop '8' '(' nop nop O
+ 010 '9' ')' nop nop '9' ')' nop nop O
+ 011 '0' '=' nop nop '0' '=' nop nop O
+ 012 ''' '?' ns ns ''' '?' ns ns O
+ 013 141 '^' nop nop 141 '^' nop nop O
+ 014 bs bs del del bs bs del del O
+ 015 ht btab nop nop ht btab nop nop O
+ 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C
+ 017 'w' 'W' etb etb 'w' 'W' etb etb C
+ 018 'e' 'E' enq enq 'e' 'E' enq enq C
+ 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C
+ 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C
+ 021 'y' 'Y' em em 'y' 'Y' em em C
+ 022 'u' 'U' nak nak 'u' 'U' nak nak C
+ 023 'i' 'I' ht ht 'i' 'I' ht ht C
+ 024 'o' 'O' si si 'o' 'O' si si C
+ 025 'p' 'P' dle dle 'p' 'P' dle dle C
+ 026 138 130 esc esc '[' '{' esc esc O
+ 027 '+' '*' gs gs ']' '}' gs gs O
+ 028 cr cr nl nl cr cr nl nl O
+ 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O
+ 030 'a' 'A' soh soh 'a' 'A' soh soh C
+ 031 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C
+ 032 'd' 'D' eot eot 'd' 'D' eot eot C
+ 033 'f' 'F' ack ack 'f' 'F' ack ack C
+ 034 'g' 'G' bel bel 'g' 'G' bel bel C
+ 035 'h' 'H' bs bs 'h' 'H' bs bs C
+ 036 'j' 'J' nl nl 'j' 'J' nl nl C
+ 037 'k' 'K' vt vt 'k' 'K' vt vt C
+ 038 'l' 'L' ff ff 'l' 'L' ff ff C
+ 039 149 135 nop nop '@' nop nop nop O
+ 040 133 '~' nop nop '#' nop nop nop O
+ 041 '\' '|' nop nop '~' '~' nop nop O
+ 042 lshift lshift lshift lshift lshift lshift lshift lshift O
+ 043 151 021 fs fs nop nop fs fs O
+ 044 'z' 'Z' sub sub 'z' 'Z' sub sub C
+ 045 'x' 'X' can can 'x' 'X' can can C
+ 046 'c' 'C' etx etx 'c' 'C' etx etx C
+ 047 'v' 'V' syn syn 'v' 'V' syn syn C
+ 048 'b' 'B' stx stx 'b' 'B' stx stx C
+ 049 'n' 'N' so so 'n' 'N' so so C
+ 050 'm' 'M' cr cr 'm' 'M' cr cr C
+ 051 ',' ';' nop nop ',' ';' nop nop O
+ 052 '.' ':' nop nop '.' ':' nop nop O
+ 053 '-' '_' nop nop '-' '_' nop nop O
+ 054 rshift rshift rshift rshift rshift rshift rshift rshift O
+ 055 '*' '*' nscr nscr '*' '*' nscr nscr O
+ 056 lalt lalt lalt lalt lalt lalt lalt lalt O
+ 057 ' ' ' ' nul ' ' ' ' ' ' 135 ' ' O
+ 058 clock clock clock clock clock clock clock clock O
+ 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O
+ 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O
+ 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O
+ 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O
+ 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O
+ 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O
+ 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O
+ 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O
+ 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O
+ 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O
+ 069 nlock nlock nlock nlock nlock nlock nlock nlock O
+ 070 slock slock slock slock slock slock slock slock O
+ 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N
+ 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N
+ 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N
+ 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N
+ 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N
+ 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N
+ 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N
+ 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N
+ 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N
+ 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N
+ 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N
+ 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N
+ 083 del '.' '.' '.' '.' '.' boot boot N
+ 084 nop nop nop nop nop nop nop nop O
+ 085 nop nop nop nop nop nop nop nop O
+ 086 '<' '>' nop nop nop nop nop nop O
+ 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
+ 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O
+ 089 cr cr cr cr cr cr cr cr O
+ 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O
+ 091 '/' '/' '/' '/' '/' '/' '/' '/' O
+ 092 nscr nop debug nop nop nop nop nop O
+ 093 ralt ralt ralt ralt ralt ralt ralt ralt O
+ 094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O
+ 095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O
+ 096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O
+ 097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O
+ 098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O
+ 099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O
+ 100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O
+ 101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O
+ 102 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O
+ 103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O
+ 104 slock slock slock slock slock slock slock slock O
+ 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O
+ 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O
+ 107 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O
diff --git a/sys/i386/eisa/3c5x9.c b/sys/i386/eisa/3c5x9.c
new file mode 100644
index 000000000000..bd1955f75f01
--- /dev/null
+++ b/sys/i386/eisa/3c5x9.c
@@ -0,0 +1,309 @@
+/*
+ * Product specific probe and attach routines for:
+ * 3COM 3C579 and 3C509(in eisa config mode) ethernet controllers
+ *
+ * Copyright (c) 1996 Justin T. Gibbs
+ * 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 immediately at the beginning of the file, without modification,
+ * 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. Absolutely no warranty of function or purpose is made by the author
+ * Justin T. Gibbs.
+ * 4. Modifications may be freely made to this file if the above conditions
+ * are met.
+ *
+ * $Id: 3c5x9.c,v 1.1 1996/02/26 01:01:37 gibbs Exp $
+ */
+
+#include "eisa.h"
+#if NEISA > 0
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/devconf.h>
+#include <sys/kernel.h>
+
+#include <machine/clock.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
+#include <i386/isa/if_epreg.h>
+#include <i386/isa/isa_device.h> /* For kdc_isa0 */
+#include <i386/eisa/eisaconf.h>
+
+#define EISA_DEVICE_ID_3COM_3C509_TP 0x506d5090
+#define EISA_DEVICE_ID_3COM_3C509_BNC 0x506d5091
+#define EISA_DEVICE_ID_3COM_3C579_TP 0x506d5092
+#define EISA_DEVICE_ID_3COM_3C579_BNC 0x506d5093
+#define EISA_DEVICE_ID_3COM_3C509_COMBO 0x506d5094
+#define EISA_DEVICE_ID_3COM_3C509_TPO 0x506d5095
+
+#define EP_EISA_SLOT_OFFSET 0x0c80
+#define EP_EISA_IOSIZE 0x000a
+
+#define EISA_IOCONF 0x0008
+#define IRQ_CHANNEL 0xf000
+#define INT_3 0x3000
+#define INT_5 0x5000
+#define INT_7 0x7000
+#define INT_9 0x9000
+#define INT_10 0xa000
+#define INT_11 0xb000
+#define INT_12 0xc000
+#define INT_15 0xf000
+#define EISA_BPROM_MEDIA_CONF 0x0006
+#define TRANS_TYPE 0xc000
+#define TRANS_TP 0x0000
+#define TRANS_AUI 0x4000
+#define TRANS_BNC 0xc000
+
+static int ep_eisa_probe __P((void));
+static int ep_eisa_attach __P((struct eisa_device *e_dev));
+
+struct eisa_driver ep_eisa_driver = {
+ "ep",
+ ep_eisa_probe,
+ ep_eisa_attach,
+ /*shutdown*/NULL,
+ &ep_unit
+ };
+
+DATA_SET (eisadriver_set, ep_eisa_driver);
+
+static struct kern_devconf kdc_eisa_ep = {
+ 0, 0, 0, /* filled in by dev_attach */
+ "ep", 0, { MDDT_EISA, 0, "net" },
+ eisa_generic_externalize, 0, 0, EISA_EXTERNALLEN,
+ &kdc_eisa0, /* parent */
+ 0, /* parentdata */
+ DC_UNCONFIGURED, /* always start out here */
+ NULL,
+ DC_CLS_MISC /* host adapters aren't special */
+};
+
+static char *ep_match __P((eisa_id_t type));
+
+static char*
+ep_match(type)
+ eisa_id_t type;
+{
+ switch(type) {
+ case EISA_DEVICE_ID_3COM_3C509_TP:
+ return "3Com 3C509-TP Network Adapter";
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_BNC:
+ return "3Com 3C509-BNC Network Adapter";
+ break;
+ case EISA_DEVICE_ID_3COM_3C579_TP:
+ return "3Com 3C579-TP EISA Network Adapter";
+ break;
+ case EISA_DEVICE_ID_3COM_3C579_BNC:
+ return "3Com 3C579-BNC EISA Network Adapter";
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_COMBO:
+ return "3Com 3C509-Combo Network Adapter";
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_TPO:
+ return "3Com 3C509-TPO Network Adapter";
+ break;
+ default:
+ break;
+ }
+ return (NULL);
+}
+
+static int
+ep_eisa_probe(void)
+{
+ u_long iobase;
+ struct eisa_device *e_dev = NULL;
+ int stat = 0;
+ int count;
+
+ count = 0;
+ while ((e_dev = eisa_match_dev(e_dev, ep_match))) {
+ u_short conf;
+ u_long port;
+ int irq;
+
+ port = (e_dev->ioconf.slot * EISA_SLOT_SIZE);
+ iobase = port + EP_EISA_SLOT_OFFSET;
+
+ /* We must be in EISA configuration mode */
+ if ((inw(iobase + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)
+ continue;
+
+ eisa_add_iospace(e_dev, iobase, EP_EISA_IOSIZE, RESVADDR_NONE);
+ eisa_add_iospace(e_dev, port, EP_IOSIZE, RESVADDR_NONE);
+
+ conf = inw(iobase + EISA_IOCONF);
+ /* Determine our IRQ */
+ switch (conf & IRQ_CHANNEL) {
+ case INT_3:
+ irq = 3;
+ break;
+ case INT_5:
+ irq = 5;
+ break;
+ case INT_7:
+ irq = 7;
+ break;
+ case INT_9:
+ irq = 9;
+ break;
+ case INT_10:
+ irq = 10;
+ break;
+ case INT_11:
+ irq = 11;
+ break;
+ case INT_12:
+ irq = 12;
+ break;
+ case INT_15:
+ irq = 15;
+ break;
+ default:
+ /* Disabled */
+ printf("ep: 3COM Network Adapter at "
+ "slot %d has its IRQ disabled. "
+ "Probe failed.\n",
+ e_dev->ioconf.slot);
+ continue;
+ }
+ eisa_add_intr(e_dev, irq);
+ eisa_registerdev(e_dev, &ep_eisa_driver, &kdc_eisa_ep);
+ if(e_dev->id != EISA_DEVICE_ID_3COM_3C579_TP &&
+ e_dev->id != EISA_DEVICE_ID_3COM_3C579_BNC) {
+ /* Our real parent is the isa bus. Say so. */
+ e_dev->kdc->kdc_parent = &kdc_isa0;
+ }
+ count++;
+ }
+ return count;
+}
+
+static int
+ep_eisa_attach(e_dev)
+ struct eisa_device *e_dev;
+{
+ struct ep_softc *sc;
+ struct ep_board *epb;
+ int unit = e_dev->unit;
+ int irq = ffs(e_dev->ioconf.irq) - 1;
+ resvaddr_t *ioport;
+ resvaddr_t *eisa_ioport;
+ u_char level_intr;
+ u_short conf;
+ int i;
+
+ /*
+ * The addresses are sorted in increasing order
+ * so we know the port to pass to the core ep
+ * driver comes first.
+ */
+ ioport = e_dev->ioconf.ioaddrs.lh_first;
+
+ if(!ioport)
+ return -1;
+
+ eisa_ioport = ioport->links.le_next;
+
+ if(!eisa_ioport)
+ return -1;
+
+ eisa_reg_start(e_dev);
+ if(eisa_reg_iospace(e_dev, ioport))
+ return -1;
+
+ if(eisa_reg_iospace(e_dev, eisa_ioport))
+ return -1;
+
+ epb = &ep_board[ep_boards];
+
+ epb->epb_addr = ioport->addr;
+ epb->epb_used = 1;
+
+ if(!(sc = ep_alloc(unit, epb)))
+ return -1;
+
+ ep_boards++;
+
+ sc->stat = 0;
+ sc->kdc = e_dev->kdc;
+ level_intr = FALSE;
+ switch(e_dev->id) {
+ case EISA_DEVICE_ID_3COM_3C509_TP:
+ sc->ep_connectors = UTP|AUI;
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_BNC:
+ sc->ep_connectors = BNC|AUI;
+ break;
+ case EISA_DEVICE_ID_3COM_3C579_TP:
+ sc->ep_connectors = UTP|AUI;
+ sc->stat = F_ACCESS_32_BITS;
+ level_intr = TRUE;
+ break;
+ case EISA_DEVICE_ID_3COM_3C579_BNC:
+ sc->ep_connectors = BNC|AUI;
+ sc->stat = F_ACCESS_32_BITS;
+ level_intr = TRUE;
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_COMBO:
+ sc->ep_connectors = UTP|BNC|AUI;
+ break;
+ case EISA_DEVICE_ID_3COM_3C509_TPO:
+ sc->ep_connectors = UTP;
+ break;
+ default:
+ break;
+ }
+ /*
+ * Set the eisa config selected media type
+ */
+ sc->ep_connector = inw(eisa_ioport->addr + EISA_BPROM_MEDIA_CONF)
+ >> ACF_CONNECTOR_BITS;
+
+ if(eisa_reg_intr(e_dev, irq, ep_intr, (void *)sc, &net_imask,
+ /*shared ==*/level_intr)) {
+ ep_free(sc);
+ return -1;
+ }
+ eisa_reg_end(e_dev);
+
+ /* Reset and Enable the card */
+ outb(eisa_ioport->addr + EP_W0_CONFIG_CTRL, W0_P4_CMD_RESET_ADAPTER);
+ DELAY(1000); /* we must wait at least 1 ms */
+ outb(eisa_ioport->addr + EP_W0_CONFIG_CTRL, W0_P4_CMD_ENABLE_ADAPTER);
+
+ /* Now the registers are availible through the lower ioport */
+
+ /*
+ * Retrieve our ethernet address
+ */
+ GO_WINDOW(0);
+ for(i = 0; i < 3; i++)
+ sc->epb->eth_addr[i] = get_e(sc, i);
+
+ ep_attach(sc);
+
+ if(eisa_enable_intr(e_dev, irq)) {
+ ep_free(sc);
+ eisa_release_intr(e_dev, irq, ep_intr);
+ return -1;
+ }
+
+ return 0;
+}
+
+#endif /* NEISA > 0 */
diff --git a/sys/i386/include/laptops.h b/sys/i386/include/laptops.h
new file mode 100644
index 000000000000..1ea104ca445f
--- /dev/null
+++ b/sys/i386/include/laptops.h
@@ -0,0 +1,104 @@
+/*
+ * Machine-depend parameters for laptop machines
+ *
+ * Copyright (c) 1996, HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
+ */
+
+/*
+ * Laptop machines has more incompatibilities and machine-specific
+ * parameters than the desktop machines.
+ */
+
+#ifndef _LAPTOPS_H_
+#define _LAPTOPS_H_
+
+#ifdef LAPTOP
+
+#ifdef HINOTE /* Digital Hinote */
+#ifndef COMPAT_APM10
+#define COMPAT_APM10
+#endif /* COMPAT_APM10 */
+#ifndef SIO_IRQ_BUG
+#define SIO_IRQ_BUG
+#endif /* SIO_IRQ_BUG */
+#endif /* HINOTE */
+
+#ifdef DHULTRA /* Digital Hinote Ultra */
+#ifndef FORCE_APM10
+#define FORCE_APM10
+#endif /* FORCE_APM10 */
+#ifndef SIO_IRQ_BUG
+#define SIO_IRQ_BUG
+#endif /* SIO_IRQ_BUG */
+#endif /* DHULTRA */
+
+#ifdef TP230 /* IBM ThinkPad 230 Series */
+#ifndef SIO_IRQ_BUG2
+#define SIO_IRQ_BUG2
+#endif /* SIO_IRQ_BUG2 */
+#ifndef FORCE_APM10
+#define FORCE_APM10
+#endif /* FORCE_APM10 */
+#ifndef PCIC_NOCLRREGS
+#define PCIC_NOCLRREGS
+#endif /* PCIC_NOCLRREGS */
+#endif /* TP230 */
+
+#ifdef TP230FBW /* IBM ThinkPad 230 FBW Series */
+#ifndef SIO_IRQ_BUG2
+#define SIO_IRQ_BUG2
+#endif /* SIO_IRQ_BUG2 */
+#ifndef PCIC_NOCLRREGS
+#define PCIC_NOCLRREGS
+#endif /* PCIC_NOCLRREGS */
+#endif /* TP230FBW */
+
+#ifdef TP530 /* IBM ThinkPad 530 Series */
+#ifndef APM_DSVALUE_BUG
+#define APM_DSVALUE_BUG
+#endif /* APM_DSVALUE_BUG */
+#endif /* TP530 */
+
+#ifdef WINBOOKPRO /* Sotec WinbookPro */
+#ifndef FORCE_APM10
+#define FORCE_APM10
+#endif /* FORCE_APM10 */
+#ifndef APM_NO_ENGAGE
+#define APM_NO_ENGAGE
+#endif /* APM_NO_ENGAGE */
+#ifndef APM_SUSPEND_POSTPONE
+#define APM_SUSPEND_POSTPONE
+#endif /* APM_SUSPEND_POSTPONE */
+#ifndef APM_DISABLE_BUG
+#define APM_DISABLE_BUG
+#endif /* APM_DISABLE_BUG */
+#endif /* WINBOOKPRO */
+
+#ifdef GW2KLIBERTY /* Gateway 2K Liberty */
+#ifndef FORCE_APM10
+#define FORCE_APM10
+#endif /* FORCE_APM10 */
+#endif /* GW2KLIBERTY */
+
+#ifdef JETMINI /* Panasonic Pronote Jet Mini */
+#ifndef FORCE_APM10
+#define FORCE_APM10
+#endif /* FORCE_APM10 */
+#endif /* JETMINI */
+
+#ifdef CONTURA /* COMPAQ CONTURA Series */
+#ifndef SIO_IRQ_BUG
+#define SIO_IRQ_BUG
+#endif /* SIO_IRQ_BUG */
+#ifndef PCIC_NOCLRREGS
+#define PCIC_NOCLRREGS
+#endif /* PCIC_NOCLRREGS */
+#ifndef APM_SUSPEND_DELAY
+#define APM_SUSPEND_DELAY
+#endif /* APM_SUSPEND_DELAY */
+#endif /* CONTURA */
+
+
+#endif /* LAPTOP */
+
+#endif /* _LAPTOPS_H_ */
diff --git a/usr.bin/locate/locate/locate.updatedb.8 b/usr.bin/locate/locate/locate.updatedb.8
new file mode 100644
index 000000000000..eeaa9c00621e
--- /dev/null
+++ b/usr.bin/locate/locate/locate.updatedb.8
@@ -0,0 +1,58 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Mike Pritchard.
+.\" 4. Neither the name of the author 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE 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.
+.\"
+.Dd February 11, 1996
+.Dt LOCATE.UPDATEDB 8
+.Os BSD 4.4
+.Sh NAME
+.Nm locate.updatedb
+.Nd update locate database
+.Sh SYNOPSIS
+.Nm /usr/libexec/locate.updatedb
+.Sh DESCRIPTION
+.Nm Locate.updatedb
+updates the database used by
+.Xr locate 1 .
+It is typically run once a week by the
+.Nm /etc/weekly script.
+.Sh FILES
+.Bl -tag -width /var/db/locate.database -compact
+.It Pa /var/db/locate.database the actual database
+.El
+.Sh SEE ALSO
+.Xr locate 1
+.Rs
+.%A Woods, James A.
+.%D 1983
+.%T "Finding Files Fast"
+.%J ";login"
+.%V 8:1
+.%P pp. 8-10
+.Re
diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh
new file mode 100644
index 000000000000..af9eb47c143a
--- /dev/null
+++ b/usr.bin/locate/locate/updatedb.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# James A. Woods.
+#
+# Modified to be a /bin/sh script by Nate Williams
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the University of
+# California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# @(#)updatedb.csh 8.3 (Berkeley) 3/19/94
+#
+
+SRCHPATHS="/" # directories to be put in the database
+LIBDIR="/usr/libexec" # for subprograms
+FCODES="/var/db/locate.database" # the database
+if [ "$TMPDIR" = "" ]; then
+ TMPDIR="/var/tmp" # for temp files
+fi
+
+PATH=/bin:/usr/bin
+BIGRAMS="$TMPDIR/locate.bigrams.$$"
+FILELIST="$TMPDIR/locate.list.$$"
+ERRS="$TMPDIR/locate.errs.$$"
+
+# Make a file list and compute common bigrams.
+# Alphabetize '/' before any other char with 'tr'.
+# If the system is very short of sort space, 'bigram' can be made
+# smarter to accumulate common bigrams directly without sorting
+# ('awk', with its associative memory capacity, can do this in several
+# lines, but is too slow, and runs out of string space on small machines).
+
+# search locally or everything
+# find ${SRCHPATHS} -print | \
+find ${SRCHPATHS} ! -fstype ufs -prune -or -print | \
+ tr '/' '\001' | \
+ (sort -T $TMPDIR -f; echo $? > $ERRS) | tr '\001' '/' > $FILELIST
+
+$LIBDIR/locate.bigram < $FILELIST | \
+ (sort -T $TMPDIR ; echo $? >> $ERRS) | \
+ uniq -c | sort -T $TMPDIR -nr | \
+ awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $BIGRAMS
+
+# code the file list
+if [ `sort -u $ERRS | grep -s -v 0` ]; then
+ printf 'locate: updatedb failed\n\n'
+else
+ $LIBDIR/locate.code $BIGRAMS < $FILELIST > $FCODES
+ chmod 644 $FCODES
+ rm $BIGRAMS $FILELIST $ERRS
+fi
diff --git a/usr.bin/talk/get_iface.c b/usr.bin/talk/get_iface.c
new file mode 100644
index 000000000000..741392e3db7e
--- /dev/null
+++ b/usr.bin/talk/get_iface.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright 1994, 1995 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * From:
+ * Id: find_interface.c,v 1.1 1995/08/14 16:08:39 wollman Exp
+ *
+ * $Id: get_iface.c,v 1.1 1996/03/09 19:22:52 joerg Exp $
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "talk.h"
+
+/*
+ * Try to find the interface address that is used to route an IP
+ * packet to a remote peer.
+ */
+
+int
+get_iface(dst, iface)
+ struct in_addr *dst;
+ struct in_addr *iface;
+{
+ static struct sockaddr_in local;
+ struct sockaddr_in remote;
+ struct hostent *hp;
+ int s, rv, namelen;
+
+ memcpy(&remote.sin_addr, dst, sizeof remote.sin_addr);
+ remote.sin_port = htons(60000);
+ remote.sin_family = AF_INET;
+ remote.sin_len = sizeof remote;
+
+ local.sin_addr.s_addr = htonl(INADDR_ANY);
+ local.sin_port = htons(60000);
+ local.sin_family = AF_INET;
+ local.sin_len = sizeof local;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ return -1;
+
+ do {
+ rv = bind(s, (struct sockaddr *)&local, sizeof local);
+ local.sin_port = htons(ntohs(local.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0) {
+ close(s);
+ return -1;
+ }
+
+ do {
+ rv = connect(s, (struct sockaddr *)&remote, sizeof remote);
+ remote.sin_port = htons(ntohs(remote.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0) {
+ close(s);
+ return -1;
+ }
+
+ namelen = sizeof local;
+ rv = getsockname(s, (struct sockaddr *)&local, &namelen);
+ close(s);
+ if (rv < 0)
+ return -1;
+
+ memcpy(iface, &local.sin_addr, sizeof local.sin_addr);
+ return 0;
+}
diff --git a/usr.sbin/qcamcontrol/Makefile b/usr.sbin/qcamcontrol/Makefile
new file mode 100644
index 000000000000..d5f42cf0bf2b
--- /dev/null
+++ b/usr.sbin/qcamcontrol/Makefile
@@ -0,0 +1,3 @@
+PROG= qcamcontrol
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/qcamcontrol/qcamcontrol.1 b/usr.sbin/qcamcontrol/qcamcontrol.1
new file mode 100644
index 000000000000..33f7a96c8c04
--- /dev/null
+++ b/usr.sbin/qcamcontrol/qcamcontrol.1
@@ -0,0 +1,64 @@
+.Dd Feburary 29, 1996
+.Dt QCAMCONTROL 1
+.Os FreeBSD
+.Sh NAME
+.Nm qcamcontrol
+.Nd Connectix QuickCam control utility
+.Sh SYNOPSIS
+.Nm qcamcontrol
+.Op Fl b Ar brightness
+.Op Fl c Ar contrast
+.Op Fl d Ar depth
+.Op Fl p Ar device
+.Op Fl w Ar whitebalance
+.Op Fl x Ar xsize
+.Op Fl y Ar ysize
+.Op Fl z Ar zoom
+.Sh DESCRIPTION
+.Nm qcamcontrol
+is a program to demonstrate control over the Connectix QuickCam(TM)
+parallel port camera and to take a single frame picture.
+.Pp
+If the device not specified, "/dev/qcam0" is assumed.
+If no command is given, then
+.Nm qcamcontrol
+will use its defaults to grab a single frame from the camera. The control
+program will output a portable pixmap (ppm) file to stdout.
+.Pp
+The following options are available:
+.Bl -tag -width "flag whitebalance"
+.It Fl b Ar brightness
+control the brightness of the picture (0..255)
+.It Fl c Ar contrast
+control the contrast of the picture (0..255)
+.It Fl d Ar depth
+16 or 64 shades of gray (specified as 4 or 6 bits per pixel)
+.It Fl p Ar device
+quickcam device (port) (default is /dev/qcam0)
+.It Fl w Ar whitebalance
+amount of white in the picture (0..255)
+.It Fl x Ar xsize
+width of image (320 or less)
+.It Fl y Ar ysize
+height of image (240 or less)
+.It Fl z Ar zoom
+zoom in (1, 1.5x, or 2x)
+.El
+.Sh BUGS
+.Nm qcamcontrol
+does not enforce a proper aspect ratio for x y sizes.
+In practice, standard picture sizes are 320x240 and 180x160 and all smaller
+sizes that maintain a similar aspect ratio.
+Also, the camera is notoriously finicky until you get just the right
+combination of white-balance, contrast, and brightness. Improper values
+will return all-black or all-white pictures.
+.Sh FILES
+.Bl -tag -width /dev/qcam0 -compact
+.It Pa /dev/qcam0
+.El
+.Sh AUTHOR
+Paul Traina
+.Sh HISTORY
+The
+.Nm qcamcontrol
+command appeared in FreeBSD 2.1.1
diff --git a/usr.sbin/qcamcontrol/qcamtime/Makefile b/usr.sbin/qcamcontrol/qcamtime/Makefile
new file mode 100644
index 000000000000..03c040cf4850
--- /dev/null
+++ b/usr.sbin/qcamcontrol/qcamtime/Makefile
@@ -0,0 +1,8 @@
+#
+# qcamtime is a program for snarfing timing histograms out of the kernel
+# it is only meant for use by driver developers
+#
+PROG= qcamtime
+NOMAN=
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/qcamcontrol/qcamtime/qcamtime.c b/usr.sbin/qcamcontrol/qcamtime/qcamtime.c
new file mode 100644
index 000000000000..5ed58a1a3158
--- /dev/null
+++ b/usr.sbin/qcamcontrol/qcamtime/qcamtime.c
@@ -0,0 +1,111 @@
+/*
+ * Print out timing statistics from a QuickCam scan run yes, this is ugly,
+ * it's just for simple analysis of driver timing. This is not normally
+ * part of the system.
+ *
+ * Paul Traina, Feburary 1996
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/fcntl.h>
+#include <paths.h>
+#include <nlist.h>
+
+#include <machine/qcam.h>
+
+int kmem = -1;
+
+struct nlist names[] = {
+ {"_qcam_rsbhigh"},
+ {"_qcam_rsblow"}
+};
+#define MAX_SYMBOLS 2
+
+#define FBUFSIZE (QC_MAX_XSIZE*QC_MAX_YSIZE)+50
+static u_short high_times[FBUFSIZE];
+static u_short low_times[FBUFSIZE];
+
+void
+getaddrs(void)
+{
+ int i;
+
+ if (kmem < 0) {
+ if ((kmem = open(_PATH_KMEM, 0, 0)) < 0) {
+ perror("open kmem");
+ exit(1);
+ }
+ (void) fcntl(kmem, F_SETFD, 1);
+
+ for (i = 0; i < MAX_SYMBOLS; i++) {
+ if (nlist("/kernel", &names[i]) < 0) {
+ perror("nlist");
+ exit(1);
+ }
+ if (names[i].n_value == 0) {
+ fprintf(stderr, "couldn't find names[%d]\n", i);
+ exit(1);
+ }
+ }
+ }
+}
+
+void
+getdata(void)
+{
+ if (lseek(kmem, (off_t) names[0].n_value, SEEK_SET) < 0) {
+ perror("lseek high");
+ exit(1);
+ }
+ if (read(kmem, (u_short *) high_times, sizeof(high_times)) < 0) {
+ perror("read high");
+ exit(1);
+ }
+ if (lseek(kmem, (off_t) names[1].n_value, SEEK_SET) < 0) {
+ perror("lseek low");
+ exit(1);
+ }
+ if (read(kmem, (u_short *) low_times, sizeof(low_times)) < 0) {
+ perror("read low");
+ exit(1);
+ }
+}
+
+
+/*
+ * slow and stupid, who cares? we're just learning about the camera's
+ * behavior
+ */
+int
+printdata(u_short * p, int length)
+{
+ int i, j, non_zero;
+
+ for (i = 0; i < length;) {
+ non_zero = 0;
+ for (j = 0; j < 16; j++)
+ if (p[j])
+ non_zero++;
+
+ if (non_zero) {
+ printf("%8d:", i);
+
+ for (j = 0; j < 16; j++) {
+ printf(" %d", *p++);
+ i++;
+ }
+ printf("\n");
+ } else
+ i += 16;
+ }
+}
+
+void
+main(void)
+{
+ getaddrs();
+ getdata();
+ printdata(high_times, FBUFSIZE);
+ printdata(low_times, FBUFSIZE);
+}
diff --git a/usr.sbin/tzsetup/tzsetup.8 b/usr.sbin/tzsetup/tzsetup.8
new file mode 100644
index 000000000000..bcea26124013
--- /dev/null
+++ b/usr.sbin/tzsetup/tzsetup.8
@@ -0,0 +1,43 @@
+.\"
+.\" (c) Wolfram Schneider, Berlin, Germany. Public domain.
+.\"
+.\" $Id: tzsetup.8,v 1.1 1996/01/24 00:11:58 wosch Exp $
+
+.Dd Jan 1996
+.Dt TZSETUP 8
+.Os FreeBSD
+
+.Sh NAME
+.Nm tzsetup
+.Nd set local timezone
+
+.Sh DESCRIPTION
+.Nm tzsetup
+is a menu based program to set your local time zone. Pick the continent
+and a city (e.g. your capital) that best describes your location and
+.Nm tzsetup
+do all the work for you.
+
+.Sh BUGS
+You need to reboot the machine for changes to take effect.
+
+.Sh FILES
+.Bl -tag -width /etc/wall_cmos_clock -compact
+.It Pa /etc/localtime
+current time zone file
+.It Pa /usr/share/zoneinfo
+directory for zoneinfo files
+.It Pa /etc/wall_cmos_clock
+see adjkerntz(8).
+.El
+
+.Sh SEE ALSO
+.Xr adjkerntz 8 ,
+.Xr adjtime 2 ,
+.Xr ctime 3 ,
+.Xr date 1 ,
+.Xr timezone 3 ,
+.Xr tzfile 5 ,
+.Xr zdump 8 ,
+.Xr zic 8 .
+