diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1996-01-29 00:33:03 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1996-01-29 00:33:03 +0000 |
| commit | 3ec408c6eb2a60281dda3545efcb0bb6b642057e (patch) | |
| tree | 01c89a3a3c42f527120e0363b294751974c8fefc | |
| parent | bc9112fb36b7e39d61b6b9adc1b724e36f76a74b (diff) | |
Notes
41 files changed, 2910 insertions, 0 deletions
diff --git a/gnu/usr.bin/cc/f77/f77.1 b/gnu/usr.bin/cc/f77/f77.1 new file mode 100644 index 000000000000..cc501d75bebe --- /dev/null +++ b/gnu/usr.bin/cc/f77/f77.1 @@ -0,0 +1,67 @@ +.Dd July 22, 1995 +.Dt F77 1 +.Os FreeBSD +.Sh NAME +.Nm f77 +.Nd FORTRAN compiler driver +.Sh SYNOPSIS +.Nm f77 +.Op options | files +.Sh DESCRIPTION +.Nm f77 +is a simple driver for the FORTRAN compilation process under FreeBSD. +.Pp +.Nm f77 +calls the FORTRAN to C translator +.Nm f2c +to translate the FORTRAN source to C. Then it calls +.Nm cc +to compile the resulting C code and +.Nm as +to assemble it. After this stage it may call +.Nm ld +to link the resulting object files together with the +.Nm f2c +library +.Nm libf2c +, the +.Nm math +library +.Nm libm +and other user specified libraries into an executable. Files ending in other +suffixes than .f (.o, .c, ...) are also accepted in the commandline and will +processed by the appropriate program. +.Pp +From the user side of view this FORTRAN to C translation is completely +transparent - +.Nm f77 +looks like a traditional FORTRAN compiler. +.Pp +Available options: +.Pp +The options that +.Nm f77 +recognizes are a superset of the +.Nm f2c +and the +.Nm cc +options - please refer to their manpages for more details. +.Pp +.Sh FILES +file.f FORTRAN source file +.Pp +file.o object file +.Pp +a.out link edited output +.Pp +/usr/lib/libf2c.a f2c library (contains libF77 and libI77) +.Pp +/usr/lib/libf2c.so.x.y shared f2c library +.Pp +.Sh SEE ALSO +.Xr f2c 1 , +.Xr cc 1 , +.Xr as 1 , +.Xr ld 1 +.Sh BUGS +The input file must end in .f - for instance .for will give problems. diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 new file mode 100644 index 000000000000..20ee4d979df6 --- /dev/null +++ b/lib/libc/sys/ptrace.2 @@ -0,0 +1,196 @@ +.\" $Id$ +.\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ +.\" +.\" This file is in the public domain. +.Dd January 20, 1996 +.Dt PTRACE 2 +.Os FreeBSD 2 +.Sh NAME +.Nm ptrace +.Nd process tracing and debugging +.Sh SYNOPSIS +.Fd #include <sys/types.h> +.Fd #include <sys/ptrace.h> +.Ft int +.Fn ptrace "int request" "pid_t pid" "caddr_t addr" "int data" +.Sh DESCRIPTION +.Fn ptrace +provides tracing and debugging facilities. It allows one process (the +.Em tracing +process) to control another (the +.Em traced +process). Most of the time, the traced process runs normally, but when +it receives a signal +.Po +see +.Xr sigaction 2 +.Pc , +it stops. The tracing process is expected to notice this via +.Xr wait 2 +or the delivery of a +.Dv SIGCHLD +signal, examine the state of the stopped process, and cause it to +terminate or continue as appropriate. +.Fn ptrace +is the mechanism by which all this happens. +.Pp +The +.Fa request +argument specifies what operation is being performed; the meaning of +the rest of the arguments depends on the operation, but except for one +special case noted below, all +.Fn ptrace +calls are made by the tracing process, and the +.Fa pid +argument specifies the process ID of the traced process. +.Fa request +can be: +.Bl -tag -width 12n +.It Dv PT_TRACE_ME +This request is the only one used by the traced process; it declares +that the process expects to be traced by its parent. All the other +arguments are ignored. (If the parent process does not expect to trace +the child, it will probably be rather confused by the results; once the +traced process stops, it cannot be made to continue except via +.Eo \& +.Fn ptrace +.Ec \&.) +When a process has used this request and calls +.Xr execve 2 +or any of the routines built on it +.Po +such as +.Xr execv 3 +.Pc , +it will stop before executing the first instruction of the new image. +Also, any setuid or setgid bits on the executable being executed will +be ignored. +.It Dv PT_READ_I , Dv PT_READ_D +These requests read a single +.Li int +of data from the traced process' address space. Traditionally, +.Fn ptrace +has allowed for machines with distinct address spaces for instruction +and data, which is why there are two requests: conceptually, +.Dv PT_READ_I +reads from the instruction space and +.Dv PT_READ_D +reads from the data space. In the current NetBSD implementation, these +two requests are completely identical. The +.Fa addr +argument specifies the address (in the traced process' virtual address +space) at which the read is to be done. This address does not have to +meet any alignment constraints. The value read is returned as the +return value from +.Eo \& +.Fn ptrace +.Ec . +.It Dv PT_WRITE_I , Dv PT_WRITE_D +These requests parallel +.Dv PT_READ_I +and +.Dv PT_READ_D , +except that they write rather than read. The +.Fa data +argument supplies the value to be written. +.It Dv PT_READ_U +This request reads an +.Li int +from the traced process' user structure. The +.Fa addr +argument specifies the location of the int relative to the base of the +user structure; it will usually be an integer value cast to +.Li caddr_t +either explicitly or via the presence of a prototype for +.Eo \& +.Fn ptrace +.Ec . +Unlike +.Dv PT_READ_I +and +.Dv PT_READ_D , +.Fa addr +must be aligned on an +.Li int +boundary. The value read is returned as the return value from +.Eo \& +.Fn ptrace +.Ec . +.It Dv PT_WRITE_U +This request writes an +.Li int +into the traced process' user structure. +.Fa addr +specifies the offset, just as for +.Dv PT_READ_U , +and +.Fa data +specifies the value to be written, just as for +.Dv PT_WRITE_I +and +.Dv PT_WRITE_D . +.It Dv PT_CONTINUE +The traced process continues execution. +.Fa addr +is an address specifying the place where execution is to be resumed (a +new value for the program counter), or +.Li (caddr_t)1 +to indicate that execution is to pick up where it left off. +.Fa data +provides a signal number to be delivered to the traced process as it +resumes execution, or 0 if no signal is to be sent. +.It Dv PT_KILL +The traced process terminates, as if +.Dv PT_CONTINUE +had been used with +.Dv SIGKILL +given as the signal to be delivered. +.El +.Sh ERRORS +Some requests can cause +.Fn ptrace +to return +.Li -1 +as a non-error value; to disambiguate, +.Va errno +can be set to 0 before the call and checked afterwards. The possible +errors are: +.Bl -tag -width 4n +.It Bq Er ESRCH +.Bl -bullet -compact +.It +No process having the specified process ID exists. +.El +.It Bq Er EINVAL +.Bl -bullet -compact +.It +The +.Fa request +was not one of the legal requests. +.It +The +.Fa addr +to +.Dv PT_READ_U +or +.Dv PT_WRITE_U +was not +.Li int Ns \&-aligned. +.It +The signal number (in +.Fa data ) +to +.Dv PT_CONTINUE +was neither 0 nor a legal signal number. +.El +.It Bq Er EPERM +.Bl -bullet -compact +.It +A request +attempted to manipulate a process that wasn't being traced at all. +.El +.Sh SEE ALSO +.Xr sigaction 2 +.Xr wait 2 +.Xr execve 2 +.Xr execv 3 diff --git a/release/doFS.sh b/release/doFS.sh new file mode 100644 index 000000000000..4d58e4611cf4 --- /dev/null +++ b/release/doFS.sh @@ -0,0 +1,106 @@ +: +#set -ex + +VNDEVICE=vn0 +export BLOCKSIZE=512 + +RD=$1 ; shift +MNT=$1 ; shift +FSSIZE=$1 ; shift +FSPROTO=$1 ; shift +FSINODE=$1 ; shift +FSLABEL=$1 ; shift + +deadlock=20 + +while true +do + rm -f fs-image + + if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then + ( cd /dev && sh MAKEDEV ${VNDEVICE} ) + fi + + umount /dev/${VNDEVICE} 2>/dev/null || true + + umount ${MNT} 2>/dev/null || true + + vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true + + dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null + # this suppresses the `invalid primary partition table: no magic' + awk 'BEGIN {printf "%c%c", 85, 170}' |\ + dd of=fs-image obs=1 seek=510 conv=notrunc 2>/dev/null + + vnconfig -s labels -c /dev/r${VNDEVICE} fs-image + + sed '/^minimum:/,$d' /etc/disktab > /etc/disktab.tmp + cat /etc/disktab.tmp > /etc/disktab + rm -f /etc/disktab.tmp + ( + a=`expr ${FSSIZE} \* 2` + echo + echo "minimum:ty=mfs:se#512:nt#1:rm#300:\\" + echo " :ns#$a:nc#1:\\" + echo " :pa#$a:oa#0:ba#4096:fa#512:\\" + echo " :pc#$a:oc#0:bc#4096:fc#512:" + echo + ) >> /etc/disktab + + disklabel -w -r -B \ + -b ${RD}/trees/bin/usr/mdec/fdboot \ + -s ${RD}/trees/bin/usr/mdec/bootfd \ + /dev/r${VNDEVICE} minimum + + newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum /dev/r${VNDEVICE}a + + mount /dev/${VNDEVICE}a ${MNT} + + ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) + + set `df -i /mnt | tail -1` + + umount ${MNT} + + fsck -p /dev/r${VNDEVICE}a < /dev/null + + vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true + + if [ $FSLABEL != "minimum" ] ; then + echo ${FSSIZE} > fs-image.size + break + fi + + echo ">>> Filesystem is ${FSSIZE} K, $4 left" + echo ">>> ${FSINODE} bytes/inode, $7 left" + echo ">>> `expr ${FSSIZE} \* 1024 / ${FSINODE}`" + if [ $4 -gt 128 ] ; then + echo "Reducing size" + FSSIZE=`expr ${FSSIZE} - $4 / 2` + continue + fi + if [ $7 -gt 128 ] ; then + echo "Increasing bytes per inode" + FSINODE=`expr ${FSINODE} + 8192` + continue + fi + if [ $4 -gt 32 ] ; then + echo "Reducing size" + FSSIZE=`expr ${FSSIZE} - 4` + FSINODE=`expr ${FSINODE} - 1024` + continue + fi + if [ $7 -gt 64 ] ; then + echo "Increasing bytes per inode" + FSINODE=`expr ${FSINODE} + 8192` + continue + fi + if [ $deadlock -eq 0 ] ; then + echo "Avoiding deadlock, giving up" + echo ${FSSIZE} > fs-image.size + break + fi + deadlock=`expr $deadlock - 1` + echo ${FSSIZE} > fs-image.size + break; +done diff --git a/release/scripts/commerce-install.sh b/release/scripts/commerce-install.sh new file mode 100755 index 000000000000..e8a8ca71a8a5 --- /dev/null +++ b/release/scripts/commerce-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +tar --unlink -xpzf commerce.tgz -C /usr/local +exit 0 diff --git a/release/scripts/compat1x-install.sh b/release/scripts/compat1x-install.sh new file mode 100755 index 000000000000..036115732329 --- /dev/null +++ b/release/scripts/compat1x-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +tar --unlink -xpzf compat1x.tgz -C / +exit 0 diff --git a/release/scripts/compat20-install.sh b/release/scripts/compat20-install.sh new file mode 100755 index 000000000000..9c84c14dc989 --- /dev/null +++ b/release/scripts/compat20-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +tar --unlink -xpzf compat20.tgz -C / +exit 0 diff --git a/release/scripts/des-install.sh b/release/scripts/des-install.sh new file mode 100755 index 000000000000..548f83a49ffd --- /dev/null +++ b/release/scripts/des-install.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +echo "You are about to extract the DES distribution into / - are you SURE" +echo "you want to do this over your installed system? If not, hit ^C now!" +read junk +cat des.?? | tar --unlink -xpzf - -C / +cat krb.?? | tar --unlink -xpzf - -C / +echo -n "Do you want to install the DES sources (y/n)? " +read ans +if [ "$ans" = "y" ]; then + cat sebones.?? | tar --unlink -xpzf - -C /usr/src + cat ssecure.?? | tar --unlink -xpzf - -C /usr/src +fi +exit 0 diff --git a/release/scripts/dict-install.sh b/release/scripts/dict-install.sh new file mode 100755 index 000000000000..e86c744cc264 --- /dev/null +++ b/release/scripts/dict-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +cat dict.?? | tar --unlink -xpzf - -C / +exit 0 diff --git a/release/scripts/games-install.sh b/release/scripts/games-install.sh new file mode 100755 index 000000000000..1b907b2af2f0 --- /dev/null +++ b/release/scripts/games-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +cat games.?? | tar --unlink -xpzf - -C / +exit 0 diff --git a/release/scripts/info-install.sh b/release/scripts/info-install.sh new file mode 100755 index 000000000000..7248df6a01e2 --- /dev/null +++ b/release/scripts/info-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +cat info.?? | tar --unlink -xpzf - -C / +exit 0 diff --git a/release/scripts/manpages-install.sh b/release/scripts/manpages-install.sh new file mode 100755 index 000000000000..6ba009240784 --- /dev/null +++ b/release/scripts/manpages-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +cat manpages.?? | tar --unlink -xpzf - -C / +exit 0 diff --git a/release/scripts/proflibs-install.sh b/release/scripts/proflibs-install.sh new file mode 100755 index 000000000000..afcd5c506824 --- /dev/null +++ b/release/scripts/proflibs-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +cat proflibs.?? | tar --unlink -xpzf - -C / +exit 0 diff --git a/release/scripts/src-install.sh b/release/scripts/src-install.sh new file mode 100755 index 000000000000..3c0c3d87c029 --- /dev/null +++ b/release/scripts/src-install.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +if [ $# -lt 1 ]; then + echo "You must specify which components of src to extract" + echo "possible subcomponents are:" + echo + echo "base bin etc games gnu include lib libexec lkm release" + echo "sbin share smailcf sys ubin usbin" + echo + exit 1 +fi + +for i in $*; do + echo "Extracting source component: $i" + cat s${i}.?? | tar --unlink -xpzf - -C /usr/src +done +exit 0 diff --git a/release/scripts/xperimnt-install.sh b/release/scripts/xperimnt-install.sh new file mode 100755 index 000000000000..e998c0f5ce60 --- /dev/null +++ b/release/scripts/xperimnt-install.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +if [ "`id -u`" != "0" ]; then + echo "Sorry, this must be done as root." + exit 1 +fi +tar --unlink -xpzf xperimnt.tgz -C /usr/local +exit 0 diff --git a/sbin/rdisc/Makefile b/sbin/rdisc/Makefile new file mode 100644 index 000000000000..a3cf0314dd64 --- /dev/null +++ b/sbin/rdisc/Makefile @@ -0,0 +1,8 @@ +# @(#)Makefile 8.1 (Berkeley) 6/5/93 + +PROG= rdisc +MAN8= rdisc.8 +BINOWN= root +BINMODE=555 + +.include <bsd.prog.mk> diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c new file mode 100644 index 000000000000..1c41cdf0b50a --- /dev/null +++ b/sys/pci/if_fxp.c @@ -0,0 +1,1147 @@ +/* + * Copyright (c) 1995, David Greenman + * 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 unmodified, 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 David Greenman. + * 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 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. + * + * $Id: if_fxp.c,v 1.7 1996/01/03 05:22:32 davidg Exp $ + */ + +/* + * Intel EtherExpress Pro/100B PCI Fast Ethernet driver + */ + +#include "bpfilter.h" + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/ioctl.h> +#include <sys/mbuf.h> +#include <sys/malloc.h> +#include <sys/kernel.h> +#include <sys/devconf.h> +#include <sys/syslog.h> + +#include <net/if.h> +#include <net/if_dl.h> +#include <net/if_types.h> + +#ifdef INET +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/in_var.h> +#include <netinet/ip.h> +#include <netinet/if_ether.h> +#endif + +#ifdef IPX +#include <netipx/ipx.h> +#include <netipx/ipx_if.h> +#endif + +#ifdef NS +#include <netns/ns.h> +#include <netns/ns_if.h> +#endif + +#if NBPFILTER > 0 +#include <net/bpf.h> +#include <net/bpfdesc.h> +#endif + +#include <vm/vm.h> /* for vtophys */ +#include <vm/vm_param.h> /* for vtophys */ +#include <vm/pmap.h> /* for vtophys */ +#include <machine/clock.h> /* for DELAY */ + +#include <pci/pcivar.h> +#include <pci/if_fxpreg.h> + +struct fxp_softc { + struct arpcom arpcom; /* per-interface network data */ + caddr_t bpf; /* BPF token */ + struct fxp_csr *csr; /* control/status registers */ + struct fxp_cb_tx *cbl_base; /* base of TxCB list */ + struct fxp_cb_tx *cbl_first; /* first active TxCB in list */ + struct fxp_cb_tx *cbl_last; /* last active TxCB in list */ + struct mbuf *rfa_headm; /* first mbuf in receive frame area */ + struct mbuf *rfa_tailm; /* last mbuf in receive frame area */ + struct fxp_stats *fxp_stats; /* Pointer to interface stats */ + int tx_queued; /* # of active TxCB's */ + int promisc_mode; /* promiscuous mode enabled */ +}; + +#include "fxp.h" +static struct fxp_softc *fxp_sc[NFXP]; /* XXX Yuck */ + +static u_long fxp_count; + +/* + * Template for default configuration parameters. + * See struct fxp_cb_config for the bit definitions. + */ +static u_char fxp_cb_config_template[] = { + 0x0, 0x0, /* cb_status */ + 0x80, 0x2, /* cb_command */ + 0xff, 0xff, 0xff, 0xff, /* link_addr */ + 0x16, /* 0 */ + 0x8, /* 1 */ + 0x0, /* 2 */ + 0x0, /* 3 */ + 0x0, /* 4 */ + 0x80, /* 5 */ + 0xb2, /* 6 */ + 0x3, /* 7 */ + 0x1, /* 8 */ + 0x0, /* 9 */ + 0x26, /* 10 */ + 0x0, /* 11 */ + 0x60, /* 12 */ + 0x0, /* 13 */ + 0xf2, /* 14 */ + 0x48, /* 15 */ + 0x0, /* 16 */ + 0x40, /* 17 */ + 0xf3, /* 18 */ + 0x0, /* 19 */ + 0x3f, /* 20 */ + 0x5, /* 21 */ + 0x0, 0x0 +}; + +static inline int fxp_scb_wait __P((struct fxp_csr *)); +static char *fxp_probe __P((pcici_t, pcidi_t)); +static void fxp_attach __P((pcici_t, int)); +static int fxp_shutdown __P((struct kern_devconf *, int)); +static int fxp_intr __P((void *)); +static void fxp_start __P((struct ifnet *)); +static int fxp_ioctl __P((struct ifnet *, int, caddr_t)); +static void fxp_init __P((struct ifnet *)); +static void fxp_stop __P((struct fxp_softc *)); +static void fxp_watchdog __P((struct ifnet *)); +static void fxp_get_macaddr __P((struct fxp_softc *)); +static int fxp_add_rfabuf __P((struct fxp_softc *, struct mbuf *)); + +timeout_t fxp_stats_update; + +static struct pci_device fxp_device = { + "fxp", + fxp_probe, + fxp_attach, + &fxp_count, + fxp_shutdown +}; +DATA_SET(pcidevice_set, fxp_device); + +/* + * Number of transmit control blocks. This determines the number + * of transmit buffers that can be chained in the CB list. + * This must be a power of two. + */ +#define FXP_NTXCB 64 + +/* + * TxCB list index mask. This is used to do list wrap-around. + */ +#define FXP_TXCB_MASK (FXP_NTXCB - 1) + +/* + * Number of DMA segments in a TxCB. Note that this is carefully + * chosen to make the total struct size an even power of two. It's + * critical that no TxCB be split across a page boundry since + * no attempt is made to allocate physically contiguous memory. + * + * XXX - don't forget to change the hard-coded constant in the + * fxp_cb_tx struct (defined in if_fxpreg.h), too! + */ +#define FXP_NTXSEG 29 + +/* + * Number of receive frame area buffers. These are large so chose + * wisely. + */ +#define FXP_NRFABUFS 32 + +/* + * Wait for the previous command to be accepted (but not necessarily + * completed). + */ +static inline int +fxp_scb_wait(csr) + struct fxp_csr *csr; +{ + int i = 10000; + + while ((csr->scb_command & FXP_SCB_COMMAND_MASK) && --i); + return (i); +} + +/* + * Return identification string if this is device is ours. + */ +static char * +fxp_probe(config_id, device_id) + pcici_t config_id; + pcidi_t device_id; +{ + if (((device_id & 0xffff) == FXP_VENDORID_INTEL) && + ((device_id >> 16) & 0xffff) == FXP_DEVICEID_i82557) + return ("Intel EtherExpress Pro/100B Fast Ethernet"); + + return NULL; +} + +/* + * Allocate data structures and attach the device. + */ +static void +fxp_attach(config_id, unit) + pcici_t config_id; + int unit; +{ + struct fxp_softc *sc; + struct ifnet *ifp; + vm_offset_t pbase; + int s, i; + + sc = malloc(sizeof(struct fxp_softc), M_DEVBUF, M_NOWAIT); + if (sc == NULL) + return; + bzero(sc, sizeof(struct fxp_softc)); + + s = splimp(); + + /* + * Map control/status registers. + */ + if (!pci_map_mem(config_id, FXP_PCI_MMBA, + (vm_offset_t *)&sc->csr, &pbase)) { + printf("fxp%d: couldn't map memory\n", unit); + goto fail; + } + + /* + * Issue a software reset. + */ + sc->csr->port = 0; + DELAY(10); + + /* + * Allocate our interrupt. + */ + if (!pci_map_int(config_id, fxp_intr, sc, &net_imask)) { + printf("fxp%d: couldn't map interrupt\n", unit); + goto fail; + } + + sc->cbl_base = malloc(sizeof(struct fxp_cb_tx) * FXP_NTXCB, + M_DEVBUF, M_NOWAIT); + if (sc->cbl_base == NULL) + goto malloc_fail; + + sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF, M_NOWAIT); + if (sc->fxp_stats == NULL) + goto malloc_fail; + bzero(sc->fxp_stats, sizeof(struct fxp_stats)); + + /* + * Pre-allocate our receive buffers. + */ + for (i = 0; i < FXP_NRFABUFS; i++) { + if (fxp_add_rfabuf(sc, NULL) != 0) { + goto malloc_fail; + } + } + + fxp_sc[unit] = sc; + + ifp = &sc->arpcom.ac_if; + ifp->if_unit = unit; + ifp->if_name = "fxp"; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = fxp_ioctl; + ifp->if_output = ether_output; + ifp->if_start = fxp_start; + ifp->if_watchdog = fxp_watchdog; + + fxp_get_macaddr(sc); + printf("fxp%d: Ethernet address %s\n", unit, + ether_sprintf(sc->arpcom.ac_enaddr)); + + /* + * Attach the interface. + */ + if_attach(ifp); +#if NBPFILTER > 0 + bpfattach(&sc->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); +#endif + splx(s); + return; + +malloc_fail: + printf("fxp%d: Failed to malloc memory\n", unit); + (void) pci_unmap_int(config_id); + if (sc && sc->cbl_base) + free(sc->cbl_base, M_DEVBUF); + if (sc && sc->fxp_stats) + free(sc->fxp_stats, M_DEVBUF); + /* frees entire chain */ + if (sc && sc->rfa_headm) + m_freem(sc->rfa_headm); +fail: + if (sc) + free(sc, M_DEVBUF); + splx(s); +} + +/* + * Read station (MAC) address from serial EEPROM. Basically, you + * manually shift in the read opcode (one bit at a time) and then + * shift in the address, and then you shift out the data (all of + * this one bit at a time). The word size is 16 bits, so you have + * to provide the address for every 16 bits of data. The MAC address + * is in the first 3 words (6 bytes total). + */ +static void +fxp_get_macaddr(sc) + struct fxp_softc *sc; +{ + struct fxp_csr *csr; + u_short reg, *data; + int i, x; + + csr = sc->csr; + data = (u_short *)sc->arpcom.ac_enaddr; + + for (i = 0; i < 3; i++) { + csr->eeprom_control = FXP_EEPROM_EECS; + /* + * Shift in read opcode. + */ + for (x = 3; x > 0; x--) { + if (FXP_EEPROM_OPC_READ & (1 << (x - 1))) { + reg = FXP_EEPROM_EECS | FXP_EEPROM_EEDI; + } else { + reg = FXP_EEPROM_EECS; + } + csr->eeprom_control = reg; + csr->eeprom_control = reg | FXP_EEPROM_EESK; + DELAY(1); + csr->eeprom_control = reg; + DELAY(1); + } + /* + * Shift in address. + */ + for (x = 6; x > 0; x--) { + if (i & (1 << (x - 1))) { + reg = FXP_EEPROM_EECS | FXP_EEPROM_EEDI; + } else { + reg = FXP_EEPROM_EECS; + } + csr->eeprom_control = reg; + csr->eeprom_control = reg | FXP_EEPROM_EESK; + DELAY(1); + csr->eeprom_control = reg; + DELAY(1); + } + reg = FXP_EEPROM_EECS; + data[i] = 0; + /* + * Shift out data. + */ + for (x = 16; x > 0; x--) { + csr->eeprom_control = reg | FXP_EEPROM_EESK; + DELAY(1); + if (csr->eeprom_control & FXP_EEPROM_EEDO) + data[i] |= (1 << (x - 1)); + csr->eeprom_control = reg; + DELAY(1); + } + csr->eeprom_control = 0; + DELAY(1); + } +} + +/* + * Device shutdown routine. Usually called at system shutdown. The + * main purpose of this routine is to shut off receiver DMA so that + * kernel memory doesn't get clobbered during warmboot. + */ +static int +fxp_shutdown(kdc, force) + struct kern_devconf *kdc; + int force; +{ + struct fxp_softc *sc = fxp_sc[kdc->kdc_unit]; + + fxp_stop(sc); + + (void) dev_detach(kdc); + return 0; +} + +/* + * Start packet transmission on the interface. + */ +static void +fxp_start(ifp) + struct ifnet *ifp; +{ + struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct fxp_csr *csr = sc->csr; + struct fxp_cb_tx *txp; + struct mbuf *m, *mb_head; + int segment; + +txloop: + /* + * See if a TxCB is available. If not, indicate this to the + * outside world and exit. + */ + if (sc->tx_queued >= FXP_NTXCB) { + ifp->if_flags |= IFF_OACTIVE; + return; + } + /* + * Grab a packet to transmit. + */ + IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, mb_head); + if (mb_head == NULL) { + /* + * No more packets to send. + */ + return; + } + + /* + * Get pointer to next available (unused) descriptor. + */ + txp = sc->cbl_last->next; + + /* + * Go through each of the mbufs in the chain and initialize + * the transmit buffers descriptors with the physical address + * and size of the mbuf. + */ +tbdinit: + for (m = mb_head, segment = 0; m != NULL; m = m->m_next) { + if (m->m_len != 0) { + if (segment == FXP_NTXSEG) + break; + txp->tbd[segment].tb_addr = + vtophys(mtod(m, vm_offset_t)); + txp->tbd[segment].tb_size = m->m_len; + segment++; + } + } + if (m != NULL && segment == FXP_NTXSEG) { + struct mbuf *mn; + + /* + * We ran out of segments. We have to recopy this mbuf + * chain first. + */ + MGETHDR(mn, M_DONTWAIT, MT_DATA); + if (mn == NULL) { + m_freem(mb_head); + return; + } + if (mb_head->m_pkthdr.len > MHLEN) { + MCLGET(mn, M_DONTWAIT); + if ((mn->m_flags & M_EXT) == 0) { + m_freem(mn); + m_freem(mb_head); + return; + } + } + m_copydata(mb_head, 0, mb_head->m_pkthdr.len, mtod(mn, caddr_t)); + mn->m_pkthdr.len = mn->m_len = mb_head->m_pkthdr.len; + m_freem(mb_head); + mb_head = mn; + goto tbdinit; + } + + txp->tbd_number = segment; + + /* + * Finish the initialization of this TxCB. + */ + txp->cb_status = 0; + txp->cb_command = + FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S; + txp->tx_threshold = 16; /* bytes*8 */ + txp->mb_head = mb_head; + + /* + * Advance the end-of-list forward. + */ + sc->cbl_last->cb_command &= ~FXP_CB_COMMAND_S; + sc->cbl_last = txp; + + /* + * If no packets were previously queued then advance the first + * pointer to this TxCB. + */ + if (sc->tx_queued++ == 0) { + sc->cbl_first = txp; + } + + if (!fxp_scb_wait(csr)) { + /* + * Hmmm, card has gone out to lunch + */ + fxp_init(ifp); + goto txloop; + } + + /* + * Resume transmission if suspended. + */ + csr->scb_command = FXP_SCB_COMMAND_CU_RESUME; + +#if NBPFILTER > 0 + /* + * Pass packet to bpf if there is a listener. + */ + if (sc->bpf != NULL) + bpf_mtap(sc->bpf, mb_head); +#endif + /* + * Set a 5 second timer just in case we don't hear from the + * card again. + */ + ifp->if_timer = 5; + + goto txloop; +} + +/* + * Process interface interrupts. Returns 1 if the interrupt + * was handled, 0 if it wasn't. + */ +static int +fxp_intr(arg) + void *arg; +{ + struct fxp_softc *sc = arg; + struct fxp_csr *csr = sc->csr; + struct ifnet *ifp = &sc->arpcom.ac_if; + int found = 0; + u_char statack; + + while ((statack = csr->scb_statack) != 0) { + found = 1; + /* + * First ACK all the interrupts in this pass. + */ + csr->scb_statack = statack; + + /* + * Free any finished transmit mbuf chains. + */ + if (statack & FXP_SCB_STATACK_CNA) { + struct fxp_cb_tx *txp; + + for (txp = sc->cbl_first; + (txp->cb_status & FXP_CB_STATUS_C) && + txp->mb_head != NULL; + txp = txp->next) { + m_freem(txp->mb_head); + txp->mb_head = NULL; + sc->tx_queued--; + } + sc->cbl_first = txp; + /* + * We unconditionally clear IFF_OACTIVE since it + * doesn't hurt to do so even if the tx queue is + * still full - it will just get set again in + * fxp_start(). If we get a CNA interrupt, it is + * (almost?) certain that we've freed up space for + * at least one more packet. + */ + ifp->if_flags &= ~IFF_OACTIVE; + /* + * Clear watchdog timer. It may or may not be set + * again in fxp_start(). + */ + ifp->if_timer = 0; + fxp_start(ifp); + } + /* + * Process receiver interrupts. If a no-resource (RNR) + * condition exists, get whatever packets we can and + * re-start the receiver. + */ + if (statack & (FXP_SCB_STATACK_FR | FXP_SCB_STATACK_RNR)) { + struct mbuf *m; + struct fxp_rfa *rfa; +rcvloop: + m = sc->rfa_headm; + rfa = (struct fxp_rfa *)m->m_ext.ext_buf; + + if (rfa->rfa_status & FXP_RFA_STATUS_C) { + /* + * Remove first packet from the chain. + */ + sc->rfa_headm = m->m_next; + m->m_next = NULL; + + /* + * Add a new buffer to the receive chain. If this + * fails, the old buffer is recycled instead. + */ + if (fxp_add_rfabuf(sc, m) == 0) { + struct ether_header *eh; + u_short total_len; + + total_len = rfa->actual_size & (MCLBYTES - 1); + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = total_len - + sizeof(struct ether_header); + eh = mtod(m, struct ether_header *); +#if NBPFILTER > 0 + if (sc->bpf != NULL) { + bpf_tap(sc->bpf, mtod(m, caddr_t), total_len); + /* + * Only pass this packet up if it is for us. + */ + if ((ifp->if_flags & IFF_PROMISC) && + (rfa->rfa_status & FXP_RFA_STATUS_IAMATCH) && + (eh->ether_dhost[0] & 1) == 0) { + m_freem(m); + goto rcvloop; + } + } +#endif + m->m_data += sizeof(struct ether_header); + ether_input(ifp, eh, m); + } + goto rcvloop; + } + if (statack & FXP_SCB_STATACK_RNR) { + struct fxp_csr *csr = sc->csr; + + (void) fxp_scb_wait(csr); + csr->scb_general = vtophys(sc->rfa_headm->m_ext.ext_buf); + csr->scb_command = FXP_SCB_COMMAND_RU_START; + } + } + } + + return found; +} + +/* + * Update packet in/out/collision statistics. The i82557 doesn't + * allow you to access these counters without doing a fairly + * expensive DMA to get _all_ of the statistics it maintains, so + * we do this operation here only once per second. The statistics + * counters in the kernel are updated from the previous dump-stats + * DMA and then a new dump-stats DMA is started. The on-chip + * counters are zeroed when the DMA completes. If we can't start + * the DMA immediately, we don't wait - we just prepare to read + * them again next time. + */ +void +fxp_stats_update(arg) + void *arg; +{ + struct fxp_softc *sc = arg; + struct ifnet *ifp = &sc->arpcom.ac_if; + struct fxp_stats *sp = sc->fxp_stats; + + ifp->if_opackets += sp->tx_good; + ifp->if_collisions += sp->tx_total_collisions; + ifp->if_ipackets += sp->rx_good; + ifp->if_ierrors += + sp->rx_crc_errors + + sp->rx_alignment_errors + + sp->rx_rnr_errors + + sp->rx_overrun_errors + + sp->rx_shortframes; + /* + * If there is no pending command, start another stats + * dump. Otherwise punt for now. + */ + if ((sc->csr->scb_command & FXP_SCB_COMMAND_MASK) == 0) { + /* + * Start another stats dump. By waiting for it to be + * accepted, we avoid having to do splhigh locking when + * writing scb_command in other parts of the driver. + */ + sc->csr->scb_command = FXP_SCB_COMMAND_CU_DUMPRESET; + (void) fxp_scb_wait(sc->csr); + } else { + /* + * A previous command is still waiting to be accepted. + * Just zero our copy of the stats and wait for the + * next timer event to update them. + */ + sp->tx_good = 0; + sp->tx_total_collisions = 0; + + sp->rx_good = 0; + sp->rx_crc_errors = 0; + sp->rx_alignment_errors = 0; + sp->rx_rnr_errors = 0; + sp->rx_overrun_errors = 0; + sp->rx_shortframes = 0;; + } + /* + * Schedule another timeout one second from now. + */ + timeout(fxp_stats_update, sc, hz); +} + +/* + * Stop the interface. Cancels the statistics updater and resets + * the interface. + */ +static void +fxp_stop(sc) + struct fxp_softc *sc; +{ + struct ifnet *ifp = &sc->arpcom.ac_if; + struct fxp_cb_tx *txp; + int i; + + /* + * Cancel stats updater. + */ + untimeout(fxp_stats_update, sc); + + /* + * Issue software reset + */ + sc->csr->port = 0; + DELAY(10); + + /* + * Release any xmit buffers. + */ + for (txp = sc->cbl_first; txp != NULL && txp->mb_head != NULL; + txp = txp->next) { + m_freem(txp->mb_head); + txp->mb_head = NULL; + } + sc->tx_queued = 0; + + /* + * Free all the receive buffers then reallocate/reinitialize + */ + if (sc->rfa_headm != NULL) + m_freem(sc->rfa_headm); + sc->rfa_headm = NULL; + sc->rfa_tailm = NULL; + for (i = 0; i < FXP_NRFABUFS; i++) { + if (fxp_add_rfabuf(sc, NULL) != 0) { + /* + * This "can't happen" - we're at splimp() + * and we just freed all the buffers we need + * above. + */ + panic("fxp_stop: no buffers!"); + } + } + + ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_timer = 0; +} + +/* + * Watchdog/transmission transmit timeout handler. Called when a + * transmission is started on the interface, but no interrupt is + * received before the timeout. This usually indicates that the + * card has wedged for some reason. + */ +static void +fxp_watchdog(ifp) + struct ifnet *ifp; +{ + log(LOG_ERR, "fxp%d: device timeout\n", ifp->if_unit); + ifp->if_oerrors++; + + fxp_init(ifp); +} + +static void +fxp_init(ifp) + struct ifnet *ifp; +{ + struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct fxp_cb_config *cbp; + struct fxp_cb_ias *cb_ias; + struct fxp_cb_tx *txp; + struct fxp_csr *csr = sc->csr; + int i, s, mcast, prm; + + s = splimp(); + /* + * Cancel any pending I/O + */ + fxp_stop(sc); + + prm = (ifp->if_flags & IFF_PROMISC) ? 1 : 0; + sc->promisc_mode = prm; + /* + * Sleeze out here and enable reception of all multicasts if + * multicasts are enabled. Ideally, we'd program the multicast + * address filter to only accept specific multicasts. + */ + mcast = (ifp->if_flags & (IFF_MULTICAST|IFF_ALLMULTI)) ? 1 : 0; + + /* + * Initialize base of CBL and RFA memory. Loading with zero + * sets it up for regular linear addressing. + */ + csr->scb_general = 0; + csr->scb_command = FXP_SCB_COMMAND_CU_BASE; + + (void) fxp_scb_wait(csr); + csr->scb_command = FXP_SCB_COMMAND_RU_BASE; + + /* + * Initialize base of dump-stats buffer. + */ + (void) fxp_scb_wait(csr); + csr->scb_general = vtophys(sc->fxp_stats); + csr->scb_command = FXP_SCB_COMMAND_CU_DUMP_ADR; + + /* + * We temporarily use memory that contains the TxCB list to + * construct the config CB. The TxCB list memory is rebuilt + * later. + */ + cbp = (struct fxp_cb_config *) sc->cbl_base; + + /* + * This bcopy is kind of disgusting, but there are a bunch of must be + * zero and must be one bits in this structure and this is the easiest + * way to initialize them all to proper values. + */ + bcopy(fxp_cb_config_template, cbp, sizeof(struct fxp_cb_config)); + + cbp->cb_status = 0; + cbp->cb_command = FXP_CB_COMMAND_CONFIG | FXP_CB_COMMAND_EL; + cbp->link_addr = -1; /* (no) next command */ + cbp->byte_count = 22; /* (22) bytes to config */ + cbp->rx_fifo_limit = 8; /* rx fifo threshold */ + cbp->tx_fifo_limit = 0; /* tx fifo threshold */ + cbp->adaptive_ifs = 0; /* (no) adaptive interframe spacing */ + cbp->rx_dma_bytecount = 0; /* (no) rx DMA max */ + cbp->tx_dma_bytecount = 0; /* (no) tx DMA max */ + cbp->dma_bce = 1; /* (enable) dma max counters */ + cbp->late_scb = 0; /* (don't) defer SCB update */ + cbp->tno_int = 0; /* (disable) tx not okay interrupt */ + cbp->ci_int = 0; /* (do) interrupt on CU not active */ + cbp->save_bf = prm; /* save bad frames */ + cbp->disc_short_rx = !prm; /* discard short packets */ + cbp->underrun_retry = 1; /* retry mode (1) on DMA underrun */ + cbp->mediatype = 1; /* (MII) interface mode */ + cbp->nsai = 1; /* (don't) disable source addr insert */ + cbp->preamble_length = 2; /* (7 byte) preamble */ + cbp->loopback = 0; /* (don't) loopback */ + cbp->linear_priority = 0; /* (normal CSMA/CD operation) */ + cbp->linear_pri_mode = 0; /* (wait after xmit only) */ + cbp->interfrm_spacing = 6; /* (96 bits of) interframe spacing */ + cbp->promiscuous = prm; /* promiscuous mode */ + cbp->bcast_disable = 0; /* (don't) disable broadcasts */ + cbp->crscdt = 0; /* (CRS only) */ + cbp->stripping = !prm; /* truncate rx packet to byte count */ + cbp->padding = 1; /* (do) pad short tx packets */ + cbp->rcv_crc_xfer = 0; /* (don't) xfer CRC to host */ + cbp->force_fdx = 0; /* (don't) force full duplex */ + cbp->fdx_pin_en = 1; /* (enable) FDX# pin */ + cbp->multi_ia = 0; /* (don't) accept multiple IAs */ + cbp->mc_all = mcast; /* accept all multicasts */ + + /* + * Start the config command/DMA. + */ + (void) fxp_scb_wait(csr); + csr->scb_general = vtophys(cbp); + csr->scb_command = FXP_SCB_COMMAND_CU_START; + /* ...and wait for it to complete. */ + while (!(cbp->cb_status & FXP_CB_STATUS_C)); + + /* + * Now initialize the station address. Temporarily use the TxCB + * memory area like we did above for the config CB. + */ + cb_ias = (struct fxp_cb_ias *) sc->cbl_base; + cb_ias->cb_status = 0; + cb_ias->cb_command = FXP_CB_COMMAND_IAS | FXP_CB_COMMAND_EL; + cb_ias->link_addr = -1; + bcopy(sc->arpcom.ac_enaddr, (void *)cb_ias->macaddr, + sizeof(sc->arpcom.ac_enaddr)); + + /* + * Start the IAS (Individual Address Setup) command/DMA. + */ + (void) fxp_scb_wait(csr); + csr->scb_command = FXP_SCB_COMMAND_CU_START; + /* ...and wait for it to complete. */ + while (!(cb_ias->cb_status & FXP_CB_STATUS_C)); + + /* + * Initialize transmit control block (TxCB) list. + */ + + txp = sc->cbl_base; + bzero(txp, sizeof(struct fxp_cb_tx) * FXP_NTXCB); + for (i = 0; i < FXP_NTXCB; i++) { + txp[i].cb_status = FXP_CB_STATUS_C | FXP_CB_STATUS_OK; + txp[i].cb_command = FXP_CB_COMMAND_NOP; + txp[i].link_addr = vtophys(&txp[(i + 1) & FXP_TXCB_MASK]); + txp[i].tbd_array_addr = vtophys(&txp[i].tbd[0]); + txp[i].next = &txp[(i + 1) & FXP_TXCB_MASK]; + } + /* + * Set the stop flag on the first TxCB and start the control + * unit. It will execute the NOP and then suspend. + */ + txp->cb_command = FXP_CB_COMMAND_NOP | FXP_CB_COMMAND_S; + sc->cbl_first = sc->cbl_last = txp; + sc->tx_queued = 0; + + (void) fxp_scb_wait(csr); + csr->scb_command = FXP_SCB_COMMAND_CU_START; + + /* + * Initialize receiver buffer area - RFA. + */ + (void) fxp_scb_wait(csr); + csr->scb_general = vtophys(sc->rfa_headm->m_ext.ext_buf); + csr->scb_command = FXP_SCB_COMMAND_RU_START; + + ifp->if_flags |= IFF_RUNNING; + ifp->if_flags &= ~IFF_OACTIVE; + splx(s); + + /* + * Start stats updater. + */ + timeout(fxp_stats_update, sc, hz); +} + +/* + * Add a buffer to the end of the RFA buffer list. + * Return 0 if successful, 1 for failure. A failure results in + * adding the 'oldm' (if non-NULL) on to the end of the list - + * tossing out it's old contents and recycling it. + * The RFA struct is stuck at the beginning of mbuf cluster and the + * data pointer is fixed up to point just past it. + */ +static int +fxp_add_rfabuf(sc, oldm) + struct fxp_softc *sc; + struct mbuf *oldm; +{ + struct mbuf *m; + struct fxp_rfa *rfa, *p_rfa; + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m != NULL) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_freem(m); + m = oldm; + } + } else { + m = oldm; + } + if (m == NULL) + return 1; + rfa = mtod(m, struct fxp_rfa *); + rfa->rfa_status = 0; + rfa->rfa_control = FXP_RFA_CONTROL_EL; + rfa->link_addr = -1; + rfa->rbd_addr = -1; + rfa->actual_size = 0; + rfa->size = MCLBYTES - sizeof(struct fxp_rfa); + m->m_data += sizeof(struct fxp_rfa); + /* + * If there are other buffers already on the list, attach this + * one to the end by fixing up the tail to point to this one. + */ + if (sc->rfa_headm != NULL) { + p_rfa = (struct fxp_rfa *) sc->rfa_tailm->m_ext.ext_buf; + sc->rfa_tailm->m_next = m; + p_rfa->link_addr = vtophys(rfa); + p_rfa->rfa_control &= ~FXP_RFA_CONTROL_EL; + } else { + sc->rfa_headm = m; + } + sc->rfa_tailm = m; + + return (m == oldm); +} + +static int +fxp_ioctl(ifp, command, data) + struct ifnet *ifp; + int command; + caddr_t data; +{ + struct ifaddr *ifa = (struct ifaddr *) data; + struct fxp_softc *sc = (struct fxp_softc *)ifp; + struct ifreq *ifr = (struct ifreq *) data; + int s, error = 0; + + s = splimp(); + + switch (command) { + + case SIOCSIFADDR: + ifp->if_flags |= IFF_UP; + + switch (ifa->ifa_addr->sa_family) { +#ifdef INET + case AF_INET: + fxp_init(ifp); /* before arpwhohas */ + arp_ifinit((struct arpcom *)ifp, ifa); + break; +#endif +#ifdef IPX + /* + * XXX - This code is probably wrong + */ + case AF_IPX: + { + register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); + + if (ipx_nullhost(*ina)) + ina->x_host = + *(union ipx_host *) (sc->arpcom.ac_enaddr); + else { + bcopy((caddr_t) ina->x_host.c_host, + (caddr_t) sc->arpcom.ac_enaddr, + sizeof(sc->arpcom.ac_enaddr)); + } + + /* + * Set new address + */ + fxp_init(ifp); + break; + } +#endif +#ifdef NS + /* + * XXX - This code is probably wrong + */ + case AF_NS: + { + register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); + + if (ns_nullhost(*ina)) + ina->x_host = + *(union ns_host *) (sc->arpcom.ac_enaddr); + else { + bcopy((caddr_t) ina->x_host.c_host, + (caddr_t) sc->arpcom.ac_enaddr, + sizeof(sc->arpcom.ac_enaddr)); + } + + /* + * Set new address + */ + fxp_init(ifp); + break; + } +#endif + default: + fxp_init(ifp); + break; + } + break; + + case SIOCGIFADDR: + { + struct sockaddr *sa; + + sa = (struct sockaddr *) & ifr->ifr_data; + bcopy((caddr_t) sc->arpcom.ac_enaddr, + (caddr_t) sa->sa_data, sizeof(sc->arpcom.ac_enaddr)); + } + break; + + case SIOCSIFFLAGS: + + /* + * If interface is marked up and not running, then start it. + * If it is marked down and running, stop it. + * XXX If it's up then re-initialize it. This is so flags + * such as IFF_PROMISC are handled. + */ + if (ifp->if_flags & IFF_UP) { + fxp_init(ifp); + } else { + if (ifp->if_flags & IFF_RUNNING) + fxp_stop(sc); + } + break; + + case SIOCADDMULTI: + case SIOCDELMULTI: + /* + * Update out multicast list. + */ + error = (command == SIOCADDMULTI) ? + ether_addmulti(ifr, &sc->arpcom) : + ether_delmulti(ifr, &sc->arpcom); + + if (error == ENETRESET) { + /* + * Multicast list has changed; set the hardware filter + * accordingly. + */ + fxp_init(ifp); + + error = 0; + } + break; + + case SIOCSIFMTU: + /* + * Set the interface MTU. + */ + if (ifr->ifr_mtu > ETHERMTU) { + error = EINVAL; + } else { + ifp->if_mtu = ifr->ifr_mtu; + } + break; + + default: + error = EINVAL; + } + (void) splx(s); + return (error); +} diff --git a/sys/scsi/scsi_worm.h b/sys/scsi/scsi_worm.h new file mode 100644 index 000000000000..b2fa7740ac53 --- /dev/null +++ b/sys/scsi/scsi_worm.h @@ -0,0 +1,93 @@ +#ifndef _SCSI_SCSI_WORM_H +#define _SCSI_SCSI_WORM_H + +#define PAGE_HEADERLEN 2 + +/* + * Opcodes + */ + +#define REZERO_UNIT 0x01 /* re-init; XXX belongs to scsi_all? */ +#define SYNCHRONIZE_CACHE 0x35 /* flush write buffer, close wr chn */ +#define FIRST_WRITEABLE_ADDR 0xe2 /* return first available LBA */ +#define RESERVE_TRACK 0xe4 /* reserve a track for later write */ +#define READ_TRACK_INFORMATION 0xe5 /* get info for a particular track */ +#define WRITE_TRACK 0xe6 /* open the write channel */ +#define LOAD_UNLOAD 0xe7 /* resembles part of START_STOP */ +#define FIXATION 0xe9 /* write leadin/leadout */ + +struct scsi_rezero_unit +{ + u_char op_code; + u_char byte2; + u_char reserved[3]; + u_char control; +}; + +struct scsi_synchronize_cache +{ + u_char op_code; + u_char byte2; + u_char reserved[7]; + u_char control; +}; + +/* struct scsi_first_writeable_address; */ + +struct scsi_reserve_track +{ + u_char op_code; + u_char byte2; + u_char reserved[3]; + u_char reserve_length_3; /* MSB */ + u_char reserve_length_2; + u_char reserve_length_1; + u_char reserve_length_0; /* LSB */ + u_char control; +}; + +/* struct scsi_read_track_information; */ + +struct scsi_write_track +{ + u_char op_code; + u_char byte2; + u_char reserved[3]; + u_char track_number; /* 0 means: use next available */ + u_char mode; +#define WORM_TRACK_MODE_RAW 0x08 +#define WORM_TRACK_MODE_AUDIO 0x04 +#define WORM_TRACK_MODE_MODE1 0x01 /* also audio with preemphasis */ +#define WORM_TRACK_MODE_MODE2 0x02 + u_char transfer_length_1; /* number of blocks to transfer, MSB */ + u_char transfer_length_0; /* LSB */ + u_char control; +#define WORM_TRACK_CONTROL_MIX 0x40 /* mixed mode blocks */ +}; + +struct scsi_load_unload +{ + u_char op_code; + u_char byte2; + u_char reserved[6]; + u_char load; +#define WORM_LOAD_MEDIUM 0x01 + u_char control; +}; + +struct scsi_fixation +{ + u_char op_code; + u_char byte2; + u_char reserved[6]; + u_char action; +#define WORM_FIXATION_ONP 0x08 /* open next program area (new session) */ +#define WORM_TOC_TYPE_AUDIO 0x00 +#define WORM_TOC_TYPE_CDROM 0x01 +#define WORM_TOC_TYPE_CDROM_1 0x02 /* CD-ROM, first track mode 1 (?) */ +#define WORM_TOC_TYPE_CDROM_2 0x03 /* CD-ROM, first track mode 2 */ +#define WORM_TOC_TYPE_CDI 0x04 + u_char control; +}; + +#endif /* _SCSI_SCSI_WORM_H */ diff --git a/sys/sys/wormio.h b/sys/sys/wormio.h new file mode 100644 index 000000000000..38af90a35a35 --- /dev/null +++ b/sys/sys/wormio.h @@ -0,0 +1,62 @@ +/* Shared between kernel & process */ +#ifndef _SYS_WORMIO_H_ +#define _SYS_WORMIO_H_ + +/***************************************************************\ +* Ioctls for the WORM drive * +\***************************************************************/ + +/* + * Quirk select: chose the set of quirk functions to use for this + * device. + */ + +struct wormio_quirk_select +{ + const char *vendor; /* vendor name */ + const char *model; /* model name */ +}; + +#define WORMIOCQUIRKSELECT _IOW('W', 10, struct wormio_quirk_select) + +/* + * Prepare disk-wide parameters. + */ + +struct wormio_prepare_disk +{ + int dummy; /* use dummy writes, laser turned off */ + int speed; /* drive speed selection */ +}; + +#define WORMIOCPREPDISK _IOW('W', 20, struct wormio_prepare_disk) + +/* + * Prepare track-specific parameters. + */ + +struct wormio_prepare_track +{ + int audio; /* audio track (data track if 0) */ + int preemp; /* audio with preemphasis */ +}; + +#define WORMIOCPREPTRACK _IOW('W', 21, struct wormio_prepare_track) + +/* + * Fixation: write leadins and leadouts. Select table-of-contents + * type for this session. If onp is != 0, another session will be + * opened. + */ + +struct wormio_fixation +{ + int toc_type; /* TOC type */ + int onp; /* open next program area */ +}; + +#define WORMIOCFIXATION _IOW('W', 22, struct wormio_fixation) + + +#endif /* _SYS_WORMIO_H_ */ + diff --git a/usr.bin/calendar/calendars/calendar.world b/usr.bin/calendar/calendars/calendar.world new file mode 100644 index 000000000000..641b2b5701bc --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.world @@ -0,0 +1,18 @@ +/* + * World wide calendar files, except national calendars + * + * $Id: calendar.world,v 1.1 1996/01/28 19:12:24 wosch Exp $ + */ + +#ifndef _calendar_world_ +#define _calendar_world_ + +#include <calendar.birthday> +#include <calendar.christian> +#include <calendar.computer> +#include <calendar.history> +#include <calendar.holiday> +#include <calendar.judaic> +#include <calendar.music> + +#endif /* !_calendar_world_ */ diff --git a/usr.bin/file/Magdir/animation b/usr.bin/file/Magdir/animation new file mode 100644 index 000000000000..9d2dc8e69aa2 --- /dev/null +++ b/usr.bin/file/Magdir/animation @@ -0,0 +1,54 @@ + +#------------------------------------------------------------------------------ +# animation: file(1) magic for animation/movie formats +# +# animation formats +# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8) +# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com) + +# MPEG animation format +0 string \000\000\001\263 MPEG file + +# FLI animation format +4 leshort 0xAF11 FLI file +>6 leshort x - %d frames, +>8 leshort x width=%d pixels, +>10 leshort x height=%d pixels, +>12 leshort x depth=%d, +>16 leshort x ticks/frame=%d +# FLC animation format +4 leshort 0xAF12 FLC file +>6 leshort x - %d frames +>8 leshort x width=%d pixels, +>10 leshort x height=%d pixels, +>12 leshort x depth=%d, +>16 leshort x ticks/frame=%d + +# DL animation format +# XXX - collision with most `mips' magic +# +# I couldn't find a real magic number for these, however, this +# -appears- to work. Note that it might catch other files, too, so be +# careful! +# +# Note that title and author appear in the two 20-byte chunks +# at decimal offsets 2 and 22, respectively, but they are XOR'ed with +# 255 (hex FF)! The DL format is really bad. +# +#0 byte 1 DL version 1, medium format (160x100, 4 images/screen) +#>42 byte x - %d screens, +#>43 byte x %d commands +#0 byte 2 DL version 2 +#>1 byte 1 - large format (320x200,1 image/screen), +#>1 byte 2 - medium format (160x100,4 images/screen), +#>1 byte >2 - unknown format, +#>42 byte x %d screens, +#>43 byte x %d commands +# Based on empirical evidence, DL version 3 have several nulls following the +# \003. Most of them start with non-null values at hex offset 0x34 or so. +#0 string \3\0\0\0\0\0\0\0\0\0\0\0 DL version 3 + +# SGI and Apple formats +0 string MOVI Silicon Graphics movie file +4 string moov Apple QuickTime movie file (moov) +4 string mdat Apple QuickTime movie file (mdat) diff --git a/usr.bin/file/Magdir/database b/usr.bin/file/Magdir/database new file mode 100644 index 000000000000..692ce6b31536 --- /dev/null +++ b/usr.bin/file/Magdir/database @@ -0,0 +1,36 @@ + +#------------------------------------------------------------------------------ +# database: file(1) magic for various databases +# +# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) +# +# +# GDBM magic numbers +# Will be maintained as part of the GDBM distribution in the future. +# <downsj@teeny.org> +0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian +0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian +0 string GDBM GNU dbm 2.x database +# +0 belong 0x061561 Berkeley DB Hash file +>4 belong >0 (Version %d, +>8 belong 1234 Little Endian, +>8 belong 4321 Big Endian, +>12 belong x Bucket Size %d, +>16 belong x Directory Size %d, +>20 belong x Segment Size %d, +>24 belong x Segment Shift %d, +>28 belong x Overflow Point %d, +>32 belong x Last Freed %d, +>36 belong x Max Bucket %d, +>40 belong x High Mask 0x%x, +>44 belong x Low Mask 0x%x, +>48 belong x Fill Factor %d, +>52 belong x Number of Keys %d) +# +0 belong 0x053162 Berkeley DB Btree file +>4 belong >0 (Version %d, +>8 belong x Page Size %d, +>12 belong x Free Page %d, +>16 belong x Number of Records %d, +>20 belong x Flags 0x%x) diff --git a/usr.bin/file/Magdir/filesystems b/usr.bin/file/Magdir/filesystems new file mode 100644 index 000000000000..125250d9b6d9 --- /dev/null +++ b/usr.bin/file/Magdir/filesystems @@ -0,0 +1,6 @@ + +#------------------------------------------------------------------------------ +# filesystems: file(1) magic for different filesystems +# +0x438 leshort 0xEF53 Linux/i386 ext2 filesystem +0 string \366\366\366\366 PC formatted floppy with no filesystem diff --git a/usr.bin/file/Magdir/karma b/usr.bin/file/Magdir/karma new file mode 100644 index 000000000000..e256abfd05a1 --- /dev/null +++ b/usr.bin/file/Magdir/karma @@ -0,0 +1,8 @@ + +#------------------------------------------------------------------------------ +# karma: file(1) magic for Karma data files +# +# From <rgooch@atnf.csiro.au> + +0 string KarmaRHD Version Karma Data Structure Version +>16 long x %lu diff --git a/usr.bin/file/Magdir/lisp b/usr.bin/file/Magdir/lisp new file mode 100644 index 000000000000..ac4ba7745dbf --- /dev/null +++ b/usr.bin/file/Magdir/lisp @@ -0,0 +1,10 @@ + +#------------------------------------------------------------------------------ +# lisp: file(1) magic for lisp programs +# +# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) +0 string ;; Lisp/Scheme program text +# Emacs 18 - this is always correct, but not very magical. +0 string \012( byte-compiled Emacs-Lisp program data +# Emacs 19 +0 string ;ELC\023\000\000\000 byte-compiled Emacs-Lisp program data diff --git a/usr.bin/file/Magdir/pdf b/usr.bin/file/Magdir/pdf new file mode 100644 index 000000000000..3cea0de3457f --- /dev/null +++ b/usr.bin/file/Magdir/pdf @@ -0,0 +1,7 @@ + +#------------------------------------------------------------------------------ +# pdf: file(1) magic for Portable Document Format +# + +0 string %PDF- PDF document +>5 string x \b, version %.3s diff --git a/usr.bin/file/Magdir/printer b/usr.bin/file/Magdir/printer new file mode 100644 index 000000000000..2d12bc5e4543 --- /dev/null +++ b/usr.bin/file/Magdir/printer @@ -0,0 +1,55 @@ + +#------------------------------------------------------------------------------ +# printer: file(1) magic for printer-formatted files +# + +# PostScript, updated by Daniel Quinlan (quinlan@yggdrasil.com) +0 string %! PostScript document text +>2 string PS-Adobe- conforming +>>11 string >\0 at level %.3s +>>>15 string EPS - type %s +>>>15 string Query - type %s +>>>15 string ExitServer - type %s +# Some PCs have the annoying habit of adding a ^D as a document separator +0 string \004%! PostScript document text +>3 string PS-Adobe- conforming +>>12 string >\0 at level %.3s +>>>16 string EPS - type %s +>>>16 string Query - type %s +>>>16 string ExitServer - type %s + +# HP Printer Job Language +0 string \033%-12345X@PJL HP Printer Job Language data +>15 string \ ENTER\ LANGUAGE\ = +>31 string PostScript Postscript + +# HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com) +0 string \033E\033 HP PCL printer data +>3 string \&l0A - default page size +>3 string \&l1A - US executive page size +>3 string \&l2A - US letter page size +>3 string \&l3A - US legal page size +>3 string \&l26A - A4 page size +>3 string \&l80A - Monarch envelope size +>3 string \&l81A - No. 10 envelope size +>3 string \&l90A - Intl. DL envelope size +>3 string \&l91A - Intl. C5 envelope size +>3 string \&l100A - Intl. B5 envelope size +>3 string \&l-81A - No. 10 envelope size (landscape) +>3 string \&l-90A - Intl. DL envelope size (landscape) + +# IMAGEN printer-ready files: +0 string @document( Imagen printer +# this only works if "language xxx" is first item in Imagen header. +>10 string language\ impress (imPRESS data) +>10 string language\ daisy (daisywheel text) +>10 string language\ diablo (daisywheel text) +>10 string language\ printer (line printer emulation) +>10 string language\ tektronix (Tektronix 4014 emulation) +# Add any other languages that your Imagen uses - remember +# to keep the word `text' if the file is human-readable. +# [GRR 950115: missing "postscript" or "ultrascript" (whatever it was called)] +# +# Now magic for IMAGEN font files... +0 string Rast RST-format raster font data +>45 string >0 face % diff --git a/usr.bin/file/Magdir/rpm b/usr.bin/file/Magdir/rpm new file mode 100644 index 000000000000..7b89c682cf4c --- /dev/null +++ b/usr.bin/file/Magdir/rpm @@ -0,0 +1,14 @@ +#------------------------------------------------------------------------------ +# +# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com) +# +0 beshort 0xedab +>2 beshort 0xeedb RPM +>>4 byte x v%d +>>6 beshort 0 bin +>>6 beshort 1 src +>>8 beshort 1 i386 +>>8 beshort 2 Alpha +>>8 beshort 3 PowerPC +>>8 beshort 4 Sparc +>>10 string x %s diff --git a/usr.bin/file/Magdir/rtf b/usr.bin/file/Magdir/rtf new file mode 100644 index 000000000000..8e2d4166fa58 --- /dev/null +++ b/usr.bin/file/Magdir/rtf @@ -0,0 +1,12 @@ + +#------------------------------------------------------------------------------ +# rtf: file(1) magic for Rich Text Format (RTF) +# +# Duncan P. Simpson, D.P.Simpson@dcs.warwick.ac.uk +# +0 string {\\rtf Rich Text Format data, +>5 byte x version %c, +>6 string \\ansi ANSI +>6 string \\mac Apple Macintosh +>6 string \\pc IBM PC, code page 437 +>6 string \\pca IBM PS/2, code page 850 diff --git a/usr.bin/file/Magdir/sgi b/usr.bin/file/Magdir/sgi new file mode 100644 index 000000000000..a73cfcf0b3cb --- /dev/null +++ b/usr.bin/file/Magdir/sgi @@ -0,0 +1,165 @@ + +#------------------------------------------------------------------------------ +# sgi: file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.) +# +# all of SGI's *current* machines and OSes run in big-endian mode on the +# MIPS machines, as far as I know. +# +# XXX - what is the blank "-" line? +# +0 belong 0407 old SGI 68020 executable +0 belong 0410 old SGI 68020 pure executable +0 beshort 0x8765 disk quotas file +0 beshort 0x0506 IRIS Showcase file +>2 byte 0x49 - +>3 byte x - version %ld +0 beshort 0x0226 IRIS Showcase template +>2 byte 0x63 - +>3 byte x - version %ld +0 belong 0x5343464d IRIS Showcase file +>4 byte x - version %ld +0 belong 0x5443464d IRIS Showcase template +>4 byte x - version %ld +0 belong 0xdeadbabe IRIX Parallel Arena +>8 belong >0 - version %ld +# +0 beshort 0x0160 MIPSEB COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x0162 MIPSEL COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>23 byte x - version %d +>22 byte x .%ld +# +0 beshort 0x6001 MIPSEB-LE COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %d +>23 byte x .%ld +# +0 beshort 0x6201 MIPSEL-LE COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +# MIPS 2 additions +# +0 beshort 0x0163 MIPSEB MIPS-II COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x0166 MIPSEL MIPS-II COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x6301 MIPSEB-LE MIPS-II COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>23 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x6601 MIPSEL-LE MIPS-II COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>23 byte x - version %ld +>23 byte x .%ld +# +# MIPS 3 additions +# +0 beshort 0x0140 MIPSEB MIPS-III COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x0142 MIPSEL MIPS-III COFF executable +>20 beshort 0407 (impure) +>20 beshort 0410 (swapped) +>20 beshort 0413 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>22 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x4001 MIPSEB-LE MIPS-III COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>23 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x4201 MIPSEL-LE MIPS-III COFF executable +>20 beshort 03401 (impure) +>20 beshort 04001 (swapped) +>20 beshort 05401 (paged) +>8 belong >0 not stripped +>8 belong 0 stripped +>23 byte x - version %ld +>23 byte x .%ld +# +0 beshort 0x180 MIPSEB Ucode +0 beshort 0x182 MIPSEL Ucode +# 32bit core file +0 belong 0xdeadadb0 IRIX core dump +>4 belong 1 of +>16 string >\0 '%s' +# 64bit core file +0 belong 0xdeadad40 IRIX 64-bit core dump +>4 belong 1 of +>16 string >\0 '%s' +# New style crash dump file +0 string \x43\x72\x73\x68\x44\x75\x6d\x70 IRIX vmcore dump of +>36 string >\0 '%s' +# Trusted IRIX info +0 string SGIAUDIT SGI Audit file +>8 byte x - version %d +>9 byte x .%ld +# Are these three SGI-based file types or general ones? +0 string WNGZWZSC Wingz compiled script +0 string WNGZWZSS Wingz spreadsheet +0 string WNGZWZHP Wingz help file +# +0 string \#Inventor V IRIS Inventor file +# XXX - I don't know what next thing is! It is likely to be an image +# (or movie) format +0 string glfHeadMagic(); GLF_TEXT +4 belong 0x41010000 GLF_BINARY_LSB_FIRST +4 belong 0x00000141 GLF_BINARY_MSB_FIRST diff --git a/usr.bin/file/Magdir/timezone b/usr.bin/file/Magdir/timezone new file mode 100644 index 000000000000..e47a3717abd6 --- /dev/null +++ b/usr.bin/file/Magdir/timezone @@ -0,0 +1,12 @@ + +#------------------------------------------------------------------------------ +# timezone: file(1) magic for timezone data +# +# from Daniel Quinlan (quinlan@yggdrasil.com) +# this should work on Linux, SunOS, and maybe others +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0 timezone data diff --git a/usr.bin/file/Magdir/vms b/usr.bin/file/Magdir/vms new file mode 100644 index 000000000000..c91186f68c3e --- /dev/null +++ b/usr.bin/file/Magdir/vms @@ -0,0 +1,27 @@ + +#------------------------------------------------------------------------------ +# vms: file(1) magic for VMS executables (experimental) +# +# VMS .exe formats, both VAX and AXP (Greg Roelofs, newt@uchicago.edu) + +# GRR 950122: I'm just guessing on these, based on inspection of the headers +# of three executables each for Alpha and VAX architectures. The VAX files +# all had headers similar to this: +# +# 00000 b0 00 30 00 44 00 60 00 00 00 00 00 30 32 30 35 ..0.D.`.....0205 +# 00010 01 01 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 ................ +# +0 string \xb0\0\x30\0 VMS VAX executable +>44032 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption +# +# The AXP files all looked like this, except that the byte at offset 0x22 +# was 06 in some of them and 07 in others: +# +# 00000 03 00 00 00 00 00 00 00 ec 02 00 00 10 01 00 00 ................ +# 00010 68 00 00 00 98 00 00 00 b8 00 00 00 00 00 00 00 h............... +# 00020 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +# 00030 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ +# 00040 00 00 00 00 ff ff ff ff ff ff ff ff 02 00 00 00 ................ +# +0 belong 0x03000000 VMS Alpha executable +>75264 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption diff --git a/usr.sbin/mrouted/RELEASE b/usr.sbin/mrouted/RELEASE new file mode 100644 index 000000000000..7dff93789cce --- /dev/null +++ b/usr.sbin/mrouted/RELEASE @@ -0,0 +1,326 @@ +Id: README-3.8.mrouted,v 3.8 1995/11/29 22:23:02 fenner Rel + + IP Multicast Extensions for BSD-Derived Unix Systems + + Release 3.8 + November 29, 1995 + + available from parcftp.xerox.com, + file pub/net-research/ipmulti/mrouted3.8.tar.Z + binaries pub/net-research/ipmulti/mrouted3.8-sparc-sunos41x.tar.Z + pub/net-research/ipmulti/mrouted3.8-sparc-solaris2.tar.Z + pub/net-research/ipmulti/mrouted3.8-i386-bsd.tar.Z + pub/net-research/ipmulti/mrouted3.8-alpha-osf1.tar.Z + pub/net-research/ipmulti/mrouted3.8-sgi-irix.tar.Z + pub/net-research/ipmulti/mrouted3.8-hp-hpux.tar.Z + +Note: The 3.8 release is mrouted-only, and will run on top of a 3.5 kernel. +It is a drop-in replacement for mrouted 3.5, 3.6 or 3.7 . + +The 3.8 release fixes the following bugs: + + o mrouted would fail to forget prunes when a neighbor went away, + thus potentially sending traffic down a tunnel after the tunnel + endpoint has gone down. This was due to some research code making + it into the "emergency" 3.7 release, sigh. + + o mrouted could send prunes with negative lifetimes. This causes + slightly higher prune traffic but shouldn't be any major problem. + +=========== +Release 3.7 +November 28, 1995 + +The 3.7 release fixes the following bugs: + + o mrouted now ignores route reports that include bogus netmasks. + There was a bug in 3.5 that would mangle default routes into + tens of bogus routes; this should prevent that bug from killing + the MBONE. + + This solution can cause route flaps and black holes until the + 3.5's are gone or all of the 3.5's neighbors are 3.7 . + + o mrouted now ignores duplicate routes. Ciscos and the above 3.5 + bug could cause two copies of the same route to appear in a single + routing update; mrouted would insert two copies of the same route + into its routing table and wreak all sorts of havoc. + + o mrouted now sends a group-specific query for both retransmissions + of a g-s query; previous versions sent a general query the second + time. + + o mrouted now loops back multicasted mtrace responses and + group-specific membership queries + + o mrouted now performs deterministic tiebreaking between two + neighbors on the same vif. + + o mrouted now only does duplicate suppression on traceroute requests, + not all traceroute packets, so that a loop can be nicely detected + via a duplicate router instead of just a timeout. + + o the buffer size that mrouted uses has been increased to allow + more than 16 hops in mtrace messages. + + o mtrace's hop-by-hop termination is now more likely to be correct. + + o mrinfo now waits for the responses to its retransmitted queries. + +The 3.7 release has the following new features: + + o The configuration file can accept a hostname as the other end + of a tunnel. There must be a single name->ip mapping for the + given name, however, or mrouted will fail to start up. + + o mrinfo now sends requests to all interfaces of a multihomed host. + + o mtrace's passive mode has been implemented. + + o The first screen of mtrace statistics is shorter and more likely + to fit on one screen. + +=========== +Release 3.6 +June 26, 1995 + +The 3.6 release fixes the following bugs: + + o mrouted would dump core when attempting to report no routes (i.e. upon + startup, if you have no enabled phyint's) + + o mrouted would dump core if requested to traceroute a source for which it + had no route + + o neighbor flags were not always properly updated on probe or report + + o mrouted would sometimes reply to a multicast traceroute on a disabled + phyint; now it uses the first configured phyint to reply to traceroutes. + + o host routes (i.e. netmask 0xffffffff) works now; it was discarding + IGMP from the host because it was coming from the "broadcast address" + of the subnet. + + o send_igmp() now treats the failure to send an mtrace or a neighbor + reply as informational, as opposed to warning. + + o mrouted would go into an infinite loop trying to respond to a traceroute + for a source with a netmask of 0xffffffff. + + o vifs_with_neighbors was not being reset if the mrouted was restarted + with SIGHUP + + o the default route was not being properly advertised to neighbors (although + it was accepted if it was advertised to it) + + o ANSI-fication for those who it helps, still-K&R-ish for those it doesn't. + + o mtrace now attempts to trace three hops past a non-responding router, + in the hopes that it does support traceroute but just couldn't respond + (i.e. unicast didn't work and it can't source multicast because all its + phyints are disabled). + + o mrinfo now times out even on a multicast router. + + +=========== +Release 3.5 +May 8, 1995 + +The 3.5 release has the following new features: + + o The kernel and mrouted make sure that each is the correct version, to + prevent problems with mismatched kernel/mrouted versions. A too-old + mrouted will die with the error: + + can't enable DVMRP routing in kernel: Option not supported by protocol + + o mrouted can accept and propogate a default route (essential for + heirarchical multicast routing) + + o Kernel route cache keeps source-specific routes instead of subnet routes, + eliminating hashing and longest-match problems. + (allows classless routing, longest-match and default routing) + + o Cached kernel routes only get deleted if no traffic is flowing, to + facilitate multicast traceroute + + o mrouted has a new configuration file parser, which provides better error + messages than before, and allows named boundaries (see man page) + + o added "netmask" to phyint configuration, at the suggestion of + Anders Klemets + + o System V and FreeBSD compatibility from John Brezak <brezak@ch.hp.com> + + o phyint's can have additional subnets configured, for people with + multiple subnets on one physical network. mrouted.conf syntax is + altnet 1.2.3.0, or altnet 1.2.3.0/24 if you need to specify + a different netmask. There can be as many altnet statements + as you need. + + o both mrouted and the kernel now support classless addresses. + + o the kernel supports PIM assert processing by notifying the router + when a packet arrives on the wrong interface + + o the kernel keeps additional counters, and mrouted can be compiled to + support SNMP and the Multicast MIB + + o the packet classifier in the kernel now uses the following udp port + ranges: + [0, 16384) - lowest priority, unclassified + [16384, 32768) - highest priority, i.e. audio + [32768, 49152) - medium priority, i.e. whiteboard + [49152, 65536) - low priority, i.e. video + A future release of a session directory will allocate ports in these + ranges. + + o the configuration code has been modified to default tunnels' rate_limit + parameters to 500kbps. This is easily modified with a rate_limit keyword + in mrouted.conf, but should be a good default for the MBONE in general. + + o The tunnel sending code now caches a route for ip_output(), this should + help performance on machines with lots of tunnels. + + o Dispatching for de-capsulating packets is now via protosw[], making + reception of other raw protocols more efficient + + o Neighbor capabilities are discovered via a bitmask as opposed to + version number. + + o Multicast traceroute code improved + + o mrouted can be compiled with Routing Support for Resource Reservation + (RSRR), required for RSVP. + + +The 3.5 release fixes the following bugs: + + o The IGMPv2 query timeout field was interpreted as being in units of + 200ms as opposed to 100ms, thus the maximum timeout was set to twice + the expected value. This is not fatal, as mrouted always queries + twice in the expectation that a packet could get loss, but it does + make it less robust in the face of packet loss. + + o IGMP could report membership in local-only groups (i.e. 224.0.0.X) + + o IGMP could get confused by hearing its own new membership reports, thus + a router would never perform fast leave. + + o IGMP could reset timers for the wrong interface. + + o mrouted put a bogus value in the maximum timeout field of IGMPv2 query + packets. + + o Non-querier mrouters would respond to IGMP leave messages + + o mrouted was not performing fast leave properly + + o If the last member goes away on a transit network, the upstream router + would stop forwarding even if there are downstream members. + + o Kernel hash function improved + + o Eliminated possibility of panic(): timeout in cache maintenance + + o Reordered resource allocation when sending upcall to handle failure properly + + o some endian-ness bugs squashed in mrouted, probably more to go. + + o Multicast traceroute could send a reply on a disabled interface. + + +This release consists of the following files: + + + README-3.8.mrouted - this file + + mrouted/* - version 3.8 of mrouted, + mrinfo, map-mbone and + mtrace. + + ifconfig/* - Changes to ifconfig to + show multicast interfaces + + netstat/* - Diffs to netstat + + ping/* - sources for ping + which support + multicasting + + mtest/* - utility for testing + multicast group + membership + + +MROUTED 3.8 + +Mrouted 3.8 has two optional features: SNMP and RSRR. RSRR support +is required for running RSVP; the SNMP code, with the help of the +ISODE snmpd, implements both the Multicast MIB and the DVMRP MIB. + +RSRR +---- +Routing Support for Resource Reservations (RSRR) was contributed by +Daniel Zappala <daniel@isi.edu>. + +To enable RSRR support, uncomment the three lines starting with +RSRR near the top of the Makefile and "make clean; make". Or use +the prebuilt binary, mrouted.rsrr . + +RSRR allows RSVP to query mrouted for its routing entry for a particular +source-group pair. Using the routing entry and the IP_MULTICAST_VIF +socket call, RSVP can forward distinct control messages out each +outgoing interface. This version of mrouted supports RSRR messages +using a Unix datagram socket. + +RSRR currently includes two pairs of query-reply messages. RSVP sends +an Initial Query when it starts. Mrouted responds with an Initial Reply +that includes the set of vifs it is using, flagging those that are +administratively disabled. When RSVP needs the routing entry for a +source-group pair, it sends a Route Query. Mrouted responds with a +Route Reply that includes the incoming vif and outgoing vifs for the +source-group pair. + +RSVP may request route change notification by setting the notification +bit in the Route Query. If mrouted can provide route change +notification for the source-group pair, it sets the notification bit in +its Route Reply. When the routing entry for the source-group pair +changes, mrouted sends an unsolicited Route Reply containing the new +routing information. The initial release of mrouted 3.5 did not support +route change notification and always returned a Route Reply with the +notification bit cleared. This release of mrouted provides route change +notification when possible. + +SNMP +---- +SNMP support was contributed by David Thaler <thalerd@eecs.umich.edu>. + +To enable SNMP support, uncomment the six lines near the top of +the Makefile below the description of SNMP support, or use the +prebuilt binary, mrouted.snmp or mrouted.rsrr.snmp . + +To link the SNMP-capable mrouted, you need the CMU libraries. +See http://nic.merit.edu/~mbone/ for a full mrouted-snmp distribution. + +Make sure to add the "sysName", "sysContact", "sysVersion" and +"sysLocation" variables to your /etc/mrouted.conf if you want them +to provide anything other than default values. + +Example: + +sysName "tibia" +sysContact "Bill Fenner <fenner@parc.xerox.com> +1 415 812-4816" +sysVersion "SunOS 4.1.3 and mrouted 3.8" +sysLocation "MAXC room, PARC building 35" + +The SNMP version of mrouted has an additional command line flag: + + -P snmp_port + + Specifies a port for SNMP communication (default 161). This option + should be used when another SNMP daemon already exists. The + preferred alternate port in this case is port 9161. + +The mstat(8) program allows querying of statistics using SNMP. diff --git a/usr.sbin/ppp/arp.h b/usr.sbin/ppp/arp.h new file mode 100644 index 000000000000..95c10ba2e4da --- /dev/null +++ b/usr.sbin/ppp/arp.h @@ -0,0 +1,28 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _ARP_H_ +#define _ARP_H_ +extern int cifproxyarp __P((int, u_long)); +extern int sifproxyarp __P((int, u_long)); +#endif diff --git a/usr.sbin/ppp/chat.h b/usr.sbin/ppp/chat.h new file mode 100644 index 000000000000..bdb6dd0765e6 --- /dev/null +++ b/usr.sbin/ppp/chat.h @@ -0,0 +1,29 @@ +/* + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Most of codes are derived from chat.c by Karl Fox (karl@MorningStar.Com). + * + * Chat -- a program for automatic session establishment (i.e. dial + * the phone and log in). + * + * This software is in the public domain. + * + * Please send all bug reports, requests for information, etc. to: + * + * Karl Fox <karl@MorningStar.Com> + * Morning Star Technologies, Inc. + * 1760 Zollinger Road + * Columbus, OH 43221 + * (614)451-1883 + * + * $Id: chat.c,v 1.5 1995/09/02 17:20:50 amurai Exp $ + * + */ +#ifndef _CHAT_H_ +#define _CHAT_H_ +#include "cdefs.h" +extern char * ExpandString __P((char *, char *, int)); +extern int MakeArgs __P((char *, char **)); +#endif diff --git a/usr.sbin/ppp/ip.h b/usr.sbin/ppp/ip.h new file mode 100644 index 000000000000..fcc461d469d2 --- /dev/null +++ b/usr.sbin/ppp/ip.h @@ -0,0 +1,29 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _IP_H_ +#define _IP_H_ +extern void IpStartOutput __P((void)); +extern int PacketCheck __P((char *, int , int)); +extern void IpEnqueue __P((int, char *, int)); +#endif diff --git a/usr.sbin/ppp/main.h b/usr.sbin/ppp/main.h new file mode 100644 index 000000000000..1f578821ea96 --- /dev/null +++ b/usr.sbin/ppp/main.h @@ -0,0 +1,27 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _MAIN_H_ +#define _MAIN_H_ +void Cleanup __P((int)); +#endif diff --git a/usr.sbin/ppp/pred.h b/usr.sbin/ppp/pred.h new file mode 100644 index 000000000000..e44a489b2055 --- /dev/null +++ b/usr.sbin/ppp/pred.h @@ -0,0 +1,29 @@ +/* + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: ccp.h,v 1.2 1995/02/26 12:17:15 amurai Exp $ + * + * TODO: + */ + +#ifndef _PRED_H_ +#define _PRED_H_ + +extern void Pred1Output __P((int, u_short, struct mbuf *bp)); +extern void Pred1Input __P((struct mbuf*)); +extern void Pred1Init __P((int)); +#endif diff --git a/usr.sbin/ppp/route.h b/usr.sbin/ppp/route.h new file mode 100644 index 000000000000..4aba1af33d19 --- /dev/null +++ b/usr.sbin/ppp/route.h @@ -0,0 +1,27 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _ROUTE_H_ +#define _ROUTE_H_ +int GetIfIndex __P((char *)); +#endif diff --git a/usr.sbin/ppp/systems.h b/usr.sbin/ppp/systems.h new file mode 100644 index 000000000000..b1953a4969eb --- /dev/null +++ b/usr.sbin/ppp/systems.h @@ -0,0 +1,28 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _SYSTEMS_H_ +#define _SYSTEMS_H_ +extern void GetUid __P((void)); +extern int SelectSystem __P((char *, char*)); +#endif diff --git a/usr.sbin/wormcontrol/Makefile b/usr.sbin/wormcontrol/Makefile new file mode 100644 index 000000000000..c94d349ab621 --- /dev/null +++ b/usr.sbin/wormcontrol/Makefile @@ -0,0 +1,4 @@ +PROG= wormcontrol +MAN8= wormcontrol.8 + +.include <bsd.prog.mk> diff --git a/usr.sbin/wormcontrol/wormcontrol.c b/usr.sbin/wormcontrol/wormcontrol.c new file mode 100644 index 000000000000..be04c47ec6e3 --- /dev/null +++ b/usr.sbin/wormcontrol/wormcontrol.c @@ -0,0 +1,169 @@ +/* + * Copyright (C) 1996 + * interface business GmbH + * Tolkewitzer Strasse 49 + * D-01277 Dresden + * F.R. Germany + * + * All rights reserved. + * + * Written by Joerg Wunsch <joerg_wunsch@interface-business.de> + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) 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$ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <err.h> +#include <sysexits.h> + +#include <sys/ioctl.h> +#include <sys/wormio.h> + + +void +usage(void) +{ + errx(EX_USAGE, + "usage: wormcontrol [-f device] command [args]\n" + "commands:\n" + " select vendor-id model-id\n" + " prepdisk [dummy] single|double\n" + " track audio|data [preemp]\n" + " fixate toc-type [onp]\n"); +} + +#define eq(a, b) (strcmp(a, b) == 0) + +int +main(int argc, char **argv) +{ + int fd, c, i; + int errs = 0; + const char *devname = "/dev/rworm0"; + + while ((c = getopt(argc, argv, "f:")) != EOF) + switch(c) { + case 'f': + devname = optarg; + break; + + case '?': + default: + errs++; + } + + argc -= optind; + argv += optind; + + if (errs || argc < 1) + usage(); + + if ((fd = open(devname, O_RDONLY, 0)) == -1) + err(EX_NOINPUT, "open(%s)", devname); + + if (eq(argv[0], "select")) { + struct wormio_quirk_select q; + if (argc != 3) + errx(EX_USAGE, "wrong params for \"select\""); + q.vendor = argv[1]; + q.model = argv[2]; + if (ioctl(fd, WORMIOCQUIRKSELECT, &q) == -1) + err(EX_IOERR, "ioctl(WORMIOCQUIRKSELECT)"); + } + else if (eq(argv[0], "prepdisk")) { + struct wormio_prepare_disk d; + d.dummy = 0; + d.speed = -1; + for (i = 1; i < argc; i++) { + if (eq(argv[i], "dummy")) + d.dummy = 1; + else if (eq(argv[i], "single")) + d.speed = 1; + else if (eq(argv[i], "double")) + d.speed = 2; + else + errx(EX_USAGE, + "wrong param for \"prepdisk\": %s", + argv[i]); + } + if (d.speed == -1) + errx(EX_USAGE, "missing speed parameter"); + if (ioctl(fd, WORMIOCPREPDISK, &d) == -1) + err(EX_IOERR, "ioctl(WORMIOCPREPDISK)"); + } + else if (eq(argv[0], "track")) { + struct wormio_prepare_track t; + t.audio = -1; + t.preemp = 0; + for (i = 1; i < argc; i++) { + if (eq(argv[i], "audio")) + t.audio = 1; + else if (eq(argv[i], "data")) + t.audio = 0; + else if (eq(argv[i], "preemp")) + t.preemp = 1; + else + errx(EX_USAGE, + "wrong param for \"track\": %s", + argv[i]); + } + if (t.audio == -1) + errx(EX_USAGE, "missing track type parameter"); + if (t.audio == 0 && t.preemp == 1) + errx(EX_USAGE, "\"preemp\" attempted on data track"); + if (ioctl(fd, WORMIOCPREPTRACK, &t) == -1) + err(EX_IOERR, "ioctl(WORMIOCPREPTRACK)"); + } + else if (eq(argv[0], "fixate")) { + struct wormio_fixation f; + f.toc_type = -1; + f.onp = 0; + for (i = 1; i < argc; i++) { + if (eq(argv[i], "onp")) + f.onp = 1; + else if (argv[i][0] >= '0' && argv[i][0] <= '4' && + argv[i][1] == '\0') + f.toc_type = argv[i][0] - '0'; + else + errx(EX_USAGE, + "wrong param for \"fixate\": %s", + argv[i]); + } + if (f.toc_type == -1) + errx(EX_USAGE, "missing TOC type parameter"); + if (ioctl(fd, WORMIOCFIXATION, &f) == -1) + err(EX_IOERR, "ioctl(WORMIOFIXATION)"); + } + else + errx(EX_USAGE, "unknown command: %s", argv[0]); + + return EX_OK; +} |
