Index: head/bin/ps/ps.1 =================================================================== --- head/bin/ps/ps.1 (revision 1855) +++ head/bin/ps/ps.1 (revision 1856) @@ -1,502 +1,502 @@ .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" .Dd April 18, 1994 .Dt PS 1 .Os BSD 4 .Sh NAME .Nm \&ps .Nd process status .Sh SYNOPSIS .Nm \&ps .Op Fl aCehjlmrSTuvwx .Op Fl M Ar core .Op Fl N Ar system .Op Fl O Ar fmt .Op Fl o Ar fmt .Op Fl p Ar pid .Op Fl t Ar tty .Op Fl W Ar swap .Nm ps .Op Fl L .Sh DESCRIPTION .Nm \&Ps displays a header line followed by lines containing information about your processes that have controlling terminals. This information is sorted by process .Tn ID . .Pp The information displayed is selected based on a set of keywords (see the .Fl L .Fl O and .Fl o options). The default output format includes, for each process, the process' .Tn ID , controlling terminal, cpu time (including both user and system time), state, and associated command. .Pp The options are as follows: .Bl -tag -width indent .It Fl a Display information about other users' processes as well as your own. .It Fl C Change the way the cpu percentage is calculated by using a ``raw'' cpu calculation that ignores ``resident'' time (this normally has no effect). .It Fl e Display the environment as well. .It Fl h Repeat the information header as often as necessary to guarantee one header per page of information. .It Fl j Print information associated with the following keywords: user, pid, ppid, pgid, sess, jobc, state, tt, time and command. .It Fl L List the set of available keywords. .It Fl l Display information associated with the following keywords: uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time and command. .It Fl M Extract values associated with the name list from the specified core instead of the default .Dq Pa /dev/kmem . .It Fl m Sort by memory usage, instead of by process .Tn ID . .It Fl N Extract the name list from the specified system instead of the default -.Dq Pa /vmunix . +.Dq Pa /kernel . .It Fl O Add the information associated with the space or comma separated list of keywords specified, after the process .Tn ID , in the default information display. Keywords may be appended with an equals (``='') sign and a string. This causes the printed header to use the specified string instead of the standard header. .It Fl o Display information associated with the space or comma separated list of keywords specified. Keywords may be appended with an equals (``='') sign and a string. This causes the printed header to use the specified string instead of the standard header. .It Fl p Display information associated with the specified process .Tn ID . .It Fl r Sort by current cpu usage, instead of by process .Tn ID . .It Fl S Change the way the process time is calculated by summing all exited children to their parent process. .It Fl T Display information about processes attached to the device associated with the standard input. .It Fl t Display information about processes attached to the specified terminal device. .It Fl u Display information associated with the following keywords: user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command. The .Fl u option implies the .Fl r option. .It Fl v Display information associated with the following keywords: pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, %cpu, %mem and command. The .Fl v option implies the .Fl m option. .It Fl W Extract swap information from the specified file instead of the default .Dq Pa /dev/swap . .It Fl w Use 132 columns to display information, instead of the default which is your window size. If the .Fl w option is specified more than once, .Nm \&ps will use as many columns as necessary without regard for your window size. .It Fl x Display information about processes without controlling terminals. .El .Pp A complete list of the available keywords are listed below. Some of these keywords are further specified as follows: .Bl -tag -width indent .It %cpu The cpu utilization of the process; this is a decaying average over up to a minute of previous (real) time. Since the time base over which this is computed varies (since processes may be very young) it is possible for the sum of all .Tn \&%CPU fields to exceed 100%. .It %mem The percentage of real memory used by this process. .It flags The flags (in hexadecimal) associated with the process as in the include file .Aq Pa sys/proc.h : .Bl -column SNOCLDSTOP SNOCLDSTOP .It Dv "SLOAD" Ta No "0x0000001 in core" .It Dv "SSYS" Ta No "0x0000002 swapper or pager process" .It Dv "SLOCK" Ta No "0x0000004 process being swapped out" .It Dv "SSWAP" Ta No "0x0000008 save area flag" .It Dv "STRC" Ta No "0x0000010 process is being traced" .It Dv "SWTED" Ta No "0x0000020 another tracing flag" .It Dv "SSINTR" Ta No "0x0000040 sleep is interruptible" .It Dv "SKEEP" Ta No "0x0000100 another flag to prevent swap out" .It Dv "SOMASK" Ta No "0x0000200 restore old mask after taking signal" .It Dv "SWEXIT" Ta No "0x0000400 working on exiting" .It Dv "SPHYSIO" Ta No "0x0000800 doing physical" .Tn I/O .It Dv "SVFORK" Ta No "0x0001000 process resulted from" .Xr vfork 2 .It Dv "SVFDONE" Ta No "0x0002000 another" .Xr vfork flag .It Dv "SNOVM" Ta No "0x0004000 no vm, parent in a" .Xr vfork .It Dv "SPAGV" Ta No "0x0008000 init data space on demand, from vnode" .It Dv "SSEQL" Ta No "0x0010000 user warned of sequential vm behavior" .It Dv "SUANOM" Ta No "0x0020000 user warned of random vm behavior" .It Dv "STIMO" Ta No "0x0040000 timing out during sleep" .It Dv "SNOCLDSTOP" Ta No "0x0080000 no" .Dv SIGCHLD when children stop .It Dv "SCTTY" Ta No "0x0100000 has a controlling terminal" .It Dv "SOWEUPC" Ta No "0x0200000 owe process an addupc() call at next ast" .\" the routine addupc is not documented in the man pages .It Dv "SSEL" Ta No "0x0400000 selecting; wakeup/waiting danger" .It Dv "SEXEC" Ta No "0x0800000 process called" .Xr exec 2 .It Dv "SHPUX" Ta No "0x1000000 \\*(tNHP-UX\\*(sP process .Pq Dv HPUXCOMPAT .It Dv "SULOCK" Ta No "0x2000000 locked in core after swap error" .It Dv "SPTECHG" Ta No "0x4000000 pte's for process have changed" .El .It lim The soft limit on memory used, specified via a call to .Xr setrlimit 2 . .It lstart The exact time the command started, using the ``%C'' format described in .Xr strftime 3 . .It nice The process scheduling increment (see .Xr setpriority 2 ) . .It rss the real memory (resident set) size of the process (in 1024 byte units). .It start The time the command started. If the command started less than 24 hours ago, the start time is displayed using the ``%l:ps.1p'' format described in .Xr strftime 3 . If the command started less than 7 days ago, the start time is displayed using the ``%a6.15p'' format. Otherwise, the start time is displayed using the ``%e%b%y'' format. .It state The state is given by a sequence of letters, for example, .Dq Tn RWNA . The first letter indicates the run state of the process: .Pp .Bl -tag -width indent -compact .It D Marks a process in disk (or other short term, uninterruptible) wait. .It I Marks a process that is idle (sleeping for longer than about 20 seconds). .It R Marks a runnable process. .It S Marks a process that is sleeping for less than about 20 seconds. .It T Marks a stopped process. .It Z Marks a dead process (a ``zombie''). .El .Pp Additional characters after these, if any, indicate additional state information: .Pp .Bl -tag -width indent -compact .It + The process is in the foreground process group of its control terminal. .It < The process has raised .Tn CPU scheduling priority. .It > The process has specified a soft limit on memory requirements and is currently exceeding that limit; such a process is (necessarily) not swapped. .It A the process has asked for random page replacement .Pf ( Dv VA_ANOM , from .Xr vadvise 2 , for example, .Xr lisp 1 in a garbage collect). .It E The process is trying to exit. .It L The process has pages locked in core (for example, for raw .Tn I/O ) . .It N The process has reduced .Tn CPU scheduling priority (see .Xr setpriority 2 ) . .It S The process has asked for .Tn FIFO page replacement .Pf ( Dv VA_SEQL , from .Xr vadvise 2 , for example, a large image processing program using virtual memory to sequentially address voluminous data). .It s The process is a session leader. .It V The process is suspended during a .Xr vfork . .It W The process is swapped out. .It X The process is being traced or debugged. .El .It tt An abbreviation for the pathname of the controlling terminal, if any. The abbreviation consists of the two letters following .Dq Pa /dev/tty , or, for the console, ``co''. This is followed by a ``-'' if the process can no longer reach that controlling terminal (i.e., it has been revoked). .It wchan The event (an address in the system) on which a process waits. When printed numerically, the initial part of the address is trimmed off and the result is printed in hex, for example, 0x80324000 prints as 324000. .El .Pp When printing using the command keyword, a process that has exited and has a parent that has not yet waited for the process (in other words, a zombie) is listed as ``'', and a process which is blocked while trying to exit is listed as ``''. .Nm \&Ps makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be depended on too much. The ucomm (accounting) keyword can, however, be depended on. .Sh KEYWORDS The following is a complete list of the available keywords and their meanings. Several of them have aliases (keywords which are synonyms). .Pp .Bl -tag -width sigignore -compact .It %cpu percentage cpu usage (alias pcpu) .It %mem percentage memory usage (alias pmem) .It acflag accounting flag (alias acflg) .It command command and arguments .It cpu short-term cpu usage factor (for scheduling) .It flags the process flags, in hexadecimal (alias f) .It inblk total blocks read (alias inblock) .It jobc job control count .It ktrace tracing flags .It ktracep tracing vnode .It lim memoryuse limit .It logname login name of user who started the process .It lstart time started .It majflt total page faults .It minflt total page reclaims .It msgrcv total messages received (reads from pipes/sockets) .It msgsnd total messages sent (writes on pipes/sockets) .It nice nice value (alias ni) .It nivcsw total involuntary context switches .It nsigs total signals taken (alias nsignals) .It nswap total swaps in/out .It nvcsw total voluntary context switches .It nwchan wait channel (as an address) .It oublk total blocks written (alias oublock) .It p_ru resource usage (valid only for zombie) .It paddr swap address .It pagein pageins (same as majflt) .It pgid process group number .It pid process .Tn ID .It poip pageouts in progress .It ppid parent process .Tn ID .It pri scheduling priority .It re core residency time (in seconds; 127 = infinity) .It rgid real group .Tn ID .It rlink reverse link on run queue, or 0 .It rss resident set size .It rsz resident set size + (text size / text use count) (alias rssize) .It ruid real user .Tn ID .It ruser user name (from ruid) .It sess session pointer .It sig pending signals (alias pending) .It sigcatch caught signals (alias caught) .It sigignore ignored signals (alias ignored) .It sigmask blocked signals (alias blocked) .It sl sleep time (in seconds; 127 = infinity) .It start time started .It state symbolic process state (alias stat) .It svgid saved gid from a setgid executable .It svuid saved uid from a setuid executable .It tdev control terminal device number .It time accumulated cpu time, user + system (alias cputime) .It tpgid control terminal process group .Tn ID .\".It trss .\"text resident set size (in Kbytes) .It tsess control terminal session pointer .It tsiz text size (in Kbytes) .It tt control terminal name (two letter abbreviation) .It tty full name of control terminal .It uprocp process pointer .It ucomm name to be used for accounting .It uid effective user .Tn ID .It upr scheduling priority on return from system call (alias usrpri) .It user user name (from uid) .It vsz virtual size in Kbytes (alias vsize) .It wchan wait channel (as a symbolic name) .It xstat exit or stop status (valid only for stopped or zombie process) .El .Sh FILES -.Bl -tag -width /var/run/kvm_vmunix.db -compact +.Bl -tag -width /var/run/kvm_kernel.db -compact .It Pa /dev special files and device names .It Pa /dev/drum default swap device .It Pa /dev/kmem default kernel memory .It Pa /var/run/dev.db /dev name database -.It Pa /var/run/kvm_vmunix.db +.It Pa /var/run/kvm_kernel.db system namelist database -.It Pa /vmunix +.It Pa /kernel default system namelist .El .Sh SEE ALSO .Xr kill 1 , .Xr w 1 , .Xr kvm 3 , .Xr strftime 3 , .Xr pstat 8 .Sh BUGS Since .Nm \&ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact. Index: head/lib/libc/sys/reboot.2 =================================================================== --- head/lib/libc/sys/reboot.2 (revision 1855) +++ head/lib/libc/sys/reboot.2 (revision 1856) @@ -1,158 +1,158 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 .\" .Dd June 4, 1993 .Dt REBOOT 2 .Os BSD 4 .Sh NAME .Nm reboot .Nd reboot system or halt processor .Sh SYNOPSIS .Fd #include .Fd #include .Ft int .Fn reboot "int howto" .Sh DESCRIPTION .Fn Reboot reboots the system. Only the super-user may reboot a machine on demand. However, a reboot is invoked automatically in the event of unrecoverable system failures. .Pp .Fa Howto is a mask of options; the system call interface allows the following options, defined in the include file .Aq Pa sys/reboot.h , to be passed to the new kernel or the new bootstrap and init programs. .Bl -tag -width RB_INITNAMEA .It Dv RB_AUTOBOOT The default, causing the system to reboot in its usual fashion. .It Dv RB_ASKNAME Interpreted by the bootstrap program itself, causing it to prompt on the console as to what file should be booted. Normally, the system is booted from the file -.Dq Em xx Ns No (0,0)vmunix , +.Dq Em xx Ns No (0,0)kernel , where .Em xx is the default disk name, without prompting for the file name. .It Dv RB_DFLTROOT Use the compiled in root device. Normally, the system uses the device from which it was booted as the root device if possible. (The default behavior is dependent on the ability of the bootstrap program to determine the drive from which it was loaded, which is not possible on all systems.) .It Dv RB_DUMP Dump kernel memory before rebooting; see .Xr savecore 8 for more information. .It Dv RB_HALT the processor is simply halted; no reboot takes place. This option should be used with caution. .It Dv RB_INITNAME An option allowing the specification of an init program (see .Xr init 8 ) other than .Pa /sbin/init to be run when the system reboots. This switch is not currently available. .It Dv RB_KDB Load the symbol table and enable a built-in debugger in the system. This option will have no useful function if the kernel is not configured for debugging. Several other options have different meaning if combined with this option, although their use may not be possible via the .Fn reboot call. See .Xr kadb 4 for more information. .It Dv RB_NOSYNC Normally, the disks are sync'd (see .Xr sync 8 ) before the processor is halted or rebooted. This option may be useful if file system changes have been made manually or if the processor is on fire. .It Dv RB_RDONLY Initially mount the root file system read-only. This is currently the default, and this option has been deprecated. .It Dv RB_SINGLE Normally, the reboot procedure involves an automatic disk consistency check and then multi-user operations. .Dv RB_SINGLE prevents this, booting the system with a single-user shell on the console. .Dv RB_SINGLE is actually interpreted by the .Xr init 8 program in the newly booted system. .Pp When no options are given (i.e., .Dv RB_AUTOBOOT is used), the system is -rebooted from file ``vmunix'' in the root file system of unit 0 +rebooted from file ``kernel'' in the root file system of unit 0 of a disk chosen in a processor specific way. An automatic consistency check of the disks is normally performed (see .Xr fsck 8 ) . .El .Sh RETURN VALUES If successful, this call never returns. Otherwise, a -1 is returned and an error is returned in the global variable .Va errno . .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM The caller is not the super-user. .El .Sh SEE ALSO .Xr kadb 4 , .Xr crash 8 , .Xr halt 8 , .Xr init 8 , .Xr reboot 8 , .Xr savecore 8 .Sh BUGS The HP300 implementation supports neither .Dv RB_DFLTROOT nor .Dv RB_KDB . .Sh HISTORY The .Nm function call appeared in .Bx 4.0 . Index: head/lib/libkvm/kvm.c =================================================================== --- head/lib/libkvm/kvm.c (revision 1855) +++ head/lib/libkvm/kvm.c (revision 1856) @@ -1,540 +1,540 @@ /*- * Copyright (c) 1989, 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software developed by the Computer Systems * Engineering group at Lawrence Berkeley Laboratory under DARPA contract * BG 91-66 and contributed to Berkeley. * * 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. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kvm_private.h" static int kvm_dbopen __P((kvm_t *, const char *)); char * kvm_geterr(kd) kvm_t *kd; { return (kd->errbuf); } #if __STDC__ #include #else #include #endif /* * Report an error using printf style arguments. "program" is kd->program * on hard errors, and 0 on soft errors, so that under sun error emulation, * only hard errors are printed out (otherwise, programs like gdb will * generate tons of error messages when trying to access bogus pointers). */ void #if __STDC__ _kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) #else _kvm_err(kd, program, fmt, va_alist) kvm_t *kd; char *program, *fmt; va_dcl #endif { va_list ap; #ifdef __STDC__ va_start(ap, fmt); #else va_start(ap); #endif if (program != NULL) { (void)fprintf(stderr, "%s: ", program); (void)vfprintf(stderr, fmt, ap); (void)fputc('\n', stderr); } else (void)vsnprintf(kd->errbuf, sizeof(kd->errbuf), (char *)fmt, ap); va_end(ap); } void #if __STDC__ _kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...) #else _kvm_syserr(kd, program, fmt, va_alist) kvm_t *kd; char *program, *fmt; va_dcl #endif { va_list ap; register int n; #if __STDC__ va_start(ap, fmt); #else va_start(ap); #endif if (program != NULL) { (void)fprintf(stderr, "%s: ", program); (void)vfprintf(stderr, fmt, ap); (void)fprintf(stderr, ": %s\n", strerror(errno)); } else { register char *cp = kd->errbuf; (void)vsnprintf(cp, sizeof(kd->errbuf), (char *)fmt, ap); n = strlen(cp); (void)snprintf(&cp[n], sizeof(kd->errbuf) - n, ": %s", strerror(errno)); } va_end(ap); } void * _kvm_malloc(kd, n) register kvm_t *kd; register size_t n; { void *p; if ((p = malloc(n)) == NULL) _kvm_err(kd, kd->program, strerror(errno)); return (p); } static kvm_t * _kvm_open(kd, uf, mf, sf, flag, errout) register kvm_t *kd; const char *uf; const char *mf; const char *sf; int flag; char *errout; { struct stat st; kd->vmfd = -1; kd->pmfd = -1; kd->swfd = -1; kd->nlfd = -1; kd->vmst = 0; kd->db = 0; kd->procbase = 0; kd->argspc = 0; kd->argv = 0; if (uf == 0) uf = _PATH_UNIX; else if (strlen(uf) >= MAXPATHLEN) { _kvm_err(kd, kd->program, "exec file name too long"); goto failed; } if (flag & ~O_RDWR) { _kvm_err(kd, kd->program, "bad flags arg"); goto failed; } if (mf == 0) mf = _PATH_MEM; if (sf == 0) sf = _PATH_DRUM; if ((kd->pmfd = open(mf, flag, 0)) < 0) { _kvm_syserr(kd, kd->program, "%s", mf); goto failed; } if (fstat(kd->pmfd, &st) < 0) { _kvm_syserr(kd, kd->program, "%s", mf); goto failed; } if (S_ISCHR(st.st_mode)) { /* * If this is a character special device, then check that * it's /dev/mem. If so, open kmem too. (Maybe we should * make it work for either /dev/mem or /dev/kmem -- in either * case you're working with a live kernel.) */ if (strcmp(mf, _PATH_MEM) != 0) { /* XXX */ _kvm_err(kd, kd->program, "%s: not physical memory device", mf); goto failed; } if ((kd->vmfd = open(_PATH_KMEM, flag)) < 0) { _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; } if ((kd->swfd = open(sf, flag, 0)) < 0) { _kvm_syserr(kd, kd->program, "%s", sf); goto failed; } /* * Open kvm nlist database. We go ahead and do this - * here so that we don't have to hold on to the vmunix + * here so that we don't have to hold on to the kernel * path name. Since a kvm application will surely do * a kvm_nlist(), this probably won't be a wasted effort. * If the database cannot be opened, open the namelist * argument so we revert to slow nlist() calls. */ if (kvm_dbopen(kd, uf) < 0 && (kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { _kvm_syserr(kd, kd->program, "%s", uf); goto failed; } } else { /* * This is a crash dump. * Initalize the virtual address translation machinery, * but first setup the namelist fd. */ if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { _kvm_syserr(kd, kd->program, "%s", uf); goto failed; } if (_kvm_initvtop(kd) < 0) goto failed; } return (kd); failed: /* * Copy out the error if doing sane error semantics. */ if (errout != 0) strcpy(errout, kd->errbuf); (void)kvm_close(kd); return (0); } kvm_t * kvm_openfiles(uf, mf, sf, flag, errout) const char *uf; const char *mf; const char *sf; int flag; char *errout; { register kvm_t *kd; if ((kd = malloc(sizeof(*kd))) == NULL) { (void)strcpy(errout, strerror(errno)); return (0); } kd->program = 0; return (_kvm_open(kd, uf, mf, sf, flag, errout)); } kvm_t * kvm_open(uf, mf, sf, flag, program) const char *uf; const char *mf; const char *sf; int flag; const char *program; { register kvm_t *kd; if ((kd = malloc(sizeof(*kd))) == NULL && program != NULL) { (void)fprintf(stderr, "%s: %s\n", strerror(errno)); return (0); } kd->program = program; return (_kvm_open(kd, uf, mf, sf, flag, NULL)); } int kvm_close(kd) kvm_t *kd; { register int error = 0; if (kd->pmfd >= 0) error |= close(kd->pmfd); if (kd->vmfd >= 0) error |= close(kd->vmfd); if (kd->nlfd >= 0) error |= close(kd->nlfd); if (kd->swfd >= 0) error |= close(kd->swfd); if (kd->db != 0) error |= (kd->db->close)(kd->db); if (kd->vmst) _kvm_freevtop(kd); if (kd->procbase != 0) free((void *)kd->procbase); if (kd->argv != 0) free((void *)kd->argv); free((void *)kd); return (0); } /* * Set up state necessary to do queries on the kernel namelist * data base. If the data base is out-of-data/incompatible with * given executable, set up things so we revert to standard nlist call. * Only called for live kernels. Return 0 on success, -1 on failure. */ static int kvm_dbopen(kd, uf) kvm_t *kd; const char *uf; { char *cp; DBT rec; int dbversionlen; struct nlist nitem; char dbversion[_POSIX2_LINE_MAX]; char kversion[_POSIX2_LINE_MAX]; char dbname[MAXPATHLEN]; if ((cp = rindex(uf, '/')) != 0) uf = cp + 1; (void)snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf); kd->db = dbopen(dbname, O_RDONLY, 0, DB_HASH, NULL); if (kd->db == 0) return (-1); /* * read version out of database */ rec.data = VRS_KEY; rec.size = sizeof(VRS_KEY) - 1; if ((kd->db->get)(kd->db, (DBT *)&rec, (DBT *)&rec, 0)) goto close; if (rec.data == 0 || rec.size > sizeof(dbversion)) goto close; bcopy(rec.data, dbversion, rec.size); dbversionlen = rec.size; /* * Read version string from kernel memory. * Since we are dealing with a live kernel, we can call kvm_read() * at this point. */ rec.data = VRS_SYM; rec.size = sizeof(VRS_SYM) - 1; if ((kd->db->get)(kd->db, (DBT *)&rec, (DBT *)&rec, 0)) goto close; if (rec.data == 0 || rec.size != sizeof(struct nlist)) goto close; bcopy((char *)rec.data, (char *)&nitem, sizeof(nitem)); if (kvm_read(kd, (u_long)nitem.n_value, kversion, dbversionlen) != dbversionlen) goto close; /* * If they match, we win - otherwise clear out kd->db so * we revert to slow nlist(). */ if (bcmp(dbversion, kversion, dbversionlen) == 0) return (0); close: (void)(kd->db->close)(kd->db); kd->db = 0; return (-1); } int kvm_nlist(kd, nl) kvm_t *kd; struct nlist *nl; { register struct nlist *p; register int nvalid; /* * If we can't use the data base, revert to the * slow library call. */ if (kd->db == 0) return (__fdnlist(kd->nlfd, nl)); /* * We can use the kvm data base. Go through each nlist entry * and look it up with a db query. */ nvalid = 0; for (p = nl; p->n_name && p->n_name[0]; ++p) { register int len; DBT rec; if ((len = strlen(p->n_name)) > 4096) { /* sanity */ _kvm_err(kd, kd->program, "symbol too large"); return (-1); } rec.data = p->n_name; rec.size = len; if ((kd->db->get)(kd->db, (DBT *)&rec, (DBT *)&rec, 0)) continue; if (rec.data == 0 || rec.size != sizeof(struct nlist)) continue; ++nvalid; /* * Avoid alignment issues. */ bcopy((char *)&((struct nlist *)rec.data)->n_type, (char *)&p->n_type, sizeof(p->n_type)); bcopy((char *)&((struct nlist *)rec.data)->n_value, (char *)&p->n_value, sizeof(p->n_value)); } /* * Return the number of entries that weren't found. */ return ((p - nl) - nvalid); } ssize_t kvm_read(kd, kva, buf, len) kvm_t *kd; register u_long kva; register void *buf; register size_t len; { register int cc; register void *cp; if (ISALIVE(kd)) { /* * We're using /dev/kmem. Just read straight from the * device and let the active kernel do the address translation. */ errno = 0; if (lseek(kd->vmfd, (off_t)kva, 0) == -1 && errno != 0) { _kvm_err(kd, 0, "invalid address (%x)", kva); return (0); } cc = read(kd->vmfd, buf, len); if (cc < 0) { _kvm_syserr(kd, 0, "kvm_read"); return (0); } else if (cc < len) _kvm_err(kd, kd->program, "short read"); return (cc); } else { cp = buf; while (len > 0) { u_long pa; cc = _kvm_kvatop(kd, kva, &pa); if (cc == 0) return (0); if (cc > len) cc = len; errno = 0; if (lseek(kd->pmfd, (off_t)pa, 0) == -1 && errno != 0) { _kvm_syserr(kd, 0, _PATH_MEM); break; } cc = read(kd->pmfd, cp, cc); if (cc < 0) { _kvm_syserr(kd, kd->program, "kvm_read"); break; } /* * If kvm_kvatop returns a bogus value or our core * file is truncated, we might wind up seeking beyond * the end of the core file in which case the read will * return 0 (EOF). */ if (cc == 0) break; (char *)cp += cc; kva += cc; len -= cc; } return ((char *)cp - (char *)buf); } /* NOTREACHED */ } ssize_t kvm_write(kd, kva, buf, len) kvm_t *kd; register u_long kva; register const void *buf; register size_t len; { register int cc; if (ISALIVE(kd)) { /* * Just like kvm_read, only we write. */ errno = 0; if (lseek(kd->vmfd, (off_t)kva, 0) == -1 && errno != 0) { _kvm_err(kd, 0, "invalid address (%x)", kva); return (0); } cc = write(kd->vmfd, buf, len); if (cc < 0) { _kvm_syserr(kd, 0, "kvm_write"); return (0); } else if (cc < len) _kvm_err(kd, kd->program, "short write"); return (cc); } else { _kvm_err(kd, kd->program, "kvm_write not implemented for dead kernels"); return (0); } /* NOTREACHED */ } Index: head/lib/libkvm/kvm_nlist.3 =================================================================== --- head/lib/libkvm/kvm_nlist.3 (revision 1855) +++ head/lib/libkvm/kvm_nlist.3 (revision 1856) @@ -1,88 +1,88 @@ .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software developed by the Computer Systems .\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract .\" BG 91-66 and contributed to Berkeley. .\" .\" 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. .\" .\" @(#)kvm_nlist.3 8.1 (Berkeley) 6/4/93 .\" .Dd June 4, 1993 .Dt KVM_NLIST 3 .Os .Sh NAME .Nm kvm_nlist .Nd retrieve symbol table names from a kernel image .Sh SYNOPSIS .Fd #include .Fd #include .Ft int .Fn kvm_nlist "kvm_t *kd" "struct nlist *nl" .Sh DESCRIPTION .Fn kvm_nlist retrieves the symbol table entries indicated by the name list argument .Fa \&nl . This argument points to an array of nlist structures, terminated by an entry whose n_name field is .Dv NULL (see .Xr nlist 3 ) . Each symbol is looked up using the n_name field, and if found, the corresponding n_type and n_value fields are filled in. These fields are set to 0 if the symbol is not found. .Pp The program .Xr kvm_mkdb 8 builds a database from the running kernel's namelist. If the database matches the opened kernel, .Fn kvm_nlist uses it to speed lookups. .Sh RETURN VALUES The .Fn kvm_nlist function returns the number of invalid entries found. If the kernel symbol table was unreadable, -1 is returned. .Sh FILES -.Bl -tag -width /var/db/kvm_vmunix.db -compact -.It Pa /var/db/kvm_vmunix.db +.Bl -tag -width /var/db/kvm_kernel.db -compact +.It Pa /var/db/kvm_kernel.db .El .Sh SEE ALSO .Xr kvm 3 , .Xr kvm_close 3 , .Xr kvm_getargv 3 , .Xr kvm_getenvv 3 , .Xr kvm_geterr 3 , .Xr kvm_getprocs 3 , .Xr kvm_open 3 , .Xr kvm_openfiles 3 , .Xr kvm_read 3 , .Xr kvm_write 3 , .Xr kvm_mkdb 8 Index: head/lib/libkvm/kvm_private.h =================================================================== --- head/lib/libkvm/kvm_private.h (revision 1855) +++ head/lib/libkvm/kvm_private.h (revision 1856) @@ -1,81 +1,81 @@ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software developed by the Computer Systems * Engineering group at Lawrence Berkeley Laboratory under DARPA contract * BG 91-66 and contributed to Berkeley. * * 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. * * @(#)kvm_private.h 8.1 (Berkeley) 6/4/93 */ struct __kvm { /* * a string to be prepended to error messages * provided for compatibility with sun's interface * if this value is null, errors are saved in errbuf[] */ const char *program; char *errp; /* XXX this can probably go away */ char errbuf[_POSIX2_LINE_MAX]; DB *db; #define ISALIVE(kd) ((kd)->vmfd >= 0) int pmfd; /* physical memory file (or crashdump) */ int vmfd; /* virtual memory file (-1 if crashdump) */ int swfd; /* swap file (e.g., /dev/drum) */ - int nlfd; /* namelist file (e.g., /vmunix) */ + int nlfd; /* namelist file (e.g., /kernel) */ struct kinfo_proc *procbase; char *argspc; /* (dynamic) storage for argv strings */ int arglen; /* length of the above */ char **argv; /* (dynamic) storage for argv pointers */ int argc; /* length of above (not actual # present) */ /* * Kernel virtual address translation state. This only gets filled * in for dead kernels; otherwise, the running kernel (i.e. kmem) * will do the translations for us. It could be big, so we * only allocate it if necessary. */ struct vmstate *vmst; }; /* * Functions used internally by kvm, but across kvm modules. */ void _kvm_err __P((kvm_t *kd, const char *program, const char *fmt, ...)); void _kvm_freeprocs __P((kvm_t *kd)); void _kvm_freevtop __P((kvm_t *)); int _kvm_initvtop __P((kvm_t *)); int _kvm_kvatop __P((kvm_t *, u_long, u_long *)); void *_kvm_malloc __P((kvm_t *kd, size_t)); void *_kvm_realloc __P((kvm_t *kd, void *, size_t)); void _kvm_syserr __P((kvm_t *kd, const char *program, const char *fmt, ...)); int _kvm_uvatop __P((kvm_t *, const struct proc *, u_long, u_long *)); Index: head/sbin/dmesg/dmesg.8 =================================================================== --- head/sbin/dmesg/dmesg.8 (revision 1855) +++ head/sbin/dmesg/dmesg.8 (revision 1856) @@ -1,63 +1,63 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)dmesg.8 8.1 (Berkeley) 6/5/93 .\" .Dd June 5, 1993 .Dt DMESG 8 .Os BSD 4 .Sh NAME .Nm dmesg .Nd "display the system message buffer" .Sh SYNOPSIS .Nm dmesg .Op Fl M Ar core .Op Fl N Ar system .Sh DESCRIPTION .Nm Dmesg displays the contents of the system message buffer. .Pp The options are as follows: .Bl -tag -width Ds .It Fl M Extract values associated with the name list from the specified core instead of the default ``/dev/kmem''. .It Fl N Extract the name list from the specified system instead of the default -``/vmunix''. +``/kernel''. .El .Sh SEE ALSO .Xr syslogd 8 .Sh HISTORY The .Nm command appeared in .Bx 4.0 . Index: head/sbin/reboot/boot_hp300.8 =================================================================== --- head/sbin/reboot/boot_hp300.8 (revision 1855) +++ head/sbin/reboot/boot_hp300.8 (revision 1856) @@ -1,117 +1,117 @@ .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the Systems Programming Group of the University of Utah Computer .\" Science Department. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)boot_hp300.8 8.2 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt BOOT_HP300 8 hp300 .Os .Sh NAME .Nm boot .Nd system bootstrapping procedures .Sh DESCRIPTION .Sy Power fail and crash recovery. Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts. On an HP300, the boot procedure uses the boot ROM to load a boot program from an .Tn LIF format directory at the beginning of an attached disk. The .Pa /usr/mdec directory contains a disk boot programs which should be placed in a new pack automatically by .Xr newfs 8 when the ``a'' partition file system on the pack is created. .Pp This .Em boot program finds the corresponding file on the given device -.Pf ( Ar vmunix +.Pf ( Ar kernel by default), loads that file into memory, and starts the program at the entry address specified in the program header. .Pp The boot program can be interrupted by typing `^C' (ctrl-C). This will force the boot program to interactively prompt for a system to boot. If not interrupted, it will boot from the device from which the boot program itself was loaded. .Pp The file specifications used for an interactive boot are of the form: .Pp .Dl device(unit, minor) .Pp where .Ar device is the type of the device to be searched, .Ar unit is 8 * the hpib number plus the unit number of the disk or tape, and .Ar minor is the disk partition or tape file number. Normal line editing characters can be used when typing the file specification. Currently, ``rd'' and ``sd'' are the only valid .Ar device specifiers. .Pp For example, to boot from the `a' file system of unit 0 on HP-IB 2, type -.Ql rd(16, 0)vmunix +.Ql rd(16, 0)kernel to the boot prompt. For tapes, the minor device number gives a file offset. .Pp In an emergency, the bootstrap methods described in the paper .%T Installing 4.3bsd on the HP300 can be used to boot from a distribution tape. .Sh FILES .Bl -tag -width /usr/mdec/installboot -compact -.It Pa /vmunix +.It Pa /kernel system code .It Pa /usr/mdec/bootrd .Tn LIF format boot block .It Pa /usr/mdec/installboot program to install boot blocks .El .Sh SEE ALSO .Xr halt 8 , .Xr reboot 8 , .Xr shutdown 8 Index: head/sbin/reboot/boot_i386.8 =================================================================== --- head/sbin/reboot/boot_i386.8 (revision 1855) +++ head/sbin/reboot/boot_i386.8 (revision 1856) @@ -1,126 +1,126 @@ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software written and contributed .\" to Berkeley by William Jolitz. .\" .\" 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. .\" .\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt BOOT 8 i386 .Os .Sh NAME .Nm boot .Nd system bootstrapping procedures .Sh DESCRIPTION .Sy Power fail and crash recovery. Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts. The 386 .Tn "PC AT" clones attempt to boot the floppy disk drive A (otherwise known as drive 0) first, and failing that, attempt to boot the hard disk C (otherwise known as hard disk controller 1, drive 0). The automatic boot will attempt to load -.Pa vmunix +.Pa kernel from partition A of either the floppy or the hard disk. This boot may be aborted by typing any character on the keyboard repeatedly (four or five times at least) during the operating system load phase, after which the bootstrap will prompt for the file that you wish to load instead. .Pp One exception to this is the .Ql d key, which will not abort the load but instead silently force the .Dv DEBUG boot flags. The boot flags for an autoboot are 0, and 3 for the successive boot after an aborted autoboot sequence. No other provison is made for setting boot flags (yet). A specific device or bootstrap file may be used; for example, .Pp The file specifications used for the boostrap when loaded with the .Dq askme flag (e.g. an aborted autoboot) are of the form: .Pp .Dl device unit partition: .Pp where .Ar device is the type of the device, assumed to be on the ISA bus, to be searched, .Ar unit is the unit number of the disk or tape, and .Ar partition is the disk partition or tape file number. Normal line editing characters can be used when typing the file specification. The following list of supported devices may vary from installation to installation: .Bd -unfilled -offset indent wd ST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike controller fd 5 1/4" or 3 1/2" High density floppies .Ed .Pp For example, to boot from a file system which starts at cylinder 0 of unit 0 of an IDE disk, type -.Dq Li wd0a:vmunix +.Dq Li wd0a:kernel to the boot prompt; -.Dq Li fd0a:vmunix +.Dq Li fd0a:kernel would specify a 3 1/2" floppy drive 0 . .Pp In an emergency, the bootstrap methods described in the paper .%T "Installing and Operating 4.3 BSD-Reno UNIX on the AT/386" can be used to boot from a distribution tape. .Sh FILES -.Bl -tag -width /vmunixxx -compact -.It Pa /vmunix +.Bl -tag -width /kernelxx -compact +.It Pa /kernel system code .It Pa /boot system bootstrap .El .Sh SEE ALSO .Xr halt 8 , .Xr reboot 8 , .Xr shutdown 8 .Sh BUGS The disklabel format used by this version of .Bx is quite different from that of other architectures. Index: head/sbin/reboot/boot_sparc.8 =================================================================== --- head/sbin/reboot/boot_sparc.8 (revision 1855) +++ head/sbin/reboot/boot_sparc.8 (revision 1856) @@ -1,89 +1,89 @@ .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)boot_sparc.8 8.2 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt REBOOT 8 sparc .Os .Sh NAME .Nm reboot .Nd .Tn UNIX bootstrapping procedures .Sh SYNOPSIS .Nm reboot .Op Fl n .Op Fl q .Sh DESCRIPTION .Sy Power fail and crash recovery. Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed as described in .Xr fsck 8 . and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts The SPARC system currently uses the SunOS bootstrap loaders. This will be changed in a future version of the system. The SunOS boot will attempt to load -.Pa vmunix +.Pa kernel from partition A of the boot device, which must currently be an ``sd'' disk. .Pp The .Op Fl s flag to the SunOS boot loader will being the system up in single-user mode. The .Op Fl d flag to the SunOS boot loader will bring the system up in debug mode. Here it waits for a kernel debugger connect; see .Xr kgdb 8 . Other flags are currently ignored. .Sh FILES -.Bl -tag -width /vmunixxx -compact -.It Pa /vmunix +.Bl -tag -width /kernelxx -compact +.It Pa /kernel system code .It Pa /boot system bootstrap .El .Sh SEE ALSO .Xr crash 8 , .Xr disklabel 8 , .Xr fsck 8 , .Xr halt 8 , .Xr init 8 , .Xr rc 8 , .Xr shutdown 8 , .Xr syslogd 8 .Sh BUGS The use of Sun disk labels, without the ability to write them, is problematic. Index: head/sbin/reboot/boot_tahoe.8 =================================================================== --- head/sbin/reboot/boot_tahoe.8 (revision 1855) +++ head/sbin/reboot/boot_tahoe.8 (revision 1856) @@ -1,152 +1,152 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)boot_tahoe.8 8.2 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt BOOT 8 tahoe .Os .Sh NAME .Nm boot .Nd system bootstrapping procedures .Sh DESCRIPTION .Sy Power fail and crash recovery. Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts. These are processor-type dependent. On the .Tn CCI Power 6/32 and related processors, the system will do a standard autoboot from drive 0 upon power-up or reset. This automatic boot may be cancelled by typing a .Ql \&# in the first few seconds after reset. This enters console mode; the console prompt is .Ql > or .Ql \&# . The boot flags can be set to any hexadecimal value .Fl n with the command .Pp .Bd -filled -offset indent -compact .Li \&#> p23 .Ar n . .Ed .Pp The default device may be examined or set; see the Diagnostics and Debugging manual for the processor for details on device naming and syntax. After setting the boot flags and/or device, a bootstrap sequence can be initiated with .Pp .Dl #> fb .Pp A specific device or bootstrap file may be used; for example, .Pp .Dl \&#> \&fb xfd(1,0) .Pp would boot from the `a' partition on .Tn XFD drive 1. .Pp The file specifications used for the boostrap when loaded with the .Dq askme flag (register 23 set to 1 or 3) are of the form: .Pp .Dl device(adaptor,controller,unit,minor) .Pp where .Ar device is the type of the device to be searched, .Ar adaptor is number of the .Tn VERSAbus (or .Tn VMEbus ) to which the device is attached, .Ar controller is the unit number of the controller on that buss, .Ar unit is the unit number of the disk or tape, and .Ar minor is the disk partition or tape file number. Leading adaptor or controller numbers default to 0. Normal line editing characters can be used when typing the file specification. The following list of supported devices may vary from installation to installation: .Pp .Bd -unfilled -offset indent -compact dk SMD or ESDI disks on VDDC or SMD-E cy tape on Ciprico Tapemaster controller .Ed .Pp For example, to boot from a file system which starts at cylinder 0 of unit 0 of an .Tn SMD-E disk, type -.Ql dk(0,0)vmunix +.Ql dk(0,0)kernel to the boot prompt; -.Ql dk(2,1,0)vmunix +.Ql dk(2,1,0)kernel would specify drive 1 on .Tn SMD-E controller 2. .Pp In an emergency, the bootstrap methods described in the paper .%T "Installing and Operating 4.3 BSD-tahoe UNIX on the Tahoe" can be used to boot from a distribution tape. .Sh FILES -.Bl -tag -width /vmunix -compact -.It Pa /vmunix +.Bl -tag -width /kernel -compact +.It Pa /kernel system code .It Pa /boot system bootstrap .El .Sh SEE ALSO .Xr halt 8 , .Xr reboot 8 , .Xr shutdown 8 .Sh BUGS The disklabel format used by some versions of the console processor is different than the format used by .Tn UNIX and the bootstrap. .Sh HISTORY Index: head/sbin/reboot/boot_vax.8 =================================================================== --- head/sbin/reboot/boot_vax.8 (revision 1855) +++ head/sbin/reboot/boot_vax.8 (revision 1856) @@ -1,322 +1,322 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)boot_vax.8 8.2 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt BOOT 8 vax .Os .Sh NAME .Nm boot .Nd system bootstrapping procedures .Sh DESCRIPTION .Sy Power fail and crash recovery. Normally, the system will reboot itself at power-up or after crashes. Provided the auto-restart is enabled on the machine front panel, an automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts. These are processor-type dependent. On an 11/780, there are two floppy files for each disk controller, both of which cause boots from unit 0 of the root file system of a controller located on mba0 or uba0. One gives a single user shell, while the other invokes the multi-user automatic reboot. Thus these files are .Tn HPS and .Tn HPM for the single and multi-user boot from .Tn MASSBUS RP06/RM03/RM05 disks, .Tn UPS and .Tn UPM for .Tn UNIBUS storage module controller and disks such as the .Tn EMULEX SC-21 and .Tn AMPEX 9300 pair, .Tn RAS and .Tn RAM to boot from .Tn MSCP controllers and disks such as the RA81, or .Tn HKS and .Tn HKM for RK07 disks. There is also a script for booting from the default device, which is normally a copy of one of the standard multi-user boot scripts, but which may be modified to perform other actions or to boot from a different unit. The situation on the 8600 is similar, with scripts loaded from the console RL02. .Pp Giving the command .Pp .Dl >>>BOOT HPM .Pp would boot the system from (e.g.) an RP06 and run the automatic consistency check as described in .Xr fsck 8 . (Note that it may be necessary to type control-P and halt the processor to gain the attention of the .Tn LSI-11 before getting the >>> prompt.) The command .Pp .Dl >>>BOOT ANY .Pp invokes a version of the boot program in a way which allows you to specify any system as the system to be booted. It reads from the console a device specification (see below) followed immediately by a pathname. .Pp The scripts may be modified for local configuration if necessary. The flags are placed in register 11 (as defined in .Aq Pa sys/reboot.h ) . The boot device is specified in register 10. The encoding of this register is also defined in .Aq Pa sys/reboot.h . The current encoding has a historical basis, and is shown in the following table: .Pp .Bd -unfilled -offset indent -compact bits usage 0-7 boot device type (the device major number) 8-15 disk partition 16-19 drive unit 20-23 controller number 24-27 adaptor number (UNIBUS or MASSBUS as appropriate) .Ed .Pp The adaptor number corresponds to the normal configuration on the 11/750, and to the order in which adaptors are found on the 11/780 and 8600 (generally the same as the numbers used by .Tn UNIX ) . .Pp On an 11/750, the reset button will boot from the device selected by the front panel boot device switch. In systems with RK07's, position B normally selects the RK07 for boot. This will boot multi-user. To boot from RK07 with boot flags you may specify .Pp .Bd -unfilled -offset indent -compact .Li \&>>>B/ Ns Fl n No DMA0 .Ed .Pp where, giving a .Ar n of 1 causes the boot program to ask for the name of the system to be bootstrapped, giving a .Ar n of 2 causes the boot program to come up single user, and a .Ar n of 3 causes both of these actions to occur. The ``DM'' specifies RK07, the ``A'' represents the adaptor number .Pf ( Tn UNIBUS or .Tn MASSBUS ) , and the ``0'' is the drive unit number. Other disk types which may be used are DB .Pq Tn MASSBUS , DD (TU58), and DU .Pf ( Tn UDA-50/RA disk). A non-zero disk partition can be used by adding (partition times 1000 hex) to .Ar n . .Pp The boot procedure on the Micro .Tn VAX II is similar. A switch on the back panel sets the power-up action to autoboot or to halt. When halted, the processor may be booted using the same syntax as on the 11/750. .Pp The 11/750 boot procedure uses the boot roms to load block 0 off of the specified device. The /usr/mdec directory contains a number of bootstrap programs for the various disks which should be placed in a new pack by .Xr disklabel 8 . Similarly, the Micro .Tn VAX II boot procedure loads a boot parameter block from block 0 of the disk. The .Xr rdboot .Dq bootstrap contains the correct parameters for an .Tn MSCP disk such as the RD53. .Pp On any processor, the .Em boot program finds the corresponding file on the given device -.Pf ( Pa vmunix +.Pf ( Pa kernel by default), loads that file into memory location zero, and starts the program at the entry address specified in the program header (after clearing off the high bit of the specified entry address). .Pp The file specifications used with .Dq BOOT ANY or .Dq \&B/3 are of the form: .Pp .Dl device(adaptor,controller,unit,minor) .Pp where .Ar device is the type of the device to be searched, .Ar adaptor is the .Tn UNIBUS or .Tn MASSBUS number of the adaptor to which the device is attached, .Ar controller is the unit number of the controller or .Tn MASSBUS tape formatter on that adaptor, .Ar unit is the unit number of the disk or transport slave unit of the tape, and .Ar minor is the disk partition or tape file number. Leading adaptor or controller numbers default to 0. Normal line editing characters can be used when typing the file specification. The following list of supported devices may vary from installation to installation: .Pp .Bd -unfilled -offset indent -compact hp MASSBUS disk drive up UNIBUS storage module drive ht TE16,TU45,TU77 on MASSBUS kra storage module on a KDB50 mt TU78 on MASSBUS hk RK07 on UNIBUS ra storage module on a MSCP-compatible UNIBUS controller rb storage module on a 730 IDC rl RL02 on UNIBUS tm TM11 emulation tape drives on UNIBUS tms TMSCP-compatible tape ts TS11 on UNIBUS ut UNIBUS TU45 emulator .Ed .Pp For example, to boot from a file system which starts at cylinder 0 of unit 0 of a .Tn MASSBUS disk, type -.Ql hp(0,0)vmunix +.Ql hp(0,0)kernel to the boot prompt; -.Ql hp(2,0,1,0)vmunix +.Ql hp(2,0,1,0)kernel would specify drive 1 on .Tn MASSBUS adaptor 2; -.Ql up(0,0)vmunix +.Ql up(0,0)kernel would specify a .Tn UNIBUS drive, -.Ql hk(0,0)vmunix +.Ql hk(0,0)kernel would specify an RK07 disk drive, -.Ql ra(1,0,0,0)vmunix +.Ql ra(1,0,0,0)kernel would specify a .Tn UDA50 disk drive on a second .Tn UNIBUS , and -.Ql rb(0,0)vmunix +.Ql rb(0,0)kernel would specify a disk on a 730 .Tn IDC . For tapes, the minor device number gives a file offset; .Ql mt(1,2,3,4) would specify the fifth file on slave 3 of the formatter at .Ql drive 2 on mba 1. .Pp On an 11/750 with patchable control store, microcode patches will be installed by .Em boot if the file .Pa psc750.bin exists in the root of the filesystem from which the system is booted. .Pp In an emergency, the bootstrap methods described in the paper .%T Installing and Operating 4.3bsd can be used to boot from a distribution tape. .Sh FILES .Bl -tag -width /usr/mdec/xxboot -compact -.It Pa /vmunix +.It Pa /kernel system code .It Pa /boot system bootstrap .It Pa /usr/mdec/xxboot sector-0 boot block for 750, xx is disk type .It Pa /usr/mdec/bootxx second-stage boot for 750, xx is disk type .It Pa /pcs750.bin microcode patch file on 750 .El .Sh SEE ALSO .Xr arff 8 , .Xr halt 8 , .Xr reboot 8 , .Xr shutdown 8 .Sh HISTORY The .Nm command appeared in .Bx 4.0 . Index: head/sbin/savecore/savecore.8 =================================================================== --- head/sbin/savecore/savecore.8 (revision 1855) +++ head/sbin/savecore/savecore.8 (revision 1856) @@ -1,124 +1,124 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)savecore.8 8.1 (Berkeley) 6/5/93 .\" .Dd June 5, 1993 .Dt SAVECORE 8 .Os BSD 4 .Sh NAME .Nm savecore .Nd "save a core dump of the operating system" .Sh SYNOPSIS .Nm savecore .Fl c .Nm savecore .Op Fl fvz .Op Fl N Ar system .Ar directory .Sh DESCRIPTION .Nm Savecore copies the currently running kernel and its associated core dump into .Fa directory , and enters a reboot message and information about the core dump into the system log. .Pp The options are as follows: .Bl -tag -width directory .It Fl c Clears the dump, so that future invocations of .Nm savecore will ignore it. .It Fl f Forces a dump to be taken even if the dump doesn't appear correct or there is insufficient disk space. .It Fl N Use .Ar system -as the kernel instead of the default ``/vmunix''. +as the kernel instead of the default ``/kernel''. .It Fl v Prints out some additional debugging information. .It Fl z Compresses the core dump and kernel (see .Xr compress 1 ). .El .Pp .Nm Savecore checks the core dump in various ways to make sure that it is current and that it corresponds to the currently running system. If it passes these checks, it saves the core image in .Ar directory Ns Pa /vmcore.# and the system in -.Ar directory Ns Pa /vmunix.# +.Ar directory Ns Pa /kernel.# The ``#'' is the number from the first line of the file .Ar directory Ns Pa /bounds , and it is incremented and stored back into the file each time .Nm savecore successfully runs. .Pp .Nm Savecore also checks the available disk space before attempting to make the copies. If there is insufficient disk space in the filesystem containing .Ar directory , or if the file .Ar directory Ns Pa /minfree exists and the number of free kilobytes (for non-superusers) in the filesystem after the copies were made would be less than the number in the first line of this file, the copies are not attempted. .Pp If .Nm savecore successfully copies the kernel and the core dump, the core dump is cleared so that future invocations of .Nm savecore will ignore it. .Pp .Nm Savecore is meant to be called near the end of the initialization file .Pa /etc/rc (see .Xr rc 8 ) . .Sh FILES -.Bl -tag -width /vmunixxx -compact -.It Pa /vmunix +.Bl -tag -width /kernelxx -compact +.It Pa /kernel current .Tn UNIX .El .Sh BUGS The minfree code does not consider the effect of compression. .Sh SEE ALSO .Xr compress 1 , .Xr syslogd 8 .Sh HISTORY The .Nm command appeared in .Bx 4.1 . Index: head/sbin/savecore/savecore.c =================================================================== --- head/sbin/savecore/savecore.c (revision 1855) +++ head/sbin/savecore/savecore.c (revision 1856) @@ -1,652 +1,652 @@ /*- * Copyright (c) 1986, 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint static char copyright[] = "@(#) Copyright (c) 1986, 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; #endif /* not lint */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ok(number) ((number) - KERNBASE) struct nlist current_nl[] = { /* Namelist for currently running system. */ #define X_DUMPDEV 0 { "_dumpdev" }, #define X_DUMPLO 1 { "_dumplo" }, #define X_TIME 2 { "_time" }, #define X_DUMPSIZE 3 { "_dumpsize" }, #define X_VERSION 4 { "_version" }, #define X_PANICSTR 5 { "_panicstr" }, #define X_DUMPMAG 6 { "_dumpmag" }, { "" }, }; int cursyms[] = { X_DUMPDEV, X_DUMPLO, X_VERSION, X_DUMPMAG, -1 }; int dumpsyms[] = { X_TIME, X_DUMPSIZE, X_VERSION, X_PANICSTR, X_DUMPMAG, -1 }; struct nlist dump_nl[] = { /* Name list for dumped system. */ { "_dumpdev" }, /* Entries MUST be the same as */ { "_dumplo" }, /* those in current_nl[]. */ { "_time" }, { "_dumpsize" }, { "_version" }, { "_panicstr" }, { "_dumpmag" }, { "" }, }; /* Types match kernel declarations. */ long dumplo; /* where dump starts on dumpdev */ int dumpmag; /* magic number in dump */ int dumpsize; /* amount of memory dumped */ -char *vmunix; +char *kernel; char *dirname; /* directory to save dumps in */ char *ddname; /* name of dump device */ dev_t dumpdev; /* dump device */ int dumpfd; /* read/write descriptor on block dev */ time_t now; /* current date */ char panic_mesg[1024]; int panicstr; char vers[1024]; int clear, compress, force, verbose; /* flags */ void check_kmem __P((void)); int check_space __P((void)); void clear_dump __P((void)); int Create __P((char *, int)); int dump_exists __P((void)); char *find_dev __P((dev_t, int)); int get_crashtime __P((void)); void kmem_setup __P((void)); void log __P((int, char *, ...)); void Lseek __P((int, off_t, int)); int Open __P((char *, int rw)); int Read __P((int, void *, int)); char *rawname __P((char *s)); void save_core __P((void)); void usage __P((void)); void Write __P((int, void *, int)); int main(argc, argv) int argc; char *argv[]; { int ch; openlog("savecore", LOG_PERROR, LOG_DAEMON); while ((ch = getopt(argc, argv, "cdfNvz")) != EOF) switch(ch) { case 'c': clear = 1; break; case 'd': /* Not documented. */ case 'v': verbose = 1; break; case 'f': force = 1; break; case 'N': - vmunix = optarg; + kernel = optarg; break; case 'z': compress = 1; break; case '?': default: usage(); } argc -= optind; argv += optind; if (!clear) { if (argc != 1 && argc != 2) usage(); dirname = argv[0]; } if (argc == 2) - vmunix = argv[1]; + kernel = argv[1]; (void)time(&now); kmem_setup(); if (clear) { clear_dump(); exit(0); } if (!dump_exists() && !force) exit(1); check_kmem(); if (panicstr) syslog(LOG_ALERT, "reboot after panic: %s", panic_mesg); else syslog(LOG_ALERT, "reboot"); if ((!get_crashtime() || !check_space()) && !force) exit(1); save_core(); clear_dump(); exit(0); } void kmem_setup() { FILE *fp; int kmem, i; char *dump_sys; /* * Some names we need for the currently running system, others for * the system that was running when the dump was made. The values * obtained from the current system are used to look for things in * /dev/kmem that cannot be found in the dump_sys namelist, but are * presumed to be the same (since the disk partitions are probably * the same!) */ if ((nlist(_PATH_UNIX, current_nl)) == -1) syslog(LOG_ERR, "%s: nlist: %s", _PATH_UNIX, strerror(errno)); for (i = 0; cursyms[i] != -1; i++) if (current_nl[cursyms[i]].n_value == 0) { syslog(LOG_ERR, "%s: %s not in namelist", _PATH_UNIX, current_nl[cursyms[i]].n_name); exit(1); } - dump_sys = vmunix ? vmunix : _PATH_UNIX; + dump_sys = kernel ? kernel : _PATH_UNIX; if ((nlist(dump_sys, dump_nl)) == -1) syslog(LOG_ERR, "%s: nlist: %s", dump_sys, strerror(errno)); for (i = 0; dumpsyms[i] != -1; i++) if (dump_nl[dumpsyms[i]].n_value == 0) { syslog(LOG_ERR, "%s: %s not in namelist", dump_sys, dump_nl[dumpsyms[i]].n_name); exit(1); } kmem = Open(_PATH_KMEM, O_RDONLY); Lseek(kmem, (off_t)current_nl[X_DUMPDEV].n_value, L_SET); (void)Read(kmem, &dumpdev, sizeof(dumpdev)); if (dumpdev == NODEV) { syslog(LOG_WARNING, "no core dump (no dumpdev)"); exit(1); } Lseek(kmem, (off_t)current_nl[X_DUMPLO].n_value, L_SET); (void)Read(kmem, &dumplo, sizeof(dumplo)); if (verbose) (void)printf("dumplo = %d (%d * %d)\n", dumplo, dumplo/DEV_BSIZE, DEV_BSIZE); Lseek(kmem, (off_t)current_nl[X_DUMPMAG].n_value, L_SET); (void)Read(kmem, &dumpmag, sizeof(dumpmag)); dumplo *= DEV_BSIZE; ddname = find_dev(dumpdev, S_IFBLK); dumpfd = Open(ddname, O_RDWR); fp = fdopen(kmem, "r"); if (fp == NULL) { syslog(LOG_ERR, "%s: fdopen: %m", _PATH_KMEM); exit(1); } - if (vmunix) + if (kernel) return; (void)fseek(fp, (off_t)current_nl[X_VERSION].n_value, L_SET); (void)fgets(vers, sizeof(vers), fp); /* Don't fclose(fp), we use dumpfd later. */ } void check_kmem() { register char *cp; FILE *fp; char core_vers[1024]; fp = fdopen(dumpfd, "r"); if (fp == NULL) { syslog(LOG_ERR, "%s: fdopen: %m", ddname); exit(1); } fseek(fp, (off_t)(dumplo + ok(dump_nl[X_VERSION].n_value)), L_SET); fgets(core_vers, sizeof(core_vers), fp); - if (strcmp(vers, core_vers) && vmunix == 0) + if (strcmp(vers, core_vers) && kernel == 0) syslog(LOG_WARNING, "warning: %s version mismatch:\n\t%s\nand\t%s\n", _PATH_UNIX, vers, core_vers); (void)fseek(fp, (off_t)(dumplo + ok(dump_nl[X_PANICSTR].n_value)), L_SET); (void)fread(&panicstr, sizeof(panicstr), 1, fp); if (panicstr) { (void)fseek(fp, dumplo + ok(panicstr), L_SET); cp = panic_mesg; do *cp = getc(fp); while (*cp++ && cp < &panic_mesg[sizeof(panic_mesg)]); } /* Don't fclose(fp), we use dumpfd later. */ } void clear_dump() { long newdumplo; newdumplo = 0; Lseek(dumpfd, (off_t)(dumplo + ok(dump_nl[X_DUMPMAG].n_value)), L_SET); Write(dumpfd, &newdumplo, sizeof(newdumplo)); } int dump_exists() { int newdumpmag; Lseek(dumpfd, (off_t)(dumplo + ok(dump_nl[X_DUMPMAG].n_value)), L_SET); (void)Read(dumpfd, &newdumpmag, sizeof(newdumpmag)); if (newdumpmag != dumpmag) { if (verbose) syslog(LOG_WARNING, "magic number mismatch (%x != %x)", newdumpmag, dumpmag); syslog(LOG_WARNING, "no core dump"); return (0); } return (1); } char buf[1024 * 1024]; void save_core() { register FILE *fp; register int bounds, ifd, nr, nw, ofd; char *rawp, path[MAXPATHLEN]; /* * Get the current number and update the bounds file. Do the update * now, because may fail later and don't want to overwrite anything. */ (void)snprintf(path, sizeof(path), "%s/bounds", dirname); if ((fp = fopen(path, "r")) == NULL) goto err1; if (fgets(buf, sizeof(buf), fp) == NULL) { if (ferror(fp)) err1: syslog(LOG_WARNING, "%s: %s", path, strerror(errno)); bounds = 0; } else bounds = atoi(buf); if (fp != NULL) (void)fclose(fp); if ((fp = fopen(path, "w")) == NULL) syslog(LOG_ERR, "%s: %m", path); else { (void)fprintf(fp, "%d\n", bounds + 1); (void)fclose(fp); } (void)fclose(fp); /* Create the core file. */ (void)snprintf(path, sizeof(path), "%s/vmcore.%d%s", dirname, bounds, compress ? ".Z" : ""); if (compress) { if ((fp = zopen(path, "w", 0)) == NULL) { syslog(LOG_ERR, "%s: %s", path, strerror(errno)); exit(1); } } else ofd = Create(path, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* Open the raw device. */ rawp = rawname(ddname); if ((ifd = open(rawp, O_RDONLY)) == -1) { syslog(LOG_WARNING, "%s: %m; using block device", rawp); ifd = dumpfd; } /* Read the dump size. */ Lseek(dumpfd, (off_t)(dumplo + ok(dump_nl[X_DUMPSIZE].n_value)), L_SET); (void)Read(dumpfd, &dumpsize, sizeof(dumpsize)); /* Seek to the start of the core. */ Lseek(ifd, (off_t)dumplo, L_SET); /* Copy the core file. */ dumpsize *= NBPG; syslog(LOG_NOTICE, "writing %score to %s", compress ? "compressed " : "", path); for (; dumpsize > 0; dumpsize -= nr) { (void)printf("%6dK\r", dumpsize / 1024); (void)fflush(stdout); nr = read(ifd, buf, MIN(dumpsize, sizeof(buf))); if (nr <= 0) { if (nr == 0) syslog(LOG_WARNING, "WARNING: EOF on dump device"); else syslog(LOG_ERR, "%s: %m", rawp); goto err2; } if (compress) nw = fwrite(buf, 1, nr, fp); else nw = write(ofd, buf, nr); if (nw != nr) { syslog(LOG_ERR, "%s: %s", path, strerror(nw == 0 ? EIO : errno)); err2: syslog(LOG_WARNING, "WARNING: vmcore may be incomplete"); (void)printf("\n"); exit(1); } } (void)printf("\n"); (void)close(ifd); if (compress) (void)fclose(fp); else (void)close(ofd); /* Copy the kernel. */ - ifd = Open(vmunix ? vmunix : _PATH_UNIX, O_RDONLY); - (void)snprintf(path, sizeof(path), "%s/vmunix.%d%s", + ifd = Open(kernel ? kernel : _PATH_UNIX, O_RDONLY); + (void)snprintf(path, sizeof(path), "%s/kernel.%d%s", dirname, bounds, compress ? ".Z" : ""); if (compress) { if ((fp = zopen(path, "w", 0)) == NULL) { syslog(LOG_ERR, "%s: %s", path, strerror(errno)); exit(1); } } else ofd = Create(path, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); syslog(LOG_NOTICE, "writing %skernel to %s", compress ? "compressed " : "", path); while ((nr = read(ifd, buf, sizeof(buf))) > 0) { if (compress) nw = fwrite(buf, 1, nr, fp); else nw = write(ofd, buf, nr); if (nw != nr) { syslog(LOG_ERR, "%s: %s", path, strerror(nw == 0 ? EIO : errno)); syslog(LOG_WARNING, - "WARNING: vmunix may be incomplete"); + "WARNING: kernel may be incomplete"); exit(1); } } if (nr < 0) { syslog(LOG_ERR, "%s: %s", - vmunix ? vmunix : _PATH_UNIX, strerror(errno)); + kernel ? kernel : _PATH_UNIX, strerror(errno)); syslog(LOG_WARNING, - "WARNING: vmunix may be incomplete"); + "WARNING: kernel may be incomplete"); exit(1); } if (compress) (void)fclose(fp); else (void)close(ofd); } char * find_dev(dev, type) register dev_t dev; register int type; { register DIR *dfd; struct dirent *dir; struct stat sb; char *dp, devname[MAXPATHLEN + 1]; if ((dfd = opendir(_PATH_DEV)) == NULL) { syslog(LOG_ERR, "%s: %s", _PATH_DEV, strerror(errno)); exit(1); } (void)strcpy(devname, _PATH_DEV); while ((dir = readdir(dfd))) { (void)strcpy(devname + sizeof(_PATH_DEV) - 1, dir->d_name); if (lstat(devname, &sb)) { syslog(LOG_ERR, "%s: %s", devname, strerror(errno)); continue; } if ((sb.st_mode & S_IFMT) != type) continue; if (dev == sb.st_rdev) { closedir(dfd); if ((dp = strdup(devname)) == NULL) { syslog(LOG_ERR, "%s", strerror(errno)); exit(1); } return (dp); } } closedir(dfd); syslog(LOG_ERR, "can't find device %d/%d", major(dev), minor(dev)); exit(1); } char * rawname(s) char *s; { char *sl, name[MAXPATHLEN]; if ((sl = rindex(s, '/')) == NULL || sl[1] == '0') { syslog(LOG_ERR, "can't make raw dump device name from %s", s); return (s); } (void)snprintf(name, sizeof(name), "%.*s/r%s", sl - s, s, sl + 1); if ((sl = strdup(name)) == NULL) { syslog(LOG_ERR, "%s", strerror(errno)); exit(1); } return (sl); } int get_crashtime() { time_t dumptime; /* Time the dump was taken. */ Lseek(dumpfd, (off_t)(dumplo + ok(dump_nl[X_TIME].n_value)), L_SET); (void)Read(dumpfd, &dumptime, sizeof(dumptime)); if (dumptime == 0) { if (verbose) syslog(LOG_ERR, "dump time is zero"); return (0); } (void)printf("savecore: system went down at %s", ctime(&dumptime)); #define LEEWAY (7 * SECSPERDAY) if (dumptime < now - LEEWAY || dumptime > now + LEEWAY) { (void)printf("dump time is unreasonable\n"); return (0); } return (1); } int check_space() { register FILE *fp; - char *tvmunix; - off_t minfree, spacefree, vmunixsize, needed; + char *tkernel; + off_t minfree, spacefree, kernelsize, needed; struct stat st; struct statfs fsbuf; char buf[100], path[MAXPATHLEN]; - tvmunix = vmunix ? vmunix : _PATH_UNIX; - if (stat(tvmunix, &st) < 0) { - syslog(LOG_ERR, "%s: %m", tvmunix); + tkernel = kernel ? kernel : _PATH_UNIX; + if (stat(tkernel, &st) < 0) { + syslog(LOG_ERR, "%s: %m", tkernel); exit(1); } - vmunixsize = st.st_blocks * S_BLKSIZE; + kernelsize = st.st_blocks * S_BLKSIZE; if (statfs(dirname, &fsbuf) < 0) { syslog(LOG_ERR, "%s: %m", dirname); exit(1); } spacefree = (fsbuf.f_bavail * fsbuf.f_bsize) / 1024; (void)snprintf(path, sizeof(path), "%s/minfree", dirname); if ((fp = fopen(path, "r")) == NULL) minfree = 0; else { if (fgets(buf, sizeof(buf), fp) == NULL) minfree = 0; else minfree = atoi(buf); (void)fclose(fp); } - needed = (dumpsize + vmunixsize) / 1024; + needed = (dumpsize + kernelsize) / 1024; if (minfree > 0 && spacefree - needed < minfree) { syslog(LOG_WARNING, "no dump, not enough free space on device"); return (0); } if (spacefree - needed < minfree) syslog(LOG_WARNING, "dump performed, but free space threshold crossed"); return (1); } int Open(name, rw) char *name; int rw; { int fd; if ((fd = open(name, rw, 0)) < 0) { syslog(LOG_ERR, "%s: %m", name); exit(1); } return (fd); } int Read(fd, bp, size) int fd, size; void *bp; { int nr; nr = read(fd, bp, size); if (nr != size) { syslog(LOG_ERR, "read: %m"); exit(1); } return (nr); } void Lseek(fd, off, flag) int fd, flag; off_t off; { off_t ret; ret = lseek(fd, off, flag); if (ret == -1) { syslog(LOG_ERR, "lseek: %m"); exit(1); } } int Create(file, mode) char *file; int mode; { register int fd; fd = creat(file, mode); if (fd < 0) { syslog(LOG_ERR, "%s: %m", file); exit(1); } return (fd); } void Write(fd, bp, size) int fd, size; void *bp; { int n; if ((n = write(fd, bp, size)) < size) { syslog(LOG_ERR, "write: %s", strerror(n == -1 ? errno : EIO)); exit(1); } } void usage() { (void)syslog(LOG_ERR, "usage: savecore [-cfvz] [-N system] directory"); exit(1); } Index: head/share/doc/smm/01.setup/2.t =================================================================== --- head/share/doc/smm/01.setup/2.t (revision 1855) +++ head/share/doc/smm/01.setup/2.t (revision 1856) @@ -1,1658 +1,1658 @@ .\" Copyright (c) 1988, 1993 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)2.t 8.1 (Berkeley) 7/27/93 .\" .ds lq `` .ds rq '' .ds LH "Installing/Operating \*(4B .ds RH Bootstrapping .ds CF \*(Dy .Sh 1 "Bootstrap procedure" .PP This section explains the bootstrap procedure that can be used to get the kernel supplied with this distribution running on your machine. If you are not currently running \*(Ps you will have to do a full bootstrap. Section 3 describes how to upgrade a \*(Ps system. An understanding of the operations used in a full bootstrap is helpful in doing an upgrade as well. In either case, it is highly desirable to read and understand the remainder of this document before proceeding. .PP The distribution supports a somewhat wider set of machines than those for which we have built binaries. The architectures that are supported only in source form include: .IP \(bu Intel 386/486-based machines (ISA/AT or EISA bus only) .IP \(bu Sony News MIPS-based workstations .IP \(bu Omron Luna 68000-based workstations .LP If you wish to run one of these architectures, you will have to build a cross compilation environment. Note that the distribution does .B not include the machine support for the Tahoe and VAX architectures found in previous BSD distributions. Our primary development environment is the HP9000/300 series machines. The other architectures are developed and supported by people outside the university. Consequently, we are not able to directly test or maintain these other architectures, so cannot comment on their robustness, reliability, or completeness. .Sh 2 "Bootstrapping from the tape" .LP The set of files on the distribution tape are as follows: .IP 1) A .Xr dd (1) (HP300), .Xr tar (1) (DECstation), or .Xr dump (8) (SPARC) image of the root filesystem .IP 2) A .Xr tar image of the .Pn /var filesystem .IP 3) A .Xr tar image of the .Pn /usr filesystem .IP 4) A .Xr tar image of .Pn /usr/src/sys .IP 5) A .Xr tar image of .Pn /usr/src except sys and contrib .IP 6) A .Xr tar image of .Pn /usr/src/contrib .IP 7) (8mm Exabyte tape distributions only) A .Xr tar image of .Pn /usr/src/X11R5 .LP The tape bootstrap procedure used to create a working system involves the following major steps: .IP 1) Transfer a bootable root filesystem from the tape to a disk and get it booted and running. .IP 2) Build and restore the .Pn /var and .Pn /usr filesystems from tape with .Xr tar (1). .IP 3) Extract the system and utility source files as desired. .PP The following sections describe the above steps in detail. The details of the first step vary between architectures. The specific steps for the HP300, SPARC, and DECstation are given in the next three sections respectively. You should follow the instructions for your particular architecture. In all sections, commands you are expected to type are shown in italics, while that information printed by the system is shown emboldened. .Sh 2 "Booting the HP300" .Sh 3 "Supported hardware" .LP The hardware supported by \*(4B for the HP300/400 is as follows: .TS center box; lw(1i) lw(4i). CPU's T{ 68020 based (318, 319, 320, 330 and 350), 68030 based (340, 345, 360, 370, 375, 400) and 68040 based (380, 425, 433). T} _ DISK's T{ HP-IB/CS80 (7912, 7914, 7933, 7936, 7945, 7957, 7958, 7959, 2200, 2203) and SCSI-I (including magneto-optical). T} _ TAPE's T{ Low-density CS80 cartridge (7914, 7946, 9144), high-density CS80 cartridge (9145), HP SCSI DAT and SCSI Exabyte. T} _ RS232 T{ 98644 built-in single-port, 98642 4-port and 98638 8-port interfaces. T} _ NETWORK T{ 98643 internal and external LAN cards. T} _ GRAPHICS T{ Terminal emulation and raw frame buffer support for 98544 / 98545 / 98547 (Topcat color & monochrome), 98548 / 98549 / 98550 (Catseye color & monochrome), 98700 / 98710 (Gatorbox), 98720 / 98721 (Renaissance), 98730 / 98731 (DaVinci) and A1096A (Hyperion monochrome). T} _ INPUT T{ General interface supporting all HIL devices. (e.g. keyboard, 2 and 3 button mice, ID module, ...) T} _ MISC T{ Battery-backed real time clock, builtin and 98625A/B HP-IB interfaces, builtin and 98658A SCSI interfaces, serial printers and plotters on HP-IB, and SCSI autochanger device. T} .TE .LP Major items that are not supported include the 310 and 332 CPU's, 400 series machines configured for Domain/OS, EISA and VME bus adaptors, audio, the centronics port, 1/2" tape drives (7980), CD-ROM, and the PVRX/TVRX 3D graphics displays. .Sh 3 "Standalone device file naming" .LP The standalone system device name syntax on the HP300 is of the form: .DS xx(a,c,u,p) .DE where \fIxx\fP is the device type, \fIa\fP specifies the adaptor to use, \fIc\fP the controller, \fIu\fP the unit, and \fIp\fP a partition. The \fIdevice type\fP differentiates the various disks and tapes and is one of: ``rd'' for HP-IB CS80 disks, ``ct'' for HP-IB CS80 cartridge tapes, or ``sd'' for SCSI-I disks (SCSI-I tapes are currently not supported). The \fIadaptor\fP field is a logical HP-IB or SCSI bus adaptor card number. This will typically be 0 for SCSI disks, 0 for devices on the ``slow'' HP-IB interface (usually tapes) and 1 for devices on the ``fast'' HP-IB interface (usually disks). To get a complete mapping of physical (select-code) to logical card numbers just type a ^C at the standalone prompt. The \fIcontroller\fP field is the disk or tape's target number on the HP-IB or SCSI bus. For SCSI the range is 0 to 6 (7 is the adaptor address) and for HP-IB the range is 0 to 7. The \fIunit\fP field is unused and should be 0. The \fIpartition\fP field is interpreted differently for tapes and disks: for disks it is a disk partition (in the range 0-7), and for tapes it is a file number offset on the tape. Thus, partition 2 of a SCSI disk drive at target 3 on SCSI bus 1 would be ``sd(1,3,0,2)''. If you have only one of any type bus adaptor, you may omit the adaptor and controller numbers; e.g. ``sd(0,2)'' could be used instead of ``sd(0,0,0,2)''. The following examples always use the full syntax for clarity. .Sh 3 "The procedure" .LP The basic steps involved in bringing up the HP300 are as follows: .IP 1) Obtain a second disk and format it, if necessary. .IP 2) Copy a root filesystem from the tape onto the beginning of the disk. .IP 3) Boot the UNIX system on the new disk. .IP 4) (Optional) Build a root filesystem optimized for your disk. .IP 5) Label the disks with the .Xr disklabel (8) program. .Sh 4 "Step 1: selecting and formatting a disk" .PP For your first system you will have to obtain a formatted disk of a type given in the ``supported hardware'' list above. If you want to load an entire binary system (i.e., everything except .Pn /usr/src ), on the single disk you will need a minimum of 290MB, ruling out anything smaller than a 7959B/S disk. The disklabel included in the bootstrap root image is laid out to accommodate this scenario. Note that an HP SCSI magneto-optical disk will work fine for this case. \*(4B will boot and run (albeit slowly) using one. If you want to load source on a single disk system, you will need at least 640MB (at least a 2213A SCSI or 2203A HP-IB disk). A disk as small as the 7945A (54MB) can be used for the bootstrap procedure but will hold only the root and primary swap partitions. If you plan to use multiple disks, refer to section 2.5 for suggestions on partitioning. .PP After selecting a disk, you may need to format it. Since most HP disk drives come pre-formatted (except optical media) you probably will not, but if necessary, you can format a disk under HP-UX using the .Xr mediainit (1m) program. Once you have \*(4B up and running on one machine you can use the .Xr scsiformat (8) program to format additional SCSI disks. Any additional HP-IB disks will have to be formatted using HP-UX. .Sh 4 "Step 2: copying the root filesystem from tape to disk" .PP Once you have a formatted second disk you can use the .Xr dd (1) command under HP-UX to copy the root filesystem image from the tape to the beginning of the second disk. For HP's, the root filesystem image is the first file on the tape. It includes a disklabel and bootblock along with the root filesystem. An example command to copy the image from tape to the beginning of a disk is: .DS .ft CW dd if=/dev/rmt/0m of=/dev/rdsk/1s0 bs=\*(Bzb .DE The actual special file syntax may vary depending on unit numbers and the version of HP-UX that is running. Consult the HP-UX .Xr mt (7) and .Xr disk (7) man pages for details. .PP Note that if you have a SCSI disk, you don't necessarily have to use HP-UX (or an HP) to create the boot disk. Any machine and operating system that will allow you to copy the raw disk image out to block 0 of the disk will do. .PP If you have only a single machine with a single disk, you may still be able to install and boot \*(4B if you have an HP-IB cartridge tape drive. If so, you can use a more difficult approach of booting a standalone copy program from the tape, and using that to copy the root filesystem image from the tape to the disk. To do this, you need to extract the first file of the distribution tape (the root image), copy it over to a machine with a cartridge drive and then copy the image onto tape. For example: .DS .ft CW dd if=/dev/rst0 of=bootimage bs=\*(Bzb rcp bootimage foo:/tmp/bootimage dd if=/tmp/bootimage of=/dev/rct/0m bs=\*(Bzb .DE Once this tape is created you can boot and run the standalone tape copy program from it. The copy program is loaded just as any other program would be loaded by the bootrom in ``attended'' mode: reset the CPU, hold down the space bar until the word ``Keyboard'' appears in the installed interface list, and enter the menu selection for SYS_TCOPY. Once loaded and running: .DS .TS lw(2i) l. \fBFrom:\fP \fI^C\fP (control-C to see logical adaptor assignments) \fBhpib0 at sc7\fP \fBscsi0 at sc14\fP \fBFrom:\fP \fIct(0,7,0,0)\fP (HP-IB tape, target 7, first tape file) \fBTo:\fP \fIsd(0,0,0,2)\fP (SCSI disk, target 0, third partition) \fBCopy completed: 1728 records copied\fP .TE .DE .LP This copy will likely take 30 minutes or more. .Sh 4 "Step 3: booting the root filesystem" .PP You now have a bootable root filesystem on the disk. If you were previously running with two disks, it would be best if you shut down the machine and turn off power on the HP-UX drive. It will be less confusing and it will eliminate any chance of accidentally destroying the HP-UX disk. If you used a cartridge tape for booting you should also unload the tape at this point. Whether you booted from tape or copied from disk you should now reboot the machine and do another attended boot (see previous section), this time with SYS_TBOOT. Once loaded and running the boot program will display the CPU type and prompt for a kernel file to boot: .DS .B HP433 CPU Boot .R -\fB:\fP \fI/vmunix\fP +\fB:\fP \fI/kernel\fP .DE .LP After providing the kernel name, the machine will boot \*(4B with output that looks about like this: .DS .B 597480+34120+139288 start 0xfe8019ec Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. Copyright (c) 1992 Hewlett-Packard Company Copyright (c) 1992 Motorola Inc. All rights reserved. 4.4BSD UNIX #1: Tue Jul 20 11:40:36 PDT 1993 mckusick@vangogh.CS.Berkeley.EDU:/usr/obj/sys/compile/GENERIC.hp300 HP9000/433 (33MHz MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches) real mem = xxx avail mem = ### using ### buffers containing ### bytes of memory (... information about available devices ...) root device? .R .DE .PP The first three numbers are printed out by the bootstrap program and are the sizes of different parts of the system (text, initialized and uninitialized data). The system also allocates several system data structures after it starts running. The sizes of these structures are based on the amount of available memory and the maximum count of active users expected, as declared in a system configuration description. This will be discussed later. .PP UNIX itself then runs for the first time and begins by printing out a banner identifying the release and version of the system that is in use and the date that it was compiled. .PP Next the .I mem messages give the amount of real (physical) memory and the memory available to user programs in bytes. For example, if your machine has 16Mb bytes of memory, then \fBxxx\fP will be 16777216. .PP The messages that come out next show what devices were found on the current processor. These messages are described in .Xr autoconf (4). The distributed system may not have found all the communications devices you have or all the mass storage peripherals you have, especially if you have more than two of anything. You will correct this when you create a description of your machine from which to configure a site-dependent version of UNIX. The messages printed at boot here contain much of the information that will be used in creating the configuration. In a correctly configured system most of the information present in the configuration description is printed out at boot time as the system verifies that each device is present. .PP The \*(lqroot device?\*(rq prompt was printed by the system to ask you for the name of the root filesystem to use. This happens because the distribution system is a \fIgeneric\fP system, i.e., it can be bootstrapped on a cpu with its root device and paging area on any available disk drive. You will most likely respond to the root device question with ``sd0'' if you are booting from a SCSI disk, or with ``rd0'' if you are booting from an HP-IB disk. This response shows that the disk it is running on is drive 0 of type ``sd'' or ``rd'' respectively. If you have other disks attached to the system, it is possible that the drive you are using will not be configured as logical drive 0. Check the autoconfiguration messages printed out by the kernel to make sure. These messages will show the type of every logical drive and their associated controller and slave addresses. You will later build a system tailored to your configuration that will not prompt you for a root device when it is bootstrapped. .DS \fBroot device?\fP \fI\*(Dk0\fP \fBWARNING: preposterous time in filesystem \-\- CHECK AND RESET THE DATE!\fP \fBerase ^?, kill ^U, intr ^C\fP \fB#\fP .DE .PP The \*(lqerase ...\*(rq message is part of the .Pn /.profile that was executed by the root shell when it started. This message tells you about the settings of the character erase, line erase, and interrupt characters. .PP UNIX is now running, and the \fIUNIX Programmer's Manual\fP applies. The ``#'' is the prompt from the Bourne shell, and lets you know that you are the super-user, whose login name is \*(lqroot\*(rq. .PP At this point, the root filesystem is mounted read-only. Before continuing the installation, the filesystem needs to be ``updated'' to allow writing and device special files for the following steps need to be created. This is done as follows: .DS .TS lw(2i) l. \fB#\fP \fImount_mfs -s 1000 -T type /dev/null /tmp\fP (create a writable filesystem) (\fItype\fP is the disk type as determined from /etc/disktab) \fB#\fP \fIcd /tmp\fP (connect to that directory) \fB#\fP \fI../dev/MAKEDEV \*(Dk#\fP (create special files for root disk) (\fI\*(Dk\fP is the disk type, \fI#\fP is the unit number) (ignore warning from ``sh'') \fB#\fP \fImount \-uw /tmp/\*(Dk#a /\fP (read-write mount root filesystem) \fB#\fP \fIcd /dev\fP (go to device directory) \fB#\fP \fI./MAKEDEV \*(Dk#\fP (create permanent special files for root disk) (again, ignore warning from ``sh'') .TE .DE .Sh 4 "Step 4: (optional) restoring the root filesystem" .PP The root filesystem that you are currently running on is complete, however it probably is not optimally laid out for the disk on which you are running. If you will be cloning copies of the system onto multiple disks for other machines, you are advised to connect one of these disks to this machine, and build and restore a properly laid out root filesystem onto it. If this is the only machine on which you will be running \*(4B or peak performance is not an issue, you can skip this step and proceed directly to step 5. .PP Connect a second disk to your machine. If you bootstrapped using the two disk method, you can overwrite your initial HP-UX disk, as it will no longer be needed (assuming you have no plans to run HP-UX again). .PP To really create the root filesystem on drive 1 you should first label the disk as described in step 5 below. Then run the following commands: .DS \fB#\fP \fIcd /dev\fP \fB#\fP \fI./MAKEDEV \*(Dk1a\fP \fB#\fP\|\fInewfs /dev/r\*(Dk1a\fP \fB#\fP\|\fImount /dev/\*(Dk1a /mnt\fP \fB#\fP\|\fIcd /mnt\fP \fB#\fP\|\fIdump 0f \- /dev/r\*(Dk0a | restore xf \-\fP (Note: restore will ask if you want to ``set owner/mode for '.''' to which you should reply ``yes''.) .DE .PP When this completes, you should then shut down the system, and boot on the disk that you just created following the procedure in step (3) above. .Sh 4 "Step 5: placing labels on the disks" .PP For each disk on the HP300, \*(4B places information about the geometry of the drive and the partition layout at byte offset 1024. This information is written with .Xr disklabel (8). .PP The root image just loaded includes a ``generic'' label intended to allow easy installation of the root and .Pn /usr and may not be suitable for the actual disk on which it was installed. In particular, it may make your disk appear larger or smaller than its real size. In the former case, you lose some capacity. In the latter, some of the partitions may map non-existent sectors leading to errors if those partitions are used. It is also possible that the defined geometry will interact poorly with the filesystem code resulting in reduced performance. However, as long as you are willing to give up a little space, not use certain partitions or suffer minor performance degradation, you might want to avoid this step; especially if you do not know how to use .Xr ed (1). .PP If you choose to edit this label, you can fill in correct geometry information from .Pn /etc/disktab . You may also want to rework the ``e'' and ``f'' partitions used for loading .Pn /usr and .Pn /var . You should not attempt to, and .Xr disklabel will not let you, modify the ``a'', ``b'' and ``d'' partitions. To edit a label: .DS \fB#\fP \fIEDITOR=ed\fP \fB#\fP \fIexport EDITOR\fP \fB#\fP \fIdisklabel -r -e /dev/r\fBXX#\fPd .DE where \fBXX\fP is the type and \fB#\fP is the logical drive number; e.g. .Pn /dev/rsd0d or .Pn /dev/rrd0d . Note the explicit use of the ``d'' partition. This partition includes the bootblock as does ``c'' and using it allows you to change the size of ``c''. .PP If you wish to label any additional disks, run the following command for each: .DS \fB#\|\fP\fIdisklabel -rw \fBXX# type\fP \fI"optional_pack_name"\fP .DE where \fBXX#\fP is the same as in the previous command and \fBtype\fP is the HP300 disk device name as listed in .Pn /etc/disktab . The optional information may contain any descriptive name for the contents of a disk, and may be up to 16 characters long. This procedure will place the label on the disk using the information found in .Pn /etc/disktab for the disk type named. If you have changed the disk partition sizes, you may wish to add entries for the modified configuration in .Pn /etc/disktab before labeling the affected disks. .PP You have now completed the HP300 specific part of the installation. Now proceed to the generic part of the installation described starting in section 2.5 below. Note that where the disk name ``sd'' is used throughout section 2.5, you should substitute the name ``rd'' if you are running on an HP-IB disk. Also, if you are loading on a single disk with the default disklabel, .Pn /var should be restored to the ``f'' partition and .Pn /usr to the ``e'' partition. .Sh 2 "Booting the SPARC" .Sh 3 "Supported hardware" .LP The hardware supported by \*(4B for the SPARC is as follows: .TS center box; lw(1i) lw(4i). CPU's T{ SPARCstation 1 series (1, 1+, SLC, IPC) and SPARCstation 2 series (2, IPX). T} _ DISK's T{ SCSI. T} _ TAPE's T{ none. T} _ NETWORK T{ SPARCstation Lance (le). T} _ GRAPHICS T{ bwtwo and cgthree. T} _ INPUT T{ Keyboard and mouse. T} _ MISC T{ Battery-backed real time clock, built-in serial devices, Sbus SCSI controller, and audio device. T} .TE .LP Major items that are not supported include anything VME-based, the GX (cgsix) display, the floppy disk, and SCSI tapes. .Sh 3 "Limitations" .LP There are several important limitations on the \*(4B distribution for the SPARC: .IP 1) You .B must have SunOS 4.1.x or Solaris to bring up \*(4B. There is no SPARCstation bootstrap code in this distribution. The Sun-supplied boot loader will be used to boot \*(4B; you must copy this from your SunOS distribution. This imposes several restrictions on the system, as detailed below. .IP 2) The \*(4B SPARC kernel does not remap SCSI IDs. A SCSI disk at target 0 will become ``sd0'', where in SunOS the same disk will normally be called ``sd3''. If your existing SunOS system is diskful, it will be least painful to have SunOS running on the disk on target 0 lun 0 and put \*(4B on the disk on target 3 lun 0. Both systems will then think they are running on ``sd0'', and you can boot either system as needed simply by changing the EEPROM's boot device. .IP 3) There is no SCSI tape driver. You must have another system for tape reading and backups. .IP 4) Although the \*(4B SPARC kernel will handle existing SunOS shared libraries, it does not use or create them itself, and therefore requires much more disk space than SunOS does. .IP 5) It is currently difficult (though not completely impossible) to run \*(4B diskless. These instructions assume you will have a local boot, swap, and root filesystem. .IP 6) When using a serial port rather than a graphics display as the console, only port .Pn ttya can be used. Attempts to use port .Pn ttyb will fail when the kernel tries to print the boot up messages to the console. .Sh 3 "The procedure" .PP You must have a spare disk on which to place \*(4B. The steps involved in bootstrapping this tape are as follows: .IP 1) Bring up SunOS (preferably SunOS 4.1.x or Solaris 1.x, although Solaris 2 may work \(em this is untested). .IP 2) Attach auxiliary SCSI disk(s). Format and label using the SunOS formatting and labeling programs as needed. Note that the root filesystem currently requires at least 10 MB; 16 MB or more is recommended. The b partition will be used for swap; this should be at least 32 MB. .IP 3) Use the SunOS .Xr newfs to build the root filesystem. You may also want to build other filesystems at the same time. (By default, the \*(4B .Xr newfs builds a filesystem that SunOS will not handle; if you plan to switch OSes back and forth you may want to sacrifice the performance gain from the new filesystem format for compatibility.) You can build an old-format filesystem on \*(4B by giving the \-O option to .Xr newfs (8). .Xr Fsck (8) can convert old format filesystems to new format filesystems, but not vice versa, so you may want to initially build old format filesystems so that they can be mounted under SunOS, and then later convert them to new format filesystems when you are satisfied that \*(4B is running properly. In any case, .B you must build an old-style root filesystem .R so that the SunOS boot program will work. .IP 4) Mount the new root, then copy the SunOS .Pn /boot into place and use the SunOS ``installboot'' program to enable disk-based booting. Note that the filesystem must be mounted when you do the ``installboot'': .DS .ft CW # mount /dev/sd3a /mnt # cp /boot /mnt/boot # cd /usr/kvm/mdec # installboot /mnt/boot bootsd /dev/rsd3a .DE The SunOS .Pn /boot will load \*(4B kernels; there is no SPARCstation bootstrap code on the distribution. Note that the SunOS .Pn /boot does not handle the new \*(4B filesystem format. .IP 5) Restore the contents of the \*(4B root filesystem. .DS .ft CW # cd /mnt # rrestore xf tapehost:/dev/nrst0 .DE .IP 6) Boot the supplied kernel: .DS .ft CW # halt -ok boot sd(0,3)vmunix -s [for old proms] OR +ok boot sd(0,3)kernel -s [for old proms] OR ok boot disk3 -s [for new proms] \&... [\*(4B boot messages] .DE .LP To install the remaining filesystems, use the procedure described starting in section 2.5. In these instructions, .Pn /usr should be loaded into the ``e'' partition and .Pn /var in the ``f'' partition. .LP After completing the filesystem installation you may want to set up \*(4B to reboot automatically: .DS .ft CW # halt -ok setenv boot-from sd(0,3)vmunix [for old proms] OR +ok setenv boot-from sd(0,3)kernel [for old proms] OR ok setenv boot-device disk3 [for new proms] .DE If you build backwards-compatible filesystems, either with the SunOS newfs or with the \*(4B ``\-O'' option, you can mount these under SunOS. The SunOS fsck will, however, always think that these filesystems are corrupted, as there are several new (previously unused) superblock fields that are updated in \*(4B. Running ``fsck \-b32'' and letting it ``fix'' the superblock will take care of this. .sp 0.5 If you wish to run SunOS binaries that use SunOS shared libraries, you simply need to copy all the dynamic linker files from an existing SunOS system: .DS .ft CW # rcp sunos-host:/etc/ld.so.cache /etc/ # rcp sunos-host:'/usr/lib/*.so*' /usr/lib/ .DE The SunOS compiler and linker should be able to produce SunOS binaries under \*(4B, but this has not been tested. If you plan to try it you will need the appropriate .sa files as well. .Sh 2 "Booting the DECstation" .Sh 3 "Supported hardware" .LP The hardware supported by \*(4B for the DECstation is as follows: .TS center box; lw(1i) lw(4i). CPU's T{ R2000 based (3100) and R3000 based (5000/200, 5000/20, 5000/25, 5000/1xx). T} _ DISK's T{ SCSI-I (tested RZ23, RZ55, RZ57, Maxtor 8760S). T} _ TAPE's T{ SCSI-I (tested DEC TK50, Archive DAT, Emulex MT02). T} _ RS232 T{ Internal DEC dc7085 and AMD 8530 based interfaces. T} _ NETWORK T{ TURBOchannel PMAD-AA and internal LANCE based interfaces. T} _ GRAPHICS T{ Terminal emulation and raw frame buffer support for 3100 (color & monochrome), TURBOchannel PMAG-AA, PMAG-BA, PMAG-DV. T} _ INPUT T{ Standard DEC keyboard (LK201) and mouse. T} _ MISC T{ Battery-backed real time clock, internal and TURBOchannel PMAZ-AA SCSI interfaces. T} .TE .LP Major items that are not supported include the 5000/240 (there is code but not compiled in or tested), R4000 based machines, FDDI and audio interfaces. Diskless machines are not supported but booting kernels and bootstrapping over the network is supported on the 5000 series. .Sh 3 "The procedure" .PP The first file on the distribution tape is a tar file that contains four files. The first step requires a running UNIX (or ULTRIX) system that can be used to extract the tar archive from the first file on the tape. The command: .DS .ft CW tar xf /dev/rmt0 .DE will extract the following four files: .DS A) root.image: \fIdd\fP image of the root filesystem -B) vmunix.tape: \fIdd\fP image for creating boot tapes -C) vmunix.net: file for booting over the network +B) kernel.tape: \fIdd\fP image for creating boot tapes +C) kernel.net: file for booting over the network D) root.dump: \fIdump\fP image of the root filesystem .DE There are three basic ways a system can be bootstrapped corresponding to the first three files. You may want to read the section on bootstrapping the HP300 since many of the steps are similar. A spare, formatted SCSI disk is also useful. .Sh 4 "Procedure A: copy root filesystem to disk" .PP This procedure is similar to the HP300. If you have an extra disk, the easiest approach is to use \fIdd\fP\|(1) under ULTRIX to copy the root filesystem image to the beginning of the spare disk. The root filesystem image includes a disklabel and bootblock along with the root filesystem. An example command to copy the image to the beginning of a disk is: .DS .ft CW dd if=root.image of=/dev/rz1c bs=\*(Bzb .DE The actual special file syntax will vary depending on unit numbers and the version of ULTRIX that is running. This system is now ready to boot. You can boot the kernel with one of the following PROM commands. If you are booting on a 3100, the disk must be SCSI id zero because of a bug. .DS .ft CW -DEC 3100: boot \-f rz(0,0,0)vmunix -DEC 5000: boot 5/rz0/vmunix +DEC 3100: boot \-f rz(0,0,0)kernel +DEC 5000: boot 5/rz0/kernel .DE You can then proceed to section 2.5 to create reasonable disk partitions for your machine and then install the rest of the system. .Sh 4 "Procedure B: bootstrap from tape" .PP If you have only a single machine with a single disk, you need to use the more difficult approach of booting a kernel and mini-root from tape or the network, and using it to restore the root filesystem. .PP First, you will need to create a boot tape. This can be done using \fIdd\fP as in the following example. .DS .ft CW -dd if=vmunix.tape of=/dev/nrmt0 bs=1b +dd if=kernel.tape of=/dev/nrmt0 bs=1b dd if=root.dump of=/dev/nrmt0 bs=\*(Bzb .DE The actual special file syntax for the tape drive will vary depending on unit numbers, tape device and the version of ULTRIX that is running. .PP The first file on the boot tape contains a boot header, kernel, and mini-root filesystem that the PROM can copy into memory. Installing from tape has only been tested on a 3100 and a 5000/200 using a TK50 tape drive. Here are two example PROM commands to boot from tape. .DS .ft CW DEC 3100: boot \-f tz(0,5,0) m # 5 is the SCSI id of the TK50 DEC 5000: boot 5/tz6 m # 6 is the SCSI id of the TK50 .DE The `m' argument tells the kernel to look for a root filesystem in memory. Next you should proceed to section 2.4.3 to build a disk-based root filesystem. .Sh 4 "Procedure C: bootstrap over the network" .PP You will need a host machine that is running the \fIbootp\fP server with the -.Pn vmunix.net +.Pn kernel.net file installed in the default directory defined by the configuration file for .Xr bootp . Here are two example PROM commands to boot across the net: .DS .ft CW -DEC 3100: boot \-f tftp()vmunix.net m -DEC 5000: boot 6/tftp/vmunix.net m +DEC 3100: boot \-f tftp()kernel.net m +DEC 5000: boot 6/tftp/kernel.net m .DE This command should load the kernel and mini-root into memory and run the same as the tape install (procedure B). The rest of the steps are the same except you will need to start the network (if you are unsure how to fill in the fields below, see sections 4.4 and 5). Execute the following to start the networking: .DS .ft CW # mount \-uw / # echo 127.0.0.1 localhost >> /etc/hosts # echo myname.my.domain myname >> /etc/hosts # echo myfriend.my.domain myfriend >> /etc/hosts # ifconfig le0 inet myname .DE Next you should proceed to section 2.4.3 to build a disk-based root filesystem. .Sh 3 "Label disk and create the root filesystem" .LP There are five steps to create a disk-based root filesystem. .IP 1) Label the disk. .DS .ft CW # disklabel -W /dev/rrz?c # This enables writing the label # disklabel -w -r -B /dev/rrz?c $DISKTYPE # newfs /dev/rrz?a \&... # fsck /dev/rrz?a \&... .DE Supported disk types are listed in .Pn /etc/disktab . .IP 2) Restore the root filesystem. .DS .ft CW # mount \-uw / # mount /dev/rz?a /a # cd /a .DE .ti +0.4i If you are restoring locally (procedure B), run: .DS .ft CW # mt \-f /dev/nrmt0 rew # restore \-xsf 2 /dev/rmt0 .DE .ti +0.4i If you are restoring across the net (procedure c), run: .DS .ft CW # rrestore xf myfriend:/path/to/root.dump .DE .ti +0.4i When the restore finishes, clean up with: .DS .ft CW # cd / # sync # umount /a # fsck /dev/rz?a .DE .IP 3) Reset the system and initialize the PROM monitor to boot automatically. .DS .ft CW -DEC 3100: setenv bootpath boot \-f rz(0,?,0)vmunix -DEC 5000: setenv bootpath 5/rz?/vmunix -a +DEC 3100: setenv bootpath boot \-f rz(0,?,0)kernel +DEC 5000: setenv bootpath 5/rz?/kernel -a .DE .IP 4) After booting UNIX, you will need to create .Pn /dev/mouse to run X windows as in the following example. .DS .ft CW rm /dev/mouse ln /dev/xx /dev/mouse .DE The 'xx' should be one of the following: .DS pm0 raw interface to PMAX graphics devices cfb0 raw interface to TURBOchannel PMAG-BA color frame buffer xcfb0 raw interface to maxine graphics devices mfb0 raw interface to mono graphics devices .DE You can then proceed to section 2.5 to install the rest of the system. Note that where the disk name ``sd'' is used throughout section 2.5, you should substitute the name ``rz''. .Sh 2 "Disk configuration" .PP All architectures now have a root filesystem up and running and proceed from this point to layout filesystems to make use of the available space and to balance disk load for better system performance. .Sh 3 "Disk naming and divisions" .PP Each physical disk drive can be divided into up to 8 partitions; UNIX typically uses only 3 or 4 partitions. For instance, the first partition, \*(Dk0a, is used for a root filesystem, a backup thereof, or a small filesystem like, .Pn /var/tmp ; the second partition, \*(Dk0b, is used for paging and swapping; and a third partition, typically \*(Dk0e, holds a user filesystem. .PP The space available on a disk varies per device. Each disk typically has a paging area of 30 to 100 megabytes and a root filesystem of about 17 megabytes. .\" XXX check The distributed system binaries occupy about 150 (180 with X11R5) megabytes .\" XXX check while the major sources occupy another 250 (340 with X11R5) megabytes. The .Pn /var filesystem as delivered on the tape is only 2Mb, however it should have at least 50Mb allocated to it just for normal system activity. Usually it is allocated the last partition on the disk so that it can provide as much space as possible to the .Pn /var/users filesystem. See section 2.5.4 for further details on disk layouts. .PP Be aware that the disks have their sizes measured in disk sectors (usually 512 bytes), while the UNIX filesystem blocks are variable sized. If .Sm BLOCKSIZE=1k is set in the user's environment, all user programs report disk space in kilobytes, otherwise, disk sizes are always reported in units of 512-byte sectors\**. .FS You can thank System V intransigence and POSIX duplicity for requiring that 512-byte blocks be the units that programs report. .FE The .Pn /etc/disktab file used in labelling disks and making filesystems specifies disk partition sizes in sectors. .Sh 3 "Layout considerations" .PP There are several considerations in deciding how to adjust the arrangement of things on your disks. The most important is making sure that there is adequate space for what is required; secondarily, throughput should be maximized. Paging space is an important parameter. The system, as distributed, sizes the configured paging areas each time the system is booted. Further, multiple paging areas of different sizes may be interleaved. .PP Many common system programs (C, the editor, the assembler etc.) create intermediate files in the .Pn /tmp directory, so the filesystem where this is stored also should be made large enough to accommodate most high-water marks. Typically, .Pn /tmp is constructed from a memory-based filesystem (see .Xr mount_mfs (8)). Programs that want their temporary files to persist across system reboots (such as editors) should use .Pn /var/tmp . If you plan to use a disk-based .Pn /tmp filesystem to avoid loss across system reboots, it makes sense to mount this in a ``root'' (i.e. first partition) filesystem on another disk. All the programs that create files in .Pn /tmp take care to delete them, but are not immune to rare events and can leave dregs. The directory should be examined every so often and the old files deleted. .PP The efficiency with which UNIX is able to use the CPU is often strongly affected by the configuration of disk controllers; it is critical for good performance to balance disk load. There are at least five components of the disk load that you can divide between the available disks: .IP 1) The root filesystem. .IP 2) The .Pn /var and .Pn /var/tmp filesystems. .IP 3) The .Pn /usr filesystem. .IP 4) The user filesystems. .IP 5) The paging activity. .LP The following possibilities are ones we have used at times when we had 2, 3 and 4 disks: .TS center doublebox; l | c s s l | lw(5) | lw(5) | lw(5). disks what 2 3 4 _ root 0 0 0 var 1 2 3 usr 1 1 1 paging 0+1 0+2 0+2+3 users 0 0+2 0+2 archive x x 3 .TE .PP The most important things to consider are to even out the disk load as much as possible, and to do this by decoupling filesystems (on separate arms) between which heavy copying occurs. Note that a long term average balanced load is not important; it is much more important to have an instantaneously balanced load when the system is busy. .PP Intelligent experimentation with a few filesystem arrangements can pay off in much improved performance. It is particularly easy to move the root, the .Pn /var and .Pn /var/tmp filesystems and the paging areas. Place the user files and the .Pn /usr directory as space needs dictate and experiment with the other, more easily moved filesystems. .Sh 3 "Filesystem parameters" .PP Each filesystem is parameterized according to its block size, fragment size, and the disk geometry characteristics of the medium on which it resides. Inaccurate specification of the disk characteristics or haphazard choice of the filesystem parameters can result in substantial throughput degradation or significant waste of disk space. As distributed, filesystems are configured according to the following table. .DS .TS center; l l l. Filesystem Block size Fragment size _ root 8 kbytes 1 kbytes usr 8 kbytes 1 kbytes users 4 kbytes 512 bytes .TE .DE .PP The root filesystem block size is made large to optimize bandwidth to the associated disk. The large block size is important as many of the most heavily used programs are demand paged out of the .Pn /bin directory. The fragment size of 1 kbyte is a ``nominal'' value to use with a filesystem. With a 1 kbyte fragment size disk space utilization is about the same as with the earlier versions of the filesystem. .PP The filesystems for users have a 4 kbyte block size with 512 byte fragment size. These parameters have been selected based on observations of the performance of our user filesystems. The 4 kbyte block size provides adequate bandwidth while the 512 byte fragment size provides acceptable space compaction and disk fragmentation. .PP Other parameters may be chosen in constructing filesystems, but the factors involved in choosing a block size and fragment size are many and interact in complex ways. Larger block sizes result in better throughput to large files in the filesystem as larger I/O requests will then be done by the system. However, consideration must be given to the average file sizes found in the filesystem and the performance of the internal system buffer cache. The system currently provides space in the inode for 12 direct block pointers, 1 single indirect block pointer, 1 double indirect block pointer, and 1 triple indirect block pointer. If a file uses only direct blocks, access time to it will be optimized by maximizing the block size. If a file spills over into an indirect block, increasing the block size of the filesystem may decrease the amount of space used by eliminating the need to allocate an indirect block. However, if the block size is increased and an indirect block is still required, then more disk space will be used by the file because indirect blocks are allocated according to the block size of the filesystem. .PP In selecting a fragment size for a filesystem, at least two considerations should be given. The major performance tradeoffs observed are between an 8 kbyte block filesystem and a 4 kbyte block filesystem. Because of implementation constraints, the block size versus fragment size ratio can not be greater than 8. This means that an 8 kbyte filesystem will always have a fragment size of at least 1 kbytes. If a filesystem is created with a 4 kbyte block size and a 1 kbyte fragment size, then upgraded to an 8 kbyte block size and 1 kbyte fragment size, identical space compaction will be observed. However, if a filesystem has a 4 kbyte block size and 512 byte fragment size, converting it to an 8K/1K filesystem will result in 4-8% more space being used. This implies that 4 kbyte block filesystems that might be upgraded to 8 kbyte blocks for higher performance should use fragment sizes of at least 1 kbytes to minimize the amount of work required in conversion. .PP A second, more important, consideration when selecting the fragment size for a filesystem is the level of fragmentation on the disk. With an 8:1 fragment to block ratio, storage fragmentation occurs much sooner, particularly with a busy filesystem running near full capacity. By comparison, the level of fragmentation in a 4:1 fragment to block ratio filesystem is one tenth as severe. This means that on filesystems where many files are created and deleted, the 512 byte fragment size is more likely to result in apparent space exhaustion because of fragmentation. That is, when the filesystem is nearly full, file expansion that requires locating a contiguous area of disk space is more likely to fail on a 512 byte filesystem than on a 1 kbyte filesystem. To minimize fragmentation problems of this sort, a parameter in the super block specifies a minimum acceptable free space threshold. When normal users (i.e. anyone but the super-user) attempt to allocate disk space and the free space threshold is exceeded, the user is returned an error as if the filesystem were really full. This parameter is nominally set to 5%; it may be changed by supplying a parameter to .Xr newfs (8), or by updating the super block of an existing filesystem using .Xr tunefs (8). .PP Finally, a third, less common consideration is the attributes of the disk itself. The fragment size should not be smaller than the physical sector size of the disk. As an example, the HP magneto-optical disks have 1024 byte physical sectors. Using a 512 byte fragment size on such disks will work but is extremely inefficient. .PP Note that the above discussion considers block sizes of up to only 8k. As of the 4.4 release, the maximum block size has been increased to 64k. This allows an entirely new set of block/fragment combinations for which there is little experience to date. In general though, unless a filesystem is to be used for a special purpose application (for example, storing image processing data), we recommend using the values supplied above. Remember that the current implementation limits the block size to at most 64 kbytes and the ratio of block size versus fragment size must be 1, 2, 4, or 8. .PP The disk geometry information used by the filesystem affects the block layout policies employed. The file .Pn /etc/disktab , as supplied, contains the data for most all drives supported by the system. Before constructing a filesystem with .Xr newfs (8) you should label the disk (if it has not yet been labeled, and the driver supports labels). If labels cannot be used, you must instead specify the type of disk on which the filesystem resides; .Xr newfs then reads .Pn /etc/disktab instead of the pack label. This file also contains the default filesystem partition sizes, and default block and fragment sizes. To override any of the default values you can modify the file, edit the disk label, or use an option to .Xr newfs . .Sh 3 "Implementing a layout" .PP To put a chosen disk layout into effect, you should use the .Xr newfs (8) command to create each new filesystem. Each filesystem must also be added to the file .Pn /etc/fstab so that it will be checked and mounted when the system is bootstrapped. .PP First we will consider a system with a single disk. There is little real choice on how to do the layout; the root filesystem goes in the ``a'' partition, .Pn /usr goes in the ``e'' partition, and .Pn /var fills out the remainder of the disk in the ``f'' partition. This is the organization used if you loaded the disk-image root filesystem. With the addition of a memory-based .Pn /tmp filesystem, its fstab entry would be as follows: .TS center; lfC lfC l l n n. /dev/\*(Dk0a / ufs rw 1 1 /dev/\*(Dk0b none swap sw 0 0 /dev/\*(Dk0b /tmp mfs rw,-s=14000,-b=8192,-f=1024,-T=sd660 0 0 /dev/\*(Dk0e /usr ufs ro 1 2 /dev/\*(Dk0f /var ufs rw 1 2 .TE .PP If we had a second disk, we would split the load between the drives. On the second disk, we place the .Pn /usr and .Pn /var filesystems in their usual \*(Dk1e and \*(Dk1f partitions respectively. The \*(Dk1b partition would be used as a second paging area, and the \*(Dk1a partition left as a spare root filesystem (alternatively \*(Dk1a could be used for .Pn /var/tmp ). The first disk still holds the the root filesystem in \*(Dk0a, and the primary swap area in \*(Dk0b. The \*(Dk0e partition is used to hold home directories in .Pn /var/users . The \*(Dk0f partition can be used for .Pn /usr/src or alternately the \*(Dk0e partition can be extended to cover the rest of the disk with .Xr disklabel (8). As before, the .Pn /tmp directory is a memory-based filesystem. Note that to interleave the paging between the two disks you must build a system configuration that specifies: .DS -config vmunix root on \*(Dk0 swap on \*(Dk0 and \*(Dk1 +config kernel root on \*(Dk0 swap on \*(Dk0 and \*(Dk1 .DE The .Pn /etc/fstab file would then contain .TS center; lfC lfC l l n n. /dev/\*(Dk0a / ufs rw 1 1 /dev/\*(Dk0b none swap sw 0 0 /dev/\*(Dk1b none swap sw 0 0 /dev/\*(Dk0b /tmp mfs rw,-s=14000,-b=8192,-f=1024,-T=sd660 0 0 /dev/\*(Dk1e /usr ufs ro 1 2 /dev/\*(Dk0f /usr/src ufs rw 1 2 /dev/\*(Dk1f /var ufs rw 1 2 /dev/\*(Dk0e /var/users ufs rw 1 2 .TE .PP To make the .Pn /var filesystem we would do: .DS \fB#\fP \fIcd /dev\fP \fB#\fP \fIMAKEDEV \*(Dk1\fP \fB#\fP \fIdisklabel -wr \*(Dk1 "disk type" "disk name"\fP \fB#\fP \fInewfs \*(Dk1f\fP (information about filesystem prints out) \fB#\fP \fImkdir /var\fP \fB#\fP \fImount /dev/\*(Dk1f /var\fP .DE .Sh 2 "Installing the rest of the system" .PP At this point you should have your disks partitioned. The next step is to extract the rest of the data from the tape. At a minimum you need to set up the .Pn /var and .Pn /usr filesystems. You may also want to extract some or all the program sources. Since not all architectures support tape drives or don't support the correct ones, you may need to extract the files indirectly using .Xr rsh (1). For example, for a directly connected tape drive you might do: .DS \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP .DE The equivalent indirect procedure (where the tape drive is on machine ``foo'') is: .DS \fB#\fP \fIrsh foo mt -f /dev/nr\*(Mt0 fsf\fP \fB#\fP \fIrsh foo dd if=/dev/nr\*(Mt0 bs=\*(Bzb | tar xbpf \*(Bz -\fP .DE Obviously, the target machine must be connected to the local network for this to work. To do this: .DS \fB#\fP \fIecho 127.0.0.1 localhost >> /etc/hosts\fP \fB#\fP \fIecho \fPyour.host.inet.number myname.my.domain myname\fI >> /etc/hosts\fP \fB#\fP \fIecho \fPfriend.host.inet.number myfriend.my.domain myfriend\fI >> /etc/hosts\fP \fB#\fP \fIifconfig le0 inet \fPmyname .DE where the ``host.inet.number'' fields are the IP addresses for your host and the host with the tape drive and the ``my.domain'' fields are the names of your machine and the tape-hosting machine. See sections 4.4 and 5 for more information on setting up the network. .PP Assuming a directly connected tape drive, here is how to extract and install .Pn /var and .Pn /usr : .br .ne 5 .TS lw(2i) l. \fB#\fP \fImount \-uw /dev/\*(Dk#a /\fP (read-write mount root filesystem) \fB#\fP \fIdate yymmddhhmm\fP (set date, see \fIdate\fP\|(1)) \&.... \fB#\fP \fIpasswd -l root\fP (set password for super-user) \fBNew password:\fP (password will not echo) \fBRetype new password:\fP \fB#\fP \fIpasswd -l toor\fP (set password for super-user) \fBNew password:\fP (password will not echo) \fBRetype new password:\fP \fB#\fP \fIhostname mysitename\fP (set your hostname) \fB#\fP \fInewfs r\*(Dk#p\fP (create empty user filesystem) (\fI\*(Dk\fP is the disk type, \fI#\fP is the unit number, \fIp\fP is the partition; this takes a few minutes) \fB#\fP \fImount /dev/\*(Dk#p /var\fP (mount the var filesystem) \fB#\fP \fIcd /var\fP (make /var the current directory) \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP (extract all of var) (this takes a few minutes) \fB#\fP \fInewfs r\*(Dk#p\fP (create empty user filesystem) (as before \fI\*(Dk\fP is the disk type, \fI#\fP is the unit number, \fIp\fP is the partition) \fB#\fP \fImount /dev/\*(Dk#p /mnt\fP (mount the new /usr in temporary location) \fB#\fP \fIcd /mnt\fP (make /mnt the current directory) \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP (extract all of usr except usr/src) (this takes about 15-20 minutes) \fB#\fP \fIcd /\fP (make / the current directory) \fB#\fP \fIumount /mnt\fP (unmount from temporary mount point) \fB#\fP \fIrm -r /usr/*\fP (remove excess bootstrap binaries) \fB#\fP \fImount /dev/\*(Dk#p /usr\fP (remount /usr) .TE If no disk label has been installed on the disk, the .Xr newfs command will require a third argument to specify the disk type, using one of the names in .Pn /etc/disktab . If the tape had been rewound or positioned incorrectly before the .Xr tar , to extract .Pn /var it may be repositioned by the following commands. .DS \fB#\fP \fImt -f /dev/nr\*(Mt0 rew\fP \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf 1\fP .DE The data on the second and third tape files has now been extracted. If you are using 6250bpi tapes, the first reel of the distribution is no longer needed; you should now mount the second reel instead. The installation procedure continues from this point on the 8mm tape. The next step is to extract the sources. As previously noted, .Pn /usr/src .\" XXX Check requires about 250-340Mb of space. Ideally sources should be in a separate filesystem; if you plan to put them into your .Pn /usr filesystem, it will need at least 500Mb of space. Assuming that you will be using a separate filesystem on \*(Dk0f for .Pn /usr/src , you will start by creating and mounting it: .DS \fB#\fP \fInewfs \*(Dk0f\fP (information about filesystem prints out) \fB#\fP \fImkdir /usr/src\fP \fB#\fP \fImount /dev/\*(Dk0f /usr/src\fP .DE .LP First you will extract the kernel source: .DS .TS lw(2i) l. \fB#\fP \fIcd /usr/src\fP \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) (this should only be done on Exabyte distributions) \fB#\fP \fItar xpbf \*(Bz /dev/nr\*(Mt0\fP (extract the kernel sources) (this takes about 15-30 minutes) .TE .DE .LP The next tar file contains the sources for the utilities. It is extracted as follows: .DS .TS lw(2i) l. \fB#\fP \fIcd /usr/src\fP \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) \fB#\fP \fItar xpbf \*(Bz /dev/rmt12\fP (extract the utility source) (this takes about 30-60 minutes) .TE .DE .PP If you are using 6250bpi tapes, the second reel of the distribution is no longer needed; you should now mount the third reel instead. The installation procedure continues from this point on the 8mm tape. .PP The next tar file contains the sources for the contributed software. It is extracted as follows: .DS .TS lw(2i) l. \fB#\fP \fIcd /usr/src\fP \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) (this should only be done on Exabyte distributions) \fB#\fP \fItar xpbf \*(Bz /dev/rmt12\fP (extract the contributed software source) (this takes about 30-60 minutes) .TE .DE .PP If you received a distribution on 8mm Exabyte tape, there is one additional tape file on the distribution tape that has not been installed to this point; it contains the sources for X11R5 in .Xr tar (1) format. As distributed, X11R5 should be placed in .Pn /usr/src/X11R5 . .DS .TS lw(2i) l. \fB#\fP \fIcd /usr/src\fP \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP (space to end of previous tape file) \fB#\fP \fItar xpbf \*(Bz /dev/nr\*(Mt0\fP (extract the X11R5 source) (this takes about 30-60 minutes) .TE .DE Many of the X11 utilities search using the path .Pn /usr/X11 , so be sure that you have a symbolic link that points at the location of your X11 binaries (here, X11R5). .PP Having now completed the extraction of the sources, you may want to verify that your .Pn /usr/src filesystem is consistent. To do so, you must unmount it, and run .Xr fsck (8); assuming that you used \*(Dk0f you would proceed as follows: .DS .TS lw(2i) l. \fB#\fP \fIcd /\fP (change directory, back to the root) \fB#\fP \fIumount /usr/src\fP (unmount /usr/src) \fB#\fP \fIfsck /dev/r\*(Dk0f\fP .TE .DE The output from .Xr fsck should look something like: .DS .B ** /dev/r\*(Dk0f ** Last Mounted on /usr/src ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 23000 files, 261000 used, 39000 free (2200 frags, 4600 blocks) .R .DE .PP If there are inconsistencies in the filesystem, you may be prompted to apply corrective action; see the .Xr fsck (8) or \fIFsck \(en The UNIX File System Check Program\fP (SMM:3) for more details. .PP To use the .Pn /usr/src filesystem, you should now remount it with: .DS \fB#\fP \fImount /dev/\*(Dk0f /usr/src\fP .DE or if you have made an entry for it in .Pn /etc/fstab you can remount it with: .DS \fB#\fP \fImount /usr/src\fP .DE .Sh 2 "Additional conversion information" .PP After setting up the new \*(4B filesystems, you may restore the user files that were saved on tape before beginning the conversion. Note that the \*(4B .Xr restore program does its work on a mounted filesystem using normal system operations. This means that filesystem dumps may be restored even if the characteristics of the filesystem changed. To restore a dump tape for, say, the .Pn /a filesystem something like the following would be used: .DS \fB#\fP \fImkdir /a\fP \fB#\fP \fInewfs \*(Dk#p\fI \fB#\fP \fImount /dev/\*(Dk#p /a\fP \fB#\fP \fIcd /a\fP \fB#\fP \fIrestore x\fP .DE .PP If .Xr tar images were written instead of doing a dump, you should be sure to use its `\-p' option when reading the files back. No matter how you restore a filesystem, be sure to unmount it and and check its integrity with .Xr fsck (8) when the job is complete. Index: head/share/doc/smm/01.setup/4.t =================================================================== --- head/share/doc/smm/01.setup/4.t (revision 1855) +++ head/share/doc/smm/01.setup/4.t (revision 1856) @@ -1,713 +1,713 @@ .\" Copyright (c) 1980, 1986, 1988 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. .\" .\" @(#)4.t 8.1 (Berkeley) 7/29/93 .\" .ds LH "Installing/Operating \*(4B .ds CF \*(Dy .ds RH "System setup .Sh 1 "System setup" .PP This section describes procedures used to set up a \*(4B UNIX system. These procedures are used when a system is first installed or when the system configuration changes. Procedures for normal system operation are described in the next section. .Sh 2 "Kernel configuration" .PP This section briefly describes the layout of the kernel code and how files for devices are made. For a full discussion of configuring and building system images, consult the document ``Building 4.3BSD UNIX Systems with Config'' (SMM:2). .Sh 3 "Kernel organization" .PP As distributed, the kernel source is in a separate tar image. The source may be physically located anywhere within any filesystem so long as a symbolic link to the location is created for the file .Pn /sys (many files in .Pn /usr/include are normally symbolic links relative to .Pn /sys ). In further discussions of the system source all path names will be given relative to .Pn /sys . .LP The kernel is made up of several large generic parts: .TS l l l. sys main kernel header files kern kernel functions broken down as follows init system startup, syscall dispatching, entry points kern scheduling, descriptor handling and generic I/O sys process management, signals tty terminal handling and job control vfs filesystem management uipc interprocess communication (sockets) subr miscellaneous support routines vm virtual memory management ufs local filesystems broken down as follows ufs common local filesystem routines ffs fast filesystem lfs log-based filesystem mfs memory based filesystem nfs Sun-compatible network filesystem miscfs miscellaneous filesystems broken down as follows deadfs where rejected vnodes go to die fdesc access to per-process file descriptors fifofs IEEE Std1003.1 FIFOs kernfs filesystem access to kernel data structures lofs loopback filesystem nullfs another loopback filesystem portal associate processes with filesystem locations specfs device special files umapfs provide alternate uid/gid mappings dev generic device drivers (SCSI, vnode, concatenated disk) .TE .LP The networking code is organized by protocol .TS l l. net routing and generic interface drivers netinet Internet protocols (TCP, UDP, IP, etc) netiso ISO protocols (TP-4, CLNP, CLTP, etc) netns Xerox network systems protocols (IDP, SPP, etc) netx25 CCITT X.25 protocols (X.25 Packet Level, HDLC/LAPB) .TE .LP A separate subdirectory is provided for each machine architecture .TS l l. hp300 HP 9000/300 series of Motorola 68000-based machines hp code common to both HP 68k and (non-existent) PA-RISC ports i386 Intel 386/486-based PC machines luna68k Omron 68000-based workstations news3400 Sony News MIPS-based workstations pmax Digital 3100/5000 MIPS-based workstations sparc Sun Microsystems SPARCstation 1, 1+, and 2 tahoe (deprecated) CCI Power 6-series machines vax (deprecated) Digital VAX machines .TE .LP Each machine directory is subdivided by function; for example the hp300 directory contains .TS l l. include exported machine-dependent header files hp300 machine-dependent support code and private header files dev device drivers conf configuration files stand machine-dependent standalone code .TE .LP Other kernel related directories .TS l l. compile area to compile kernels conf machine-independent configuration files stand machine-independent standalone code .TE .Sh 3 "Devices and device drivers" .PP Devices supported by UNIX are implemented in the kernel by drivers whose source is kept in .Pn /sys//dev . These drivers are loaded into the system when included in a cpu specific configuration file kept in the conf directory. Devices are accessed through special files in the filesystem, made by the .Xr mknod (8) program and normally kept in the .Pn /dev directory. For all the devices supported by the distribution system, the files in .Pn /dev are created by the .Pn /dev/MAKEDEV shell script. .PP Determine the set of devices that you have and create a new .Pn /dev directory by running the MAKEDEV script. First create a new directory .Pn /newdev , copy MAKEDEV into it, edit the file MAKEDEV.local to provide an entry for local needs, and run it to generate a .Pn /newdev directory. For instance, .DS \fB#\fP \fIcd /\fP \fB#\fP \fImkdir newdev\fP \fB#\fP \fIcp dev/MAKEDEV newdev/MAKEDEV\fP \fB#\fP \fIcd newdev\fP \fB#\fP \fIMAKEDEV \*(Dk0 pt0 std LOCAL\fP .DE Note the ``std'' argument causes standard devices such as .Pn /dev/console , the machine console, to be created. .PP You can then do .DS \fB#\fP \fIcd /\fP \fB#\fP \fImv dev olddev ; mv newdev dev\fP \fB#\fP \fIsync\fP .DE to install the new device directory. .Sh 3 "Building new system images" .PP The kernel configuration of each UNIX system is described by a single configuration file, stored in the .Pn /sys//conf directory. To learn about the format of this file and the procedure used to build system images, start by reading ``Building 4.3BSD UNIX Systems with Config'' (SMM:2), look at the manual pages in section 4 of the UNIX manual for the devices you have, and look at the sample configuration files in the .Pn /sys//conf directory. .PP The configured system image -.Pn vmunix +.Pn kernel should be copied to the root, and then booted to try it out. It is best to name it -.Pn /newvmunix +.Pn /newkernel so as not to destroy the working system until you are sure it does work: .DS -\fB#\fP \fIcp vmunix /newvmunix\fP +\fB#\fP \fIcp kernel /newkernel\fP \fB#\fP \fIsync\fP .DE It is also a good idea to keep the previous system around under some other name. In particular, we recommend that you save the generic distribution version of the system permanently as -.Pn /genvmunix +.Pn /genkernel for use in emergencies. To boot the new version of the system you should follow the bootstrap procedures outlined in section 6.1. After having booted and tested the new system, it should be installed as -.Pn /vmunix +.Pn /kernel before going into multiuser operation. A systematic scheme for numbering and saving old versions of the system may be useful. .Sh 2 "Configuring terminals" .PP If UNIX is to support simultaneous access from directly-connected terminals other than the console, the file .Pn /etc/ttys (see .Xr ttys (5)) must be edited. .PP To add a new terminal device, be sure the device is configured into the system and that the special files for the device have been made by .Pn /dev/MAKEDEV . Then, enable the appropriate lines of .Pn /etc/ttys by setting the ``status'' field to \fBon\fP (or add new lines). Note that lines in .Pn /etc/ttys are one-for-one with entries in the file of current users (see .Pn /var/run/utmp ), and therefore it is best to make changes while running in single-user mode and to add all the entries for a new device at once. .PP Each line in the .Pn /etc/ttys file is broken into four tab separated fields (comments are shown by a `#' character and extend to the end of the line). For each terminal line the four fields are: the device (without a leading .Pn /dev ), the program .Pn /sbin/init should startup to service the line (or \fBnone\fP if the line is to be left alone), the terminal type (found in .Pn /usr/share/misc/termcap ), and optional status information describing if the terminal is enabled or not and if it is ``secure'' (i.e. the super user should be allowed to login on the line). If the console is marked as ``insecure'', then the root password is required to bring the machine up single-user. All fields are character strings with entries requiring embedded white space enclosed in double quotes. Thus a newly added terminal .Pn /dev/tty00 could be added as .DS tty00 "/usr/libexec/getty std.9600" vt100 on secure # mike's office .DE The std.9600 parameter provided to .Pn /usr/libexec/getty is used in searching the file .Pn /etc/gettytab ; it specifies a terminal's characteristics (such as baud rate). To make custom terminal types, consult .Xr gettytab (5) before modifying .Pn /etc/gettytab . .PP Dialup terminals should be wired so that carrier is asserted only when the phone line is dialed up. For non-dialup terminals, from which modem control is not available, you must wire back the signals so that the carrier appears to always be present. For further details, find your terminal driver in section 4 of the manual. .PP For network terminals (i.e. pseudo terminals), no program should be started up on the lines. Thus, the normal entry in .Pn /etc/ttys would look like .DS ttyp0 none network .DE (Note, the fourth field is not needed here.) .PP When the system is running multi-user, all terminals that are listed in .Pn /etc/ttys as \fBon\fP have their line enabled. If, during normal operations, you wish to disable a terminal line, you can edit the file .Pn /etc/ttys to change the terminal's status to \fBoff\fP and then send a hangup signal to the .Xr init process, by doing .DS \fB#\fP \fIkill \-1 1\fP .DE Terminals can similarly be enabled by changing the status field from \fBoff\fP to \fBon\fP and sending a hangup signal to .Xr init . .PP Note that if a special file is inaccessible when .Xr init tries to create a process for it, .Xr init will log a message to the system error logging process (see .Xr syslogd (8)) and try to reopen the terminal every minute, reprinting the warning message every 10 minutes. Messages of this sort are normally printed on the console, though other actions may occur depending on the configuration information found in .Pn /etc/syslog.conf . .PP Finally note that you should change the names of any dialup terminals to ttyd? where ? is in [0-9a-zA-Z], as some programs use this property of the names to determine if a terminal is a dialup. Shell commands to do this should be put in the .Pn /dev/MAKEDEV.local script. .PP While it is possible to use truly arbitrary strings for terminal names, the accounting and noticeably the .Xr ps (1) command make good use of the convention that tty names (by default, and also after dialups are named as suggested above) are distinct in the last 2 characters. Change this and you may be sorry later, as the heuristic .Xr ps (1) uses based on these conventions will then break down and .Xr ps will run MUCH slower. .Sh 2 "Adding users" .PP The procedure for adding a new user is described in .Xr adduser (8). You should add accounts for the initial user community, giving each a directory and a password, and putting users who will wish to share software in the same groups. .PP Several guest accounts have been provided on the distribution system; these accounts are for people at Berkeley, Bell Laboratories, and others who have done major work on UNIX in the past. You can delete these accounts, or leave them on the system if you expect that these people would have occasion to login as guests on your system. .Sh 2 "Site tailoring" .PP All programs that require the site's name, or some similar characteristic, obtain the information through system calls or from files located in .Pn /etc . Aside from parts of the system related to the network, to tailor the system to your site you must simply select a site name, then edit the file .DS /etc/netstart .DE The first lines in .Pn /etc/netstart use a variable to set the hostname, .DS hostname=\fImysitename\fP /bin/hostname $hostname .DE to define the value returned by the .Xr gethostname (2) system call. If you are running the name server, your site name should be your fully qualified domain name. Programs such as .Xr getty (8), .Xr mail (1), .Xr wall (1), and .Xr uucp (1) use this system call so that the binary images are site independent. .PP You will also need to edit .Pn /etc/netstart to do the network interface initialization using .Xr ifconfig (8). If you are not sure how to do this, see sections 5.1, 5.2, and 5.3. If you are not running a routing daemon and have more than one Ethernet in your environment you will need to set up a default route; see section 5.4 for details. Before bringing your system up multiuser, you should ensure that the networking is properly configured. The network is started by running .Pn /etc/netstart . Once started, you should test connectivity using .Xr ping (8). You should first test connectivity to yourself, then another host on your Ethernet, and finally a host on another Ethernet. The .Xr netstat (8) program can be used to inspect and debug your routes; see section 5.4. .Sh 2 "Setting up the line printer system" .PP The line printer system consists of at least the following files and commands: .DS .TS l l. /usr/bin/lpq spooling queue examination program /usr/bin/lprm program to delete jobs from a queue /usr/bin/lpr program to enter a job in a printer queue /etc/printcap printer configuration and capability database /usr/sbin/lpd line printer daemon, scans spooling queues /usr/sbin/lpc line printer control program /etc/hosts.lpd list of host allowed to use the printers .TE .DE .PP The file .Pn /etc/printcap is a master database describing line printers directly attached to a machine and, also, printers accessible across a network. The manual page .Xr printcap (5) describes the format of this database and also shows the default values for such things as the directory in which spooling is performed. The line printer system handles multiple printers, multiple spooling queues, local and remote printers, and also printers attached via serial lines that require line initialization such as the baud rate. Raster output devices such as a Varian or Versatec, and laser printers such as an Imagen, are also supported by the line printer system. .PP Remote spooling via the network is handled with two spooling queues, one on the local machine and one on the remote machine. When a remote printer job is started with .Xr lpr , the job is queued locally and a daemon process created to oversee the transfer of the job to the remote machine. If the destination machine is unreachable, the job will remain queued until it is possible to transfer the files to the spooling queue on the remote machine. The .Xr lpq program shows the contents of spool queues on both the local and remote machines. .PP To configure your line printers, consult the printcap manual page and the accompanying document, ``4.3BSD Line Printer Spooler Manual'' (SMM:7). A call to the .Xr lpd program should be present in .Pn /etc/rc . .Sh 2 "Setting up the mail system" .PP The mail system consists of the following commands: .DS .TS l l. /usr/bin/mail UCB mail program, described in \fImail\fP\|(1) /usr/sbin/sendmail mail routing program /var/spool/mail mail spooling directory /var/spool/secretmail secure mail directory /usr/bin/xsend secure mail sender /usr/bin/xget secure mail receiver /etc/aliases mail forwarding information /usr/bin/newaliases command to rebuild binary forwarding database /usr/bin/biff mail notification enabler /usr/libexec/comsat mail notification daemon .TE .DE Mail is normally sent and received using the .Xr mail (1) command (found in .Pn /usr/bin/mail ), which provides a front-end to edit the messages sent and received, and passes the messages to .Xr sendmail (8) for routing. The routing algorithm uses knowledge of the network name syntax, aliasing and forwarding information, and network topology, as defined in the configuration file .Pn /usr/lib/sendmail.cf , to process each piece of mail. Local mail is delivered by giving it to the program .Pn /usr/libexec/mail.local that adds it to the mailboxes in the directory .Pn /var/spool/mail/ , using a locking protocol to avoid problems with simultaneous updates. After the mail is delivered, the local mail delivery daemon .Pn /usr/libexec/comsat is notified, which in turn notifies users who have issued a ``\fIbiff\fP y'' command that mail has arrived. .PP Mail queued in the directory .Pn /var/spool/mail is normally readable only by the recipient. To send mail that is secure against perusal (except by a code-breaker) you should use the secret mail facility, which encrypts the mail. .PP To set up the mail facility you should read the instructions in the file READ_ME in the directory .Pn /usr/src/usr.sbin/sendmail and then adjust the necessary configuration files. You should also set up the file .Pn /etc/aliases for your installation, creating mail groups as appropriate. For more informations see ``Sendmail Installation and Operation Guide'' (SMM:8) and ``Sendmail \- An Internetwork Mail Router'' (SMM:9). .Sh 3 "Setting up a UUCP connection" .LP The version of .Xr uucp included in \*(4B has the following features: .IP \(bu 3 support for many auto call units and dialers in addition to the DEC DN11, .IP \(bu 3 breakup of the spooling area into multiple subdirectories, .IP \(bu 3 addition of an .Pn L.cmds file to control the set of commands that may be executed by a remote site, .IP \(bu 3 enhanced ``expect-send'' sequence capabilities when logging in to a remote site, .IP \(bu 3 new commands to be used in polling sites and obtaining snap shots of .Xr uucp activity, .IP \(bu 3 additional protocols for different communication media. .LP This section gives a brief overview of .Xr uucp and points out the most important steps in its installation. .PP To connect two UNIX machines with a .Xr uucp network link using modems, one site must have an automatic call unit and the other must have a dialup port. It is better if both sites have both. .PP You should first read the paper in the UNIX System Manager's Manual: ``Uucp Implementation Description'' (SMM:14). It describes in detail the file formats and conventions, and will give you a little context. In addition, the document ``setup.tblms'', located in the directory .Pn /usr/src/usr.bin/uucp/UUAIDS , may be of use in tailoring the software to your needs. .PP The .Xr uucp support is located in three major directories: .Pn /usr/bin, .Pn /usr/lib/uucp, and .Pn /var/spool/uucp . User commands are kept in .Pn /usr/bin, operational commands in .Pn /usr/lib/uucp , and .Pn /var/spool/uucp is used as a spooling area. The commands in .Pn /usr/bin are: .DS .TS l l. /usr/bin/uucp file-copy command /usr/bin/uux remote execution command /usr/bin/uusend binary file transfer using mail /usr/bin/uuencode binary file encoder (for \fIuusend\fP) /usr/bin/uudecode binary file decoder (for \fIuusend\fP) /usr/bin/uulog scans session log files /usr/bin/uusnap gives a snap-shot of \fIuucp\fP activity /usr/bin/uupoll polls remote system until an answer is received /usr/bin/uuname prints a list of known uucp hosts /usr/bin/uuq gives information about the queue .TE .DE The important files and commands in .Pn /usr/lib/uucp are: .DS .TS l l. /usr/lib/uucp/L-devices list of dialers and hard-wired lines /usr/lib/uucp/L-dialcodes dialcode abbreviations /usr/lib/uucp/L.aliases hostname aliases /usr/lib/uucp/L.cmds commands remote sites may execute /usr/lib/uucp/L.sys systems to communicate with, how to connect, and when /usr/lib/uucp/SEQF sequence numbering control file /usr/lib/uucp/USERFILE remote site pathname access specifications /usr/lib/uucp/uucico \fIuucp\fP protocol daemon /usr/lib/uucp/uuclean cleans up garbage files in spool area /usr/lib/uucp/uuxqt \fIuucp\fP remote execution server .TE .DE while the spooling area contains the following important files and directories: .DS .TS l l. /var/spool/uucp/C. directory for command, ``C.'' files /var/spool/uucp/D. directory for data, ``D.'', files /var/spool/uucp/X. directory for command execution, ``X.'', files /var/spool/uucp/D.\fImachine\fP directory for local ``D.'' files /var/spool/uucp/D.\fImachine\fPX directory for local ``X.'' files /var/spool/uucp/TM. directory for temporary, ``TM.'', files /var/spool/uucp/LOGFILE log file of \fIuucp\fP activity /var/spool/uucp/SYSLOG log file of \fIuucp\fP file transfers .TE .DE .PP To install .Xr uucp on your system, start by selecting a site name (shorter than 14 characters). A .Xr uucp account must be created in the password file and a password set up. Then, create the appropriate spooling directories with mode 755 and owned by user .Xr uucp , group \fIdaemon\fP. .PP If you have an auto-call unit, the L.sys, L-dialcodes, and L-devices files should be created. The L.sys file should contain the phone numbers and login sequences required to establish a connection with a .Xr uucp daemon on another machine. For example, our L.sys file looks something like: .DS adiron Any ACU 1200 out0123456789- ogin-EOT-ogin uucp cbosg Never Slave 300 cbosgd Never Slave 300 chico Never Slave 1200 out2010123456 .DE The first field is the name of a site, the second shows when the machine may be called, the third field specifies how the host is connected (through an ACU, a hard-wired line, etc.), then comes the phone number to use in connecting through an auto-call unit, and finally a login sequence. The phone number may contain common abbreviations that are defined in the L-dialcodes file. The device specification should refer to devices specified in the L-devices file. Listing only ACU causes the .Xr uucp daemon, .Xr uucico , to search for any available auto-call unit in L-devices. Our L-dialcodes file is of the form: .DS ucb 2 out 9% .DE while our L-devices file is: .DS ACU cul0 unused 1200 ventel .DE Refer to the README file in the .Xr uucp source directory for more information about installation. .PP As .Xr uucp operates it creates (and removes) many small files in the directories underneath .Pn /var/spool/uucp . Sometimes files are left undeleted; these are most easily purged with the .Xr uuclean program. The log files can grow without bound unless trimmed back; .Xr uulog maintains these files. Many useful aids in maintaining your .Xr uucp installation are included in a subdirectory UUAIDS beneath .Pn /usr/src/usr.bin/uucp . Peruse this directory and read the ``setup'' instructions also located there. Index: head/share/doc/smm/01.setup/spell.ok =================================================================== --- head/share/doc/smm/01.setup/spell.ok (revision 1855) +++ head/share/doc/smm/01.setup/spell.ok (revision 1856) @@ -1,618 +1,618 @@ A1096A AA ACU AMD Automounter BA BLOCKSIZE BSD Bb Bostic Bourne Bs Bz CCI CCITT CLNP CLTP COMPAT CPU's CS80 CSRG CW Catseye Cyl DAT DECstation DESTDIR DISK's DISKTYPE DMA DN11 DV DaVinci Dk Dn Dy EBCDIC EEPROM's EINTR EISA EOT ERESTART ESIS Emulex Exabyte FDDI FIPS FPU FTAM Filesystem Filesystems GCC GENERIC.hp300 GX Gatorbox HDLC HIL HP HP's HP300 HP300s HP433 HP9000 HPBSD HPUXCOMPAT Hibler IB ICMP IDP IDs IFLNK IP IPC IPSENDREDIRECTS IPX ISA ISO ISVTX Intel Jul Karels Kerberos L.aliases L.cmds L.sys LAN LAPB LFS LH LK201 LOGFILE Leffler Luna MAKEDEV.local MB MC68040 MFS MIB MIPS MISC MMU MT02 Macklem Makefile Makefiles Maxtor McKusick NFS NIC.ARPA NPSECT NTP OHPUX OS OSI OSes Omron PCATCH PDT PMAD PMAG PMAX PMAZ POSIX POSIX.1 POSIX.2 PSD:5 PVRX Pathnames Pendry Postel README RFC RH RISC ROM RS232 RZ23 RZ55 RZ57 SCSI SEQF SIOCGIFCONF SLC SMM:1 SMM:10 SMM:13 SMM:14 SMM:2 SMM:3 SMM:4 SMM:6 SMM:7 SMM:8 SMM:9 SMTP SPARC SPARCstation SPP SRC SUNOS Sbus Solaris Standalone Std1003.1 Std1003.2 SunOS TAI TAPE's TBOOT TCP TIOCSCTTY TK50 TM TP4 TURBOchannel TVRX TZ Tcpmux Topcat Tue UCB UDP UFS ULTRIX ULTRIXCOMPAT UNIX''SMM:1 USERFILE USL UTC UUAIDS UX Ux VAX VFS VME X11R5 XX Xinu a,c,u,p a.out adaptor adaptors addrlen adiron adm aka aliases.db amd autochanger autoconf autoconfiguration autoconfigures bdes bootblock bootimage bootp bootpath bootrom bootsd bootstrapped bs bsd bsd.README btree bwtwo c.f callback cbosg cbosgd centronics cfb0 cgsix cgthree changelist chflags chico chpass cksum cleandir cleanerd clnp cltp conf conformant contrib cpio crontab crontab.local cs csh.cshrc csh.login csh.logout cshrc ct cul0 db dbopen dc7085 deadfs dev dgram dialcode dialcodes dict disk3 diskful disklabel disklabels disktab dm dm.conf dm.config dma doc endian es esis ext fd fdesc fifofs files.HOST fileservers filesystem filesystems foo frags friend.host.inet.number fsf fstab fstype ftpusers ftpwelcome fts funopen gcc -genvmunix +genkernel getcap gettytab gid gid's gids groff groupquota hangup hanoi heapsort hexdump hier host.inet.number hostmaster hosts.equiv hosts.lpd hp hp300 hpib0 inetd.conf inline inode int intr iob iso kbyte kbytes kdb kdump kerberos kerberosIV kernfs kmem krb.conf ksh ktrace kvm labelling lastlog ld.so.cache le le0 lfs lib libc libdata libedit libexec libkern libkvm libutil localhost lofs logname loopback lq lun luna68k magtape mail.local mail.rc maillog maillog.0 maillog.1 maillog.2 maillog.3 maillog.4 maillog.5 maillog.6 maillog.7 makefiles man.conf man0 manl master.passwd maxine mckusick mdec mediainit mem mergesort mfb0 mfs misc miscfs mk mkdb mkdep mkfifo mmap mnt mono motd mountd mqueue msgbuf mtree my.domain myfriend myfriend.my.domain myname myname.my.domain mysitename namelen net.inet.ip.redirect netgroup netinet netiso netmask netns netstart netx25 newdev newlfs news3400 -newvmunix +newkernel nfs nfsd nfsiod nfsstat nfssvc nodump nowait npsect nr nrmt0 nrst0 nsect nullfs nvi obj ogin ok okeeffe.CS.Berkeley.EDU olddev oldroot opr osockaddr out0123456789 out2010123456 pageable pathname pathnames pcc picasso.CS.Berkeley.EDU pid pm0 pmake pmap pmax posix printcap pt0 pty pty.c pty0 pty1 pty2 pty3 ptyp pwd.db quota.group quota.user quotas.user radixsort rc.local rct rd rd0 rdsk recno rew rf rhosts rmt0 rmt12 ro roff root.dump root.image routedflags rq rrd0d rrz?a rrz?c rsd0d rsd3a rsf rst0 rw rxx0 rz rz0 rz1c rz?a sbin sc14 sc7 scsi0 scsiformat sd sd0 sd2b sd3 sd3a sd660 secretmail securelevel securettys sendmail.cf setsid setup.tblms shar shareable sizeof skel sockaddr sparc specfs spwd.db sr src srvtab st st.st standalone std std.9600 stderr stdin stdout subr sunos sw sy sysctl sysctl.c syslog.0 syslog.1 syslog.2 syslog.3 syslog.4 syslog.5 syslog.6 syslog.7 syslog.conf tahoe tapehost tcp termios tmac tmp toor tps tput tsleep tty.c tty00 ttya ttyb ttyd ttyp ttyp0 ttytype types.h tz tz6 ucb ufs uid uid's uids uipc umap umapfs un.h unaddr.sun uname unistd.h userid username userquota usr.bin usr.sbin utmp uucp.daemon uucppublic uw vangogh.CS.Berkeley.EDU var vax ventel vfs vm -vmunix -vmunix.net -vmunix.tape +kernel +kernel.net +kernel.tape vnode vnodes vol vt100 wildcard wr wsrc wtmp xargs xbpf xcfb0 xf xp xpbf xpf xsf xx xx0 xxx your.host.inet.number yymmddhhmm zA zoneinfo Index: head/share/doc/smm/06.nfs/1.t =================================================================== --- head/share/doc/smm/06.nfs/1.t (revision 1855) +++ head/share/doc/smm/06.nfs/1.t (revision 1856) @@ -1,588 +1,588 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This document is derived from software contributed to Berkeley by .\" Rick Macklem at The University of Guelph. .\" .\" 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. .\" .\" @(#)1.t 8.1 (Berkeley) 6/8/93 .\" .sh 1 "NFS Implementation" .pp The 4.4BSD implementation of NFS and the alternate protocol nicknamed Not Quite NFS (NQNFS) are kernel resident, but make use of a few system daemons. The kernel implementation does not use an RPC library, handling the RPC request and reply messages directly in \fImbuf\fR data areas. NFS interfaces to the network using sockets via. the kernel interface available in \fIsys/kern/uipc_syscalls.c\fR as \fIsosend(), soreceive(),\fR... There are connection management routines for support of sockets for connection oriented protocols and timeout/retransmit support for datagram sockets on the client side. For connection oriented transport protocols, such as TCP/IP, there is one connection for each client to server mount point that is maintained until an umount. If the connection breaks, the client will attempt a reconnect with a new socket. The client side can operate without any daemons running, but performance will be improved by running nfsiod daemons that perform read-aheads and write-behinds. For the server side to function, the daemons portmap, mountd and nfsd must be running. The mountd daemon performs two important functions. .ip 1) Upon startup and after a hangup signal, mountd reads the exports file and pushes the export information for each local file system down into the kernel via. the mount system call. .ip 2) Mountd handles remote mount protocol (RFC1094, Appendix A) requests. .lp The nfsd master daemon forks off children that enter the kernel via. the nfssvc system call. The children normally remain kernel resident, providing a process context for the NFS RPC servers. The only exception to this is when a Kerberos [Steiner88] ticket is received and at that time the nfsd exits the kernel temporarily to verify the ticket via. the Kerberos libraries and then returns to the kernel with the results. (This only happens for Kerberos mount points as described further under Security.) Meanwhile, the master nfsd waits to accept new connections from clients using connection oriented transport protocols and passes the new sockets down into the kernel. The client side mount_nfs along with portmap and mountd are the only parts of the NFS subsystem that make any use of the Sun RPC library. .sh 1 "Mount Problems" .pp There are several problems that can be encountered at the time of an NFS mount, ranging from a unresponsive NFS server (crashed, network partitioned from client, etc.) to various interoperability problems between different NFS implementations. .pp On the server side, if the 4.4BSD NFS server will be handling any PC clients, mountd will require the \fB-n\fR option to enable non-root mount request servicing. Running of a pcnfsd\** daemon will also be necessary. .(f \** Pcnfsd is available in source form from Sun Microsystems and many anonymous ftp sites. .)f The server side requires that the daemons mountd and nfsd be running and that they be registered with portmap properly. If problems are encountered, the safest fix is to kill all the daemons and then restart them in the order portmap, mountd and nfsd. Other server side problems are normally caused by problems with the format of the exports file, which is covered under Security and in the exports man page. .pp On the client side, there are several mount options useful for dealing with server problems. In cases where a file system is not critical for system operation, the \fB-b\fR mount option may be specified so that mount_nfs will go into the background for a mount attempt on an unresponsive server. This is useful for mounts specified in \fIfstab(5)\fR, so that the system will not get hung while booting doing \fBmount -a\fR because a file server is not responsive. On the other hand, if the file system is critical to system operation, this option should not be used so that the client will wait for the server to come up before completing bootstrapping. There are also three mount options to help deal with interoperability issues with various non-BSD NFS servers. The \fB-P\fR option specifies that the NFS client use a reserved IP port number to satisfy some servers' security requirements.\** .(f \**Any security benefit of this is highly questionable and as such the BSD server does not require a client to use a reserved port number. .)f The \fB-c\fR option stops the NFS client from doing a \fIconnect\fR on the UDP socket, so that the mount works with servers that send NFS replies from port numbers other than the standard 2049.\** .(f \**The Encore Multimax is known to require this. .)f Finally, the \fB-g=\fInum\fR option sets the maximum size of the group list in the credentials passed to an NFS server in every RPC request. Although RFC1057 specifies a maximum size of 16 for the group list, some servers can't handle that many. If a user, particularly root doing a mount, keeps getting access denied from a file server, try temporarily reducing the number of groups that user is in to less than 5 by editing /etc/group. If the user can then access the file system, slowly increase the number of groups for that user until the limit is found and then peg the limit there with the \fB-g=\fInum\fR option. This implies that the server will only see the first \fInum\fR groups that the user is in, which can cause some accessibility problems. .pp For sites that have many NFS servers, amd [Pendry93] is a useful administration tool. It also reduces the number of actual NFS mount points, alleviating problems with commands such as df(1) that hang when any of the NFS servers is unreachable. .sh 1 "Dealing with Hung Servers" .pp There are several mount options available to help a client deal with being hung waiting for response from a crashed or unreachable\** server. .(f \**Due to a network partitioning or similar. .)f By default, a hard mount will continue to try to contact the server ``forever'' to complete the system call. This type of mount is appropriate when processes on the client that access files in the file system do not tolerate file I/O systems calls that return -1 with \fIerrno == EINTR\fR and/or access to the file system is critical for normal system operation. .lp There are two other alternatives: .ip 1) A soft mount (\fB-s\fR option) retries an RPC \fIn\fR times and then the corresponding system call returns -1 with errno set to EINTR. For TCP transport, the actual RPC request is not retransmitted, but the timeout intervals waiting for a reply from the server are done in the same manner as UDP for this purpose. The problem with this type of mount is that most applications do not expect an EINTR error return from file I/O system calls (since it never occurs for a local file system) and get confused by the error return from the I/O system call. The option \fB-x=\fInum\fR is used to set the RPC retry limit and if set too low, the error returns will start occurring whenever the NFS server is slow due to heavy load. Alternately, a large retry limit can result in a process hung for a long time, due to a crashed server or network partitioning. .ip 2) An interruptible mount (\fB-i\fR option) checks to see if a termination signal is pending for the process when waiting for server response and if it is, the I/O system call posts an EINTR. Normally this results in the process being terminated by the signal when returning from the system call. This feature allows you to ``^C'' out of processes that are hung due to unresponsive servers. The problem with this approach is that signals that are caught by a process are not recognized as termination signals and the process will remain hung.\** .(f \**Unfortunately, there are also some resource allocation situations in the BSD kernel where the termination signal will be ignored and the process will not terminate. .)f .sh 1 "RPC Transport Issues" .pp The NFS Version 2 protocol runs over UDP/IP transport by sending each Sun Remote Procedure Call (RFC1057) request/reply message in a single UDP datagram. Since UDP does not guarantee datagram delivery, the Remote Procedure Call (RPC) layer times out and retransmits an RPC request if no RPC reply has been received. Since this round trip timeout (RTO) value is for the entire RPC operation, including RPC message transmission to the server, queuing at the server for an nfsd, performing the RPC and sending the RPC reply message back to the client, it can be highly variable for even a moderately loaded NFS server. As a result, the RTO interval must be a conservation (large) estimate, in order to avoid extraneous RPC request retransmits.\** .(f \**At best, an extraneous RPC request retransmit increases the load on the server and at worst can result in damaged files on the server when non-idempotent RPCs are redone [Juszczak89]. .)f Also, with an 8Kbyte read/write data size (the default), the read/write reply/request will be an 8+Kbyte UDP datagram that must normally be fragmented at the IP layer for transmission.\** .(f \**6 IP fragments for an Ethernet, which has an maximum transmission unit of 1500bytes. .)f For IP fragments to be successfully reassembled into the IP datagram at the receive end, all fragments must be received within a fairly short ``time to live''. If one fragment is lost/damaged in transit, the entire RPC must be retransmitted and redone. This problem can be exaggerated by a network interface on the receiver that cannot handle the reception of back to back network packets. [Kent87a] .pp There are several tuning mount options on the client side that can prove useful when trying to alleviate performance problems related to UDP RPC transport. The options \fB-r=\fInum\fR and \fB-w=\fInum\fR specify the maximum read or write data size respectively. The size \fInum\fR should be a power of 2 (4K, 2K, 1K) and adjusted downward from the maximum of 8Kbytes whenever IP fragmentation is causing problems. The best indicator of IP fragmentation problems is a significant number of \fIfragments dropped after timeout\fR reported by the \fIip:\fR section of a \fBnetstat -s\fR command on either the client or server. Of course, if the fragments are being dropped at the server, it can be fun figuring out which client(s) are involved. The most likely candidates are clients that are not on the same local area network as the server or have network interfaces that do not receive several back to back network packets properly. .pp By default, the 4.4BSD NFS client dynamically estimates the retransmit timeout interval for the RPC and this appears to work reasonably well for many environments. However, the \fB-d\fR flag can be specified to turn off the dynamic estimation of retransmit timeout, so that the client will use a static initial timeout interval.\** .(f \**After the first retransmit timeout, the initial interval is backed off exponentially. .)f The \fB-t=\fInum\fR option can be used with \fB-d\fR to set the initial timeout interval to other than the default of 2 seconds. The best indicator that dynamic estimation should be turned off would be a significant number\** in the \fIX Replies\fR field and a .(f \**Even 0.1% of the total RPCs is probably significant. .)f large number in the \fIRetries\fR field in the \fIRpc Info:\fR section as reported by the \fBnfsstat\fR command. On the server, there would be significant numbers of \fIInprog\fR recent request cache hits in the \fIServer Cache Stats:\fR section as reported by the \fBnfsstat\fR command, when run on the server. .pp The tradeoff is that a smaller timeout interval results in a better average RPC response time, but increases the risk of extraneous retries that in turn increase server load and the possibility of damaged files on the server. It is probably best to err on the safe side and use a large (>= 2sec) fixed timeout if the dynamic retransmit timeout estimation seems to be causing problems. .pp An alternative to all this fiddling is to run NFS over TCP transport instead of UDP. Since the 4.4BSD TCP implementation provides reliable delivery with congestion control, it avoids all of the above problems. It also permits the use of read and write data sizes greater than the 8Kbyte limit for UDP transport.\** .(f \**Read/write data sizes greater than 8Kbytes will not normally improve performance unless the kernel constant MAXBSIZE is increased and the file system on the server has a block size greater than 8Kbytes. .)f NFS over TCP usually delivers comparable to significantly better performance than NFS over UDP unless the client or server processor runs at less than 5-10MIPS. For a slow processor, the extra CPU overhead of using TCP transport will become significant and TCP transport may only be useful when the client to server interconnect traverses congested gateways. The main problem with using TCP transport is that it is only supported between BSD clients and servers.\** .(f \**There are rumors of commercial NFS over TCP implementations on the horizon and these may well be worth exploring. .)f .sh 1 "Other Tuning Tricks" .pp Another mount option that may improve performance over certain network interconnects is \fB-a=\fInum\fR which sets the number of blocks that the system will attempt to read-ahead during sequential reading of a file. The default value of 1 seems to be appropriate for most situations, but a larger value might achieve better performance for some environments, such as a mount to a server across a ``high bandwidth * round trip delay'' interconnect. .pp For the adventurous, playing with the size of the buffer cache can also improve performance for some environments that use NFS heavily. Under some workloads, a buffer cache of 4-6Mbytes can result in significant performance improvements over 1-2Mbytes, both in client side system call response time and reduced server RPC load. The buffer cache size defaults to 10% of physical memory, but this can be overridden by specifying the BUFPAGES option in the machine's config file.\** .(f BUFPAGES is the number of physical machine pages allocated to the buffer cache. ie. BUFPAGES * NBPG = buffer cache size in bytes .)f When increasing the size of BUFPAGES, it is also advisable to increase the number of buffers NBUF by a corresponding amount. Note that there is a tradeoff of memory allocated to the buffer cache versus available for paging, which implies that making the buffer cache larger will increase paging rate, with possibly disastrous results. .sh 1 "Security Issues" .pp When a machine is running an NFS server it opens up a great big security hole. For ordinary NFS, the server receives client credentials in the RPC request as a user id and a list of group ids and trusts them to be authentic! The only tool available to restrict remote access to file systems with is the exports(5) file, so file systems should be exported with great care. The exports file is read by mountd upon startup and after a hangup signal is posted for it and then as much of the access specifications as possible are pushed down into the kernel for use by the nfsd(s). The trick here is that the kernel information is stored on a per local file system mount point and client host address basis and cannot refer to individual directories within the local server file system. It is best to think of the exports file as referring to the various local file systems and not just directory paths as mount points. A local file system may be exported to a specific host, all hosts that match a subnet mask or all other hosts (the world). The latter is very dangerous and should only be used for public information. It is also strongly recommended that file systems exported to ``the world'' be exported read-only. For each host or group of hosts, the file system can be exported read-only or read/write. You can also define one of three client user id to server credential mappings to help control access. Root (user id == 0) can be mapped to some default credentials while all other user ids are accepted as given. If the default credentials for user id equal zero are root, then there is essentially no remapping. Most NFS file systems are exported this way, most commonly mapping user id == 0 to the credentials for the user nobody. Since the client user id and group id list is used unchanged on the server (except for root), this also implies that the user id and group id space must be common between the client and server. (ie. user id N on the client must refer to the same user on the server) All user ids can be mapped to a default set of credentials, typically that of the user nobody. This essentially gives world access to all users on the corresponding hosts. .pp There is also a non-standard BSD \fB-kerb\fR export option that requires the client provide a KerberosIV rcmd service ticket to authenticate the user on the server. If successful, the Kerberos principal is looked up in the server's password and group databases to get a set of credentials and a map of client userid to these credentials is then cached. The use of TCP transport is strongly recommended, since the scheme depends on the TCP connection to avert replay attempts. Unfortunately, this option is only usable between BSD clients and servers since it is not compatible with other known ``kerberized'' NFS systems. To enable use of this Kerberos option, both mount_nfs on the client and nfsd on the server must be rebuilt with the -DKERBEROS option and linked to KerberosIV libraries. The file system is then exported to the client(s) with the \fB-kerb\fR option in the exports file on the server and the client mount specifies the \fB-K\fR and \fB-T\fR options. The \fB-m=\fIrealm\fR mount option may be used to specify a Kerberos Realm for the ticket (it must be the Kerberos Realm of the server) that is other than the client's local Realm. To access files in a \fB-kerb\fR mount point, the user must have a valid TGT for the server's Realm, as provided by kinit or similar. .pp As well as the standard NFS Version 2 protocol (RFC1094) implementation, BSD systems can use a variant of the protocol called Not Quite NFS (NQNFS) that supports a variety of protocol extensions. This protocol uses 64bit file offsets and sizes, an \fIaccess rpc\fR, an \fIappend\fR option on the write rpc and extended file attributes to support 4.4BSD file system functionality more fully. It also makes use of a variant of short term \fIleases\fR [Gray89] with delayed write client caching, in an effort to provide full cache consistency and better performance. This protocol is available between 4.4BSD systems only and is used when the \fB-q\fR mount option is specified. It can be used with any of the aforementioned options for NFS, such as TCP transport (\fB-T\fR) and KerberosIV authentication (\fB-K\fR). Although this protocol is experimental, it is recommended over NFS for mounts between 4.4BSD systems.\** .(f \**I would appreciate email from anyone who can provide NFS vs. NQNFS performance measurements, particularly fast clients, many clients or over an internetwork connection with a large ``bandwidth * RTT'' product. .)f .sh 1 "Monitoring NFS Activity" .pp The basic command for monitoring NFS activity on clients and servers is nfsstat. It reports cumulative statistics of various NFS activities, such as counts of the various different RPCs and cache hit rates on the client and server. Of particular interest on the server are the fields in the \fIServer Cache Stats:\fR section, which gives numbers for RPC retries received in the first three fields and total RPCs in the fourth. The first three fields should remain a very small percentage of the total. If not, it would indicate one or more clients doing retries too aggressively and the fix would be to isolate these clients, disable the dynamic RTO estimation on them and make their initial timeout interval a conservative (ie. large) value. .pp On the client side, the fields in the \fIRpc Info:\fR section are of particular interest, as they give an overall picture of NFS activity. The \fITimedOut\fR field is the number of I/O system calls that returned -1 for ``soft'' mounts and can be reduced by increasing the retry limit or changing the mount type to ``intr'' or ``hard''. The \fIInvalid\fR field is a count of trashed RPC replies that are received and should remain zero.\** .(f \**Some NFS implementations run with UDP checksums disabled, so garbage RPC messages can be received. .)f The \fIX Replies\fR field counts the number of repeated RPC replies received from the server and is a clear indication of a too aggressive RTO estimate. Unfortunately, a good NFS server implementation will use a ``recent request cache'' [Juszczak89] that will suppress the extraneous replies. A large value for \fIRetries\fR indicates a problem, but it could be any of: .ip \(bu a too aggressive RTO estimate .ip \(bu an overloaded NFS server .ip \(bu IP fragments being dropped (gateway, client or server) .lp and requires further investigation. The \fIRequests\fR field is the total count of RPCs done on all servers. .pp The \fBnetstat -s\fR comes in useful during investigation of RPC transport problems. The field \fIfragments dropped after timeout\fR in the \fIip:\fR section indicates IP fragments are being lost and a significant number of these occurring indicates that the use of TCP transport or a smaller read/write data size is in order. A significant number of \fIbad checksums\fR reported in the \fIudp:\fR section would suggest network problems of a more generic sort. (cabling, transceiver or network hardware interface problems or similar) .pp There is a RPC activity logging facility for both the client and server side in the kernel. When logging is enabled by setting the kernel variable nfsrtton to one, the logs in the kernel structures nfsrtt (for the client side) and nfsdrt (for the server side) are updated upon the completion of each RPC in a circular manner. The pos element of the structure is the index of the next element of the log array to be updated. In other words, elements of the log array from \fIlog\fR[pos] to \fIlog\fR[pos - 1] are in chronological order. The include file should be consulted for details on the fields in the two log structures.\** .(f \**Unfortunately, a monitoring tool that uses these logs is still in the planning (dreaming) stage. .)f .sh 1 "Diskless Client Support" .pp The NFS client does include kernel support for diskless/dataless operation where the root file system and optionally the swap area is remote NFS mounted. A diskless/dataless client is configured using a version of the -``swapvmunix.c'' file as provided in the directory \fIcontrib/diskless.nfs\fR. +``swapkernel.c'' file as provided in the directory \fIcontrib/diskless.nfs\fR. If the swap device == NODEV, it specifies an NFS mounted swap area and should be configured the same size as set up by diskless_setup when run on the server. This file must be put in the \fIsys/compile/\fR kernel build directory after the config command has been run, since config does not know about specifying NFS root and swap areas. The kernel variable mountroot must be set to nfs_mountroot instead of ffs_mountroot and the kernel structure nfs_diskless must be filled in properly. There are some primitive system administration tools in the \fIcontrib/diskless.nfs\fR directory to assist in filling in the nfs_diskless structure and in setting up an NFS server for diskless/dataless clients. The tools were designed to provide a bare bones capability, to allow maximum flexibility when setting up different servers. .lp The tools are as follows: .ip \(bu -diskless_offset.c - This little program reads a ``vmunix'' object file and +diskless_offset.c - This little program reads a ``kernel'' object file and writes the file byte offset of the nfs_diskless structure in it to standard out. It was kept separate because it sometimes has to be compiled/linked in funny ways depending on the client architecture. (See the comment at the beginning of it.) .ip \(bu diskless_setup.c - This program is run on the server and sets up files for a given client. It mostly just fills in an nfs_diskless structure and -writes it out to either the "vmunix" file or a separate file called +writes it out to either the "kernel" file or a separate file called /var/diskless/setup. .ip \(bu diskless_boot.c - There are two functions in here that may be used -by a bootstrap server such as tftpd to permit sharing of the ``vmunix'' +by a bootstrap server such as tftpd to permit sharing of the ``kernel'' object file for similar clients. This saves disk space on the bootstrap server and simplify organization, but are not critical for correct operation. -They read the ``vmunix'' +They read the ``kernel'' file, but optionally fill in the nfs_diskless structure from a separate "setup." file so that there is only -one copy of "vmunix" for all similar (same arch etc.) clients. +one copy of "kernel" for all similar (same arch etc.) clients. These functions use a text file called /var/diskless/boot. to control the netboot. .lp The basic setup steps are: .ip \(bu -make a "vmunix" for the client(s) with mountroot() == nfs_mountroot() +make a "kernel" for the client(s) with mountroot() == nfs_mountroot() and swdevt[0].sw_dev == NODEV if it is to do nfs swapping as well -(See the same swapvmunix.c file) +(See the same swapkernel.c file) .ip \(bu -run diskless_offset on the vmunix file to find out the byte offset +run diskless_offset on the kernel file to find out the byte offset of the nfs_diskless structure .ip \(bu Run diskless_setup on the server to set up the server and fill in the nfs_diskless structure for that client. The nfs_diskless structure can either be written into the -vmunix file (the -x option) or +kernel file (the -x option) or saved in /var/diskless/setup.. .ip \(bu Set up the bootstrap server. If the nfs_diskless structure was written into -the ``vmunix'' file, any vanilla bootstrap protocol such as bootp/tftp can +the ``kernel'' file, any vanilla bootstrap protocol such as bootp/tftp can be used. If the bootstrap server has been modified to use the functions in diskless_boot.c, then a file called /var/diskless/boot. must be created. It is simply a two line text file, where the first line is the pathname -of the correct ``vmunix'' file and the second line has the pathname of +of the correct ``kernel'' file and the second line has the pathname of the nfs_diskless structure file and its byte offset in it. For example: .br - /var/diskless/vmunix.pmax + /var/diskless/kernel.pmax .br /var/diskless/setup.rickers.cis.uoguelph.ca 642308 .br .ip \(bu Create a /var subtree for each client in an appropriate place on the server, such as /var/diskless/var//... By using the to differentiate /var for each host, /etc/rc can be modified to mount the correct /var from the server. Index: head/share/man/man7/hier.7 =================================================================== --- head/share/man/man7/hier.7 (revision 1855) +++ head/share/man/man7/hier.7 (revision 1856) @@ -1,389 +1,389 @@ .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" .Dd June 5, 1993 .Dt HIER 7 .Os .Sh NAME .Nm hier .Nd layout of filesystems .Sh DESCRIPTION A sketch of the filesystem hierarchy. .Bl -tag -width "/stand/" .It Li / root directory of the filesystem .It Li /bin/ user utilities fundamental to both single-user and multi-user environments .It Li /dev/ block and character device files .Pp .Bl -tag -width MAKEDEV -compact .It Li MAKEDEV script for creating device files; see .Xr makedev 8 .It Li fd/ file descriptor files; see .Xr \&fd 4 .El .It Li /etc/ system configuration files and scripts .Pp .Bl -tag -width "disklabels/" -compact .It Li localtime local timezone information; see .Xr ctime 3 .It Li disklabels/ backup disklabels; see .Xr disklabel 8 .It Li kerberosIV/ configuration files for the kerberos version IV; see .Xr kerberos 1 .It Li mtree/ mtree configuration files; see .Xr mtree 1 .It Li namedb/ named configuration files; see .Xr named 8 .El .It Li /mnt/ empty directory commonly used by system administrators as a temporary mount point .It Li /sbin/ system programs and administration utilities fundamental to both single-user and multi-user environments .It Li /stand/ programs used in a standalone environment .It Li /tmp/ temporary files, usually a .Xr mfs 8 memory-based filesystem (the contents of /tmp are usually NOT preserved across a system reboot) .It Li /usr/ contains the majority of user utilities and applications .Pp .Bl -tag -width "libdata/" -compact .It Li bin/ common utilities, programming tools, and applications .It Li contrib/ large packages contributed to Berkeley by outside parties .It Li games/ useful and semi-frivolous programs .It Li include/ standard C include files .Pp .Bl -tag -width "kerberosIV/" -compact .It Li X11/ C include files for X11 window system .It Li arpa/ C include files for Internet service protocols .It Li kerberosIV/ C include files for kerberos authentication package; see .Xr kerberos 1 .It Li machine/ machine specific C include files .It Li net/ misc network C include files .It Li netimp/ C include files for IMP protocols; see .Xr imp 4 .It Li netinet/ C include files for Internet standard protocols; see .Xr inet 4 .It Li netiso/ C include files for ISO standard protocols; see .Xr iso 4 .It Li netns/ C include files for XNS standard protocols; see .Xr \&ns 4 .It Li nfs/ C include files for NFS (Network File System) .It Li pascal/ include files for pc 1 .It Li protocols/ C include files for Berkeley service protocols .It Li sys/ system C include files (kernel data structures) .It Li ufs/ C include files for UFS (The U-word File System) .El .Pp .It Li lib/ archive libraries .Pp .Bl -tag -width Fl -compact .It Li uucp/ UUCP configuration files (historically placed; to be moved) .El .It Li libdata/ misc. utility data files .It Li libexec/ system daemons & system utilities (executed by other programs) .It Li local/ local executables, libraries, etc. .It Li obj/ architecture-specific target tree produced by building the /usr/src tree .It Li old/ programs from past lives of BSD which may disappear in future releases .It Li sbin/ system daemons & system utilities (executed by users) .It Li share/ architecture-independent ascii text files .Pp .Bl -tag -width "calendar/" -compact .It Li calendar/ a variety of pre-fab calendar files; see .Xr calendar 1 .It Li dict/ word lists; see .Xr look 1 .Pp .Bl -tag -width Fl -compact .It Li words common words .It Li web2 words from Webster's 2nd International .It Li papers/ reference databases; see .Xr refer 1 .It Li special/ custom word lists; see .Xr spell 1 .El .Pp .It Li doc/ misc documentation; src for most of the printed .Bx BSD manuals (available from the .Tn USENIX association) .It Li games/ ascii text files used by various games .It Li man/ manual pages .It Li me/ macros for use with the me macro package .It Li misc/ misc system-wide ascii text files .Bl -tag -width Fl -compact .It Li termcap terminal characteristics database; see .Xr termcap 5 .El .It Li mk/ templates for make; see .Xr make 1 .It Li ms/ macros for use with the ms macro package .It Li skel/ example . (dot) files for new accounts .It Li tabset/ tab description files for a variety of terminals; used in the termcap file; see .Xr termcap 5 .It Li tmac/ text processing macros; see .Xr nroff 1 and .Xr troff 1 .It Li zoneinfo/ timezone configuration information; see .Xr tzfile 5 .El .Pp .It Li src/ BSD and/or local source files .Pp .Bl -tag -width "kerberosIV/" -compact .It Li bin/ src for files in /bin .It Li contrib/ src for files in /usr/contrib .It Li etc/ src for files in /etc .It Li games/ src for files in /usr/games .It Li include/ src for files in /usr/include .It Li kerberosIV/ src for kerberos version IV .It Li lib/ src for files in /usr/lib .It Li libexec/ src for files in /usr/libexec .It Li local/ src for files in /usr/local .It Li old/ src for files in /usr/old .It Li pgrm/ src for programming tools in /usr/bin .It Li sbin/ src for files in /sbin .It Li share/ src for files in /usr/share .It Li sys/ kernel src files .It Li usr.bin/ src for files in /usr/bin .It Li usr.sbin/ src for files in /usr/sbin .El .El .It Li /var/ multi-purpose log, temporary, transient, and spool files .Pp .Bl -tag -width "preserve/" -compact .It Li account/ system accounting files .Pp .Bl -tag -width Fl -compact .It Li acct execution accounting file; see .Xr acct 5 .El .Pp .It Li at/ timed command scheduling files; see .Xr \&at 1 .It Li backups/ misc. backup files .It Li db/ misc. automatically generated system-specific database files .It Li games/ misc. game status and log files .It Li log/ misc. system log files .Pp .Bl -tag -width Fl -compact .It Li wtmp login/logout log; see .Xr wtmp 5 .El .Pp .It Li mail/ user mailbox files .It Li preserve/ temporary home of files preserved after an accidental death of an editor; see .Xr \&ex 1 .It Li quotas/ filesystem quota information files .It Li run/ system information files describing various info about system since it was booted .Pp .Bl -tag -width Fl -compact .It Li utmp database of current users; see .Xr utmp 5 .El .Pp .It Li rwho/ rwho data files; see .Xr rwhod 8 , .Xr rwho 1 , and .Xr ruptime 1 .It Li spool/ misc. printer and mail system spooling directories .Pp .Bl -tag -width Fl -compact .It Li ftp/ commonly ~ftp; the anonymous ftp root directory .It Li mqueue/ undelivered mail queue; see .Xr sendmail 8 .It Li output/ line printer spooling directories .It Li secretmail/ secretmail spool directory; see .Xr xget 1 .It Li uucp/ uucp spool directory .It Li uucppublic/ commonly ~uucp; public uucp temporary directory .El .Pp .It Li tmp/ temporary files that are kept between system reboots .El -.It Li /vmunix +.It Li /kernel pure kernel executable (the operating system loaded into memory at boot time). .El .Sh SEE ALSO .Xr \&ls 1 , .Xr apropos 1 , .Xr whatis 1 , .Xr whereis 1 , .Xr finger 1 , .Xr which 1 , .Xr find 1 , .Xr grep 1 , .Xr fsck 8 .Sh HISTORY A .Nm hier manual page appeared in .At v7 . Index: head/share/man/tools/newsp.errs =================================================================== --- head/share/man/tools/newsp.errs (revision 1855) +++ head/share/man/tools/newsp.errs (revision 1856) @@ -1,4572 +1,4572 @@ Fri Jul 29 00:07:08 PDT 1983 cat <<'EOF' >---------------- Section 1 1ic 4.2bsd ACSII ADDBIB ADDR ANOM AP ARGSUSED ARPANET ATD Aahimnrs Addbib Afile Aho Allman Arg Asa BFatuwvx BIFF BS.ES BSS Babaoglu Backslashes Backus Bedminster Berkman Berknet Bernardsville Bfile Biff Bizcomp Bourne Branchburg Breedlove CFLAGS CK CONT CPU CRT's CRTERASE CRTKILL CTRL Cbs Cfoo Changequote Colin Corfil Cory Cpu DASI DB DBX DEC's DECtape DVI Dbx Delimeters Diablo Dstring EBCDIC EECS EOF ESC FFLAGS FILENAME FP FPR FSPLIT FTP Ferrin File1 Filename Foderaro Fortran77 Fp Fpr Fsplit Ftp GCORE GID GPROF GSI GT Gallager Gcore HOSTID HOSTNAME HUP Hazeltine Hertzfeld Hostnames Hyterm I.E.E.E IDs IM Ignoreeof Ind Indxbib Katseff Kernighan Keypad Kleckner Kulp L6i LCK LE LFLAGS LIM LINTLIBRARY LOGFILE LR LT Larus Laxenburg Lesk Levinsky Llopart MACLISP MFLAGS MOS MT Mail.help Mail.rc Makefile McKusick Mt N.B NETSTAT NEWALIASES NNN NOSTRICT NOTREACHED NUL Newaliases Newline Newlines Niklaus Nohup Nowitz O1i OED OFMT OFS Objfil Orderlist Ossanna Ozalp PAGEIN PAGESIZE PDP PDX PFLAGS PID PMERGE PPID PRI Pagesize Pathname Pdx Pelegri Plauger Pmerge Pos1 Pprinter Pre Presotto Procs RCP RCS RCVD RLOGIN RMAIL ROFFBIB RSH RSS RUBOUT RUPTIME RWHO RWNA Racal Rankine Rcp Reiser Retargetted Rlogin Rmail Roffbib Romberger Rowan Rsh Rubout Runtime Ruptime SANOM SBM SCCS SDETACH SDLYU SENDBUG SEQL SIG SIGALRM SIGCHILD SIGCONT SIGINT SIGKILL SIGPLAN SIGQUIT SIGTERM SIGTINT SKEEP SL SLOAD SLOCK SNOVM SORTBIB SOUSIG SPAGE SPAGI SPHYSIO SSIZ SSWAP SSYS STIMO STRC SUANOM SULOCK SVFDONE SVFORK SWEXIT SWTED SYMDEF SYSLINE Schriebman Sendbug Shenaut Shienbrood Shoens Sklower Sname Sortbib Spellin Spellout Stangenberger Studsworth Substitition Symbolfile TELNET TENEX TRS TSIZ TW TalkDaemon Televideo Televideos Telnet Temp TermiNet Tuthill Twp UCB UCI UID UNX Uudecode VARARGS VAX VLP VMS VWIDTH Vadic Ventel Versatec Vfontedpr Vlp Vol Vwidth WCHAN Wasley Wirth XXXXX YFLAGS ZZ a.out aN aa abchnpuvx abcissas abe abi acdefjnstuw acdfgilqrstu1ACLFR acegklstuvwx ack acu addbib addr ade adm3a afile allboxed alloc alt analyis annoation arg arg1 arg1,arg2 arg2 argc argn args argv arpanet arpanet:dm2500 arpanet:type ascii,lcase askcc atime atm atrun autoindent autoprint avm ba backslash backslashes backtrace bar.c baudrate bcdehDilmpqrsj bdf beginproc belgiumfranc betwee bfx bg biblio biff bio.c bl blah blkdtaNNN.f blnpstuwz bocklin bocklin.14 bool bpi br breaksw brgallon britainpound bs0 bs1 bsf bsr buf bugformat bx cat.c cbreak cbs cccc ccol ccom cdflsu cdpath cds cef cefh ceiknrstuvx centimeters centre changequote checkeq chmach cifplot cleardot cleartext cmd cnnn colour comsat concept100 cond cont coredump coredumpsize corfil cpile cpu cputime cr0 cr1 cr2 cr3 crmod crt crt's crt0.o crtbs crterase crtkill cryptosystem csh's cshrc csw ctlecho ctm cu'd cwd cypher dB daemon daemon's daemons dan datasize dbx dead.letter dec decctlq december def delim dequeue deriv dialog dialtimeout dialup dialup:concept100 dialup:dw2 dialup:h19 dialup:type dialups dict diction,explain dir1 dir2 ditroff divnum dj dmr dnl dnnn doc doc,man doc.n doit dotdot dp drqtpmx ds dsa dsusp dumpdef dw2 e.g ebcdic echocheck edhup effectors efil efile efilname eign ek eknptuvx elif emacs endcol endif endnotes endsw eof eofr eofread eofw eofwrite eol eq errorrc errprint es esac etx etxack eval ex3 ex?.?preserve ex?.?recover ex?.?strings expr2 exrc ext exta extb extern exum2.n exum?.n fFresc fasl'ed ff0 ff1 fg fhlpq fi fi.diff file.C file.c file.i file.o file.p filenames filesize fillin flags&onum flusho fo fontfile fontinfo fontname foo foo.c foo.l foreach formatted formatter formfeed formfeeds fp fpr fpr.tbl fr framesize franz fre from';echo fromdir fsf fsplit fsr fstab ft ftp func ga gcore gcos gcrt0.o ge gethostid gethostname getpagesize getwd gfont gmon.out gmon.sum gname gnopru goto goto's gotos gprof graphy grok gsize gt hangup hangups hardcopy hardwired hashstat hh hhhh hhmm histchars hlist hlista hookey host.port host.user host:user hostid hostname hosts.equiv hstop huckfinn hushlogin i.e ia ib ibase ibm ibs ic ident identifer ier ifdef ifdefs ifelse iff ig ignoreeof ignorefile ignorelevel incl incr indent.pro index'th indxbib inet inf inline inodes inr inrt instvVxX intr intrup intuit intuited inum inv ise jan jkf joe keypad kridle l.m lastlog lasttimedone lbc lc lc.ln lcase lcd lcol lcsh le len lex.yy.c lexcommands lfoo.ln lg lhost lib,bin,ucb,old,new,local lib.b libF77 libF77.a libI77 libI77.a libU77 libU77.a libc.a libm.a libpc.a lightyear lim linefeed linenumber lispfile liszt.1 litout llib lnext localfile loginname logout lpc lpile ls.c lsh lstat lt lwc lxref.1,v lyx m,n mac machacks.l magtapes mailaddr mailrc mainNNN.f majorfont makefile makefiles maketemp man1 matchop mbox mcleanup mcount mcrt0.o mdelete mdir mdmbuf mds messagefile meta metoo mget mic michael minorfont mkey ml mls mm:ss mon.out mon.sum more.c more.help morefiles motd mpqruwxCQST mput msgsrc mt mtime mtio mtu mubdf mubdfinrt mumble.p mumble.p:17 mutliple myhlist n1,n2 n3,n4 na name.c name.f name.i name.o name.p name.pointsize name.size name1 name2 namelist nameofhost nbc nbytes ndj netrc netstat network.port new.p newaliases newcrt newline newlines newps nexti nl nl0 nl1 nl2 nl3 nlambda nnn nnnnn noclobber noecho noerror noerror,sync noglob nohang nohup'ed nohup.out nologin nonie nonomatch nosave nr numcols nv obase obj objfil objfile obs occom ocpp offline ok old.p oldcsh oldls,ls oldls.c oldps oldwrite.c onetrip onintr onum oo oops op orderlist otherhost otherremotefile ozalp pagesize parens pascal pathnames paul paula pdx pdxinit pendin perm pfile pg pgm photoypesetter pid pistrings pla10 playpen pltndgvcfrmhs plugboard plugboard:?adm3a plugboard:type pmerge pmon.out pointsize popd port.ln pos1 pos2 posname pr's pre preceed preceeded pred1 pred2 pred3 prev printcap proc.h processid prog prog.f promptfile proto prterase ptmp pushd pushdown pwba qxscn ra railmag raisechar rc.local rcol rcp rd readit readlink readonly readtable rec recipt recv refcnt reformatted remotefile remotehelp repeat...until resp rewoffl rfile rhost rhost.rname rhost:path rhosts rlogin rlogind rmail rmt rmt0 rmt12 rmt8 rname roffbib roman rp0a rpile rprnt ruptime rwho rwhod s1s2 sA savehist sbm sc screenful screenfuls sd se secretmail securetty sendbug sendmail sendport setdot setenv setgroups sethostid sethostname setitimer setpriority setrlimit sfile shutdownlog sidebyside sig signal.h sigvec sinclude sn somefile sortbib sourcefile sourceing sp spb spellhist spellin spellout spf src ss stacksize standardise standout startcol stepi stm stopi str str1 string1 string2 su'd substr suffixlist supresses susp switch:?vt100 sym symbolfile symdef symlink symref sys1 sys2 syscall.l syscmd sysline sysline.1 syslinelock tHouseholds tNumber tSize ta tab0 tab1 tab1,tab2,...,tabn tab2 tab3 tabexpand tabstop tabstops tapename tco td0 tek telnet tenex terminfo tex th thier ti700 tip.record tiprc title1 title2 tmac tmac.bib tmac.s tmac.vcat tmac.vgrind tn300 todir toplevel.l toplines tostop tracct trace.l traceback tracei tranmission transfered translit travelled troff'ed trpt tty0 tty3 tty33 tty37 ttyd0 tvfn typeahead typedefs typename ua ucase ucb ucbcory ucifnc.l udc ugo um undef unsetenv usd username usg uudecode uuencode,uudecode vE vS var vcat vd vec ver versatec's vfontedpr vgrindefs vh vide vk vlp vlpmacs vmcore -vmunix +kernel vol vpd vpf vplot vrast vs vsort vt05 vuaibclo vwidth weof werase wfile wg whod wildcard wildcards windowfuls wline wordlist wrapmargin wri write.c x.c x1.x2.x3 x1.y1.x2.y2 xit xn xn.yn xs.c xs.o xx xxx xy y.output y.tab.c y.tab.h yacc.acts yacc.tmp yaccpar yourname yoursystem yourttyname yy yy.ddd.hhhh yyerror yylex yymmddhhmm yyparse yytext zzzNNN.f cat <<'EOF' >---------------- Section 2 ARG ASKNAME AUTOBOOT Addr Arg Bpt Buf CHROOT CPU Chme Chms Chmu Chroot Cmd DARPA DECOVF DFL DGRAM DONTLINGER DONTROUTE DOWARN DUPFD Dirname E2BIG EACCESS EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EALREADY ECONNABORTED ECONNREFUSED ECONNRESET EDESTADDRREQ EINPROGRESS EISCONN ELOOP EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENOBUFS ENOPROTOOPT ENOTCONN ENOTEMPTY ENOTSOCK EOPNOSUPPORT EOPNOTSUPP EPFNOSUPPORT EPROTONOSUPPORT EPROTOTYPE ESHUTDOWN ESOCKTNOSUPPORT ETIMEDOUT EUSERS EWOULDBLOCK EXCL Envp FASYNC FCNTL FILENAME FLTDIV FLTOVF FLTUND FPE FSIZE FSYNC Fchmod Fchown Fcntl Fd Febuary Fromlen Fstat Fsync Ftruncate GETDLIM GETDTABLESIZE GETFD GETFL GETGID GETGROUPS GETHOSTID GETHOSTNAME GETITIMER GETOWN GETPAGESIZE GETPEERNAME GETPRIORITY GETRLIMIT GETRUSAGE GETSOCKNAME GETSOCKOPT GETTIMEOFDAY Getgid Getgroups Gethostid Gethostname Getpagesize Getpeername Getppid Getpriority Getrusage Getsockname Getsockopt Gettimeofday Howto ID's IDs IEXEC IFBLK IFCHR IFDIR IFLNK IFMT IFREG IFSOCK IGN IMPLINK INCR INET INTDIV INTOVF IREAD ISGID ISUID ISVTX ITIMER IWRITE Iovcnt KEEPALIVE Lstat MSG NDELAY NGRPS NODEV Name1 Name2 OOB Oldd Optname PATHNAME PGRP PKTSTREAM PRIO PRIVIN PROC PSL Prio RDM RDONLY RDWR READLINK RECV REUSEADDR RLIMIT RSS RUSAGE Readlink Readv Recv SEQPACKET SETDLIM SETDUSE SETFD SETFL SETGROUPS SETOWN SETQUOTA SETREGID SETREUID SETWARN SIG SIGALRM SIGBLOCK SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINT SIGIO SIGIOT SIGKILL SIGPAUSE SIGPIPE SIGPROF SIGQUIT SIGSEGV SIGSETMASK SIGSTACK SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGVEC SIGVTALRM SIGXCPU SIGXFSZ SOCKETPAIR SOF SUBRNG SYMLINK SYSCALL Sbrk Scp Setgroups Sethostid Sethostname Setquota Setsockopt Sig Sigblock Sigmask Sigpause Sigsetmask Sigstack Sigvec Syscall TCP TIOCGPGRP TIOCSPGRP TRUNC Timerclear Tvp UDP UID Umount Unpriviledged VAX WNOHANG WRONLY WUNTRACED Writev XTND a.out accrights accrightslen addr addrlen af arg argc argp argv atime blksize blocksize bootstrapped buf bufsiz cacheing caddr checkquota cmd cpu daemon datagram datagrams dialup dqblk dqusage dqwarn ds dst dsttime dup2 egid envp errno.h euid exec'd execptfds facilitity fchmod fchown fcntl.h fd file.h foo fromlen fsync ftruncate getdtablesize getgroup getgroups gethostid gethostname getitimer getpagesize getpeername getpriority getprotoent getrlimit getrusage getsockname getsockopt gettimeofday gidset gprof hangup hostid howto idrss inblock incr ing initgroups initilized ino inode's instr ioctl.h iov iovcnt iovec ioveclen iovlen ipc isrss itimerval ixrss keepalives len lstat majflt max maxrss messags minflt minuteswest msg msghdr msglen msgrcv msgsnd mtime name1 name2 namelen nbytes nds newd nfds ngroups nivcsw nlink ns nsignals nswap numask nvcsw occurance occured occurence oldd onstack ops optlen optname optval oss oublock oumask ovalue ovec pagesize param.h pathnames pc's pdp pgrp pid pos ppid prgp prio priviledged psl quota.h quotacheck quotaon rdev readfds readlink readv reboot.h recv recvfrom recvmsg res resource.h resp rgid rlim rlimit rlp ru ruid rusage rwflag scp sendmsg sendto setgroups sethostid sethostname setitimer setpriority setquota setregid setreuid setrlimit setsockopt settimeofday sig sigblock sigcontext sigmask signal.h signalling sigpause sigsetmask sigstack sigvec sockaddr socket.h socketpair someway sp spare1 spare2 spare3 spare4 ss st stat.h sv symlink th time.h timercmp timerisset timeval timezone tolen tvp types.h tzp uio.h usec vec -vmunix +kernel wait.h writefds writen writev zero'd cat <<'EOF' >---------------- Section 3 Acos Alloca Alphasort Arg Argv Asctime Asin Atan Atan2 Atoi BSD BSTRING BUFSIZ BYTEORDER Bcmp Bcopy Bp Bpt Bzero CBREAK CPU CallingHost Calloc Chme Chms Chmu Closedir Closelog Closepl Clrerr Compar DARPA DASI DECOVF DFL DISKTAB DNDEBUG Dptr Dtime EMOD EOF ETIME Endfsent Endgrent Endhostent Endnetent Endprotoent Endservent Envp Etext FDATE FLMIN FLTDIV FLTOVF FLTUND FORT01 FORT12 FPE FSIZE Fabs Fcvt Fdate Feof Fflush Ffs Fgetc Fgets Fileno Firstkey Fpecnt Fprintf Fputc Fputs Fscanf Ftell Fwrite GETCWD GETDISKBYNAME GETFSENT GETHOSTENT GETLOG GETNETENT GETPROTOENT GETSERVENT GETWD GSI Gcvt Gerror Getchar Getdiskbyname Getfsent Getfsspec Getfstype Gethostbyname Gethostent Getlog Getnetbyname Getnetent Getprotobyname Getprotoent Getpwuid Getservbyname Getservent Getw Getwd Gtty HOSTNM HPIB IDATE IGN INET INFO INITGROUPS INSQUE INTDIV INTOVF IOINIT Iargc Idate Ierrno Initgroups Initstate Insque Ioinit Irand Isascii Isatty Itime LIB2648 LIM LOC Ldexp Lib2648 Lnblnk Localtime Lowpc Lshift Ltime MAXPATHLEN MAXRSS MAXUINT Modf Moncontrol Monstartup Msg NCARGS NN NORAISE NSIG Name1 Name2 Nbytes Noone OOPS Opendir Openlog Openpl PDP PDP11 PDP11's PID PRIVIN PSIGNAL PSL Pclose Pid Psignal Putchar Putw RCMD REXEC Rcmd Readdir Realloc Rewinddir Rexec Rresvport Rshift Rtnval Ruserok SALERT SCANDIR SCCS SIG SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGVTALRM SIGXCPU SIGXFSZ SUBRNG Scandir Scp Seekdir Sep Setbuffer Seteuid Setfsent Sethostent Setlinebuf Setnetent Setprotoent Setruid Setservent Setstate Sig Signum Sprintf Sqrt Sscanf Strcat Strcmp Strcpy Strlen Strncat Strncmp Strncpy Symlnk Syslog TIOCGETP TIOCSETP TOPEN TRAPER TRAPOV TRPFPE TTYNAM Tclose Telldir Tgetent Tgetflag Tgetnum Tgetstr Tgoto Timezone Tlu Topen Tputs Trewin Trpfpe Tskipf Ttynam Ttyslot Twrite VARARGS VAX Vax Vfree Vm Wasley XTABS a.out abort.3 abort.3f abs.3 access.3f accessability addch addr addrtype addstr affcnt agoto ahost alarm.3c alarm.3f alloca alphasort aoff aon apnd areaclear arg arg0 arg1 argc argn argno args argv arithmatic arpa assert.3x assert.h atof.3 basec basegid bcmp bcopy besj0 besj1 besjn bessel.3f besy0 besy1 besyn bit.3f bitcopy bitmap bitmat bp bsize bstring.3 buf bufsize byteorder.3n bzero bzro caching cbreak cctl ch chdir.3f chmod.3f cleara clearerr clearg clearok closedir closelog closepl clrtobot clrtoeol cm cmax cmd cmin comp compar compatibilty congruential cont cpu crmode crypt.3 cstime ctime.3 ctype.3 ctype.h curoff curon curses.3x cutime daemons dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn dbm.3x dbminit dcl ddd ddd.ddd decpt delch deleteln delwin dest destcol destline devnam dffrac dflmax dflmin dir.h directory.3 dirp disect disktab disktab.h dispmsg doprnt dox dptr drand drawbox ds dsize dst dstflag dtime dumpmat ecvt.3 edflag egid elem emptyrow ename end.3 endfsent endhostent endnetent endprotoent endservent endwin envp eoff eotf eptr errf errlist etime etime.3f euid evalue exec'ed exece execl.3 exect exit.3 exit.3f exp.3m extern fclose.3s fd fd2p fdate fdate.3f ferror.3s ffrac ffs file.c filedes firstkey flmax flmin flmin.3f floor.3m flush.3f fmt,arg1,arg2 fork.3f formatted formfeed fortran forw fpecnt fpeflt fperr frag fread.3s freq frexp.3 fseek.3f fseek.3s fsize fstab fstab.h ftime func funtions gamma.3m gcvt gdefault gerror getarg.3f getc.3f getc.3s getcap getch getcwd getcwd.3f getdisk.3x getdiskbyname getenv.3 getenv.3f getfsent getfsent.3x getfsfile getfsspec getfstype getgrent.3 gethost gethostbyaddr gethostbyname gethostent gethostent.3n gethostname getlog getlog.3f getlogin.3 getnet getnetbyaddr getnetbyname getnetent getnetent.3n getpass.3 getpid.3f getproto getprotobyname getprotobynumber getprotoent getprotoent.3n getpw.3 getpw.3c getpwent.3 getrlimit getrusage gets.3s getserv getservbyname getservbyport getservent getservent.3n getstr gettimeofday gettmode getuid.3f getwd getwd.3 getyx goff gon goto gprof grp.h hangup highpc host.equiv hostent hostlong hostnm hostnm.3f hosts.equiv hostshort htonl htons hypot.3m iargc iarray ibzr ictl idate idate.3f ident idrss idsrss ieof ierrno iflag imediately in.h inblk incr index.3f inet inet.3n inet.h initgroups initgroups.3x initscr initstate inmax inport insch insertln insque insque.3 instantiations instr int2 int4 intro.3f intro.3s ioiflg ioinit ioinit.3f iptr irand irregardless isdst isize itime ixrss key.dptr keypad kill.3f koff kon l300s labelled lasty,lastx,newy,newx lcurses ldbm leaveok len lib2648 lib2648.3x lib2648.a libF77.a libI66.a libI77.a libU77.a libc.a libcurses.a libdbm.a libm.a libplot.a libtermcap.a linemod lines,cols,begin link.3f lna lnaof lnblnk loc loc.3f log10 logstat long.3f longname longword lowleft lowpc lplot lshift lstat ltermcap ltime lunit luser majflt makeaddr malloc.3 math.h maxlen maxrss mday millitm min minflt minmax mktemp.3 mnew mon mon.out moncontrol monitor.3 monstartup movecurs msg mvcur mydata myprogram myresults name1 name2 namelist namlen nbits nbytes ncylinders ndigit ndigits nel nelem nerr net.host netdb.h netent netinet netlong netof netrc netshort newline newlines newmat newwin nextkey nfiles nfunc nice.3c nitems nl nlist.3 nlist.h nocrmode noecho nonl noraise noraw nptr nrecs nsectors nswap ntoa ntohl ntohs ntracks numesg occured occurences opcodes open''ed opendir openlog openpl ospeed oublk outc outstr pag param.h passno pause.3c perror.3 perror.3f pg pid plot.3x popen.3 preceeded pred printf.3s printg printw proc proto protoent psignal psignal.3 psl ptr ptrname pushback putc.3f putc.3s puts.3s pvar pw pwd.h qelem qsort.3 qsort.3f rand.3c rand.3f random.3 range.3f rawchar rboff rbon rcmd rcmd.3x rdchar readdir readline recno regex.3 rem remque rename.3f resetty rewinddir rexec rexec.3x rexecd rgid rhost rhosts rindex rlogin rlogind rmax rmin rpm rresvport rshd rshift rss rtnval ruid ruserok savetty scandir scandir.3 scanf.3s scanw scp scr scr,boolf scrollok secsize seekdir servent serverftp setbuf.3s setbuffer setclear setegid setenv seteuid setfsent setgroups sethostent setitimer setjmp.3 setjmp.h setlinebuf setmat setnetent setpriority setprotoent setregid setreuid setrgid setrlimit setruid setservent setset setstate setterm settimeofday setuid.3 setxor sevral sgtty.h sgttyb sig sigblock sigcontext siglist sigmask signal.3 signal.3c signal.3f signal.h signgam signum sigpause sigsetmask sigstack sigvec sin.3m sinh.3m sizeof sleep.3 sleep.3f socket.h srandom src standend standout stat.3f statb stayopen stdio.h stdscr str string.3 strings.h stty.3c substr swab.3 symlink symlnk syslog syslog.3 syslog.h system.3 system.3f tarray tclose tcp tcsr telldir termbuf termbuf,name termcap.3x tgetent tgetflag tgetnum tgetstr tgoto thompson time.3c time.3f time.h timeb timeb.h timekeeping timep times.3c times.h timezone tloc tlu tms togvid topen topen''ed topen.3f touchwin tputs traper traper.3f trapov trapov.3f trewin trpfpe trpfpe.3f tskipf tstate ttyinit ttynam ttynam.3f ttyname.3 ttyslot twrite typedef types.h ucb unctrl unformatted ungetc.3s unlink.3f username utime.3c val valloc.3 varargs varargs.3 varargs.h vidinv vidnorm vlimit.3c vlimit.h vm -vmunix +kernel vrbose vtimes.3c vtimes.h waddch waddstr wait.3f wclear wclrtobot wclrtoeol wday wdelch wdeleteln werase wgetch wgetstr win,boolf win,c win,ch win,fmt,arg1,arg2 win,lines,cols,begin win,str win,vert,hor win,y,x win1 win1,win2 win2 winsch winsertln wmove word1 word2 wprintw wrefresh wscanw wstandend wstandout xmat xor yday zermat zoomn zoomoff zoomon cat <<'EOF' >---------------- Section 4 5Mbytes ACC ACU AF ALLDELAY ARP ASKNAME AUTOCONF ArpaNet BBN BSDELAY BSP BUFSIZ Backoff Berknet CBREAK CHAN CPU CRDELAY CRMOD CSS CT CTL Crt DARPA DDCMP DECtape DGRAM DMA DMA'ed DMC DMF DMR DN DOSTOP DTABT Datagram Diablo Diskette EADDRINUSE EADDRNOTAVAIL EC ECC ECONNREFUSED ECONNRESET EISCONN EMSGSIZE ENETDOWN ENETUNREACH ENF ENOBUFS ENOTCONN ETIMEDOUT EVENP EWOULDBLOCK EXTA EXTB Emulex Ethernet Ethernets FASYNC FIONREAD FLUSHREAD FLUSHWRITE GETADDR GETDENS HK HY Hardcopy Hazeltine Hazeltines Helge ICMP IFF IK IL IMPLINK INADDR INET INIT IP ISHT ISMT ISTM ISTS ISUT Ik Ikonas KG LCASE LCRTBS LCRTERA LCRTKIL LCRTKILL LCTLECH LDECCTQ LDISC LETXACK LFLUSHO LINTRUP LLITOUT LMDMBUF LNOHANG LPENDIN LPRTERA LTILDE LTOSTOP MASSBUS MAXPUPSIZ MBEXC MINPUPSIZ ML11A ML11B MPSIZE MRSP MSCP MT MTBSF MTBSR MTFSF MTFSR MTIO MTIOCGET MTIOCTOP MTNOP MTOFFL MTREW MTWEOF N.B NCC NETLDISC NEX NEXUS NLDELAY NOCKSUM NOOP NOSTOP NOTRAILERS NSC NTTYDISC NXM ODDP ODT OFFLINE OTTYDISC PCL PDP11's PSAUTOMAP PSAUTOREFRESH PSDOUBLEBUFFER PSGETADDR PSSINGLEBUFFER PSSINGLEMAP PSSINGLEREFRESH PSSTOPMAP PSSTOPREFRESH PSTIMEREFRESH PSWAITMAP PSWAITREFRESH PTY PUPPROTO Proteon Quadracall RDDMK RDM RECVD RK07's RSP RTF RX RX02's RXIOC SDI SIGHUP SIGINT SIGIO SIGQUIT SIGTINT SIGTSTP SIGTTIN SIGTTOU SIOCADDRT SIOCDELRT SIOCGIFADDR SIOCGIFCONF SIOCGIFDSTADDR SIOCGIFFLAGS SIOCSIFADDR SIOCSIFDSTADDR SIOCSIFFLAGS SMD SWABIPS Skrivervik TAB0 TAB1 TAB2 TBDELAY TCP TDM TIMEREFRESH TIOCCBRK TIOCCDTR TIOCEXCL TIOCFLUSH TIOCGETC TIOCGETD TIOCGETP TIOCGLTC TIOCGPGRP TIOCHPCL TIOCLBIC TIOCLBIS TIOCLGET TIOCLSET TIOCNXCL TIOCPKT TIOCREMOTE TIOCSBRK TIOCSDTR TIOCSETC TIOCSETD TIOCSETN TIOCSETP TIOCSLTC TIOCSPGRP TIOCSTART TIOCSTI TIOCSTOP TS TU TU58's Tchars Terminet UDA UDP UNIBUS UT UU UUDMA Ungermann VAX VAX'en VAX's VPLOT VSETSTATE VTDELAY VV Versatec WAITINT WDDMK WIRECENTER Wildcard Wirecenter XTABS acc acc0 accrint accxint ad0 adaptors addr adintr af arg args arp arpanet autocall autoconf autoconfiguration autoconfigure autoconfigured autodialer autoloads backoff blkno bn bp bpi brkc buf caddr calulates capricorn cbreak chan cnt cpu crt crt's cs cs1 cs2 csr css css0 cssrint cssxint ct0 ctintr cua cua0 cua1 cul cul0 cul1 cyl cyls daemon datagram dataphone dataset datasets db degaussed dh0 dhost dhrint dhxint dialup dialups diskette diskettes diskpart dm0 dma dmc dmc0 dmcload dmcrint dmcxint dmf dmf0 dmfdaint dmfdbint dmflint dmfrint dmfsrint dmfsxint dmfxint dmintr dn0 dnet dnintr ds dsock dsreg dst dstaddr dsuspc dz0 dzrint dzxint ec ec0 ecc eccollide ecrint ecxint effectors en0 enrint enxint eofc er erreg ethernet existant filedes flakey flushc formatted formatter formatters fx0 fxxxxx hangup hardcopy hk0 hk?a hk?b hk?c hk?g hosts's hp0 hp?a hp?b hp?c hp?d hp?e hp?f hp?g hp?h ht0 hy hy0 hyint icsr if.h ifc ifconf ifcu ifcu.ifcu ifnet ifp ifr ifreq ifrequest ifru ifru.ifru ik0 ikintr ikonas il il0 ilcint ilrint imp.h impostors in.h inet info intr intrc ioctl.h ipl ips ispeed kbytes kg kg0 kglock kgmon kludge ldisc len lnextc longword longwords loopback lp0 lpintr ltchars mag mba mba's mba0 mbsr mcr mcr's mod mpm mscp.h mt mt0 mt11 mt15 mt16 mt19 mt23 mt3 mt7 mt8 mtget mtio mtio.h mtop mu0 netimp netinet netpup newcrt newfs newline newlines npr nsectors ntracks occured ocsr offline olen online op ospeed pcl pcl0 pclrint pclxint pgrp pk plotmd powerfails pre proNET prom proms prtmd ps0 psec pseud psintr pty pup.h pupport quitc ra0 ra?a ra?b ra?c ra?d ra?e ra?f ra?g ra?h rcr rcv recive recv recvfrom refcnt req resid resyncing rhk rhp rk0 rk07's rkintr rlogin rlogind rmt rmt0 rmt23 route.h rprntc rra rrx rrx0a rrx0b rrx0c rrx0d rsr rt rtentry rup rx rx0 rx1 rxformat rxintr rxreg.h sc0 sendto sg sgtty sgtty.h sgttyb shost sigvec snet sockaddr socket.h spup ssock startc stopc subsituting subsytem suspc ta tapemarks tchars tcontrol tcp tcr te0 thru tj tj0 tm0 tmintr tri trk ts ts0 tsintr tsr tty02 ttyd ttyh2 tu tu0 types.h uba uba0 ubinfo uda uda0 udasa udintr udp un un0 unibus unintr unuseable up0 up?a up?b up?c up?d up?e up?f up?g up?h upintr uploading useable ut ut0 utintr uu uu0 uu?a uurintr uuxintr va0 vaintr vax vaxuba vcmd.h vec versatec vp0 vpbuf vpintr vs vv vv0 vvicsr vvocsr vvrint vvxint vz0 werasc wildcard xmit zero1 zero2 zs0 cat <<'EOF' >---------------- Section 5 A.OUT A.out ACOMPAT ACORE ADDR ADM AFORK ARFMAG ARMAG ASU AXSIG BADMAG BCOMM BIZCOMP BSIZE BSS BUFSIZ Chksum DARPA DECtape DEV DIRBLKSIZ DIRSIZ DISKTAB DM2500,H2000 DUMPINFMT DUMPOUTFMT DVI Datamedia's Disktab ECOML ECOMM EE:ta EK:xn ENH EOF EXT Ee:so FNAME FS FSTAB GETTYTAB GSYM Gettytab Hardcopy Hazeltine ID's INODE INOPB Inode Keypad Kj LBRAC LCSYM LENG LSYM Linkflag MAXBPC MAXBPG MAXBSIZE MAXCPG MAXCSBUFS MAXIPG MAXMNTLEN MAXNAMLEN MICOM MINBSIZE MLEN MSIZ Maxx Mime Mtime N.B NAMSIZ NBPI NIC NINDIR NMAGIC NRPOS NSPF NTREC Newline OMAGIC Op PRINTCAP PSYM Perkin Presotto Printcap RBRAC RSYM SARMAG SBSIZE SENDMAIL SLINE SSYM STROFF STSYM SYMOFF Siegler Stab.h Standout TBLOCK TVI TXTOFF Teleray UNDF UPAGES Uid Umount Upline Uudecode VAX VGRINDEFS Versatec Vgrindefs XOFF XON Xl ZMAGIC Zk a.out a.out.h acct.h acctbuf acctp addr adm3 adm3:am:bs:cl aliases.dir aliases.pag ap ar.h arpavax asm basic:4 blk blkno blkoff blks blksize bmask bool br bshift bsize btime buf caddr calc cau0:el cblkno cbreak cgmask cgoffset cgrotor cgsize chksum cifplot cl cl,ll,sf,sb cm comp compat concept100:is cont cpc cpg crt csaddr csmask csp csshift cssize cstotal csum ctrl cyl daemon dblkno dbtofsb dbuf dbx def desc di dialup dinode dir.h dirdesc diskpart disktab disktab.h ditroff dotdashed drsize dsize du:at dumpdates dumprestor.h dv e.g elt endif enum enviroment eol etime ev extern extern:1 fds filesys fmag fmask formatted formfeed fortran fpg frag fragoff frags fragshift freelist freq fs.h fsbtodb fshift fsize fsmnt fstab fstab.h getfsent getfsfile getfsspec getfstype gethostent getnetent getprotoent getservent gettytab goto grp hangup hardcopy harris hblock hd hdr hn hostname iblkno idates ie ifdef ifndef im incno incore inet info initgroups ino inode.h inodes inopb inumber ipg kd keyletter keypad kh kludge kr ku lblkno lbn lcomm length:2 level,address linefeed linemod linkflag linkname linknames lm loc logout longdashed lpc lsi mag magtapes makedev max maxbpg maxcontig maxx maxy mime minfree mod modtime mtab.h mtime nam name,,0 name,,0,0,address name,,0,linenumber,address name,,0,subtype,line name,,0,type,0 name,,0,type,address name,,0,type,offset name,,0,type,register name,,0,type,struct name,linenumber,address name2 namelist namlen nbytes ncg ncyl newaliases newfs newline newlines nindir nsect nspf ntrak numfrags nx oe op or'ed overriden pac param.h pascal passno pcrel:1 physadr plugboard pn postbl pre printcap quotacheck quotaon reclen resp rlink ronly rotbl rotdelay rpm rps rw,ro,sw sblkno sbsize sendmail setgroups setrlimit sgtty.h shortdashed sigvec sizeof sparecon spc spcl src ssize stab.h stabd stabn standout std steamerflies str strx swblk sym symbolnum symbolnum:24 syms tabset tapea tapeaddr tapemark tcp tex tip300 trampflies trsize tt tty33:co typedef types.h un.n undef unused1 unused2 user.h ushort utmp.h uudecode val vax vcat ve ventel:ie ver vgrindefs vipw vs xtnd cat <<'EOF' >---------------- Section 6 ATPB Allman BR Backslash Bournes Bros DDL ELIZA EOF Foderaro Fourr HJKL Heuer Hoyle Lebling McKusick Mikey PD RUBOUT Rogerian Rubout SEFC VAX VMS Weizenbaum Wichman Wumpus Yendor aliens.log amt1 anual appl arg arp atus bdh canfield cards.pck category1 category2 cfscores cithep cmd commadore course1 crt ddl ddlrun de debtee decwriter dict doc ds e.g epie erhd est fortunes.dat grainier hardcopy hasers hexagram hexagrams hjkl i.e ields isual logout mages mortgageable mpulse ndock newline newlines nfences nrobots omputer orpedo ove pture quiz.k req rogue.save rscan scrunched sefc snake.log snakerawscores snscore solitaire spread1 strfile trekkie ucb utomatic wslao wumpus cat <<'EOF' >---------------- Section 7 ARPANET Adm Allman Arpa Berkeley.ARPA Berknet Bitnet CSNET DARPA DASI DIABLO DTC EXINIT Ethernet GSI L.sys LOGFILE MAILADDR MAKEDEV MAKEDEV.local MASBUS MULTICS Nofill PP RA RC RFC822 Reg SM Seigler Tterm UCB UDel UNIBUS VAX a.out a.out.h abs.c access.s acct.h ack addrs adm3a africa ar.c arpavax as.1 atrun bitnet bp brk.s calder.Berkeley.ARPA cat1 ccom cf conf crt0.s cshrc csu csvax ctm daemon datebook del dh.c dialup dict disktab dle doc dumpdates ec.c eign en.c enq eric etb etx exdented exrc extern fIword fgets.c fopen.c fstab ftB ftR ftR.c gen gethostbyname.c hangups host.ARPA host.BITNET host.CC host.UUCP host:user hosta hostb hostb:user hostc hostnames hp.c ht.c imp.c imphost.c imphost.h ingvax lc libc.a libc.m lineprinter llib lm locore.s lpacct machdep.c mailaddr mailrc main.c man1 math.h mba.c mcrt0.s mime monet monet.Berkeley.ARPA motd mount.1m mqueue msgsrc n.t.l netimp netinet netrc nical nofill p.i pac preformatted pupose quiz.k rc.local rcp rhp secretmail sendmail setenv socket.c soh spellhist src stat.h stdio.h stm stx syn syscalls.c tab300.c tf tmac tmac.an tmac.e tmac.s tmac.x tracct uba.c ucb ucbarpa ucbcad ucbcory ucbernie ucbingres ucbkim ucbvax uipc umlaut undef up.c user.host usr.bin uucico vaacct varian vax vaxif vaxmba vaxuba versatec -vmunix +kernel vpacct vv.c wd xx yourname cat <<'EOF' >---------------- Section 8 0123456789fusdWn ADDR ALLO APPE ARPANET BAD144 BADSECT BPI BUGFILER Babaoglu Bad144 Badsect Bcc BerkNet Berknet Blksize Bugfiler CADDR CCNT CHM CLKT CNT COMSAT CONFIG CPU CPU's CRIT CRMOD CWD Catchall Cifplot Cmds Comsat Config Cory Countdown Crontab DADDR DARPA DBA0 DELE DEV DISKPART DMA DMA0 DRA0 DRTEST DSK DUMPFS DVI Dept Diskpart Drtest Dumpfs ECC EDQUOTA EECS EMERG EMULEX ESSAA EVRAC Edquota FASTBOOT FLG FTPD Fastboot Formatted Fragsize Ftpd HKM HKS HPM HPS HTABLE HUP Helge Hostname Htable ICMP ID's IDC IMPLOG IMPLOGD INADDR INFO INIT INO IPC IPTR Implog Implogd Init's Inode Intransit KGMON KSP Kgmon Kovacs Kovacs,508E,7925,6428202 LOC LPC LPD Leffler Lpc Lpd MAKEDEV MAKEDEV.local MASSBUS MIN MKLOST MKPROTO MTIOCGET MTIOCOP McKusick Minfree Mkproto N.B NCP NETLDISC NEWFS NI NIC NLK NLST NOHOST NOOP NOUSER NPR NTTYDISC Name1 Name2 Ncpg Newfs Nsect Ntrack OSERR OTTYDISC Ozalp PAC PCB PGRP PID POIP PPID PRI PRIO Pac Pprinter Prototocol QUOTACHECK QUOTAON Quotacheck Quotaoff Quotaon RC RDC RDUMP REPQUOTA RETR REXECD RFC RFC733 RFC819 RFC821 RFC822 RK07 RK07's RLOGIND RM0X RMT RNFR RNTO RP0X RRESTORE RSHD RSS RWHOD RXFORMAT Rc Rc.local Rdump Repquota Rexecd Rlogind Rmt Rrestore Rshd Rwhod SALERT SAVECORE SBI SEC:PACKINIT SENDMAIL SETIFADDR SIGHUP SIOCADDRT SIOCDELRT SIOCGIFCONF SIOGIFCONF SIZ SLP SMTP SRSS SSE STOR STRU STST SYOPNSIS Savecore Sendmail Setifaddr Sklower Skrivervik Standford Syslog TCP TE16,TU45,TU77 TELNET TELNETD TEMPFAIL TEXTP TFTP TFTPD TRPT TSTP TUNEFS Telnetd Tex Tftpd Trpt Tunefs UCB UDA50 UDP UID UNIBUS UPM UUSNAP Umount Uusnap VAX VIPW Vipw WCHAN WRC XCUP XCWD XMKD XPWD XRMD XSIS XTABS Xqts abcdDfijkKlnrstuv abreviated abreviation ack adapter,unit adaptor addr adduser.8 aixptufT aliases.dir aliases.pag analyze.8 arcv.8 arff.8v arg args arpa ast autoboot avio axl ba backslash bad144 bad144.8 badsect badsect.8 bbdir bd bi biff blksize bm bootstrapped boottime bp bpt bse bt bugfiler bugfiler.8 bv bz catman.8 cf chown.8 cifplot clri.8 cmd comsat comsat.8c conf conf.c config.8 corefile coremap cpu cpu's crash.8v cron.8 crontab cshrc csn csvax cyl daemon daemons dameons datagram dcheck.8 dead.letter deamons dec degaussed devices.vax dialup dieing diskette diskmap diskpart diskpart.8 disktab disktype dissappears dkbad dmesg.8 dmf drtest drtest.8 dump.8 dumpdates dumpfs dumpfs.8 ec6d ecc ecc's edquota edquota.8 eric ernie ernie's ernie::235:20 fastboot fastboot.8 fasthalt files.ERNIE files.vax filesys flakey format.8v formatted formatter formatting...make found.8 frag fragsize freeblock fsck.8 fstab fsync ftp ftpd ftpd.8c ftplog ftpusers fullname gethostent gethostname getnetent getpriority getservbyname gettable.8c getty.8 gettytab gmon.out googol gprof halt.8 hangup hostname hosts.equiv hosts.txt htable htable.8 icheck.8 implog implog.8c implogd implogd.8c incore inet info ing init's init.8 innocuous inodes inscruitable instantiate intransit intstack inumber ioconf.c jobnum john kalash kgmon kgmon.8 kilo kridle len loadav localgateways localhosts localnetworks logfile loopback lpc lpc.8 lpd.8 machine:device mailaddr maildir mailq makedev makedev.8 makefile makefile.vax makekey.8 makewhatis maxbpg maxcontig mba mba0 mba1 mbz mdec min minfree mkfs.8 mklost mknod.8 mkproto mkproto.8 mnt mount.8 mqueue msgbuf mt mtio name1 name2 namelist ncheck.8 ncpg netstat newaliases newfs newfs.8 newlines nicname nnnnn nologin nsect ntrack online op outmp p0br pac pac.8 pathnames pgrp pid ploter pprice pre preformatted printcap proto pseduo pstat.8 ptmp pty putput queuedir queueing quot.8 quotacheck quotacheck.8 quotaoff quotaon quotaon.8 radix50 rc.local rcmd rdump rdump.8c reboot.8 recvtime renice.8 repquota repquota.8 restore.8 restoresymtab rexec rexecd rexecd.8c rhosts rlogin rlogind rlogind.8c rmail rmt rmt.8c rmt8 roms rotdelay route.8c routed.8c rp0g rps rrestore rrestore.8c rrp0g rrp1g rrx rrx0 rrx1 rshd rshd.8c rstdir rstmode ruptime rwho rwhod rwhod.8c rxformat rxformat.8v sandbagged savacct savecore savecore.8 selfexplanatory sendberkmail sendmail sendmail.8 sendmail.cf sendmail.fc sendmail.hf sendmail.st sendtime setifaddr setifaddr.8c setitimer setpriority setquota setsockopt shutdown.8 shutdownlog sizeof skel sno sockstamp standalone std sticky.8 stz,dtz swapfile swapon.8 sync.8 sysexits.h syslog syslog.8 syslog.conf syslog.h syslog.pid sysname ta telnet telnetd telnetd.8c tftp tftpd tftpd.8c threshhold tio topq trksec trpt trpt.8c ttyd tunefs tunefs.8 tuneup typeX uba uba0 ubglue.s udp unixtomh update.8 username usracct uuclean.8c uusnap uusnap.8c vers vipw vipw.8 vmcore vmcore.n -vmunix -vmunix.n +kernel +kernel.n whod whoent xfc zz Index: head/usr.bin/fstat/fstat.1 =================================================================== --- head/usr.bin/fstat/fstat.1 (revision 1855) +++ head/usr.bin/fstat/fstat.1 (revision 1856) @@ -1,219 +1,219 @@ .\" Copyright (c) 1987, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)fstat.1 8.3 (Berkeley) 2/25/94 .\" .Dd February 25, 1994 .Dt FSTAT 1 .Os BSD 4 .Sh NAME .Nm fstat .Nd file status .Sh SYNOPSIS .Nm fstat .Op Fl fnv .Op Fl M Ar core .Op Fl N Ar system .Op Fl p Ar pid .Op Fl u Ar user .Op Ar filename... .Sh DESCRIPTION .Nm Fstat identifies open files. A file is considered open by a process if it was explicitly opened, is the working directory, root directory, active pure text, or kernel trace file for that process. If no options are specified, .Nm fstat reports on all open files in the system. .Pp Options: .Bl -tag -width Ds .It Fl f Restrict examination to files open in the same filesystems as the named file arguments, or to the filesystem containing the current directory if there are no additional filename arguments. For example, to find all files open in the filesystem where the directory .Pa /usr/src resides, type .Dq Li fstat -f /usr/src . .It Fl M Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . .It Fl N Extract the name list from the specified system instead of the default -.Pa /vmunix . +.Pa /kernel . .It Fl n Numerical format. Print the device number (maj,min) of the filesystem the file resides in rather than the mount point name; for special files, print the device number that the special device refers to rather than the filename in .Pa /dev ; and print the mode of the file in octal instead of symbolic form. .It Fl p Report all files open by the specified process. .It Fl u Report all files open by the specified user. .It Fl v Verbose mode. Print error messages upon failures to locate particular system data structures rather than silently ignoring them. Most of these data structures are dynamically created or deleted and it is possible for them to disappear while .Nm fstat is running. This is normal and unavoidable since the rest of the system is running while .Nm fstat itself is running. .It Ar filename ... Restrict reports to the specified files. .El .Pp The following fields are printed: .Bl -tag -width MOUNT .It Li USER The username of the owner of the process (effective uid). .It Li CMD The command name of the process. .It Li PID The process id. .It Li FD The file number in the per-process open file table or one of the following special names: .Pp .Bd -ragged -offset indent -compact text - pure text inode wd - current working directory root - root inode tr - kernel trace file .Ed .Pp If the file number is followed by an asterisk (``*''), the file is not an inode, but rather a socket, .Tn FIFO , or there is an error. In this case the remainder of the line doesn't correspond to the remaining headers -- the format of the line is described later under .Sx Sockets . .It Li MOUNT If the .Fl n flag wasn't specified, this header is present and is the pathname that the filesystem the file resides in is mounted on. .It Li DEV If the .Fl n flag is specified, this header is present and is the major/minor number of the device that this file resides in. .It Li INUM The inode number of the file. .It Li MODE The mode of the file. If the .Fl n flag isn't specified, the mode is printed using a symbolic format (see .Xr strmode 3 ) ; otherwise, the mode is printed as an octal number. .It Li SZ\&|DV If the file is not a character or block special, prints the size of the file in bytes. Otherwise, if the .Fl n flag is not specified, prints the name of the special file as located in .Pa /dev . If that cannot be located, or the .Fl n flag is specified, prints the major/minor device number that the special device refers to. .It Li R/W This column describes the access mode that the file allows. The letter ``r'' indicates open for reading; the letter ``w'' indicates open for writing. This field is useful when trying to find the processes that are preventing a filesystem from being down graded to read-only. .It Li NAME If filename arguments are specified and the .Fl f flag is not, then this field is present and is the name associated with the given file. Normally the name cannot be determined since there is no mapping from an open file back to the directory entry that was used to open that file. Also, since different directory entries may reference the same file (via .Xr ln 2 ) , the name printed may not be the actual name that the process originally used to open that file. .El .Sh SOCKETS The formating of open sockets depends on the protocol domain. In all cases the first field is the domain name, the second field is the socket type (stream, dgram, etc), and the third is the socket flags field (in hex). The remaining fields are protocol dependent. For tcp, it is the address of the tcpcb, and for udp, the inpcb (socket pcb). For unix domain sockets, its the address of the socket pcb and the address of the connected pcb (if connected). Otherwise the protocol number and address of the socket itself are printed. The attempt is to make enough information available to permit further analysis without duplicating .Xr netstat 1 . .Pp For example, the addresses mentioned above are the addresses which the .Dq Li netstat -A command would print for tcp, udp, and unixdomain. Note that since pipes are implemented using sockets, a pipe appears as a connected unix domain stream socket. A unidirectional unix domain socket indicates the direction of flow with an arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow (``<->''). .Sh BUGS Since .Nm fstat takes a snapshot of the system, it is only correct for a very short period of time. .Sh SEE ALSO .Xr netstat 1 , .Xr nfsstat 1 , .Xr ps 1 , .Xr systat 1 , .Xr vmstat 1 , .Xr iostat 8 , .Xr pstat 8 .Sh HISTORY The .Nm command appeared in .Bx 4.3 tahoe . Index: head/usr.bin/netstat/netstat.1 =================================================================== --- head/usr.bin/netstat/netstat.1 (revision 1855) +++ head/usr.bin/netstat/netstat.1 (revision 1856) @@ -1,289 +1,289 @@ .\" Copyright (c) 1983, 1990, 1992, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" .Dd April 18, 1994 .Dt NETSTAT 1 .Os BSD 4.2 .Sh NAME .Nm netstat .Nd show network status .Sh SYNOPSIS .Nm netstat .Op Fl Aan .Op Fl f Ar address_family .Op Fl M Ar core .Op Fl N Ar system .Nm netstat .Op Fl dghimnrs .Op Fl f Ar address_family .Op Fl M Ar core .Op Fl N Ar system .Nm netstat .Op Fl dn .Op Fl I Ar interface .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait .Nm netstat .Op Fl p Ar protocol .Op Fl M Ar core .Op Fl N Ar system .Sh DESCRIPTION The .Nm netstat command symbolically displays the contents of various network-related data structures. There are a number of output formats, depending on the options for the information presented. The first form of the command displays a list of active sockets for each protocol. The second form presents the contents of one of the other network data structures according to the option selected. Using the third form, with a .Ar wait interval specified, .Nm netstat will continuously display the information regarding packet traffic on the configured network interfaces. The fourth form displays statistics about the named protocol. .Pp The options have the following meaning: .Bl -tag -width flag .It Fl A With the default display, show the address of any protocol control blocks associated with sockets; used for debugging. .It Fl a With the default display, show the state of all sockets; normally sockets used by server processes are not shown. .It Fl d With either interface display (option .Fl i or an interval, as described below), show the number of dropped packets. .It Fl f Ar address_family Limit statistics or address control block reports to those of the specified .Ar address family . The following address families are recognized: .Ar inet , for .Dv AF_INET , .Ar ns , for .Dv AF_NS , .Ar iso , for .Dv AF_ISO , and .Ar unix , for .Dv AF_UNIX . .It Fl g Show information related to multicast (group address) routing. By default, show the IP Multicast virtual-interface and routing tables. If the .Fl s option is also present, show multicast routing statistics. .It Fl h Show the state of the .Tn IMP host table (obsolete). .It Fl I Ar interface Show information about the specified interface; used with a .Ar wait interval as described below. .It Fl i Show the state of interfaces which have been auto-configured (interfaces statically configured into a system, but not located at boot time are not shown). If the .Fl a options is also present, multicast addresses currently in use are shown for each Ethernet interface and for each IP interface address. Multicast addresses are shown on separate lines following the interface address with which they are associated. .It Fl M Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . .It Fl m Show statistics recorded by the memory management routines (the network manages a private pool of memory buffers). .It Fl N Extract the name list from the specified system instead of the default -.Pa /vmunix . +.Pa /kernel . .It Fl n Show network addresses as numbers (normally .Nm netstat interprets addresses and attempts to display them symbolically). This option may be used with any of the display formats. .It Fl p Ar protocol Show statistics about .Ar protocol , which is either a well-known name for a protocol or an alias for it. Some protocol names and aliases are listed in the file .Pa /etc/protocols . A null response typically means that there are no interesting numbers to report. The program will complain if .Ar protocol is unknown or if there is no statistics routine for it. .It Fl s Show per-protocol statistics. If this option is repeated, counters with a value of zero are suppressed. .It Fl r Show the routing tables. When .Fl s is also present, show routing statistics instead. .It Fl w Ar wait Show network interface statistics at intervals of .Ar wait seconds. .El .Pp The default display, for active sockets, shows the local and remote addresses, send and receive queue sizes (in bytes), protocol, and the internal state of the protocol. Address formats are of the form ``host.port'' or ``network.port'' if a socket's address specifies a network but no specific host address. When known the host and network addresses are displayed symbolically according to the data bases .Pa /etc/hosts and .Pa /etc/networks , respectively. If a symbolic name for an address is unknown, or if the .Fl n option is specified, the address is printed numerically, according to the address family. For more information regarding the Internet ``dot format,'' refer to .Xr inet 3 ) . Unspecified, or ``wildcard'', addresses and ports appear as ``*''. .Pp The interface display provides a table of cumulative statistics regarding packets transferred, errors, and collisions. The network addresses of the interface and the maximum transmission unit (``mtu'') are also displayed. .Pp The routing table display indicates the available routes and their status. Each route consists of a destination host or network and a gateway to use in forwarding packets. The flags field shows a collection of information about the route stored as binary choices. The individual flags are discussed in more detail in the .Xr route 8 and .Xr route 4 manual pages. The mapping between letters and flags is: .Bl -column XXXX RTF_BLACKHOLE 1 RTF_PROTO2 Protocol specific routing flag #1 2 RTF_PROTO1 Protocol specific routing flag #2 B RTF_BLACKHOLE Just discard pkts (during updates) C RTF_CLONING Generate new routes on use D RTF_DYNAMIC Created dynamically (by redirect) G RTF_GATEWAY Destination requires forwarding by intermediary H RTF_HOST Host entry (net otherwise) L RTF_LLINFO Valid protocol to link address translation. M RTF_MODIFIED Modified dynamically (by redirect) R RTF_REJECT Host or net unreachable S RTF_STATIC Manually added U RTF_UP Route usable X RTF_XRESOLVE External daemon translates proto to link address .El .Pp Direct routes are created for each interface attached to the local host; the gateway field for such entries shows the address of the outgoing interface. The refcnt field gives the current number of active uses of the route. Connection oriented protocols normally hold on to a single route for the duration of a connection while connectionless protocols obtain a route while sending to the same destination. The use field provides a count of the number of packets sent using that route. The interface entry indicates the network interface utilized for the route. .Pp When .Nm netstat is invoked with the .Fl w option and a .Ar wait interval argument, it displays a running count of statistics related to network interfaces. An obsolescent version of this option used a numeric parameter with no option, and is currently supported for backward compatibility. This display consists of a column for the primary interface (the first interface found during autoconfiguration) and a column summarizing information for all interfaces. The primary interface may be replaced with another interface with the .Fl I option. The first line of each screen of information contains a summary since the system was last rebooted. Subsequent lines of output show values accumulated over the preceding interval. .Sh SEE ALSO .Xr iostat 1 , .Xr nfsstat 1 , .Xr ps 1 , .Xr vmstat 1 , .Xr hosts 5 , .Xr networks 5 , .Xr protocols 5 , .Xr services 5 , .Xr trpt 8 , .Xr trsp 8 .Sh HISTORY The .Nm netstat command appeared in .Bx 4.2 . .\" .Sh FILES .\" .Bl -tag -width /dev/kmem -compact -.\" .It Pa /vmunix +.\" .It Pa /kernel .\" default kernel namelist .\" .It Pa /dev/kmem .\" default memory file .\" .El .Sh BUGS The notion of errors is ill-defined. Index: head/usr.bin/nfsstat/nfsstat.1 =================================================================== --- head/usr.bin/nfsstat/nfsstat.1 (revision 1855) +++ head/usr.bin/nfsstat/nfsstat.1 (revision 1856) @@ -1,88 +1,88 @@ .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt NFSSTAT 1 .Os BSD 4.4 .Sh NAME .Nm nfsstat .Nd display .Tn NFS statistics .Sh SYNOPSIS .Nm nfsstat .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait .Sh DESCRIPTION .Nm Nfsstat displays statistics kept about .Tn NFS client and server activity. .Pp The options are as follows: .Bl -tag -width Ds .It Fl M Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . .It Fl N Extract the name list from the specified system instead of the default -.Pa /vmunix . +.Pa /kernel . .It Fl w Display a shorter summary of .Tn NFS activity for both the client and server at .Ar wait second intervals. .El .Sh FILES .Bl -tag -width /dev/kmem -compact -.It Pa /vmunix +.It Pa /kernel default kernel namelist .It Pa /dev/kmem default memory file .El .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , .Xr ps 1 , .Xr systat 1 , .Xr vmstat 1 , .Xr iostat 8 , .Xr pstat 8 , .Sh HISTORY The .Nm nfsstat command appears in .Bx 4.4 . Index: head/usr.bin/systat/systat.1 =================================================================== --- head/usr.bin/systat/systat.1 (revision 1855) +++ head/usr.bin/systat/systat.1 (revision 1856) @@ -1,423 +1,423 @@ .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" .Dd December 30, 1993 .Dt SYSTAT 1 .Os BSD 4.3 .Sh NAME .Nm systat .Nd display system statistics on a crt .Sh SYNOPSIS .Nm systat .Op Fl display .Op Ar refresh-interval .Sh DESCRIPTION .Nm Systat displays various system statistics in a screen oriented fashion using the curses screen display library, .Xr curses 3 . .Pp While .Nm systat is running the screen is usually divided into two windows (an exception is the vmstat display which uses the entire screen). The upper window depicts the current system load average. The information displayed in the lower window may vary, depending on user commands. The last line on the screen is reserved for user input and error messages. .Pp By default .Nm systat displays the processes getting the largest percentage of the processor in the lower window. Other displays show swap space usage, disk .Tn I/O statistics (a la .Xr iostat 1 ) , virtual memory statistics (a la .Xr vmstat 1 ) , network ``mbuf'' utilization, and network connections (a la .Xr netstat 1 ) . .Pp Input is interpreted at two different levels. A ``global'' command interpreter processes all keyboard input. If this command interpreter fails to recognize a command, the input line is passed to a per-display command interpreter. This allows each display to have certain display-specific commands. .Pp Command line options: .Bl -tag -width "refresh_interval" .It Fl Ns Ar display The .Fl flag expects .Ar display to be one of: .Ic pigs , .Ic iostat , .Ic swap , .Ic mbufs , .Ic vmstat or .Ic netstat . These displays can also be requested interactively (without the .Dq Fl ) and are described in full detail below. .It Ar refresh-interval The .Ar refresh-value specifies the screen refresh time interval in seconds. .El .Pp Certain characters cause immediate action by .Nm systat . These are .Bl -tag -width Fl .It Ic \&^L Refresh the screen. .It Ic \&^G Print the name of the current ``display'' being shown in the lower window and the refresh interval. .It Ic \&^Z Stop .Nm systat . .It Ic \&: Move the cursor to the command line and interpret the input line typed as a command. While entering a command the current character erase, word erase, and line kill characters may be used. .El .Pp The following commands are interpreted by the ``global'' command interpreter. .Bl -tag -width Fl .It Ic help Print the names of the available displays on the command line. .It Ic load Print the load average over the past 1, 5, and 15 minutes on the command line. .It Ic stop Stop refreshing the screen. .It Xo .Op Ic start .Op Ar number .Xc Start (continue) refreshing the screen. If a second, numeric, argument is provided it is interpreted as a refresh interval (in seconds). Supplying only a number will set the refresh interval to this value. .It Ic quit Exit .Nm systat . (This may be abbreviated to .Ic q . ) .El .Pp The available displays are: .Bl -tag -width Ic .It Ic pigs Display, in the lower window, those processes resident in main memory and getting the largest portion of the processor (the default display). When less than 100% of the processor is scheduled to user processes, the remaining time is accounted to the ``idle'' process. .It Ic iostat Display, in the lower window, statistics about processor use and disk throughput. Statistics on processor use appear as bar graphs of the amount of time executing in user mode (``user''), in user mode running low priority processes (``nice''), in system mode (``system''), and idle (``idle''). Statistics on disk throughput show, for each drive, kilobytes of data transferred, number of disk transactions performed, and average seek time (in milliseconds). This information may be displayed as bar graphs or as rows of numbers which scroll downward. Bar graphs are shown by default; .Pp The following commands are specific to the .Ic iostat display; the minimum unambiguous prefix may be supplied. .Pp .Bl -tag -width Fl -compact .It Cm numbers Show the disk .Tn I/O statistics in numeric form. Values are displayed in numeric columns which scroll downward. .It Cm bars Show the disk .Tn I/O statistics in bar graph form (default). .It Cm msps Toggle the display of average seek time (the default is to not display seek times). .El .It Ic swap Show information about swap space usage on all the swap areas compiled into the kernel. The first column is the device name of the partition. The next column is the total space available in the partition. The .Ar Used column indicates the total blocks used so far; the graph shows the percentage of space in use on each partition. If there are more than one swap partition in use, a total line is also shown. Areas known to the kernel, but not in use are shown as not available. .It Ic mbufs Display, in the lower window, the number of mbufs allocated for particular uses, i.e. data, socket structures, etc. .It Ic vmstat Take over the entire display and show a (rather crowded) compendium of statistics related to virtual memory usage, process scheduling, device interrupts, system name translation cacheing, disk .Tn I/O etc. .Pp The upper left quadrant of the screen shows the number of users logged in and the load average over the last one, five, and fifteen minute intervals. Below this line are statistics on memory utilization. The first row of the table reports memory usage only among active processes, that is processes that have run in the previous twenty seconds. The second row reports on memory usage of all processes. The first column reports on the number of physical pages claimed by processes. The second column reports the number of physical pages that are devoted to read only text pages. The third and fourth columns report the same two figures for virtual pages, that is the number of pages that would be needed if all processes had all of their pages. Finally the last column shows the number of physical pages on the free list. .Pp Below the memory display is the disk usage display. It reports the number of seeks, transfers, and number of kilobyte blocks transferred per second averaged over the refresh period of the display (by default, five seconds). For some disks it also reports the average milliseconds per seek. Note that the system only keeps statistics on at most four disks. .Pp Below the disk display is a list of the average number of processes (over the last refresh interval) that are runnable (`r'), in page wait (`p'), in disk wait other than paging (`d'), sleeping (`s'), and swapped out but desiring to run (`w'). Below the queue length listing is a numerical listing and a bar graph showing the amount of system (shown as `='), user (shown as `>'), nice (shown as `-'), and idle time (shown as ` '). .Pp At the bottom left are statistics on name translations. It lists the number of names translated in the previous interval, the number and percentage of the translations that were handled by the system wide name translation cache, and the number and percentage of the translations that were handled by the per process name translation cache. .Pp Under the date in the upper right hand quadrant are statistics on paging and swapping activity. The first two columns report the average number of pages brought in and out per second over the last refresh interval due to page faults and the paging daemon. The third and fourth columns report the average number of pages brought in and out per second over the last refresh interval due to swap requests initiated by the scheduler. The first row of the display shows the average number of disk transfers per second over the last refresh interval; the second row of the display shows the average number of pages transferred per second over the last refresh interval. .Pp Below the paging statistics is a line listing the average number of total reclaims ('Rec'), intransit blocking page faults (`It'), swap text pages found in free list (`F/S'), file system text pages found in free list (`F/F'), reclaims from free list pages freed by the clock daemon (`Fre'), and sequential process pages freed (`SFr') per second over the refresh interval. .Pp Below this line are statistics on the average number of zero filled pages (`zf') and demand filled text pages (`xf') per second over the refresh period. The first row indicates the number of requests that were resolved, the second row shows the number that were set up, and the last row shows the percentage of setup requests that were actually used. Note that this percentage is usually less than 100%, however it may exceed 100% if a large number of requests are actually used long after they were set up during a period when no new pages are being set up. Thus this figure is most interesting when observed over a long time period, such as from boot time (see below on getting such a display). .Pp Below the page fill statistics is a column that lists the average number of context switches (`Csw'), traps (`Trp'; includes page faults), system calls (`Sys'), interrupts (`Int'), characters output to DZ ports using .No pseudo Ns -DMA (`Pdm'), network software interrupts (`Sof'), page faults (`Flt'), pages scanned by the page daemon (`Scn'), and revolutions of the page daemon's hand (`Rev') per second over the refresh interval. .Pp Running down the right hand side of the display is a breakdown of the interrupts being handled by the system. At the top of the list is the total interrupts per second over the time interval. The rest of the column breaks down the total on a device by device basis. Only devices that have interrupted at least once since boot time are shown. .Pp The following commands are specific to the .Ic vmstat display; the minimum unambiguous prefix may be supplied. .Pp .Bl -tag -width Ar -compact .It Cm boot Display cumulative statistics since the system was booted. .It Cm run Display statistics as a running total from the point this command is given. .It Cm time Display statistics averaged over the refresh interval (the default). .It Cm zero Reset running statistics to zero. .El .It Ic netstat Display, in the lower window, network connections. By default, network servers awaiting requests are not displayed. Each address is displayed in the format ``host.port'', with each shown symbolically, when possible. It is possible to have addresses displayed numerically, limit the display to a set of ports, hosts, and/or protocols (the minimum unambiguous prefix may be supplied): .Pp .Bl -tag -width Ar -compact .It Cm all Toggle the displaying of server processes awaiting requests (this is the equivalent of the .Fl a flag to .Ar netstat 1 ) . .It Cm numbers Display network addresses numerically. .It Cm names Display network addresses symbolically. .It Ar protocol Display only network connections using the indicated protocol (currently either ``tcp'' or ``udp''). .It Cm ignore Op Ar items Do not display information about connections associated with the specified hosts or ports. Hosts and ports may be specified by name (``vangogh'', ``ftp''), or numerically. Host addresses use the Internet dot notation (``128.32.0.9''). Multiple items may be specified with a single command by separating them with spaces. .It Cm display Op Ar items Display information about the connections associated with the specified hosts or ports. As for .Ar ignore , .Op Ar items may be names or numbers. .It Cm show Op Ar ports\&|hosts Show, on the command line, the currently selected protocols, hosts, and ports. Hosts and ports which are being ignored are prefixed with a `!'. If .Ar ports or .Ar hosts is supplied as an argument to .Cm show , then only the requested information will be displayed. .It Cm reset Reset the port, host, and protocol matching mechanisms to the default (any protocol, port, or host). .El .El .Pp Commands to switch between displays may be abbreviated to the minimum unambiguous prefix; for example, ``io'' for ``iostat''. Certain information may be discarded when the screen size is insufficient for display. For example, on a machine with 10 drives the .Ic iostat bar graph displays only 3 drives on a 24 line terminal. When a bar graph would overflow the allotted screen space it is truncated and the actual value is printed ``over top'' of the bar. .Pp The following commands are common to each display which shows information about disk drives. These commands are used to select a set of drives to report on, should your system have more drives configured than can normally be displayed on the screen. .Pp .Bl -tag -width Tx -compact .It Cm ignore Op Ar drives Do not display information about the drives indicated. Multiple drives may be specified, separated by spaces. .It Cm display Op Ar drives Display information about the drives indicated. Multiple drives may be specified, separated by spaces. .El .Sh FILES .Bl -tag -width /etc/networks -compact -.It Pa /vmunix +.It Pa /kernel For the namelist. .It Pa /dev/kmem For information in main memory. .It Pa /dev/drum For information about swapped out processes. .It Pa /etc/hosts For host names. .It Pa /etc/networks For network names. .It Pa /etc/services For port names. .El .Sh HISTORY The .Nm systat program appeared in .Bx 4.3 . .Sh BUGS Takes 2-10 percent of the cpu. Certain displays presume a minimum of 80 characters per line. The .Ic vmstat display looks out of place because it is (it was added in as a separate display rather than created as a new program). Index: head/usr.bin/uucp/acucntrl/acucntrl.8 =================================================================== --- head/usr.bin/uucp/acucntrl/acucntrl.8 (revision 1855) +++ head/usr.bin/uucp/acucntrl/acucntrl.8 (revision 1856) @@ -1,164 +1,164 @@ .\" Copyright (c) 1985, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)acucntrl.8 8.2 (Berkeley) 12/11/93 .\" .TH ACUCNTRL 8 "December 11, 1993" .UC 6 .SH NAME acucntrl \- turn around tty line between dialin and dialout .SH SYNOPSIS .B /usr/lib/uucp/acucntrl keyword ttyline .SH DESCRIPTION .PP .I Acucntrl turns around the terminal line, enabling it to be used for both dialin and dialout. On dialin a terminal line is assumed to have modem control enabled and a getty process in existence waiting for logins. On dialout modem control is disabled and there is no getty process. .PP This program must be run setuid to root. .PP .I keyword is chosen from the list: .I disable or .IR dialout , to condition a line for dialout; and .I enable or .IR dialin , to condition a line for dialin. .PP When the line is conditioned for dialing out, the login name of the real uid of the process is placed in /etc/utmp in capitals. This declares that the line is in use and acts as an additional locking mechanism. .I Acucntrl will refuse to act if the /etc/utmp entry for the line is not null, is not the the user's login name (capitalized or not), and if the process is not running as the superuser. The last condition is to allow the superuser to clear the state of the line. .PP Turning modem control on or off is handled by poking into /dev/kmem. It is currently implemented for dz, dh, and dmf lines. .PP Under 4.2 BSD the program will also refuse to disable a line if carrier is sensed on it. This is to avoid the dead period where someone has just dialed in and made the connection but has not yet logged in. .PP .I Ttyline can be either of the form tty* or /dev/tty*. Enabling/disabling a line whose name does not begin with ttyd? is prohibited unless the real uid of the process is 0 or if the login name corresponding to the real uid is uucp. This is a security precaution. .PP Steps taken when disabling .RI ( i . e . setup for dialing out) .IP 1) check input arguments .IP 2) look in /etc/utmp to check that the line is not in use by another user .IP 3) disable modem control on line .IP 4) check for carrier on device .IP 5) change owner of device to real uid .IP 6) edit /etc/ttys, changing the first character of the appropriate line to 0 .IP 7) send a hangup to process 1 to poke init to disable getty .IP 8) post uid name in capitals in /etc/utmp to let world know device has been grabbed .IP 9) make sure that DTR is on .PP Steps taken when enabling .RI ( i . e . setup for dialing in) .IP 1) check input arguments .IP 2) look in /etc/utmp to check that the line is not in use by another user .IP 3) make sure modem control on line is disabled .IP 4) turn off DTR to make sure line is hung up .IP 5) condition line: clear exclusive use and set hangup on close modes .IP 6) turn on modem control .IP 7) edit /etc/ttys, changing the first character of the appropriate line to 1 .IP 8) send a hangup to process 1 to poke init to enable getty .IP 9) clear uid name for /etc/utmp .SH HISTORY .PP First written by Allan Wilkes (fisher!allan) .PP Modified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel rather than use a kernel hack to turn on/off modem control, using a subroutine stolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu .PP Worked over many times by W.Sebok .RI ( i . e . hacked to death) .SH FILES -/dev/kmem, /vmunix, /etc/ttys, /etc/utmp, /dev/tty* +/dev/kmem, /kernel, /etc/ttys, /etc/utmp, /dev/tty* .SH BUGS .PP Sensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately this ioctl is not implemented in the vanilla 4.2 BSD dh driver even though the dz and dmf drivers use an emulation of the DH11's modem control bits. This has been fixed here. .PP Some time (currently 2 seconds) is required between disabling modem control and opening the device. This is probably because of a race with getty whose open is finally being allowed to complete. This time interval may not be enough on a loaded system. Because of this problem and the above problem with the dh driver there is deliberately no error message given when the TIOCMGET ioctl fails. .PP Previously there were similar synchronization problems with the init process. When dialins are disabled the capitalized name of the process cannot be posted into /etc/utmp until init has finished clearing /etc/utmp. However one does not know how long that will take, and, on a loaded system, it can take quite a while. This was solved by the strategy of 1) posting the name, 2) poking init, 3) going into a loop where the process repeatedly waits a second and checks whether the entry has been cleared from /etc/utmp, and 4) posting the name again. Index: head/usr.bin/vmstat/vmstat.8 =================================================================== --- head/usr.bin/vmstat/vmstat.8 (revision 1855) +++ head/usr.bin/vmstat/vmstat.8 (revision 1856) @@ -1,206 +1,206 @@ .\" Copyright (c) 1986, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 .\" .TH VMSTAT 1 "June 6, 1993" .UC 4 .SH NAME vmstat \- report virtual memory statistics .SH SYNOPSIS .nf .ft B vmstat [ \-fimst ] [ \-c count ] [ \-M core ] [ \-N system ] .ti +5 [ \-w wait ] [ disks ] .ft R .fi .SH DESCRIPTION .I Vmstat reports certain kernel statistics kept about process, virtual memory, disk, trap and cpu activity. .PP The options are as follows: .TP \-c Repeat the display .I count times. The first display is for the time since a reboot and each subsequent report is for the time period since the last display. If no .I wait interval is specified, the default is 1 second. .TP \-f Report on the number .IR fork (2) and .IR vfork (2) system calls since system startup, and the number of pages of virtual memory involved in each. .TP \-i Report on the number of interrupts taken by each device since system startup. .TP \-M Extract values associated with the name list from the specified core instead of the default ``/dev/kmem''. .TP \-N Extract the name list from the specified system instead of the default -``/vmunix''. +``/kernel''. .TP \-m Report on the usage of kernel dynamic memory listed first by size of allocation and then by type of usage. .TP \-s Display the contents of the .I sum structure, giving the total number of several kinds of paging related events which have occurred since system startup. .TP \-t Report on the number of page in and page reclaims since system startup, and the amount of time required by each. .TP \-w Pause .I wait seconds between each display. If no repeat .I count is specified, the default is infinity. .PP By default, .I vmstat displays the following information: .PP .TP procs Information about the numbers of processes in various states. .sp .RS .nf r in run queue b blocked for resources (i/o, paging, etc.) w runnable or short sleeper (< 20 secs) but swapped .fi .RE .TP memory Information about the usage of virtual and real memory. Virtual pages (reported in units of 1024 bytes) are considered active if they belong to processes which are running or have run in the last 20 seconds. .sp .RS .nf avm active virtual pages fre size of the free list .fi .RE .TP page Information about page faults and paging activity. These are averaged each five seconds, and given in units per second. .sp .RS .nf re page reclaims (simulating reference bits) at pages attached (found in free list) pi pages paged in po pages paged out fr pages freed per second de anticipated short term memory shortfall sr pages scanned by clock algorithm, per-second .fi .RE .TP disks Disk operations per second (this field is system dependent). Typically paging will be split across the available drives. The header of the field is the first character of the disk name and the unit number. If more than four disk drives are configured in the system, .I vmstat displays only the first four drives. To force .I vmstat to display specific drives, their names may be supplied on the command line. .TP faults Trap/interrupt rate averages per second over last 5 seconds. .sp .RS .nf in device interrupts per interval (including clock interrupts) sy system calls per interval cs cpu context switch rate (switches/interval) .fi .RE .TP cpu Breakdown of percentage usage of CPU time. .sp .RS .nf us user time for normal and low priority processes sy system time id cpu idle .fi .RE .SH EXAMPLES The command ``vmstat -i 5'' will print what the system is doing every five seconds; this is a good choice of printing interval since this is how often some of the statistics are sampled in the system. Others vary every second and running the output for a while will make it apparent which are recomputed every second. .SH FILES .ta \w'/dev/kmem 'u -/vmunix default kernel namelist +/kernel default kernel namelist .br /dev/kmem default memory file .SH SEE ALSO .IR fstat (1), .IR netstat (1), .IR nfsstat (1), .IR ps (1), .IR systat (1), .IR iostat (8), .IR pstat (8) .sp The sections starting with ``Interpreting system activity'' in .IR "Installing and Operating 4.3BSD" . .SH BUGS The \-c and \-w options are only available with the default output. Index: head/usr.bin/w/uptime.1 =================================================================== --- head/usr.bin/w/uptime.1 (revision 1855) +++ head/usr.bin/w/uptime.1 (revision 1856) @@ -1,60 +1,60 @@ .\" Copyright (c) 1980, 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. 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. .\" .\" @(#)uptime.1 8.2 (Berkeley) 4/18/94 .\" .Dd April 18, 1994 .Dt UPTIME 1 .Os BSD 3 .Sh NAME .Nm uptime .Nd show how long system has been running .Sh SYNOPSIS .Nm uptime .Sh DESCRIPTION The .Nm uptime utility displays the current time, the length of time the system has been up, the number of users, and the load average of the system over the last 1, 5, and 15 minutes. .Sh FILES -.Bl -tag -width /vmunix -.It Pa /vmunix +.Bl -tag -width /kernel +.It Pa /kernel system name list .El .Sh SEE ALSO .Xr w 1 .Sh HISTORY The .Nm command appeared in .Bx 3.0 . Index: head/usr.bin/w/w.1 =================================================================== --- head/usr.bin/w/w.1 (revision 1855) +++ head/usr.bin/w/w.1 (revision 1856) @@ -1,141 +1,141 @@ .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)w.1 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt W 1 .Os BSD 4 .Sh NAME .Nm w .Nd "who present users are and what they are doing" .Sh SYNOPSIS .Nm w .Op Fl hin .Op Fl M Ar core .Op Fl N Ar system .Op Ar user .Sh DESCRIPTION The .Nm w utility prints a summary of the current activity on the system, including what each user is doing. The first line displays the current time of day, how long the system has been running, the number of users logged into the system, and the load averages. The load average numbers give the number of jobs in the run queue averaged over 1, 5 and 15 minutes. .Pp The fields output are the user's login name, the name of the terminal the user is on, the host from which the user is logged in, the time the user logged on, the time since the user last typed anything, and the name and arguments of the current process. .Pp The options are as follows: .Bl -tag -width Ds .It Fl h Suppress the heading. .It Fl i Output is sorted by idle time. .It Fl M Extract values associated with the name list from the specified core instead of the default .Dq /dev/kmem . .It Fl N Extract the name list from the specified system instead of the default -.Dq /vmunix . +.Dq /kernel . .It Fl n Show network addresses as numbers (normally .Nm w interprets addresses and attempts to display them symbolically). .El .Pp If a .Ar user name is specified, the output is restricted to that user. .Sh FILES .Bl -tag -width /var/run/utmp -compact .It Pa /var/run/utmp list of users on the system .El .Sh SEE ALSO .Xr who 1 , .Xr finger 1 , .Xr ps 1 , .Xr uptime 1 , .Sh BUGS The notion of the .Dq current process is muddy. The current algorithm is ``the highest numbered process on the terminal that is not ignoring interrupts, or, if there is none, the highest numbered process on the terminal''. This fails, for example, in critical sections of programs like the shell and editor, or when faulty programs running in the background fork and fail to ignore interrupts. (In cases where no process can be found, .Nm w prints .Dq \- . ) .Pp The .Tn CPU time is only an estimate, in particular, if someone leaves a background process running after logging out, the person currently on that terminal is .Dq charged with the time. .Pp Background processes are not shown, even though they account for much of the load on the system. .Pp Sometimes processes, typically those in the background, are printed with null or garbaged arguments. In these cases, the name of the command is printed in parentheses. .Pp The .Nm w utility does not know about the new conventions for detection of background jobs. It will sometimes find a background job instead of the right one. .Sh COMPATIBILITY The .Fl f , .Fl l , .Fl s , and .Fl w flags are no longer supported. .Sh HISTORY The .Nm command appeared in .Ux 3.0 . Index: head/usr.sbin/XNSrouted/defs.h =================================================================== --- head/usr.sbin/XNSrouted/defs.h (revision 1855) +++ head/usr.sbin/XNSrouted/defs.h (revision 1856) @@ -1,94 +1,94 @@ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)defs.h 8.1 (Berkeley) 6/5/93 */ #include #include #include #include #include #if defined(vax) || defined(pdp11) #define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] ) #else #define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] ) #endif #define IDPPORT_RIF 1 #include #include #include "protocol.h" #include "trace.h" #include "interface.h" #include "table.h" #include "af.h" /* * When we find any interfaces marked down we rescan the * kernel every CHECK_INTERVAL seconds to see if they've * come up. */ #define CHECK_INTERVAL (5*60) #define equal(a1, a2) \ (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) #define min(a,b) ((a)>(b)?(b):(a)) struct sockaddr_ns addr; /* Daemon's Address */ int s; /* Socket to listen on */ int kmem; int supplier; /* process should supply updates */ int install; /* if 1 call kernel */ int lookforinterfaces; /* if 1 probe kernel for new up interfaces */ -int performnlist; /* if 1 check if /vmunix has changed */ +int performnlist; /* if 1 check if /kernel has changed */ int externalinterfaces; /* # of remote and local interfaces */ int timeval; /* local idea of time */ int noteremoterequests; /* squawk on requests from non-local nets */ int r; /* Routing socket to install updates with */ struct sockaddr_ns ns_netmask; /* Used in installing routes */ char packet[MAXPACKETSIZE+sizeof(struct idp)+1]; struct rip *msg; char **argv0; int sndmsg(); int supply(); int cleanup(); int rtioctl(); #define ADD 1 #define DELETE 2 #define CHANGE 3 Index: head/usr.sbin/bad144/bad144.8 =================================================================== --- head/usr.sbin/bad144/bad144.8 (revision 1855) +++ head/usr.sbin/bad144/bad144.8 (revision 1856) @@ -1,186 +1,186 @@ .\" Copyright (c) 1980, 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)bad144.8 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt BAD144 8 .Os BSD 4 .Sh NAME .Nm bad144 .Nd read/write dec standard 144 bad sector information .Sh SYNOPSIS .Nm bad144 .Op Fl c .Op Fl f .Op Fl v .Ar disk .Oo .Ar sno .Op Ar bad ... .Oc .Nm bad144 .Fl a .Op Fl c .Op Fl f .Op Fl v .Ar disk .Op Ar bad ... .Sh DESCRIPTION .Nm Bad144 can be used to inspect the information stored on a disk that is used by the disk drivers to implement bad sector forwarding. .Pp Available options: .Pp .Bl -tag -width Ds .It Fl a The argument list consists of new bad sectors to be added to an existing list. The new sectors are sorted into the list, which must have been in order. Replacement sectors are moved to accommodate the additions; the new replacement sectors are cleared. .It Fl c Forces an attempt to copy the old sector to the replacement, and may be useful when replacing an unreliable sector. .It Fl f For a RP06, RM03, RM05, Fujitsu Eagle, or .Tn SMD disk on a Massbus, the .Fl f option may be used to mark the new bad sectors as ``bad'' by reformatting them as unusable sectors. This option is .Em required unless the sectors have already been marked bad, or the system will not be notified that it should use the replacement sector. This option may be used while running multiuser; it is no longer necessary to perform format operations while running single-user. .It Fl v The entire process is described as it happens in gory detail if .Fl v (verbose) is given. .El .Pp The format of the information is specified by .Tn DEC standard 144, as follows. The bad sector information is located in the first 5 even numbered sectors of the last track of the disk pack. There are five identical copies of the information, described by the .Ar dkbad structure. .Pp Replacement sectors are allocated starting with the first sector before the bad sector information and working backwards towards the beginning of the disk. A maximum of 126 bad sectors are supported. The position of the bad sector in the bad sector table determines the replacement sector to which it corresponds. The bad sectors must be listed in ascending order. .Pp The bad sector information and replacement sectors are conventionally only accessible through the ``c'' file system partition of the disk. If that partition is used for a file system, the user is responsible for making sure that it does not overlap the bad sector information or any replacement sectors. Thus, one track plus 126 sectors must be reserved to allow use of all of the possible bad sector replacements. .Pp The bad sector structure is as follows: .Bd -literal struct dkbad { long bt_csn; /* cartridge serial number */ u_short bt_mbz; /* unused; should be 0 */ u_short bt_flag; /* -1 => alignment cartridge */ struct bt_bad { u_short bt_cyl; /* bad sector cylinder number */ u_short bt_trksec; /* track and sector number */ } bt_bad[126]; }; .Ed .Pp Unused slots in the .Ar bt_bad array are filled with all bits set, a putatively illegal value. .Pp .Nm Bad144 is invoked by giving a device name (e.g. hk0, hp1, etc.). With no optional arguments it reads the first sector of the last track of the corresponding disk and prints out the bad sector information. It issues a warning if the bad sectors are out of order. .Nm Bad144 may also be invoked with a serial number for the pack and a list of bad sectors. It will write the supplied information into all copies of the bad-sector file, replacing any previous information. Note, however, that .Nm bad144 does not arrange for the specified sectors to be marked bad in this case. This procedure should only be used to restore known bad sector information which was destroyed. .Pp It is no longer necessary to reboot to allow the kernel to reread the bad-sector table from the drive. .Sh SEE ALSO .Xr badsect 8 , .Xr format 8 .Sh BUGS It should be possible to format disks on-line under .Tn UNIX . .Pp It should be possible to mark bad sectors on drives of all type. .Pp On an 11/750, the standard bootstrap drivers used to boot the system do not understand bad sectors, handle .Tn ECC errors, or the special .Tn SSE (skip sector) errors of RM80-type disks. This means that none of these errors can occur when reading the file -.Pa /vmunix +.Pa /kernel to boot. Sectors 0-15 of the disk drive must also not have any of these errors. .Pp The drivers which write a system core image on disk after a crash do not handle errors; thus the crash dump area must be free of errors and bad sectors. .Sh HISTORY The .Nm command appeared in .Bx 4.1 . Index: head/usr.sbin/config/SMM.doc/3.t =================================================================== --- head/usr.sbin/config/SMM.doc/3.t (revision 1855) +++ head/usr.sbin/config/SMM.doc/3.t (revision 1856) @@ -1,299 +1,299 @@ .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)3.t 8.1 (Berkeley) 6/8/93 .\" .\".ds RH "System Building Process .ne 2i .NH SYSTEM BUILDING PROCESS .PP In this section we consider the steps necessary to build a bootable system image. We assume the system source is located in the ``/sys'' directory and that, initially, the system is being configured from source code. .PP Under normal circumstances there are 5 steps in building a system. .IP 1) 3 Create a configuration file for the system. .IP 2) 3 Make a directory for the system to be constructed in. .IP 3) 3 Run .I config on the configuration file to generate the files required to compile and load the system image. .IP 4) Construct the source code interdependency rules for the configured system with .I make depend using .IR make (1). .IP 5) Compile and load the system with .IR make . .PP Steps 1 and 2 are usually done only once. When a system configuration changes it usually suffices to just run .I config on the modified configuration file, rebuild the source code dependencies, and remake the system. Sometimes, however, configuration dependencies may not be noticed in which case it is necessary to clean out the relocatable object files saved in the system's directory; this will be discussed later. .NH 2 Creating a configuration file .PP Configuration files normally reside in the directory ``/sys/conf''. A configuration file is most easily constructed by copying an existing configuration file and modifying it. The 4.4BSD distribution contains a number of configuration files for machines at Berkeley; one may be suitable or, in worst case, a copy of the generic configuration file may be edited. .PP The configuration file must have the same name as the directory in which the configured system is to be built. Further, .I config assumes this directory is located in the parent directory of the directory in which it is run. For example, the generic system has a configuration file ``/sys/conf/GENERIC'' and an accompanying directory named ``/sys/GENERIC''. Although it is not required that the system sources and configuration files reside in ``/sys,'' the configuration and compilation procedure depends on the relative locations of directories within that hierarchy, as most of the system code and the files created by .I config use pathnames of the form ``../''. If the system files are not located in ``/sys,'' it is desirable to make a symbolic link there for use in installation of other parts of the system that share files with the kernel. .PP When building the configuration file, be sure to include the items described in section 2. In particular, the machine type, cpu type, timezone, system identifier, maximum users, and root device must be specified. The specification of the hardware present may take a bit of work; particularly if your hardware is configured at non-standard places (e.g. device registers located at funny places or devices not supported by the system). Section 4 of this document gives a detailed description of the configuration file syntax, section 5 explains some sample configuration files, and section 6 discusses how to add new devices to the system. If the devices to be configured are not already described in one of the existing configuration files you should check the manual pages in section 4 of the UNIX Programmers Manual. For each supported device, the manual page synopsis entry gives a sample configuration line. .PP Once the configuration file is complete, run it through .I config and look for any errors. Never try and use a system which .I config has complained about; the results are unpredictable. For the most part, .IR config 's error diagnostics are self explanatory. It may be the case that the line numbers given with the error messages are off by one. .PP A successful run of .I config on your configuration file will generate a number of files in the configuration directory. These files are: .IP \(bu 3 A file to be used by \fImake\fP\|(1) in compiling and loading the system, .IR Makefile . .IP \(bu 3 One file for each possible system image for this machine, .IR swapxxx.c , where .I xxx is the name of the system image, which describes where swapping, the root file system, and other miscellaneous system devices are located. .IP \(bu 3 A collection of header files, one per possible device the system supports, which define the hardware configured. .IP \(bu 3 A file containing the I/O configuration tables used by the system during its .I autoconfiguration phase, .IR ioconf.c . .IP \(bu 3 An assembly language file of interrupt vectors which connect interrupts from the machine's external buses to the main system path for handling interrupts, and a file that contains counters and names for the interrupt vectors. .PP Unless you have reason to doubt .IR config , or are curious how the system's autoconfiguration scheme works, you should never have to look at any of these files. .NH 2 Constructing source code dependencies .PP When .I config is done generating the files needed to compile and link your system it will terminate with a message of the form ``Don't forget to run make depend''. This is a reminder that you should change over to the configuration directory for the system just configured and type ``make depend'' to build the rules used by .I make to recognize interdependencies in the system source code. This will insure that any changes to a piece of the system source code will result in the proper modules being recompiled the next time .I make is run. .PP This step is particularly important if your site makes changes to the system include files. The rules generated specify which source code files are dependent on which include files. Without these rules, .I make will not recognize when it must rebuild modules due to the modification of a system header file. The dependency rules are generated by a pass of the C preprocessor and reflect the global system options. This step must be repeated when the configuration file is changed and .I config is used to regenerate the system makefile. .NH 2 Building the system .PP The makefile constructed by .I config should allow a new system to be rebuilt by simply typing ``make image-name''. -For example, if you have named your bootable system image ``vmunix'', -then ``make vmunix'' -will generate a bootable image named ``vmunix''. Alternate system image names +For example, if you have named your bootable system image ``kernel'', +then ``make kernel'' +will generate a bootable image named ``kernel''. Alternate system image names are used when the root file system location and/or swapping configuration is done in more than one way. The makefile which .I config creates has entry points for each system image defined in the configuration file. -Thus, if you have configured ``vmunix'' to be a system with the root file -system on an ``hp'' device and ``hkvmunix'' to be a system with the root -file system on an ``hk'' device, then ``make vmunix hkvmunix'' will generate +Thus, if you have configured ``kernel'' to be a system with the root file +system on an ``hp'' device and ``hkkernel'' to be a system with the root +file system on an ``hk'' device, then ``make kernel hkkernel'' will generate binary images for each. As the system will generally use the disk from which it is loaded as the root filesystem, separate system images are only required to support different swap configurations. .PP Note that the name of a bootable image is different from the system identifier. All bootable images are configured for the same system; only the information about the root file system and paging devices differ. (This is described in more detail in section 4.) .PP The last step in the system building process is to rearrange certain commonly used symbols in the symbol table of the system image; the makefile generated by .I config does this automatically for you. This is advantageous for programs such as \fInetstat\fP\|(1) and \fIvmstat\fP\|(1), which run much faster when the symbols they need are located at the front of the symbol table. Remember also that many programs expect -the currently executing system to be named ``/vmunix''. If you install -a new system and name it something other than ``/vmunix'', many programs +the currently executing system to be named ``/kernel''. If you install +a new system and name it something other than ``/kernel'', many programs are likely to give strange results. .NH 2 Sharing object modules .PP If you have many systems which are all built on a single machine there are at least two approaches to saving time in building system images. The best way is to have a single system image which is run on all machines. This is attractive since it minimizes disk space used and time required to rebuild systems after making changes. However, it is often the case that one or more systems will require a separately configured system image. This may be due to limited memory (building a system with many unused device drivers can be expensive), or to configuration requirements (one machine may be a development machine where disk quotas are not needed, while another is a production machine where they are), etc. In these cases it is possible for common systems to share relocatable object modules which are not configuration dependent; most of the modules in the directory ``/sys/sys'' are of this sort. .PP To share object modules, a generic system should be built. Then, for each system configure the system as before, but before recompiling and linking the system, type ``make links'' in the system compilation directory. This will cause the system to be searched for source modules which are safe to share between systems and generate symbolic links in the current directory to the appropriate object modules in the directory ``../GENERIC''. A shell script, ``makelinks'' is generated with this request and may be checked for correctness. The file ``/sys/conf/defines'' contains a list of symbols which we believe are safe to ignore when checking the source code for modules which may be shared. Note that this list includes the definitions used to conditionally compile in the virtual memory tracing facilities, and the trace point support used only rarely (even at Berkeley). It may be necessary to modify this file to reflect local needs. Note further that interdependencies which are not directly visible in the source code are not caught. This means that if you place per-system dependencies in an include file, they will not be recognized and the shared code may be selected in an unexpected fashion. .NH 2 Building profiled systems .PP It is simple to configure a system which will automatically collect profiling information as it operates. The profiling data may be collected with \fIkgmon\fP\|(8) and processed with \fIgprof\fP\|(1) to obtain information regarding the system's operation. Profiled systems maintain histograms of the program counter as well as the number of invocations of each routine. The \fIgprof\fP command will also generate a dynamic call graph of the executing system and propagate time spent in each routine along the arcs of the call graph (consult the \fIgprof\fP documentation for elaboration). The program counter sampling can be driven by the system clock, or if you have an alternate real time clock, this can be used. The latter is highly recommended, as use of the system clock will result in statistical anomalies, and time spent in the clock routine will not be accurately attributed. .PP To configure a profiled system, the .B \-p option should be supplied to \fIconfig\fP. A profiled system is about 5-10% larger in its text space due to the calls to count the subroutine invocations. When the system executes, the profiling data is stored in a buffer which is 1.2 times the size of the text space. The overhead for running a profiled system varies; under normal load we see anywhere from 5-25% of the system time spent in the profiling code. .PP Note that systems configured for profiling should not be shared as described above unless all the other shared systems are also to be profiled. Index: head/usr.sbin/config/SMM.doc/4.t =================================================================== --- head/usr.sbin/config/SMM.doc/4.t (revision 1855) +++ head/usr.sbin/config/SMM.doc/4.t (revision 1856) @@ -1,442 +1,442 @@ .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)4.t 8.1 (Berkeley) 6/8/93 .\" .\".ds RH "Configuration File Syntax .ne 2i .NH CONFIGURATION FILE SYNTAX .PP In this section we consider the specific rules used in writing a configuration file. A complete grammar for the input language can be found in Appendix A and may be of use if you should have problems with syntax errors. .PP A configuration file is broken up into three logical pieces: .IP \(bu 3 configuration parameters global to all system images specified in the configuration file, .IP \(bu 3 parameters specific to each system image to be generated, and .IP \(bu 3 device specifications. .NH 2 Global configuration parameters .PP The global configuration parameters are the type of machine, cpu types, options, timezone, system identifier, and maximum users. Each is specified with a separate line in the configuration file. .IP "\fBmachine\fP \fItype\fP" .br The system is to run on the machine type specified. No more than one machine type can appear in the configuration file. Legal values are .B vax and \fBsun\fP. .IP "\fBcpu\fP ``\fItype\fP''" .br This system is to run on the cpu type specified. More than one cpu type specification can appear in a configuration file. Legal types for a .B vax machine are \fBVAX8600\fP, \fBVAX780\fP, \fBVAX750\fP, \fBVAX730\fP and \fBVAX630\fP (MicroVAX II). The 8650 is listed as an 8600, the 785 as a 780, and a 725 as a 730. .IP "\fBoptions\fP \fIoptionlist\fP" .br Compile the listed optional code into the system. Options in this list are separated by commas. Possible options are listed at the top of the generic makefile. A line of the form ``options FUNNY,HAHA'' generates global ``#define''s \-DFUNNY \-DHAHA in the resultant makefile. An option may be given a value by following its name with ``\fB=\fP'', then the value enclosed in (double) quotes. The following are major options are currently in use: COMPAT (include code for compatibility with 4.1BSD binaries), INET (Internet communication protocols), NS (Xerox NS communication protocols), and QUOTA (enable disk quotas). Other kernel options controlling system sizes and limits are listed in Appendix D; options for the network are found in Appendix E. There are additional options which are associated with certain peripheral devices; those are listed in the Synopsis section of the manual page for the device. .IP "\fBmakeoptions\fP \fIoptionlist\fP" .br Options that are used within the system makefile and evaluated by .I make are listed as .IR makeoptions . Options are listed with their values with the form ``makeoptions name=value,name2=value2.'' The values must be enclosed in double quotes if they include numerals or begin with a dash. .IP "\fBtimezone\fP \fInumber\fP [ \fBdst\fP [ \fInumber\fP ] ]" .br Specifies the timezone used by the system. This is measured in the number of hours your timezone is west of GMT. EST is 5 hours west of GMT, PST is 8. Negative numbers indicate hours east of GMT. If you specify \fBdst\fP, the system will operate under daylight savings time. An optional integer or floating point number may be included to specify a particular daylight saving time correction algorithm; the default value is 1, indicating the United States. Other values are: 2 (Australian style), 3 (Western European), 4 (Middle European), and 5 (Eastern European). See \fIgettimeofday\fP\|(2) and \fIctime\fP\|(3) for more information. .IP "\fBident\fP \fIname\fP" .br This system is to be known as .IR name . This is usually a cute name like ERNIE (short for Ernie Co-Vax) or VAXWELL (for Vaxwell Smart). This value is defined for use in conditional compilation, and is also used to locate an optional list of source files specific to this system. .IP "\fBmaxusers\fP \fInumber\fP" .br The maximum expected number of simultaneously active user on this system is .IR number . This number is used to size several system data structures. .NH 2 System image parameters .PP Multiple bootable images may be specified in a single configuration file. The systems will have the same global configuration parameters and devices, but the location of the root file system and other system specific devices may be different. A system image is specified with a ``config'' line: .IP \fBconfig\fP\ \fIsysname\fP\ \fIconfig-clauses\fP .LP The .I sysname field is the name given to the loaded system image; almost everyone -names their standard system image ``vmunix''. The configuration clauses +names their standard system image ``kernel''. The configuration clauses are one or more specifications indicating where the root file system is located and the number and location of paging devices. The device used by the system to process argument lists during .IR execve (2) calls may also be specified, though in practice this is almost always selected by .I config using one of its rules for selecting default locations for system devices. .PP A configuration clause is one of the following .IP .nf \fBroot\fP [ \fBon\fP ] \fIroot-device\fP \fBswap\fP [ \fBon\fP ] \fIswap-device\fP [ \fBand\fP \fIswap-device\fP ] ... \fBdumps\fP [ \fBon\fP ] \fIdump-device\fP \fBargs\fP [ \fBon\fP ] \fIarg-device\fP .LP (the ``on'' is optional.) Multiple configuration clauses are separated by white space; .I config allows specifications to be continued across multiple lines by beginning the continuation line with a tab character. The ``root'' clause specifies where the root file system is located, the ``swap'' clause indicates swapping and paging area(s), the ``dumps'' clause can be used to force system dumps to be taken on a particular device, and the ``args'' clause can be used to specify that argument list processing for .I execve should be done on a particular device. .PP The device names supplied in the clauses may be fully specified as a device, unit, and file system partition; or underspecified in which case .I config will use builtin rules to select default unit numbers and file system partitions. The defaulting rules are a bit complicated as they are dependent on the overall system configuration. For example, the swap area need not be specified at all if the root device is specified; in this case the swap area is placed in the ``b'' partition of the same disk where the root file system is located. Appendix B contains a complete list of the defaulting rules used in selecting system configuration devices. .PP The device names are translated to the appropriate major and minor device numbers on a per-machine basis. A file, ``/sys/conf/devices.machine'' (where ``machine'' is the machine type specified in the configuration file), is used to map a device name to its major block device number. The minor device number is calculated using the standard disk partitioning rules: on unit 0, partition ``a'' is minor device 0, partition ``b'' is minor device 1, and so on; for units other than 0, add 8 times the unit number to get the minor device. .PP If the default mapping of device name to major/minor device number is incorrect for your configuration, it can be replaced by an explicit specification of the major/minor device. This is done by substituting .IP \fBmajor\fP \fIx\fP \fBminor\fP \fIy\fP .LP where the device name would normally be found. For example, .IP .nf -\fBconfig\fP vmunix \fBroot\fP \fBon\fP \fBmajor\fP 99 \fBminor\fP 1 +\fBconfig\fP kernel \fBroot\fP \fBon\fP \fBmajor\fP 99 \fBminor\fP 1 .fi .PP Normally, the areas configured for swap space are sized by the system at boot time. If a non-standard size is to be used for one or more swap areas (less than the full partition), this can also be specified. To do this, the device name specified for a swap area should have a ``size'' specification appended. For example, .IP .nf -\fBconfig\fP vmunix \fBroot\fP \fBon\fP hp0 \fBswap\fP \fBon\fP hp0b \fBsize\fP 1200 +\fBconfig\fP kernel \fBroot\fP \fBon\fP hp0 \fBswap\fP \fBon\fP hp0b \fBsize\fP 1200 .fi .LP would force swapping to be done in partition ``b'' of ``hp0'' and the swap partition size would be set to 1200 sectors. A swap area sized larger than the associated disk partition is trimmed to the partition size. .PP To create a generic configuration, only the clause ``swap generic'' should be specified; any extra clauses will cause an error. .NH 2 Device specifications .PP Each device attached to a machine must be specified to .I config so that the system generated will know to probe for it during the autoconfiguration process carried out at boot time. Hardware specified in the configuration need not actually be present on the machine where the generated system is to be run. Only the hardware actually found at boot time will be used by the system. .PP The specification of hardware devices in the configuration file parallels the interconnection hierarchy of the machine to be configured. On the VAX, this means that a configuration file must indicate what MASSBUS and UNIBUS adapters are present, and to which \fInexi\fP they might be connected.* .FS * While VAX-11/750's and VAX-11/730 do not actually have nexi, the system treats them as having .I "simulated nexi" to simplify device configuration. .FE Similarly, devices and controllers must be indicated as possibly being connected to one or more adapters. A device description may provide a complete definition of the possible configuration parameters or it may leave certain parameters undefined and make the system probe for all the possible values. The latter allows a single device configuration list to match many possible physical configurations. For example, a disk may be indicated as present at UNIBUS adapter 0, or at any UNIBUS adapter which the system locates at boot time. The latter scheme, termed .IR wildcarding , allows more flexibility in the physical configuration of a system; if a disk must be moved around for some reason, the system will still locate it at the alternate location. .PP A device specification takes one of the following forms: .IP .nf \fBmaster\fP \fIdevice-name\fP \fIdevice-info\fP \fBcontroller\fP \fIdevice-name\fP \fIdevice-info\fP [ \fIinterrupt-spec\fP ] \fBdevice\fP \fIdevice-name\fP \fIdevice-info\fP \fIinterrupt-spec\fP \fBdisk\fP \fIdevice-name\fP \fIdevice-info\fP \fBtape\fP \fIdevice-name\fP \fIdevice-info\fP .fi .LP A ``master'' is a MASSBUS tape controller; a ``controller'' is a disk controller, a UNIBUS tape controller, a MASSBUS adapter, or a UNIBUS adapter. A ``device'' is an autonomous device which connects directly to a UNIBUS adapter (as opposed to something like a disk which connects through a disk controller). ``Disk'' and ``tape'' identify disk drives and tape drives connected to a ``controller'' or ``master.'' .PP The .I device-name is one of the standard device names, as indicated in section 4 of the UNIX Programmers Manual, concatenated with the .I logical unit number to be assigned the device (the .I logical unit number may be different than the .I physical unit number indicated on the front of something like a disk; the .I logical unit number is used to refer to the UNIX device, not the physical unit number). For example, ``hp0'' is logical unit 0 of a MASSBUS storage device, even though it might be physical unit 3 on MASSBUS adapter 1. .PP The .I device-info clause specifies how the hardware is connected in the interconnection hierarchy. On the VAX, UNIBUS and MASSBUS adapters are connected to the internal system bus through a \fInexus\fP. Thus, one of the following specifications would be used: .IP .ta 1.5i 2.5i 4.0i .nf \fBcontroller\fP mba0 \fBat\fP \fBnexus\fP \fIx\fP \fBcontroller\fP uba0 \fBat\fP \fBnexus\fP \fIx\fP .fi .LP To tie a controller to a specific nexus, ``x'' would be supplied as the number of that nexus; otherwise ``x'' may be specified as ``?'', in which case the system will probe all nexi present looking for the specified controller. .PP The remaining interconnections on the VAX are: .IP \(bu 3 a controller may be connected to another controller (e.g. a disk controller attached to a UNIBUS adapter), .IP \(bu 3 a master is always attached to a controller (a MASSBUS adapter), .IP \(bu 3 a tape is always attached to a master (for MASSBUS tape drives), .IP \(bu 3 a disk is always attached to a controller, and .IP \(bu 3 devices are always attached to controllers (e.g. UNIBUS controllers attached to UNIBUS adapters). .LP The following lines give an example of each of these interconnections: .IP .ta 1.5i 2.5i 4.0i .nf \fBcontroller\fP hk0 \fBat\fP uba0 ... \fBmaster\fP ht0 \fBat\fP mba0 ... \fBdisk\fP hp0 \fBat\fP mba0 ... \fBtape\fP tu0 \fBat\fP ht0 ... \fBdisk\fP rk1 \fBat\fP hk0 ... \fBdevice\fP dz0 \fBat\fP uba0 ... .fi .LP Any piece of hardware which may be connected to a specific controller may also be wildcarded across multiple controllers. .PP The final piece of information needed by the system to configure devices is some indication of where or how a device will interrupt. For tapes and disks, simply specifying the \fIslave\fP or \fIdrive\fP number is sufficient to locate the control status register for the device. \fIDrive\fP numbers may be wildcarded on MASSBUS devices, but not on disks on a UNIBUS controller. For controllers, the control status register must be given explicitly, as well the number of interrupt vectors used and the names of the routines to which they should be bound. Thus the example lines given above might be completed as: .IP .ta 1.5i 2.5i 4.0i .nf \fBcontroller\fP hk0 \fBat\fP uba0 \fBcsr\fP 0177440 \fBvector\fP rkintr \fBmaster\fP ht0 \fBat\fP mba0 \fBdrive\fP 0 \fBdisk\fP hp0 \fBat\fP mba0 \fBdrive\fP ? \fBtape\fP tu0 \fBat\fP ht0 \fBslave\fP 0 \fBdisk\fP rk1 \fBat\fP hk0 \fBdrive\fP 1 \fBdevice\fP dz0 \fBat\fP uba0 \fBcsr\fP 0160100 \fBvector\fP dzrint dzxint .fi .PP Certain device drivers require extra information passed to them at boot time to tailor their operation to the actual hardware present. The line printer driver, for example, needs to know how many columns are present on each non-standard line printer (i.e. a line printer with other than 80 columns). The drivers for the terminal multiplexors need to know which lines are attached to modem lines so that no one will be allowed to use them unless a connection is present. For this reason, one last parameter may be specified to a .IR device , a .I flags field. It has the syntax .IP \fBflags\fP \fInumber\fP .LP and is usually placed after the .I csr specification. The .I number is passed directly to the associated driver. The manual pages in section 4 should be consulted to determine how each driver uses this value (if at all). Communications interface drivers commonly use the flags to indicate whether modem control signals are in use. .PP The exact syntax for each specific device is given in the Synopsis section of its manual page in section 4 of the manual. .NH 2 Pseudo-devices .PP A number of drivers and software subsystems are treated like device drivers without any associated hardware. To include any of these pieces, a ``pseudo-device'' specification must be used. A specification for a pseudo device takes the form .IP .DT .nf \fBpseudo-device\fP \fIdevice-name\fP [ \fIhowmany\fP ] .fi .PP Examples of pseudo devices are \fBpty\fP, the pseudo terminal driver (where the optional .I howmany value indicates the number of pseudo terminals to configure, 32 default), and \fBloop\fP, the software loopback network pseudo-interface. Other pseudo devices for the network include \fBimp\fP (required when a CSS or ACC imp is configured) and \fBether\fP (used by the Address Resolution Protocol on 10 Mb/sec Ethernets). More information on configuring each of these can also be found in section 4 of the manual. Index: head/usr.sbin/config/SMM.doc/5.t =================================================================== --- head/usr.sbin/config/SMM.doc/5.t (revision 1855) +++ head/usr.sbin/config/SMM.doc/5.t (revision 1856) @@ -1,271 +1,271 @@ .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)5.t 8.1 (Berkeley) 6/8/93 .\" .\".ds RH "Sample Configuration Files .ne 2i .NH SAMPLE CONFIGURATION FILES .PP In this section we will consider how to configure a sample VAX-11/780 system on which the hardware can be reconfigured to guard against various hardware mishaps. We then study the rules needed to configure a VAX-11/750 to run in a networking environment. .NH 2 VAX-11/780 System .PP Our VAX-11/780 is configured with hardware recommended in the document ``Hints on Configuring a VAX for 4.2BSD'' (this is one of the high-end configurations). Table 1 lists the pertinent hardware to be configured. .DS B .TS box; l | l | l | l | l l | l | l | l | l. Item Vendor Connection Name Reference _ cpu DEC VAX780 MASSBUS controller Emulex nexus ? mba0 hp(4) disk Fujitsu mba0 hp0 disk Fujitsu mba0 hp1 MASSBUS controller Emulex nexus ? mba1 disk Fujitsu mba1 hp2 disk Fujitsu mba1 hp3 UNIBUS adapter DEC nexus ? tape controller Emulex uba0 tm0 tm(4) tape drive Kennedy tm0 te0 tape drive Kennedy tm0 te1 terminal multiplexor Emulex uba0 dh0 dh(4) terminal multiplexor Emulex uba0 dh1 terminal multiplexor Emulex uba0 dh2 .TE .DE .ce Table 1. VAX-11/780 Hardware support. .LP We will call this machine ANSEL and construct a configuration file one step at a time. .PP The first step is to fill in the global configuration parameters. The machine is a VAX, so the .I "machine type" is ``vax''. We will assume this system will run only on this one processor, so the .I "cpu type" is ``VAX780''. The options are empty since this is going to be a ``vanilla'' VAX. The system identifier, as mentioned before, is ``ANSEL,'' and the maximum number of users we plan to support is about 40. Thus the beginning of the configuration file looks like this: .DS .ta 1.5i 2.5i 4.0i # # ANSEL VAX (a picture perfect machine) # machine vax cpu VAX780 timezone 8 dst ident ANSEL maxusers 40 .DE .PP To this we must then add the specifications for three system images. The first will be our standard system with the root on ``hp0'' and swapping on the same drive as the root. The second will have the root file system in the same location, but swap space interleaved among drives on each controller. Finally, the third will be a generic system, to allow us to boot off any of the four disk drives. .DS .ta 1.5i 2.5i -config vmunix root on hp0 -config hpvmunix root on hp0 swap on hp0 and hp2 -config genvmunix swap generic +config kernel root on hp0 +config hpkernel root on hp0 swap on hp0 and hp2 +config genkernel swap generic .DE .PP Finally, the hardware must be specified. Let us first just try transcribing the information from Table 1. .DS .ta 1.5i 2.5i 4.0i controller mba0 at nexus ? disk hp0 at mba0 disk 0 disk hp1 at mba0 disk 1 controller mba1 at nexus ? disk hp2 at mba1 disk 2 disk hp3 at mba1 disk 3 controller uba0 at nexus ? controller tm0 at uba0 csr 0172520 vector tmintr tape te0 at tm0 drive 0 tape te1 at tm0 drive 1 device dh0 at uba0 csr 0160020 vector dhrint dhxint device dm0 at uba0 csr 0170500 vector dmintr device dh1 at uba0 csr 0160040 vector dhrint dhxint device dh2 at uba0 csr 0160060 vector dhrint dhxint .DE .LP (Oh, I forgot to mention one panel of the terminal multiplexor has modem control, thus the ``dm0'' device.) .PP This will suffice, but leaves us with little flexibility. Suppose our first disk controller were to break. We would like to recable the drives normally on the second controller so that all our disks could still be used without reconfiguring the system. To do this we wildcard the MASSBUS adapter connections and also the slave numbers. Further, we wildcard the UNIBUS adapter connections in case we decide some time in the future to purchase another adapter to offload the single UNIBUS we currently have. The revised device specifications would then be: .DS .ta 1.5i 2.5i 4.0i controller mba0 at nexus ? disk hp0 at mba? disk ? disk hp1 at mba? disk ? controller mba1 at nexus ? disk hp2 at mba? disk ? disk hp3 at mba? disk ? controller uba0 at nexus ? controller tm0 at uba? csr 0172520 vector tmintr tape te0 at tm0 drive 0 tape te1 at tm0 drive 1 device dh0 at uba? csr 0160020 vector dhrint dhxint device dm0 at uba? csr 0170500 vector dmintr device dh1 at uba? csr 0160040 vector dhrint dhxint device dh2 at uba? csr 0160060 vector dhrint dhxint .DE .LP The completed configuration file for ANSEL is shown in Appendix C. .NH 2 VAX-11/750 with network support .PP Our VAX-11/750 system will be located on two 10Mb/s Ethernet local area networks and also the DARPA Internet. The system will have a MASSBUS drive for the root file system and two UNIBUS drives. Paging is interleaved among all three drives. We have sold our standard DEC terminal multiplexors since this machine will be accessed solely through the network. This machine is not intended to have a large user community, it does not have a great deal of memory. First the global parameters: .DS .ta 1.5i 2.5i 4.0i # # UCBVAX (Gateway to the world) # machine vax cpu "VAX780" cpu "VAX750" ident UCBVAX timezone 8 dst maxusers 32 options INET options NS .DE .PP The multiple cpu types allow us to replace UCBVAX with a more powerful cpu without reconfiguring the system. The value of 32 given for the maximum number of users is done to force the system data structures to be over-allocated. That is desirable on this machine because, while it is not expected to support many users, it is expected to perform a great deal of work. The ``INET'' indicates that we plan to use the DARPA standard Internet protocols on this machine, and ``NS'' also includes support for Xerox NS protocols. Note that unlike 4.2BSD configuration files, the network protocol options do not require corresponding pseudo devices. .PP The system images and disks are configured next. .DS .ta 1.5i 2.5i 4.0i -config vmunix root on hp swap on hp and rk0 and rk1 -config upvmunix root on up -config hkvmunix root on hk swap on rk0 and rk1 +config kernel root on hp swap on hp and rk0 and rk1 +config upkernel root on up +config hkkernel root on hk swap on rk0 and rk1 controller mba0 at nexus ? controller uba0 at nexus ? disk hp0 at mba? drive 0 disk hp1 at mba? drive 1 controller sc0 at uba? csr 0176700 vector upintr disk up0 at sc0 drive 0 disk up1 at sc0 drive 1 controller hk0 at uba? csr 0177440 vector rkintr disk rk0 at hk0 drive 0 disk rk1 at hk0 drive 1 .DE .PP UCBVAX requires heavy interleaving of its paging area to keep up with all the mail traffic it handles. The limiting factor on this system's performance is usually the number of disk arms, as opposed to memory or cpu cycles. The extra UNIBUS controller, ``sc0'', is in case the MASSBUS controller breaks and a spare controller must be installed (most of our old UNIBUS controllers have been replaced with the newer MASSBUS controllers, so we have a number of these around as spares). .PP Finally, we add in the network devices. Pseudo terminals are needed to allow users to log in across the network (remember the only hardwired terminal is the console). The software loopback device is used for on-machine communications. The connection to the Internet is through an IMP, this requires yet another .I pseudo-device (in addition to the actual hardware device used by the IMP software). And, finally, there are the two Ethernet devices. These use a special protocol, the Address Resolution Protocol (ARP), to map between Internet and Ethernet addresses. Thus, yet another .I pseudo-device is needed. The additional device specifications are show below. .DS .ta 1.5i 2.5i 4.0i pseudo-device pty pseudo-device loop pseudo-device imp device acc0 at uba? csr 0167600 vector accrint accxint pseudo-device ether device ec0 at uba? csr 0164330 vector ecrint eccollide ecxint device il0 at uba? csr 0164000 vector ilrint ilcint .DE .LP The completed configuration file for UCBVAX is shown in Appendix C. .NH 2 Miscellaneous comments .PP It should be noted in these examples that neither system was configured to use disk quotas or the 4.1BSD compatibility mode. To use these optional facilities, and others, we would probably clean out our current configuration, reconfigure the system, then recompile and relink the system image(s). This could, of course, be avoided by figuring out which relocatable object files are affected by the reconfiguration, then reconfiguring and recompiling only those files affected by the configuration change. This technique should be used carefully. Index: head/usr.sbin/config/SMM.doc/b.t =================================================================== --- head/usr.sbin/config/SMM.doc/b.t (revision 1855) +++ head/usr.sbin/config/SMM.doc/b.t (revision 1856) @@ -1,137 +1,137 @@ .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)b.t 8.1 (Berkeley) 6/8/93 .\" .\".ds RH "Device Defaulting Rules .bp .LG .B .ce APPENDIX B. RULES FOR DEFAULTING SYSTEM DEVICES .sp .R .NL .PP When \fIconfig\fP processes a ``config'' rule which does not fully specify the location of the root file system, paging area(s), device for system dumps, and device for argument list processing it applies a set of rules to define those values left unspecified. The following list of rules are used in defaulting system devices. .IP 1) 3 If a root device is not specified, the swap specification must indicate a ``generic'' system is to be built. .IP 2) 3 If the root device does not specify a unit number, it defaults to unit 0. .IP 3) 3 If the root device does not include a partition specification, it defaults to the ``a'' partition. .IP 4) 3 If no swap area is specified, it defaults to the ``b'' partition of the root device. .IP 5) 3 If no device is specified for processing argument lists, the first swap partition is selected. .IP 6) 3 If no device is chosen for system dumps, the first swap partition is selected (see below to find out where dumps are placed within the partition). .PP The following table summarizes the default partitions selected when a device specification is incomplete, e.g. ``hp0''. .DS .TS l l. Type Partition _ root ``a'' swap ``b'' args ``b'' dumps ``b'' .TE .DE .SH Multiple swap/paging areas .PP When multiple swap partitions are specified, the system treats the first specified as a ``primary'' swap area which is always used. The remaining partitions are then interleaved into the paging system at the time a .IR swapon (2) system call is made. This is normally done at boot time with a call to .IR swapon (8) from the /etc/rc file. .SH System dumps .PP System dumps are automatically taken after a system crash, provided the device driver for the ``dumps'' device supports this. The dump contains the contents of memory, but not the swap areas. Normally the dump device is a disk in which case the information is copied to a location at the back of the partition. The dump is placed in the back of the partition because the primary swap and dump device are commonly the same device and this allows the system to be rebooted without immediately overwriting the saved information. When a dump has occurred, the system variable \fIdumpsize\fP is set to a non-zero value indicating the size (in bytes) of the dump. The \fIsavecore\fP\|(8) program then copies the information from the dump partition to a file in a ``crash'' directory and also makes a copy of the system which was running at the time of the crash (usually -``/vmunix''). The offset to the system dump is defined in the +``/kernel''). The offset to the system dump is defined in the system variable \fIdumplo\fP (a sector offset from the front of the dump partition). The .I savecore program operates by reading the contents of \fIdumplo\fP, \fIdumpdev\fP, and \fIdumpmagic\fP from /dev/kmem, then comparing the value of \fIdumpmagic\fP read from /dev/kmem to that located in corresponding location in the dump area of the dump partition. If a match is found, .I savecore assumes a crash occurred and reads \fIdumpsize\fP from the dump area of the dump partition. This value is then used in copying the system dump. Refer to \fIsavecore\fP\|(8) for more information about its operation. .PP The value \fIdumplo\fP is calculated to be .DS \fIdumpdev-size\fP \- \fImemsize\fP .DE where \fIdumpdev-size\fP is the size of the disk partition where system dumps are to be placed, and \fImemsize\fP is the size of physical memory. If the disk partition is not large enough to hold a full dump, \fIdumplo\fP is set to 0 (the start of the partition). Index: head/usr.sbin/config/SMM.doc/c.t =================================================================== --- head/usr.sbin/config/SMM.doc/c.t (revision 1855) +++ head/usr.sbin/config/SMM.doc/c.t (revision 1856) @@ -1,109 +1,109 @@ .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)c.t 8.1 (Berkeley) 6/8/93 .\" .\".ds RH "Sample Config Files .bp .LG .B .ce APPENDIX C. SAMPLE CONFIGURATION FILES .sp .R .NL .PP The following configuration files are developed in section 5; they are included here for completeness. .sp 2 .nf .ta 1.5i 2.5i 4.0i # # ANSEL VAX (a picture perfect machine) # machine vax cpu VAX780 timezone 8 dst ident ANSEL maxusers 40 -config vmunix root on hp0 -config hpvmunix root on hp0 swap on hp0 and hp2 -config genvmunix swap generic +config kernel root on hp0 +config hpkernel root on hp0 swap on hp0 and hp2 +config genkernel swap generic controller mba0 at nexus ? disk hp0 at mba? disk ? disk hp1 at mba? disk ? controller mba1 at nexus ? disk hp2 at mba? disk ? disk hp3 at mba? disk ? controller uba0 at nexus ? controller tm0 at uba? csr 0172520 vector tmintr tape te0 at tm0 drive 0 tape te1 at tm0 drive 1 device dh0 at uba? csr 0160020 vector dhrint dhxint device dm0 at uba? csr 0170500 vector dmintr device dh1 at uba? csr 0160040 vector dhrint dhxint device dh2 at uba? csr 0160060 vector dhrint dhxint .bp # # UCBVAX - Gateway to the world # machine vax cpu "VAX780" cpu "VAX750" ident UCBVAX timezone 8 dst maxusers 32 options INET options NS -config vmunix root on hp swap on hp and rk0 and rk1 -config upvmunix root on up -config hkvmunix root on hk swap on rk0 and rk1 +config kernel root on hp swap on hp and rk0 and rk1 +config upkernel root on up +config hkkernel root on hk swap on rk0 and rk1 controller mba0 at nexus ? controller uba0 at nexus ? disk hp0 at mba? drive 0 disk hp1 at mba? drive 1 controller sc0 at uba? csr 0176700 vector upintr disk up0 at sc0 drive 0 disk up1 at sc0 drive 1 controller hk0 at uba? csr 0177440 vector rkintr disk rk0 at hk0 drive 0 disk rk1 at hk0 drive 1 pseudo-device pty pseudo-device loop pseudo-device imp device acc0 at uba? csr 0167600 vector accrint accxint pseudo-device ether device ec0 at uba? csr 0164330 vector ecrint eccollide ecxint device il0 at uba? csr 0164000 vector ilrint ilcint Index: head/usr.sbin/config/SMM.doc/spell.ok =================================================================== --- head/usr.sbin/config/SMM.doc/spell.ok (revision 1855) +++ head/usr.sbin/config/SMM.doc/spell.ok (revision 1856) @@ -1,306 +1,306 @@ ACC ANSEL ARP Autoconfiguration BUFPAGES CANTWAIT CH COMPAT CSS Co Config Config''SMM:2 DCLR DFLDSIZ DFLSSIZ DFUNNY DHAHA DMA Dev Dquot ECC EMULEX Emulex Ethernet FPNUMBER FUNNY,HAHA HAVEBDP ICMP IDP IE INET IP IPC IPFORWARDING IPL IPSENDREDIRECTS Info Karels LH Leffler MAKEDEV MAKEDEV.local MASSBUS MAXDSIZ MAXTSIZ Makefile Mb MicroVAX Mkopt Mkoption NBUF NEED16 NEEDBDP NINODE NMOUNT NOFILE NPROC NS NSC NSIP NUP PST RCS RDY RH RK07 RK611 SCCS SITENAME SMM:2 SUBNETSARELOCAL SYSPTSIZE TCP THREEWAYSHAKE Timezone UCBVAX UDP UNIBUS UPAGES UPCS2 USRPTSIZE VAX VAX630 VAX730 VAX750 VAX780 VAX8600 VAXWELL VAXen Vax Vaxwell acc0 accrint accxint addr arg args assym.s autoconfiguration autoconfigure autoconfigured backpointer badaddr blkno br br5 buf bufpages buses caddr callout catchall cmap.h cmd conf conf.c config csr ct.c ctlr cvec datagrams define''s dev devices.machine dgo dh.c dh0 dh1 dh2 dhreg.h dhrint dhxint dinfo dk dk.h dm0 dmintr dname dquot dst dumpdev dumplo dumpmagic dumpsize dz.c dz0 dzrint dzxint ec0 eccollide ecrint ecxint endif es files.machine filesystem foo foo.c -genvmunix +genkernel gettimeofday gigabytes gprof hardwired hd hk hk0 -hkvmunix +hkkernel howmany hp0 hp0b hp1 hp2 hp3 -hpvmunix +hpkernel ht0 hz ident ifdef ifndef il0 ilcint ilrint info intr ioconf.c kgmon linterrs loopback machdep.c machparam.h makefile makelinks makeoptions maxusers mba mba0 mba1 mbuf.h mcount.c memsize minfo mname moniker mspw nbuf ncallout nclist ndquot ndrive netimp netinet netns netstat nexi nexus nfile ninode nmbclusters nnn.ddd nproc nquota nsip ntext optionlist param.c param.h pathnames pg physaddr pty rc reg rk.c rk0 rk1 rkintr savecore sc sc0 sc1 scdriver setrlimit sizeof softc source.c subr swapxxx.c sysname te0 te1 timezone tm0 tmintr tu0 uba uba.c uba0 ubago uballoc ubamem ubanum ubareg.h ubarelse ubavar.h ubglue.s ubinfo ud ui um up.c up0 up1 up2 upaddr upattach upba upcs1 upcs2 updevice updgo updinfo updtab upintr upip upmaptype upminfo upprobe upslave upstd -upvmunix +upkernel upwatch upwstart value,name2 value2 vax vaxif vaxmba vaxuba vmparam.h -vmunix +kernel wildcard wildcarded wildcarding xclu xxx Index: head/usr.sbin/config.new/config.h =================================================================== --- head/usr.sbin/config.new/config.h (revision 1855) +++ head/usr.sbin/config.new/config.h (revision 1856) @@ -1,281 +1,281 @@ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * 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, Lawrence Berkeley Laboratories. * * 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. * * @(#)config.h 8.1 (Berkeley) 6/6/93 */ /* * Name/value lists. Values can be strings or pointers and/or can carry * integers. The names can be NULL, resulting in simple value lists. */ struct nvlist { struct nvlist *nv_next; const char *nv_name; union { const char *un_str; void *un_ptr; } nv_un; #define nv_str nv_un.un_str #define nv_ptr nv_un.un_ptr int nv_int; }; /* * Kernel configurations. */ struct config { struct config *cf_next; /* linked list */ - const char *cf_name; /* "vmunix" */ + const char *cf_name; /* "kernel" */ int cf_lineno; /* source line */ struct nvlist *cf_root; /* "root on ra0a" */ struct nvlist *cf_swap; /* "swap on ra0b and ra1b" */ struct nvlist *cf_dump; /* "dumps on ra0b" */ }; /* * Attributes. These come in two flavors: "plain" and "interface". * Plain attributes (e.g., "ether") simply serve to pull in files. * Interface attributes (e.g., "scsi") carry three lists: locators, * child devices, and references. The locators are those things * that must be specified in order to configure a device instance * using this attribute (e.g., "tg0 at scsi0"). The a_devs field * lists child devices that can connect here (e.g., "tg"s), while * the a_refs are parents that carry the attribute (e.g., actual * SCSI host adapter drivers such as the SPARC "esp"). */ struct attr { const char *a_name; /* name of this attribute */ int a_iattr; /* true => allows children */ struct nvlist *a_locs; /* locators required */ int a_loclen; /* length of above list */ struct nvlist *a_devs; /* children */ struct nvlist *a_refs; /* parents */ }; /* * The "base" part of a device ("uba", "sd"; but not "uba2" or * "sd0"). It may be found "at" one or more attributes, including * "at root" (this is represented by a NULL attribute). * * Each device may also export attributes. If any provide an output * interface (e.g., "esp" provides "scsi"), other devices (e.g., * "tg"s) can be found at instances of this one (e.g., "esp"s). * Such a connection must provide locators as specified by that * interface attribute (e.g., "target"). * * Each base carries a list of instances (via d_ihead). Note that this * list "skips over" aliases; those must be found through the instances * themselves. */ struct devbase { const char *d_name; /* e.g., "sd" */ struct devbase *d_next; /* linked list */ int d_isdef; /* set once properly defined */ int d_ispseudo; /* is a pseudo-device */ int d_major; /* used for "root on sd0", e.g. */ struct nvlist *d_atlist; /* e.g., "at tg" (attr list) */ struct nvlist *d_vectors; /* interrupt vectors, if any */ struct nvlist *d_attrs; /* attributes, if any */ struct devi *d_ihead; /* first instance, if any */ struct devi **d_ipp; /* used for tacking on more instances */ int d_umax; /* highest unit number + 1 */ }; /* * An "instance" of a device. The same instance may be listed more * than once, e.g., "xx0 at isa? port FOO" + "xx0 at isa? port BAR". * * After everything has been read in and verified, the devi's are * "packed" to collect all the information needed to generate ioconf.c. * In particular, we try to collapse multiple aliases into a single entry. * We then assign each "primary" (non-collapsed) instance a cfdata index. * Note that there may still be aliases among these. */ struct devi { /* created while parsing config file */ const char *i_name; /* e.g., "sd0" */ int i_unit; /* unit from name, e.g., 0 */ struct devbase *i_base;/* e.g., pointer to "sd" base */ struct devi *i_next; /* list of all instances */ struct devi *i_bsame; /* list on same base */ struct devi *i_alias; /* other aliases of this instance */ const char *i_at; /* where this is "at" (NULL if at root) */ struct attr *i_atattr; /* attr that allowed attach */ struct devbase *i_atdev;/* dev if "at ", else NULL */ const char **i_locs; /* locators (as given by i_atattr) */ int i_atunit; /* unit from "at" */ int i_cfflags; /* flags from config line */ int i_lineno; /* line # in config, for later errors */ /* created during packing or ioconf.c generation */ /* i_loclen via i_atattr->a_loclen */ short i_collapsed; /* set => this alias no longer needed */ short i_cfindex; /* our index in cfdata */ short i_pvlen; /* number of parents */ short i_pvoff; /* offset in parents.vec */ short i_locoff; /* offset in locators.vec */ short i_ivoff; /* offset in interrupt vectors, if any */ struct devi **i_parents;/* the parents themselves */ }; /* special units */ #define STAR (-1) /* unit number for, e.g., "sd*" */ #define WILD (-2) /* unit number for, e.g., "sd?" */ /* * Files. Each file is either standard (always included) or optional, * depending on whether it has names on which to *be* optional. */ struct files { struct files *fi_next; /* linked list */ const char *fi_srcfile; /* the name of the "files" file that got us */ u_short fi_srcline; /* and the line number */ u_char fi_flags; /* as below */ char fi_lastc; /* last char from path */ const char *fi_path; /* full file path */ const char *fi_tail; /* name, i.e., rindex(fi_path, '/') + 1 */ const char *fi_base; /* tail minus ".c" (or whatever) */ struct nvlist *fi_opt; /* optional on ... */ const char *fi_mkrule; /* special make rule, if any */ }; /* flags */ #define FI_SEL 0x01 /* selected */ #define FI_CONFIGDEP 0x02 /* config-dependent */ #define FI_DRIVER 0x04 /* device-driver */ #define FI_NEEDSCOUNT 0x08 /* needs-count */ #define FI_NEEDSFLAG 0x10 /* needs-flag */ #define FI_HIDDEN 0x20 /* obscured by other(s), base names overlap */ /* * Hash tables look up name=value pairs. The pointer value of the name * is assumed to be constant forever; this can be arranged by interning * the name. (This is fairly convenient since our lexer does this for * all identifier-like strings---it has to save them anyway, lest yacc's * look-ahead wipe out the current one.) */ struct hashtab; const char *conffile; /* source file, e.g., "GENERIC.sparc" */ const char *confdirbase; /* basename of compile directory, usu. same */ const char *machine; /* machine type, e.g., "sparc" */ int errors; /* counts calls to error() */ int minmaxusers; /* minimum "maxusers" parameter */ int defmaxusers; /* default "maxusers" parameter */ int maxmaxusers; /* default "maxusers" parameter */ int maxusers; /* configuration's "maxusers" parameter */ struct nvlist *options; /* options */ struct nvlist *mkoptions; /* makeoptions */ struct hashtab *devbasetab; /* devbase lookup */ struct hashtab *selecttab; /* selects things that are "optional foo" */ struct hashtab *needcnttab; /* retains names marked "needs-count" */ struct devbase *allbases; /* list of all devbase structures */ struct config *allcf; /* list of configured kernels */ struct devi *alldevi; /* list of all instances */ struct devi *allpseudo; /* list of all pseudo-devices */ int ndevi; /* number of devi's (before packing) */ int npseudo; /* number of pseudo's */ struct files *allfiles; /* list of all kernel source files */ struct devi **packed; /* arrayified table for packed devi's */ int npacked; /* size of packed table, <= ndevi */ struct { /* pv[] table for config */ short *vec; int used; } parents; struct { /* loc[] table for config */ const char **vec; int used; } locators; /* files.c */ void initfiles __P((void)); void checkfiles __P((void)); int fixfiles __P((void)); /* finalize */ void addfile __P((const char *, struct nvlist *, int, const char *)); /* hash.c */ struct hashtab *ht_new __P((void)); int ht_insrep __P((struct hashtab *, const char *, void *, int)); #define ht_insert(ht, nam, val) ht_insrep(ht, nam, val, 0) #define ht_replace(ht, nam, val) ht_insrep(ht, nam, val, 1) void *ht_lookup __P((struct hashtab *, const char *)); void initintern __P((void)); const char *intern __P((const char *)); /* main.c */ void addoption __P((const char *name, const char *value)); void addmkoption __P((const char *name, const char *value)); /* mkheaders.c */ int mkheaders __P((void)); /* mkioconf.c */ int mkioconf __P((void)); /* mkmakefile.c */ int mkmakefile __P((void)); /* mkswap.c */ int mkswap __P((void)); /* pack.c */ void pack __P((void)); /* scan.l */ int currentline __P((void)); /* sem.c, other than for yacc actions */ void initsem __P((void)); /* util.c */ void *emalloc __P((size_t)); void *erealloc __P((void *, size_t)); char *path __P((const char *)); void error __P((const char *, ...)); /* immediate errs */ void xerror __P((const char *, int, const char *, ...)); /* delayed errs */ __dead void panic __P((const char *, ...)); struct nvlist *newnv __P((const char *, const char *, void *, int)); void nvfree __P((struct nvlist *)); void nvfreel __P((struct nvlist *)); Index: head/usr.sbin/iostat/iostat.8 =================================================================== --- head/usr.sbin/iostat/iostat.8 (revision 1855) +++ head/usr.sbin/iostat/iostat.8 (revision 1856) @@ -1,142 +1,142 @@ .\" Copyright (c) 1985, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)iostat.8 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt IOSTAT 8 .Os BSD 4 .Sh NAME .Nm iostat .Nd report .Tn I/O statistics .Sh SYNOPSIS .Nm iostat .Op Fl c Ar count .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait .Op Ar drives .Sh DESCRIPTION .Nm Iostat displays kernel .Tn I/O statistics on terminal, disk and cpu operations. .Pp The options are as follows: .Bl -tag -width flag .It Fl c Repeat the display .Ar count times. The first display is for the time since a reboot and each subsequent report is for the time period since the last display. If no .Ar wait interval is specified, the default is 1 second. .It Fl M Extract values associated with the name list from the specified core instead of the default .Dq Pa /dev/kmem . .It Fl N Extract the name list from the specified system instead of the default -.Dq Pa /vmunix . +.Dq Pa /kernel . .It Fl w Pause .Ar wait seconds between each display. If no repeat .Ar count is specified, the default is infinity. .El .Pp .Nm Iostat displays its information in the following format: .Bl -tag -width flag .It tty .Bl -tag -width indent -compact .It tin characters read from terminals .It tout characters written to terminals .El .It disks Disk operations (this field is system dependent). The header of the field is the disk name and unit number. If more than four disk drives are configured in the system, .Nm iostat displays only the first four drives. To force .Nm iostat to display specific drives, their names may be supplied on the command line. .Pp .Bl -tag -width indent -compact .It sps sectors transferred per second .It tps transfers per second .It msps milliseconds per average seek (including implied seeks and rotational latency) .El .It cpu .Bl -tag -width indent -compact .It \&us % of cpu time in user mode .It \&ni % of cpu time in user mode running niced processes .It \&sy % of cpu time in system mode .It \&id % of cpu time in idle mode .El .El .Sh FILES .Bl -tag -width /dev/kmem -compact -.It Pa /vmunix +.It Pa /kernel Default kernel namelist. .It Pa /dev/kmem Default memory file. .El .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , .Xr nfsstat 1 , .Xr \&ps 1 , .Xr systat 1 , .Xr vmstat 1 , .Xr pstat 8 .Pp The sections starting with ``Interpreting system activity'' in .%T "Installing and Operating 4.3BSD" . Index: head/usr.sbin/kgmon/kgmon.8 =================================================================== --- head/usr.sbin/kgmon/kgmon.8 (revision 1855) +++ head/usr.sbin/kgmon/kgmon.8 (revision 1856) @@ -1,122 +1,122 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)kgmon.8 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt KGMON 8 .Os BSD 4.2 .Sh NAME .Nm kgmon .Nd generate a dump of the operating system's profile buffers .Sh SYNOPSIS .Nm kgmon .Op Fl bhpr .Op Fl M core .Op Fl N system .Sh DESCRIPTION .Nm Kgmon is a tool used when profiling the operating system. When no arguments are supplied, .Nm kgmon indicates the state of operating system profiling as running, off, or not configured. (see .Xr config 8 ) If the .Fl p flag is specified, .Nm kgmon extracts profile data from the operating system and produces a .Pa gmon.out file suitable for later analysis by .Xr gprof 1 . .Pp The options are as follows: .Bl -tag -width Ds .It Fl b Resume the collection of profile data. .It Fl h Stop the collection of profile data. .It Fl p Dump the contents of the profile buffers into a .Pa gmon.out file. .It Fl r Reset all the profile buffers. If the .Fl p flag is also specified, the .Pa gmon.out file is generated before the buffers are reset. .It Fl M Extract values associated with the name list from the specified core instead of the default ``/dev/kmem''. .It Fl N Extract the name list from the specified system instead of the -default ``/vmunix''. +default ``/kernel''. .El .Pp If neither .Fl b nor .Fl h is specified, the state of profiling collection remains unchanged. For example, if the .Fl p flag is specified and profile data is being collected, profiling will be momentarily suspended, the operating system profile buffers will be dumped, and profiling will be immediately resumed. .Sh FILES .Bl -tag -width /dev/kmemx -compact -.It Pa /vmunix +.It Pa /kernel the default system .It Pa /dev/kmem the default memory .El .Sh SEE ALSO .Xr gprof 1 , .Xr config 8 .Sh DIAGNOSTICS Users with only read permission on .Pa /dev/kmem cannot change the state of profiling collection. They can get a .Pa gmon.out file with the warning that the data may be inconsistent if profiling is in progress. .Sh HISTORY The .Nm command appeared in .Bx 4.2 . Index: head/usr.sbin/kvm_mkdb/kvm_mkdb.8 =================================================================== --- head/usr.sbin/kvm_mkdb/kvm_mkdb.8 (revision 1855) +++ head/usr.sbin/kvm_mkdb/kvm_mkdb.8 (revision 1856) @@ -1,69 +1,69 @@ .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)kvm_mkdb.8 8.1 (Berkeley) 6/9/93 .\" .Dd June 9, 1993 .Dt KVM_MKDB 8 .Os .Sh NAME .Nm kvm_mkdb .Nd create kernel database .Sh SYNOPSIS .Nm kvm_mkdb .Op file .Sh DESCRIPTION .Nm Kvm_mkdb creates a database in .Pa /var/db containing information about the specified file. If no file is specified, -.Pa /vmunix +.Pa /kernel is used by default. The file is named ``kvm_filename.db'', where ``filename'' is the name of the file read. Various library routines consult this database. The only information currently stored is the kernel namelist, which is used by the .Xr kvm_nlist 3 function, however, in the future the database may contain other static information about the current system. .Sh FILES -.Bl -tag -width /var/db/kvm_vmunix.db -compact -.It Pa /vmunix -.It Pa /var/db/kvm_vmunix.db +.Bl -tag -width /var/db/kvm_kernel.db -compact +.It Pa /kernel +.It Pa /var/db/kvm_kernel.db .El .Sh SEE ALSO .Xr kvm_nlist 3 .Sh HISTORY The .Nm kvm_mkdb utility first appeared in 4.4BSD. Index: head/usr.sbin/pstat/pstat.8 =================================================================== --- head/usr.sbin/pstat/pstat.8 (revision 1855) +++ head/usr.sbin/pstat/pstat.8 (revision 1856) @@ -1,321 +1,321 @@ .\" Copyright (c) 1980, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" @(#)pstat.8 8.4 (Berkeley) 4/19/94 .\" 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. .\" .\" @(#)pstat.8 8.4 (Berkeley) 4/19/94 .\" .Dd April 19, 1994 .Dt PSTAT 8 .Os BSD 4 .Sh NAME .Nm pstat .Nd display system data structures .Sh SYNOPSIS .Nm pstat .Op Fl Tfnstv .Op Fl M Ar core .Op Fl N Ar system .Sh DESCRIPTION .Nm Pstat displays open file entry, swap space utilization, terminal state, and vnode data structures. If .Ar corefile is given, the information is sought there, otherwise in .Pa /dev/kmem . The required namelist is taken from -.Pa /vmunix +.Pa /kernel unless .Ar system is specified. The .Fl n option specifies that devices should be printed out by major/minor number rather than by name. .Pp Options are .Bl -tag -width indent .It Fl T Prints the number of used and free slots in the several system tables and is useful for checking to see how large system tables have become if the system is under heavy load. .It Fl f Print the open file table with these headings: .Bl -tag -width indent .It LOC The core location of this table entry. .It TYPE The type of object the file table entry points to. .It FLG Miscellaneous state variables encoded thus: .Bl -tag -width indent .It R open for reading .It W open for writing .It A open for appending .It S shared lock present .It X exclusive lock present .It I signal pgrp when data ready .El .It CNT Number of processes that know this open file. .It MSG Number of messages outstanding for this file. .It DATA The location of the vnode table entry or socket structure for this file. .It OFFSET The file offset (see .Xr lseek 2 ) . .El .It Fl s Print information about swap space usage on all the swap areas compiled into the kernel. The first column is the device name of the partition. The next column is the total space available in the partition. The .Ar Used column indicates the total blocks used so far; the .Ar Available column indicates how much space is remaining on each partition. The .Ar Capacity reports the percentage of space used. .Pp If more than one partition is configured into the system, totals for all of the statistics will be reported in the final line of the report. .It Fl t Print table for terminals with these headings: .Bl -tag -width indent .It RAW Number of characters in raw input queue. .It CAN Number of characters in canonicalized input queue. .It OUT Number of characters in putput queue. .It MODE See .Xr tty 4 . .It ADDR Physical device address. .It DEL Number of delimiters (newlines) in canonicalized input queue. .It COL Calculated column position of terminal. .It STATE Miscellaneous state variables encoded thus: .Bl -tag -width indent .It T delay timeout in progress .It W waiting for open to complete .It O open .It F outq has been flushed during DMA .It C carrier is on .It B busy doing output .It A process is awaiting output .It X open for exclusive use .It S output stopped .It H hangup on close .El .It PGRP Process group for which this is controlling terminal. .It DISC Line discipline; blank is old tty OTTYDISC or .Ql new tty for NTTYDISC or .Ql net for NETLDISC (see .Xr bk 4 ) . .El .It Fl v Print the active vnodes. Each group of vnodes corresponding to a particular filesystem is preceded by a two line header. The first line consists of the following: .Pp .Df I .No *** MOUNT Em fstype from on .Em on fsflags .De .Pp where .Em fstype is one of .Em ufs , nfs , mfs , or pc ; .Em from is the filesystem is mounted from; .Em on is the directory the filesystem is mounted on; and .Em fsflags is a list of optional flags applied to the mount (see .Xr mount 8 ) . .The second line is a header for the individual fields , the first part of which are fixed, and the second part are filesystem type specific. The headers common to all vnodes are: .Bl -tag -width indent .It ADDR Location of this vnode. .It TYP File type. .It VFLAG .Pp A list of letters representing vnode flags: .Bl -tag -width indent .It R \- VROOT .It T \- VTEXT .It L \- VXLOCK .It W \- VXWANT .It E \- VEXLOCK .It S \- VSHLOCK .It T \- VLWAIT .It A \- VALIASED .It B \- VBWAIT .El .Pp .It USE The number of references to this vnode. .It HOLD The number of I/O buffers held by this vnode. .It FILEID The vnode fileid. In the case of .Em ufs this is the inode number. .It IFLAG Miscellaneous filesystem specific state variables encoded thus: .Bl -tag -width indent .It "For ufs:" .Pp .Bl -tag -width indent .It L locked .It U update time .Pq Xr fs 5 must be corrected .It A access time must be corrected .It W wanted by another process (L flag is on) .It C changed time must be corrected .It S shared lock applied .It E exclusive lock applied .It Z someone waiting for a lock .It M contains modifications .It R has a rename in progress .El .It "For nfs:" .Bl -tag -width indent .It W waiting for I/O buffer flush to complete .It P I/O buffers being flushed .It M locally modified data exists .It E an earlier write failed .It X non-cacheable lease (nqnfs) .It O write lease (nqnfs) .It G lease was evicted (nqnfs) .El .El .It SIZ/RDEV Number of bytes in an ordinary file, or major and minor device of special file. .El .El .Sh FILES .Bl -tag -width /dev/kmemxxx -compact -.It Pa /vmunix +.It Pa /kernel namelist .It Pa /dev/kmem default source of tables .El .Sh SEE ALSO .Xr iostat 1 , .Xr ps 1 , .Xr systat 1 , .Xr vmstat 1 , .Xr stat 2 , .Xr fs 5 , .Rs .Rt Tn UNIX Rt Implementation , .Ra K. Thompson .Re .Sh BUGS Swap statistics are reported for all swap partitions compiled into the kernel, regardless of whether those partitions are being used. .Pp Does not understand NFS swap servers. .Sh HISTORY The .Nm pstat command appeared in 4.0BSD. Index: head/usr.sbin/routed/defs.h =================================================================== --- head/usr.sbin/routed/defs.h (revision 1855) +++ head/usr.sbin/routed/defs.h (revision 1856) @@ -1,103 +1,103 @@ /* * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)defs.h 8.1 (Berkeley) 6/5/93 */ /* * Internal data structure definitions for * user routing process. Based on Xerox NS * protocol specs with mods relevant to more * general addressing scheme. */ #include #include #include #include #include #include #include #include #include "trace.h" #include "interface.h" #include "table.h" #include "af.h" /* * When we find any interfaces marked down we rescan the * kernel every CHECK_INTERVAL seconds to see if they've * come up. */ #define CHECK_INTERVAL (1*60) #define equal(a1, a2) \ (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) struct sockaddr_in addr; /* address of daemon's socket */ int s; /* source and sink of all data */ int r; /* routing socket */ pid_t pid; /* process id for identifying messages */ uid_t uid; /* user id for identifying messages */ int seqno; /* sequence number for identifying messages */ int kmem; int supplier; /* process should supply updates */ int install; /* if 1 call kernel */ int lookforinterfaces; /* if 1 probe kernel for new up interfaces */ -int performnlist; /* if 1 check if /vmunix has changed */ +int performnlist; /* if 1 check if /kernel has changed */ int externalinterfaces; /* # of remote and local interfaces */ struct timeval now; /* current idea of time */ struct timeval lastbcast; /* last time all/changes broadcast */ struct timeval lastfullupdate; /* last time full table broadcast */ struct timeval nextbcast; /* time to wait before changes broadcast */ int needupdate; /* true if we need update at nextbcast */ char packet[MAXPACKETSIZE+1]; struct rip *msg; char **argv0; struct servent *sp; struct in_addr inet_makeaddr(); int inet_addr(); int inet_maskof(); int sndmsg(); int supply(); int cleanup(); int rtioctl(); #define ADD 1 #define DELETE 2 #define CHANGE 3 Index: head/usr.sbin/rwhod/rwhod.8 =================================================================== --- head/usr.sbin/rwhod/rwhod.8 (revision 1855) +++ head/usr.sbin/rwhod/rwhod.8 (revision 1856) @@ -1,146 +1,146 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)rwhod.8 8.2 (Berkeley) 12/11/93 .\" .Dd December 11, 1993 .Dt RWHOD 8 .Os BSD 4.2 .Sh NAME .Nm rwhod .Nd system status server .Sh SYNOPSIS .Nm rwhod .Sh DESCRIPTION .Nm Rwhod is the server which maintains the database used by the .Xr rwho 1 and .Xr ruptime 1 programs. Its operation is predicated on the ability to .Em broadcast messages on a network. .Pp .Nm Rwhod operates as both a producer and consumer of status information. As a producer of information it periodically queries the state of the system and constructs status messages which are broadcast on a network. As a consumer of information, it listens for other .Nm rwhod servers' status messages, validating them, then recording them in a collection of files located in the directory .Pa /var/rwho . .Pp The server transmits and receives messages at the port indicated in the ``rwho'' service specification; see .Xr services 5 . The messages sent and received, are of the form: .Bd -literal -offset indent struct outmp { char out_line[8]; /* tty name */ char out_name[8]; /* user id */ long out_time; /* time on */ }; struct whod { char wd_vers; char wd_type; char wd_fill[2]; int wd_sendtime; int wd_recvtime; char wd_hostname[32]; int wd_loadav[3]; int wd_boottime; struct whoent { struct outmp we_utmp; int we_idle; } wd_we[1024 / sizeof (struct whoent)]; }; .Ed .Pp All fields are converted to network byte order prior to transmission. The load averages are as calculated by the .Xr w 1 program, and represent load averages over the 5, 10, and 15 minute intervals prior to a server's transmission; they are multiplied by 100 for representation in an integer. The host name included is that returned by the .Xr gethostname 2 system call, with any trailing domain name omitted. The array at the end of the message contains information about the users logged in to the sending machine. This information includes the contents of the .Xr utmp 5 entry for each non-idle terminal line and a value indicating the time in seconds since a character was last received on the terminal line. .Pp Messages received by the .Xr rwho server are discarded unless they originated at an .Xr rwho server's port. In addition, if the host's name, as specified in the message, contains any unprintable .Tn ASCII characters, the message is discarded. Valid messages received by .Nm rwhod are placed in files named .Pa whod.hostname in the directory .Pa /var/rwho . These files contain only the most recent message, in the format described above. .Pp Status messages are generated approximately once every 3 minutes. .Nm Rwhod performs an .Xr nlist 3 on -.Pa /vmunix +.Pa /kernel every 30 minutes to guard against the possibility that this file is not the system image currently operating. .Sh SEE ALSO .Xr rwho 1 , .Xr ruptime 1 .Sh BUGS There should be a way to relay status information between networks. Status information should be sent only upon request rather than continuously. People often interpret the server dying or network communication failures as a machine going down. .Sh HISTORY The .Nm command appeared in .Bx 4.2 . Index: head/usr.sbin/sendmail/src/conf.c =================================================================== --- head/usr.sbin/sendmail/src/conf.c (revision 1855) +++ head/usr.sbin/sendmail/src/conf.c (revision 1856) @@ -1,2381 +1,2381 @@ /* * Copyright (c) 1983 Eric P. Allman * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint static char sccsid[] = "@(#)conf.c 8.89 (Berkeley) 4/18/94"; #endif /* not lint */ # include "sendmail.h" # include "pathnames.h" # include # include # include # include /* ** CONF.C -- Sendmail Configuration Tables. ** ** Defines the configuration of this installation. ** ** Configuration Variables: ** HdrInfo -- a table describing well-known header fields. ** Each entry has the field name and some flags, ** which are described in sendmail.h. ** ** Notes: ** I have tried to put almost all the reasonable ** configuration information into the configuration ** file read at runtime. My intent is that anything ** here is a function of the version of UNIX you ** are running, or is really static -- for example ** the headers are a superset of widely used ** protocols. If you find yourself playing with ** this file too much, you may be making a mistake! */ /* ** Header info table ** Final (null) entry contains the flags used for any other field. ** ** Not all of these are actually handled specially by sendmail ** at this time. They are included as placeholders, to let ** you know that "someday" I intend to have sendmail do ** something with them. */ struct hdrinfo HdrInfo[] = { /* originator fields, most to least significant */ "resent-sender", H_FROM|H_RESENT, "resent-from", H_FROM|H_RESENT, "resent-reply-to", H_FROM|H_RESENT, "sender", H_FROM, "from", H_FROM, "reply-to", H_FROM, "full-name", H_ACHECK, "return-receipt-to", H_FROM|H_RECEIPTTO, "errors-to", H_FROM|H_ERRORSTO, /* destination fields */ "to", H_RCPT, "resent-to", H_RCPT|H_RESENT, "cc", H_RCPT, "resent-cc", H_RCPT|H_RESENT, "bcc", H_RCPT|H_ACHECK, "resent-bcc", H_RCPT|H_ACHECK|H_RESENT, "apparently-to", H_RCPT, /* message identification and control */ "message-id", 0, "resent-message-id", H_RESENT, "message", H_EOH, "text", H_EOH, /* date fields */ "date", 0, "resent-date", H_RESENT, /* trace fields */ "received", H_TRACE|H_FORCE, "x400-received", H_TRACE|H_FORCE, "via", H_TRACE|H_FORCE, "mail-from", H_TRACE|H_FORCE, /* miscellaneous fields */ "comments", H_FORCE, "return-path", H_FORCE|H_ACHECK, NULL, 0, }; /* ** Location of system files/databases/etc. */ char *PidFile = _PATH_SENDMAILPID; /* stores daemon proc id */ /* ** Privacy values */ struct prival PrivacyValues[] = { "public", PRIV_PUBLIC, "needmailhelo", PRIV_NEEDMAILHELO, "needexpnhelo", PRIV_NEEDEXPNHELO, "needvrfyhelo", PRIV_NEEDVRFYHELO, "noexpn", PRIV_NOEXPN, "novrfy", PRIV_NOVRFY, "restrictmailq", PRIV_RESTRICTMAILQ, "restrictqrun", PRIV_RESTRICTQRUN, "authwarnings", PRIV_AUTHWARNINGS, "noreceipts", PRIV_NORECEIPTS, "goaway", PRIV_GOAWAY, NULL, 0, }; /* ** Miscellaneous stuff. */ int DtableSize = 50; /* max open files; reset in 4.2bsd */ /* ** Following should be config parameters (and probably will be in ** future releases). In the meantime, setting these is considered ** unsupported, and is intentionally undocumented. */ #ifdef BROKENSMTPPEERS bool BrokenSmtpPeers = TRUE; /* set if you have broken SMTP peers */ #else bool BrokenSmtpPeers = FALSE; /* set if you have broken SMTP peers */ #endif #ifdef NOLOOPBACKCHECK bool CheckLoopBack = FALSE; /* set to check HELO loopback */ #else bool CheckLoopBack = TRUE; /* set to check HELO loopback */ #endif /* ** SETDEFAULTS -- set default values ** ** Because of the way freezing is done, these must be initialized ** using direct code. ** ** Parameters: ** e -- the default envelope. ** ** Returns: ** none. ** ** Side Effects: ** Initializes a bunch of global variables to their ** default values. */ #define DAYS * 24 * 60 * 60 setdefaults(e) register ENVELOPE *e; { SpaceSub = ' '; /* option B */ QueueLA = 8; /* option x */ RefuseLA = 12; /* option X */ WkRecipFact = 30000L; /* option y */ WkClassFact = 1800L; /* option z */ WkTimeFact = 90000L; /* option Z */ QueueFactor = WkRecipFact * 20; /* option q */ FileMode = (RealUid != geteuid()) ? 0644 : 0600; /* option F */ DefUid = 1; /* option u */ DefGid = 1; /* option g */ CheckpointInterval = 10; /* option C */ MaxHopCount = 25; /* option h */ e->e_sendmode = SM_FORK; /* option d */ e->e_errormode = EM_PRINT; /* option e */ SevenBit = FALSE; /* option 7 */ MaxMciCache = 1; /* option k */ MciCacheTimeout = 300; /* option K */ LogLevel = 9; /* option L */ settimeouts(NULL); /* option r */ TimeOuts.to_q_return = 5 DAYS; /* option T */ TimeOuts.to_q_warning = 0; /* option T */ PrivacyFlags = 0; /* option p */ setdefuser(); setupmaps(); setupmailers(); } /* ** SETDEFUSER -- set/reset DefUser using DefUid (for initgroups()) */ setdefuser() { struct passwd *defpwent; static char defuserbuf[40]; DefUser = defuserbuf; if ((defpwent = getpwuid(DefUid)) != NULL) strcpy(defuserbuf, defpwent->pw_name); else strcpy(defuserbuf, "nobody"); } /* ** HOST_MAP_INIT -- initialize host class structures */ bool host_map_init(map, args) MAP *map; char *args; { register char *p = args; for (;;) { while (isascii(*p) && isspace(*p)) p++; if (*p != '-') break; switch (*++p) { case 'a': map->map_app = ++p; break; } while (*p != '\0' && !(isascii(*p) && isspace(*p))) p++; if (*p != '\0') *p++ = '\0'; } if (map->map_app != NULL) map->map_app = newstr(map->map_app); return TRUE; } /* ** SETUPMAILERS -- initialize default mailers */ setupmailers() { char buf[100]; strcpy(buf, "prog, P=/bin/sh, F=lsD, A=sh -c $u"); makemailer(buf); strcpy(buf, "*file*, P=/dev/null, F=lsDFMPEu, A=FILE"); makemailer(buf); strcpy(buf, "*include*, P=/dev/null, F=su, A=INCLUDE"); makemailer(buf); } /* ** SETUPMAPS -- set up map classes */ #define MAPDEF(name, ext, flags, parse, open, close, lookup, store) \ { \ extern bool parse __P((MAP *, char *)); \ extern bool open __P((MAP *, int)); \ extern void close __P((MAP *)); \ extern char *lookup __P((MAP *, char *, char **, int *)); \ extern void store __P((MAP *, char *, char *)); \ s = stab(name, ST_MAPCLASS, ST_ENTER); \ s->s_mapclass.map_cname = name; \ s->s_mapclass.map_ext = ext; \ s->s_mapclass.map_cflags = flags; \ s->s_mapclass.map_parse = parse; \ s->s_mapclass.map_open = open; \ s->s_mapclass.map_close = close; \ s->s_mapclass.map_lookup = lookup; \ s->s_mapclass.map_store = store; \ } setupmaps() { register STAB *s; #ifdef NEWDB MAPDEF("hash", ".db", MCF_ALIASOK|MCF_REBUILDABLE, map_parseargs, hash_map_open, db_map_close, db_map_lookup, db_map_store); MAPDEF("btree", ".db", MCF_ALIASOK|MCF_REBUILDABLE, map_parseargs, bt_map_open, db_map_close, db_map_lookup, db_map_store); #endif #ifdef NDBM MAPDEF("dbm", ".dir", MCF_ALIASOK|MCF_REBUILDABLE, map_parseargs, ndbm_map_open, ndbm_map_close, ndbm_map_lookup, ndbm_map_store); #endif #ifdef NIS MAPDEF("nis", NULL, MCF_ALIASOK, map_parseargs, nis_map_open, nis_map_close, nis_map_lookup, nis_map_store); #endif MAPDEF("stab", NULL, MCF_ALIASOK|MCF_ALIASONLY, map_parseargs, stab_map_open, stab_map_close, stab_map_lookup, stab_map_store); MAPDEF("implicit", NULL, MCF_ALIASOK|MCF_ALIASONLY|MCF_REBUILDABLE, map_parseargs, impl_map_open, impl_map_close, impl_map_lookup, impl_map_store); /* host DNS lookup */ MAPDEF("host", NULL, 0, host_map_init, null_map_open, null_map_close, host_map_lookup, null_map_store); /* dequote map */ MAPDEF("dequote", NULL, 0, dequote_init, null_map_open, null_map_close, dequote_map, null_map_store); #if 0 # ifdef USERDB /* user database */ MAPDEF("udb", ".db", 0, udb_map_parse, null_map_open, null_map_close, udb_map_lookup, null_map_store); # endif #endif } #undef MAPDEF /* ** USERNAME -- return the user id of the logged in user. ** ** Parameters: ** none. ** ** Returns: ** The login name of the logged in user. ** ** Side Effects: ** none. ** ** Notes: ** The return value is statically allocated. */ char * username() { static char *myname = NULL; extern char *getlogin(); register struct passwd *pw; /* cache the result */ if (myname == NULL) { myname = getlogin(); if (myname == NULL || myname[0] == '\0') { pw = getpwuid(RealUid); if (pw != NULL) myname = newstr(pw->pw_name); } else { uid_t uid = RealUid; myname = newstr(myname); if ((pw = getpwnam(myname)) == NULL || (uid != 0 && uid != pw->pw_uid)) { pw = getpwuid(uid); if (pw != NULL) myname = newstr(pw->pw_name); } } if (myname == NULL || myname[0] == '\0') { syserr("554 Who are you?"); myname = "postmaster"; } } return (myname); } /* ** TTYPATH -- Get the path of the user's tty ** ** Returns the pathname of the user's tty. Returns NULL if ** the user is not logged in or if s/he has write permission ** denied. ** ** Parameters: ** none ** ** Returns: ** pathname of the user's tty. ** NULL if not logged in or write permission denied. ** ** Side Effects: ** none. ** ** WARNING: ** Return value is in a local buffer. ** ** Called By: ** savemail */ char * ttypath() { struct stat stbuf; register char *pathn; extern char *ttyname(); extern char *getlogin(); /* compute the pathname of the controlling tty */ if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL && (pathn = ttyname(0)) == NULL) { errno = 0; return (NULL); } /* see if we have write permission */ if (stat(pathn, &stbuf) < 0 || !bitset(02, stbuf.st_mode)) { errno = 0; return (NULL); } /* see if the user is logged in */ if (getlogin() == NULL) return (NULL); /* looks good */ return (pathn); } /* ** CHECKCOMPAT -- check for From and To person compatible. ** ** This routine can be supplied on a per-installation basis ** to determine whether a person is allowed to send a message. ** This allows restriction of certain types of internet ** forwarding or registration of users. ** ** If the hosts are found to be incompatible, an error ** message should be given using "usrerr" and 0 should ** be returned. ** ** 'NoReturn' can be set to suppress the return-to-sender ** function; this should be done on huge messages. ** ** Parameters: ** to -- the person being sent to. ** ** Returns: ** an exit status ** ** Side Effects: ** none (unless you include the usrerr stuff) */ checkcompat(to, e) register ADDRESS *to; register ENVELOPE *e; { # ifdef lint if (to == NULL) to++; # endif /* lint */ if (tTd(49, 1)) printf("checkcompat(to=%s, from=%s)\n", to->q_paddr, e->e_from.q_paddr); # ifdef EXAMPLE_CODE /* this code is intended as an example only */ register STAB *s; s = stab("arpa", ST_MAILER, ST_FIND); if (s != NULL && e->e_from.q_mailer != LocalMailer && to->q_mailer == s->s_mailer) { usrerr("553 No ARPA mail through this machine: see your system administration"); /* NoReturn = TRUE; to supress return copy */ return (EX_UNAVAILABLE); } # endif /* EXAMPLE_CODE */ return (EX_OK); } /* ** SETSIGNAL -- set a signal handler ** ** This is essentially old BSD "signal(3)". */ sigfunc_t setsignal(sig, handler) int sig; sigfunc_t handler; { #if defined(SYS5SIGNALS) || defined(BSD4_3) || defined(_AUX_SOURCE) return signal(sig, handler); #else struct sigaction n, o; bzero(&n, sizeof n); n.sa_handler = handler; if (sigaction(sig, &n, &o) < 0) return SIG_ERR; return o.sa_handler; #endif } /* ** HOLDSIGS -- arrange to hold all signals ** ** Parameters: ** none. ** ** Returns: ** none. ** ** Side Effects: ** Arranges that signals are held. */ holdsigs() { } /* ** RLSESIGS -- arrange to release all signals ** ** This undoes the effect of holdsigs. ** ** Parameters: ** none. ** ** Returns: ** none. ** ** Side Effects: ** Arranges that signals are released. */ rlsesigs() { } /* ** INIT_MD -- do machine dependent initializations ** ** Systems that have global modes that should be set should do ** them here rather than in main. */ #ifdef _AUX_SOURCE # include #endif init_md(argc, argv) int argc; char **argv; { #ifdef _AUX_SOURCE setcompat(getcompat() | COMPAT_BSDPROT); #endif } /* ** GETLA -- get the current load average ** ** This code stolen from la.c. ** ** Parameters: ** none. ** ** Returns: ** The current load average as an integer. ** ** Side Effects: ** none. */ /* try to guess what style of load average we have */ #define LA_ZERO 1 /* always return load average as zero */ #define LA_INT 2 /* read kmem for avenrun; interpret as long */ #define LA_FLOAT 3 /* read kmem for avenrun; interpret as float */ #define LA_SUBR 4 /* call getloadavg */ #define LA_MACH 5 /* MACH load averages (as on NeXT boxes) */ #define LA_SHORT 6 /* read kmem for avenrun; interpret as short */ #define LA_PROCSTR 7 /* read string ("1.17") from /proc/loadavg */ /* do guesses based on general OS type */ #ifndef LA_TYPE # define LA_TYPE LA_ZERO #endif #if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) #include #ifndef LA_AVENRUN # ifdef SYSTEM5 # define LA_AVENRUN "avenrun" # else # define LA_AVENRUN "_avenrun" # endif #endif /* _PATH_UNIX should be defined in */ #ifndef _PATH_UNIX # if defined(SYSTEM5) # define _PATH_UNIX "/unix" # else -# define _PATH_UNIX "/vmunix" +# define _PATH_UNIX "/kernel" # endif #endif struct nlist Nl[] = { { LA_AVENRUN }, #define X_AVENRUN 0 { 0 }, }; #ifndef FSHIFT # if defined(unixpc) # define FSHIFT 5 # endif # if defined(__alpha) || defined(IRIX) # define FSHIFT 10 # endif #endif #ifndef FSHIFT # define FSHIFT 8 #endif #ifndef FSCALE # define FSCALE (1 << FSHIFT) #endif getla() { static int kmem = -1; #if LA_TYPE == LA_INT long avenrun[3]; #else # if LA_TYPE == LA_SHORT short avenrun[3]; # else double avenrun[3]; # endif #endif extern off_t lseek(); extern int errno; if (kmem < 0) { kmem = open("/dev/kmem", 0, 0); if (kmem < 0) { if (tTd(3, 1)) printf("getla: open(/dev/kmem): %s\n", errstring(errno)); return (-1); } (void) fcntl(kmem, F_SETFD, 1); if (nlist(_PATH_UNIX, Nl) < 0) { if (tTd(3, 1)) printf("getla: nlist(%s): %s\n", _PATH_UNIX, errstring(errno)); return (-1); } if (Nl[X_AVENRUN].n_value == 0) { if (tTd(3, 1)) printf("getla: nlist(%s, %s) ==> 0\n", _PATH_UNIX, LA_AVENRUN); return (-1); } #ifdef IRIX Nl[X_AVENRUN].n_value &= 0x7fffffff; #endif } if (tTd(3, 20)) printf("getla: symbol address = %#x\n", Nl[X_AVENRUN].n_value); if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 || read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun)) { /* thank you Ian */ if (tTd(3, 1)) printf("getla: lseek or read: %s\n", errstring(errno)); return (-1); } #if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) if (tTd(3, 5)) { printf("getla: avenrun = %d", avenrun[0]); if (tTd(3, 15)) printf(", %d, %d", avenrun[1], avenrun[2]); printf("\n"); } if (tTd(3, 1)) printf("getla: %d\n", (int) (avenrun[0] + FSCALE/2) >> FSHIFT); return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT); #else if (tTd(3, 5)) { printf("getla: avenrun = %g", avenrun[0]); if (tTd(3, 15)) printf(", %g, %g", avenrun[1], avenrun[2]); printf("\n"); } if (tTd(3, 1)) printf("getla: %d\n", (int) (avenrun[0] +0.5)); return ((int) (avenrun[0] + 0.5)); #endif } #else #if LA_TYPE == LA_SUBR #ifdef DGUX #include int getla() { struct dg_sys_info_load_info load_info; dg_sys_info((long *)&load_info, DG_SYS_INFO_LOAD_INFO_TYPE, DG_SYS_INFO_LOAD_VERSION_0); return((int) (load_info.one_minute + 0.5)); } #else getla() { double avenrun[3]; if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) < 0) { if (tTd(3, 1)) perror("getla: getloadavg failed:"); return (-1); } if (tTd(3, 1)) printf("getla: %d\n", (int) (avenrun[0] +0.5)); return ((int) (avenrun[0] + 0.5)); } #endif /* DGUX */ #else #if LA_TYPE == LA_MACH /* ** This has been tested on NEXTSTEP release 2.1/3.X. */ #if defined(NX_CURRENT_COMPILER_RELEASE) && NX_CURRENT_COMPILER_RELEASE > NX_COMPILER_RELEASE_3_0 # include #else # include #endif getla() { processor_set_t default_set; kern_return_t error; unsigned int info_count; struct processor_set_basic_info info; host_t host; error = processor_set_default(host_self(), &default_set); if (error != KERN_SUCCESS) return -1; info_count = PROCESSOR_SET_BASIC_INFO_COUNT; if (processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO, &host, (processor_set_info_t)&info, &info_count) != KERN_SUCCESS) { return -1; } return (int) (info.load_average + (LOAD_SCALE / 2)) / LOAD_SCALE; } #else #if LA_TYPE == LA_PROCSTR /* ** Read /proc/loadavg for the load average. This is assumed to be ** in a format like "0.15 0.12 0.06". ** ** Initially intended for Linux. This has been in the kernel ** since at least 0.99.15. */ # ifndef _PATH_LOADAVG # define _PATH_LOADAVG "/proc/loadavg" # endif int getla() { double avenrun; register int result; FILE *fp; fp = fopen(_PATH_LOADAVG, "r"); if (fp == NULL) { if (tTd(3, 1)) printf("getla: fopen(%s): %s\n", _PATH_LOADAVG, errstring(errno)); return -1; } result = fscanf(fp, "%lf", &avenrun); fclose(fp); if (result != 1) { if (tTd(3, 1)) printf("getla: fscanf() = %d: %s\n", result, errstring(errno)); return -1; } if (tTd(3, 1)) printf("getla(): %.2f\n", avenrun); return ((int) (avenrun + 0.5)); } #else getla() { if (tTd(3, 1)) printf("getla: ZERO\n"); return (0); } #endif #endif #endif #endif /* * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Authors: Many and varied... */ /* Non Apollo stuff removed by Don Lewis 11/15/93 */ #ifndef lint static char rcsid[] = "@(#)$Id: getloadavg.c,v 1.16 1991/06/21 12:51:15 paul Exp $"; #endif /* !lint */ #ifdef apollo # undef volatile # include /* ARGSUSED */ int getloadavg( call_data ) caddr_t call_data; /* pointer to (double) return value */ { double *avenrun = (double *) call_data; int i; status_$t st; long loadav[3]; proc1_$get_loadav(loadav, &st); *avenrun = loadav[0] / (double) (1 << 16); return(0); } # endif /* apollo */ /* ** SHOULDQUEUE -- should this message be queued or sent? ** ** Compares the message cost to the load average to decide. ** ** Parameters: ** pri -- the priority of the message in question. ** ctime -- the message creation time. ** ** Returns: ** TRUE -- if this message should be queued up for the ** time being. ** FALSE -- if the load is low enough to send this message. ** ** Side Effects: ** none. */ bool shouldqueue(pri, ctime) long pri; time_t ctime; { if (CurrentLA < QueueLA) return (FALSE); if (CurrentLA >= RefuseLA) return (TRUE); return (pri > (QueueFactor / (CurrentLA - QueueLA + 1))); } /* ** REFUSECONNECTIONS -- decide if connections should be refused ** ** Parameters: ** none. ** ** Returns: ** TRUE if incoming SMTP connections should be refused ** (for now). ** FALSE if we should accept new work. ** ** Side Effects: ** none. */ bool refuseconnections() { #ifdef XLA if (!xla_smtp_ok()) return TRUE; #endif /* this is probably too simplistic */ return (CurrentLA >= RefuseLA); } /* ** SETPROCTITLE -- set process title for ps ** ** Parameters: ** fmt -- a printf style format string. ** a, b, c -- possible parameters to fmt. ** ** Returns: ** none. ** ** Side Effects: ** Clobbers argv of our main procedure so ps(1) will ** display the title. */ #ifdef SETPROCTITLE # ifdef HASSETPROCTITLE *** ERROR *** Cannot have both SETPROCTITLE and HASSETPROCTITLE defined # endif # ifdef __hpux # include # endif # ifdef BSD4_4 # include # include # ifdef __bsdi__ # undef PS_STRINGS /* BSDI 1.0 doesn't do PS_STRINGS as we expect */ # define PROCTITLEPAD '\0' # endif # ifdef __FreeBSD__ # undef PS_STRINGS /* XXX This is broken due to needing */ # define PROCTITLEPAD '\0' # endif # ifdef PS_STRINGS # define SETPROC_STATIC static # endif # endif # ifndef SETPROC_STATIC # define SETPROC_STATIC # endif #endif #ifndef PROCTITLEPAD # define PROCTITLEPAD ' ' #endif #ifndef HASSETPROCTITLE /*VARARGS1*/ #ifdef __STDC__ setproctitle(char *fmt, ...) #else setproctitle(fmt, va_alist) char *fmt; va_dcl #endif { # ifdef SETPROCTITLE register char *p; register int i; SETPROC_STATIC char buf[MAXLINE]; VA_LOCAL_DECL # ifdef __hpux union pstun pst; # endif extern char **Argv; extern char *LastArgv; p = buf; /* print sendmail: heading for grep */ (void) strcpy(p, "sendmail: "); p += strlen(p); /* print the argument string */ VA_START(fmt); (void) vsprintf(p, fmt, ap); VA_END; i = strlen(buf); # ifdef __hpux pst.pst_command = buf; pstat(PSTAT_SETCMD, pst, i, 0, 0); # else # ifdef PS_STRINGS PS_STRINGS->ps_nargvstr = 1; PS_STRINGS->ps_argvstr = buf; # else if (i > LastArgv - Argv[0] - 2) { i = LastArgv - Argv[0] - 2; buf[i] = '\0'; } (void) strcpy(Argv[0], buf); p = &Argv[0][i]; while (p < LastArgv) *p++ = PROCTITLEPAD; # endif # endif # endif /* SETPROCTITLE */ } #endif /* ** REAPCHILD -- pick up the body of my child, lest it become a zombie ** ** Parameters: ** none. ** ** Returns: ** none. ** ** Side Effects: ** Picks up extant zombies. */ void reapchild() { int olderrno = errno; # ifdef HASWAITPID auto int status; int count; int pid; count = 0; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { if (count++ > 1000) { #ifdef LOG syslog(LOG_ALERT, "reapchild: waitpid loop: pid=%d, status=%x", pid, status); #endif break; } } # else # ifdef WNOHANG union wait status; while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) continue; # else /* WNOHANG */ auto int status; while (wait(&status) > 0) continue; # endif /* WNOHANG */ # endif # ifdef SYS5SIGNALS (void) setsignal(SIGCHLD, reapchild); # endif errno = olderrno; } /* ** UNSETENV -- remove a variable from the environment ** ** Not needed on newer systems. ** ** Parameters: ** name -- the string name of the environment variable to be ** deleted from the current environment. ** ** Returns: ** none. ** ** Globals: ** environ -- a pointer to the current environment. ** ** Side Effects: ** Modifies environ. */ #ifndef HASUNSETENV void unsetenv(name) char *name; { extern char **environ; register char **pp; int len = strlen(name); for (pp = environ; *pp != NULL; pp++) { if (strncmp(name, *pp, len) == 0 && ((*pp)[len] == '=' || (*pp)[len] == '\0')) break; } for (; *pp != NULL; pp++) *pp = pp[1]; } #endif /* ** GETDTABLESIZE -- return number of file descriptors ** ** Only on non-BSD systems ** ** Parameters: ** none ** ** Returns: ** size of file descriptor table ** ** Side Effects: ** none */ #ifdef SOLARIS # include #endif int getdtsize() { #ifdef RLIMIT_NOFILE struct rlimit rl; if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) return rl.rlim_cur; #endif # ifdef HASGETDTABLESIZE return getdtablesize(); # else # ifdef _SC_OPEN_MAX return sysconf(_SC_OPEN_MAX); # else return NOFILE; # endif # endif } /* ** UNAME -- get the UUCP name of this system. */ #ifndef HASUNAME int uname(name) struct utsname *name; { FILE *file; char *n; name->nodename[0] = '\0'; /* try /etc/whoami -- one line with the node name */ if ((file = fopen("/etc/whoami", "r")) != NULL) { (void) fgets(name->nodename, NODE_LENGTH + 1, file); (void) fclose(file); n = strchr(name->nodename, '\n'); if (n != NULL) *n = '\0'; if (name->nodename[0] != '\0') return (0); } /* try /usr/include/whoami.h -- has a #define somewhere */ if ((file = fopen("/usr/include/whoami.h", "r")) != NULL) { char buf[MAXLINE]; while (fgets(buf, MAXLINE, file) != NULL) if (sscanf(buf, "#define sysname \"%*[^\"]\"", NODE_LENGTH, name->nodename) > 0) break; (void) fclose(file); if (name->nodename[0] != '\0') return (0); } #ifdef TRUST_POPEN /* ** Popen is known to have security holes. */ /* try uuname -l to return local name */ if ((file = popen("uuname -l", "r")) != NULL) { (void) fgets(name, NODE_LENGTH + 1, file); (void) pclose(file); n = strchr(name, '\n'); if (n != NULL) *n = '\0'; if (name->nodename[0] != '\0') return (0); } #endif return (-1); } #endif /* HASUNAME */ /* ** INITGROUPS -- initialize groups ** ** Stub implementation for System V style systems */ #ifndef HASINITGROUPS initgroups(name, basegid) char *name; int basegid; { return 0; } #endif /* ** SETSID -- set session id (for non-POSIX systems) */ #ifndef HASSETSID pid_t setsid __P ((void)) { #ifdef TIOCNOTTY int fd; fd = open("/dev/tty", O_RDWR, 0); if (fd >= 0) { (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0); (void) close(fd); } #endif /* TIOCNOTTY */ # ifdef SYS5SETPGRP return setpgrp(); # else return setpgid(0, getpid()); # endif } #endif /* ** FSYNC -- dummy fsync */ #ifdef NEEDFSYNC fsync(fd) int fd; { # ifdef O_SYNC return fcntl(fd, F_SETFL, O_SYNC); # else /* nothing we can do */ return 0; # endif } #endif /* ** DGUX_INET_ADDR -- inet_addr for DG/UX ** ** Data General DG/UX version of inet_addr returns a struct in_addr ** instead of a long. This patches things. */ #ifdef DGUX #undef inet_addr long dgux_inet_addr(host) char *host; { struct in_addr haddr; haddr = inet_addr(host); return haddr.s_addr; } #endif /* ** GETOPT -- for old systems or systems with bogus implementations */ #ifdef NEEDGETOPT /* * Copyright (c) 1985 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ /* ** this version hacked to add `atend' flag to allow state machine ** to reset if invoked by the program to scan args for a 2nd time */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getopt.c 4.3 (Berkeley) 3/9/86"; #endif /* LIBC_SCCS and not lint */ #include /* * get option letter from argument vector */ #ifdef _CONVEX_SOURCE extern int optind, opterr; #else int opterr = 1; /* if error message should be printed */ int optind = 1; /* index into parent argv vector */ #endif int optopt; /* character checked for validity */ char *optarg; /* argument associated with option */ #define BADCH (int)'?' #define EMSG "" #define tell(s) if (opterr) {fputs(*nargv,stderr);fputs(s,stderr); \ fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);} getopt(nargc,nargv,ostr) int nargc; char *const *nargv; const char *ostr; { static char *place = EMSG; /* option letter processing */ static char atend = 0; register char *oli; /* option letter list index */ if (atend) { atend = 0; place = EMSG; } if(!*place) { /* update scanning pointer */ if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) { atend++; return(EOF); } if (*place == '-') { /* found "--" */ ++optind; atend++; return(EOF); } } /* option letter okay? */ if ((optopt = (int)*place++) == (int)':' || !(oli = strchr(ostr,optopt))) { if (!*place) ++optind; tell(": illegal option -- "); } if (*++oli != ':') { /* don't need argument */ optarg = NULL; if (!*place) ++optind; } else { /* need an argument */ if (*place) optarg = place; /* no white space */ else if (nargc <= ++optind) { /* no arg */ place = EMSG; tell(": option requires an argument -- "); } else optarg = nargv[optind]; /* white space */ place = EMSG; ++optind; } return(optopt); /* dump back option letter */ } #endif /* ** VFPRINTF, VSPRINTF -- for old 4.3 BSD systems missing a real version */ #ifdef NEEDVPRINTF #define MAXARG 16 vfprintf(fp, fmt, ap) FILE * fp; char * fmt; char ** ap; { char * bp[MAXARG]; int i = 0; while (*ap && i < MAXARG) bp[i++] = *ap++; fprintf(fp, fmt, bp[0], bp[1], bp[2], bp[3], bp[4], bp[5], bp[6], bp[7], bp[8], bp[9], bp[10], bp[11], bp[12], bp[13], bp[14], bp[15]); } vsprintf(s, fmt, ap) char * s; char * fmt; char ** ap; { char * bp[MAXARG]; int i = 0; while (*ap && i < MAXARG) bp[i++] = *ap++; sprintf(s, fmt, bp[0], bp[1], bp[2], bp[3], bp[4], bp[5], bp[6], bp[7], bp[8], bp[9], bp[10], bp[11], bp[12], bp[13], bp[14], bp[15]); } #endif /* ** USERSHELLOK -- tell if a user's shell is ok for unrestricted use ** ** Parameters: ** shell -- the user's shell from /etc/passwd ** ** Returns: ** TRUE -- if it is ok to use this for unrestricted access. ** FALSE -- if the shell is restricted. */ #if !HASGETUSERSHELL # ifndef _PATH_SHELLS # define _PATH_SHELLS "/etc/shells" # endif char *DefaultUserShells[] = { "/bin/sh", "/usr/bin/sh", "/bin/csh", "/usr/bin/csh", #ifdef __hpux "/bin/rsh", "/bin/ksh", "/bin/rksh", "/bin/pam", "/usr/bin/keysh", "/bin/posix/sh", #endif NULL }; #endif #define WILDCARD_SHELL "/SENDMAIL/ANY/SHELL/" bool usershellok(shell) char *shell; { #if HASGETUSERSHELL register char *p; extern char *getusershell(); setusershell(); while ((p = getusershell()) != NULL) if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0) break; endusershell(); return p != NULL; #else register FILE *shellf; char buf[MAXLINE]; shellf = fopen(_PATH_SHELLS, "r"); if (shellf == NULL) { /* no /etc/shells; see if it is one of the std shells */ char **d; for (d = DefaultUserShells; *d != NULL; d++) { if (strcmp(shell, *d) == 0) return TRUE; } return FALSE; } while (fgets(buf, sizeof buf, shellf) != NULL) { register char *p, *q; p = buf; while (*p != '\0' && *p != '#' && *p != '/') p++; if (*p == '#' || *p == '\0') continue; q = p; while (*p != '\0' && *p != '#' && !isspace(*p)) p++; *p = '\0'; if (strcmp(shell, q) == 0 || strcmp(WILDCARD_SHELL, q) == 0) { fclose(shellf); return TRUE; } } fclose(shellf); return FALSE; #endif } /* ** FREESPACE -- see how much free space is on the queue filesystem ** ** Only implemented if you have statfs. ** ** Parameters: ** dir -- the directory in question. ** bsize -- a variable into which the filesystem ** block size is stored. ** ** Returns: ** The number of bytes free on the queue filesystem. ** -1 if the statfs call fails. ** ** Side effects: ** Puts the filesystem block size into bsize. */ /* statfs types */ #define SFS_NONE 0 /* no statfs implementation */ #define SFS_USTAT 1 /* use ustat */ #define SFS_4ARGS 2 /* use four-argument statfs call */ #define SFS_VFS 3 /* use implementation */ #define SFS_MOUNT 4 /* use implementation */ #define SFS_STATFS 5 /* use implementation */ #define SFS_STATVFS 6 /* use implementation */ #ifndef SFS_TYPE # define SFS_TYPE SFS_NONE #endif #if SFS_TYPE == SFS_USTAT # include #endif #if SFS_TYPE == SFS_4ARGS || SFS_TYPE == SFS_STATFS # include #endif #if SFS_TYPE == SFS_VFS # include #endif #if SFS_TYPE == SFS_MOUNT # include #endif #if SFS_TYPE == SFS_STATVFS # include #endif long freespace(dir, bsize) char *dir; long *bsize; { #if SFS_TYPE != SFS_NONE # if SFS_TYPE == SFS_USTAT struct ustat fs; struct stat statbuf; # define FSBLOCKSIZE DEV_BSIZE # define f_bavail f_tfree # else # if defined(ultrix) struct fs_data fs; # define f_bavail fd_bfreen # define FSBLOCKSIZE fs.fd_bsize # else # if SFS_TYPE == SFS_STATVFS struct statvfs fs; # define FSBLOCKSIZE fs.f_bsize # else struct statfs fs; # define FSBLOCKSIZE fs.f_bsize # if defined(_SCO_unix_) || defined(IRIX) || defined(apollo) # define f_bavail f_bfree # endif # endif # endif # endif extern int errno; # if SFS_TYPE == SFS_USTAT if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0) # else # if SFS_TYPE == SFS_4ARGS if (statfs(dir, &fs, sizeof fs, 0) == 0) # else # if defined(ultrix) if (statfs(dir, &fs) > 0) # else if (statfs(dir, &fs) == 0) # endif # endif # endif { if (bsize != NULL) *bsize = FSBLOCKSIZE; return (fs.f_bavail); } #endif return (-1); } /* ** ENOUGHSPACE -- check to see if there is enough free space on the queue fs ** ** Only implemented if you have statfs. ** ** Parameters: ** msize -- the size to check against. If zero, we don't yet ** know how big the message will be, so just check for ** a "reasonable" amount. ** ** Returns: ** TRUE if there is enough space. ** FALSE otherwise. */ bool enoughspace(msize) long msize; { long bfree, bsize; if (MinBlocksFree <= 0 && msize <= 0) { if (tTd(4, 80)) printf("enoughspace: no threshold\n"); return TRUE; } if ((bfree = freespace(QueueDir, &bsize)) >= 0) { if (tTd(4, 80)) printf("enoughspace: bavail=%ld, need=%ld\n", bfree, msize); /* convert msize to block count */ msize = msize / bsize + 1; if (MinBlocksFree >= 0) msize += MinBlocksFree; if (bfree < msize) { #ifdef LOG if (LogLevel > 0) syslog(LOG_ALERT, "%s: low on space (have %ld, %s needs %ld in %s)", CurEnv->e_id, bfree, CurHostName, msize, QueueDir); #endif return FALSE; } } else if (tTd(4, 80)) printf("enoughspace failure: min=%ld, need=%ld: %s\n", MinBlocksFree, msize, errstring(errno)); return TRUE; } /* ** TRANSIENTERROR -- tell if an error code indicates a transient failure ** ** This looks at an errno value and tells if this is likely to ** go away if retried later. ** ** Parameters: ** err -- the errno code to classify. ** ** Returns: ** TRUE if this is probably transient. ** FALSE otherwise. */ bool transienterror(err) int err; { switch (err) { case EIO: /* I/O error */ case ENXIO: /* Device not configured */ case EAGAIN: /* Resource temporarily unavailable */ case ENOMEM: /* Cannot allocate memory */ case ENODEV: /* Operation not supported by device */ case ENFILE: /* Too many open files in system */ case EMFILE: /* Too many open files */ case ENOSPC: /* No space left on device */ #ifdef ETIMEDOUT case ETIMEDOUT: /* Connection timed out */ #endif #ifdef ESTALE case ESTALE: /* Stale NFS file handle */ #endif #ifdef ENETDOWN case ENETDOWN: /* Network is down */ #endif #ifdef ENETUNREACH case ENETUNREACH: /* Network is unreachable */ #endif #ifdef ENETRESET case ENETRESET: /* Network dropped connection on reset */ #endif #ifdef ECONNABORTED case ECONNABORTED: /* Software caused connection abort */ #endif #ifdef ECONNRESET case ECONNRESET: /* Connection reset by peer */ #endif #ifdef ENOBUFS case ENOBUFS: /* No buffer space available */ #endif #ifdef ESHUTDOWN case ESHUTDOWN: /* Can't send after socket shutdown */ #endif #ifdef ECONNREFUSED case ECONNREFUSED: /* Connection refused */ #endif #ifdef EHOSTDOWN case EHOSTDOWN: /* Host is down */ #endif #ifdef EHOSTUNREACH case EHOSTUNREACH: /* No route to host */ #endif #ifdef EDQUOT case EDQUOT: /* Disc quota exceeded */ #endif #ifdef EPROCLIM case EPROCLIM: /* Too many processes */ #endif #ifdef EUSERS case EUSERS: /* Too many users */ #endif #ifdef EDEADLK case EDEADLK: /* Resource deadlock avoided */ #endif #ifdef EISCONN case EISCONN: /* Socket already connected */ #endif #ifdef EINPROGRESS case EINPROGRESS: /* Operation now in progress */ #endif #ifdef EALREADY case EALREADY: /* Operation already in progress */ #endif #ifdef EADDRINUSE case EADDRINUSE: /* Address already in use */ #endif #ifdef EADDRNOTAVAIL case EADDRNOTAVAIL: /* Can't assign requested address */ #endif #ifdef ETXTBSY case ETXTBSY: /* (Apollo) file locked */ #endif #if defined(ENOSR) && (!defined(ENOBUFS) || (ENOBUFS != ENOSR)) case ENOSR: /* Out of streams resources */ #endif return TRUE; } /* nope, must be permanent */ return FALSE; } /* ** LOCKFILE -- lock a file using flock or (shudder) fcntl locking ** ** Parameters: ** fd -- the file descriptor of the file. ** filename -- the file name (for error messages). ** ext -- the filename extension. ** type -- type of the lock. Bits can be: ** LOCK_EX -- exclusive lock. ** LOCK_NB -- non-blocking. ** ** Returns: ** TRUE if the lock was acquired. ** FALSE otherwise. */ bool lockfile(fd, filename, ext, type) int fd; char *filename; char *ext; int type; { # if !HASFLOCK int action; struct flock lfd; if (ext == NULL) ext = ""; bzero(&lfd, sizeof lfd); if (bitset(LOCK_UN, type)) lfd.l_type = F_UNLCK; else if (bitset(LOCK_EX, type)) lfd.l_type = F_WRLCK; else lfd.l_type = F_RDLCK; if (bitset(LOCK_NB, type)) action = F_SETLK; else action = F_SETLKW; if (tTd(55, 60)) printf("lockfile(%s%s, action=%d, type=%d): ", filename, ext, action, lfd.l_type); if (fcntl(fd, action, &lfd) >= 0) { if (tTd(55, 60)) printf("SUCCESS\n"); return TRUE; } if (tTd(55, 60)) printf("(%s) ", errstring(errno)); /* ** On SunOS, if you are testing using -oQ/tmp/mqueue or ** -oA/tmp/aliases or anything like that, and /tmp is mounted ** as type "tmp" (that is, served from swap space), the ** previous fcntl will fail with "Invalid argument" errors. ** Since this is fairly common during testing, we will assume ** that this indicates that the lock is successfully grabbed. */ if (errno == EINVAL) { if (tTd(55, 60)) printf("SUCCESS\n"); return TRUE; } if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN)) { int omode = -1; # ifdef F_GETFL int oerrno = errno; (void) fcntl(fd, F_GETFL, &omode); errno = oerrno; # endif syserr("cannot lockf(%s%s, fd=%d, type=%o, omode=%o, euid=%d)", filename, ext, fd, type, omode, geteuid()); } # else if (ext == NULL) ext = ""; if (tTd(55, 60)) printf("lockfile(%s%s, type=%o): ", filename, ext, type); if (flock(fd, type) >= 0) { if (tTd(55, 60)) printf("SUCCESS\n"); return TRUE; } if (tTd(55, 60)) printf("(%s) ", errstring(errno)); if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK) { int omode = -1; # ifdef F_GETFL int oerrno = errno; (void) fcntl(fd, F_GETFL, &omode); errno = oerrno; # endif syserr("cannot flock(%s%s, fd=%d, type=%o, omode=%o, euid=%d)", filename, ext, fd, type, omode, geteuid()); } # endif if (tTd(55, 60)) printf("FAIL\n"); return FALSE; } /* ** CHOWNSAFE -- tell if chown is "safe" (executable only by root) ** ** Parameters: ** fd -- the file descriptor to check. ** ** Returns: ** TRUE -- if only root can chown the file to an arbitrary ** user. ** FALSE -- if an arbitrary user can give away a file. */ bool chownsafe(fd) int fd; { #ifdef __hpux char *s; int tfd; uid_t o_uid, o_euid; gid_t o_gid, o_egid; bool rval; struct stat stbuf; o_uid = getuid(); o_euid = geteuid(); o_gid = getgid(); o_egid = getegid(); fstat(fd, &stbuf); setresuid(stbuf.st_uid, stbuf.st_uid, -1); setresgid(stbuf.st_gid, stbuf.st_gid, -1); s = tmpnam(NULL); tfd = open(s, O_RDONLY|O_CREAT, 0600); rval = fchown(tfd, DefUid, DefGid) != 0; close(tfd); unlink(s); setreuid(o_uid, o_euid); setresgid(o_gid, o_egid, -1); return rval; #else # ifdef _POSIX_CHOWN_RESTRICTED # if _POSIX_CHOWN_RESTRICTED == -1 return FALSE; # else return TRUE; # endif # else # ifdef _PC_CHOWN_RESTRICTED return fpathconf(fd, _PC_CHOWN_RESTRICTED) > 0; # else # ifdef BSD return TRUE; # else return FALSE; # endif # endif # endif #endif } /* ** GETCFNAME -- return the name of the .cf file. ** ** Some systems (e.g., NeXT) determine this dynamically. */ char * getcfname() { if (ConfFile != NULL) return ConfFile; #ifdef NETINFO { extern char *ni_propval(); char *cflocation; cflocation = ni_propval("/locations/sendmail", "sendmail.cf"); if (cflocation != NULL) return cflocation; } #endif return _PATH_SENDMAILCF; } /* ** SETVENDOR -- process vendor code from V configuration line ** ** Parameters: ** vendor -- string representation of vendor. ** ** Returns: ** TRUE -- if ok. ** FALSE -- if vendor code could not be processed. ** ** Side Effects: ** It is reasonable to set mode flags here to tweak ** processing in other parts of the code if necessary. ** For example, if you are a vendor that uses $%y to ** indicate YP lookups, you could enable that here. */ bool setvendor(vendor) char *vendor; { if (strcasecmp(vendor, "Berkeley") == 0) return TRUE; /* add vendor extensions here */ return FALSE; } /* ** STRTOL -- convert string to long integer ** ** For systems that don't have it in the C library. ** ** This is taken verbatim from the 4.4-Lite C library. */ #ifdef NEEDSTRTOL #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include /* * Convert a string to a long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ long strtol(nptr, endptr, base) const char *nptr; char **endptr; register int base; { register const char *s = nptr; register unsigned long acc; register int c; register unsigned long cutoff; register int neg = 0, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else * assume decimal; if base is already 16, allow 0x. */ do { c = *s++; } while (isspace(c)); if (c == '-') { neg = 1; c = *s++; } else if (c == '+') c = *s++; if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = c == '0' ? 8 : 10; /* * Compute the cutoff value between legal numbers and illegal * numbers. That is the largest legal value, divided by the * base. An input number that is greater than this value, if * followed by a legal input character, is too big. One that * is equal to this value may be valid or not; the limit * between valid and invalid numbers is then based on the last * digit. For instance, if the range for longs is * [-2147483648..2147483647] and the input base is 10, * cutoff will be set to 214748364 and cutlim to either * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated * a value > 214748364, or equal but the next digit is > 7 (or 8), * the number is too big, and we will return a range error. * * Set any if any `digits' consumed; make it negative to indicate * overflow. */ cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; cutlim = cutoff % (unsigned long)base; cutoff /= (unsigned long)base; for (acc = 0, any = 0;; c = *s++) { if (isdigit(c)) c -= '0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) break; if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) any = -1; else { any = 1; acc *= base; acc += c; } } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) *endptr = (char *)(any ? s - 1 : nptr); return (acc); } #endif /* ** SOLARIS_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX ** ** Solaris versions prior through 2.3 don't properly deliver a ** canonical h_name field. This tries to work around it. */ #ifdef SOLARIS struct hostent * solaris_gethostbyname(name) const char *name; { # ifdef SOLARIS_2_3 static struct hostent hp; static char buf[1000]; extern struct hostent *_switch_gethostbyname_r(); return _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno); # else extern struct hostent *__switch_gethostbyname(); return __switch_gethostbyname(name); # endif } struct hostent * solaris_gethostbyaddr(addr, len, type) const char *addr; int len; int type; { # ifdef SOLARIS_2_3 static struct hostent hp; static char buf[1000]; extern struct hostent *_switch_gethostbyaddr_r(); return _switch_gethostbyaddr_r(addr, len, type, &hp, buf, sizeof(buf), &h_errno); # else extern struct hostent *__switch_gethostbyaddr(); return __switch_gethostbyaddr(addr, len, type); # endif } #endif /* ** NI_PROPVAL -- netinfo property value lookup routine ** ** Parameters: ** directory -- the Netinfo directory name. ** propname -- the Netinfo property name. ** ** Returns: ** NULL -- if: ** 1. the directory is not found ** 2. the property name is not found ** 3. the property contains multiple values ** 4. some error occured ** else -- the location of the config file. ** ** Notes: ** Caller should free the return value of ni_proval */ #ifdef NETINFO # include # define LOCAL_NETINFO_DOMAIN "." # define PARENT_NETINFO_DOMAIN ".." # define MAX_NI_LEVELS 256 char * ni_propval(directory, propname) char *directory; char *propname; { char *propval = NULL; int i; void *ni = NULL; void *lastni = NULL; ni_status nis; ni_id nid; ni_namelist ninl; /* ** If the passed directory and property name are found ** in one of netinfo domains we need to search (starting ** from the local domain moving all the way back to the ** root domain) set propval to the property's value ** and return it. */ for (i = 0; i < MAX_NI_LEVELS; ++i) { if (i == 0) { nis = ni_open(NULL, LOCAL_NETINFO_DOMAIN, &ni); } else { if (lastni != NULL) ni_free(lastni); lastni = ni; nis = ni_open(lastni, PARENT_NETINFO_DOMAIN, &ni); } /* ** Don't bother if we didn't get a handle on a ** proper domain. This is not necessarily an error. ** We would get a positive ni_status if, for instance ** we never found the directory or property and tried ** to open the parent of the root domain! */ if (nis != 0) break; /* ** Find the path to the server information. */ if (ni_pathsearch(ni, &nid, directory) != 0) continue; /* ** Find "host" information. */ if (ni_lookupprop(ni, &nid, propname, &ninl) != 0) continue; /* ** If there's only one name in ** the list, assume we've got ** what we want. */ if (ninl.ni_namelist_len == 1) { propval = ni_name_dup(ninl.ni_namelist_val[0]); break; } } /* ** Clean up. */ if (ni != NULL) ni_free(ni); if (lastni != NULL && ni != lastni) ni_free(lastni); return propval; } #endif /* NETINFO */ /* ** HARD_SYSLOG -- call syslog repeatedly until it works ** ** Needed on HP-UX, which apparently doesn't guarantee that ** syslog succeeds during interrupt handlers. */ #ifdef __hpux # define MAXSYSLOGTRIES 100 # undef syslog # ifdef __STDC__ hard_syslog(int pri, char *msg, ...) # else hard_syslog(pri, msg, va_alist) int pri; char *msg; va_dcl # endif { int i; char buf[SYSLOG_BUFSIZE * 2]; VA_LOCAL_DECL; VA_START(msg); vsprintf(buf, msg, ap); VA_END; for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, "%s", buf) < 0; ) continue; } #endif Index: head/usr.sbin/syslogd/syslogd.c =================================================================== --- head/usr.sbin/syslogd/syslogd.c (revision 1855) +++ head/usr.sbin/syslogd/syslogd.c (revision 1856) @@ -1,1131 +1,1131 @@ /* * Copyright (c) 1983, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. 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. */ #ifndef lint static char copyright[] = "@(#) Copyright (c) 1983, 1988, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #endif /* not lint */ /* * syslogd -- log system messages * * This program implements a system log. It takes a series of lines. * Each line may have a priority, signified as "" as * the first characters of the line. If this is * not present, a default priority is used. * * To kill syslogd, send a signal 15 (terminate). A signal 1 (hup) will * cause it to reread its configuration file. * * Defined Constants: * * MAXLINE -- the maximimum line length that can be handled. * DEFUPRI -- the default priority for user messages * DEFSPRI -- the default priority for kernel messages * * Author: Eric Allman * extensive changes by Ralph Campbell * more extensive changes by Eric Allman (again) */ #define MAXLINE 1024 /* maximum line length */ #define MAXSVLINE 120 /* maximum saved line length */ #define DEFUPRI (LOG_USER|LOG_NOTICE) #define DEFSPRI (LOG_KERN|LOG_CRIT) #define TIMERINTVL 30 /* interval for checking flush, mark */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pathnames.h" #define SYSLOG_NAMES #include char *LogName = _PATH_LOG; char *ConfFile = _PATH_LOGCONF; char *PidFile = _PATH_LOGPID; char ctty[] = _PATH_CONSOLE; #define FDMASK(fd) (1 << (fd)) #define dprintf if (Debug) printf #define MAXUNAMES 20 /* maximum number of user names */ /* * Flags to logmsg(). */ #define IGN_CONS 0x001 /* don't print on console */ #define SYNC_FILE 0x002 /* do fsync on file after printing */ #define ADDDATE 0x004 /* add a date to the message */ #define MARK 0x008 /* this message is a mark */ /* * This structure represents the files that will have log * copies printed. */ struct filed { struct filed *f_next; /* next in linked list */ short f_type; /* entry type, see below */ short f_file; /* file descriptor */ time_t f_time; /* time this was last written */ u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */ union { char f_uname[MAXUNAMES][UT_NAMESIZE+1]; struct { char f_hname[MAXHOSTNAMELEN+1]; struct sockaddr_in f_addr; } f_forw; /* forwarding address */ char f_fname[MAXPATHLEN]; } f_un; char f_prevline[MAXSVLINE]; /* last message logged */ char f_lasttime[16]; /* time of last occurrence */ char f_prevhost[MAXHOSTNAMELEN+1]; /* host from which recd. */ int f_prevpri; /* pri of f_prevline */ int f_prevlen; /* length of f_prevline */ int f_prevcount; /* repetition cnt of prevline */ int f_repeatcount; /* number of "repeated" msgs */ }; /* * Intervals at which we flush out "message repeated" messages, * in seconds after previous message is logged. After each flush, * we move to the next interval until we reach the largest. */ int repeatinterval[] = { 30, 120, 600 }; /* # of secs before flush */ #define MAXREPEAT ((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1) #define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) #define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ (f)->f_repeatcount = MAXREPEAT; \ } /* values for f_type */ #define F_UNUSED 0 /* unused entry */ #define F_FILE 1 /* regular file */ #define F_TTY 2 /* terminal */ #define F_CONSOLE 3 /* console terminal */ #define F_FORW 4 /* remote machine */ #define F_USERS 5 /* list of users */ #define F_WALL 6 /* everyone logged on */ char *TypeNames[7] = { "UNUSED", "FILE", "TTY", "CONSOLE", "FORW", "USERS", "WALL" }; struct filed *Files; struct filed consfile; int Debug; /* debug flag */ char LocalHostName[MAXHOSTNAMELEN+1]; /* our hostname */ char *LocalDomain; /* our local domain name */ int InetInuse = 0; /* non-zero if INET sockets are being used */ int finet; /* Internet datagram socket */ int LogPort; /* port number for INET connections */ int Initialized = 0; /* set when we have initialized ourselves */ int MarkInterval = 20 * 60; /* interval between marks in seconds */ int MarkSeq = 0; /* mark sequence number */ void cfline __P((char *, struct filed *)); char *cvthname __P((struct sockaddr_in *)); int decode __P((const char *, CODE *)); void die __P((int)); void domark __P((int)); void fprintlog __P((struct filed *, int, char *)); void init __P((int)); void logerror __P((char *)); void logmsg __P((int, char *, char *, int)); void printline __P((char *, char *)); void printsys __P((char *)); void reapchild __P((int)); char *ttymsg __P((struct iovec *, int, char *, int)); void usage __P((void)); void wallmsg __P((struct filed *, struct iovec *)); int main(argc, argv) int argc; char *argv[]; { int ch, funix, i, inetm, fklog, klogm, len; struct sockaddr_un sunx, fromunix; struct sockaddr_in sin, frominet; FILE *fp; char *p, line[MSG_BSIZE + 1]; while ((ch = getopt(argc, argv, "df:m:p:")) != EOF) switch(ch) { case 'd': /* debug */ Debug++; break; case 'f': /* configuration file */ ConfFile = optarg; break; case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; case 'p': /* path */ LogName = optarg; break; case '?': default: usage(); } if ((argc -= optind) != 0) usage(); if (!Debug) (void)daemon(0, 0); else setlinebuf(stdout); consfile.f_type = F_CONSOLE; (void)strcpy(consfile.f_un.f_fname, ctty); (void)gethostname(LocalHostName, sizeof(LocalHostName)); if ((p = strchr(LocalHostName, '.')) != NULL) { *p++ = '\0'; LocalDomain = p; } else LocalDomain = ""; (void)signal(SIGTERM, die); (void)signal(SIGINT, Debug ? die : SIG_IGN); (void)signal(SIGQUIT, Debug ? die : SIG_IGN); (void)signal(SIGCHLD, reapchild); (void)signal(SIGALRM, domark); (void)alarm(TIMERINTVL); (void)unlink(LogName); #ifndef SUN_LEN #define SUN_LEN(unp) (strlen((unp)->sun_path) + 2) #endif memset(&sunx, 0, sizeof(sunx)); sunx.sun_family = AF_UNIX; (void)strncpy(sunx.sun_path, LogName, sizeof(sunx.sun_path)); funix = socket(AF_UNIX, SOCK_DGRAM, 0); if (funix < 0 || bind(funix, (struct sockaddr *)&sunx, SUN_LEN(&sunx)) < 0 || chmod(LogName, 0666) < 0) { (void) sprintf(line, "cannot create %s", LogName); logerror(line); dprintf("cannot create %s (%d)\n", LogName, errno); die(0); } finet = socket(AF_INET, SOCK_DGRAM, 0); inetm = 0; if (finet >= 0) { struct servent *sp; sp = getservbyname("syslog", "udp"); if (sp == NULL) { errno = 0; logerror("syslog/udp: unknown service"); die(0); } memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = LogPort = sp->s_port; if (bind(finet, (struct sockaddr *)&sin, sizeof(sin)) < 0) { logerror("bind"); if (!Debug) die(0); } else { inetm = FDMASK(finet); InetInuse = 1; } } if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) >= 0) klogm = FDMASK(fklog); else { dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); klogm = 0; } /* tuck my process id away */ fp = fopen(PidFile, "w"); if (fp != NULL) { fprintf(fp, "%d\n", getpid()); (void) fclose(fp); } dprintf("off & running....\n"); init(0); (void)signal(SIGHUP, init); for (;;) { int nfds, readfds = FDMASK(funix) | inetm | klogm; dprintf("readfds = %#x\n", readfds); nfds = select(20, (fd_set *)&readfds, (fd_set *)NULL, (fd_set *)NULL, (struct timeval *)NULL); if (nfds == 0) continue; if (nfds < 0) { if (errno != EINTR) logerror("select"); continue; } dprintf("got a message (%d, %#x)\n", nfds, readfds); if (readfds & klogm) { i = read(fklog, line, sizeof(line) - 1); if (i > 0) { line[i] = '\0'; printsys(line); } else if (i < 0 && errno != EINTR) { logerror("klog"); fklog = -1; klogm = 0; } } if (readfds & FDMASK(funix)) { len = sizeof(fromunix); i = recvfrom(funix, line, MAXLINE, 0, (struct sockaddr *)&fromunix, &len); if (i > 0) { line[i] = '\0'; printline(LocalHostName, line); } else if (i < 0 && errno != EINTR) logerror("recvfrom unix"); } if (readfds & inetm) { len = sizeof(frominet); i = recvfrom(finet, line, MAXLINE, 0, (struct sockaddr *)&frominet, &len); if (i > 0) { line[i] = '\0'; printline(cvthname(&frominet), line); } else if (i < 0 && errno != EINTR) logerror("recvfrom inet"); } } } void usage() { (void)fprintf(stderr, "usage: syslogd [-f conffile] [-m markinterval] [-p logpath]\n"); exit(1); } /* * Take a raw input line, decode the message, and print the message * on the appropriate log files. */ void printline(hname, msg) char *hname; char *msg; { int c, pri; char *p, *q, line[MAXLINE + 1]; /* test for special codes */ pri = DEFUPRI; p = msg; if (*p == '<') { pri = 0; while (isdigit(*++p)) pri = 10 * pri + (*p - '0'); if (*p == '>') ++p; } if (pri &~ (LOG_FACMASK|LOG_PRIMASK)) pri = DEFUPRI; /* don't allow users to log kernel messages */ if (LOG_FAC(pri) == LOG_KERN) pri = LOG_MAKEPRI(LOG_USER, LOG_PRI(pri)); q = line; while ((c = *p++ & 0177) != '\0' && q < &line[sizeof(line) - 1]) if (iscntrl(c)) if (c == '\n') *q++ = ' '; else if (c == '\t') *q++ = '\t'; else { *q++ = '^'; *q++ = c ^ 0100; } else *q++ = c; *q = '\0'; logmsg(pri, line, hname, 0); } /* * Take a raw input line from /dev/klog, split and format similar to syslog(). */ void printsys(msg) char *msg; { int c, pri, flags; char *lp, *p, *q, line[MAXLINE + 1]; - (void)strcpy(line, "vmunix: "); + (void)strcpy(line, "kernel: "); lp = line + strlen(line); for (p = msg; *p != '\0'; ) { flags = SYNC_FILE | ADDDATE; /* fsync file after write */ pri = DEFSPRI; if (*p == '<') { pri = 0; while (isdigit(*++p)) pri = 10 * pri + (*p - '0'); if (*p == '>') ++p; } else { /* kernel printf's come out on console */ flags |= IGN_CONS; } if (pri &~ (LOG_FACMASK|LOG_PRIMASK)) pri = DEFSPRI; q = lp; while (*p != '\0' && (c = *p++) != '\n' && q < &line[MAXLINE]) *q++ = c; *q = '\0'; logmsg(pri, line, LocalHostName, flags); } } time_t now; /* * Log a message to the appropriate log files, users, etc. based on * the priority. */ void logmsg(pri, msg, from, flags) int pri; char *msg, *from; int flags; { struct filed *f; int fac, msglen, omask, prilev; char *timestamp; dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg); omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM)); /* * Check to see if msg looks non-standard. */ msglen = strlen(msg); if (msglen < 16 || msg[3] != ' ' || msg[6] != ' ' || msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') flags |= ADDDATE; (void)time(&now); if (flags & ADDDATE) timestamp = ctime(&now) + 4; else { timestamp = msg; msg += 16; msglen -= 16; } /* extract facility and priority level */ if (flags & MARK) fac = LOG_NFACILITIES; else fac = LOG_FAC(pri); prilev = LOG_PRI(pri); /* log the message to the particular outputs */ if (!Initialized) { f = &consfile; f->f_file = open(ctty, O_WRONLY, 0); if (f->f_file >= 0) { fprintlog(f, flags, msg); (void)close(f->f_file); } (void)sigsetmask(omask); return; } for (f = Files; f; f = f->f_next) { /* skip messages that are incorrect priority */ if (f->f_pmask[fac] < prilev || f->f_pmask[fac] == INTERNAL_NOPRI) continue; if (f->f_type == F_CONSOLE && (flags & IGN_CONS)) continue; /* don't output marks to recently written files */ if ((flags & MARK) && (now - f->f_time) < MarkInterval / 2) continue; /* * suppress duplicate lines to this file */ if ((flags & MARK) == 0 && msglen == f->f_prevlen && !strcmp(msg, f->f_prevline) && !strcmp(from, f->f_prevhost)) { (void)strncpy(f->f_lasttime, timestamp, 15); f->f_prevcount++; dprintf("msg repeated %d times, %ld sec of %d\n", f->f_prevcount, now - f->f_time, repeatinterval[f->f_repeatcount]); /* * If domark would have logged this by now, * flush it now (so we don't hold isolated messages), * but back off so we'll flush less often * in the future. */ if (now > REPEATTIME(f)) { fprintlog(f, flags, (char *)NULL); BACKOFF(f); } } else { /* new line, save it */ if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); f->f_repeatcount = 0; (void)strncpy(f->f_lasttime, timestamp, 15); (void)strncpy(f->f_prevhost, from, sizeof(f->f_prevhost)); if (msglen < MAXSVLINE) { f->f_prevlen = msglen; f->f_prevpri = pri; (void)strcpy(f->f_prevline, msg); fprintlog(f, flags, (char *)NULL); } else { f->f_prevline[0] = 0; f->f_prevlen = 0; fprintlog(f, flags, msg); } } } (void)sigsetmask(omask); } void fprintlog(f, flags, msg) struct filed *f; int flags; char *msg; { struct iovec iov[6]; struct iovec *v; int l; char line[MAXLINE + 1], repbuf[80], greetings[200]; v = iov; if (f->f_type == F_WALL) { v->iov_base = greetings; v->iov_len = sprintf(greetings, "\r\n\7Message from syslogd@%s at %.24s ...\r\n", f->f_prevhost, ctime(&now)); v++; v->iov_base = ""; v->iov_len = 0; v++; } else { v->iov_base = f->f_lasttime; v->iov_len = 15; v++; v->iov_base = " "; v->iov_len = 1; v++; } v->iov_base = f->f_prevhost; v->iov_len = strlen(v->iov_base); v++; v->iov_base = " "; v->iov_len = 1; v++; if (msg) { v->iov_base = msg; v->iov_len = strlen(msg); } else if (f->f_prevcount > 1) { v->iov_base = repbuf; v->iov_len = sprintf(repbuf, "last message repeated %d times", f->f_prevcount); } else { v->iov_base = f->f_prevline; v->iov_len = f->f_prevlen; } v++; dprintf("Logging to %s", TypeNames[f->f_type]); f->f_time = now; switch (f->f_type) { case F_UNUSED: dprintf("\n"); break; case F_FORW: dprintf(" %s\n", f->f_un.f_forw.f_hname); l = sprintf(line, "<%d>%.15s %s", f->f_prevpri, iov[0].iov_base, iov[4].iov_base); if (l > MAXLINE) l = MAXLINE; if (sendto(finet, line, l, 0, (struct sockaddr *)&f->f_un.f_forw.f_addr, sizeof(f->f_un.f_forw.f_addr)) != l) { int e = errno; (void)close(f->f_file); f->f_type = F_UNUSED; errno = e; logerror("sendto"); } break; case F_CONSOLE: if (flags & IGN_CONS) { dprintf(" (ignored)\n"); break; } /* FALLTHROUGH */ case F_TTY: case F_FILE: dprintf(" %s\n", f->f_un.f_fname); if (f->f_type != F_FILE) { v->iov_base = "\r\n"; v->iov_len = 2; } else { v->iov_base = "\n"; v->iov_len = 1; } again: if (writev(f->f_file, iov, 6) < 0) { int e = errno; (void)close(f->f_file); /* * Check for errors on TTY's due to loss of tty */ if ((e == EIO || e == EBADF) && f->f_type != F_FILE) { f->f_file = open(f->f_un.f_fname, O_WRONLY|O_APPEND, 0); if (f->f_file < 0) { f->f_type = F_UNUSED; logerror(f->f_un.f_fname); } else goto again; } else { f->f_type = F_UNUSED; errno = e; logerror(f->f_un.f_fname); } } else if (flags & SYNC_FILE) (void)fsync(f->f_file); break; case F_USERS: case F_WALL: dprintf("\n"); v->iov_base = "\r\n"; v->iov_len = 2; wallmsg(f, iov); break; } f->f_prevcount = 0; } /* * WALLMSG -- Write a message to the world at large * * Write the specified message to either the entire * world, or a list of approved users. */ void wallmsg(f, iov) struct filed *f; struct iovec *iov; { static int reenter; /* avoid calling ourselves */ FILE *uf; struct utmp ut; int i; char *p; char line[sizeof(ut.ut_line) + 1]; if (reenter++) return; if ((uf = fopen(_PATH_UTMP, "r")) == NULL) { logerror(_PATH_UTMP); reenter = 0; return; } /* NOSTRICT */ while (fread((char *)&ut, sizeof(ut), 1, uf) == 1) { if (ut.ut_name[0] == '\0') continue; strncpy(line, ut.ut_line, sizeof(ut.ut_line)); line[sizeof(ut.ut_line)] = '\0'; if (f->f_type == F_WALL) { if ((p = ttymsg(iov, 6, line, 60*5)) != NULL) { errno = 0; /* already in msg */ logerror(p); } continue; } /* should we send the message to this user? */ for (i = 0; i < MAXUNAMES; i++) { if (!f->f_un.f_uname[i][0]) break; if (!strncmp(f->f_un.f_uname[i], ut.ut_name, UT_NAMESIZE)) { if ((p = ttymsg(iov, 6, line, 60*5)) != NULL) { errno = 0; /* already in msg */ logerror(p); } break; } } } (void)fclose(uf); reenter = 0; } void reapchild(signo) int signo; { union wait status; while (wait3((int *)&status, WNOHANG, (struct rusage *)NULL) > 0) ; } /* * Return a printable representation of a host address. */ char * cvthname(f) struct sockaddr_in *f; { struct hostent *hp; char *p; dprintf("cvthname(%s)\n", inet_ntoa(f->sin_addr)); if (f->sin_family != AF_INET) { dprintf("Malformed from address\n"); return ("???"); } hp = gethostbyaddr((char *)&f->sin_addr, sizeof(struct in_addr), f->sin_family); if (hp == 0) { dprintf("Host name for your address (%s) unknown\n", inet_ntoa(f->sin_addr)); return (inet_ntoa(f->sin_addr)); } if ((p = strchr(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0) *p = '\0'; return (hp->h_name); } void domark(signo) int signo; { struct filed *f; now = time((time_t *)NULL); MarkSeq += TIMERINTVL; if (MarkSeq >= MarkInterval) { logmsg(LOG_INFO, "-- MARK --", LocalHostName, ADDDATE|MARK); MarkSeq = 0; } for (f = Files; f; f = f->f_next) { if (f->f_prevcount && now >= REPEATTIME(f)) { dprintf("flush %s: repeated %d times, %d sec.\n", TypeNames[f->f_type], f->f_prevcount, repeatinterval[f->f_repeatcount]); fprintlog(f, 0, (char *)NULL); BACKOFF(f); } } (void)alarm(TIMERINTVL); } /* * Print syslogd errors some place. */ void logerror(type) char *type; { char buf[100]; if (errno) (void)snprintf(buf, sizeof(buf), "syslogd: %s: %s", type, strerror(errno)); else (void)snprintf(buf, sizeof(buf), "syslogd: %s", type); errno = 0; dprintf("%s\n", buf); logmsg(LOG_SYSLOG|LOG_ERR, buf, LocalHostName, ADDDATE); } void die(signo) int signo; { struct filed *f; char buf[100]; for (f = Files; f != NULL; f = f->f_next) { /* flush any pending output */ if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); } if (signo) { dprintf("syslogd: exiting on signal %d\n", signo); (void)sprintf(buf, "exiting on signal %d", signo); errno = 0; logerror(buf); } (void)unlink(LogName); exit(0); } /* * INIT -- Initialize syslogd from configuration table */ void init(signo) int signo; { int i; FILE *cf; struct filed *f, *next, **nextp; char *p; char cline[LINE_MAX]; dprintf("init\n"); /* * Close all open log files. */ Initialized = 0; for (f = Files; f != NULL; f = next) { /* flush any pending output */ if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); switch (f->f_type) { case F_FILE: case F_TTY: case F_CONSOLE: case F_FORW: (void)close(f->f_file); break; } next = f->f_next; free((char *)f); } Files = NULL; nextp = &Files; /* open the configuration file */ if ((cf = fopen(ConfFile, "r")) == NULL) { dprintf("cannot open %s\n", ConfFile); *nextp = (struct filed *)calloc(1, sizeof(*f)); cfline("*.ERR\t/dev/console", *nextp); (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f)); cfline("*.PANIC\t*", (*nextp)->f_next); Initialized = 1; return; } /* * Foreach line in the conf table, open that file. */ f = NULL; while (fgets(cline, sizeof(cline), cf) != NULL) { /* * check for end-of-section, comments, strip off trailing * spaces and newline character. */ for (p = cline; isspace(*p); ++p) continue; if (*p == NULL || *p == '#') continue; for (p = strchr(cline, '\0'); isspace(*--p);) continue; *++p = '\0'; f = (struct filed *)calloc(1, sizeof(*f)); *nextp = f; nextp = &f->f_next; cfline(cline, f); } /* close the configuration file */ (void)fclose(cf); Initialized = 1; if (Debug) { for (f = Files; f; f = f->f_next) { for (i = 0; i <= LOG_NFACILITIES; i++) if (f->f_pmask[i] == INTERNAL_NOPRI) printf("X "); else printf("%d ", f->f_pmask[i]); printf("%s: ", TypeNames[f->f_type]); switch (f->f_type) { case F_FILE: case F_TTY: case F_CONSOLE: printf("%s", f->f_un.f_fname); break; case F_FORW: printf("%s", f->f_un.f_forw.f_hname); break; case F_USERS: for (i = 0; i < MAXUNAMES && *f->f_un.f_uname[i]; i++) printf("%s, ", f->f_un.f_uname[i]); break; } printf("\n"); } } logmsg(LOG_SYSLOG|LOG_INFO, "syslogd: restart", LocalHostName, ADDDATE); dprintf("syslogd: restarted\n"); } /* * Crack a configuration file line */ void cfline(line, f) char *line; struct filed *f; { struct hostent *hp; int i, pri; char *bp, *p, *q; char buf[MAXLINE], ebuf[100]; dprintf("cfline(%s)\n", line); errno = 0; /* keep strerror() stuff out of logerror messages */ /* clear out file entry */ memset(f, 0, sizeof(*f)); for (i = 0; i <= LOG_NFACILITIES; i++) f->f_pmask[i] = INTERNAL_NOPRI; /* scan through the list of selectors */ for (p = line; *p && *p != '\t';) { /* find the end of this facility name list */ for (q = p; *q && *q != '\t' && *q++ != '.'; ) continue; /* collect priority name */ for (bp = buf; *q && !strchr("\t,;", *q); ) *bp++ = *q++; *bp = '\0'; /* skip cruft */ while (strchr(", ;", *q)) q++; /* decode priority name */ if (*buf == '*') pri = LOG_PRIMASK + 1; else { pri = decode(buf, prioritynames); if (pri < 0) { (void)sprintf(ebuf, "unknown priority name \"%s\"", buf); logerror(ebuf); return; } } /* scan facilities */ while (*p && !strchr("\t.;", *p)) { for (bp = buf; *p && !strchr("\t,;.", *p); ) *bp++ = *p++; *bp = '\0'; if (*buf == '*') for (i = 0; i < LOG_NFACILITIES; i++) f->f_pmask[i] = pri; else { i = decode(buf, facilitynames); if (i < 0) { (void)sprintf(ebuf, "unknown facility name \"%s\"", buf); logerror(ebuf); return; } f->f_pmask[i >> 3] = pri; } while (*p == ',' || *p == ' ') p++; } p = q; } /* skip to action part */ while (*p == '\t') p++; switch (*p) { case '@': if (!InetInuse) break; (void)strcpy(f->f_un.f_forw.f_hname, ++p); hp = gethostbyname(p); if (hp == NULL) { extern int h_errno; logerror(hstrerror(h_errno)); break; } memset(&f->f_un.f_forw.f_addr, 0, sizeof(f->f_un.f_forw.f_addr)); f->f_un.f_forw.f_addr.sin_family = AF_INET; f->f_un.f_forw.f_addr.sin_port = LogPort; memmove(&f->f_un.f_forw.f_addr.sin_addr, hp->h_addr, hp->h_length); f->f_type = F_FORW; break; case '/': (void)strcpy(f->f_un.f_fname, p); if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) { f->f_file = F_UNUSED; logerror(p); break; } if (isatty(f->f_file)) f->f_type = F_TTY; else f->f_type = F_FILE; if (strcmp(p, ctty) == 0) f->f_type = F_CONSOLE; break; case '*': f->f_type = F_WALL; break; default: for (i = 0; i < MAXUNAMES && *p; i++) { for (q = p; *q && *q != ','; ) q++; (void)strncpy(f->f_un.f_uname[i], p, UT_NAMESIZE); if ((q - p) > UT_NAMESIZE) f->f_un.f_uname[i][UT_NAMESIZE] = '\0'; else f->f_un.f_uname[i][q - p] = '\0'; while (*q == ',' || *q == ' ') q++; p = q; } f->f_type = F_USERS; break; } } /* * Decode a symbolic name to a numeric value */ int decode(name, codetab) const char *name; CODE *codetab; { CODE *c; char *p, buf[40]; if (isdigit(*name)) return (atoi(name)); for (p = buf; *name && p < &buf[sizeof(buf) - 1]; p++, name++) { if (isupper(*name)) *p = tolower(*name); else *p = *name; } *p = '\0'; for (c = codetab; c->c_name; c++) if (!strcmp(buf, c->c_name)) return (c->c_val); return (-1); } Index: head/usr.sbin/trpt/trpt.8 =================================================================== --- head/usr.sbin/trpt/trpt.8 (revision 1855) +++ head/usr.sbin/trpt/trpt.8 (revision 1856) @@ -1,151 +1,151 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)trpt.8 8.2 (Berkeley) 12/11/93 .\" .Dd December 11, 1993 .Dt TRPT 8 .Os BSD 4.2 .Sh NAME .Nm trpt .Nd transliterate protocol trace .Sh SYNOPSIS .Nm trpt .Op Fl a .Op Fl f .Op Fl j .Op Fl p Ar hex-address .Op Fl s .Op Fl t .Oo .Ar system Op Ar core .Oc .Sh DESCRIPTION .Nm Trpt interrogates the buffer of .Tn TCP trace records created when a socket is marked for .Dq debugging (see .Xr setsockopt 2 ) , and prints a readable description of these records. When no options are supplied, .Nm trpt prints all the trace records found in the system grouped according to .Tn TCP connection protocol control block .Pq Tn PCB . The following options may be used to alter this behavior. .Bl -tag -width Ds .It Fl a In addition to the normal output, print the values of the source and destination addresses for each packet recorded. .It Fl f Follow the trace as it occurs, waiting a short time for additional records each time the end of the log is reached. .It Fl j Just give a list of the protocol control block addresses for which there are trace records. .It Fl p Show only trace records associated with the protocol control block at the given address .Ar hex-address . .It Fl s In addition to the normal output, print a detailed description of the packet sequencing information. .It Fl t in addition to the normal output, print the values for all timers at each point in the trace. .El .Pp The recommended use of .Nm trpt is as follows. Isolate the problem and enable debugging on the socket(s) involved in the connection. Find the address of the protocol control blocks associated with the sockets using the .Fl A option to .Xr netstat 1 . Then run .Nm trpt with the .Fl p option, supplying the associated protocol control block addresses. The .Fl f option can be used to follow the trace log once the trace is located. If there are many sockets using the debugging option, the .Fl j option may be useful in checking to see if any trace records are present for the socket in question. .Pp If debugging is being performed on a system or core file other than the default, the last two arguments may be used to supplant the defaults. .Sh FILES .Bl -tag -width /dev/kmem -compact -.It Pa /vmunix +.It Pa /kernel .It Pa /dev/kmem .El .Sh SEE ALSO .Xr netstat 1 , .Xr setsockopt 2 , .Xr trsp 8 .Sh DIAGNOSTICS .Bl -tag -width Ds .It Sy no namelist When the system image doesn't contain the proper symbols to find the trace buffer; others which should be self explanatory. .El .Sh BUGS Should also print the data for each input or output, but this is not saved in the race record. .Pp The output format is inscrutable and should be described here. .Sh HISTORY The .Nm command appeared in .Bx 4.2 . Index: head/usr.sbin/trsp/trsp.8 =================================================================== --- head/usr.sbin/trsp/trsp.8 (revision 1855) +++ head/usr.sbin/trsp/trsp.8 (revision 1856) @@ -1,141 +1,141 @@ .\" Copyright (c) 1985, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)trsp.8 8.1 (Berkeley) 6/6/93 .\" .Dd June 6, 1993 .Dt TRSP 8 .Os BSD 4.2 .Sh NAME .Nm trsp .Nd transliterate sequenced packet protocol trace .Sh SYNOPSIS .Nm trsp .Op Fl a .Op Fl s .Op Fl t .Op Fl j .Op Fl p Ar hex-address .Oo .Ar system Op Ar core .Oc .Sh DESCRIPTION .Xr Trpt interrogates the buffer of .Tn SPP trace records created when a socket is marked for .Dq debugging (see .Xr setsockopt 2 ) , and prints a readable description of these records. When no options are supplied, .Nm trsp prints all the trace records found in the system grouped according to .Tn SPP connection protocol control block .Pq Tn PCB . The following options may be used to alter this behavior. .Bl -tag -width Ds .It Fl a In addition to the normal output, print the values of the source and destination addresses for each packet recorded. .It Fl j Just give a list of the protocol control block addresses for which there are trace records. .It Fl p Show only trace records associated with the protocol control block at the given address, .Ar hex-address . .It Fl s in addition to the normal output, print a detailed description of the packet sequencing information. .It Fl t in addition to the normal output, print the values for all timers at each point in the trace, .El .Pp The recommended use of .Nm trsp is as follows. Isolate the problem and enable debugging on the socket(s) involved in the connection. Find the address of the protocol control blocks associated with the sockets using the .Fl A option to .Xr netstat 1 . Then run .Nm trsp with the .Fl p option, supplying the associated protocol control block addresses. If there are many sockets using the debugging option, the .Fl j option may be useful in checking to see if any trace records are present for the socket in question. .Pp If debugging is being performed on a system or core file other than the default, the last two arguments may be used to supplant the defaults. .Sh FILES .Bl -tag -width /dev/kmem -compact -.It Pa /vmunix +.It Pa /kernel .It Pa /dev/kmem .El .Sh SEE ALSO .Xr netstat 1 , .Xr setsockopt 2 .Sh DIAGNOSTICS .Bl -tag -width Ds .It Sy no namelist When the system image doesn't contain the proper symbols to find the trace buffer; others which should be self explanatory. .Sh BUGS Should also print the data for each input or output, but this is not saved in the race record. .Pp The output format is inscrutable and should be described here. .Sh HISTORY The .Nm command appeared in .Bx 4.3 .