aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/Makefile16
-rw-r--r--sbin/Makefile.inc1
-rw-r--r--sbin/adjkerntz/Makefile4
-rw-r--r--sbin/adjkerntz/adjkerntz.8122
-rw-r--r--sbin/adjkerntz/adjkerntz.c224
-rw-r--r--sbin/adjkerntz/pathnames.h36
-rw-r--r--sbin/chkconfig/Makefile6
-rw-r--r--sbin/chkconfig/chkconfig.8160
-rw-r--r--sbin/chkconfig/chkconfig.c363
-rw-r--r--sbin/chkconfig/paths.h30
-rw-r--r--sbin/comcontrol/Makefile2
-rw-r--r--sbin/comcontrol/comcontrol.874
-rw-r--r--sbin/comcontrol/comcontrol.c65
-rw-r--r--sbin/disklabel/disklabel.c3
-rw-r--r--sbin/dump/Makefile2
-rw-r--r--sbin/dump/dump.82
-rw-r--r--sbin/dump/dump.h2
-rw-r--r--sbin/dump/dumpitime.c2
-rw-r--r--sbin/dump/dumpmain.c2
-rw-r--r--sbin/dump/dumpoptr.c2
-rw-r--r--sbin/dump/dumprmt.c2
-rw-r--r--sbin/dump/dumptape.c2
-rw-r--r--sbin/dump/dumptraverse.c2
-rw-r--r--sbin/dump/pathnames.h2
-rw-r--r--sbin/dump/rdump.82
-rw-r--r--sbin/dump/unctime.c2
-rw-r--r--sbin/fdisk/fdisk.82
-rw-r--r--sbin/fsck/Makefile5
-rw-r--r--sbin/fsck/fsck.82
-rw-r--r--sbin/fsck/fsck.h2
-rw-r--r--sbin/fsck/inode.c2
-rw-r--r--sbin/fsck/main.c5
-rw-r--r--sbin/fsck/pass1.c2
-rw-r--r--sbin/fsck/pass1b.c2
-rw-r--r--sbin/fsck/pass2.c2
-rw-r--r--sbin/fsck/pass3.c2
-rw-r--r--sbin/fsck/pass4.c2
-rw-r--r--sbin/fsck/pass5.c2
-rw-r--r--sbin/fsck/preen.c2
-rw-r--r--sbin/fsck/setup.c2
-rw-r--r--sbin/fsck/utilities.c2
-rw-r--r--sbin/ft/Makefile7
-rw-r--r--sbin/ft/ft.886
-rw-r--r--sbin/ft/ft.c432
-rw-r--r--sbin/ft/ftecc.c316
-rw-r--r--sbin/ifconfig/ifconfig.830
-rw-r--r--sbin/ifconfig/ifconfig.c46
-rw-r--r--sbin/init.bsdi/Makefile7
-rw-r--r--sbin/init.bsdi/init.c114
-rw-r--r--sbin/init.chmr/init.82
-rw-r--r--sbin/mount/Makefile2
-rw-r--r--sbin/mount/mount.810
-rw-r--r--sbin/mount_isofs/mount_isofs.814
-rw-r--r--sbin/mount_isofs/mount_isofs.c2
-rw-r--r--sbin/mount_procfs/Makefile8
-rw-r--r--sbin/mount_procfs/mount_procfs.840
-rw-r--r--sbin/mount_procfs/mount_procfs.c81
-rw-r--r--sbin/mountd/Makefile3
-rw-r--r--sbin/mountd/mountd.82
-rw-r--r--sbin/mountd/mountd.c7
-rw-r--r--sbin/newfs/Makefile4
-rw-r--r--sbin/newfs/mfs.c128
-rw-r--r--sbin/newfs/mkfs.c115
-rw-r--r--sbin/newfs/newfs.826
-rw-r--r--sbin/newfs/newfs.c56
-rw-r--r--sbin/nfsd/Makefile3
-rw-r--r--sbin/ping/ping.c19
-rw-r--r--sbin/reboot/reboot_i386.86
-rw-r--r--sbin/restore/dirs.c9
-rw-r--r--sbin/restore/pathnames.h9
-rw-r--r--sbin/restore/restore.h9
-rw-r--r--sbin/restore/tape.c22
-rw-r--r--sbin/route/Makefile8
-rw-r--r--sbin/route/route.c46
-rw-r--r--sbin/routed/tables.c31
-rw-r--r--sbin/savecore/savecore.c4
-rw-r--r--sbin/scsi/Makefile7
-rw-r--r--sbin/scsi/procargs.c86
-rw-r--r--sbin/scsi/scsi.155
-rw-r--r--sbin/scsi/scsi.c102
-rw-r--r--sbin/slattach/slattach.c28
-rw-r--r--sbin/st/Makefile4
-rw-r--r--sbin/st/st.1 (renamed from sbin/st/st.8)18
-rw-r--r--sbin/st/st.c36
-rw-r--r--sbin/swapon/swapon.84
-rw-r--r--sbin/umount/Makefile2
86 files changed, 2866 insertions, 346 deletions
diff --git a/sbin/Makefile b/sbin/Makefile
index 86ebd705b798..a1ac2c6c8c66 100644
--- a/sbin/Makefile
+++ b/sbin/Makefile
@@ -1,17 +1,19 @@
# @(#)Makefile 5.4.1.1 (Berkeley) 5/7/91
+# $Id: Makefile,v 1.10 1994/02/07 05:23:06 alm Exp $
#
-SUBDIR= XNSrouted badsect comcontrol clri disklabel dmesg dump dumpfs fastboot fdisk \
- fsck halt ifconfig mknod mount mount_isofs mount_pcfs mountd \
- newfs nfsd nfsiod ping quotacheck reboot restore route routed \
- savecore shutdown slattach st swapon tunefs umount
+SUBDIR= XNSrouted adjkerntz badsect chkconfig clri comcontrol disklabel dmesg \
+ dump dumpfs fastboot fdisk fsck ft halt ifconfig mknod mount \
+ mount_isofs mount_pcfs mount_procfs mountd newfs nfsd nfsiod ping \
+ quotacheck reboot restore route routed savecore scsi shutdown \
+ slattach st swapon tunefs umount
-.if defined(INIT_BSDI)
-SUBDIR+= init.bsdi
+.if defined(INIT_ORIG)
+SUBDIR+= init
.elif defined(INIT_CHMR)
SUBDIR+= init.chmr
.else
-SUBDIR+= init
+SUBDIR+= init.bsdi
.endif
diff --git a/sbin/Makefile.inc b/sbin/Makefile.inc
index 95ad55675db3..df26b95e61a2 100644
--- a/sbin/Makefile.inc
+++ b/sbin/Makefile.inc
@@ -1,3 +1,4 @@
# @(#)Makefile.inc 5.1 (Berkeley) 5/11/90
BINDIR?= /sbin
+NOSHARED?= YES
diff --git a/sbin/adjkerntz/Makefile b/sbin/adjkerntz/Makefile
new file mode 100644
index 000000000000..1ac5047b6f6a
--- /dev/null
+++ b/sbin/adjkerntz/Makefile
@@ -0,0 +1,4 @@
+PROG= adjkerntz
+MAN8= adjkerntz.8
+
+.include <bsd.prog.mk>
diff --git a/sbin/adjkerntz/adjkerntz.8 b/sbin/adjkerntz/adjkerntz.8
new file mode 100644
index 000000000000..ac8fb5fbc952
--- /dev/null
+++ b/sbin/adjkerntz/adjkerntz.8
@@ -0,0 +1,122 @@
+.\" Copyright (C) 1993 by Andrew A. Chernov, Moscow, Russia.
+.\" 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 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 December 15, 1993
+.Dt ADJKERNTZ 8
+.Os FreeBSD
+.Sh NAME
+.Nm adjkerntz
+.Nd "adjusts the kernel time if the machine runs wall CMOS clock"
+.Sh SYNOPSIS
+.Nm adjkerntz
+.Fl i
+.Op Fl v
+.Nm adjkerntz
+.Fl a
+.Op Fl v
+.Sh DESCRIPTION
+.Nm Adjkerntz
+fixes kernel time (makes it UTC) using the current wall CMOS clock value,
+the current time zone rule and the kernel timezone value. The adjustment is
+enabled only if the file
+.Pa /etc/wall_cmos_clock
+exists, in other cases it is assumed that the machine runs UTC CMOS clock and
+.Nm adjkerntz
+does nothing.
+.Pp
+The adjustment is needed at boot stage and when a time zone
+change occurs, so
+.Nm adjkerntz
+can be called in two forms:
+.Bl -tag -width 4n
+.It Cm Fl i
+initialization call from
+.Pa /etc/rc
+(before any daemons are started).
+.Nm Adjkerntz
+makes the first adjustment and the initial time zone offset is stored into
+.Pa /var/run/.adjkerntz
+for following subsequent
+.Nm adjkerntz
+calls.
+.It Cm Fl a
+This form is needed, when time zone changes occur.
+.Nm Adjkerntz
+uses the previously stored
+time zone offset and the changed time zone rule to
+produce the new time zone offset, fix the kernel time and store the new
+offset into
+.Pa /var/run/.adjkerntz
+too.
+It is recommended to use this form in root's
+.Xr crontab 5
+near 3am,
+since this time matches most modern time zone changes.
+.It Cm Fl v
+This option is for diagnostic purposes. It causes
+.Nm adjkerntz
+to print differences between the old and new time zone offsets
+to stdout.
+.El
+.Pp
+.Nm Adjkerntz
+clears the kernel timezone structure and makes kernel always run at UTC
+time zone.
+Super-user privilege is required for all operations.
+.Sh ENVIRONMENT
+.Bl -tag -width Fl
+.It Ev TZ
+Time zone change rule, see
+.Xr tzset 3 ;
+not needed when
+.Xr zic 8
+is used.
+.Sh FILES
+.Bl -tag -width /etc/wall_cmos_clock -compact
+.It Pa /etc/localtime
+Link to the current zone info file, see
+.Xr zic 8 .
+.It Pa /etc/wall_cmos_clock
+Empty file.
+Presence of it indicates that the machine runs wall CMOS clock,
+absence indicates UTC CMOS clock.
+.It Pa /var/run/.adjkerntz
+Text file with the stored current time zone offset in seconds.
+.Sh SEE ALSO
+.Xr tzset 3 ,
+.Xr zic 8 ,
+.Xr rc 8 ,
+.Xr crontab 5
+.Sh DIAGNOSTICS
+No diagnostics, unless \-v option is specified.
+If any error occurs, an error message printed to stderr and
+.Nm adjkerntz
+exits with return code greater than zero.
+.Sh AUTHOR
+Andrew A. Chernov <ache@astral.msk.su>
+.Sh HISTORY
+The
+.Nm adjkerntz
+command appeared in FreeBSD 1.0.1
+
diff --git a/sbin/adjkerntz/adjkerntz.c b/sbin/adjkerntz/adjkerntz.c
new file mode 100644
index 000000000000..53a871ac45d1
--- /dev/null
+++ b/sbin/adjkerntz/adjkerntz.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 1993 by Andrew A. Chernov, Moscow, Russia.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE 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.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#)Copyright (C) 1993 by Andrew A. Chernov, Moscow, Russia.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+/*
+ * Andrew A. Chernov <ache@astral.msk.su> Dec 20 1993
+ *
+ * Fix kernel time value if machine run wall CMOS clock
+ * (and /etc/wall_cmos_clock file present)
+ * using zoneinfo rules or direct TZ environment variable set.
+ * Use Joerg Wunsch idea for seconds accurate offset calculation
+ * with Garrett Wollman and Bruce Evans fixes.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include "pathnames.h"
+
+char storage[] = _PATH_OFFSET;
+
+int main(argc, argv)
+ int argc;
+ char **argv;
+{
+ struct tm local, utc;
+ struct timeval tv, *stv;
+ struct timezone tz, *stz;
+ /* Avoid time_t here, can be unsigned long or worse */
+ long offset, oldoffset, utcsec, localsec, diff;
+ time_t initial_sec, final_sec;
+ int ch, init = -1, verbose = 0;
+ FILE *f;
+
+ while ((ch = getopt(argc, argv, "aiv")) != EOF)
+ switch((char)ch) {
+ case 'i': /* initial call, save offset */
+ if (init != -1)
+ goto usage;
+ init = 1;
+ break;
+ case 'a': /* adjustment call, use saved offset */
+ if (init != -1)
+ goto usage;
+ init = 0;
+ break;
+ case 'v': /* verbose */
+ verbose = 1;
+ break;
+ default:
+ usage:
+ fprintf(stderr, "Usage:\n\
+\tadjkerntz -i [-v]\t(initial call from /etc/rc)\n\
+\tadjkerntz -a [-v]\t(adjustment call from crontab)\n");
+ return 2;
+ }
+ if (init == -1)
+ goto usage;
+
+ if (access(_PATH_CLOCK, F_OK))
+ return 0;
+
+ /* Restore saved offset */
+
+ if (!init) {
+ if ((f = fopen(storage, "r")) == NULL) {
+ perror(storage);
+ return 1;
+ }
+ if (fscanf(f, "%ld", &oldoffset) != 1) {
+ fprintf(stderr, "Misformatted offset in %s\n",
+ storage);
+ return 1;
+ }
+ (void) fclose(f);
+ }
+ else
+ oldoffset = 0;
+
+/****** Critical section, do all things as fast as possible ******/
+
+ /* get local CMOS clock and possible kernel offset */
+ if (gettimeofday(&tv, &tz)) {
+ perror("gettimeofday");
+ return 1;
+ }
+
+ /* get the actual local timezone difference */
+ initial_sec = tv.tv_sec;
+ local = *localtime(&initial_sec);
+ utc = *gmtime(&initial_sec);
+ utc.tm_isdst = local.tm_isdst; /* Use current timezone for mktime(), */
+ /* because it assumed local time */
+
+ /* calculate local CMOS diff from GMT */
+
+ utcsec = mktime(&utc);
+ localsec = mktime(&local);
+ if (utcsec == -1 || localsec == -1) {
+ /*
+ * XXX user can only control local time, and it is
+ * unacceptable to fail here for -i. 2:30 am in the
+ * middle of the nonexistent hour means 3:30 am.
+ */
+ fprintf(stderr,
+ "Nonexistent local time - try again in an hour\n");
+ return 1;
+ }
+ offset = utcsec - localsec;
+
+ /* correct the kerneltime for this diffs */
+ /* subtract kernel offset, if present, old offset too */
+
+ diff = offset - tz.tz_minuteswest * 60 - oldoffset;
+
+ if (diff != 0) {
+
+ /* Yet one step for final time */
+
+ final_sec = tv.tv_sec + diff;
+
+ /* get the actual local timezone difference */
+ local = *localtime(&final_sec);
+ utc = *gmtime(&final_sec);
+ utc.tm_isdst = local.tm_isdst; /* Use current timezone for mktime(), */
+ /* because it assumed local time */
+
+ utcsec = mktime(&utc);
+ localsec = mktime(&local);
+ if (utcsec == -1 || localsec == -1) {
+ /*
+ * XXX as above. The user has even less control,
+ * but perhaps we never get here.
+ */
+ fprintf(stderr,
+ "Nonexistent (final) local time - try again in an hour\n");
+ return 1;
+ }
+ offset = utcsec - localsec;
+
+ /* correct the kerneltime for this diffs */
+ /* subtract kernel offset, if present, old offset too */
+
+ diff = offset - tz.tz_minuteswest * 60 - oldoffset;
+
+ if (diff != 0) {
+ tv.tv_sec += diff;
+ tv.tv_usec = 0; /* we are restarting here... */
+ stv = &tv;
+ }
+ else
+ stv = NULL;
+ }
+ else
+ stv = NULL;
+
+ if (tz.tz_dsttime != 0 || tz.tz_minuteswest != 0) {
+ tz.tz_dsttime = tz.tz_minuteswest = 0; /* zone info is garbage */
+ stz = &tz;
+ }
+ else
+ stz = NULL;
+
+ if (stz != NULL || stv != NULL) {
+ if (settimeofday(stv, stz)) {
+ perror("settimeofday");
+ return 1;
+ }
+ }
+
+/****** End of critical section ******/
+
+ if (verbose)
+ printf("Calculated zone offset difference: %ld seconds\n",
+ diff);
+
+ if (offset != oldoffset) {
+ (void) umask(022);
+ /* Save offset for next calls from crontab */
+ if ((f = fopen(storage, "w")) == NULL) {
+ perror(storage);
+ return 1;
+ }
+ fprintf(f, "%ld\n", offset);
+ if (fclose(f)) {
+ perror(storage);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
diff --git a/sbin/adjkerntz/pathnames.h b/sbin/adjkerntz/pathnames.h
new file mode 100644
index 000000000000..a8b751fa5f23
--- /dev/null
+++ b/sbin/adjkerntz/pathnames.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 1993 by Andrew A. Chernov, Moscow, Russia.
+ * 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 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.
+ */
+
+#include <paths.h>
+
+/*
+ * Offset file name started with '.', because "adjkerntz -i"
+ * called in /etc/rc before cleaning '*' in /var/run,
+ * and this file should be keeped after it.
+ */
+#define _PATH_OFFSET "/var/run/.adjkerntz"
+
+#define _PATH_CLOCK "/etc/wall_cmos_clock"
diff --git a/sbin/chkconfig/Makefile b/sbin/chkconfig/Makefile
new file mode 100644
index 000000000000..6374cd860a80
--- /dev/null
+++ b/sbin/chkconfig/Makefile
@@ -0,0 +1,6 @@
+# $Id: Makefile,v 1.1 1993/11/11 05:25:27 wollman Exp $
+
+PROG= chkconfig
+MAN8= chkconfig.8
+
+.include <bsd.prog.mk>
diff --git a/sbin/chkconfig/chkconfig.8 b/sbin/chkconfig/chkconfig.8
new file mode 100644
index 000000000000..e166f77ec22d
--- /dev/null
+++ b/sbin/chkconfig/chkconfig.8
@@ -0,0 +1,160 @@
+.\" Copyright 1993, Garrett A. Wollman.
+.\" Copyright 1993, University of Vermont and State Agricultural College.
+.\" 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 UNIVERSITY AND 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 UNIVERSITY OR 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.
+.\"
+.\" $Id: chkconfig.8,v 1.4 1993/11/12 03:58:43 wollman Exp $
+.\"
+.Dd November 10, 1993
+.Dt CHKCONFIG 8
+.Os "FreeBSD"
+.Sh NAME
+.Nm chkconfig
+.Nd "set and inquire the state of system configuration files"
+.Sh SYNOPSIS
+.Nm chkconfig
+.Op Fl d Ar dirname
+.Op Fl s
+.Nm chkconfig
+.Op Fl d Ar dirname
+.Op Fl v
+.Ar option
+.Nm chkconfig
+.Op Fl d Ar dirname
+.Fl o
+.Ar option
+.Nm chkconfig
+.Op Fl d Ar dirname
+.Op Fl f
+.Op Fl v
+.Ar option
+.Ar state
+.Sh DESCRIPTION
+The
+.Nm chkconfig
+program is used to set and inquire the state of the system
+configuration files. These files are used by the system startup
+scripts
+.Pa /etc/rc ,
+.Pa /etc/netstart ,
+and
+.Pa /etc/rc.local
+to determine which programs and services to start when the system
+boots. The configuration files are normally located in the directory
+.Pa /etc/config ,
+but an alternate location can be specified with the
+.Fl d
+flag.
+By convention, configuration file names do not contain dots (which are
+reserved for files containing command-line options for various
+programs), but this is not strictly enforced.
+.Pp
+There are four forms of the
+.Nm chkconfig
+command. The first form, with no
+.Ar option
+argument, lists the state of the entire set of options. If the
+.Fl s
+flag is specified, the files are first sorted according to the state
+of each option; by default, they are sorted in ASCII collation order.
+If there is a
+.Pa .flags
+file with the same basename as an option file, the flags listed therein are
+also printed.
+.Pp
+The second form, with only a
+.Ar option
+argument (and no state) specified, retrieves the current value of the
+specified option. If the appropriate file exists and contains only
+the word ``on'', then the option is considered to be on; otherwise it
+is considered to be off. Comments are allowed, using the `#'
+character, but must begin in the first column of the file.
+If the
+.Fl v
+flag is specified,
+.Nm chkconfig
+displays the status on the standard output. In either case,
+.Nm chkconfig
+exits with a status of zero (true) if the option is on, or 1 (false)
+otherwise.
+.Pp
+The third form, with the
+.Fl o
+flag specified, does not actually have anything to do with options,
+but was included in
+.Nm chkconfig
+for convenience. It looks in the configuration directory for a file
+named
+.Ar option Ns No .flags ,
+and skips any comment lines, then prints the next line on the standard
+output.
+.Pp
+The fourth form, with both
+.Ar option
+and
+.Ar state
+specified, attempts to change the state of
+.Ar option
+to be
+.Ar state ,
+which is interpreted in the same way as the file contents (above). If
+the configuration file does not already exist, the
+.Fl f
+flag must be specified to force creation of a new file. If the
+.Fl v
+flag is specified,
+.Nm chkconfig
+displays the new status on the standard output if successful.
+If unsuccessful,
+.Nm chkconfig
+displays an error message and exits with a non-zero return value.
+.Sh SEE ALSO
+.Xr rc 8
+.Sh FILES
+.Bl -tag -width /etc/netstart -compact
+.It Pa /etc/rc
+system startup file
+.It Pa /etc/netstart
+network startup file
+.It Pa /etc/rc.local
+secondary system startup file
+.It Pa /etc/config
+default location for system configuration files
+.El
+.Sh BUGS
+The
+.Fl f
+option is bogus, and kept only for SGI compatibility.
+.Sh HISTORY
+The
+.Nm chkconfig
+command is modeled after the command of the same name in Silicon
+Graphics' IRIX. The
+.Fl d
+and
+.Fl o
+flags are extensions to the SGI version, as is the ability to have
+comments in the configuration files.
+.Sh AUTHOR
+.Nm chkconfig
+was written by Garrett A. Wollman, University of Vermont.
diff --git a/sbin/chkconfig/chkconfig.c b/sbin/chkconfig/chkconfig.c
new file mode 100644
index 000000000000..0c0f51da79d8
--- /dev/null
+++ b/sbin/chkconfig/chkconfig.c
@@ -0,0 +1,363 @@
+/*
+ * Copyright 1993, Garrett A. Wollman.
+ * Copyright 1993, University of Vermont and State Agricultural College.
+ * 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 UNIVERSITY AND 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 UNIVERSITY OR 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.
+ */
+
+const char chkconfig_c_rcsid[] =
+ "$Id: chkconfig.c,v 1.4 1993/11/12 03:54:24 wollman Exp $";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <errno.h>
+#include <string.h>
+#include "paths.h"
+
+static int testvalue(const char *);
+static int printflags(const char *);
+static int setvalue(const char *, int);
+static int printvalues(void);
+static void usage(void);
+static void die(const char *);
+static int is_on(const char *);
+
+const char *whoami;
+static const char *configdir = _PATH_CONFIG;
+static int sortbystate = 0;
+static int doflags = 0;
+static int force = 0;
+static int verbose = 0;
+
+int main(int argc, char **argv) {
+ int opt;
+
+ whoami = argv[0];
+
+ while((opt = getopt(argc, argv, "osfd:v")) != EOF) {
+ switch(opt) {
+ case 'o':
+ doflags = 1;
+ break;
+ case 's':
+ sortbystate = 1;
+ break;
+ case 'f':
+ force = 1;
+ break;
+ case 'd':
+ configdir = optarg;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ return -1;
+ }
+ }
+
+ if(sortbystate && optind != argc) {
+ fprintf(stderr, "%s: -s: too many arguments\n", whoami);
+ usage();
+ return -1;
+ }
+
+ if(force && optind == argc) {
+ fprintf(stderr, "%s: -f: too few arguments\n", whoami);
+ usage();
+ return -1;
+ }
+
+ switch(argc - optind) {
+ case 0:
+ return printvalues();
+
+ case 1:
+ return doflags ? printflags(argv[optind]) : testvalue(argv[optind]);
+
+ case 2:
+ return setvalue(argv[optind], is_on(argv[optind + 1]));
+
+ default:
+ usage();
+ return -1;
+ }
+}
+
+static int is_on(const char *str) {
+ if(!str) return 0;
+ return ( ((str[0] == 'o') || (str[0] == 'O'))
+ && ((str[1] == 'n') || (str[1] == 'N'))
+ && ((str[2] == '\n')|| (str[2] == '\0')));
+}
+
+static void chat(const char *str, int state) {
+ if(verbose)
+ printf("`%s' is %s.\n", str, state ? "ON" : "OFF");
+}
+
+static const char *confname(const char *str, const char *str2) {
+ int len = strlen(configdir) + strlen(str) + strlen(str2) + 2;
+ char *rv = malloc(len);
+
+ if(!rv) {
+ errno = ENOMEM;
+ die("confname: malloc");
+ }
+
+ strcpy(rv, configdir);
+ strcat(rv, "/");
+ strcat(rv, str);
+ strcat(rv, str2);
+ return rv;
+}
+
+static int testvalue(const char *str) {
+ FILE *fp;
+ char *line;
+ const char *fname;
+ int rv = 1; /* NB: shell's convention is opposite C's */
+
+ fname = confname(str, "");
+ fp = fopen(fname, "r");
+ if(fp) {
+ do {
+ line = fgetline(fp, (size_t *)0);
+ } while(line && line[0] == '#');
+ rv = !is_on(line); /* shell's convention is opposite C's */
+ fclose(fp);
+ }
+
+ free((void *)fname); /* cast away `const' to avoid warning */
+ chat(str, !rv); /* tell the user about it if verbose */
+ return rv;
+}
+
+static char *getflags(const char *str) {
+ FILE *fp;
+ char *line;
+ const char *fname;
+ char *rv = strdup("");
+
+ if(!rv) {
+ errno = ENOMEM;
+ die("getflags: strdup");
+ }
+
+ fname = confname(str, ".flags");
+ fp = fopen(fname, "r");
+ if(fp) {
+ do {
+ line = fgetline(fp, (size_t *)0);
+ } while(line && line[0] == '#');
+
+ if(line) {
+ free(rv);
+ rv = strdup(line);
+
+ if(!rv) {
+ errno = ENOMEM;
+ die("getflags: strdup");
+ }
+ }
+
+ fclose(fp);
+ }
+ free((void *)fname);
+
+ return rv;
+}
+
+
+static int printflags(const char *str) {
+ int rv = 0;
+ char *flags;
+
+ flags = getflags(str);
+ if(flags[0]) printf("%s\n", flags);
+ free(flags);
+ return 0;
+}
+
+static int setvalue(const char *str, int state) {
+ FILE *fp;
+ const char *fname;
+
+ fname = confname(str, "");
+ errno = 0;
+ fp = fopen(fname, "r");
+ if(!fp && !force) {
+ /*
+ * Yes, I know this is bogus, but SGI must have had some sort of
+ * reason...
+ */
+ if(errno == ENOENT) {
+ fprintf(stderr,
+ "%s: configuration file does not exist;"
+ " use `-f' flag to create it.\n", whoami);
+ return -1;
+ } else {
+ die(fname);
+ }
+ }
+
+ if(fp)
+ fclose(fp);
+
+ errno = 0;
+ fp = fopen(fname, "w");
+ if(!fp)
+ die(fname);
+
+ fprintf(fp, "%s\n", state ? "on" : "off");
+
+ fclose(fp);
+
+ chat(str, state);
+ return 0;
+}
+
+/*
+ * From here down is the code for listing the value of every option.
+ */
+struct q {
+ struct q *next;
+ int state;
+ char *name;
+ char *flags;
+};
+
+static struct q *onhead;
+static struct q *offhead; /* only used for sortbystate == 1 */
+
+static void insert(const char *fname) {
+ struct q *q;
+ struct q **headp;
+ int state;
+
+ q = malloc(sizeof *q);
+ if(!q) {
+ errno = ENOMEM;
+ die("insert: malloc");
+ }
+
+ q->name = strdup(fname);
+ q->state = state = !testvalue(fname);
+ q->flags = getflags(fname);
+
+ if(state || !sortbystate)
+ headp = &onhead;
+ else
+ headp = &offhead;
+
+ while(*headp && strcmp(q->name, (**headp).name) > 0) {
+ headp = &(**headp).next;
+ }
+
+ q->next = *headp;
+ *headp = q;
+}
+
+static int printvalues(void) {
+ struct q *temp;
+ DIR *dir;
+ struct dirent *entry;
+ struct stat stab;
+ int doneheader = 0;
+
+ verbose = 0; /* we're already verbose enough */
+
+ errno = 0;
+ dir = opendir(configdir);
+ if(!dir)
+ die(configdir);
+
+ while((entry = readdir(dir))) {
+ if(stat(entry->d_name, &stab) < 0) {
+ die(entry->d_name);
+ }
+
+ if(S_ISREG(stab.st_mode) && !strchr(entry->d_name, '.')) {
+ insert(entry->d_name);
+ }
+ }
+
+ closedir(dir);
+
+ /*
+ * Now we're done reading the file names, so we can print them out.
+ * Thanks to insert(), everything is already in ASCII order.
+ */
+#define FORMAT "%15s %-5s %s\n"
+
+ if(sortbystate) {
+ printf("%15s %s %s\n",
+ "Option", "State", "Flags");
+ printf("%15s %s %s\n",
+ "===============", "=====", "====================");
+ doneheader = 1;
+
+ while((temp = offhead)) {
+ printf(FORMAT, temp->name, "off", temp->flags);
+ free(temp->name);
+ free(temp->flags);
+ offhead = temp->next;
+ free(temp);
+ }
+ }
+
+ if(!doneheader) {
+ printf("%15s %s %s\n", "Option", "State", "Flags");
+ printf("%15s %s %s\n",
+ "===============", "=====", "====================");
+ }
+
+ while((temp = onhead)) {
+ printf(FORMAT, temp->name, temp->state ? "on" : "off", temp->flags);
+ free(temp->name);
+ free(temp->flags);
+ onhead = temp->next;
+ free(temp);
+ }
+
+ return 0;
+}
+
+
+static void die(const char *why) {
+ fprintf(stderr, "%s: %s: %s\n", whoami, why, strerror(errno));
+ exit(-1);
+}
+
+static void usage(void) {
+ fprintf(stderr, "%s: usage:\n"
+ "%s [ -d configdir ] [ -s ]\n"
+ "%s [ -d configdir ] option\n"
+ "%s [ -d configdir ] [ -f ] option [ on | off ]\n",
+ whoami, whoami, whoami, whoami);
+}
diff --git a/sbin/chkconfig/paths.h b/sbin/chkconfig/paths.h
new file mode 100644
index 000000000000..cf20c4e0bf01
--- /dev/null
+++ b/sbin/chkconfig/paths.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1993, Garrett A. Wollman.
+ * Copyright 1993, University of Vermont and State Agricultural College.
+ * 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 UNIVERSITY AND 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 UNIVERSITY OR 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.
+ *
+ * $Id: paths.h,v 1.1 1993/11/11 05:25:29 wollman Exp $
+ */
+
+#define _PATH_CONFIG "/etc/config"
diff --git a/sbin/comcontrol/Makefile b/sbin/comcontrol/Makefile
index 46179428a7e7..abc8d0a7f81f 100644
--- a/sbin/comcontrol/Makefile
+++ b/sbin/comcontrol/Makefile
@@ -1,6 +1,6 @@
# @(#)Makefile 5.4 (Berkeley) 6/5/91
PROG= comcontrol
-NOMAN= noman
+MAN8= comcontrol.8
.include <bsd.prog.mk>
diff --git a/sbin/comcontrol/comcontrol.8 b/sbin/comcontrol/comcontrol.8
new file mode 100644
index 000000000000..bcb44e1088ee
--- /dev/null
+++ b/sbin/comcontrol/comcontrol.8
@@ -0,0 +1,74 @@
+.Dd December 10, 1993
+.Dt COMCONTROL 8
+.Os FreeBSD
+.Sh NAME
+.Nm comcontrol
+.Nd "control the bidirectional status of a sio port and waiting time after DTR drop"
+.Sh SYNOPSIS
+.Nm comcontrol
+.Ar sio_special_device
+.Op Cm bidir | Fl bidir
+.Op Cm dtrwait Ar ticks
+.Sh DESCRIPTION
+.Nm Comcontrol
+is used to examine and modify the bidirectional status
+of a specified
+sio communications port
+and its waiting time after DTR drop.
+By default (if
+.Ar sio_special_device
+only specified),
+.Nm comcontrol
+will print the current port state
+(if kernel was built with
+.Cm options COM_BIDIR )
+as either
+.Cm bidir
+to indicate that bidirectional operation is enabled or
+.Fl bidir
+to indicate that it is disabled, string
+.Cm dtrwait
+and current waiting time in ticks
+after DTR drop.
+To modify the status of the port or waiting time, simply
+specify the desired new state
+and/or new waiting time
+on the command line. All users with
+read access to the
+.Ar sio_special_device
+can use
+.Nm comcontrol
+to get the port's status and current waiting time.
+Only root can set a port's status and waiting time.
+By default, each port is initially unidirectional, waiting time is
+2 seconds.
+.Pp
+The standard way to use
+.Nm comcontrol
+is to put invocations of it in the
+.Ar /etc/rc.local
+startup script.
+.Sh SEE ALSO
+.Xr sio 4
+.Sh FILES
+.Bl -tag -width Pa
+.It Pa /dev/sio??
+.Sh DIAGNOSTICS
+.Cm TIOCMSBIDIR: Inappropriate ioctl for device.
+.Pp
+This indicates attempt to change port status on
+a non-sio special device file,
+or the kernel has not been built with
+.Cm options COM_BIDIR .
+For more information concerning reconfiguration
+of your kernel see
+.Ar /usr/src/sys/i386/doc/config_options.doc.
+.Sh AUTHOR
+Christopher G. Demetriou
+.Sh BUGS
+It is strongly recommended that you do *not*
+change the bidirectional status of a port while there are programs
+using the port. Read that as: if you do, and it breaks, don't yell
+at me; that's a really weird thing to do.
+.Sh HISTORY
+Originally part of cgd's com package patches, version 0.2.1, to 386BSD 0.1.
diff --git a/sbin/comcontrol/comcontrol.c b/sbin/comcontrol/comcontrol.c
index 101d64ff4759..e88e3d8f71e0 100644
--- a/sbin/comcontrol/comcontrol.c
+++ b/sbin/comcontrol/comcontrol.c
@@ -31,12 +31,14 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
#include <fcntl.h>
void usage(char *progname)
{
- fprintf(stderr, "usage: %s <filename> [[-]bidir]\n", progname);
+ fprintf(stderr, "usage: %s <filename> [[-]bidir] [dtrwait <n>]\n", progname);
exit(1);
}
@@ -44,8 +46,9 @@ int main(int argc, char *argv[])
{
int fd;
int res;
+ int dtrwait;
- if ((argc < 2) || (argc > 3)) usage(argv[0]);
+ if ((argc < 2) || (argc > 5)) usage(argv[0]);
fd = open(argv[1], O_RDONLY|O_NONBLOCK, 0);
if (fd < 0) {
@@ -55,25 +58,55 @@ int main(int argc, char *argv[])
}
if (argc == 2) {
- if (ioctl(fd, TIOCMGBIDIR, &res) < 0) {
- perror("ioctl");
+ if (ioctl(fd, TIOCMGBIDIR, &res) >= 0) {
+ if (!res) printf("-");
+ printf("bidir ");
+ }
+ if (ioctl(fd, TIOCMGDTRWAIT, &dtrwait) < 0) {
+ perror("TIOCMGDTRWAIT");
exit(1);
}
- if (!res) printf("-");
- printf("bidir\n");
+ printf("dtrwait %d\n", dtrwait);
} else {
- if (!strcmp(argv[2],"bidir")) {
- res = 1;
- } else if (!strcmp(argv[2],"-bidir")) {
- res = 0;
- } else {
- usage(argv[0]);
+ char *prg = argv[0];
+
+ res = dtrwait = -1;
+ while (argv[2] != NULL) {
+ if (!strcmp(argv[2],"bidir")) {
+ if (res >= 0)
+ usage(prg);
+ res = 1;
+ argv++;
+ } else if (!strcmp(argv[2],"-bidir")) {
+ if (res >= 0)
+ usage(prg);
+ res = 0;
+ argv++;
+ } else if (!strcmp(argv[2],"dtrwait")) {
+ if (dtrwait >= 0)
+ usage(prg);
+ if (argv[3] == NULL || !isdigit(argv[3][0]))
+ usage(prg);
+ dtrwait = atoi(argv[3]);
+ argv += 2;
+ } else {
+ usage(prg);
+ }
+ }
+ if (res >= 0) {
+ if (ioctl(fd, TIOCMSBIDIR, &res) < 0) {
+ perror("TIOCMSBIDIR");
+ exit(1);
+ }
+ }
+ if (dtrwait >= 0) {
+ if (ioctl(fd, TIOCMSDTRWAIT, &dtrwait) < 0) {
+ perror("TIOCMSDTRWAIT");
+ exit(1);
+ }
}
- if (ioctl(fd, TIOCMSBIDIR, &res) < 0) {
- perror("ioctl");
- exit(1);
- }
}
close(fd);
+ exit(0);
}
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 801dbc399a25..f8810370dd6a 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -63,8 +63,10 @@ static char sccsid[] = "@(#)disklabel.c 5.20 (Berkeley) 2/9/91";
#include <sys/disklabel.h>
#include <stdio.h>
#include <ctype.h>
+#include <unistd.h>
#include "pathnames.h"
+
/*
* Disklabel: read and write disklabels.
* The label is usually placed on one of the first sectors of the disk.
@@ -367,7 +369,6 @@ writelabel(f, boot, lp)
{
register int i;
int flag;
- off_t lseek();
#ifdef __386BSD__
off_t lbl_off; struct partition *pp = lp->d_partitions;
#endif
diff --git a/sbin/dump/Makefile b/sbin/dump/Makefile
index 61110fa41be4..050b1839bc4f 100644
--- a/sbin/dump/Makefile
+++ b/sbin/dump/Makefile
@@ -1,6 +1,6 @@
# @(#)Makefile 5.12 (Berkeley) 3/7/91
#
-# $Header: /a/cvs/386BSD/src/sbin/dump/Makefile,v 1.4 1993/07/22 16:49:11 jkh Exp $
+# $Header: /home/cvs/386BSD/src/sbin/dump/Makefile,v 1.4 1993/07/22 16:49:11 jkh Exp $
# dump.h header file
# dumpitime.c reads /etc/dumpdates
diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8
index 567c18511d90..ff5a914a191b 100644
--- a/sbin/dump/dump.8
+++ b/sbin/dump/dump.8
@@ -31,7 +31,7 @@
.\"
.\" @(#)dump.8 6.8 (Berkeley) 6/17/91
.\"
-.\" $Header: /a/cvs/386BSD/src/sbin/dump/dump.8,v 1.2 1993/07/22 16:49:13 jkh Exp $
+.\" $Header: /home/cvs/386BSD/src/sbin/dump/dump.8,v 1.2.2.1 1994/05/01 16:06:51 jkh Exp $
.\"
.Dd June 17, 1991
.Dt DUMP 8
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index 5f7d7dfb2cf1..6cabf7e01ffa 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -32,7 +32,7 @@
*
* @(#)dump.h 5.16 (Berkeley) 5/29/91
*
- * $Header: /a/cvs/386BSD/src/sbin/dump/dump.h,v 1.2 1993/07/22 16:49:14 jkh Exp $
+ * $Header: /home/cvs/386BSD/src/sbin/dump/dump.h,v 1.2 1993/07/22 16:49:14 jkh Exp $
*/
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
diff --git a/sbin/dump/dumpitime.c b/sbin/dump/dumpitime.c
index 4852b69cfc3b..b2edc4170886 100644
--- a/sbin/dump/dumpitime.c
+++ b/sbin/dump/dumpitime.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)dumpitime.c 5.7 (Berkeley) 3/7/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumpitime.c,v 1.2 1993/07/22 16:49:15 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumpitime.c,v 1.2 1993/07/22 16:49:15 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/dumpmain.c b/sbin/dump/dumpmain.c
index eb1aaf438c6d..a6f6e3c04baa 100644
--- a/sbin/dump/dumpmain.c
+++ b/sbin/dump/dumpmain.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
static char sccsid[] = "@(#)dumpmain.c 5.16 (Berkeley) 4/24/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumpmain.c,v 1.3 1993/09/13 21:25:11 rgrimes Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumpmain.c,v 1.3 1993/09/13 21:25:11 rgrimes Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/dumpoptr.c b/sbin/dump/dumpoptr.c
index 1bb5b262fa07..deff36a7fd19 100644
--- a/sbin/dump/dumpoptr.c
+++ b/sbin/dump/dumpoptr.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)dumpoptr.c 5.8 (Berkeley) 3/7/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumpoptr.c,v 1.2 1993/07/22 16:49:17 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumpoptr.c,v 1.2 1993/07/22 16:49:17 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index aad16dec7357..7780041936f5 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)dumprmt.c 5.11 (Berkeley) 3/7/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumprmt.c,v 1.3 1993/09/13 21:25:12 rgrimes Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumprmt.c,v 1.3 1993/09/13 21:25:12 rgrimes Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/dumptape.c b/sbin/dump/dumptape.c
index 952e586ee508..52992ecf8117 100644
--- a/sbin/dump/dumptape.c
+++ b/sbin/dump/dumptape.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)dumptape.c 5.18 (Berkeley) 4/24/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumptape.c,v 1.2 1993/07/22 16:49:19 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumptape.c,v 1.2 1993/07/22 16:49:19 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/dumptraverse.c b/sbin/dump/dumptraverse.c
index 75a74418f84f..e1d6373e8ad5 100644
--- a/sbin/dump/dumptraverse.c
+++ b/sbin/dump/dumptraverse.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)dumptraverse.c 5.11 (Berkeley) 3/7/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/dumptraverse.c,v 1.2 1993/07/22 16:49:20 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/dumptraverse.c,v 1.2 1993/07/22 16:49:20 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/dump/pathnames.h b/sbin/dump/pathnames.h
index 5e2e620bdcfd..e3a37f4dc4ae 100644
--- a/sbin/dump/pathnames.h
+++ b/sbin/dump/pathnames.h
@@ -32,7 +32,7 @@
*
* @(#)pathnames.h 5.6 (Berkeley) 2/28/91
*
- * $Header: /a/cvs/386BSD/src/sbin/dump/pathnames.h,v 1.2 1993/07/22 16:49:21 jkh Exp $
+ * $Header: /home/cvs/386BSD/src/sbin/dump/pathnames.h,v 1.2 1993/07/22 16:49:21 jkh Exp $
*/
#include <paths.h>
diff --git a/sbin/dump/rdump.8 b/sbin/dump/rdump.8
index 8a826241e6b5..acbfeab5367b 100644
--- a/sbin/dump/rdump.8
+++ b/sbin/dump/rdump.8
@@ -31,7 +31,7 @@
.\"
.\" @(#)rdump.8 6.3 (Berkeley) 3/16/91
.\"
-.\" $Header: /a/cvs/386BSD/src/sbin/dump/rdump.8,v 1.3 1993/09/13 21:25:13 rgrimes Exp $
+.\" $Header: /home/cvs/386BSD/src/sbin/dump/rdump.8,v 1.3.2.1 1994/05/01 16:06:53 jkh Exp $
.\"
.Dd March 16, 1991
.Dt RDUMP 8
diff --git a/sbin/dump/unctime.c b/sbin/dump/unctime.c
index c0f447e63dc9..ced65389135b 100644
--- a/sbin/dump/unctime.c
+++ b/sbin/dump/unctime.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)unctime.c 5.4 (Berkeley) 3/7/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/dump/unctime.c,v 1.2 1993/07/22 16:49:23 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/dump/unctime.c,v 1.2 1993/07/22 16:49:23 jkh Exp $";
#endif /* not lint */
#include <sys/types.h>
diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8
index 0c9fd82cc34d..5eb2deaa436d 100644
--- a/sbin/fdisk/fdisk.8
+++ b/sbin/fdisk/fdisk.8
@@ -104,7 +104,7 @@ The
program will enter a conversational mode.
This mode is designed not to change any data unless you explicitly tell it to.
.Nm
-selects defaults for its questions to guarantee the above behaviour.
+selects defaults for its questions to guarantee the above behavior.
.Pp
It displays each partition
and ask if you want to edit it.
diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile
index 5a613287f0a4..01f9b16ba4cb 100644
--- a/sbin/fsck/Makefile
+++ b/sbin/fsck/Makefile
@@ -1,11 +1,12 @@
-# @(#)Makefile 5.15 (Berkeley) 6/29/90
+# From: @(#)Makefile 5.15 (Berkeley) 6/29/90
#
-# $Header: /a/cvs/386BSD/src/sbin/fsck/Makefile,v 1.4 1993/07/26 22:47:35 nate Exp $
+# $Id: Makefile,v 1.5 1994/02/04 03:03:03 wollman Exp $
PROG= fsck
MAN8= fsck.8
SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
pass5.c preen.c setup.c utilities.c ufs_subr.c ufs_tables.c
.PATH: ${.CURDIR}/../../sys/ufs
+LDADD+= -lutil
.include <bsd.prog.mk>
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index 2403ac647ccb..ecc96c322b53 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -31,7 +31,7 @@
.\"
.\" @(#)fsck.8 6.9 (Berkeley) 4/20/91
.\"
-.\" $Header: /a/cvs/386BSD/src/sbin/fsck/fsck.8,v 1.2 1993/07/22 16:51:48 jkh Exp $
+.\" $Header: /home/cvs/386BSD/src/sbin/fsck/fsck.8,v 1.2.2.1 1994/05/01 16:06:58 jkh Exp $
.\"
.TH FSCK 8 "April 20, 1991"
.UC 4
diff --git a/sbin/fsck/fsck.h b/sbin/fsck/fsck.h
index 48d3739d099c..503795709c9d 100644
--- a/sbin/fsck/fsck.h
+++ b/sbin/fsck/fsck.h
@@ -32,7 +32,7 @@
*
* @(#)fsck.h 5.17 (Berkeley) 7/27/90
*
- * $Header: /a/cvs/386BSD/src/sbin/fsck/fsck.h,v 1.2 1993/07/22 16:51:49 jkh Exp $
+ * $Header: /home/cvs/386BSD/src/sbin/fsck/fsck.h,v 1.2 1993/07/22 16:51:49 jkh Exp $
*/
#define MAXDUP 10 /* limit on dup blks (per inode) */
diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c
index 3a2bd69f98c7..1c82e41c4bda 100644
--- a/sbin/fsck/inode.c
+++ b/sbin/fsck/inode.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)inode.c 5.18 (Berkeley) 3/19/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/inode.c,v 1.2 1993/07/22 16:51:50 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/inode.c,v 1.2 1993/07/22 16:51:50 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/main.c b/sbin/fsck/main.c
index 68c5dff3021a..69462d081abc 100644
--- a/sbin/fsck/main.c
+++ b/sbin/fsck/main.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
static char sccsid[] = "@(#)main.c 5.27 (Berkeley) 8/7/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/main.c,v 1.2 1993/07/22 16:51:51 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/main.c,v 1.3 1994/02/04 03:03:05 wollman Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -275,9 +275,10 @@ checkfilesys(filesys, mntpt, auxdata, child)
if (!fsmodified)
return (0);
if (!preen) {
+ extern char *_osname();
printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
if (hotroot)
- printf("\n***** REBOOT UNIX *****\n");
+ printf("\n***** REBOOT %s *****\n", _osname());
}
if (hotroot) {
sync();
diff --git a/sbin/fsck/pass1.c b/sbin/fsck/pass1.c
index 981a94ef9a12..0bad23b11e8d 100644
--- a/sbin/fsck/pass1.c
+++ b/sbin/fsck/pass1.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass1.c 5.16 (Berkeley) 3/19/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass1.c,v 1.2 1993/07/22 16:51:52 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass1.c,v 1.2 1993/07/22 16:51:52 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/pass1b.c b/sbin/fsck/pass1b.c
index a02b93b70e06..0be463ed1741 100644
--- a/sbin/fsck/pass1b.c
+++ b/sbin/fsck/pass1b.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass1b.c 5.8 (Berkeley) 7/20/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass1b.c,v 1.2 1993/07/22 16:51:54 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass1b.c,v 1.2 1993/07/22 16:51:54 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/pass2.c b/sbin/fsck/pass2.c
index 73fe9b34fd31..335fdb1bbbea 100644
--- a/sbin/fsck/pass2.c
+++ b/sbin/fsck/pass2.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass2.c 5.17 (Berkeley) 12/28/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass2.c,v 1.2 1993/07/22 16:51:55 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass2.c,v 1.2 1993/07/22 16:51:55 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/pass3.c b/sbin/fsck/pass3.c
index a26ac4391c1b..4fbd3d65e342 100644
--- a/sbin/fsck/pass3.c
+++ b/sbin/fsck/pass3.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass3.c 5.10 (Berkeley) 6/1/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass3.c,v 1.2 1993/07/22 16:51:56 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass3.c,v 1.2 1993/07/22 16:51:56 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/pass4.c b/sbin/fsck/pass4.c
index 91f2dbc5cdf0..be121eac0fa6 100644
--- a/sbin/fsck/pass4.c
+++ b/sbin/fsck/pass4.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass4.c 5.10 (Berkeley) 7/20/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass4.c,v 1.2 1993/07/22 16:51:57 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass4.c,v 1.2 1993/07/22 16:51:57 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/pass5.c b/sbin/fsck/pass5.c
index fc27bf35cea9..475b9a15ed85 100644
--- a/sbin/fsck/pass5.c
+++ b/sbin/fsck/pass5.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)pass5.c 5.13 (Berkeley) 7/20/90";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/pass5.c,v 1.2 1993/07/22 16:51:58 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/pass5.c,v 1.2 1993/07/22 16:51:58 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index 9109dcbb77bc..48ba869ae5b3 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)preen.c 5.7 (Berkeley) 3/19/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/preen.c,v 1.2 1993/07/22 16:51:59 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/preen.c,v 1.2 1993/07/22 16:51:59 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck/setup.c b/sbin/fsck/setup.c
index 0975145a03f0..9f10ccb5b63a 100644
--- a/sbin/fsck/setup.c
+++ b/sbin/fsck/setup.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)setup.c 5.33 (Berkeley) 2/22/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/setup.c,v 1.2 1993/07/22 16:52:00 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/setup.c,v 1.2 1993/07/22 16:52:00 jkh Exp $";
#endif /* not lint */
#define DKTYPENAMES
diff --git a/sbin/fsck/utilities.c b/sbin/fsck/utilities.c
index 420924221bef..85b67288b52b 100644
--- a/sbin/fsck/utilities.c
+++ b/sbin/fsck/utilities.c
@@ -33,7 +33,7 @@
#ifndef lint
static char sccsid[] = "@(#)utilities.c 5.30 (Berkeley) 7/26/91";
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/fsck/utilities.c,v 1.2 1993/07/22 16:52:01 jkh Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/fsck/utilities.c,v 1.2 1993/07/22 16:52:01 jkh Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/ft/Makefile b/sbin/ft/Makefile
new file mode 100644
index 000000000000..41acb7b37fb9
--- /dev/null
+++ b/sbin/ft/Makefile
@@ -0,0 +1,7 @@
+# $Id: Makefile,v 1.2 1994/02/07 08:40:16 rgrimes Exp $
+
+PROG= ft
+MAN8= ft.8
+SRCS= ft.c ftecc.c
+
+.include <bsd.prog.mk>
diff --git a/sbin/ft/ft.8 b/sbin/ft/ft.8
new file mode 100644
index 000000000000..477f09b36d28
--- /dev/null
+++ b/sbin/ft/ft.8
@@ -0,0 +1,86 @@
+.\" Copyright (c) 1980, 1989, 1991 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.
+.\"
+.\" @(#)ft.8
+.\"
+.Dd February 7, 1994
+.Dt FT 8
+.Os BSD 4
+.Sh NAME
+.Nm ft
+.Nd QIC 40/80 floppy tape drive controller
+.Sh SYNOPSIS
+.Nm ft
+.Op Fl f Ar tape
+.Op Fl description
+.Sh DESCRIPTION
+The
+.Nm ft
+command allows multi-volume dump, extract, and view of tape labels, for
+any pre-formatted QIC-40/80 tapes. It is totally system dependent,
+and has nothing to do with the QIC standards.
+.Pp
+.Nm ft
+is used primarily as a filter for tape i/o.
+For example, to save and compress the /usr directory to tape:
+.Bd -literal -offset indent
+% tar cvzf - /usr | ft "/usr save"
+.Ed
+.Pp
+To extract /usr from tape:
+.Bd -literal -offset indent
+% ft | tar xvzf -
+.Ed
+.Sh SEE ALSO
+.Xr qtar 1
+.Sh BUGS
+Formatting/Verifying is in the works. You will need to use your
+existing backup program to do this for the time being.
+.Sh NOTES
+The floppy tape driver supports tape drives such as the Colorado
+Jumbo, Mountain Summit Express, some Archive/Conner models, and
+probably many others. These tape drives attach between your floppy
+disk controller card and your existing floppy disks' ribbon cable.
+This driver does not currently support attachments via a proprietary
+tape controller card or by the parallel port.
+.Pp
+QIC-40/80 drives are more CPU intensive than a SCSI drive. This is
+really only a factor if your machine is networked or has multiple concurrent
+users. For personal use (i.e. your typical home Unix user), response time
+is perfectly acceptable. The tape drives cannot detect write errors.
+Instead, they make up for it by using CRC's, error correction, and bad
+spot mapping. Formatting time is extremely long because of this. The
+drive makes a first pass over the entire tape writing out sectors. It
+then makes a second pass at a slower rate than usual (for sensitivity)
+to detect bad spots on the tape. Typically it takes an hour to format
+a single QIC-80 (120Mb uncompressed) tape.
+.Sh AUTHOR
+Steve Gerakines <steve2@genesis.nred.ma.us>
diff --git a/sbin/ft/ft.c b/sbin/ft/ft.c
new file mode 100644
index 000000000000..4aa92f81625f
--- /dev/null
+++ b/sbin/ft/ft.c
@@ -0,0 +1,432 @@
+/*
+ * Copyright (c) 1993 Steve Gerakines
+ *
+ * This is freely redistributable software. You may do anything you
+ * wish with it, so long as the above notice stays intact.
+ *
+ * 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.
+ *
+ * ft.c - simple floppy tape filter
+ *
+ * 01/28/94 v0.3b (Jim Babb)
+ * Fixed bug when all sectors in a segment are marked bad.
+ *
+ * 10/30/93 v0.3
+ * Minor revisions. Seems pretty stable.
+ *
+ * 09/02/93 v0.2 pl01
+ * Initial revision.
+ *
+ * usage: ftfilt [ -f tape ] [ description ]
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/ftape.h>
+
+#define DEFQIC "/dev/rft0"
+
+char buff[QCV_SEGSIZE]; /* scratch buffer */
+char hbuff[QCV_SEGSIZE]; /* header buffer */
+QIC_Header *hptr = (QIC_Header *)hbuff; /* header structure */
+int hsn = -1; /* segment number of header */
+int dhsn = -1; /* segment number of duplicate header */
+int tfd; /* tape file descriptor */
+QIC_Geom geo; /* tape geometry */
+int tvno = 1; /* tape volume number */
+int tvlast; /* TRUE if last volume in set */
+long tvsize = 0; /* tape volume size in bytes */
+long tvtime = NULL; /* tape change time */
+char *tvnote = ""; /* tape note */
+
+/* Lookup the badmap for a given track and segment. */
+#define BADMAP(t,s) hptr->qh_badmap[(t)*geo.g_segtrk+(s)]
+
+/* Retrieve values from a character array. */
+#define UL_VAL(s,p) (*((ULONG *)&(s)[p]))
+#define US_VAL(s,p) (*((USHORT *)&(s)[p]))
+
+#define equal(s1,s2) (strcmp(s1, s2) == 0)
+
+
+
+/* Entry */
+main(int argc, char *argv[])
+{
+ int r, s;
+ char *tape, *getenv();
+
+ if (argc > 2 && (equal(argv[1], "-t") || equal(argv[1], "-f"))) {
+ argc -= 2;
+ tape = argv[2];
+ argv += 2;
+ } else
+ if ((tape = getenv("TAPE")) == NULL)
+ tape = DEFQIC;
+ if (argc > 1) {
+ tvnote = argv[1];
+ if (strlen(tvnote) > 18) argv[1][18] = '\0';
+ }
+
+ /* Open the tape device */
+ if ((tfd = open(tape, 2)) < 0) {
+ perror(tape);
+ exit(1);
+ }
+
+ if (!isatty(0))
+ do_write();
+ else if (!isatty(1))
+ do_read();
+ else
+ do_getname();
+
+ close(tfd);
+ exit(0);
+}
+
+
+/* Check status of tape drive */
+int check_stat(int fd, int wr)
+{
+ int r, s;
+ int sawit = 0;
+
+ /* get tape status */
+ if (ioctl(fd, QIOSTATUS, &s) < 0) {
+ fprintf(stderr, "could not get drive status\n");
+ return(1);
+ }
+
+ /* wait for the tape drive to become ready */
+ while ((s & QS_READY) == 0) {
+ if (!sawit) {
+ fprintf(stderr, "waiting for drive to become ready...\n");
+ sawit = 1;
+ }
+ sleep(2);
+ if (ioctl(fd, QIOSTATUS, &s) < 0) {
+ fprintf(stderr, "could not get drive status\n");
+ return(1);
+ }
+ }
+
+ if ((s & QS_FMTOK) == 0) {
+ fprintf(stderr, "tape is not formatted\n");
+ return(2);
+ }
+
+ if (wr && (s & QS_RDONLY) != 0) {
+ fprintf(stderr, "tape is write protected\n");
+ return(3);
+ }
+
+ return(0);
+}
+
+
+
+ULONG qtimeval(time_t t)
+{
+ struct tm *tp;
+ ULONG r;
+
+ tp = localtime(&t);
+ r = 2678400 * tp->tm_mon +
+ 86400 *(tp->tm_mday-1) +
+ 3600 * tp->tm_hour +
+ 60 * tp->tm_min +
+ tp->tm_sec;
+ r |= (tp->tm_year - 70) << 25;
+ return(r);
+}
+
+/* Return tm struct from QIC date format. */
+struct tm *qtime(UCHAR *qt)
+{
+ ULONG *vp = (ULONG *)qt;
+ struct tm t;
+ ULONG v;
+ time_t tv;
+
+ v = *vp;
+ t.tm_year = ((v >> 25) & 0x7f)+70; v &= 0x1ffffff;
+ t.tm_mon = v / 2678400; v %= 2678400;
+ t.tm_mday = v / 86400 + 1; v %= 86400;
+ t.tm_hour = v / 3600; v %= 3600;
+ t.tm_min = v / 60; v %= 60;
+ t.tm_sec = v;
+ t.tm_wday = 0; /* XXX - let mktime do the real work */
+ t.tm_yday = 0;
+ t.tm_isdst = 0;
+ t.tm_gmtoff = 0;
+ t.tm_zone = NULL;
+ tv = mktime(&t);
+ return(localtime(&tv));
+}
+
+/* Return a string, zero terminated */
+char *qstr(char *str, int nchar)
+{
+ static char tstr[256];
+ strncpy(tstr, str, nchar);
+ tstr[nchar] = '\0';
+ return(tstr);
+}
+
+/* Read header from tape */
+get_header(int fd)
+{
+ int r, sn, bytes;
+ QIC_Segment s;
+ int gothdr = 0;
+
+ if (ioctl(fd, QIOGEOM, &geo) < 0) {
+ fprintf(stderr, "couldn't determine tape geometry\n");
+ return(1);
+ }
+
+ /* Get the header and duplicate */
+ for (sn = 0; sn < 16; sn++) {
+ s.sg_trk = 0;
+ s.sg_seg = sn;
+ s.sg_badmap = 0;
+ s.sg_data = (UCHAR *)&buff[0];
+ ioctl(fd, QIOREAD, &s);
+ r = check_parity(s.sg_data, 0, s.sg_crcmap);
+ if (s.sg_data[0] == 0x55 && s.sg_data[1] == 0xaa &&
+ s.sg_data[2] == 0x55 && s.sg_data[3] == 0xaa) {
+ if (hsn >= 0) {
+ dhsn = sn;
+ if (!r && !gothdr) {
+ fprintf(stderr, "using secondary header\n");
+ bcopy(s.sg_data, hbuff, QCV_SEGSIZE);
+ gothdr = 1;
+ }
+ break;
+ }
+ hsn = sn;
+ if (!r) {
+ bcopy(s.sg_data, hbuff, QCV_SEGSIZE);
+ gothdr = 1;
+ } else {
+ fprintf(stderr, "too many errors in primary header\n");
+ }
+ }
+ }
+
+ if (!gothdr) {
+ fprintf(stderr, "couldn't read header segment\n");
+ ioctl(fd, QIOREWIND);
+ return(1);
+ }
+
+ return(0);
+}
+
+
+ask_vol(int vn)
+{
+ FILE *inp;
+ int fd;
+ char c;
+
+ if ((fd = open("/dev/tty", 2)) < 0) {
+ fprintf(stderr, "argh!! can't open /dev/tty\n");
+ exit(1);
+ }
+
+ fprintf(stderr, "Insert ftfilt volume %02d and press enter:", vn);
+ read(fd, &c, 1);
+ close(fd);
+}
+
+
+/* Return the name of the tape only. */
+do_getname()
+{
+ if (check_stat(tfd, 0)) exit(1);
+ if (get_header(tfd)) exit(1);
+ fprintf(stderr, "\"%s\" - %s",
+ qstr(hptr->qh_tname,44), asctime(qtime(hptr->qh_chgdate)));
+ ioctl(tfd, QIOREWIND);
+}
+
+
+/* Extract data from tape to stdout */
+do_read()
+{
+ int sno, vno, sbytes, r;
+ long curpos;
+ char *hname;
+ QIC_Segment s;
+
+ /* Process multiple volumes if necessary */
+ vno = 1;
+ for (;;) {
+ if (check_stat(tfd, 0)) {
+ ask_vol(vno);
+ continue;
+ }
+ if (get_header(tfd)) {
+ ask_vol(vno);
+ continue;
+ }
+
+ /* extract volume and header info from label */
+ hname = hptr->qh_tname;
+ hname[43] = '\0';
+ tvno = atoi(&hname[11]);
+ tvlast = (hname[10] == '*') ? 1 : 0;
+ tvsize = atoi(&hname[14]);
+ tvnote = &hname[25];
+ if (vno != tvno || strncmp(hname, "ftfilt", 6) != 0) {
+ fprintf(stderr, "Incorrect volume inserted. This tape is:\n");
+ fprintf(stderr,"\"%s\" - %s\n", hname,
+ asctime(qtime(hptr->qh_chgdate)));
+ ask_vol(vno);
+ continue;
+ }
+
+ /* Process this volume */
+ curpos = 0;
+ for (sno = hptr->qh_first; tvsize > 0; sno++) {
+ s.sg_trk = sno / geo.g_segtrk;
+ s.sg_seg = sno % geo.g_segtrk;
+ s.sg_badmap = BADMAP(s.sg_trk,s.sg_seg);
+ sbytes = sect_bytes(s.sg_badmap) - QCV_ECCSIZE;
+ s.sg_data = (UCHAR *)&buff[0];
+
+ /* skip segments with *all* sectors flagged as bad */
+ if (sbytes > 0) {
+ if (ioctl(tfd, QIOREAD, &s) < 0) perror("QIOREAD");
+ r = check_parity(s.sg_data, s.sg_badmap, s.sg_crcmap);
+ if (r) fprintf(stderr, "** warning: ecc failed at byte %ld\n",
+ curpos);
+ if (tvsize < sbytes) sbytes = tvsize;
+ write(1, s.sg_data, sbytes);
+ tvsize -= sbytes;
+ curpos += sbytes;
+ }
+ }
+ if (tvlast) break;
+ ioctl(tfd, QIOREWIND);
+ ask_vol(++vno);
+ }
+ ioctl(tfd, QIOREWIND);
+ return(0);
+}
+
+
+/* Dump data from stdin to tape */
+do_write()
+{
+ int sno, vno, amt, sbytes;
+ int c, maxseg, r;
+ ULONG qnow;
+ QIC_Segment s;
+ char tmpstr[80];
+
+ qnow = qtimeval(time(NULL));
+ vno = 1;
+
+ for (;;) {
+ if (check_stat(tfd, 1)) {
+ ask_vol(vno);
+ continue;
+ }
+ if (get_header(tfd)) {
+ ask_vol(vno);
+ continue;
+ }
+
+ maxseg = geo.g_segtrk * geo.g_trktape - 1;
+ sno = hptr->qh_first;
+ tvno = vno;
+ tvsize = 0;
+ tvlast = 0;
+
+ /* Process until end of volume or end of data */
+ for (sno = hptr->qh_first; sno < maxseg && tvlast == 0; ++sno) {
+ /* Prepare to load the next segment */
+ s.sg_trk = sno / geo.g_segtrk;
+ s.sg_seg = sno % geo.g_segtrk;
+ s.sg_badmap = BADMAP(s.sg_trk,s.sg_seg);
+ sbytes = sect_bytes(s.sg_badmap) - QCV_ECCSIZE;
+ s.sg_data = (UCHAR *)&buff[0];
+
+ /* Ugh. Loop to get the full amt. */
+ for (amt = 0; amt < sbytes; amt += r) {
+ r = read(0, &s.sg_data[amt], sbytes - amt);
+ if (r <= 0) {
+ tvlast = 1;
+ break;
+ }
+ }
+ /* skip the segment if *all* sectors are flagged as bad */
+ if (amt) {
+ if (amt < sbytes)
+ bzero(&s.sg_data[amt], sbytes - amt);
+ r = set_parity(s.sg_data, s.sg_badmap);
+ if (r) fprintf(stderr, "** warning: ecc problem !!\n");
+ if (ioctl(tfd, QIOWRITE, &s) < 0) {
+ perror("QIOWRITE");
+ exit(1);
+ }
+ tvsize += amt;
+ }
+ }
+
+ /* Build new header info */
+ /* ftfilt vol*xx yyyyyyyyyy note56789012345678 */
+ /* 01234567890123456789012345678901234567890123 */
+
+ sprintf(tmpstr, "ftfilt vol%s%02d %010d %s",
+ (tvlast) ? "*" : " ", tvno, tvsize, tvnote);
+ strncpy(hptr->qh_tname, tmpstr, 44);
+ UL_VAL(hptr->qh_chgdate,0) = qnow;
+
+ /* Update the header for this volume */
+ if (hsn >= 0) {
+ s.sg_trk = hsn / geo.g_segtrk;
+ s.sg_seg = hsn % geo.g_segtrk;
+ s.sg_badmap = 0;
+ s.sg_data = (UCHAR *)hbuff;
+ r = set_parity(s.sg_data, s.sg_badmap);
+ if (r) fprintf(stderr, "** warning: header ecc problem !!\n");
+ if (ioctl(tfd, QIOWRITE, &s) < 0) {
+ perror("QIOWRITE");
+ exit(1);
+ }
+ }
+ if (dhsn >= 0) {
+ s.sg_trk = dhsn / geo.g_segtrk;
+ s.sg_seg = dhsn % geo.g_segtrk;
+ s.sg_badmap = 0;
+ s.sg_data = (UCHAR *)hbuff;
+ r = set_parity(s.sg_data, s.sg_badmap);
+ if (r) fprintf(stderr, "** warning: duphdr ecc problem !!\n");
+ if (ioctl(tfd, QIOWRITE, &s) < 0) {
+ perror("QIOWRITE");
+ exit(1);
+ }
+ }
+ ioctl(tfd, QIOREWIND);
+ if (tvlast) break;
+ ask_vol(++vno);
+ }
+ return(0);
+}
diff --git a/sbin/ft/ftecc.c b/sbin/ft/ftecc.c
new file mode 100644
index 000000000000..430f3a8316bb
--- /dev/null
+++ b/sbin/ft/ftecc.c
@@ -0,0 +1,316 @@
+/*
+ * ftecc.c 10/30/93 v0.3
+ * Handle error correction for floppy tape drives.
+ *
+ * File contents are copyrighted by David L. Brown and falls under the
+ * terms of the GPL version 2 or greater. See his original release for
+ * the specific terms.
+ *
+ * Steve Gerakines
+ * steve2@genesis.nred.ma.us
+ * Modified slightly to fit with my tape driver. I'm not at all happy
+ * with this module and will have it replaced with a more functional one
+ * in the next release(/RSN). I am close, but progress will continue to
+ * be slow until I can find a book on the subject where the translator
+ * understands both the to and from languages. :-( For now it will
+ * suffice.
+ */
+#include <sys/ftape.h>
+
+/*
+ * In order to speed up the correction and adjustment, we can compute
+ * a matrix of coefficients for the multiplication.
+ */
+struct inv_mat {
+ UCHAR log_denom; /* The log z of the denominator. */
+ UCHAR zs[3][3]; /* The coefficients for the adjustment matrix. */
+};
+
+/* This array is a table of powers of x, from 0 to 254. */
+static UCHAR alpha_power[] = {
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+ 0x87, 0x89, 0x95, 0xad, 0xdd, 0x3d, 0x7a, 0xf4,
+ 0x6f, 0xde, 0x3b, 0x76, 0xec, 0x5f, 0xbe, 0xfb,
+ 0x71, 0xe2, 0x43, 0x86, 0x8b, 0x91, 0xa5, 0xcd,
+ 0x1d, 0x3a, 0x74, 0xe8, 0x57, 0xae, 0xdb, 0x31,
+ 0x62, 0xc4, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, 0x67,
+ 0xce, 0x1b, 0x36, 0x6c, 0xd8, 0x37, 0x6e, 0xdc,
+ 0x3f, 0x7e, 0xfc, 0x7f, 0xfe, 0x7b, 0xf6, 0x6b,
+ 0xd6, 0x2b, 0x56, 0xac, 0xdf, 0x39, 0x72, 0xe4,
+ 0x4f, 0x9e, 0xbb, 0xf1, 0x65, 0xca, 0x13, 0x26,
+ 0x4c, 0x98, 0xb7, 0xe9, 0x55, 0xaa, 0xd3, 0x21,
+ 0x42, 0x84, 0x8f, 0x99, 0xb5, 0xed, 0x5d, 0xba,
+ 0xf3, 0x61, 0xc2, 0x03, 0x06, 0x0c, 0x18, 0x30,
+ 0x60, 0xc0, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0,
+ 0x47, 0x8e, 0x9b, 0xb1, 0xe5, 0x4d, 0x9a, 0xb3,
+ 0xe1, 0x45, 0x8a, 0x93, 0xa1, 0xc5, 0x0d, 0x1a,
+ 0x34, 0x68, 0xd0, 0x27, 0x4e, 0x9c, 0xbf, 0xf9,
+ 0x75, 0xea, 0x53, 0xa6, 0xcb, 0x11, 0x22, 0x44,
+ 0x88, 0x97, 0xa9, 0xd5, 0x2d, 0x5a, 0xb4, 0xef,
+ 0x59, 0xb2, 0xe3, 0x41, 0x82, 0x83, 0x81, 0x85,
+ 0x8d, 0x9d, 0xbd, 0xfd, 0x7d, 0xfa, 0x73, 0xe6,
+ 0x4b, 0x96, 0xab, 0xd1, 0x25, 0x4a, 0x94, 0xaf,
+ 0xd9, 0x35, 0x6a, 0xd4, 0x2f, 0x5e, 0xbc, 0xff,
+ 0x79, 0xf2, 0x63, 0xc6, 0x0b, 0x16, 0x2c, 0x58,
+ 0xb0, 0xe7, 0x49, 0x92, 0xa3, 0xc1, 0x05, 0x0a,
+ 0x14, 0x28, 0x50, 0xa0, 0xc7, 0x09, 0x12, 0x24,
+ 0x48, 0x90, 0xa7, 0xc9, 0x15, 0x2a, 0x54, 0xa8,
+ 0xd7, 0x29, 0x52, 0xa4, 0xcf, 0x19, 0x32, 0x64,
+ 0xc8, 0x17, 0x2e, 0x5c, 0xb8, 0xf7, 0x69, 0xd2,
+ 0x23, 0x46, 0x8c, 0x9f, 0xb9, 0xf5, 0x6d, 0xda,
+ 0x33, 0x66, 0xcc, 0x1f, 0x3e, 0x7c, 0xf8, 0x77,
+ 0xee, 0x5b, 0xb6, 0xeb, 0x51, 0xa2, 0xc3
+};
+
+/*
+ * This is the reverse lookup table. There is no log of 0, so the
+ * first element is not valid.
+ */
+static UCHAR alpha_log[] = {
+ 0xff, 0x00, 0x01, 0x63, 0x02, 0xc6, 0x64, 0x6a,
+ 0x03, 0xcd, 0xc7, 0xbc, 0x65, 0x7e, 0x6b, 0x2a,
+ 0x04, 0x8d, 0xce, 0x4e, 0xc8, 0xd4, 0xbd, 0xe1,
+ 0x66, 0xdd, 0x7f, 0x31, 0x6c, 0x20, 0x2b, 0xf3,
+ 0x05, 0x57, 0x8e, 0xe8, 0xcf, 0xac, 0x4f, 0x83,
+ 0xc9, 0xd9, 0xd5, 0x41, 0xbe, 0x94, 0xe2, 0xb4,
+ 0x67, 0x27, 0xde, 0xf0, 0x80, 0xb1, 0x32, 0x35,
+ 0x6d, 0x45, 0x21, 0x12, 0x2c, 0x0d, 0xf4, 0x38,
+ 0x06, 0x9b, 0x58, 0x1a, 0x8f, 0x79, 0xe9, 0x70,
+ 0xd0, 0xc2, 0xad, 0xa8, 0x50, 0x75, 0x84, 0x48,
+ 0xca, 0xfc, 0xda, 0x8a, 0xd6, 0x54, 0x42, 0x24,
+ 0xbf, 0x98, 0x95, 0xf9, 0xe3, 0x5e, 0xb5, 0x15,
+ 0x68, 0x61, 0x28, 0xba, 0xdf, 0x4c, 0xf1, 0x2f,
+ 0x81, 0xe6, 0xb2, 0x3f, 0x33, 0xee, 0x36, 0x10,
+ 0x6e, 0x18, 0x46, 0xa6, 0x22, 0x88, 0x13, 0xf7,
+ 0x2d, 0xb8, 0x0e, 0x3d, 0xf5, 0xa4, 0x39, 0x3b,
+ 0x07, 0x9e, 0x9c, 0x9d, 0x59, 0x9f, 0x1b, 0x08,
+ 0x90, 0x09, 0x7a, 0x1c, 0xea, 0xa0, 0x71, 0x5a,
+ 0xd1, 0x1d, 0xc3, 0x7b, 0xae, 0x0a, 0xa9, 0x91,
+ 0x51, 0x5b, 0x76, 0x72, 0x85, 0xa1, 0x49, 0xeb,
+ 0xcb, 0x7c, 0xfd, 0xc4, 0xdb, 0x1e, 0x8b, 0xd2,
+ 0xd7, 0x92, 0x55, 0xaa, 0x43, 0x0b, 0x25, 0xaf,
+ 0xc0, 0x73, 0x99, 0x77, 0x96, 0x5c, 0xfa, 0x52,
+ 0xe4, 0xec, 0x5f, 0x4a, 0xb6, 0xa2, 0x16, 0x86,
+ 0x69, 0xc5, 0x62, 0xfe, 0x29, 0x7d, 0xbb, 0xcc,
+ 0xe0, 0xd3, 0x4d, 0x8c, 0xf2, 0x1f, 0x30, 0xdc,
+ 0x82, 0xab, 0xe7, 0x56, 0xb3, 0x93, 0x40, 0xd8,
+ 0x34, 0xb0, 0xef, 0x26, 0x37, 0x0c, 0x11, 0x44,
+ 0x6f, 0x78, 0x19, 0x9a, 0x47, 0x74, 0xa7, 0xc1,
+ 0x23, 0x53, 0x89, 0xfb, 0x14, 0x5d, 0xf8, 0x97,
+ 0x2e, 0x4b, 0xb9, 0x60, 0x0f, 0xed, 0x3e, 0xe5,
+ 0xf6, 0x87, 0xa5, 0x17, 0x3a, 0xa3, 0x3c, 0xb7
+};
+
+/* Return number of sectors available in a segment. */
+int sect_count(ULONG badmap)
+{
+ int i, amt;
+
+ for (amt = QCV_BLKSEG, i = 0; i < QCV_BLKSEG; i++)
+ if (badmap & (1 << i)) amt--;
+ return(amt);
+}
+
+/* Return number of bytes available in a segment. */
+int sect_bytes(ULONG badmap)
+{
+ int i, amt;
+
+ for (amt = QCV_SEGSIZE, i = 0; i < QCV_BLKSEG; i++)
+ if (badmap & (1 << i)) amt -= QCV_BLKSIZE;
+ return(amt);
+}
+
+/* Multiply two numbers in the field. */
+static UCHAR multiply(UCHAR a, UCHAR b)
+{
+ int tmp;
+
+ if (a == 0 || b == 0) return(0);
+ tmp = (alpha_log[a] + alpha_log[b]);
+ if (tmp > 254) tmp -= 255;
+ return (alpha_power[tmp]);
+}
+
+static UCHAR divide(UCHAR a, UCHAR b)
+{
+ int tmp;
+
+ if (a == 0 || b == 0) return(0);
+ tmp = (alpha_log[a] - alpha_log[b]);
+ if (tmp < 0) tmp += 255;
+ return (alpha_power[tmp]);
+}
+
+/*
+ * This is just like divide, except we have already looked up the log
+ * of the second number.
+ */
+static UCHAR divide_out(UCHAR a, UCHAR b)
+{
+ int tmp;
+
+ if (a == 0) return 0;
+ tmp = alpha_log[a] - b;
+ if (tmp < 0) tmp += 255;
+ return (alpha_power[tmp]);
+}
+
+/* This returns the value z^{a-b}. */
+static UCHAR z_of_ab(UCHAR a, UCHAR b)
+{
+ int tmp = (int)a - (int)b;
+
+ if (tmp < 0)
+ tmp += 255;
+ else if (tmp >= 255)
+ tmp -= 255;
+ return(alpha_power[tmp]);
+}
+
+/* Calculate the inverse matrix. Returns 1 if the matrix is valid, or
+ * zero if there is no inverse. The i's are the indices of the bytes
+ * to be corrected.
+ */
+static int calculate_inverse (int *pblk, struct inv_mat *inv)
+{
+ /* First some variables to remember some of the results. */
+ UCHAR z20, z10, z21, z12, z01, z02;
+ UCHAR i0, i1, i2;
+
+ i0 = pblk[0]; i1 = pblk[1]; i2 = pblk[2];
+
+ z20 = z_of_ab (i2, i0); z10 = z_of_ab (i1, i0);
+ z21 = z_of_ab (i2, i1); z12 = z_of_ab (i1, i2);
+ z01 = z_of_ab (i0, i1); z02 = z_of_ab (i0, i2);
+ inv->log_denom = (z20 ^ z10 ^ z21 ^ z12 ^ z01 ^ z02);
+ if (inv->log_denom == 0) return 0;
+ inv->log_denom = alpha_log[inv->log_denom];
+
+ /* Calculate all of the coefficients on the top. */
+ inv->zs[0][0] = alpha_power[i1] ^ alpha_power[i2];
+ inv->zs[0][1] = z21 ^ z12;
+ inv->zs[0][2] = alpha_power[255-i1] ^ alpha_power[255-i2];
+
+ inv->zs[1][0] = alpha_power[i0] ^ alpha_power[i2];
+ inv->zs[1][1] = z20 ^ z02;
+ inv->zs[1][2] = alpha_power[255-i0] ^ alpha_power[255-i2];
+
+ inv->zs[2][0] = alpha_power[i0] ^ alpha_power[i1];
+ inv->zs[2][1] = z10 ^ z01;
+ inv->zs[2][2] = alpha_power[255-i0] ^ alpha_power[255-i1];
+ return(1);
+}
+
+/*
+ * Determine the error values for a given inverse matrix and syndromes.
+ */
+static void determine3(struct inv_mat *inv, UCHAR *es, UCHAR *ss)
+{
+ UCHAR tmp;
+ int i, j;
+
+ for (i = 0; i < 3; i++) {
+ tmp = 0;
+ for (j = 0; j < 3; j++) tmp ^= multiply (ss[j], inv->zs[i][j]);
+ es[i] = divide_out(tmp, inv->log_denom);
+ }
+}
+
+
+/*
+ * Compute the 3 syndrome values. The data pointer should point to
+ * the offset within the first block of the column to calculate. The
+ * count of blocks is in blocks. The three bytes will be placed in
+ * ss[0], ss[1], and ss[2].
+ */
+static void compute_syndromes(UCHAR *data, int nblks, int col, UCHAR *ss)
+{
+ int i;
+ UCHAR v;
+
+ ss[0] = 0; ss[1] = 0; ss[2] = 0;
+ for (i = (nblks-1)*QCV_BLKSIZE; i >= 0; i -= QCV_BLKSIZE) {
+ v = data[i+col];
+ if (ss[0] & 0x01) { ss[0] >>= 1; ss[0] ^= 0xc3; } else ss[0] >>= 1;
+ ss[0] ^= v;
+ ss[1] ^= v;
+ if (ss[2] & 0x80) { ss[2] <<= 1; ss[2] ^= 0x87; } else ss[2] <<= 1;
+ ss[2] ^= v;
+ }
+}
+
+/*
+ * Calculate the parity bytes for a segment. Returns 0 on success.
+ */
+int set_parity (UCHAR *data, ULONG badmap)
+{
+ int col;
+ struct inv_mat inv;
+ UCHAR ss[3], es[3];
+ int nblks, pblk[3];
+
+ nblks = sect_count(badmap);
+ pblk[0] = nblks-3; pblk[1] = nblks-2; pblk[2] = nblks-1;
+ if (!calculate_inverse(pblk, &inv)) return(1);
+
+ pblk[0] *= QCV_BLKSIZE; pblk[1] *= QCV_BLKSIZE; pblk[2] *= QCV_BLKSIZE;
+ for (col = 0; col < QCV_BLKSIZE; col++) {
+ compute_syndromes (data, nblks-3, col, ss);
+ determine3(&inv, es, ss);
+ data[pblk[0]+col] = es[0];
+ data[pblk[1]+col] = es[1];
+ data[pblk[2]+col] = es[2];
+ }
+ return(0);
+}
+
+
+/*
+ * Check and correct errors in a block. Returns 0 on success,
+ * 1 if failed.
+ */
+int check_parity(UCHAR *data, ULONG badmap, ULONG crcmap)
+{
+ int i, j, col, crcerrs, r, tries, nblks;
+ struct inv_mat inv;
+ UCHAR ss[3], es[3];
+ int i1, i2, eblk[3];
+
+ nblks = sect_count(badmap);
+ crcerrs = 0;
+ for (i = 0; crcerrs < 3 && i < nblks; i++)
+ if (crcmap & (1 << i)) eblk[crcerrs++] = i;
+
+ for (i = 1, j = crcerrs; j < 3 && i < nblks; i++)
+ if ((crcmap & (1 << i)) == 0) eblk[j++] = i;
+
+ if (!calculate_inverse (eblk, &inv)) return(1);
+
+ eblk[0] *= QCV_BLKSIZE; eblk[1] *= QCV_BLKSIZE; eblk[2] *= QCV_BLKSIZE;
+ r = 0;
+ for (col = 0; col < QCV_BLKSIZE; col++) {
+ compute_syndromes (data, nblks, col, ss);
+
+ if (!ss[0] && !ss[1] && !ss[2]) continue;
+ if (crcerrs) {
+ determine3 (&inv, es, ss);
+ for (j = 0; j < crcerrs; j++)
+ data[eblk[j] + col] ^= es[j];
+ compute_syndromes (data, nblks, col, ss);
+ if (!ss[0] && !ss[1] && !ss[2]) {
+ r = 1;
+ continue;
+ }
+ }
+ determine3 (&inv, es, ss);
+ i1 = alpha_log[divide(ss[2], ss[1])];
+ i2 = alpha_log[divide(ss[1], ss[0])];
+ if (i1 != i2 || ((QCV_BLKSIZE * i1) + col) > QCV_SEGSIZE)
+ r = 1;
+ else
+ data[QCV_BLKSIZE * i1 + col] ^= ss[1];
+ }
+
+ return(r);
+}
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index f09bfa029cae..4499bb44d2c3 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -130,6 +130,22 @@ Internet
addresses and 10Mb/s Ethernet addresses.
.It Fl arp
Disable the use of the Address Resolution Protocol.
+.It Cm altphys
+Instruct the adapter to use a physical network connection other than
+the default, such as the AUI port rather than a built-in transceiver.
+(See
+.Cm aui ,
+which is another name for the same flag, below.)
+.It Fl altphys
+Disable the use of the alternate physical network connection.
+.It Cm aui
+On certain Ethernet drivers, configures the adapter to use the AUI
+port rather than the default built-in transceiver. (See also
+.Cm altphys ) .
+.It Cm bnc
+On certain Ethernet drivers, configures the adapter to use the
+built-in transceiver rather than the AUI port. (See also
+.Cm Fl altphys ) .
.It Cm broadcast
(Inet only)
Specify the address to use to represent broadcasts to the
@@ -165,6 +181,20 @@ of the destination.
IP encapsulation of
.Tn CLNP
packets is done differently.
+.It Cm llc0
+Enable use of IEEE 802.2 LLC class 0. (Currently
+unimplemented.)
+.It Fl llc0
+Disable IEEE 802.2 LLC class 0. Not all interfaces may permit this,
+as most 802 networks have no alternative link layer other than 802.2.
+.It Cm llc1
+Enable use of IEEE 802.2 LLC class 1. (Currently unimplemented.)
+.It Fl llc1
+Disable use of IEEE 802.2 LLC class 1.
+.It Cm llc2
+Enable use of IEEE 802.2 LLC class 2. (Currently unimplemented.)
+.It Fl llc2
+Disable use of IEEE 802.2 LLC class 2.
.It Cm metric Ar n
Set the routing metric of the interface to
.Ar n ,
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 111b88eff98c..45a3628afe0e 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -30,16 +30,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
- * -------------------- ----- ----------------------
- * CURRENT PATCH LEVEL: 1 00102
- * -------------------- ----- ----------------------
- *
- * 06 Sep 92 Herb Peyerl Added "aui"/"bnc" options to ifconfig
- * for 3COM 3C503 port selection
- * 10 Mar 93 Rodney W. Grimes Made the aui/bnc more general, you now
- * also have llc[0-2] and -llc[0-2].
- * Added the rest of the output flag bits.
*/
#ifndef lint
@@ -50,6 +40,8 @@ char copyright[] =
#ifndef lint
static char sccsid[] = "@(#)ifconfig.c 5.1 (Berkeley) 2/28/91";
+static const char rcsid[] =
+ "$Id: ifconfig.c,v 1.6 1994/01/22 08:23:47 rgrimes Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -60,7 +52,6 @@ static char sccsid[] = "@(#)ifconfig.c 5.1 (Berkeley) 2/28/91";
#include <netinet/in.h>
#include <arpa/inet.h>
-#ifdef notdef
#define NSIP
#include <netns/ns.h>
#include <netns/ns_if.h>
@@ -68,7 +59,6 @@ static char sccsid[] = "@(#)ifconfig.c 5.1 (Berkeley) 2/28/91";
#define EON
#include <netiso/iso.h>
#include <netiso/iso_var.h>
-#endif
#include <netdb.h>
#include <sys/protosw.h>
@@ -118,8 +108,17 @@ struct cmd {
{ "-arp", IFF_NOARP, setifflags },
{ "debug", IFF_DEBUG, setifflags },
{ "-debug", -IFF_DEBUG, setifflags },
+#ifdef IFF_ALTPHYS
+ { "aui", IFF_ALTPHYS, setifflags },
+ { "bnc", -IFF_ALTPHYS, setifflags },
+ { "altphys", IFF_ALTPHYS, setifflags },
+ { "-altphys", -IFF_ALTPHYS, setifflags },
+#else
{ "aui", IFF_LLC0, setifflags }, /* 06 Sep 92*/
{ "bnc", -IFF_LLC0, setifflags },
+ { "altphys", IFF_LLC0, setifflags },
+ { "-altphys", -IFF_LLC0, setifflags },
+#endif
{ "llc0", IFF_LLC0, setifflags }, /* 10 Mar 93 */
{ "-llc0", -IFF_LLC0, setifflags },
{ "llc1", IFF_LLC1, setifflags },
@@ -242,6 +241,12 @@ main(argc, argv)
p++; /* got src, do dst */
if (p->c_func) {
if (p->c_parameter == NEXTARG) {
+ if (argv[1] == NULL) {
+ fprintf(stderr,
+ "ifconfig: '%s' requires argument.\n",
+ p->c_name);
+ exit(1);
+ }
(*p->c_func)(argv[1]);
argc--, argv++;
} else
@@ -348,7 +353,7 @@ setifdstaddr(addr, param)
setifflags(vname, value)
char *vname;
- short value;
+ int value;
{
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)");
@@ -384,10 +389,14 @@ setsnpaoffset(val)
#endif
}
+/*
+ * This is ok if IFF_ALTPHYS is not defined, since we can be sure of never
+ * seeing in in that case anyway.
+ */
#define IFFBITS \
"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\
\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LLC0\16LLC1\17LLC2\
-"
+\20ALTPHYS\21MULTICAST\22VIRTUAL"
/*
* Print the status of the interface. If an address family was
@@ -415,7 +424,6 @@ in_status(force)
int force;
{
struct sockaddr_in *sin;
- char *inet_ntoa();
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
if (ioctl(s, SIOCGIFADDR, (caddr_t)&ifr) < 0) {
@@ -558,8 +566,6 @@ iso_status(force)
Perror(cmd)
char *cmd;
{
- extern int errno;
-
fprintf(stderr, "ifconfig: ");
switch (errno) {
@@ -596,14 +602,14 @@ in_getaddr(s, which)
if (which != MASK)
sin->sin_family = AF_INET;
- if ((val = inet_addr(s)) != -1)
- sin->sin_addr.s_addr = val;
+ if (inet_aton(s, &sin->sin_addr))
+ ; /* do nothing, conversion successful */
else if (hp = gethostbyname(s))
bcopy(hp->h_addr, (char *)&sin->sin_addr, hp->h_length);
else if (np = getnetbyname(s))
sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
else {
- fprintf(stderr, "%s: bad value\n", s);
+ fprintf(stderr, "ifconfig: %s: bad value\n", s);
exit(1);
}
}
diff --git a/sbin/init.bsdi/Makefile b/sbin/init.bsdi/Makefile
index 6cc3aba2a28f..44800683a306 100644
--- a/sbin/init.bsdi/Makefile
+++ b/sbin/init.bsdi/Makefile
@@ -1,4 +1,4 @@
-# BSDI $Id: Makefile,v 1.3 1993/09/26 12:26:15 rgrimes Exp $
+# BSDI $Id: Makefile,v 1.4 1994/01/25 01:35:58 nate Exp $
# @(#)Makefile 5.3 (Berkeley) 5/11/90
PROG= init
@@ -14,4 +14,9 @@ DPADD+= ${LIBCRYPT}
LDADD+= -lcrypt
.endif
+beforeinstall:
+ @rm -f ${DESTDIR}${BINDIR}/init.old
+ @- ln ${DESTDIR}${BINDIR}/init ${DESTDIR}${BINDIR}/init.old
+ @rm -f ${DESTDIR}${BINDIR}/init
+
.include <bsd.prog.mk>
diff --git a/sbin/init.bsdi/init.c b/sbin/init.bsdi/init.c
index 0ba1b5a6aa14..aae219171070 100644
--- a/sbin/init.bsdi/init.c
+++ b/sbin/init.bsdi/init.c
@@ -61,6 +61,7 @@ static char sccsid[] = "@(#)init.c 6.22 (Berkeley) 6/2/93";
#include <time.h>
#include <ttyent.h>
#include <unistd.h>
+#include <sys/reboot.h>
#ifdef __STDC__
#include <stdarg.h>
@@ -86,6 +87,7 @@ extern void logwtmp __P((const char *, const char *, const char *));
*/
#define GETTY_SPACING 5 /* N secs minimum getty spacing */
#define GETTY_SLEEP 30 /* sleep N secs after spacing problem */
+#define GETTY_NSPACE 3 /* max. spacing count to bring reaction */
#define WINDOW_WAIT 3 /* wait N secs after starting window */
#define STALL_TIMEOUT 30 /* wait N secs after warning */
#define DEATH_WATCH 10 /* wait N secs for procs to die */
@@ -116,6 +118,7 @@ state_func_t catatonia __P((void));
state_func_t death __P((void));
enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
+int noreboot = 0;
void transition __P((state_t));
state_t requested_transition = runcom;
@@ -128,11 +131,15 @@ typedef struct init_session {
time_t se_started; /* used to avoid thrashing */
int se_flags; /* status of session */
#define SE_SHUTDOWN 0x1 /* session won't be restarted */
+ int se_nspace; /* spacing count */
char *se_device; /* filename of port */
- char *se_getty; /* what to run on that port */
+ char *se_getty; /* what to run on that port */
+ char *se_getty_argv_space; /* pre-parsed argument array space */
char **se_getty_argv; /* pre-parsed argument array */
- char *se_window; /* window system (started only once) */
+ char *se_window; /* window system (started only once) */
+ char *se_window_argv_space; /* pre-parsed argument array space */
char **se_window_argv; /* pre-parsed argument array */
+ char *se_type; /* default terminal type */
struct init_session *se_prev;
struct init_session *se_next;
} session_t;
@@ -224,11 +231,11 @@ main(argc, argv)
handle(badsys, SIGSYS, 0);
handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV,
SIGBUS, SIGXCPU, SIGXFSZ, 0);
- handle(transition_handler, SIGHUP, SIGTERM, SIGTSTP, 0);
+ handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP, 0);
handle(alrm_handler, SIGALRM, 0);
sigfillset(&mask);
delset(&mask, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
- SIGXCPU, SIGXFSZ, SIGHUP, SIGTERM, SIGTSTP, SIGALRM, 0);
+ SIGXCPU, SIGXFSZ, SIGHUP, SIGINT, SIGTERM, SIGTSTP, SIGALRM, 0);
sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0);
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
@@ -520,7 +527,9 @@ setctty(name)
int fd;
(void) revoke(name);
+#ifdef BROKEN_DTR
sleep (2); /* leave DTR low */
+#endif
if ((fd = open(name, O_RDWR)) == -1) {
stall("can't open %s: %m", name);
_exit(1);
@@ -556,6 +565,15 @@ single_user()
if (getsecuritylevel() > 0)
setsecuritylevel(0);
+ if ( noreboot > 0) {
+ /* Instead of going single user, let's halt the machine */
+ sync();
+ alarm(2);
+ pause();
+ reboot(RB_HALT);
+ _exit(0);
+ }
+
if ((pid = fork()) == 0) {
/*
* Start the single user session.
@@ -867,12 +885,16 @@ free_session(sp)
free(sp->se_device);
if (sp->se_getty) {
free(sp->se_getty);
+ free(sp->se_getty_argv_space);
free(sp->se_getty_argv);
}
if (sp->se_window) {
free(sp->se_window);
+ free(sp->se_window_argv_space);
free(sp->se_window_argv);
}
+ if (sp->se_type)
+ free(sp->se_type);
free(sp);
}
@@ -928,30 +950,43 @@ setupargv(sp, typ)
if (sp->se_getty) {
free(sp->se_getty);
+ free(sp->se_getty_argv_space);
free(sp->se_getty_argv);
}
sp->se_getty = malloc(strlen(typ->ty_getty) + strlen(typ->ty_name) + 2);
(void) sprintf(sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name);
- sp->se_getty_argv = construct_argv(sp->se_getty);
+ sp->se_getty_argv_space = strdup(sp->se_getty);
+ sp->se_getty_argv = construct_argv(sp->se_getty_argv_space);
if (sp->se_getty_argv == 0) {
warning("can't parse getty for port %s", sp->se_device);
free(sp->se_getty);
- sp->se_getty = 0;
+ free(sp->se_getty_argv_space);
+ sp->se_getty = sp->se_getty_argv_space = 0;
return (0);
}
+ if (sp->se_window) {
+ free(sp->se_window);
+ free(sp->se_window_argv_space);
+ free(sp->se_window_argv);
+ }
+ sp->se_window = sp->se_window_argv_space = 0;
+ sp->se_window_argv = 0;
if (typ->ty_window) {
- if (sp->se_window)
- free(sp->se_window);
sp->se_window = strdup(typ->ty_window);
- sp->se_window_argv = construct_argv(sp->se_window);
+ sp->se_window_argv_space = strdup(sp->se_window);
+ sp->se_window_argv = construct_argv(sp->se_window_argv_space);
if (sp->se_window_argv == 0) {
warning("can't parse window for port %s",
sp->se_device);
+ free(sp->se_window_argv_space);
free(sp->se_window);
- sp->se_window = 0;
+ sp->se_window = sp->se_window_argv_space = 0;
return (0);
}
}
+ if (sp->se_type)
+ free(sp->se_type);
+ sp->se_type = typ->ty_type ? strdup(typ->ty_type) : 0;
return (1);
}
@@ -1001,6 +1036,7 @@ start_window_system(sp)
{
pid_t pid;
sigset_t mask;
+ char term[64], *env[2];
if ((pid = fork()) == -1) {
emergency("can't fork for window system on port %s: %m",
@@ -1018,7 +1054,16 @@ start_window_system(sp)
if (setsid() < 0)
emergency("setsid failed (window) %m");
- execv(sp->se_window_argv[0], sp->se_window_argv);
+ if (sp->se_type) {
+ /* Don't use malloc after fork */
+ strcpy(term, "TERM=");
+ strcat(term, sp->se_type);
+ env[0] = term;
+ env[1] = 0;
+ }
+ else
+ env[0] = 0;
+ execve(sp->se_window_argv[0], sp->se_window_argv, env);
stall("can't exec window system '%s' for port %s: %m",
sp->se_window_argv[0], sp->se_device);
_exit(1);
@@ -1034,6 +1079,7 @@ start_getty(sp)
pid_t pid;
sigset_t mask;
time_t current_time = time((time_t *) 0);
+ char term[64], *env[2];
/*
* fork(), not vfork() -- we can't afford to block.
@@ -1048,10 +1094,15 @@ start_getty(sp)
if (current_time > sp->se_started &&
current_time - sp->se_started < GETTY_SPACING) {
- warning("getty repeating too quickly on port %s, sleeping",
- sp->se_device);
+ if (++sp->se_nspace > GETTY_NSPACE) {
+ sp->se_nspace = 0;
+ warning("getty repeating too quickly on port %s, sleeping %d secs",
+ sp->se_device, GETTY_SLEEP);
sleep((unsigned) GETTY_SLEEP);
}
+ }
+ else
+ sp->se_nspace = 0;
if (sp->se_window) {
start_window_system(sp);
@@ -1061,7 +1112,16 @@ start_getty(sp)
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0);
- execv(sp->se_getty_argv[0], sp->se_getty_argv);
+ if (sp->se_type) {
+ /* Don't use malloc after fork */
+ strcpy(term, "TERM=");
+ strcat(term, sp->se_type);
+ env[0] = term;
+ env[1] = 0;
+ }
+ else
+ env[0] = 0;
+ execve(sp->se_getty_argv[0], sp->se_getty_argv, env);
stall("can't exec getty '%s' for port %s: %m",
sp->se_getty_argv[0], sp->se_device);
_exit(1);
@@ -1125,6 +1185,8 @@ transition_handler(sig)
case SIGHUP:
requested_transition = clean_ttys;
break;
+ case SIGINT:
+ noreboot++;
case SIGTERM:
requested_transition = death;
break;
@@ -1187,6 +1249,7 @@ clean_ttys()
register struct ttyent *typ;
register int session_index = 0;
register int devlen;
+ char *old_getty, *old_window, *old_type;
if (! sessions)
return (state_func_t) multi_user;
@@ -1213,12 +1276,35 @@ clean_ttys()
continue;
}
sp->se_flags &= ~SE_SHUTDOWN;
+ old_getty = sp->se_getty ? strdup(sp->se_getty) : 0;
+ old_window = sp->se_window ? strdup(sp->se_window) : 0;
+ old_type = sp->se_type ? strdup(sp->se_type) : 0;
if (setupargv(sp, typ) == 0) {
warning("can't parse getty for port %s",
sp->se_device);
sp->se_flags |= SE_SHUTDOWN;
kill(sp->se_process, SIGHUP);
}
+ else if ( !old_getty
+ || !old_type && sp->se_type
+ || old_type && !sp->se_type
+ || !old_window && sp->se_window
+ || old_window && !sp->se_window
+ || strcmp(old_getty, sp->se_getty) != 0
+ || old_window && strcmp(old_window, sp->se_window) != 0
+ || old_type && strcmp(old_type, sp->se_type) != 0
+ ) {
+ /* Don't set SE_SHUTDOWN here */
+ sp->se_nspace = 0;
+ sp->se_started = 0;
+ kill(sp->se_process, SIGHUP);
+ }
+ if (old_getty)
+ free(old_getty);
+ if (old_getty)
+ free(old_window);
+ if (old_type)
+ free(old_type);
continue;
}
diff --git a/sbin/init.chmr/init.8 b/sbin/init.chmr/init.8
index 6aea2f096647..b01bdd678055 100644
--- a/sbin/init.chmr/init.8
+++ b/sbin/init.chmr/init.8
@@ -121,7 +121,7 @@ cure the problem. When this shell terminates,
starts over by executing
.Pa /etc/rc
again (without arguments). When finally this script terminates with
-an exit status of zero (signalling success),
+an exit status of zero (signaling success),
.Nm
starts multiuser mode by reading the file
.Pa /etc/ttys
diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile
index 50c19ec36d94..a231cde1a9b5 100644
--- a/sbin/mount/Makefile
+++ b/sbin/mount/Makefile
@@ -3,8 +3,6 @@
PROG= mount
CFLAGS+=-DNFS
MAN8= mount.8
-DPADD= ${LIBRPC}
-LDADD= -lrpc
MLINKS= mount.8 umount.8
.include <bsd.prog.mk>
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8
index ef8a024060ae..ae55108c7c72 100644
--- a/sbin/mount/mount.8
+++ b/sbin/mount/mount.8
@@ -192,12 +192,12 @@ Those options that take a value are specified
using the syntax -option=value.
For example, the mount command:
.Bd -literal -offset indent
-mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
+mount -t mfs -o nosuid,-N,-s=4000 /dev/wd0b /tmp
.Ed
.Pp
causes mount to attempt to execute:
.Bd -literal -offset indent
-/sbin/mount_mfs -F 8 -N -s 4000 /dev/dk0b /tmp
+/sbin/mount_mfs -F 8 -N -s 4000 /dev/wd0b /tmp
.Ed
.Pp
The following list can be used to override
@@ -293,7 +293,11 @@ file system table
.Sh SEE ALSO
.Xr mount 2 ,
.Xr unmount 2 ,
-.Xr fstab 5
+.Xr fstab 5 ,
+.Xr mount_isofs 8 ,
+.Xr mount_mfs 8 ,
+.Xr mount_pcfs 8 ,
+.Xr mount_procfs 8
.Sh BUGS
It is possible for a corrupted file system to cause a crash.
.Sh HISTORY
diff --git a/sbin/mount_isofs/mount_isofs.8 b/sbin/mount_isofs/mount_isofs.8
index b9d0e1e6fa93..f197ca5a1733 100644
--- a/sbin/mount_isofs/mount_isofs.8
+++ b/sbin/mount_isofs/mount_isofs.8
@@ -27,11 +27,11 @@
.\" (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: mount_isofs.8,v 1.1 1993/07/21 07:51:50 cgd Exp $
+.\" $Id: mount_isofs.8,v 1.5 1994/02/07 02:47:56 rgrimes Exp $
.\"
.Dd July 19, 1993
-.Dt MOUNT_MSDOS 8
-.Os NetBSD 0.9
+.Dt MOUNT_ISOFS 8
+.Os
.Sh NAME
.Nm mount_isofs
.Nd mount an ISO-9660 filesystem
@@ -62,10 +62,10 @@ flag is used. If that option is given to
then the Rockridge extensions will be ignored.
.Sh EXAMPLES
.Bd -literal -offset indent -compact
-mount_isofs /dev/cd0d /cdrom
-mount_isofs \-norrip /dev/cd0d /cdrom
-mount \-t isofs /dev/cd0d /cdrom
-mount \-t isofs \-o \-norrip /dev/cd0d /cdrom
+mount_isofs /dev/cd0a /cdrom
+mount_isofs \-norrip /dev/cd0a /cdrom
+mount \-t isofs /dev/cd0a /cdrom
+mount \-t isofs \-o \-norrip /dev/cd0a /cdrom
.Ed
.Sh SEE ALSO
.Xr mount 2 ,
diff --git a/sbin/mount_isofs/mount_isofs.c b/sbin/mount_isofs/mount_isofs.c
index 76298809ac8c..647515e42165 100644
--- a/sbin/mount_isofs/mount_isofs.c
+++ b/sbin/mount_isofs/mount_isofs.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Header: /a/cvs/386BSD/src/sbin/mount_isofs/mount_isofs.c,v 1.3 1993/10/24 04:30:08 rgrimes Exp $";
+static char rcsid[] = "$Header: /home/cvs/386BSD/src/sbin/mount_isofs/mount_isofs.c,v 1.3 1993/10/24 04:30:08 rgrimes Exp $";
#endif
#include <stdio.h>
diff --git a/sbin/mount_procfs/Makefile b/sbin/mount_procfs/Makefile
new file mode 100644
index 000000000000..52e3d4f4476f
--- /dev/null
+++ b/sbin/mount_procfs/Makefile
@@ -0,0 +1,8 @@
+#
+# $Id: Makefile,v 1.1 1993/12/12 12:47:13 davidg Exp $
+#
+
+PROG = mount_procfs
+MAN8 = mount_procfs.8
+
+.include <bsd.prog.mk>
diff --git a/sbin/mount_procfs/mount_procfs.8 b/sbin/mount_procfs/mount_procfs.8
new file mode 100644
index 000000000000..729762786ea5
--- /dev/null
+++ b/sbin/mount_procfs/mount_procfs.8
@@ -0,0 +1,40 @@
+.Dd August 24, 1993
+.Dt MOUNT_PROCFS 8
+.Os FreeBSD 1.1
+.Sh NAME
+.Nm mount_procfs
+.Nd mount the proc file system
+.Sh SYNOPSIS
+.Nm mount_procfs
+.Op Fl F Ar fsoptions
+.Pa proc
+.Pa mount_point
+.Sh DESCRIPTION
+The
+.Nm mount_procfs
+command attaches an instance of the proc filesystem
+to the global filesystem namespace.
+The conventional mount point is
+.Pa /proc .
+This command is normally executed by
+.Xr mount 8
+at boot time.
+.Pp
+The proc filesystem presents a directory entry for each process in the system.
+The name of an entry is process id in decimal notation.
+Opening an entry for reading and/or writing gives access to the process
+address space. Several ioctl(2) operations are available to gain additional
+control over the process.
+.Sh FILES
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5
+.Sh CAVEATS
+This filesystem may not be NFS-exported.
+The interface and implementation of the proc filesystem are still under
+development.
+.Sh HISTORY
+The
+.Nm mount_procfs
+utility first appeared in FreeBSD 1.1.
diff --git a/sbin/mount_procfs/mount_procfs.c b/sbin/mount_procfs/mount_procfs.c
new file mode 100644
index 000000000000..598ea8240002
--- /dev/null
+++ b/sbin/mount_procfs/mount_procfs.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1993 Paul Kranenburg
+ * 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 Paul Kranenburg.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software withough 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.
+ *
+ * $Id: mount_procfs.c,v 1.1 1993/12/12 12:47:15 davidg Exp $
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+
+void
+usage ()
+{
+ fprintf (stderr, "usage: mount_procfs dir\n");
+ exit (1);
+}
+
+int
+main (argc, argv)
+int argc;
+char **argv;
+{
+ char *dev;
+ char *dir;
+ int c;
+ extern char *optarg;
+ extern int optind;
+ int opts;
+
+ opts = MNT_RDONLY;
+
+ while ((c = getopt (argc, argv, "F:")) != EOF) {
+ switch (c) {
+ case 'F':
+ opts |= atoi (optarg);
+ break;
+ default:
+ usage ();
+ }
+ }
+
+ if (optind + 2 != argc)
+ usage ();
+
+ dev = argv[optind];
+ dir = argv[optind + 1];
+
+ if (mount (MOUNT_PROCFS, dir, opts, (caddr_t)0) < 0) {
+ perror ("mount");
+ exit (1);
+ }
+
+ exit (0);
+}
+
diff --git a/sbin/mountd/Makefile b/sbin/mountd/Makefile
index d40dd727b3f3..09e943fd8913 100644
--- a/sbin/mountd/Makefile
+++ b/sbin/mountd/Makefile
@@ -4,7 +4,6 @@ PROG= mountd
CFLAGS+=-DNFS
MAN5= exports.5
MAN8= mountd.8
-DPADD= ${LIBRPC}
-LDADD= -lrpc -lutil
+LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/sbin/mountd/mountd.8 b/sbin/mountd/mountd.8
index edc7a2f62e2f..e3a68a689712 100644
--- a/sbin/mountd/mountd.8
+++ b/sbin/mountd/mountd.8
@@ -64,7 +64,7 @@ The
option allows non-root mount requests to be served.
This should only be specified if there are clients such as PC's,
that require it.
-.It Ar exsportfile
+.It Ar exportsfile
The
.Ar exportsfile
argument specifies an alternate location
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index cce57d01a9fb..e2e5a26a2100 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -101,7 +101,8 @@ struct grouplist {
};
/* Global defs */
-int mntsrv(), umntall_each(), xdr_fhs(), xdr_mlist(), xdr_dir(), xdr_explist();
+void mntsrv();
+int umntall_each(), xdr_fhs(), xdr_mlist(), xdr_dir(), xdr_explist();
void add_mlist(), del_mlist(), get_exportlist(), get_mountlist();
void send_umntall();
struct exportlist exphead;
@@ -183,7 +184,7 @@ main(argc, argv)
/*
* The mount rpc service
*/
-mntsrv(rqstp, transp)
+void mntsrv(rqstp, transp)
register struct svc_req *rqstp;
register SVCXPRT *transp;
{
@@ -347,7 +348,7 @@ xdr_fhs(xdrsp, nfh)
XDR *xdrsp;
nfsv2fh_t *nfh;
{
- int ok = 0;
+ long ok = 0;
if (!xdr_long(xdrsp, &ok))
return (0);
diff --git a/sbin/newfs/Makefile b/sbin/newfs/Makefile
index 07201cdfdf2b..c61a5cde3cdd 100644
--- a/sbin/newfs/Makefile
+++ b/sbin/newfs/Makefile
@@ -2,10 +2,10 @@
PROG= newfs
CFLAGS+=-DMFS
-SRCS= dkcksum.c newfs.c mkfs.c
+SRCS= dkcksum.c newfs.c mkfs.c mfs.c
MAN8= newfs.8
LINKS= ${BINDIR}/newfs ${BINDIR}/mount_mfs
-MLINKS= newfs.8 mfs.8
+MLINKS= newfs.8 mount_mfs.8
.PATH: ${.CURDIR}/../disklabel
.include <bsd.prog.mk>
diff --git a/sbin/newfs/mfs.c b/sbin/newfs/mfs.c
new file mode 100644
index 000000000000..ce265f6fcf9b
--- /dev/null
+++ b/sbin/newfs/mfs.c
@@ -0,0 +1,128 @@
+#ifdef MFS
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <sys/signal.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+
+
+
+static void
+sighandler()
+{
+ /*
+ * kernel notifies us that the FS has been mounted successfully.
+ */
+ exit(0);
+}
+
+
+void
+mfs_mount(addr, len, name, dir, flags)
+caddr_t addr;
+unsigned long len;
+char *name, *dir;
+int flags;
+{
+ struct mfs_args margs;
+ char nmbuf[16];
+ int pfeife[2];
+ char buf[1024];
+ int red;
+
+
+
+ signal(SIGUSR1, sighandler);
+ if (pipe(pfeife) == -1)
+ fatal("cannot create pipe: %s", strerror(errno));
+ switch (fork()) {
+ case -1:
+ fatal("cannot fork: %s", strerror(errno));
+ case 0:
+ /*
+ * child: disassociate from controlling terminal,
+ * and mount the filesystem.
+ */
+ dup2(pfeife[1], 2);
+ close(0);
+ close(1);
+ if (pfeife[0] != 2) close(pfeife[0]);
+ if (pfeife[1] != 2) close(pfeife[1]);
+ setsid();
+ (void)chdir("/");
+ if (name == 0) {
+ sprintf(nmbuf, "MFS:%d", getpid());
+ name = nmbuf;
+ }
+ margs.name = name;
+ margs.base = addr;
+ margs.size = len;
+ margs.flags = MFSMNT_SIGPPID;
+ if (mount(MOUNT_MFS, dir, flags, &margs) == -1)
+ fatal("mounting MFS: %s", strerror(errno));
+ default:
+ /*
+ * parent; if the mount system call fails, the
+ * child will write error messages to the pipe.
+ * We duplicate those messages to our stdout.
+ * If the mount succeedet, we will receive a SIGUSR1
+ * (and exit with status 0).
+ */
+ close(pfeife[1]);
+ while ((red = read(pfeife[0], buf, sizeof(buf))) > 0)
+ write(2, buf, red);
+ exit(1);
+ }
+ /* NOTREACHED */
+}
+
+
+caddr_t
+mfs_malloc(size)
+unsigned long size;
+{
+ caddr_t addr;
+
+ addr = mmap(0, size, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_SHARED, -1, 0);
+ if (addr == (caddr_t)-1)
+ fatal("cannot allocate memory: %s", strerror(errno));
+ return(addr);
+}
+
+void
+mfs_mountfile(file, dir, flags)
+char *file, *dir;
+int flags;
+{
+ caddr_t addr;
+ int fd;
+ struct stat st;
+
+
+ fd = open(file, O_RDWR | O_EXLOCK);
+ if ((fd == -1) || (fstat(fd, &st) == -1))
+ fatal("%s: %s", file, strerror(errno));
+ addr = mmap(0, st.st_size, PROT_READ | PROT_WRITE,
+ MAP_FILE | MAP_SHARED, fd, 0);
+ if (addr == (caddr_t) -1)
+ fatal("cannot mmap file: %s", strerror(errno));
+ mfs_mount(addr, st.st_size, file, dir, flags);
+}
+
+#else
+caddr_t
+mfs_malloc()
+{
+ fatal("compiled without MFS support");
+ return(0);
+}
+void mfs_mount() {}
+void mfs_mountfile() {mfs_malloc();}
+#endif
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index d180509ede5c..5abc96a5a514 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -109,9 +109,7 @@ extern int maxbpg; /* maximum blocks per file in a cyl group */
extern int nrpos; /* # of distinguished rotational positions */
extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
-extern u_long memleft; /* virtual memory available */
extern caddr_t membase; /* start address of memory based filesystem */
-extern caddr_t malloc(), calloc();
union {
struct fs fs;
@@ -141,32 +139,11 @@ mkfs(pp, fsys, fi, fo)
long used, mincpgcnt, bpcg;
long mapcramped, inodecramped;
long postblsize, rotblsize, totalsbsize;
- int ppid, status;
time_t utime;
- void started();
#ifndef STANDALONE
time(&utime);
#endif
- if (mfs) {
- ppid = getpid();
- (void) signal(SIGUSR1, started);
- if (i = fork()) {
- if (i == -1) {
- perror("mfs");
- exit(10);
- }
- if (waitpid(i, &status, 0) != -1 && WIFEXITED(status))
- exit(WEXITSTATUS(status));
- exit(11);
- /* NOTREACHED */
- }
- (void)malloc(0);
- if (fssize * sectorsize > memleft)
- fssize = (memleft - 16384) / sectorsize;
- if ((membase = malloc(fssize * sectorsize)) == 0)
- exit(12);
- }
fsi = fi;
fso = fo;
/*
@@ -629,18 +606,6 @@ next:
pp->p_fsize = sblock.fs_fsize;
pp->p_frag = sblock.fs_frag;
pp->p_cpg = sblock.fs_cpg;
- /*
- * Notify parent process of success.
- * Dissociate from session and tty.
- */
- if (mfs) {
- kill(ppid, SIGUSR1);
- (void) setsid();
- (void) close(0);
- (void) close(1);
- (void) close(2);
- (void) chdir("/");
- }
}
/*
@@ -932,86 +897,6 @@ iput(ip, ino)
}
/*
- * Notify parent process that the filesystem has created itself successfully.
- */
-void
-started()
-{
-
- exit(0);
-}
-
-/*
- * Replace libc function with one suited to our needs.
- */
-caddr_t
-malloc(size)
- register u_long size;
-{
- u_long base, i;
- static u_long pgsz;
- struct rlimit rlp;
-
- if (pgsz == 0) {
- base = sbrk(0);
- pgsz = getpagesize() - 1;
- i = (base + pgsz) &~ pgsz;
- base = sbrk(i - base);
- if (getrlimit(RLIMIT_DATA, &rlp) < 0)
- perror("getrlimit");
- rlp.rlim_cur = rlp.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rlp) < 0)
- perror("setrlimit");
- memleft = rlp.rlim_max - base;
- }
- size = (size + pgsz) &~ pgsz;
- if (size > memleft)
- size = memleft;
- memleft -= size;
- if (size == 0)
- return (0);
- return ((caddr_t)sbrk(size));
-}
-
-/*
- * Replace libc function with one suited to our needs.
- */
-caddr_t
-realloc(ptr, size)
- char *ptr;
- u_long size;
-{
-
- /* always fail for now */
- return ((caddr_t)0);
-}
-
-/*
- * Replace libc function with one suited to our needs.
- */
-char *
-calloc(size, numelm)
- u_long size, numelm;
-{
- caddr_t base;
-
- size *= numelm;
- base = malloc(size);
- bzero(base, size);
- return (base);
-}
-
-/*
- * Replace libc function with one suited to our needs.
- */
-free(ptr)
- char *ptr;
-{
-
- /* do not worry about it for now */
-}
-
-/*
* read a block from the file system
*/
rdfs(bno, size, bf)
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index 8c17f019dca2..5e4a6b505841 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -36,17 +36,20 @@
.Os BSD 4.2
.Sh NAME
.Nm newfs ,
-.Nm mfs
+.Nm mount_mfs
.Nd construct a new file system
.Sh SYNOPSIS
.Nm newfs
.Op Fl N
.Op Ar newfs-options
.Ar special
-.Nm mfs
+.Nm mount_mfs
.Op Fl F Ar mount_flags
.Op Ar newfs-options
.Ar special node
+.Nm mount_mfs
+.Op Fl F Ar mount_flags
+.Ar file node
.Sh DESCRIPTION
.Nm Newfs
replaces the more obtuse
@@ -55,7 +58,7 @@ program.
Before running
.Nm newfs
or
-.Nm mfs ,
+.Nm mount_mfs ,
the disk must be labeled using
.Xr disklabel 8 .
.Nm Newfs
@@ -65,20 +68,22 @@ Typically the defaults are reasonable, however
.Nm newfs
has numerous options to allow the defaults to be selectively overridden.
.Pp
-.Nm Mfs
+.Nm Mount_mfs
is used to build a file system in virtual memory and then mount it
on a specified node.
-.Nm Mfs
+.Nm Mount_mfs
exits and the contents of the file system are lost
when the file system is unmounted.
+Using the third syntax given above, you can also
+mount a regular file (useful for floppy images).
If
-.Nm mfs
+.Nm mount_mfs
is sent a signal while running,
for example during system shutdown,
it will attempt to unmount its
corresponding file system.
The parameters to
-.Nm mfs
+.Nm mount_mfs
are the same as those to
.Nm newfs .
The special file is only used to read the disk label which provides
@@ -205,13 +210,13 @@ relative to sector 0 on track N-1 on the same cylinder.
.Pp
.El
The following option applies only to
-.Nm mfs .
+.Nm mount_mfs .
.Bl -tag -width Fl
.It Fl F Ar mount flags
Used to pass in a decimal numeric value to be passed
as mount flags when running as a memory based file system.
This option is primarily intended for use when
-.Nm mfs
+.Nm mount_mfs
is started by the
.Xr mount 8
command.
@@ -223,7 +228,8 @@ command.
.Xr diskpart 8 ,
.Xr fsck 8 ,
.Xr format 8 ,
-.Xr tunefs 8
+.Xr tunefs 8 ,
+.Xr mount 8
.Rs
.%A M. McKusick
.%A W. Joy
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 59d6446c2c86..96622956561a 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -61,7 +61,10 @@ char copyright[] =
#include <stdlib.h>
#include <paths.h>
-int fatal(char *fmt, ...);
+int fatal(char *fmt, ...);
+caddr_t mfs_malloc(unsigned long);
+void mfs_mountfile(char *, char *, int);
+void mfs_mount(caddr_t, unsigned long, char *, char *, int);
#define COMPAT /* allow non-labeled disks */
@@ -319,15 +322,19 @@ main(argc, argv)
usage();
special = argv[0];
- cp = rindex(special, '/');
- if (cp == 0) {
- /*
- * No path prefix; try /dev/r%s then /dev/%s.
- */
- (void)sprintf(device, "%sr%s", _PATH_DEV, special);
- if (stat(device, &st) == -1)
- (void)sprintf(device, "%s%s", _PATH_DEV, special);
- special = device;
+ /*
+ * try to open Special. Look for it as Special, then /dev/rSpecial,
+ * then /dev/Special. If it contains a slash (/) only look for Special.
+ */
+ special = argv[0];
+ if ((stat(special, &st) == -1) && (rindex(special, '/') == 0)) {
+ sprintf(device, "%sr%s", _PATH_DEV, special);
+ if (stat(device, &st) == -1) {
+ sprintf(device, "%s%s", _PATH_DEV, special);
+ if (stat(device, &st) == 0)
+ special = device;
+ } else
+ special = device;
}
if (!Nflag) {
fso = open(special, O_WRONLY);
@@ -340,7 +347,12 @@ main(argc, argv)
fatal("%s: %s", special, strerror(errno));
if (fstat(fsi, &st) < 0)
fatal("%s: %s", special, strerror(errno));
- if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
+ if (mfs && S_ISREG(st.st_mode)) {
+ (void)close(fsi);
+ mfs_mountfile(special, argv[1], mntflags);
+ /* NOTREACHED */
+ }
+ if (!S_ISCHR(st.st_mode) && !mfs)
printf("%s: %s: not a character-special device\n",
progname, special);
cp = index(argv[0], '\0') - 1;
@@ -447,6 +459,9 @@ main(argc, argv)
pp->p_size /= secperblk;
}
#endif
+ if (mfs)
+ membase = mfs_malloc(fssize*sectorsize);
+
mkfs(pp, special, fsi, fso);
#ifdef tahoe
if (realsectorsize != DEV_BSIZE)
@@ -457,18 +472,9 @@ main(argc, argv)
if (!Nflag)
close(fso);
close(fsi);
-#ifdef MFS
- if (mfs) {
- struct mfs_args args;
-
- sprintf(buf, "mfs:%d", getpid());
- args.name = buf;
- args.base = membase;
- args.size = fssize * sectorsize;
- if (mount(MOUNT_MFS, argv[1], mntflags, &args) < 0)
- fatal("%s: %s", argv[1], strerror(errno));
- }
-#endif
+
+ if (mfs)
+ mfs_mount(membase, fssize*sectorsize, 0, argv[1], mntflags);
exit(0);
}
@@ -574,10 +580,10 @@ usage()
{
if (mfs) {
fprintf(stderr,
- "usage: mfs [ -fsoptions ] special-device mount-point\n");
+ "usage: %s [ -fsoptions ] special-device mount-point\n", progname);
} else
fprintf(stderr,
- "usage: newfs [ -fsoptions ] special-device%s\n",
+ "usage: %s [ -fsoptions ] special-device%s\n", progname,
#ifdef COMPAT
" [device-type]");
#else
diff --git a/sbin/nfsd/Makefile b/sbin/nfsd/Makefile
index 675e4b2c4b9d..949dc1cbdf10 100644
--- a/sbin/nfsd/Makefile
+++ b/sbin/nfsd/Makefile
@@ -3,7 +3,6 @@
PROG= nfsd
CFLAGS+=-DNFS
MAN8= nfsd.8
-DPADD= ${LIBRPC}
-LDADD= -lrpc -lutil
+LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 9ba6c6af5c27..3609ae2fe621 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -709,7 +709,24 @@ finish()
if (nreceived && timing)
(void)printf("round-trip min/avg/max = %.3f/%.3f/%.3f ms\n",
tmin/1000.0, tsum/(nreceived + nrepeats)/1000.0, tmax/1000.0);
- exit(0);
+
+ /*
+ * 13NOV93 GRS
+ * added code to return 1 if no packets were returned to the receiver.
+ * Originally PING returned 0 regardless of how many packets were
+ * returned, thus the only way to test the return value of PING in a
+ * shell script was to do something like:
+ *
+ * if ping -n -c 1 -r $IP_ADDR | grep '0 packets received' >/dev/null
+ *
+ * now, all that is needed is:
+ *
+ * if ping -n -c 1 -r $IP_ADDR >/dev/null
+ */
+ if (nreceived)
+ exit (0);
+ else
+ exit (1);
}
#ifdef notdef
diff --git a/sbin/reboot/reboot_i386.8 b/sbin/reboot/reboot_i386.8
index b444887b3ef5..a73259d8dd15 100644
--- a/sbin/reboot/reboot_i386.8
+++ b/sbin/reboot/reboot_i386.8
@@ -40,14 +40,14 @@
.Sh NAME
.Nm reboot
.Nd
-.Tn UNIX
+.Tn FreeBSD
bootstrapping procedures
.Sh SYNOPSIS
.Nm reboot
.Op Fl n
.Op Fl q
.Sh DESCRIPTION
-.Tn UNIX ,
+.Tn FreeBSD,
an ordinary executable file,
is placed into memory by bootstrap at location absolute zero, and
entered at the executable's entry point
@@ -60,7 +60,7 @@ a disk file.
.Pp
.Sy Rebooting a running system .
When a
-.Tn UNIX
+.Tn FreeBSD
is running and a reboot is desired,
.Xr shutdown 8
is normally used.
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index b2c00f93371e..d5da24a456ab 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -1,4 +1,13 @@
/*
+ * Copyright (c) UNIX System Laboratories, Inc. All or some portions
+ * of this file are derived from material licensed to the
+ * University of California by American Telephone and Telegraph Co.
+ * or UNIX System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * $Id: dirs.c,v 1.1.1.1.2.1 1994/05/04 07:42:51 rgrimes Exp $
+ */
+/*
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
diff --git a/sbin/restore/pathnames.h b/sbin/restore/pathnames.h
index b3cf676b0d15..6c3ef24e8829 100644
--- a/sbin/restore/pathnames.h
+++ b/sbin/restore/pathnames.h
@@ -1,4 +1,13 @@
/*
+ * Copyright (c) UNIX System Laboratories, Inc. All or some portions
+ * of this file are derived from material licensed to the
+ * University of California by American Telephone and Telegraph Co.
+ * or UNIX System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * $Id: pathnames.h,v 1.1.1.1.2.1 1994/05/04 07:42:53 rgrimes Exp $
+ */
+/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
diff --git a/sbin/restore/restore.h b/sbin/restore/restore.h
index fc8a9c90a11f..85c951caa348 100644
--- a/sbin/restore/restore.h
+++ b/sbin/restore/restore.h
@@ -1,4 +1,13 @@
/*
+ * Copyright (c) UNIX System Laboratories, Inc. All or some portions
+ * of this file are derived from material licensed to the
+ * University of California by American Telephone and Telegraph Co.
+ * or UNIX System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * $Id: restore.h,v 1.1.1.1.2.1 1994/05/04 07:42:55 rgrimes Exp $
+ */
+/*
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index f8694e58ceea..02bda1d6d478 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -1,4 +1,13 @@
/*
+ * Copyright (c) UNIX System Laboratories, Inc. All or some portions
+ * of this file are derived from material licensed to the
+ * University of California by American Telephone and Telegraph Co.
+ * or UNIX System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * $Id: tape.c,v 1.2.2.1 1994/05/04 07:42:57 rgrimes Exp $
+ */
+/*
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
@@ -74,6 +83,7 @@ setinput(source)
extern int errno;
#ifdef RRESTORE
char *host, *tape;
+ char *ruser;
#endif RRESTORE
char *strerror();
@@ -86,6 +96,16 @@ setinput(source)
#ifdef RRESTORE
host = source;
tape = index(host, ':');
+ if((host = index(source, '@')))
+ {
+ *host++ = '\0';
+ ruser = source;
+ }
+ else
+ {
+ host = source;
+ ruser = NULL;
+ }
if (tape == 0) {
nohost:
msg("need keyletter ``f'' and device ``host:tape''\n");
@@ -93,7 +113,7 @@ nohost:
}
*tape++ = '\0';
(void) strcpy(magtape, tape);
- if (rmthost(host) == 0)
+ if (rmthost(host, ruser) == 0)
done(1);
setuid(getuid()); /* no longer need or want root privileges */
#else
diff --git a/sbin/route/Makefile b/sbin/route/Makefile
index c904a0bb625e..d7173cedae4d 100644
--- a/sbin/route/Makefile
+++ b/sbin/route/Makefile
@@ -1,16 +1,14 @@
-# @(#)Makefile 5.6 (Berkeley) 6/27/91
+# $Id: Makefile,v 1.3 1993/11/17 21:27:19 wollman Exp $
+# From: @(#)Makefile 5.6 (Berkeley) 6/27/91
PROG= route
MAN8= route.8
-SRCS= route.c
-#SRCS= route.c ccitt_addr.c
+SRCS= route.c ccitt_addr.c
CFLAGS+=-I.
#CLEANFILES+=keywords.h
BINOWN= root
BINMODE=4555
-all route depend lint tags: keywords.h
-
# keywords.h: keywords
# sed -e '/^#/d' -e '/^$$/d' ${.CURDIR}/keywords > _keywords.tmp
# tr a-z A-Z < _keywords.tmp | paste _keywords.tmp - | \
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 44dad38897c8..4d0c02746ed6 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -38,7 +38,9 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)route.c 5.35 (Berkeley) 6/27/91";
+/* From: static char sccsid[] = "@(#)route.c 5.35 (Berkeley) 6/27/91"; */
+const char main_c_rcsid[] =
+ "$Id: route.c,v 1.3 1993/11/17 21:27:20 wollman Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -51,11 +53,9 @@ static char sccsid[] = "@(#)route.c 5.35 (Berkeley) 6/27/91";
#include <net/route.h>
#include <net/if_dl.h>
#include <netinet/in.h>
-#ifdef notyet
#include <netns/ns.h>
#include <netiso/iso.h>
#include <netccitt/x25.h>
-#endif
#include <arpa/inet.h>
#include <netdb.h>
@@ -79,14 +79,10 @@ struct ortentry route;
union sockunion {
struct sockaddr sa;
struct sockaddr_in s_in;
-#ifdef notdef
struct sockaddr_ns sns;
struct sockaddr_iso siso;
-#endif
struct sockaddr_dl sdl;
-#ifdef notdef
struct sockaddr_x25 sx25;
-#endif
} so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp;
union sockunion *so_addrs[] =
@@ -107,9 +103,7 @@ void flushroutes(), newroute(), monitor(), sockaddr();
void print_getmsg(), print_rtmsg(), pmsg_common(), sodump(), bprintf();
int getaddr(), rtmsg();
extern char *inet_ntoa(),
-#ifdef notdef
*iso_ntoa(),
-#endif
*link_ntoa();
void
@@ -350,21 +344,17 @@ routename(sa)
break;
}
-#ifdef notdef
case AF_NS:
return (ns_print((struct sockaddr_ns *)sa));
-#endif
case AF_LINK:
return (link_ntoa((struct sockaddr_dl *)sa));
-#ifdef notdef
case AF_ISO:
(void) sprintf(line, "iso %s",
iso_ntoa(&((struct sockaddr_iso *)sa)->siso_addr));
break;
-#endif
default:
{ u_short *s = (u_short *)sa->sa_data;
u_short *slim = s + ((sa->sa_len + 1) >> 1);
@@ -446,21 +436,17 @@ netname(sa)
break;
}
-#ifdef notdef
case AF_NS:
return (ns_print((struct sockaddr_ns *)sa));
break;
-#endif
case AF_LINK:
return (link_ntoa((struct sockaddr_dl *)sa));
-#ifdef notdef
case AF_ISO:
(void) sprintf(line, "iso %s",
iso_ntoa(&((struct sockaddr_iso *)sa)->siso_addr));
break;
-#endif
default:
{ u_short *s = (u_short *)sa->sa_data;
@@ -524,33 +510,27 @@ newroute(argc, argv)
af = AF_LINK;
aflen = sizeof(struct sockaddr_dl);
break;
-#ifdef notdef
case K_OSI:
case K_ISO:
af = AF_ISO;
aflen = sizeof(struct sockaddr_iso);
break;
-#endif
case K_INET:
af = AF_INET;
aflen = sizeof(struct sockaddr_in);
break;
-#ifdef notdef
case K_X25:
af = AF_CCITT;
aflen = sizeof(struct sockaddr_x25);
break;
-#endif
case K_SA:
af = 0;
aflen = sizeof(union sockunion);
break;
-#ifdef notdef
case K_XNS:
af = AF_NS;
aflen = sizeof(struct sockaddr_ns);
break;
-#endif
case K_IFACE:
case K_INTERFACE:
iflag++;
@@ -758,10 +738,8 @@ getaddr(which, s, hpp)
struct hostent **hpp;
{
register sup su;
-#ifdef notdef
struct ns_addr ns_addr();
struct iso_addr *iso_addr();
-#endif
struct hostent *hp;
struct netent *np;
u_long val;
@@ -793,18 +771,14 @@ getaddr(which, s, hpp)
}
return 0;
}
-#ifdef notdef
if (af == AF_NS)
goto do_xns;
if (af == AF_OSI)
goto do_osi;
-#endif
if (af == AF_LINK)
goto do_link;
-#ifdef notdef
if (af == AF_CCITT)
goto do_ccitt;
-#endif
if (af == 0)
goto do_sa;
if (hpp == NULL)
@@ -840,7 +814,6 @@ getaddr(which, s, hpp)
}
(void) fprintf(stderr, "%s: bad value\n", s);
exit(1);
-#ifdef notdef
do_xns:
if (which == RTA_DST) {
extern short ns_bh[3];
@@ -865,7 +838,6 @@ do_osi:
do_ccitt:
ccitt_addr(s, &su->sx25);
return (1);
-#endif
do_link:
link_addr(s, &su->sdl);
return (1);
@@ -875,7 +847,6 @@ do_sa:
return (1);
}
-#ifdef notdef
short ns_nullh[] = {0,0,0};
short ns_bh[] = {-1,-1,-1};
@@ -922,7 +893,6 @@ ns_print(sns)
(void) sprintf(mybuf,"%XH.%s%s", ntohl(net.long_e), host, cport);
return (mybuf);
}
-#endif
void
monitor()
@@ -1016,15 +986,11 @@ mask_addr() {
if ((rtm_addrs & RTA_DST) == 0)
return;
switch(so_dst.sa.sa_family) {
-#ifdef notdef
case AF_NS:
-#endif
case AF_INET: case 0:
return;
-#ifdef notdef
case AF_ISO:
olen = MIN(so_dst.siso.siso_nlen, so_mask.sa.sa_len - 6);
-#endif
}
cp1 = so_mask.sa.sa_len + 1 + (char *)&so_dst;
cp2 = so_dst.sa.sa_len + 1 + (char *)&so_dst;
@@ -1033,12 +999,10 @@ mask_addr() {
cp2 = so_mask.sa.sa_len + 1 + (char *)&so_mask;
while (cp1 > so_dst.sa.sa_data)
*--cp1 &= *--cp2;
-#ifdef notdef
switch(so_dst.sa.sa_family) {
case AF_ISO:
so_dst.siso.siso_nlen = olen;
}
-#endif
}
char *msgtypes[] = {
@@ -1190,22 +1154,18 @@ sodump(su, which)
(void) printf("%s: link %s; ",
which, link_ntoa(&su->sdl));
break;
-#ifdef notdef
case AF_ISO:
(void) printf("%s: iso %s; ",
which, iso_ntoa(&su->siso.siso_addr));
break;
-#endif
case AF_INET:
(void) printf("%s: inet %s; ",
which, inet_ntoa(su->s_in.sin_addr));
break;
-#ifdef notdef
case AF_NS:
(void) printf("%s: xns %s; ",
which, ns_ntoa(su->sns.sns_addr));
break;
-#endif
}
(void) fflush(stdout);
}
diff --git a/sbin/routed/tables.c b/sbin/routed/tables.c
index a05e023f3a7b..17a4fb7b966e 100644
--- a/sbin/routed/tables.c
+++ b/sbin/routed/tables.c
@@ -183,8 +183,21 @@ rtadd(dst, gate, metric, state)
rt->rt_flags = RTF_UP | flags;
rt->rt_state = state | RTS_CHANGED;
rt->rt_ifp = if_ifwithdstaddr(&rt->rt_dst);
- if (rt->rt_ifp == 0)
+ if (rt->rt_ifp == 0) {
rt->rt_ifp = if_ifwithnet(&rt->rt_router);
+ /*
+ * seems like we can't figure out the interface for the
+ * IP address of the local side of a point to point
+ * connection, we just don't add that entry in the
+ * table. (it seems to already be there anyway)
+ */
+ if (rt->rt_ifp == 0) {
+ syslog(LOG_DEBUG,
+ "rtadd: can't get interface for %s",
+ (*afswitch[dst->sa_family].af_format)(dst));
+ return;
+ }
+ }
if ((state & RTS_INTERFACE) == 0)
rt->rt_flags |= RTF_GATEWAY;
rt->rt_metric = metric;
@@ -257,8 +270,22 @@ rtchange(rt, gate, metric)
if (add) {
rt->rt_router = *gate;
rt->rt_ifp = if_ifwithdstaddr(&rt->rt_router);
- if (rt->rt_ifp == 0)
+ if (rt->rt_ifp == 0) {
rt->rt_ifp = if_ifwithnet(&rt->rt_router);
+ /*
+ * seems like we can't figure out the interface for the
+ * IP address of the local side of a point to point
+ * connection, we just don't add that entry in the
+ * table. (it seems to already be there anyway)
+ */
+ if (rt->rt_ifp == 0) {
+ struct sockaddr *dst = &(rt->rt_dst);
+ syslog(LOG_DEBUG,
+ "rtchange: can't get interface for %s",
+ (*afswitch[dst->sa_family].af_format)(dst));
+ return;
+ }
+ }
}
rt->rt_metric = metric;
rt->rt_state |= RTS_CHANGED;
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 31ff825bbf62..042ccc2c2927 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -51,6 +51,8 @@ static char sccsid[] = "@(#)savecore.c 5.26 (Berkeley) 4/8/91";
#include <stdio.h>
#include <nlist.h>
#include <paths.h>
+#include <vm/vm.h>
+#include <vm/vm_param.h>
#define DAY (60L*60L*24L)
#define LEEWAY (3*DAY)
@@ -63,7 +65,7 @@ static char sccsid[] = "@(#)savecore.c 5.26 (Berkeley) 4/8/91";
#define ok(number) ((number)&~0xc0000000)
#else
#ifdef i386
-#define ok(number) ((number)&~0xfe000000)
+#define ok(number) (((number)-KERNBASE))
#else
#define ok(number) (number)
#endif
diff --git a/sbin/scsi/Makefile b/sbin/scsi/Makefile
new file mode 100644
index 000000000000..b0839776186d
--- /dev/null
+++ b/sbin/scsi/Makefile
@@ -0,0 +1,7 @@
+# $Id: Makefile,v 1.1 1993/11/18 05:05:25 rgrimes Exp $
+
+PROG= scsi
+MAN1= scsi.1
+SRCS= procargs.c scsi.c
+
+.include <bsd.prog.mk>
diff --git a/sbin/scsi/procargs.c b/sbin/scsi/procargs.c
new file mode 100644
index 000000000000..0a7de8487d23
--- /dev/null
+++ b/sbin/scsi/procargs.c
@@ -0,0 +1,86 @@
+/*
+ * Written By Julian ELischer
+ * Copyright julian Elischer 1993.
+ * Permission is granted to use or redistribute this file in any way as long
+ * as this notice remains. Julian Elischer does not guarantee that this file
+ * is totally correct for any given task and users of this file must
+ * accept responsibility for any damage that occurs from the application of this
+ * file.
+ *
+ * (julian@tfs.com julian@dialix.oz.au)
+ *
+ * $Id: procargs.c,v 1.1 1993/11/18 05:05:26 rgrimes Exp $
+ */
+
+#include <stdio.h>
+#include <sys/file.h>
+
+extern int fd;
+extern int debuglevel;
+extern int inqflag;
+extern int reprobe;
+extern int dflag;
+extern int bus;
+extern int targ;
+extern int lun;
+char *myname;
+
+void procargs(int argc, char **argv, char **envp)
+{
+ extern char *optarg;
+ extern int optind;
+ int fflag,
+ ch;
+
+ myname = *argv;
+ fflag = 0;
+ inqflag = 0;
+ dflag = 0;
+ while ((ch = getopt(argc, argv, "irf:d:b:t:l:")) != EOF) {
+ switch (ch) {
+ case 'r':
+ reprobe = 1;
+ break;
+ case 'i':
+ inqflag = 1;
+ break;
+ case 'f':
+ if ((fd = open(optarg, O_RDWR, 0)) < 0) {
+ (void) fprintf(stderr,
+ "%s: unable to open device %s.\n",
+ myname, optarg);
+ exit(1);
+ }
+ fflag = 1;
+ break;
+ case 'd':
+ debuglevel = atoi(optarg);
+ dflag = 1;
+ break;
+ case 'b':
+ bus = atoi(optarg);
+ break;
+ case 't':
+ targ = atoi(optarg);
+ break;
+ case 'l':
+ lun = atoi(optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (!fflag) usage();
+}
+
+usage()
+{
+ printf("usage: %s -f devicename [-d level] [-i] [-r [-b bus] "
+ "[-t targ] [-l lun]]\n",myname);
+ printf("where r = reprobe, i = inquire, d = debug\n");
+ printf("If debugging is not compiled in the kernel, 'd' will have no effect\n");
+ exit (1);
+}
diff --git a/sbin/scsi/scsi.1 b/sbin/scsi/scsi.1
new file mode 100644
index 000000000000..34bb64fea124
--- /dev/null
+++ b/sbin/scsi/scsi.1
@@ -0,0 +1,55 @@
+.\"
+.\" Written By Julian ELischer
+.\" Copyright julian Elischer 1993.
+.\" Permission is granted to use or redistribute this file in any way as long
+.\" as this notice remains. Julian Elischer does not guarantee that this file
+.\" is totally correct for any given task and users of this file must
+.\" accept responsibility for any damage that occurs from the application of this
+.\" file.
+.\"
+.\" (julian@tfs.com julian@dialix.oz.au)
+.\"
+.\" $Id: scsi.1,v 1.1 1993/11/18 05:05:27 rgrimes Exp $
+.\"
+.Dd October 11, 1993
+.Dt SCSI 1
+.Os BSD 4
+.Sh NAME
+.Nm scsi
+.Nd simple program to assist with scsi devices.
+.Sh SYNOPSIS
+usage: scsi -f devicename [-d level] [-i] [-r [-b bus] [-t targ] [-l lun]]
+.Pp
+where r = reprobe, i = inquire, d = debug
+.Pp
+If debugging is not compiled in the kernel, 'd' will have no effect
+.Sh DESCRIPTION
+The
+.Nm Scsi
+program is used to give some simple commands to a scsi device. It is also
+really a sample usage of the general scsi commands. A more comprehensive
+program should be written.
+.Pp
+This program allows the operator to ask the systen to reprobe for
+more devices, and also to set any debug level on any scsi device. As
+a sample of a generic scsi command, it also can also perform a scsi
+.Em Enquiry
+command against the device against which it is openned. The
+reprobe can be aimed at any specific bus or target or even lun.
+By default it reprobes lun0 of all possible targets not yet taken.
+an lun of -1 will force testing of all LUNs. As a word of warning, this
+will override the system's caution about attaching devices not on lun0
+so if a device responds to the
+.Em inquiry
+command on all luns (as many erroneously do), the system may think it has
+found a lot more devices, which are really just the bad luns of an existing
+device.
+
+.Pp
+.Sh SEE ALSO
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm scsi
+command appeared in 386BSD 0.1.2.4/FreeBSD
+
diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c
new file mode 100644
index 000000000000..360c86947527
--- /dev/null
+++ b/sbin/scsi/scsi.c
@@ -0,0 +1,102 @@
+/*
+ * Written By Julian ELischer
+ * Copyright julian Elischer 1993.
+ * Permission is granted to use or redistribute this file in any way as long
+ * as this notice remains. Julian Elischer does not guarantee that this file
+ * is totally correct for any given task and users of this file must
+ * accept responsibility for any damage that occurs from the application of this
+ * file.
+ *
+ * (julian@tfs.com julian@dialix.oz.au)
+ *
+ * $Id: scsi.c,v 1.1 1993/11/18 05:05:28 rgrimes Exp $
+ */
+
+#include <stdio.h>
+#include <sys/scsiio.h>
+#include <sys/file.h>
+#include <scsi/scsi_all.h>
+void show_mem();
+int fd;
+int debuglevel;
+int dflag,inqflag;
+int reprobe;
+int bus = -1; /* all busses */
+int targ = -1; /* all targs */
+int lun = 0; /* just lun 0 */
+
+main(int argc, char **argv, char **envp)
+{
+ struct scsi_addr scaddr;
+ struct scsi_inquiry_data dat;
+
+ procargs(argc,argv,envp);
+ if(reprobe) {
+ scaddr.scbus = bus;
+ scaddr.target = targ;
+ scaddr.lun = lun;
+
+ if (ioctl(fd,SCIOCREPROBE,&scaddr) == -1)
+ {
+ perror("ioctl");
+ }
+ }
+ if(dflag) {
+ if (ioctl(fd,SCIOCDEBUG,&debuglevel) == -1) {
+ perror("ioctl [SCIODEBUG]");
+ exit(1);
+ }
+ }
+
+ if(inqflag) {
+ inq(fd,&dat);
+ show_mem(&dat,sizeof(dat));
+ }
+}
+
+/*
+ * Do a scsi operation asking a device what it is
+ * Use the scsi_cmd routine in the switch table.
+ */
+int inq(fd,inqbuf)
+ int fd;
+ struct scsi_inquiry_data *inqbuf;
+{
+ struct scsi_inquiry *cmd;
+ scsireq_t req;
+ cmd = (struct scsi_inquiry *) req.cmd;
+
+ bzero(&req,sizeof(req));
+
+ cmd->op_code = INQUIRY;
+ cmd->length = sizeof(struct scsi_inquiry_data);
+
+ req.flags = SCCMD_READ; /* info about the request status and type */
+ req.timeout = 2000;
+ req.cmdlen = sizeof(*cmd);
+ req.databuf = (caddr_t)inqbuf; /* address in user space of buffer */
+ req.datalen = sizeof(*inqbuf); /* size of user buffer */
+ if (ioctl(fd,SCIOCCOMMAND,&req) == -1)
+ {
+ perror("ioctl");
+ exit (1);
+ }
+}
+
+
+void
+show_mem(address, num)
+ unsigned char *address;
+ int num;
+{
+ int x, y;
+ printf("------------------------------");
+ for (y = 0; y < num; y += 1) {
+ if (!(y % 16))
+ printf("\n%03d: ", y);
+ printf("%02x ", *address++);
+ }
+ printf("\n------------------------------\n");
+}
+
+
diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c
index b8cffd091fe1..66b8e1577075 100644
--- a/sbin/slattach/slattach.c
+++ b/sbin/slattach/slattach.c
@@ -81,6 +81,12 @@
* rid of redundant syslog()'s to minimize console log output. Improved
* logging of improper command line options or number of command
* arguments. Removed spurious newline characters from syslog() calls.
+ *
+ * gjung@gjbsd.franken.de
+ *
+ * sighup_handler changed to set CLOCAL before running redial_cmd.
+ * added flag exiting, so exit_handler is not run twice.
+ *
*/
#ifndef lint
@@ -135,8 +141,11 @@ int speed = DEFAULT_BAUD;
int slflags = 0; /* compression flags */
int unit = -1; /* slip device unit number */
int foreground = 0;
+int exiting = 0; /* allready running exit_handler */
FILE *console;
+struct termios tty;
+
char devname[32];
char hostname[MAXHOSTNAMELEN];
char *redial_cmd = 0; /* command to exec upon shutdown. */
@@ -281,8 +290,6 @@ int main(int argc, char **argv)
void setup_line()
{
- struct termios tty;
-
tty.c_lflag = tty.c_iflag = tty.c_oflag = 0;
tty.c_cflag = CREAD | CS8 | flow_control | modem_control;
tty.c_ispeed = tty.c_ospeed = speed;
@@ -343,6 +350,7 @@ void attach_line()
/* Signal handler for SIGHUP when carrier is dropped. */
void sighup_handler()
{
+ if(exiting) return;
again:
/* reset discipline */
if (ioctl(fd, TIOCSETD, &ttydisc) < 0) {
@@ -353,9 +361,21 @@ again:
if (redial_cmd) {
syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); running %s",
dev,unit,redial_cmd);
+ if (!(modem_control & CLOCAL)) {
+ tty.c_cflag |= CLOCAL;
+ if (tcsetattr(fd, TCSAFLUSH, &tty) < 0) {
+ syslog(LOG_ERR, "tcsetattr(TCSAFLUSH): %m");
+ exit_handler(1);
+ }
+ }
system(redial_cmd);
/* Now check again for carrier (dial command is done): */
if (!(modem_control & CLOCAL)) {
+ tty.c_cflag &= ~CLOCAL;
+ if (tcsetattr(fd, TCSAFLUSH, &tty) < 0) {
+ syslog(LOG_ERR, "tcsetattr(TCSAFLUSH): %m");
+ exit_handler(1);
+ }
ioctl(fd, TIOCMGET, &comstate);
if (!(comstate & TIOCM_CD)) { /* check for carrier */
/* force a redial if no carrier */
@@ -405,18 +425,22 @@ again:
/* Signal handler for SIGINT. We just log and exit. */
void sigint_handler()
{
+ if(exiting) return;
syslog(LOG_NOTICE,"sl%d on %s caught SIGINT, exiting.",unit,dev);
exit_handler(0);
}
/* Signal handler for SIGTERM. We just log and exit. */
void sigterm_handler()
{
+ if(exiting) return;
syslog(LOG_NOTICE,"SIGTERM on %s (sl%d); exiting",dev,unit);
exit_handler(0);
}
/* Run config_cmd if specified before exiting. */
void exit_handler(int ret)
{
+ if(exiting) return;
+ exiting = 1;
/*
* First close the slip line in case exit_cmd wants it (like to hang
* up a modem or something).
diff --git a/sbin/st/Makefile b/sbin/st/Makefile
index e6e31fb90625..be70d4bbbbc2 100644
--- a/sbin/st/Makefile
+++ b/sbin/st/Makefile
@@ -1,6 +1,6 @@
-# @(#)Makefile 5.4 (Berkeley) 6/5/91
+# $Id: Makefile,v 1.2 1993/11/18 05:05:39 rgrimes Exp $
PROG= st
-MAN8= st.8
+MAN1= st.1
.include <bsd.prog.mk>
diff --git a/sbin/st/st.8 b/sbin/st/st.1
index 246afd5dd409..efe8864517bc 100644
--- a/sbin/st/st.8
+++ b/sbin/st/st.1
@@ -56,6 +56,17 @@ that
.Ar tapename
must reference a raw (not block) tape device.
.Pp
+The tape drive will hold density and blocking parameters until the next
+unmount. In the case of rst0, this is immediately and is therefore of
+not much use with this device. In the case of nrst0 this
+may be after several commands when either an offline command is issued or
+rst0 is openned and closed. If parameters are to be held across
+unmounts, then they should be made to the control device for each
+mode.. i.e. the devices with a submode of 3 (minors 3,7,11,15 for example).
+It is suggested that the operator keep the control device unreadble
+and unwritable to normal system users, while giving them access to
+the non-rewind device (e.g. nrst0) on demand.
+.Pp
The available commands are listed below. Only as many
characters as are required to uniquely identify a command
need be specified.
@@ -87,7 +98,8 @@ Rewind the tape
Rewind the tape and place the tape unit off-line (possibly eject)
(Count is ignored).
.It Cm blocksize
-Sets the block size characteristics of the device to value specified in
+Sets the block size characteristics of the openned
+device to value specified in
.Ar count.
A 0 means variable sized blocks, and anything else means fixed block,
with blocksize as that of
@@ -189,6 +201,8 @@ where Notes means:
.It Cm status
Print status information about the tape unit.
+Information is printed out about the present active parameters and
+also the four Operating modes available.
.El
.Pp
If a tape name is not specified, and the environment variable
@@ -196,7 +210,7 @@ If a tape name is not specified, and the environment variable
does not exist;
.Nm st
uses the device
-.Pa /dev/rst0 .
+.Pa /dev/nrst0 .
.Pp
.Nm St
returns a 0 exit status when the operation(s) were successful,
diff --git a/sbin/st/st.c b/sbin/st/st.c
index f630b763fe28..9ae9bc77a5e4 100644
--- a/sbin/st/st.c
+++ b/sbin/st/st.c
@@ -111,7 +111,7 @@ main(argc, argv)
if (strncmp(cp, comp->c_name, strlen(cp)) == 0)
break;
if (comp->c_name == NULL) {
- fprintf(stderr, "mt: don't grok \"%s\"\n", cp);
+ fprintf(stderr, "st: don't grok \"%s\"\n", cp);
usage();
exit(1);
}
@@ -123,7 +123,7 @@ main(argc, argv)
mt_com.mt_op = comp->c_code;
mt_com.mt_count = (argc > 2 ? atoi(argv[2]) : 1);
if (mt_com.mt_count < 0) {
- fprintf(stderr, "mt: negative repeat count\n");
+ fprintf(stderr, "st: negative repeat count\n");
exit(1);
}
if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0) {
@@ -134,7 +134,7 @@ main(argc, argv)
}
} else {
if (ioctl(mtfd, MTIOCGET, (char *)&mt_status) < 0) {
- perror("mt");
+ perror("st");
exit(2);
}
status(&mt_status);
@@ -194,23 +194,25 @@ status(bp)
{
register struct tape_desc *mt;
- for (mt = tapes; mt->t_type; mt++)
- if (mt->t_type == bp->mt_type)
- break;
- if (mt->t_type == 0) {
- printf("unknown tape drive type (%d)\n", bp->mt_type);
- return;
- }
- printf("%s tape drive, residual=%d, blocksize=%d\n",
- mt->t_name, bp->mt_resid, bp->mt_bsiz);
- printf("Density: dflt(0) = %d(0x%x) 1 = %d(0x%x), 2 = %d(0x%x), 3 = %d(0x%x)\n",
- bp->mt_dns_dflt, bp->mt_dns_dflt,
- bp->mt_dns_dsty1, bp->mt_dns_dsty1,
- bp->mt_dns_dsty2, bp->mt_dns_dsty2,
- bp->mt_dns_dsty3, bp->mt_dns_dsty3);
+ printf("Present Mode: Density = 0x%02x, Blocksize = %d bytes\n",
+ bp->mt_density, bp->mt_blksiz);
+ printf("---------available modes----------\n");
+ printf("Mode 0: Density = 0x%02x, Blocksize = %d bytes\n",
+ bp->mt_density0, bp->mt_blksiz0);
+ printf("Mode 1: Density = 0x%02x, Blocksize = %d bytes\n",
+ bp->mt_density1, bp->mt_blksiz1);
+ printf("Mode 2: Density = 0x%02x, Blocksize = %d bytes\n",
+ bp->mt_density2, bp->mt_blksiz2);
+ printf("Mode 3: Density = 0x%02x, Blocksize = %d bytes\n",
+ bp->mt_density3, bp->mt_blksiz3);
+
+#ifdef NOTYET
+ printf("tape drive: residual=%d\n",
+ bp->mt_resid);
printreg("ds", bp->mt_dsreg, mt->t_dsbits);
printreg("\ner", bp->mt_erreg, mt->t_erbits);
putchar('\n');
+#endif
}
/*
diff --git a/sbin/swapon/swapon.8 b/sbin/swapon/swapon.8
index 596a7e576977..7c77cf9bf296 100644
--- a/sbin/swapon/swapon.8
+++ b/sbin/swapon/swapon.8
@@ -73,8 +73,8 @@ available to the system for swap allocation.
.Xr init 8
.Xr rc 8
.Sh FILES
-.Bl -tag -width /dev/[ru][pk]?b -compact
-.It Pa /dev/[ru][pk]?b
+.Bl -tag -width /dev/[ws]d?b -compact
+.It Pa /dev/[ws]d?b
standard paging devices
.It Pa /etc/fstab
ascii filesystem description table
diff --git a/sbin/umount/Makefile b/sbin/umount/Makefile
index 45121683e8ba..eeeaf9e2b19a 100644
--- a/sbin/umount/Makefile
+++ b/sbin/umount/Makefile
@@ -3,7 +3,5 @@
PROG= umount
CFLAGS+=-DNFS
NOMAN= noman
-DPADD= ${LIBRPC}
-LDADD= -lrpc
.include <bsd.prog.mk>